@Test public void testGetEntity() throws Exception { String serviceName = "xreGuide"; Whitelisted currentWhitelist = new Whitelisted(); currentWhitelist.setPaths(new ArrayList<String>() {{ add("/P0/1.55"); add("/P1/3.44"); }}); when(whiteListService.getWhitelistedStacks(serviceName)).thenReturn(currentWhitelist); PendingChangesStatus pendingChangesStatus = new PendingChangesStatus(); Map<String, PendingChange> whitelistedChanges = new HashMap<>(); PendingChangesHelper.putPendingChange(whitelistedChanges, Integer.toString("/P0/3.355".hashCode()), new Value("/P0/3.355"), null, ActionType.ADD); PendingChangesHelper.putPendingChange(whitelistedChanges, Integer.toString("/P2/3.22".hashCode()), new Value("/P2/3.22"), null, ActionType.ADD); PendingChangesHelper.putPendingChange(whitelistedChanges, Integer.toString("/P1/3.44".hashCode()), null, new Value("/P1/3.44"), ActionType.DELETE); pendingChangesStatus.setWhitelisted(whitelistedChanges); when(changesStatusService.getPendingChangesStatus(serviceName)).thenReturn(pendingChangesStatus); Whitelisted whitelisted = testee.getEntity(serviceName); Assert.assertEquals("/P0/1.55", whitelisted.getPaths().get(0)); Assert.assertEquals("/P2/3.22", whitelisted.getPaths().get(1)); Assert.assertEquals("/P0/3.355", whitelisted.getPaths().get(2)); }
@Override public Whitelisted getEntity(String serviceName) { PendingChangesStatus pendingChangesStatus = changesStatusService.getPendingChangesStatus(serviceName); return getWhitelistedPendingPreview(serviceName, pendingChangesStatus); }
NextWhitelistedEntityViewService implements IEntityViewService<Whitelisted> { @Override public Whitelisted getEntity(String serviceName) { PendingChangesStatus pendingChangesStatus = changesStatusService.getPendingChangesStatus(serviceName); return getWhitelistedPendingPreview(serviceName, pendingChangesStatus); } }
NextWhitelistedEntityViewService implements IEntityViewService<Whitelisted> { @Override public Whitelisted getEntity(String serviceName) { PendingChangesStatus pendingChangesStatus = changesStatusService.getPendingChangesStatus(serviceName); return getWhitelistedPendingPreview(serviceName, pendingChangesStatus); }  }
NextWhitelistedEntityViewService implements IEntityViewService<Whitelisted> { @Override public Whitelisted getEntity(String serviceName) { PendingChangesStatus pendingChangesStatus = changesStatusService.getPendingChangesStatus(serviceName); return getWhitelistedPendingPreview(serviceName, pendingChangesStatus); }  @Override Whitelisted getEntity(String serviceName); @Override Whitelisted getEntity(PendingChangesStatus pendingChangesStatus, Whitelisted currentEntity); void setChangesStatusService(IChangesStatusService changesStatusService); }
NextWhitelistedEntityViewService implements IEntityViewService<Whitelisted> { @Override public Whitelisted getEntity(String serviceName) { PendingChangesStatus pendingChangesStatus = changesStatusService.getPendingChangesStatus(serviceName); return getWhitelistedPendingPreview(serviceName, pendingChangesStatus); }  @Override Whitelisted getEntity(String serviceName); @Override Whitelisted getEntity(PendingChangesStatus pendingChangesStatus, Whitelisted currentEntity); void setChangesStatusService(IChangesStatusService changesStatusService);  }