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());
}
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");
}
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);
}
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);
}
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);
}
Aggregations