@Test(enabled = TestConstants.EnabledTest) public void testCostEvaluation() { log.info("==== TEST for COST EVALUATION starts ===="); Solution bestSol = createSolution(); SuitableOptions cloudCharacteristics = createSuitableOptions(); double cost = analyzer.computeCost(bestSol, cloudCharacteristics); Assert.assertTrue("Compute cost returned an impossible value", cost >= 0.0); log.info("Testing cost. Returned application cost is " + cost); log.info("==== TEST for COST EVALUATION finishes ===="); }
public double computeCost(Solution bestSol, SuitableOptions cloudCharacteristics) { double cost = 0.0; for (String moduleName : bestSol) { String cloudUsedForElement = bestSol.getCloudOfferNameForModule(moduleName); double instancesUsedForElement = -1; try { instancesUsedForElement = bestSol.getCloudInstancesForModule(moduleName); } catch (Exception E) { } double costElementInstance = cloudCharacteristics.getCloudCharacteristics(moduleName, cloudUsedForElement) .getCost(); cost += (instancesUsedForElement * costElementInstance); } properties.setCostHour(cost); return cost; }
QualityAnalyzer { public double computeCost(Solution bestSol, SuitableOptions cloudCharacteristics) { double cost = 0.0; for (String moduleName : bestSol) { String cloudUsedForElement = bestSol.getCloudOfferNameForModule(moduleName); double instancesUsedForElement = -1; try { instancesUsedForElement = bestSol.getCloudInstancesForModule(moduleName); } catch (Exception E) { } double costElementInstance = cloudCharacteristics.getCloudCharacteristics(moduleName, cloudUsedForElement) .getCost(); cost += (instancesUsedForElement * costElementInstance); } properties.setCostHour(cost); return cost; } }
QualityAnalyzer { public double computeCost(Solution bestSol, SuitableOptions cloudCharacteristics) { double cost = 0.0; for (String moduleName : bestSol) { String cloudUsedForElement = bestSol.getCloudOfferNameForModule(moduleName); double instancesUsedForElement = -1; try { instancesUsedForElement = bestSol.getCloudInstancesForModule(moduleName); } catch (Exception E) { } double costElementInstance = cloudCharacteristics.getCloudCharacteristics(moduleName, cloudUsedForElement) .getCost(); cost += (instancesUsedForElement * costElementInstance); } properties.setCostHour(cost); return cost; } QualityAnalyzer();  QualityAnalyzer(boolean debug);  QualityAnalyzer(double maxWorkload);  QualityAnalyzer(double maxWorkload, boolean debug);  QualityAnalyzer(double maxWorkload, double workloadIncrement);  QualityAnalyzer(double maxWorkload, double workloadIncrement, boolean debug); }
QualityAnalyzer { public double computeCost(Solution bestSol, SuitableOptions cloudCharacteristics) { double cost = 0.0; for (String moduleName : bestSol) { String cloudUsedForElement = bestSol.getCloudOfferNameForModule(moduleName); double instancesUsedForElement = -1; try { instancesUsedForElement = bestSol.getCloudInstancesForModule(moduleName); } catch (Exception E) { } double costElementInstance = cloudCharacteristics.getCloudCharacteristics(moduleName, cloudUsedForElement) .getCost(); cost += (instancesUsedForElement * costElementInstance); } properties.setCostHour(cost); return cost; } QualityAnalyzer();  QualityAnalyzer(boolean debug);  QualityAnalyzer(double maxWorkload);  QualityAnalyzer(double maxWorkload, boolean debug);  QualityAnalyzer(double maxWorkload, double workloadIncrement);  QualityAnalyzer(double maxWorkload, double workloadIncrement, boolean debug); QualityInformation getAllComputedQualities(); QualityInformation computePerformance(Solution bestSol, Topology topology, double workload,
         SuitableOptions cloudCharacteristics); double computeAvailability(Solution bestSol, Topology topology, SuitableOptions cloudCharacteristics); double computeCost(Solution bestSol, SuitableOptions cloudCharacteristics); HashMap<String, ArrayList<Double>> computeThresholds(Solution solInput, Topology topology,
         QualityInformation requirements, SuitableOptions cloudCharacteristics); }
QualityAnalyzer { public double computeCost(Solution bestSol, SuitableOptions cloudCharacteristics) { double cost = 0.0; for (String moduleName : bestSol) { String cloudUsedForElement = bestSol.getCloudOfferNameForModule(moduleName); double instancesUsedForElement = -1; try { instancesUsedForElement = bestSol.getCloudInstancesForModule(moduleName); } catch (Exception E) { } double costElementInstance = cloudCharacteristics.getCloudCharacteristics(moduleName, cloudUsedForElement) .getCost(); cost += (instancesUsedForElement * costElementInstance); } properties.setCostHour(cost); return cost; } QualityAnalyzer();  QualityAnalyzer(boolean debug);  QualityAnalyzer(double maxWorkload);  QualityAnalyzer(double maxWorkload, boolean debug);  QualityAnalyzer(double maxWorkload, double workloadIncrement);  QualityAnalyzer(double maxWorkload, double workloadIncrement, boolean debug); QualityInformation getAllComputedQualities(); QualityInformation computePerformance(Solution bestSol, Topology topology, double workload,
         SuitableOptions cloudCharacteristics); double computeAvailability(Solution bestSol, Topology topology, SuitableOptions cloudCharacteristics); double computeCost(Solution bestSol, SuitableOptions cloudCharacteristics); HashMap<String, ArrayList<Double>> computeThresholds(Solution solInput, Topology topology,
         QualityInformation requirements, SuitableOptions cloudCharacteristics);  }