@Test @SuppressWarnings(value = { "static-access" }) public void testGetCostEstimationForAVMAndEventNullSec() throws Exception { VMRest vmRest = new VMRest(); PaaSEnergyModeller energyModeller = mock(PaaSEnergyModeller.class); vmRest.energyModeller = energyModeller; PriceModellerClient priceModellerClient = mock(PriceModellerClient.class); vmRest.priceModellerClient = priceModellerClient; EnergyModellerQueueController emController = mock(EnergyModellerQueueController.class); vmRest.energyModellerQueueController = emController; VMDAO vmDAO = mock(VMDAO.class); vmRest.vmDAO = vmDAO; VM vm = new VM(); vm.setId(2); vm.setProviderVmId("abab"); vm.setCpuActual(1); vm.setRamActual(10); when(vmDAO.getById(2)).thenReturn(vm); List<String> ids = new ArrayList<String>(); ids.add("2"); when(energyModeller.estimate(null, "app-name", "1", ids, "loquesea", Unit.ENERGY, 0l)).thenReturn(22.0); when(energyModeller.estimate(null, "app-name", "1", ids, "loquesea", Unit.POWER, 0l)).thenReturn(23.0); EnergyModellerMessage countMessage = new EnergyModellerMessage(); countMessage.setValue("22"); String secKey = EnergyModellerQueueController.generateKey("app-name", "loquesea", "1", ids, EnergyModellerQueueController.SEC); String countKey = EnergyModellerQueueController.generateKey("app-name", "loquesea", "1", ids, EnergyModellerQueueController.COUNT); when(emController.getPredictionMessage(secKey)).thenReturn(null); when(emController.getPredictionMessage(countKey)).thenReturn(countMessage); Response response = vmRest.getCostEstimation("app-name", "1", "2", "loquesea"); assertEquals(200, response.getStatus()); String xml = (String) response.getEntity(); JAXBContext jaxbContext = JAXBContext.newInstance(Cost.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); Cost cost = (Cost) jaxbUnmarshaller.unmarshal(new StringReader(xml)); assertEquals("/applications/app-name/deployments/1/vms/2/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(23.0d, cost.getPowerValue(), 0.0001); assertEquals(22.0d, cost.getEnergyValue().doubleValue(), 0.0001); assertEquals("Charges estimation in EUROS", cost.getChargesDescription()); assertEquals(2, cost.getLinks().size()); assertEquals("/applications/app-name/deployments/1/vms/2", 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/vms/2/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()); }
@GET @Path("{vm_id}/events/{event_id}/cost-estimation") @Produces(MediaType.APPLICATION_XML) public Response getCostEstimation(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId, @PathParam("vm_id") String vmId, @PathParam("event_id") String eventId) throws InterruptedException { logger.info("GET request to path: /applications/" + applicationName + "/deployments/" + deploymentId + "/vms/" + vmId + "/events/" + eventId + "/cost-estimation"); energyModeller = getEnergyModeller(); VM vm = vmDAO.getById(Integer.parseInt(vmId)); List<String> ids = new ArrayList<String>(); ids.add("" + vm.getId()); String providerId = vm.getProviderId(); logger.debug("Connecting to Energy Modeller"); double energyEstimated = energyModeller.estimate(providerId, applicationName, deploymentId, ids, eventId, Unit.ENERGY, 0l); double powerEstimated = energyModeller.estimate(providerId, applicationName, deploymentId, ids, eventId, Unit.POWER, 0l); String secKey = EnergyModellerQueueController.generateKey(applicationName, eventId, deploymentId, ids, EnergyModellerQueueController.SEC); String countKey = EnergyModellerQueueController.generateKey(applicationName, eventId, deploymentId, ids, EnergyModellerQueueController.COUNT); Thread.sleep(1000l); EnergyModellerMessage emMessageSec = getEnergyModellerQueueController().getPredictionMessage(secKey); EnergyModellerMessage emMessageCount = getEnergyModellerQueueController().getPredictionMessage(countKey); Cost cost = new Cost(); cost.setEnergyValue(energyEstimated); cost.setPowerValue(powerEstimated); if(emMessageSec != null && emMessageCount != null) { logger.info("Parsing duration value of: " + emMessageSec.getValue()); logger.info("Parsig number events: " + emMessageCount.getValue()); long duration = (long) Double.parseDouble(emMessageSec.getValue()); int numberOfevents = (int) Double.parseDouble(emMessageCount.getValue()); int cpu = vm.getCpuActual(); int ram = (int) vm.getRamActual(); double storage = (double) vm.getDiskActual(); if(priceModellerClient == null) { priceModellerClient = PriceModellerClient.getInstance(); } int deploymentIdInt = Integer.parseInt(deploymentId); Deployment deployment = deploymentDAO.getById(deploymentIdInt); logger.info("id: " + deploymentIdInt + " cpu: " + cpu + " ram: " + ram + " Storage: " + storage + ", Energy estimated: " + energyEstimated + ", Schema: " + deployment.getSchema() + ", duration: " + duration + ", numberOfEvents: " + numberOfevents); double charges = priceModellerClient.getEventPredictedCharges(deploymentIdInt, cpu, ram, storage, energyEstimated, deployment.getSchema(), duration, numberOfevents); cost.setCharges(charges); } else { cost.setCharges(-1.0d); } String xml = XMLBuilder.getCostEstimationForAnEventInAVMXMLInfo(cost, applicationName, deploymentId, vmId, eventId); return buildResponse(Status.OK, xml); }
VMRest extends AbstractRest { @GET @Path("{vm_id}/events/{event_id}/cost-estimation") @Produces(MediaType.APPLICATION_XML) public Response getCostEstimation(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId, @PathParam("vm_id") String vmId, @PathParam("event_id") String eventId) throws InterruptedException { logger.info("GET request to path: /applications/" + applicationName + "/deployments/" + deploymentId + "/vms/" + vmId + "/events/" + eventId + "/cost-estimation"); energyModeller = getEnergyModeller(); VM vm = vmDAO.getById(Integer.parseInt(vmId)); List<String> ids = new ArrayList<String>(); ids.add("" + vm.getId()); String providerId = vm.getProviderId(); logger.debug("Connecting to Energy Modeller"); double energyEstimated = energyModeller.estimate(providerId, applicationName, deploymentId, ids, eventId, Unit.ENERGY, 0l); double powerEstimated = energyModeller.estimate(providerId, applicationName, deploymentId, ids, eventId, Unit.POWER, 0l); String secKey = EnergyModellerQueueController.generateKey(applicationName, eventId, deploymentId, ids, EnergyModellerQueueController.SEC); String countKey = EnergyModellerQueueController.generateKey(applicationName, eventId, deploymentId, ids, EnergyModellerQueueController.COUNT); Thread.sleep(1000l); EnergyModellerMessage emMessageSec = getEnergyModellerQueueController().getPredictionMessage(secKey); EnergyModellerMessage emMessageCount = getEnergyModellerQueueController().getPredictionMessage(countKey); Cost cost = new Cost(); cost.setEnergyValue(energyEstimated); cost.setPowerValue(powerEstimated); if(emMessageSec != null && emMessageCount != null) { logger.info("Parsing duration value of: " + emMessageSec.getValue()); logger.info("Parsig number events: " + emMessageCount.getValue()); long duration = (long) Double.parseDouble(emMessageSec.getValue()); int numberOfevents = (int) Double.parseDouble(emMessageCount.getValue()); int cpu = vm.getCpuActual(); int ram = (int) vm.getRamActual(); double storage = (double) vm.getDiskActual(); if(priceModellerClient == null) { priceModellerClient = PriceModellerClient.getInstance(); } int deploymentIdInt = Integer.parseInt(deploymentId); Deployment deployment = deploymentDAO.getById(deploymentIdInt); logger.info("id: " + deploymentIdInt + " cpu: " + cpu + " ram: " + ram + " Storage: " + storage + ", Energy estimated: " + energyEstimated + ", Schema: " + deployment.getSchema() + ", duration: " + duration + ", numberOfEvents: " + numberOfevents); double charges = priceModellerClient.getEventPredictedCharges(deploymentIdInt, cpu, ram, storage, energyEstimated, deployment.getSchema(), duration, numberOfevents); cost.setCharges(charges); } else { cost.setCharges(-1.0d); } String xml = XMLBuilder.getCostEstimationForAnEventInAVMXMLInfo(cost, applicationName, deploymentId, vmId, eventId); return buildResponse(Status.OK, xml); } }
VMRest extends AbstractRest { @GET @Path("{vm_id}/events/{event_id}/cost-estimation") @Produces(MediaType.APPLICATION_XML) public Response getCostEstimation(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId, @PathParam("vm_id") String vmId, @PathParam("event_id") String eventId) throws InterruptedException { logger.info("GET request to path: /applications/" + applicationName + "/deployments/" + deploymentId + "/vms/" + vmId + "/events/" + eventId + "/cost-estimation"); energyModeller = getEnergyModeller(); VM vm = vmDAO.getById(Integer.parseInt(vmId)); List<String> ids = new ArrayList<String>(); ids.add("" + vm.getId()); String providerId = vm.getProviderId(); logger.debug("Connecting to Energy Modeller"); double energyEstimated = energyModeller.estimate(providerId, applicationName, deploymentId, ids, eventId, Unit.ENERGY, 0l); double powerEstimated = energyModeller.estimate(providerId, applicationName, deploymentId, ids, eventId, Unit.POWER, 0l); String secKey = EnergyModellerQueueController.generateKey(applicationName, eventId, deploymentId, ids, EnergyModellerQueueController.SEC); String countKey = EnergyModellerQueueController.generateKey(applicationName, eventId, deploymentId, ids, EnergyModellerQueueController.COUNT); Thread.sleep(1000l); EnergyModellerMessage emMessageSec = getEnergyModellerQueueController().getPredictionMessage(secKey); EnergyModellerMessage emMessageCount = getEnergyModellerQueueController().getPredictionMessage(countKey); Cost cost = new Cost(); cost.setEnergyValue(energyEstimated); cost.setPowerValue(powerEstimated); if(emMessageSec != null && emMessageCount != null) { logger.info("Parsing duration value of: " + emMessageSec.getValue()); logger.info("Parsig number events: " + emMessageCount.getValue()); long duration = (long) Double.parseDouble(emMessageSec.getValue()); int numberOfevents = (int) Double.parseDouble(emMessageCount.getValue()); int cpu = vm.getCpuActual(); int ram = (int) vm.getRamActual(); double storage = (double) vm.getDiskActual(); if(priceModellerClient == null) { priceModellerClient = PriceModellerClient.getInstance(); } int deploymentIdInt = Integer.parseInt(deploymentId); Deployment deployment = deploymentDAO.getById(deploymentIdInt); logger.info("id: " + deploymentIdInt + " cpu: " + cpu + " ram: " + ram + " Storage: " + storage + ", Energy estimated: " + energyEstimated + ", Schema: " + deployment.getSchema() + ", duration: " + duration + ", numberOfEvents: " + numberOfevents); double charges = priceModellerClient.getEventPredictedCharges(deploymentIdInt, cpu, ram, storage, energyEstimated, deployment.getSchema(), duration, numberOfevents); cost.setCharges(charges); } else { cost.setCharges(-1.0d); } String xml = XMLBuilder.getCostEstimationForAnEventInAVMXMLInfo(cost, applicationName, deploymentId, vmId, eventId); return buildResponse(Status.OK, xml); }  }
VMRest extends AbstractRest { @GET @Path("{vm_id}/events/{event_id}/cost-estimation") @Produces(MediaType.APPLICATION_XML) public Response getCostEstimation(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId, @PathParam("vm_id") String vmId, @PathParam("event_id") String eventId) throws InterruptedException { logger.info("GET request to path: /applications/" + applicationName + "/deployments/" + deploymentId + "/vms/" + vmId + "/events/" + eventId + "/cost-estimation"); energyModeller = getEnergyModeller(); VM vm = vmDAO.getById(Integer.parseInt(vmId)); List<String> ids = new ArrayList<String>(); ids.add("" + vm.getId()); String providerId = vm.getProviderId(); logger.debug("Connecting to Energy Modeller"); double energyEstimated = energyModeller.estimate(providerId, applicationName, deploymentId, ids, eventId, Unit.ENERGY, 0l); double powerEstimated = energyModeller.estimate(providerId, applicationName, deploymentId, ids, eventId, Unit.POWER, 0l); String secKey = EnergyModellerQueueController.generateKey(applicationName, eventId, deploymentId, ids, EnergyModellerQueueController.SEC); String countKey = EnergyModellerQueueController.generateKey(applicationName, eventId, deploymentId, ids, EnergyModellerQueueController.COUNT); Thread.sleep(1000l); EnergyModellerMessage emMessageSec = getEnergyModellerQueueController().getPredictionMessage(secKey); EnergyModellerMessage emMessageCount = getEnergyModellerQueueController().getPredictionMessage(countKey); Cost cost = new Cost(); cost.setEnergyValue(energyEstimated); cost.setPowerValue(powerEstimated); if(emMessageSec != null && emMessageCount != null) { logger.info("Parsing duration value of: " + emMessageSec.getValue()); logger.info("Parsig number events: " + emMessageCount.getValue()); long duration = (long) Double.parseDouble(emMessageSec.getValue()); int numberOfevents = (int) Double.parseDouble(emMessageCount.getValue()); int cpu = vm.getCpuActual(); int ram = (int) vm.getRamActual(); double storage = (double) vm.getDiskActual(); if(priceModellerClient == null) { priceModellerClient = PriceModellerClient.getInstance(); } int deploymentIdInt = Integer.parseInt(deploymentId); Deployment deployment = deploymentDAO.getById(deploymentIdInt); logger.info("id: " + deploymentIdInt + " cpu: " + cpu + " ram: " + ram + " Storage: " + storage + ", Energy estimated: " + energyEstimated + ", Schema: " + deployment.getSchema() + ", duration: " + duration + ", numberOfEvents: " + numberOfevents); double charges = priceModellerClient.getEventPredictedCharges(deploymentIdInt, cpu, ram, storage, energyEstimated, deployment.getSchema(), duration, numberOfevents); cost.setCharges(charges); } else { cost.setCharges(-1.0d); } String xml = XMLBuilder.getCostEstimationForAnEventInAVMXMLInfo(cost, applicationName, deploymentId, vmId, eventId); return buildResponse(Status.OK, xml); }  @GET @Produces(MediaType.APPLICATION_XML) Response getVMs(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId); @POST @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML) Response postVM(@PathParam("application_name") String applicationName, 
						   @PathParam("deployment_id") String deploymentId,
						   @DefaultValue("false") @QueryParam("force") boolean force,
						   String payload); @DELETE @Path("{vm_id}") Response deleteVM(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId, @PathParam("vm_id") String vmId); @GET @Path("{vm_id}") @Produces(MediaType.APPLICATION_XML) Response getVM(@PathParam("application_name") String applicationName,  @PathParam("deployment_id") String deploymentId, @PathParam("vm_id") String vmId); @GET @Path("{vm_id}/energy-estimation") @Produces(MediaType.APPLICATION_XML) Response getEnergyEstimation(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @DefaultValue("0") @QueryParam("duration") long duration); @GET @Path("{vm_id}/events/{event_id}/energy-estimation") @Produces(MediaType.APPLICATION_XML) Response getEnergyEstimationForAnEvent(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @PathParam("event_id") String eventId,
			                             @DefaultValue("0") @QueryParam("duration") long duration); @GET @Path("{vm_id}/power-estimation") @Produces(MediaType.APPLICATION_XML) Response getPowerEstimation(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId); @GET @Path("{vm_id}/events/{event_id}/power-estimation") @Produces(MediaType.APPLICATION_XML) Response getPowerEstimationForAnEvent(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @PathParam("event_id") String eventId); @GET @Path("{vm_id}/events/{event_id}/cost-estimation") @Produces(MediaType.APPLICATION_XML) Response getCostEstimation(@PathParam("application_name") String applicationName, 
			                          @PathParam("deployment_id") String deploymentId,
			                          @PathParam("vm_id") String vmId,
			                          @PathParam("event_id") String eventId); @GET @Path("{vm_id}/events/{event_id}/energy-consumption") @Produces(MediaType.APPLICATION_XML) Response getEventEnergyConsumption(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @PathParam("event_id") String eventId,
			                             @DefaultValue("0") @QueryParam("startTime") long startTime,
			                             @DefaultValue("0") @QueryParam("endTime") long endTime); @GET @Path("{vm_id}/events/{event_id}/power-consumption") @Produces(MediaType.APPLICATION_XML) Response getEventPowerConsumption(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @PathParam("event_id") String eventId,
			                             @QueryParam("startTime") long startTime,
			                             @QueryParam("endTime") long endTime,
			                             @Context UriInfo uriInfo); @GET @Path("{vm_id}/energy-consumption") @Produces(MediaType.APPLICATION_XML) Response getEnergyConsumption(@PathParam("application_name") String applicationName, 
										@PathParam("deployment_id") String deploymentId,
										@PathParam("vm_id") String vmId,
										@DefaultValue("0") @QueryParam("startTime") long startTime,
										@DefaultValue("0") @QueryParam("endTime") long endTime); @GET @Path("{vm_id}/power-consumption") @Produces(MediaType.APPLICATION_XML) Response getPowerConsumption(@PathParam("application_name") String applicationName, 
										@PathParam("deployment_id") String deploymentId,
										@PathParam("vm_id") String vmId,
										@DefaultValue("0") @QueryParam("startTime") long startTime,
										@DefaultValue("0") @QueryParam("endTime") long endTime,
										@Context UriInfo uriInfo); @GET @Path("{vm_id}/events/{event_id}/energy-sample") @Produces(MediaType.APPLICATION_XML) Response getEnergySample(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @PathParam("event_id") String eventId,
			                             @DefaultValue("0") @QueryParam("startTime") long startTime,
			                             @DefaultValue("0") @QueryParam("endTime") long endTime,
			                             @DefaultValue("0") @QueryParam("interval") long interval); }
VMRest extends AbstractRest { @GET @Path("{vm_id}/events/{event_id}/cost-estimation") @Produces(MediaType.APPLICATION_XML) public Response getCostEstimation(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId, @PathParam("vm_id") String vmId, @PathParam("event_id") String eventId) throws InterruptedException { logger.info("GET request to path: /applications/" + applicationName + "/deployments/" + deploymentId + "/vms/" + vmId + "/events/" + eventId + "/cost-estimation"); energyModeller = getEnergyModeller(); VM vm = vmDAO.getById(Integer.parseInt(vmId)); List<String> ids = new ArrayList<String>(); ids.add("" + vm.getId()); String providerId = vm.getProviderId(); logger.debug("Connecting to Energy Modeller"); double energyEstimated = energyModeller.estimate(providerId, applicationName, deploymentId, ids, eventId, Unit.ENERGY, 0l); double powerEstimated = energyModeller.estimate(providerId, applicationName, deploymentId, ids, eventId, Unit.POWER, 0l); String secKey = EnergyModellerQueueController.generateKey(applicationName, eventId, deploymentId, ids, EnergyModellerQueueController.SEC); String countKey = EnergyModellerQueueController.generateKey(applicationName, eventId, deploymentId, ids, EnergyModellerQueueController.COUNT); Thread.sleep(1000l); EnergyModellerMessage emMessageSec = getEnergyModellerQueueController().getPredictionMessage(secKey); EnergyModellerMessage emMessageCount = getEnergyModellerQueueController().getPredictionMessage(countKey); Cost cost = new Cost(); cost.setEnergyValue(energyEstimated); cost.setPowerValue(powerEstimated); if(emMessageSec != null && emMessageCount != null) { logger.info("Parsing duration value of: " + emMessageSec.getValue()); logger.info("Parsig number events: " + emMessageCount.getValue()); long duration = (long) Double.parseDouble(emMessageSec.getValue()); int numberOfevents = (int) Double.parseDouble(emMessageCount.getValue()); int cpu = vm.getCpuActual(); int ram = (int) vm.getRamActual(); double storage = (double) vm.getDiskActual(); if(priceModellerClient == null) { priceModellerClient = PriceModellerClient.getInstance(); } int deploymentIdInt = Integer.parseInt(deploymentId); Deployment deployment = deploymentDAO.getById(deploymentIdInt); logger.info("id: " + deploymentIdInt + " cpu: " + cpu + " ram: " + ram + " Storage: " + storage + ", Energy estimated: " + energyEstimated + ", Schema: " + deployment.getSchema() + ", duration: " + duration + ", numberOfEvents: " + numberOfevents); double charges = priceModellerClient.getEventPredictedCharges(deploymentIdInt, cpu, ram, storage, energyEstimated, deployment.getSchema(), duration, numberOfevents); cost.setCharges(charges); } else { cost.setCharges(-1.0d); } String xml = XMLBuilder.getCostEstimationForAnEventInAVMXMLInfo(cost, applicationName, deploymentId, vmId, eventId); return buildResponse(Status.OK, xml); }  @GET @Produces(MediaType.APPLICATION_XML) Response getVMs(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId); @POST @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML) Response postVM(@PathParam("application_name") String applicationName, 
						   @PathParam("deployment_id") String deploymentId,
						   @DefaultValue("false") @QueryParam("force") boolean force,
						   String payload); @DELETE @Path("{vm_id}") Response deleteVM(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId, @PathParam("vm_id") String vmId); @GET @Path("{vm_id}") @Produces(MediaType.APPLICATION_XML) Response getVM(@PathParam("application_name") String applicationName,  @PathParam("deployment_id") String deploymentId, @PathParam("vm_id") String vmId); @GET @Path("{vm_id}/energy-estimation") @Produces(MediaType.APPLICATION_XML) Response getEnergyEstimation(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @DefaultValue("0") @QueryParam("duration") long duration); @GET @Path("{vm_id}/events/{event_id}/energy-estimation") @Produces(MediaType.APPLICATION_XML) Response getEnergyEstimationForAnEvent(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @PathParam("event_id") String eventId,
			                             @DefaultValue("0") @QueryParam("duration") long duration); @GET @Path("{vm_id}/power-estimation") @Produces(MediaType.APPLICATION_XML) Response getPowerEstimation(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId); @GET @Path("{vm_id}/events/{event_id}/power-estimation") @Produces(MediaType.APPLICATION_XML) Response getPowerEstimationForAnEvent(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @PathParam("event_id") String eventId); @GET @Path("{vm_id}/events/{event_id}/cost-estimation") @Produces(MediaType.APPLICATION_XML) Response getCostEstimation(@PathParam("application_name") String applicationName, 
			                          @PathParam("deployment_id") String deploymentId,
			                          @PathParam("vm_id") String vmId,
			                          @PathParam("event_id") String eventId); @GET @Path("{vm_id}/events/{event_id}/energy-consumption") @Produces(MediaType.APPLICATION_XML) Response getEventEnergyConsumption(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @PathParam("event_id") String eventId,
			                             @DefaultValue("0") @QueryParam("startTime") long startTime,
			                             @DefaultValue("0") @QueryParam("endTime") long endTime); @GET @Path("{vm_id}/events/{event_id}/power-consumption") @Produces(MediaType.APPLICATION_XML) Response getEventPowerConsumption(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @PathParam("event_id") String eventId,
			                             @QueryParam("startTime") long startTime,
			                             @QueryParam("endTime") long endTime,
			                             @Context UriInfo uriInfo); @GET @Path("{vm_id}/energy-consumption") @Produces(MediaType.APPLICATION_XML) Response getEnergyConsumption(@PathParam("application_name") String applicationName, 
										@PathParam("deployment_id") String deploymentId,
										@PathParam("vm_id") String vmId,
										@DefaultValue("0") @QueryParam("startTime") long startTime,
										@DefaultValue("0") @QueryParam("endTime") long endTime); @GET @Path("{vm_id}/power-consumption") @Produces(MediaType.APPLICATION_XML) Response getPowerConsumption(@PathParam("application_name") String applicationName, 
										@PathParam("deployment_id") String deploymentId,
										@PathParam("vm_id") String vmId,
										@DefaultValue("0") @QueryParam("startTime") long startTime,
										@DefaultValue("0") @QueryParam("endTime") long endTime,
										@Context UriInfo uriInfo); @GET @Path("{vm_id}/events/{event_id}/energy-sample") @Produces(MediaType.APPLICATION_XML) Response getEnergySample(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @PathParam("event_id") String eventId,
			                             @DefaultValue("0") @QueryParam("startTime") long startTime,
			                             @DefaultValue("0") @QueryParam("endTime") long endTime,
			                             @DefaultValue("0") @QueryParam("interval") long interval);  }