@Test public void testFromApplicationMoreNullTest() { Application application1 = new Application(); application1.setHref("href"); application1.setId(1); application1.setName("name"); ApplicationManagerMessage amMessage = MessageCreator.fromApplication(application1); assertEquals("name", amMessage.getApplicationId()); Application application2 = new Application(); application2.setHref("href"); application2.setId(1); application2.setName("name"); List<Link> links = new ArrayList<Link>(); application2.setLinks(links); List<Deployment> deployments = new ArrayList<Deployment>(); application2.setDeployments(deployments); amMessage = MessageCreator.fromApplication(application2); assertEquals("name", amMessage.getApplicationId()); Application application3 = new Application(); application3.setHref("href"); application3.setId(1); application3.setName("name"); application3.setDeployments(null); amMessage = MessageCreator.fromApplication(application3); assertEquals("name", amMessage.getApplicationId()); Application application4 = new Application(); application4.setHref("href"); application4.setId(1); application4.setName("name"); List<Deployment> deployments4 = new ArrayList<Deployment>(); application4.setDeployments(deployments4); Deployment deployment4 = new Deployment(); deployment4.setId(11); deployment4.setHref("href"); deployment4.setPrice("provider-id"); deployment4.setStatus("STATUS"); deployment4.setStartDate("aaa"); deployment4.setEndDate("bbb"); deployment4.setVms(null); deployments4.add(deployment4); amMessage = MessageCreator.fromApplication(application4); assertEquals("name", amMessage.getApplicationId()); }
public static ApplicationManagerMessage fromApplication(Application application) { if(application == null) { return null; } ApplicationManagerMessage message = new ApplicationManagerMessage(); message.setApplicationId(application.getName()); if(application.getDeployments() != null && application.getDeployments().size() > 0) { completeMessage(message, application.getDeployments().get(0), null); } return message; }
MessageCreator { public static ApplicationManagerMessage fromApplication(Application application) { if(application == null) { return null; } ApplicationManagerMessage message = new ApplicationManagerMessage(); message.setApplicationId(application.getName()); if(application.getDeployments() != null && application.getDeployments().size() > 0) { completeMessage(message, application.getDeployments().get(0), null); } return message; } }
MessageCreator { public static ApplicationManagerMessage fromApplication(Application application) { if(application == null) { return null; } ApplicationManagerMessage message = new ApplicationManagerMessage(); message.setApplicationId(application.getName()); if(application.getDeployments() != null && application.getDeployments().size() > 0) { completeMessage(message, application.getDeployments().get(0), null); } return message; }  }
MessageCreator { public static ApplicationManagerMessage fromApplication(Application application) { if(application == null) { return null; } ApplicationManagerMessage message = new ApplicationManagerMessage(); message.setApplicationId(application.getName()); if(application.getDeployments() != null && application.getDeployments().size() > 0) { completeMessage(message, application.getDeployments().get(0), null); } return message; }  static ApplicationManagerMessage fromApplication(Application application); static ApplicationManagerMessage fromDeployment(String applicationName, Deployment deployment, String status); static ApplicationManagerMessage fromVM(String applicationName, Deployment deployment, VM vm); }
MessageCreator { public static ApplicationManagerMessage fromApplication(Application application) { if(application == null) { return null; } ApplicationManagerMessage message = new ApplicationManagerMessage(); message.setApplicationId(application.getName()); if(application.getDeployments() != null && application.getDeployments().size() > 0) { completeMessage(message, application.getDeployments().get(0), null); } return message; }  static ApplicationManagerMessage fromApplication(Application application); static ApplicationManagerMessage fromDeployment(String applicationName, Deployment deployment, String status); static ApplicationManagerMessage fromVM(String applicationName, Deployment deployment, VM vm);  }