QualityAnalyzer { public double computeAvailability(Solution bestSol, Topology topology, SuitableOptions cloudCharacteristics) { visited = new HashSet<String>(); TopologyElement initialElement = topology.getInitialElement(); visited.add(initialElement.getName()); String cloudUsedInitialElement = bestSol.getCloudOfferNameForModule(initialElement.getName()); double instancesUsedInitialElement = -1; try { instancesUsedInitialElement = bestSol.getCloudInstancesForModule(initialElement.getName()); } catch (Exception E) { } double availabilityInitialElementInstance = cloudCharacteristics .getCloudCharacteristics(initialElement.getName(), cloudUsedInitialElement).getAvailability(); double unavailabilityInitialElement = Math.pow((1.0 - availabilityInitialElementInstance), instancesUsedInitialElement); double availabilityInitialElement = 1.0 - unavailabilityInitialElement; double systemAvailability = availabilityInitialElement; for (TopologyElementCalled c : topology.getInitialElement().getDependences()) { systemAvailability = systemAvailability * calculateAvailabilityRecursive(c, bestSol, topology, cloudCharacteristics); } if (log.isDebugEnabled()) { log.debug("Finished calculation of availability of solution: " + bestSol.toString()); } properties.setAvailability(systemAvailability); return systemAvailability; } 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);  }
@Test(enabled = TestConstants.EnabledTest) public void testAvailabilityEvaluation() { log.info("==== TEST for AVAILABILITY EVALUATION starts ===="); Solution bestSol = createSolution(); Topology topology = createTopology(); SuitableOptions cloudCharacteristics = createSuitableOptions(); double availability = analyzer.computeAvailability(bestSol, topology, cloudCharacteristics); Assert.assertTrue("Compute availability returned an impossible value", availability >= 0.0); Assert.assertTrue("Compute availability returned an impossible value", availability <= 1.0); log.info("Testing availability. Returned application availability is " + availability); log.info("==== TEST for AVAILABILITY EVALUATION finishes ===="); }