@Test public void testDeleteAllOccurences() { persister.saveConfiguration(testConfig); final ComplexConfigDTO dto = createTestConfigDTO(createDummyScope("b")); persister.saveConfiguration(dto); persister.deleteAllOccurences("a", EMPTY_MAP); final Collection<ScopePath> scopes = persister.listScopes("b", EMPTY_MAP); assertEquals(dto.getDefiningScopePath(), scopes.iterator().next()); assertEquals(0, persister.listScopes("a", EMPTY_MAP).size()); }
@Override public void deleteAllOccurences(final String scopeName, final Map<String, String> properties) { for (final Iterator<ScopePath> it = savedObjects.keySet().iterator(); it.hasNext();) { final ScopePath tmpScopePath = it.next(); for (final Scope tmpScope : tmpScopePath.getScopes()) { if (tmpScope.getName().equals(scopeName)) { if (tmpScope.containsAllProperties(properties)) { it.remove(); } } } } }
InMemoryPersister implements ConfigPersister { @Override public void deleteAllOccurences(final String scopeName, final Map<String, String> properties) { for (final Iterator<ScopePath> it = savedObjects.keySet().iterator(); it.hasNext();) { final ScopePath tmpScopePath = it.next(); for (final Scope tmpScope : tmpScopePath.getScopes()) { if (tmpScope.getName().equals(scopeName)) { if (tmpScope.containsAllProperties(properties)) { it.remove(); } } } } } }
InMemoryPersister implements ConfigPersister { @Override public void deleteAllOccurences(final String scopeName, final Map<String, String> properties) { for (final Iterator<ScopePath> it = savedObjects.keySet().iterator(); it.hasNext();) { final ScopePath tmpScopePath = it.next(); for (final Scope tmpScope : tmpScopePath.getScopes()) { if (tmpScope.getName().equals(scopeName)) { if (tmpScope.containsAllProperties(properties)) { it.remove(); } } } } } InMemoryPersister(); }
InMemoryPersister implements ConfigPersister { @Override public void deleteAllOccurences(final String scopeName, final Map<String, String> properties) { for (final Iterator<ScopePath> it = savedObjects.keySet().iterator(); it.hasNext();) { final ScopePath tmpScopePath = it.next(); for (final Scope tmpScope : tmpScopePath.getScopes()) { if (tmpScope.getName().equals(scopeName)) { if (tmpScope.containsAllProperties(properties)) { it.remove(); } } } } } InMemoryPersister(); @Override void saveConfiguration(final ComplexConfigDTO configDTO); @Override ComplexConfigDTO loadConfiguration(final ScopePath scopePath); @Override void updateConfiguration(final ComplexConfigDTO configDTO); @Override String getId(); @Override Collection<ScopePath> listScopes(final String scopeName, final Map<String, String> properties); @Override void delete(final ScopePath scopePath, final boolean deleteChildren); @Override void deleteAllOccurences(final String scopeName, final Map<String, String> properties); }
InMemoryPersister implements ConfigPersister { @Override public void deleteAllOccurences(final String scopeName, final Map<String, String> properties) { for (final Iterator<ScopePath> it = savedObjects.keySet().iterator(); it.hasNext();) { final ScopePath tmpScopePath = it.next(); for (final Scope tmpScope : tmpScopePath.getScopes()) { if (tmpScope.getName().equals(scopeName)) { if (tmpScope.containsAllProperties(properties)) { it.remove(); } } } } } InMemoryPersister(); @Override void saveConfiguration(final ComplexConfigDTO configDTO); @Override ComplexConfigDTO loadConfiguration(final ScopePath scopePath); @Override void updateConfiguration(final ComplexConfigDTO configDTO); @Override String getId(); @Override Collection<ScopePath> listScopes(final String scopeName, final Map<String, String> properties); @Override void delete(final ScopePath scopePath, final boolean deleteChildren); @Override void deleteAllOccurences(final String scopeName, final Map<String, String> properties); static final String ID; }