@Test public void getEnergyMeasuremenForDeploymentXMLInfoTest() throws Exception { EnergyMeasurement energyMeasurement = new EnergyMeasurement(); energyMeasurement.setValue(22.0); String xml = XMLBuilder.getEnergyMeasurementForDeploymentXMLInfo(energyMeasurement, "111", "333"); JAXBContext jaxbContext = JAXBContext.newInstance(EnergyMeasurement.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); energyMeasurement = (EnergyMeasurement) jaxbUnmarshaller.unmarshal(new StringReader(xml)); assertEquals("/applications/111/deployments/333/energy-consumption", energyMeasurement.getHref()); assertEquals(22.0, energyMeasurement.getValue(), 0.00001); assertEquals("Aggregated energy consumption in Wh for this aplication deployment", energyMeasurement.getDescription()); assertEquals(2, energyMeasurement.getLinks().size()); assertEquals("/applications/111/deployments/333", energyMeasurement.getLinks().get(0).getHref()); assertEquals("parent", energyMeasurement.getLinks().get(0).getRel()); assertEquals(MediaType.APPLICATION_XML, energyMeasurement.getLinks().get(0).getType()); assertEquals("/applications/111/deployments/333/energy-consumption", energyMeasurement.getLinks().get(1).getHref()); assertEquals("self",energyMeasurement.getLinks().get(1).getRel()); assertEquals(MediaType.APPLICATION_XML, energyMeasurement.getLinks().get(1).getType()); }
public static String getEnergyMeasurementForDeploymentXMLInfo(EnergyMeasurement energyMeasurement, String applicationId, String deploymentId) { energyMeasurement = XMLBuilder.addEnergyMeasurementForDeploymentXMLInfo(energyMeasurement, applicationId, deploymentId, "energy-consumption"); return ModelConverter.objectEnergyMeasurementToXML(energyMeasurement); }
XMLBuilder { public static String getEnergyMeasurementForDeploymentXMLInfo(EnergyMeasurement energyMeasurement, String applicationId, String deploymentId) { energyMeasurement = XMLBuilder.addEnergyMeasurementForDeploymentXMLInfo(energyMeasurement, applicationId, deploymentId, "energy-consumption"); return ModelConverter.objectEnergyMeasurementToXML(energyMeasurement); } }
XMLBuilder { public static String getEnergyMeasurementForDeploymentXMLInfo(EnergyMeasurement energyMeasurement, String applicationId, String deploymentId) { energyMeasurement = XMLBuilder.addEnergyMeasurementForDeploymentXMLInfo(energyMeasurement, applicationId, deploymentId, "energy-consumption"); return ModelConverter.objectEnergyMeasurementToXML(energyMeasurement); }  }
XMLBuilder { public static String getEnergyMeasurementForDeploymentXMLInfo(EnergyMeasurement energyMeasurement, String applicationId, String deploymentId) { energyMeasurement = XMLBuilder.addEnergyMeasurementForDeploymentXMLInfo(energyMeasurement, applicationId, deploymentId, "energy-consumption"); return ModelConverter.objectEnergyMeasurementToXML(energyMeasurement); }  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 getEnergyMeasurementForDeploymentXMLInfo(EnergyMeasurement energyMeasurement, String applicationId, String deploymentId) { energyMeasurement = XMLBuilder.addEnergyMeasurementForDeploymentXMLInfo(energyMeasurement, applicationId, deploymentId, "energy-consumption"); return ModelConverter.objectEnergyMeasurementToXML(energyMeasurement); }  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);  }