@Test @SuppressWarnings("unchecked") public void shouldAddMultipleEntriesToParameterInOneTransactionAndInvalidateCacheForThisParameter() { List<MapEntry> entries = Arrays.asList(new MapEntry()); paramEditor.addEntries(REPOSITORY_NAME, "parameter", entries); verify(editableRepository).addEntries(eq("parameter"), anyCollection()); verify(cache).invalidate("parameter"); }
@Override public DescribedCollection<ParameterEntryKey> addEntries(RepositoryName in, String parameterName, Iterable<MapEntry> entries) { EditableParamRepository repository = repositories.get(in); List<ParameterEntryKey> addedEntryKeys = repository.addEntries(parameterName, convert(repository, entries, parameterName)); clearCache(parameterName); return new DescribedCollection<ParameterEntryKey>(in, addedEntryKeys); }
BasicParamEditor implements ParamEditor { @Override public DescribedCollection<ParameterEntryKey> addEntries(RepositoryName in, String parameterName, Iterable<MapEntry> entries) { EditableParamRepository repository = repositories.get(in); List<ParameterEntryKey> addedEntryKeys = repository.addEntries(parameterName, convert(repository, entries, parameterName)); clearCache(parameterName); return new DescribedCollection<ParameterEntryKey>(in, addedEntryKeys); } }
BasicParamEditor implements ParamEditor { @Override public DescribedCollection<ParameterEntryKey> addEntries(RepositoryName in, String parameterName, Iterable<MapEntry> entries) { EditableParamRepository repository = repositories.get(in); List<ParameterEntryKey> addedEntryKeys = repository.addEntries(parameterName, convert(repository, entries, parameterName)); clearCache(parameterName); return new DescribedCollection<ParameterEntryKey>(in, addedEntryKeys); } BasicParamEditor(ParamEngine paramEngine, ParameterEntryMapConverter entryMapConverter); }
BasicParamEditor implements ParamEditor { @Override public DescribedCollection<ParameterEntryKey> addEntries(RepositoryName in, String parameterName, Iterable<MapEntry> entries) { EditableParamRepository repository = repositories.get(in); List<ParameterEntryKey> addedEntryKeys = repository.addEntries(parameterName, convert(repository, entries, parameterName)); clearCache(parameterName); return new DescribedCollection<ParameterEntryKey>(in, addedEntryKeys); } BasicParamEditor(ParamEngine paramEngine, ParameterEntryMapConverter entryMapConverter); @Override List<RepositoryName> repositories(); @Override ParameterKey createParameter(RepositoryName in, Parameter parameter); @Override void updateParameter(RepositoryName in, String parameterName, Parameter parameter); @Override void deleteParameter(RepositoryName in, String parameterName); @Override DescribedEntity<LevelKey> addLevel(RepositoryName in, String parameterName, Level level); @Override void reorderLevels(RepositoryName in, String parameterName, List<LevelKey> orderedLevels); @Override void updateLevel(RepositoryName in, String parameterName, LevelKey levelKey, Level level); @Override void deleteLevel(RepositoryName in, String parameterName, LevelKey levelKey); @Override DescribedEntity<ParameterEntryKey> addEntry(RepositoryName in, String parameterName, MapEntry entryMap); @Override DescribedCollection<ParameterEntryKey> addEntries(RepositoryName in, String parameterName, Iterable<MapEntry> entries); @Override void updateEntry(RepositoryName in, String parameterName, ParameterEntryKey entryKey, MapEntry entryMap); @Override void deleteEntry(RepositoryName in, String parameterName, ParameterEntryKey entryKey); @Override void deleteEntries(RepositoryName in, String parameterName, Iterable<ParameterEntryKey> entryKeys); @Override void deleteEntries(RepositoryName in, String parameterName); @Override MapEntry normalize(Parameter metadata, MapEntry denormalizedEntry); @Override List<MapEntry> normalize(Parameter metadata, Iterable<MapEntry> denormalizedEntries); }
BasicParamEditor implements ParamEditor { @Override public DescribedCollection<ParameterEntryKey> addEntries(RepositoryName in, String parameterName, Iterable<MapEntry> entries) { EditableParamRepository repository = repositories.get(in); List<ParameterEntryKey> addedEntryKeys = repository.addEntries(parameterName, convert(repository, entries, parameterName)); clearCache(parameterName); return new DescribedCollection<ParameterEntryKey>(in, addedEntryKeys); } BasicParamEditor(ParamEngine paramEngine, ParameterEntryMapConverter entryMapConverter); @Override List<RepositoryName> repositories(); @Override ParameterKey createParameter(RepositoryName in, Parameter parameter); @Override void updateParameter(RepositoryName in, String parameterName, Parameter parameter); @Override void deleteParameter(RepositoryName in, String parameterName); @Override DescribedEntity<LevelKey> addLevel(RepositoryName in, String parameterName, Level level); @Override void reorderLevels(RepositoryName in, String parameterName, List<LevelKey> orderedLevels); @Override void updateLevel(RepositoryName in, String parameterName, LevelKey levelKey, Level level); @Override void deleteLevel(RepositoryName in, String parameterName, LevelKey levelKey); @Override DescribedEntity<ParameterEntryKey> addEntry(RepositoryName in, String parameterName, MapEntry entryMap); @Override DescribedCollection<ParameterEntryKey> addEntries(RepositoryName in, String parameterName, Iterable<MapEntry> entries); @Override void updateEntry(RepositoryName in, String parameterName, ParameterEntryKey entryKey, MapEntry entryMap); @Override void deleteEntry(RepositoryName in, String parameterName, ParameterEntryKey entryKey); @Override void deleteEntries(RepositoryName in, String parameterName, Iterable<ParameterEntryKey> entryKeys); @Override void deleteEntries(RepositoryName in, String parameterName); @Override MapEntry normalize(Parameter metadata, MapEntry denormalizedEntry); @Override List<MapEntry> normalize(Parameter metadata, Iterable<MapEntry> denormalizedEntries);  }