@Test public void canCreateConfigurations() { File testStorePropertiesFile = new File(temporaryFolder.getRoot(), "config-store.properties"); assertThat(testStorePropertiesFile.exists(), is(false)); underTest.save(newDataStoreConfiguration("config")); assertThat(testStorePropertiesFile.exists(), is(true)); }
@Override public void save(final DataStoreConfiguration configuration) { String storeName = configuration.getName(); checkName(storeName); PropertiesFile storeProperties = findStoreProperties(storeName); synchronized (storeProperties) { storeProperties.setProperty(NAME_KEY, storeName); storeProperties.setProperty(TYPE_KEY, configuration.getType()); storeProperties.putAll(configuration.getAttributes()); try { storeProperties.store(); } catch (IOException e) { throw new UncheckedIOException(e); } } }
DataStoreConfigurationLocalSource extends ComponentSupport implements DataStoreConfigurationSource { @Override public void save(final DataStoreConfiguration configuration) { String storeName = configuration.getName(); checkName(storeName); PropertiesFile storeProperties = findStoreProperties(storeName); synchronized (storeProperties) { storeProperties.setProperty(NAME_KEY, storeName); storeProperties.setProperty(TYPE_KEY, configuration.getType()); storeProperties.putAll(configuration.getAttributes()); try { storeProperties.store(); } catch (IOException e) { throw new UncheckedIOException(e); } } } }
DataStoreConfigurationLocalSource extends ComponentSupport implements DataStoreConfigurationSource { @Override public void save(final DataStoreConfiguration configuration) { String storeName = configuration.getName(); checkName(storeName); PropertiesFile storeProperties = findStoreProperties(storeName); synchronized (storeProperties) { storeProperties.setProperty(NAME_KEY, storeName); storeProperties.setProperty(TYPE_KEY, configuration.getType()); storeProperties.putAll(configuration.getAttributes()); try { storeProperties.store(); } catch (IOException e) { throw new UncheckedIOException(e); } } } @Inject  DataStoreConfigurationLocalSource(final ApplicationDirectories directories); }
DataStoreConfigurationLocalSource extends ComponentSupport implements DataStoreConfigurationSource { @Override public void save(final DataStoreConfiguration configuration) { String storeName = configuration.getName(); checkName(storeName); PropertiesFile storeProperties = findStoreProperties(storeName); synchronized (storeProperties) { storeProperties.setProperty(NAME_KEY, storeName); storeProperties.setProperty(TYPE_KEY, configuration.getType()); storeProperties.putAll(configuration.getAttributes()); try { storeProperties.store(); } catch (IOException e) { throw new UncheckedIOException(e); } } } @Inject  DataStoreConfigurationLocalSource(final ApplicationDirectories directories); @Override String getName(); @Override boolean isModifiable(); @Override Iterable<String> browseStoreNames(); @Override DataStoreConfiguration load(final String storeName); @Override void save(final DataStoreConfiguration configuration); @Override void delete(final DataStoreConfiguration configuration); }
DataStoreConfigurationLocalSource extends ComponentSupport implements DataStoreConfigurationSource { @Override public void save(final DataStoreConfiguration configuration) { String storeName = configuration.getName(); checkName(storeName); PropertiesFile storeProperties = findStoreProperties(storeName); synchronized (storeProperties) { storeProperties.setProperty(NAME_KEY, storeName); storeProperties.setProperty(TYPE_KEY, configuration.getType()); storeProperties.putAll(configuration.getAttributes()); try { storeProperties.store(); } catch (IOException e) { throw new UncheckedIOException(e); } } } @Inject  DataStoreConfigurationLocalSource(final ApplicationDirectories directories); @Override String getName(); @Override boolean isModifiable(); @Override Iterable<String> browseStoreNames(); @Override DataStoreConfiguration load(final String storeName); @Override void save(final DataStoreConfiguration configuration); @Override void delete(final DataStoreConfiguration configuration);  }