@Test public void configDeletedFromOriginalSource() { DataStoreConfigurationSource sourceA = mock(DataStoreConfigurationSource.class); DataStoreConfigurationSource sourceB = mock(DataStoreConfigurationSource.class); DataStoreConfigurationSource sourceC = mock(DataStoreConfigurationSource.class); InOrder expected = inOrder(sourceA, sourceB, sourceC); DataStoreConfiguration testConfig = newDataStoreConfiguration("sample", "B"); try { underTest.delete(testConfig); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), containsString("refers to a missing source")); } when(configurationSources.get("B")).thenReturn(sourceB); try { underTest.delete(testConfig); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), containsString("is from a read-only source")); } when(sourceB.isModifiable()).thenReturn(true); underTest.delete(testConfig); expected.verify(sourceB).delete(testConfig); expected.verifyNoMoreInteractions(); }
public void delete(final DataStoreConfiguration configuration) { findModifiableSource(configuration).delete(configuration); }
DataStoreConfigurationManager extends ComponentSupport { public void delete(final DataStoreConfiguration configuration) { findModifiableSource(configuration).delete(configuration); } }
DataStoreConfigurationManager extends ComponentSupport { public void delete(final DataStoreConfiguration configuration) { findModifiableSource(configuration).delete(configuration); } @Inject  DataStoreConfigurationManager(final Map<String, DataStoreConfigurationSource> configurationSources); }
DataStoreConfigurationManager extends ComponentSupport { public void delete(final DataStoreConfiguration configuration) { findModifiableSource(configuration).delete(configuration); } @Inject  DataStoreConfigurationManager(final Map<String, DataStoreConfigurationSource> configurationSources); Iterable<DataStoreConfiguration> load(); void save(final DataStoreConfiguration configuration); void delete(final DataStoreConfiguration configuration); }
DataStoreConfigurationManager extends ComponentSupport { public void delete(final DataStoreConfiguration configuration) { findModifiableSource(configuration).delete(configuration); } @Inject  DataStoreConfigurationManager(final Map<String, DataStoreConfigurationSource> configurationSources); Iterable<DataStoreConfiguration> load(); void save(final DataStoreConfiguration configuration); void delete(final DataStoreConfiguration configuration);  }