@Test public void testGetEntity() throws Exception { String serviceName = "xreGuide"; Distribution distribution = new Distribution(); distribution.setDefaultServer(ServerHelper.prepareServer(RedirectorConstants.DEFAULT_SERVER_NAME, "NewDefaultFlavor")); SelectServer expectedSelectServer = RulesUtils.buildSelectServer( prepareSimpleFlavorRules(new HashMap<Expressions, String>() {{ put(new Equals("mac", "receiverMacAddress1"), "rule2-flavor"); }}), distribution ); Collection<IfExpression> rules = prepareSimpleFlavorRules(new HashMap<Expressions, String>() {{ put(new Equals("receiverType", "Native"), "rule1-flavor"); put(new Equals("mac", "receiverMacAddress"), "rule2-flavor"); }}); SelectServer currentSelectServer = new SelectServer(); PendingChangesStatus pendingChangesStatus = getPendingChangesStatus(); currentSelectServer.setItems(rules); currentSelectServer.setDistribution(distribution); when(flavorRulesService.getAllRules(serviceName)).thenReturn(currentSelectServer); when(changesStatusService.getPendingChangesStatus(serviceName)).thenReturn(pendingChangesStatus); SelectServer selectServer = testee.getEntity(serviceName); verifyRuleExpressionsEqual(expectedSelectServer.getItems(), selectServer.getItems()); assertEquals(expectedSelectServer.getDistribution(), selectServer.getDistribution()); }
@Override public SelectServer getEntity(String serviceName) { PendingChangesStatus pendingChanges = changesStatusService.getPendingChangesStatus(serviceName); SelectServer rules = flavorRulesService.getAllRules(serviceName); return getEntity(pendingChanges, rules); }
NextFlavorRulesEntityViewService implements IEntityViewService<SelectServer> { @Override public SelectServer getEntity(String serviceName) { PendingChangesStatus pendingChanges = changesStatusService.getPendingChangesStatus(serviceName); SelectServer rules = flavorRulesService.getAllRules(serviceName); return getEntity(pendingChanges, rules); } }
NextFlavorRulesEntityViewService implements IEntityViewService<SelectServer> { @Override public SelectServer getEntity(String serviceName) { PendingChangesStatus pendingChanges = changesStatusService.getPendingChangesStatus(serviceName); SelectServer rules = flavorRulesService.getAllRules(serviceName); return getEntity(pendingChanges, rules); }  }
NextFlavorRulesEntityViewService implements IEntityViewService<SelectServer> { @Override public SelectServer getEntity(String serviceName) { PendingChangesStatus pendingChanges = changesStatusService.getPendingChangesStatus(serviceName); SelectServer rules = flavorRulesService.getAllRules(serviceName); return getEntity(pendingChanges, rules); }  @Override SelectServer getEntity(String serviceName); @Override SelectServer getEntity(PendingChangesStatus pendingChangesStatus, SelectServer currentEntity); }
NextFlavorRulesEntityViewService implements IEntityViewService<SelectServer> { @Override public SelectServer getEntity(String serviceName) { PendingChangesStatus pendingChanges = changesStatusService.getPendingChangesStatus(serviceName); SelectServer rules = flavorRulesService.getAllRules(serviceName); return getEntity(pendingChanges, rules); }  @Override SelectServer getEntity(String serviceName); @Override SelectServer getEntity(PendingChangesStatus pendingChangesStatus, SelectServer currentEntity);  }