@Test public void getCostEstimationForAnEventInADeploymentXMLInfoTest() throws JAXBException { Cost cost = new Cost(); cost.setCharges(1.0d); cost.setEnergyValue(2.0d); cost.setPowerValue(1.0d); String xml = XMLBuilder.getCostEstimationForAnEventInADeploymentXMLInfo(cost, "app-name", "1", "loquesea"); JAXBContext jaxbContext = JAXBContext.newInstance(Cost.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); cost = (Cost) jaxbUnmarshaller.unmarshal(new StringReader(xml)); assertEquals("/applications/app-name/deployments/1/events/loquesea/cost-estimation", cost.getHref()); assertEquals(1.0d, cost.getCharges().doubleValue(), 0.0001); assertEquals("Energy estimation in WATTHOURS", cost.getEnergyDescription()); assertEquals("Power estimation in WATTS", cost.getPowerDescription()); assertEquals(2.0d, cost.getEnergyValue().doubleValue(), 0.0001); assertEquals(1.0d, cost.getPowerValue().doubleValue(), 0.0001); assertEquals("Charges estimation in EUROS", cost.getChargesDescription()); assertEquals(2, cost.getLinks().size()); assertEquals("/applications/app-name/deployments/1", cost.getLinks().get(0).getHref()); assertEquals("parent", cost.getLinks().get(0).getRel()); assertEquals(MediaType.APPLICATION_XML, cost.getLinks().get(0).getType()); assertEquals("/applications/app-name/deployments/1/events/loquesea/cost-estimation", cost.getLinks().get(1).getHref()); assertEquals("self", cost.getLinks().get(1).getRel()); assertEquals(MediaType.APPLICATION_XML, cost.getLinks().get(1).getType()); }
public static String getCostEstimationForAnEventInADeploymentXMLInfo(Cost cost, String applicationName, String deploymentId, String eventId) { cost.setChargesDescription("Charges estimation in EUROS"); cost.setPowerDescription("Power estimation in WATTS"); cost.setEnergyDescription("Energy estimation in WATTHOURS"); String parentHref = "/applications/" + applicationName + "/deployments/" + deploymentId; cost.setHref(parentHref + "/events/" + eventId + "/cost-estimation"); List<Link> links = new ArrayList<Link>(); cost.setLinks(links); Link linkParent = new Link(); linkParent.setHref(parentHref); linkParent.setRel("parent"); linkParent.setType(MediaType.APPLICATION_XML); links.add(linkParent); Link linkSelf = new Link(); linkSelf.setHref(cost.getHref()); linkSelf.setRel("self"); linkSelf.setType(MediaType.APPLICATION_XML); links.add(linkSelf); return ModelConverter.objectCostToXML(cost); }
XMLBuilder { public static String getCostEstimationForAnEventInADeploymentXMLInfo(Cost cost, String applicationName, String deploymentId, String eventId) { cost.setChargesDescription("Charges estimation in EUROS"); cost.setPowerDescription("Power estimation in WATTS"); cost.setEnergyDescription("Energy estimation in WATTHOURS"); String parentHref = "/applications/" + applicationName + "/deployments/" + deploymentId; cost.setHref(parentHref + "/events/" + eventId + "/cost-estimation"); List<Link> links = new ArrayList<Link>(); cost.setLinks(links); Link linkParent = new Link(); linkParent.setHref(parentHref); linkParent.setRel("parent"); linkParent.setType(MediaType.APPLICATION_XML); links.add(linkParent); Link linkSelf = new Link(); linkSelf.setHref(cost.getHref()); linkSelf.setRel("self"); linkSelf.setType(MediaType.APPLICATION_XML); links.add(linkSelf); return ModelConverter.objectCostToXML(cost); } }
XMLBuilder { public static String getCostEstimationForAnEventInADeploymentXMLInfo(Cost cost, String applicationName, String deploymentId, String eventId) { cost.setChargesDescription("Charges estimation in EUROS"); cost.setPowerDescription("Power estimation in WATTS"); cost.setEnergyDescription("Energy estimation in WATTHOURS"); String parentHref = "/applications/" + applicationName + "/deployments/" + deploymentId; cost.setHref(parentHref + "/events/" + eventId + "/cost-estimation"); List<Link> links = new ArrayList<Link>(); cost.setLinks(links); Link linkParent = new Link(); linkParent.setHref(parentHref); linkParent.setRel("parent"); linkParent.setType(MediaType.APPLICATION_XML); links.add(linkParent); Link linkSelf = new Link(); linkSelf.setHref(cost.getHref()); linkSelf.setRel("self"); linkSelf.setType(MediaType.APPLICATION_XML); links.add(linkSelf); return ModelConverter.objectCostToXML(cost); }  }
XMLBuilder { public static String getCostEstimationForAnEventInADeploymentXMLInfo(Cost cost, String applicationName, String deploymentId, String eventId) { cost.setChargesDescription("Charges estimation in EUROS"); cost.setPowerDescription("Power estimation in WATTS"); cost.setEnergyDescription("Energy estimation in WATTHOURS"); String parentHref = "/applications/" + applicationName + "/deployments/" + deploymentId; cost.setHref(parentHref + "/events/" + eventId + "/cost-estimation"); List<Link> links = new ArrayList<Link>(); cost.setLinks(links); Link linkParent = new Link(); linkParent.setHref(parentHref); linkParent.setRel("parent"); linkParent.setType(MediaType.APPLICATION_XML); links.add(linkParent); Link linkSelf = new Link(); linkSelf.setHref(cost.getHref()); linkSelf.setRel("self"); linkSelf.setType(MediaType.APPLICATION_XML); links.add(linkSelf); return ModelConverter.objectCostToXML(cost); }  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 getCostEstimationForAnEventInADeploymentXMLInfo(Cost cost, String applicationName, String deploymentId, String eventId) { cost.setChargesDescription("Charges estimation in EUROS"); cost.setPowerDescription("Power estimation in WATTS"); cost.setEnergyDescription("Energy estimation in WATTHOURS"); String parentHref = "/applications/" + applicationName + "/deployments/" + deploymentId; cost.setHref(parentHref + "/events/" + eventId + "/cost-estimation"); List<Link> links = new ArrayList<Link>(); cost.setLinks(links); Link linkParent = new Link(); linkParent.setHref(parentHref); linkParent.setRel("parent"); linkParent.setType(MediaType.APPLICATION_XML); links.add(linkParent); Link linkSelf = new Link(); linkSelf.setHref(cost.getHref()); linkSelf.setRel("self"); linkSelf.setType(MediaType.APPLICATION_XML); links.add(linkSelf); return ModelConverter.objectCostToXML(cost); }  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);  }