ConfigCenter { public Authentication loadAuthentication() { return hasAuthentication() ? new AuthenticationYamlSwapper().swapToObject(YamlEngine.unmarshal(repository.get(node.getAuthenticationPath()), YamlAuthenticationConfiguration.class)) : new Authentication(); } ConfigCenter(final ConfigurationRepository repository); void persistConfigurations(final String schemaName, final Map<String, DataSourceConfiguration> dataSourceConfigs,
                                      final Collection<RuleConfiguration> ruleConfigurations, final boolean isOverwrite); void persistGlobalConfiguration(final Authentication authentication, final Properties props, final boolean isOverwrite); @Subscribe synchronized void renew(final DataSourcePersistEvent event); @Subscribe synchronized void renew(final RulePersistEvent event); @Subscribe synchronized void renew(final SchemaNamePersistEvent event); @Subscribe synchronized void renew(final MetaDataPersistEvent event); Map<String, DataSourceConfiguration> loadDataSourceConfigurations(final String schemaName); Collection<RuleConfiguration> loadRuleConfigurations(final String schemaName); Authentication loadAuthentication(); Properties loadProperties(); Collection<String> getAllSchemaNames(); boolean hasRuleConfiguration(final String schemaName); boolean hasDataSourceConfiguration(final String schemaName); void persistMetaData(final String schemaName, final RuleSchemaMetaData ruleSchemaMetaData); Optional<RuleSchemaMetaData> loadMetaData(final String schemaName); void deleteSchema(final String schemaName);  }
@Test public void assertLoadAuthentication() { when(configurationRepository.get("/authentication")).thenReturn(readYAML(AUTHENTICATION_YAML)); ConfigCenter configCenter = new ConfigCenter(configurationRepository); Authentication actual = configCenter.loadAuthentication(); assertThat(actual.getUsers().size(), is(2)); assertThat(actual.getUsers().get("root1").getPassword(), is("root1")); }