CompositeConfiguration implements SecurityConfiguration { @NotNull @Override public ConfigurationParameters getParameters() { List<T> configs = getConfigurations(); ConfigurationParameters[] params = new ConfigurationParameters[configs.size()]; for (int i = 0; i < configs.size(); i++) { params[i] = configs.get(i).getParameters(); } return ConfigurationParameters.of(params); } CompositeConfiguration(@NotNull String name);  CompositeConfiguration(@NotNull String name, @NotNull SecurityProvider securityProvider); @Nullable T getDefaultConfig(); void setDefaultConfig(@NotNull T defaultConfig); void addConfiguration(@NotNull T configuration); void addConfiguration(@NotNull T configuration, @NotNull ConfigurationParameters params); void removeConfiguration(@NotNull T configuration); @NotNull List<T> getConfigurations(); void setSecurityProvider(@NotNull SecurityProvider securityProvider); void setRootProvider(@NotNull RootProvider rootProvider); void setTreeProvider(@NotNull TreeProvider treeProvider); @NotNull @Override String getName(); @NotNull @Override ConfigurationParameters getParameters(); @NotNull @Override WorkspaceInitializer getWorkspaceInitializer(); @NotNull @Override RepositoryInitializer getRepositoryInitializer(); @NotNull @Override List<? extends CommitHook> getCommitHooks(@NotNull final String workspaceName); @NotNull @Override List<? extends ValidatorProvider> getValidators(@NotNull final String workspaceName, @NotNull final Set<Principal> principals, @NotNull final MoveTracker moveTracker); @NotNull @Override List<ThreeWayConflictHandler> getConflictHandlers(); @NotNull @Override List<ProtectedItemImporter> getProtectedItemImporters(); @NotNull @Override Context getContext(); static final String PARAM_RANKING; }
@Test public void testGetParameters() { assertSame(ConfigurationParameters.EMPTY, compositeConfiguration.getParameters()); addConfiguration(new SecurityConfiguration.Default()); assertSame(ConfigurationParameters.EMPTY, compositeConfiguration.getParameters()); ConfigurationParameters params = ConfigurationParameters.of("a", "valueA", "b", "valueB"); SecurityConfiguration withParams = new SecurityConfiguration.Default() { @NotNull @Override public ConfigurationParameters getParameters() { return params; } }; addConfiguration(withParams); assertEquals(ImmutableSet.copyOf(params.keySet()), ImmutableSet.copyOf(compositeConfiguration.getParameters().keySet())); ConfigurationParameters params2 = ConfigurationParameters.of("a", "valueA2", "c", "valueC"); SecurityConfiguration withParams2 = new SecurityConfiguration.Default() { @NotNull @Override public ConfigurationParameters getParameters() { return params2; } }; addConfiguration(withParams2); ConfigurationParameters compositeParams = compositeConfiguration.getParameters(); assertEquals(3, compositeParams.size()); assertEquals(ImmutableSet.copyOf(ConfigurationParameters.of(params, params2).keySet()), ImmutableSet.copyOf(compositeParams.keySet())); assertEquals("valueA2", compositeParams.getConfigValue("a", "def")); }