@Test public void getCollectionOfDeploymentsJSONTest() throws JAXBException { Deployment deployment1 = new Deployment(); deployment1.setId(1); deployment1.setOvf("ovf1"); deployment1.setPrice("price1"); deployment1.setStatus("Status1"); Deployment deployment2 = new Deployment(); deployment2.setId(2); deployment2.setOvf("ovf2"); deployment2.setPrice("price2"); deployment2.setStatus("Status2"); List<Deployment> deployments = new ArrayList<Deployment>(); deployments.add(deployment1); deployments.add(deployment2); String json = XMLBuilder.getCollectionOfDeploymentsJSON(deployments, "1"); Collection collection = ModelConverter.jsonCollectionToObject(json); assertEquals("/applications/1/deployments", collection.getHref()); assertEquals(0, collection.getItems().getOffset()); assertEquals(2, collection.getItems().getTotal()); assertEquals(2, collection.getLinks().size()); assertEquals("/applications/1", collection.getLinks().get(0).getHref()); assertEquals("parent", collection.getLinks().get(0).getRel()); assertEquals(MediaType.APPLICATION_XML, collection.getLinks().get(0).getType()); assertEquals("/applications/1/deployments", collection.getLinks().get(1).getHref()); assertEquals("self", collection.getLinks().get(1).getRel()); assertEquals(MediaType.APPLICATION_XML, collection.getLinks().get(1).getType()); assertEquals(2, collection.getItems().getDeployments().size()); deployment1 = collection.getItems().getDeployments().get(0); assertEquals("/applications/1/deployments/1", deployment1.getLinks().get(1).getHref()); assertEquals("self", deployment1.getLinks().get(1).getRel()); assertEquals(MediaType.APPLICATION_XML, deployment1.getLinks().get(1).getType()); assertEquals("/applications/1/deployments", deployment1.getLinks().get(0).getHref()); assertEquals("parent", deployment1.getLinks().get(0).getRel()); assertEquals(MediaType.APPLICATION_XML, deployment1.getLinks().get(0).getType()); assertEquals("/applications/1/deployments/1/ovf", deployment1.getLinks().get(2).getHref()); assertEquals("ovf", deployment1.getLinks().get(2).getRel()); assertEquals(MediaType.APPLICATION_XML, deployment1.getLinks().get(2).getType()); assertEquals("/applications/1/deployments/1/vms", deployment1.getLinks().get(3).getHref()); assertEquals("vms", deployment1.getLinks().get(3).getRel()); assertEquals(MediaType.APPLICATION_XML, deployment1.getLinks().get(3).getType()); assertEquals("ovf1", deployment1.getOvf()); assertEquals("price1", deployment1.getPrice()); assertEquals("Status1", deployment1.getStatus()); deployment2 = collection.getItems().getDeployments().get(1); assertEquals("/applications/1/deployments/2", deployment2.getLinks().get(1).getHref()); assertEquals("self", deployment2.getLinks().get(1).getRel()); assertEquals(MediaType.APPLICATION_XML, deployment1.getLinks().get(1).getType()); assertEquals("/applications/1/deployments", deployment2.getLinks().get(0).getHref()); assertEquals("parent", deployment1.getLinks().get(0).getRel()); assertEquals(MediaType.APPLICATION_XML, deployment2.getLinks().get(0).getType()); assertEquals("/applications/1/deployments/2/ovf", deployment2.getLinks().get(2).getHref()); assertEquals("ovf", deployment2.getLinks().get(2).getRel()); assertEquals(MediaType.APPLICATION_XML, deployment2.getLinks().get(2).getType()); assertEquals("/applications/1/deployments/2/vms", deployment2.getLinks().get(3).getHref()); assertEquals("vms", deployment2.getLinks().get(3).getRel()); assertEquals(MediaType.APPLICATION_XML, deployment1.getLinks().get(3).getType()); assertEquals("ovf2", deployment2.getOvf()); assertEquals("price2", deployment2.getPrice()); assertEquals("Status2", deployment2.getStatus()); }
public static String getCollectionOfDeploymentsJSON(List<Deployment> deployments, String applicationId) { Collection collection = addCollectionOfDeploymentsInfo(deployments, applicationId); return ModelConverter.objectCollectionToJSON(collection); }
XMLBuilder { public static String getCollectionOfDeploymentsJSON(List<Deployment> deployments, String applicationId) { Collection collection = addCollectionOfDeploymentsInfo(deployments, applicationId); return ModelConverter.objectCollectionToJSON(collection); } }
XMLBuilder { public static String getCollectionOfDeploymentsJSON(List<Deployment> deployments, String applicationId) { Collection collection = addCollectionOfDeploymentsInfo(deployments, applicationId); return ModelConverter.objectCollectionToJSON(collection); }  }
XMLBuilder { public static String getCollectionOfDeploymentsJSON(List<Deployment> deployments, String applicationId) { Collection collection = addCollectionOfDeploymentsInfo(deployments, applicationId); return ModelConverter.objectCollectionToJSON(collection); }  static String getApplicationXML(Application application); static String getApplicationJSON(Application application); static String getDeploymentXML(Deployment deployment, String applicationId); static String getDeploymentJSON(Deployment deployment, String applicationName); static String getVMXML(VM vm, String applicationId, int deploymentId); static String getCollectionApplicationsXML(List<Application> applications); static String getCollectionApplicationsJSON(List<Application> applications); static String getCollectionOfCacheImagesXML(List<Image> images, String applicationName); static String getCollectionOfDeploymentsXML(List<Deployment> deployments, String applicationId); static String getCollectionOfDeploymentsJSON(List<Deployment> deployments, String applicationId); static EnergyMeasurement addEnergyMeasurementForDeploymentXMLInfo(
			EnergyMeasurement energyMeasurement, String applicationId, String deploymentId, String href); static String getEnergyMeasurementForDeploymentXMLInfo(EnergyMeasurement energyMeasurement, String applicationId, String deploymentId); static PowerMeasurement addPowerMeasurementForDeploymentXMLInfo(
			PowerMeasurement powerMeasurement, String applicationId, String deploymentId, String href); static String getPowerMeasurementForDeploymentXMLInfo(PowerMeasurement powerMeasurement, String applicationId, String deploymentId); static String getEnergyEstimationForAnEventInAVMXMLInfo(
			EnergyMeasurement energyMeasurement, String applicationId, String deploymentId, String vmId, String eventId); static String getEnergyConsumptionForAnEventInAVMXMLInfo(
			EnergyMeasurement energyMeasurement, String applicationId, String deploymentId, String vmId, String eventId); static EnergyMeasurement addEnergyEstimationForAnEventInAVMXMLInfo(
			EnergyMeasurement energyMeasurement, String applicationId, String deploymentId, String vmId, String eventId); static EnergyMeasurement addEnergyConsumptionForAnEventInAVMXMLInfo(
			EnergyMeasurement energyMeasurement, String applicationId, String deploymentId, String vmId, String eventId); static EnergyMeasurement addEnergyEstimationForDeploymentXMLInfo(EnergyMeasurement energyMeasurement, 
																			String applicationId, 
																			String deploymentId, 
																			String eventId); static EnergyMeasurement addEnergyConsumptionForDeploymentXMLInfo(EnergyMeasurement energyMeasurement, 
																			 String applicationId, 
																			 String deploymentId, 
																			 String eventId); static PowerMeasurement addPowerEstimationForDeploymentXMLInfo(PowerMeasurement powerMeasurement, String applicationId, String deploymentId, String eventId); static PowerMeasurement addPowerConsumptionForDeploymentXMLInfo(PowerMeasurement powerMeasurement, String applicationId, String deploymentId, String eventId); static String getEnergyEstimationForDeploymentXMLInfo(EnergyMeasurement energyMeasurement, String applicationId, String deploymentId, String eventId); static String getPowerEstimationForDeploymentXMLInfo(PowerMeasurement powerMeasurement, String applicationId, String deploymentId, String eventId); static String getEventSampleCollectionXMLInfo(List<EventSample> eventSamples, String applicationId, String deploymentId, String vmId, String eventId); static Agreement addAgreementXMLInfo(Agreement agreement, String applicationId, int deploymentId); static String getAgreementXML(Agreement agreement, String applicationId, int deploymentId); static String getCollectionOfAgreements(List<Agreement> agreements, String applicationId, int deploymentId); static String getCollectionOfVMs(List<VM> vms, String applicationId, int deploymentId); static String getCostEstimationForAnEventInAVMXMLInfo(Cost cost, String applicationName, String deploymentId, String vmId, String eventId); static String getCostConsumptionForADeployment(Cost cost, String applicationName, String deploymentId); static PowerMeasurement addPowerConsumptionForAnEventInAVMXMLInfo(PowerMeasurement powerMeasurement, 
																			 String applicationId, 
																			 String deploymentId,
																			 String vmId, 
																			 String eventId); static PowerMeasurement addPowerEstimationForAnEventInAVMXMLInfo(PowerMeasurement powerMeasurement, 
																			String applicationId, 
																			String deploymentId,
																			String vmId,
																			String eventId); static String getPowerConsumptionForAnEventInAVMXMLInfo(PowerMeasurement powerMeasurement, 
																   String applicationId, 
																   String deploymentId,
																   String vmId, 
																   String eventId); static String getPowerEstimationForAnEventInAVMXMLInfo(PowerMeasurement powerMeasurement, 
																  String applicationId, 
																  String deploymentId,
																  String vmId, 
																  String eventId); static String getPowerConsumptionForDeploymentXMLInfo(PowerMeasurement powerMeasurement, String applicationName,	String deploymentId, String eventId); static String getEnergyConsumptionForDeploymentXMLInfo(EnergyMeasurement energyMeasurement, String applicationName,	String deploymentId, String eventId); static String getCostEstimationForAnEventInADeploymentXMLInfo(Cost cost, String applicationName, String deploymentId, String eventId); }
XMLBuilder { public static String getCollectionOfDeploymentsJSON(List<Deployment> deployments, String applicationId) { Collection collection = addCollectionOfDeploymentsInfo(deployments, applicationId); return ModelConverter.objectCollectionToJSON(collection); }  static String getApplicationXML(Application application); static String getApplicationJSON(Application application); static String getDeploymentXML(Deployment deployment, String applicationId); static String getDeploymentJSON(Deployment deployment, String applicationName); static String getVMXML(VM vm, String applicationId, int deploymentId); static String getCollectionApplicationsXML(List<Application> applications); static String getCollectionApplicationsJSON(List<Application> applications); static String getCollectionOfCacheImagesXML(List<Image> images, String applicationName); static String getCollectionOfDeploymentsXML(List<Deployment> deployments, String applicationId); static String getCollectionOfDeploymentsJSON(List<Deployment> deployments, String applicationId); static EnergyMeasurement addEnergyMeasurementForDeploymentXMLInfo(
			EnergyMeasurement energyMeasurement, String applicationId, String deploymentId, String href); static String getEnergyMeasurementForDeploymentXMLInfo(EnergyMeasurement energyMeasurement, String applicationId, String deploymentId); static PowerMeasurement addPowerMeasurementForDeploymentXMLInfo(
			PowerMeasurement powerMeasurement, String applicationId, String deploymentId, String href); static String getPowerMeasurementForDeploymentXMLInfo(PowerMeasurement powerMeasurement, String applicationId, String deploymentId); static String getEnergyEstimationForAnEventInAVMXMLInfo(
			EnergyMeasurement energyMeasurement, String applicationId, String deploymentId, String vmId, String eventId); static String getEnergyConsumptionForAnEventInAVMXMLInfo(
			EnergyMeasurement energyMeasurement, String applicationId, String deploymentId, String vmId, String eventId); static EnergyMeasurement addEnergyEstimationForAnEventInAVMXMLInfo(
			EnergyMeasurement energyMeasurement, String applicationId, String deploymentId, String vmId, String eventId); static EnergyMeasurement addEnergyConsumptionForAnEventInAVMXMLInfo(
			EnergyMeasurement energyMeasurement, String applicationId, String deploymentId, String vmId, String eventId); static EnergyMeasurement addEnergyEstimationForDeploymentXMLInfo(EnergyMeasurement energyMeasurement, 
																			String applicationId, 
																			String deploymentId, 
																			String eventId); static EnergyMeasurement addEnergyConsumptionForDeploymentXMLInfo(EnergyMeasurement energyMeasurement, 
																			 String applicationId, 
																			 String deploymentId, 
																			 String eventId); static PowerMeasurement addPowerEstimationForDeploymentXMLInfo(PowerMeasurement powerMeasurement, String applicationId, String deploymentId, String eventId); static PowerMeasurement addPowerConsumptionForDeploymentXMLInfo(PowerMeasurement powerMeasurement, String applicationId, String deploymentId, String eventId); static String getEnergyEstimationForDeploymentXMLInfo(EnergyMeasurement energyMeasurement, String applicationId, String deploymentId, String eventId); static String getPowerEstimationForDeploymentXMLInfo(PowerMeasurement powerMeasurement, String applicationId, String deploymentId, String eventId); static String getEventSampleCollectionXMLInfo(List<EventSample> eventSamples, String applicationId, String deploymentId, String vmId, String eventId); static Agreement addAgreementXMLInfo(Agreement agreement, String applicationId, int deploymentId); static String getAgreementXML(Agreement agreement, String applicationId, int deploymentId); static String getCollectionOfAgreements(List<Agreement> agreements, String applicationId, int deploymentId); static String getCollectionOfVMs(List<VM> vms, String applicationId, int deploymentId); static String getCostEstimationForAnEventInAVMXMLInfo(Cost cost, String applicationName, String deploymentId, String vmId, String eventId); static String getCostConsumptionForADeployment(Cost cost, String applicationName, String deploymentId); static PowerMeasurement addPowerConsumptionForAnEventInAVMXMLInfo(PowerMeasurement powerMeasurement, 
																			 String applicationId, 
																			 String deploymentId,
																			 String vmId, 
																			 String eventId); static PowerMeasurement addPowerEstimationForAnEventInAVMXMLInfo(PowerMeasurement powerMeasurement, 
																			String applicationId, 
																			String deploymentId,
																			String vmId,
																			String eventId); static String getPowerConsumptionForAnEventInAVMXMLInfo(PowerMeasurement powerMeasurement, 
																   String applicationId, 
																   String deploymentId,
																   String vmId, 
																   String eventId); static String getPowerEstimationForAnEventInAVMXMLInfo(PowerMeasurement powerMeasurement, 
																  String applicationId, 
																  String deploymentId,
																  String vmId, 
																  String eventId); static String getPowerConsumptionForDeploymentXMLInfo(PowerMeasurement powerMeasurement, String applicationName,	String deploymentId, String eventId); static String getEnergyConsumptionForDeploymentXMLInfo(EnergyMeasurement energyMeasurement, String applicationName,	String deploymentId, String eventId); static String getCostEstimationForAnEventInADeploymentXMLInfo(Cost cost, String applicationName, String deploymentId, String eventId);  }