@Test public void testEnforce() { Date now = new Date(); Date since = new Date(now.getTime() - 10000); agreementEnforcement.enforce(agreement, since, false); IAgreement a = agreementDao.getByAgreementId(agreement.getAgreementId()); assertEquals(agreement.getGuaranteeTerms().get(0).getStatus(), a.getGuaranteeTerms().get(0).getStatus()); }
public void enforce(IAgreement agreement, Date since, boolean isLastExecution) { logger.debug("enforce(agreement={},since={})", agreement.getAgreementId(), since); final Date now = new Date(); checkInitialized(true); Map<IGuaranteeTerm, IMetricsRetrieverV2.RetrievalItem> retrievalItems = buildRetrievalItems(agreement, since, now, isLastExecution); Map<IGuaranteeTerm, List<IMonitoringMetric>> metricsMap; if (retriever instanceof IMetricsRetrieverV2) { metricsMap = getMetrics((IMetricsRetrieverV2)retriever, agreement, retrievalItems); } else { metricsMap = getMetrics(retriever, agreement, retrievalItems); } enforce(agreement, metricsMap); }
AgreementEnforcement { public void enforce(IAgreement agreement, Date since, boolean isLastExecution) { logger.debug("enforce(agreement={},since={})", agreement.getAgreementId(), since); final Date now = new Date(); checkInitialized(true); Map<IGuaranteeTerm, IMetricsRetrieverV2.RetrievalItem> retrievalItems = buildRetrievalItems(agreement, since, now, isLastExecution); Map<IGuaranteeTerm, List<IMonitoringMetric>> metricsMap; if (retriever instanceof IMetricsRetrieverV2) { metricsMap = getMetrics((IMetricsRetrieverV2)retriever, agreement, retrievalItems); } else { metricsMap = getMetrics(retriever, agreement, retrievalItems); } enforce(agreement, metricsMap); } }
AgreementEnforcement { public void enforce(IAgreement agreement, Date since, boolean isLastExecution) { logger.debug("enforce(agreement={},since={})", agreement.getAgreementId(), since); final Date now = new Date(); checkInitialized(true); Map<IGuaranteeTerm, IMetricsRetrieverV2.RetrievalItem> retrievalItems = buildRetrievalItems(agreement, since, now, isLastExecution); Map<IGuaranteeTerm, List<IMonitoringMetric>> metricsMap; if (retriever instanceof IMetricsRetrieverV2) { metricsMap = getMetrics((IMetricsRetrieverV2)retriever, agreement, retrievalItems); } else { metricsMap = getMetrics(retriever, agreement, retrievalItems); } enforce(agreement, metricsMap); } AgreementEnforcement(); }
AgreementEnforcement { public void enforce(IAgreement agreement, Date since, boolean isLastExecution) { logger.debug("enforce(agreement={},since={})", agreement.getAgreementId(), since); final Date now = new Date(); checkInitialized(true); Map<IGuaranteeTerm, IMetricsRetrieverV2.RetrievalItem> retrievalItems = buildRetrievalItems(agreement, since, now, isLastExecution); Map<IGuaranteeTerm, List<IMonitoringMetric>> metricsMap; if (retriever instanceof IMetricsRetrieverV2) { metricsMap = getMetrics((IMetricsRetrieverV2)retriever, agreement, retrievalItems); } else { metricsMap = getMetrics(retriever, agreement, retrievalItems); } enforce(agreement, metricsMap); } AgreementEnforcement(); void enforce(IAgreement agreement, Date since, boolean isLastExecution); void enforce(IAgreement agreement, Map<IGuaranteeTerm, List<IMonitoringMetric>> metricsMap); void enforceBusiness(IAgreement agreement,
            Map<IGuaranteeTerm, List<IViolation>> violationsMap); void setAgreementEvaluator(AgreementEvaluator agreementEval); void setMetricsRetriever(IMetricsRetriever retriever); void setMaxRetrievedResults(int maxRetrievedResults); void setConstraintEvaluator(IConstraintEvaluator constraintEval); }
AgreementEnforcement { public void enforce(IAgreement agreement, Date since, boolean isLastExecution) { logger.debug("enforce(agreement={},since={})", agreement.getAgreementId(), since); final Date now = new Date(); checkInitialized(true); Map<IGuaranteeTerm, IMetricsRetrieverV2.RetrievalItem> retrievalItems = buildRetrievalItems(agreement, since, now, isLastExecution); Map<IGuaranteeTerm, List<IMonitoringMetric>> metricsMap; if (retriever instanceof IMetricsRetrieverV2) { metricsMap = getMetrics((IMetricsRetrieverV2)retriever, agreement, retrievalItems); } else { metricsMap = getMetrics(retriever, agreement, retrievalItems); } enforce(agreement, metricsMap); } AgreementEnforcement(); void enforce(IAgreement agreement, Date since, boolean isLastExecution); void enforce(IAgreement agreement, Map<IGuaranteeTerm, List<IMonitoringMetric>> metricsMap); void enforceBusiness(IAgreement agreement,
            Map<IGuaranteeTerm, List<IViolation>> violationsMap); void setAgreementEvaluator(AgreementEvaluator agreementEval); void setMetricsRetriever(IMetricsRetriever retriever); void setMaxRetrievedResults(int maxRetrievedResults); void setConstraintEvaluator(IConstraintEvaluator constraintEval);  }