Search in sources :

Example 6 with ServiceLevelAgreement

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

the class SimpleServiceLevelAssessorTest method testAssessSufficientRequiredSuccess1st.

@Test
public void testAssessSufficientRequiredSuccess1st() {
    this.assessor.registerMetricAssessor(new TestMetricAssessor(1, "1"));
    ServiceLevelAgreement sla = this.provider.builder().name("test").obligationGroupBuilder(Condition.SUFFICIENT).obligationBuilder().description("test").metric(new TestMetric(1, "1")).build().build().obligationGroupBuilder(Condition.REQUIRED).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(1).extracting("result").contains(AssessmentResult.SUCCESS);
    assertThat(assessment.getObligationAssessments()).flatExtracting("metricAssessments").hasSize(1).extracting("result").contains(AssessmentResult.SUCCESS);
}
Also used : ServiceLevelAssessment(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAssessment) ServiceLevelAgreement(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement) Test(org.junit.Test)

Example 7 with ServiceLevelAgreement

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

the class SimpleServiceLevelAssessorTest method testAssessOptionalOptionalFailure1stWarning2nd.

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

Example 8 with ServiceLevelAgreement

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

the class SimpleServiceLevelAssessorTest method testAssessMetricFailure.

@Test
public void testAssessMetricFailure() {
    this.assessor.registerMetricAssessor(new TestMetricAssessor(0, "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.FAILURE);
}
Also used : ServiceLevelAssessment(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAssessment) ServiceLevelAgreement(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement) Test(org.junit.Test)

Example 9 with ServiceLevelAgreement

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

the class SimpleServiceLevelAssessorTest method testAssessMetricOnlySuccess.

@Test
public void testAssessMetricOnlySuccess() {
    this.assessor.registerMetricAssessor(new TestMetricAssessor(1, "1"));
    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.SUCCESS);
    assertThat(assessment.getObligationAssessments()).hasSize(1).extracting("result").contains(AssessmentResult.SUCCESS);
    assertThat(assessment.getObligationAssessments()).flatExtracting("metricAssessments").hasSize(1).extracting("result").contains(AssessmentResult.SUCCESS);
}
Also used : ServiceLevelAssessment(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAssessment) ServiceLevelAgreement(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement) Test(org.junit.Test)

Example 10 with ServiceLevelAgreement

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

the class SimpleServiceLevelAssessorTest method testAssessAllAssessorsSuccess.

@Test
public void testAssessAllAssessorsSuccess() {
    this.assessor.registerMetricAssessor(new TestMetricAssessor(1, "1"));
    this.assessor.registerObligationAssessor(new TestObligatinAssessor());
    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.SUCCESS);
    assertThat(assessment.getObligationAssessments()).hasSize(1).extracting("result").contains(AssessmentResult.SUCCESS);
    assertThat(assessment.getObligationAssessments()).flatExtracting("metricAssessments").hasSize(1).extracting("result").contains(AssessmentResult.SUCCESS);
}
Also used : ServiceLevelAssessment(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAssessment) ServiceLevelAgreement(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement) Test(org.junit.Test)

Aggregations

ServiceLevelAgreement (com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement)44 Test (org.junit.Test)20 ServiceLevelAssessment (com.thinkbiganalytics.metadata.sla.api.ServiceLevelAssessment)19 JcrServiceLevelAgreement (com.thinkbiganalytics.metadata.modeshape.sla.JcrServiceLevelAgreement)8 ArrayList (java.util.ArrayList)6 Feed (com.thinkbiganalytics.metadata.api.feed.Feed)5 Obligation (com.thinkbiganalytics.metadata.sla.api.Obligation)5 Node (javax.jcr.Node)5 JobIdentifier (com.thinkbiganalytics.scheduler.JobIdentifier)4 DefaultJobIdentifier (com.thinkbiganalytics.scheduler.model.DefaultJobIdentifier)4 List (java.util.List)4 Set (java.util.Set)4 Lists (com.google.common.collect.Lists)3 FeedServiceLevelAgreement (com.thinkbiganalytics.metadata.api.sla.FeedServiceLevelAgreement)3 FeedServiceLevelAgreementProvider (com.thinkbiganalytics.metadata.api.sla.FeedServiceLevelAgreementProvider)3 FeedServiceLevelAgreementRelationship (com.thinkbiganalytics.metadata.api.sla.FeedServiceLevelAgreementRelationship)3 JcrMetadataAccess (com.thinkbiganalytics.metadata.modeshape.JcrMetadataAccess)3 MetadataRepositoryException (com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException)3 JcrFeed (com.thinkbiganalytics.metadata.modeshape.feed.JcrFeed)3 JcrPropertyUtil (com.thinkbiganalytics.metadata.modeshape.support.JcrPropertyUtil)3