Search in sources :

Example 31 with ServiceLevelAgreement

use of com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement 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 32 with ServiceLevelAgreement

use of com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement 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 33 with ServiceLevelAgreement

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

the class SimpleServiceLevelAssessorTest method testAssessNoMetricAssessor.

@Test(expected = AssessorNotFoundException.class)
public void testAssessNoMetricAssessor() {
    ServiceLevelAgreement sla = this.provider.builder().name("test").obligationBuilder().description("test").metric(new TestMetric(1, "1")).build().build();
    this.assessor.assess(sla);
}
Also used : ServiceLevelAgreement(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement) Test(org.junit.Test)

Example 34 with ServiceLevelAgreement

use of com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement 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)

Example 35 with ServiceLevelAgreement

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

the class TestEmail method testVelocityEmail.

@Test
public void testVelocityEmail() {
    String email = "thinkbig.tester@gmail.com";
    String template = getTemplate();
    velocityService.registerTemplate("test", template);
    Map<String, Object> map = new HashMap();
    InMemorySLAProvider slaProvider = new InMemorySLAProvider();
    Metric m1 = new SimpleMetric();
    ServiceLevelAgreement sla = slaProvider.builder().name("Test SLA").description("Test SLA desc").obligationBuilder(ObligationGroup.Condition.REQUIRED).metric(m1).build().build();
    map.put("sla", sla);
    String emailBody = velocityService.mergeTemplate("test", map);
    Assert.assertEquals("This is my test Test SLA and description: Test SLA desc. \n" + "            Metric: this is my metric desc \n" + "       ", emailBody);
    int i = 0;
}
Also used : InMemorySLAProvider(com.thinkbiganalytics.metadata.sla.spi.core.InMemorySLAProvider) HashMap(java.util.HashMap) ServiceLevelAgreement(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement) Metric(com.thinkbiganalytics.metadata.sla.api.Metric) TestMetric(com.thinkbiganalytics.metadata.api.sla.TestMetric) 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