@Test public void testAssessEvent() { System.out.println("assessEvent"); EventData event = new EventData(0, 10, 4, EventData.Type.SLA_BREACH, EventData.Operator.LT, "SLAID", "AppID", "DeplyID", "GurID", "power_usage_per_app"); List<EventData> sequence = new ArrayList<>(); List<Response> recentAdaptation = new ArrayList<>(); ThresholdEventAssessor instance = new ThresholdEventAssessor(); instance.setThreshold(0); Response result = instance.assessEvent(event, sequence, recentAdaptation); assert(result != null); assert(result.getActionType().equals(Response.AdaptationType.REMOVE_VM)); }
@Override public Response assessEvent(EventData event, List<EventData> sequence, List<Response> recentAdaptation) { Response answer = null; List<EventData> previousData = EventDataAggregator.filterEventData(sequence, event.getSlaUuid(), event.getAgreementTerm()); if (previousData.size() >= threshold) { FiringCriteria rule = getFirstMatchingFiringCriteria(event); int previousActionCount = ResponseHistoryAggregator.filterResponseHistory(recentAdaptation, event.getSlaUuid(), event.getAgreementTerm()).size(); if (rule != null && previousActionCount == 0) { answer = new Response(getActuator(), event, rule.getResponseType()); answer.setAdaptationDetails(rule.getParameters()); } return answer; } return answer; }
ThresholdEventAssessor extends AbstractEventAssessor { @Override public Response assessEvent(EventData event, List<EventData> sequence, List<Response> recentAdaptation) { Response answer = null; List<EventData> previousData = EventDataAggregator.filterEventData(sequence, event.getSlaUuid(), event.getAgreementTerm()); if (previousData.size() >= threshold) { FiringCriteria rule = getFirstMatchingFiringCriteria(event); int previousActionCount = ResponseHistoryAggregator.filterResponseHistory(recentAdaptation, event.getSlaUuid(), event.getAgreementTerm()).size(); if (rule != null && previousActionCount == 0) { answer = new Response(getActuator(), event, rule.getResponseType()); answer.setAdaptationDetails(rule.getParameters()); } return answer; } return answer; } }
ThresholdEventAssessor extends AbstractEventAssessor { @Override public Response assessEvent(EventData event, List<EventData> sequence, List<Response> recentAdaptation) { Response answer = null; List<EventData> previousData = EventDataAggregator.filterEventData(sequence, event.getSlaUuid(), event.getAgreementTerm()); if (previousData.size() >= threshold) { FiringCriteria rule = getFirstMatchingFiringCriteria(event); int previousActionCount = ResponseHistoryAggregator.filterResponseHistory(recentAdaptation, event.getSlaUuid(), event.getAgreementTerm()).size(); if (rule != null && previousActionCount == 0) { answer = new Response(getActuator(), event, rule.getResponseType()); answer.setAdaptationDetails(rule.getParameters()); } return answer; } return answer; } ThresholdEventAssessor(); }
ThresholdEventAssessor extends AbstractEventAssessor { @Override public Response assessEvent(EventData event, List<EventData> sequence, List<Response> recentAdaptation) { Response answer = null; List<EventData> previousData = EventDataAggregator.filterEventData(sequence, event.getSlaUuid(), event.getAgreementTerm()); if (previousData.size() >= threshold) { FiringCriteria rule = getFirstMatchingFiringCriteria(event); int previousActionCount = ResponseHistoryAggregator.filterResponseHistory(recentAdaptation, event.getSlaUuid(), event.getAgreementTerm()).size(); if (rule != null && previousActionCount == 0) { answer = new Response(getActuator(), event, rule.getResponseType()); answer.setAdaptationDetails(rule.getParameters()); } return answer; } return answer; } ThresholdEventAssessor(); boolean writeOutDefaults(ResultsStore rulesFile); @Override Response assessEvent(EventData event, List<EventData> sequence, List<Response> recentAdaptation); int getThreshold(); void setThreshold(int threshold); }
ThresholdEventAssessor extends AbstractEventAssessor { @Override public Response assessEvent(EventData event, List<EventData> sequence, List<Response> recentAdaptation) { Response answer = null; List<EventData> previousData = EventDataAggregator.filterEventData(sequence, event.getSlaUuid(), event.getAgreementTerm()); if (previousData.size() >= threshold) { FiringCriteria rule = getFirstMatchingFiringCriteria(event); int previousActionCount = ResponseHistoryAggregator.filterResponseHistory(recentAdaptation, event.getSlaUuid(), event.getAgreementTerm()).size(); if (rule != null && previousActionCount == 0) { answer = new Response(getActuator(), event, rule.getResponseType()); answer.setAdaptationDetails(rule.getParameters()); } return answer; } return answer; } ThresholdEventAssessor(); boolean writeOutDefaults(ResultsStore rulesFile); @Override Response assessEvent(EventData event, List<EventData> sequence, List<Response> recentAdaptation); int getThreshold(); void setThreshold(int threshold);  }