Search in sources :

Example 26 with ServiceLevelAgreement

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

the class InMemorySLAProviderTest method testFindByName.

@Test
public void testFindByName() {
    ServiceLevelAgreement sla = this.provider.builder().name("testCreateSLA").build();
    ServiceLevelAgreement found = this.provider.findAgreementByName(sla.getName());
    assertThat(found).isNotNull();
    assertThat(found.getId()).isEqualTo(sla.getId());
    assertThat(found.getName()).isEqualTo(sla.getName());
}
Also used : ServiceLevelAgreement(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement) Test(org.junit.Test)

Example 27 with ServiceLevelAgreement

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

the class InMemorySLAProviderTest method testCreate.

@Test
public void testCreate() {
    ServiceLevelAgreement.ID id = this.provider.builder().name("testCreateSLA").description("testCreateSLA").obligationBuilder().description("testCreateSLA-o1").metric(createTestMetric("o1-m1")).build().obligationBuilder().description("testCreateSLA-o2").metric(createTestMetric("o2-m1")).metric(createTestMetric("o2-m2")).build().build().getId();
    assertThat(this.provider.getAgreements()).hasSize(1);
    ServiceLevelAgreement sla = this.provider.getAgreement(id);
    assertThat(sla.getName()).isEqualTo("testCreateSLA");
    assertThat(sla.getDescription()).isEqualTo("testCreateSLA");
    assertThat(sla.getObligations()).hasSize(2).extracting("description").contains("testCreateSLA-o1", "testCreateSLA-o2");
    assertThat(sla.getObligations()).flatExtracting("metrics").hasSize(3).extracting("description").contains("o1-m1", "o2-m1", "o2-m2");
}
Also used : ServiceLevelAgreement(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement) Test(org.junit.Test)

Example 28 with ServiceLevelAgreement

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

the class SimpleServiceLevelAssessmentCompareTest method testCompareEqualObligationComparables.

@Test
public void testCompareEqualObligationComparables() {
    this.assessor.registerMetricAssessor(new TestMetricAssessor(1, "1"));
    this.assessor.registerObligationAssessor(new TestObligatinAssessor("test"));
    ServiceLevelAgreement sla = this.provider.builder().name("test").obligationBuilder().description("test").metric(new TestMetric(1, "1")).build().build();
    ServiceLevelAssessment assmt1 = this.assessor.assess(sla);
    ServiceLevelAssessment assmt2 = this.assessor.assess(sla);
    assertThat(assmt1).isEqualByComparingTo(assmt2);
}
Also used : ServiceLevelAssessment(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAssessment) ServiceLevelAgreement(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement) Test(org.junit.Test)

Example 29 with ServiceLevelAgreement

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

the class SimpleServiceLevelAssessorTest method testAssessMetricWaring.

@Test
public void testAssessMetricWaring() {
    this.assessor.registerMetricAssessor(new TestMetricAssessor(0, "fail", AssessmentResult.WARNING));
    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.WARNING);
    assertThat(assessment.getObligationAssessments()).hasSize(1).extracting("result").contains(AssessmentResult.WARNING);
    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 30 with ServiceLevelAgreement

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

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