StandardTransferer implements Transferer { @Override public void transfer(TransferConfig config, ParamRepository source, WritableParamRepository target) { long startTime = System.currentTimeMillis(); logger.info("starting transfer from repository {} to repository {}", source.getClass().getSimpleName(), target.getClass().getSimpleName()); SortedParameters sortedParameters = sorter.sort(source.listParameters(), target.listParameters()); runTransferOperations(sortedParameters, config, source, target); long endTime = System.currentTimeMillis(); logger.info("done transfering parameters, took {}ms", endTime - startTime); } StandardTransferer(ParameterSorter sorter, Map<TransferOperationType, TransferOperation> operations); @Override void transfer(TransferConfig config, ParamRepository source, WritableParamRepository target);  }
@Test public void shouldRunTransferOperationsOnlyForChosenOperations() { TransferConfig config = new TransferConfig(TransferOperationType.CREATE); SortedParameters sortedParameters = sortedParameters().with(TransferOperationType.CREATE, "create").build(); when(sorter.sort(anySetOf(String.class), anySetOf(String.class))).thenReturn(sortedParameters); standardTransferer.transfer(config, mock(ParamRepository.class), mock(WritableParamRepository.class)); verify(operations.get(TransferOperationType.CREATE), times(1)).run(eq("create"), any(ParamRepository.class), any(WritableParamRepository.class)); verify(operations.get(TransferOperationType.DELETE), never()).run(anyString(), any(ParamRepository.class), any(WritableParamRepository.class)); verify(operations.get(TransferOperationType.OVERRIDE), never()).run(anyString(), any(ParamRepository.class), any(WritableParamRepository.class)); }