@Test public void testGetEntity() throws Exception { String serviceName = "xreGuide"; DistributionBuilder builder = new DistributionBuilder(); Distribution currentDistribution = builder. withRule(newDistributionRule(0, 10f, newSimpleServerForFlavor("1.40"))). withRule(newDistributionRule(1, 20f, newSimpleServerForFlavor("1.41"))). withRule(newDistributionRule(2, 30f, newSimpleServerForFlavor("1.42"))). build(); when(distributionService.getDistribution(serviceName)).thenReturn(currentDistribution); PendingChangesStatus pendingChangesStatus = new PendingChangesStatus(); Map<String, PendingChange> distributionChanges = new HashMap<>(); PendingChangesHelper.putDistributionChange(distributionChanges, 0, 10.0f, "1.40", ActionType.DELETE); PendingChangesHelper.putDistributionChange(distributionChanges, 1, 15.0f, "1.40-SNAPSHOT", ActionType.UPDATE); PendingChangesHelper.putDistributionChange(distributionChanges, 3, 35.0f, "1.44", ActionType.ADD); pendingChangesStatus.setDistributions(distributionChanges); when(changesStatusService.getPendingChangesStatus(serviceName)).thenReturn(pendingChangesStatus); Distribution distribution = testee.getEntity(serviceName); verifyRulesAreEqual(getRule(0, 15.0f, "1.40-SNAPSHOT"), distribution.getRules().get(0)); verifyRulesAreEqual(getRule(1, 30.0f, "1.42"), distribution.getRules().get(1)); verifyRulesAreEqual(getRule(2, 35.0f, "1.44"), distribution.getRules().get(2)); }
@Override public Distribution getEntity(String serviceName) { PendingChangesStatus pendingChangesStatus = changesStatusService.getPendingChangesStatus(serviceName); return getDistributionPendingPreview(serviceName, pendingChangesStatus); }
NextDistributionEntityViewService implements IEntityViewService<Distribution> { @Override public Distribution getEntity(String serviceName) { PendingChangesStatus pendingChangesStatus = changesStatusService.getPendingChangesStatus(serviceName); return getDistributionPendingPreview(serviceName, pendingChangesStatus); } }
NextDistributionEntityViewService implements IEntityViewService<Distribution> { @Override public Distribution getEntity(String serviceName) { PendingChangesStatus pendingChangesStatus = changesStatusService.getPendingChangesStatus(serviceName); return getDistributionPendingPreview(serviceName, pendingChangesStatus); }  }
NextDistributionEntityViewService implements IEntityViewService<Distribution> { @Override public Distribution getEntity(String serviceName) { PendingChangesStatus pendingChangesStatus = changesStatusService.getPendingChangesStatus(serviceName); return getDistributionPendingPreview(serviceName, pendingChangesStatus); }  @Override Distribution getEntity(String serviceName); @Override Distribution getEntity(PendingChangesStatus pendingChangesStatus, Distribution currentDistribution); void setChangesStatusService(IChangesStatusService changesStatusService); }
NextDistributionEntityViewService implements IEntityViewService<Distribution> { @Override public Distribution getEntity(String serviceName) { PendingChangesStatus pendingChangesStatus = changesStatusService.getPendingChangesStatus(serviceName); return getDistributionPendingPreview(serviceName, pendingChangesStatus); }  @Override Distribution getEntity(String serviceName); @Override Distribution getEntity(PendingChangesStatus pendingChangesStatus, Distribution currentDistribution); void setChangesStatusService(IChangesStatusService changesStatusService);  }