@Test public void testAssessEvent() { try { System.out.println("assessEvent"); EventData event = new EventData(0, 400, 800, EventData.Type.SLA_BREACH, EventData.Operator.GT, "SLAID", "AppID", "DeplyID", "GurID", "power_usage_per_app"); List<EventData> sequence = new ArrayList<>(); List<Response> recentAdaptation = new ArrayList<>(); FuzzyEventAssessor instance = new FuzzyEventAssessor(); Response result = instance.assessEvent(event, sequence, recentAdaptation); assert(result != null); System.out.println(result.getActionType()); assert(result.getActionType().equals(Response.AdaptationType.REMOVE_VM)); } catch (FileNotFoundException ex) { Logger.getLogger(FuzzyEventAssessorTest.class.getName()).log(Level.SEVERE, null, ex); } }
@Override public Response assessEvent(EventData event, List<EventData> sequence, List<Response> recentAdaptation) { Response answer = null; if (event == null | sequence == null | recentAdaptation == null) { return answer; } double trendValue = EventDataAggregator.analyseEventData(sequence); fis.setVariable("currentDifference", event.getDeviationBetweenRawAndGuarantee()); fis.setVariable("trendDifference", trendValue); fis.setVariable("energy_usage_per_app", EventDataAggregator.filterEventData(sequence, event.getSlaUuid(), "energy_usage_per_app").size()); fis.setVariable("power_usage_per_app", EventDataAggregator.filterEventData(sequence, event.getSlaUuid(), "power_usage_per_app").size()); fis.evaluate(); for (RuleBlock ruleBlock : fis.getFunctionBlock("adaptor").getRuleBlocks().values()) { for (Rule rule : ruleBlock.getRules()) { System.out.println(rule); if (rule.getDegreeOfSupport() == 1.0) { answer = new Response(getActuator(), event, Response.getAdaptationType(ruleBlock.getName())); return answer; } } } return answer; }
FuzzyEventAssessor extends AbstractEventAssessor { @Override public Response assessEvent(EventData event, List<EventData> sequence, List<Response> recentAdaptation) { Response answer = null; if (event == null | sequence == null | recentAdaptation == null) { return answer; } double trendValue = EventDataAggregator.analyseEventData(sequence); fis.setVariable("currentDifference", event.getDeviationBetweenRawAndGuarantee()); fis.setVariable("trendDifference", trendValue); fis.setVariable("energy_usage_per_app", EventDataAggregator.filterEventData(sequence, event.getSlaUuid(), "energy_usage_per_app").size()); fis.setVariable("power_usage_per_app", EventDataAggregator.filterEventData(sequence, event.getSlaUuid(), "power_usage_per_app").size()); fis.evaluate(); for (RuleBlock ruleBlock : fis.getFunctionBlock("adaptor").getRuleBlocks().values()) { for (Rule rule : ruleBlock.getRules()) { System.out.println(rule); if (rule.getDegreeOfSupport() == 1.0) { answer = new Response(getActuator(), event, Response.getAdaptationType(ruleBlock.getName())); return answer; } } } return answer; } }
FuzzyEventAssessor extends AbstractEventAssessor { @Override public Response assessEvent(EventData event, List<EventData> sequence, List<Response> recentAdaptation) { Response answer = null; if (event == null | sequence == null | recentAdaptation == null) { return answer; } double trendValue = EventDataAggregator.analyseEventData(sequence); fis.setVariable("currentDifference", event.getDeviationBetweenRawAndGuarantee()); fis.setVariable("trendDifference", trendValue); fis.setVariable("energy_usage_per_app", EventDataAggregator.filterEventData(sequence, event.getSlaUuid(), "energy_usage_per_app").size()); fis.setVariable("power_usage_per_app", EventDataAggregator.filterEventData(sequence, event.getSlaUuid(), "power_usage_per_app").size()); fis.evaluate(); for (RuleBlock ruleBlock : fis.getFunctionBlock("adaptor").getRuleBlocks().values()) { for (Rule rule : ruleBlock.getRules()) { System.out.println(rule); if (rule.getDegreeOfSupport() == 1.0) { answer = new Response(getActuator(), event, Response.getAdaptationType(ruleBlock.getName())); return answer; } } } return answer; } FuzzyEventAssessor(); }
FuzzyEventAssessor extends AbstractEventAssessor { @Override public Response assessEvent(EventData event, List<EventData> sequence, List<Response> recentAdaptation) { Response answer = null; if (event == null | sequence == null | recentAdaptation == null) { return answer; } double trendValue = EventDataAggregator.analyseEventData(sequence); fis.setVariable("currentDifference", event.getDeviationBetweenRawAndGuarantee()); fis.setVariable("trendDifference", trendValue); fis.setVariable("energy_usage_per_app", EventDataAggregator.filterEventData(sequence, event.getSlaUuid(), "energy_usage_per_app").size()); fis.setVariable("power_usage_per_app", EventDataAggregator.filterEventData(sequence, event.getSlaUuid(), "power_usage_per_app").size()); fis.evaluate(); for (RuleBlock ruleBlock : fis.getFunctionBlock("adaptor").getRuleBlocks().values()) { for (Rule rule : ruleBlock.getRules()) { System.out.println(rule); if (rule.getDegreeOfSupport() == 1.0) { answer = new Response(getActuator(), event, Response.getAdaptationType(ruleBlock.getName())); return answer; } } } return answer; } FuzzyEventAssessor(); void printFuzzyDataEvaluation(); @Override Response assessEvent(EventData event, List<EventData> sequence, List<Response> recentAdaptation); static String getRuleFile(); static void setRuleFile(String ruleFile); }
FuzzyEventAssessor extends AbstractEventAssessor { @Override public Response assessEvent(EventData event, List<EventData> sequence, List<Response> recentAdaptation) { Response answer = null; if (event == null | sequence == null | recentAdaptation == null) { return answer; } double trendValue = EventDataAggregator.analyseEventData(sequence); fis.setVariable("currentDifference", event.getDeviationBetweenRawAndGuarantee()); fis.setVariable("trendDifference", trendValue); fis.setVariable("energy_usage_per_app", EventDataAggregator.filterEventData(sequence, event.getSlaUuid(), "energy_usage_per_app").size()); fis.setVariable("power_usage_per_app", EventDataAggregator.filterEventData(sequence, event.getSlaUuid(), "power_usage_per_app").size()); fis.evaluate(); for (RuleBlock ruleBlock : fis.getFunctionBlock("adaptor").getRuleBlocks().values()) { for (Rule rule : ruleBlock.getRules()) { System.out.println(rule); if (rule.getDegreeOfSupport() == 1.0) { answer = new Response(getActuator(), event, Response.getAdaptationType(ruleBlock.getName())); return answer; } } } return answer; } FuzzyEventAssessor(); void printFuzzyDataEvaluation(); @Override Response assessEvent(EventData event, List<EventData> sequence, List<Response> recentAdaptation); static String getRuleFile(); static void setRuleFile(String ruleFile);  }