Search in sources :

Example 16 with ServiceLevelAssessment

use of com.thinkbiganalytics.metadata.sla.api.ServiceLevelAssessment in project kylo by Teradata.

the class SimpleServiceLevelAssessorTest method testAssessRequiredSufficientFailure1st.

@Test
public void testAssessRequiredSufficientFailure1st() {
    this.assessor.registerMetricAssessor(new TestMetricAssessor(1, "1"));
    ServiceLevelAgreement sla = this.provider.builder().name("test").obligationGroupBuilder(Condition.REQUIRED).obligationBuilder().description("test").metric(new TestMetric(0, "fail")).build().build().obligationGroupBuilder(Condition.SUFFICIENT).obligationBuilder().description("test").metric(new TestMetric(1, "1")).build().build().build();
    ServiceLevelAssessment assessment = this.assessor.assess(sla);
    assertThat(assessment.getResult()).isEqualTo(AssessmentResult.FAILURE);
    assertThat(assessment.getObligationAssessments()).hasSize(1).extracting("result").contains(AssessmentResult.FAILURE);
    assertThat(assessment.getObligationAssessments()).flatExtracting("metricAssessments").hasSize(1).extracting("result").contains(AssessmentResult.FAILURE);
}
Also used : ServiceLevelAssessment(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAssessment) ServiceLevelAgreement(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement) Test(org.junit.Test)

Example 17 with ServiceLevelAssessment

use of com.thinkbiganalytics.metadata.sla.api.ServiceLevelAssessment in project kylo by Teradata.

the class SimpleServiceLevelAssessorTest method testAssessRequiredSufficientSuccess1stFailure2nd.

@Test
public void testAssessRequiredSufficientSuccess1stFailure2nd() {
    this.assessor.registerMetricAssessor(new TestMetricAssessor(1, "1"));
    ServiceLevelAgreement sla = this.provider.builder().name("test").obligationGroupBuilder(Condition.REQUIRED).obligationBuilder().description("test").metric(new TestMetric(1, "1")).build().build().obligationGroupBuilder(Condition.SUFFICIENT).obligationBuilder().description("test").metric(new TestMetric(0, "fail")).build().build().build();
    ServiceLevelAssessment assessment = this.assessor.assess(sla);
    assertThat(assessment.getResult()).isEqualTo(AssessmentResult.SUCCESS);
    assertThat(assessment.getObligationAssessments()).hasSize(2).extracting("result").contains(AssessmentResult.FAILURE, AssessmentResult.SUCCESS);
    assertThat(assessment.getObligationAssessments()).flatExtracting("metricAssessments").hasSize(2).extracting("result").contains(AssessmentResult.FAILURE, AssessmentResult.SUCCESS);
}
Also used : ServiceLevelAssessment(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAssessment) ServiceLevelAgreement(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement) Test(org.junit.Test)

Example 18 with ServiceLevelAssessment

use of com.thinkbiganalytics.metadata.sla.api.ServiceLevelAssessment in project kylo by Teradata.

the class SimpleServiceLevelAssessorTest method testAssessObligationFailureMetricWaring.

@Test
public void testAssessObligationFailureMetricWaring() {
    this.assessor.registerMetricAssessor(new TestMetricAssessor(0, "fail", AssessmentResult.WARNING));
    this.assessor.registerObligationAssessor(new TestObligatinAssessor("fail"));
    ServiceLevelAgreement sla = this.provider.builder().name("test").obligationBuilder().description("test").metric(new TestMetric(1, "1")).build().build();
    ServiceLevelAssessment assessment = this.assessor.assess(sla);
    assertThat(assessment.getResult()).isEqualTo(AssessmentResult.FAILURE);
    assertThat(assessment.getObligationAssessments()).hasSize(1).extracting("result").contains(AssessmentResult.FAILURE);
    assertThat(assessment.getObligationAssessments()).flatExtracting("metricAssessments").hasSize(1).extracting("result").contains(AssessmentResult.WARNING);
}
Also used : ServiceLevelAssessment(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAssessment) ServiceLevelAgreement(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement) Test(org.junit.Test)

Example 19 with ServiceLevelAssessment

use of com.thinkbiganalytics.metadata.sla.api.ServiceLevelAssessment in project kylo by Teradata.

the class SimpleServiceLevelAssessorTest method testAssessSufficientSufficientFailure1stSuccess2nd.

@Test
public void testAssessSufficientSufficientFailure1stSuccess2nd() {
    this.assessor.registerMetricAssessor(new TestMetricAssessor(1, "1"));
    ServiceLevelAgreement sla = this.provider.builder().name("test").obligationGroupBuilder(Condition.SUFFICIENT).obligationBuilder().description("test").metric(new TestMetric(0, "fail")).build().build().obligationGroupBuilder(Condition.SUFFICIENT).obligationBuilder().description("test").metric(new TestMetric(1, "1")).build().build().build();
    ServiceLevelAssessment assessment = this.assessor.assess(sla);
    assertThat(assessment.getResult()).isEqualTo(AssessmentResult.SUCCESS);
    assertThat(assessment.getObligationAssessments()).hasSize(2).extracting("result").contains(AssessmentResult.FAILURE, AssessmentResult.SUCCESS);
    assertThat(assessment.getObligationAssessments()).flatExtracting("metricAssessments").hasSize(2).extracting("result").contains(AssessmentResult.FAILURE, AssessmentResult.SUCCESS);
}
Also used : ServiceLevelAssessment(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAssessment) ServiceLevelAgreement(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement) Test(org.junit.Test)

Aggregations

ServiceLevelAssessment (com.thinkbiganalytics.metadata.sla.api.ServiceLevelAssessment)19 ServiceLevelAgreement (com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement)18 Test (org.junit.Test)14 AssessorNotFoundException (com.thinkbiganalytics.metadata.sla.spi.AssessorNotFoundException)2 Alert (com.thinkbiganalytics.alerts.api.Alert)1 PreconditionTriggerEvent (com.thinkbiganalytics.metadata.api.event.feed.PreconditionTriggerEvent)1 FeedPrecondition (com.thinkbiganalytics.metadata.api.feed.FeedPrecondition)1 JcrServiceLevelAgreementCheck (com.thinkbiganalytics.metadata.modeshape.sla.JcrServiceLevelAgreementCheck)1 AssessmentResult (com.thinkbiganalytics.metadata.sla.api.AssessmentResult)1 Obligation (com.thinkbiganalytics.metadata.sla.api.Obligation)1 ObligationAssessment (com.thinkbiganalytics.metadata.sla.api.ObligationAssessment)1 ObligationGroup (com.thinkbiganalytics.metadata.sla.api.ObligationGroup)1 Condition (com.thinkbiganalytics.metadata.sla.api.ObligationGroup.Condition)1 ServiceLevelAgreementAction (com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreementAction)1 ServiceLevelAgreementActionConfiguration (com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreementActionConfiguration)1 ServiceLevelAgreementActionValidation (com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreementActionValidation)1 ServiceLevelAgreementCheck (com.thinkbiganalytics.metadata.sla.spi.ServiceLevelAgreementCheck)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 List (java.util.List)1