Search in sources :

Example 1 with ServiceLevelAssessment

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

the class MetadataClientTest method testCheckPrecondition.

// @Test
public void testCheckPrecondition() throws ParseException {
    Feed feedA = buildFeed("category", "feedA").post();
    Feed feedB = buildFeed("category", "feedB", "category", "feedA").post();
    HiveTableDatasource dsA = buildHiveTableDatasource("test-table").post();
    feedA = client.addDestination(feedA.getId(), dsA.getId());
    String destIdA = feedA.getDestinations().iterator().next().getId();
    DataOperation op = client.beginOperation(destIdA, "");
    op.setState(State.SUCCESS);
    op.setDataset(new Dataset(new DateTime(), dsA, ChangeType.UPDATE, ContentType.PARTITIONS));
    op = client.updateDataOperation(op);
    ServiceLevelAssessment assmt = client.assessPrecondition(feedB.getId());
    assertThat(assmt).isNotNull();
}
Also used : ServiceLevelAssessment(com.thinkbiganalytics.metadata.rest.model.sla.ServiceLevelAssessment) DataOperation(com.thinkbiganalytics.metadata.rest.model.op.DataOperation) Dataset(com.thinkbiganalytics.metadata.rest.model.op.Dataset) DateTime(org.joda.time.DateTime) Feed(com.thinkbiganalytics.metadata.rest.model.feed.Feed) FeedExecutedSinceFeed(com.thinkbiganalytics.metadata.api.sla.FeedExecutedSinceFeed) HiveTableDatasource(com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource)

Example 2 with ServiceLevelAssessment

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

the class IntegrationTestBase method getServiceLevelAssessments.

protected ServiceLevelAssessment[] getServiceLevelAssessments(String filter) {
    LOG.info(String.format("Getting up to 50 SLA Assessments for filter %s", filter));
    Response response = given(ServiceLevelAssessmentsController.BASE).urlEncodingEnabled(// url encoding enabled false to avoid replacing percent symbols in url query part
    false).when().get("?filter=" + filter + "&limit=50&sort=-createdTime&start=0");
    response.then().statusCode(HTTP_OK);
    SearchResult<Object> result = response.as(SearchResultImpl.class);
    final ObjectMapper mapper = new ObjectMapper();
    return result.getData().stream().map(o -> mapper.convertValue(o, ServiceLevelAssessment.class)).toArray(ServiceLevelAssessment[]::new);
}
Also used : Response(com.jayway.restassured.response.Response) Arrays(java.util.Arrays) PartitionField(com.thinkbiganalytics.feedmgr.rest.model.schema.PartitionField) ReusableTemplateConnectionInfo(com.thinkbiganalytics.feedmgr.rest.model.ReusableTemplateConnectionInfo) StringUtils(org.apache.commons.lang3.StringUtils) MediaType(javax.ws.rs.core.MediaType) DefaultDataTypeDescriptor(com.thinkbiganalytics.discovery.model.DefaultDataTypeDescriptor) SpringJUnit4ClassRunner(org.springframework.test.context.junit4.SpringJUnit4ClassRunner) AlertsController(com.thinkbiganalytics.alerts.rest.controller.AlertsController) SchedulerRestController(com.thinkbiganalytics.scheduler.rest.controller.SchedulerRestController) NifiFeed(com.thinkbiganalytics.feedmgr.rest.model.NifiFeed) JsonNode(com.fasterxml.jackson.databind.JsonNode) Tag(com.thinkbiganalytics.discovery.schema.Tag) Scp(org.apache.tools.ant.taskdefs.optional.ssh.Scp) JsonPath(com.jayway.restassured.path.json.JsonPath) PermissionsChange(com.thinkbiganalytics.security.rest.model.PermissionsChange) FeedSchedule(com.thinkbiganalytics.feedmgr.rest.model.FeedSchedule) NifiProperty(com.thinkbiganalytics.nifi.rest.model.NifiProperty) JobsRestController(com.thinkbiganalytics.jobrepo.rest.controller.JobsRestController) ActionGroup(com.thinkbiganalytics.security.rest.model.ActionGroup) Set(java.util.Set) ServiceLevelAssessment(com.thinkbiganalytics.metadata.rest.model.sla.ServiceLevelAssessment) EntityVersionDifference(com.thinkbiganalytics.feedmgr.rest.model.EntityVersionDifference) JobAction(com.thinkbiganalytics.jobrepo.repository.rest.model.JobAction) PortDTO(org.apache.nifi.web.api.dto.PortDTO) ImportTemplateOptions(com.thinkbiganalytics.feedmgr.rest.model.ImportTemplateOptions) RestAssured(com.jayway.restassured.RestAssured) RoleMembershipChange(com.thinkbiganalytics.security.rest.model.RoleMembershipChange) AdminControllerV2(com.thinkbiganalytics.feedmgr.rest.controller.AdminControllerV2) SearchResultImpl(com.thinkbiganalytics.rest.model.search.SearchResultImpl) AdminController(com.thinkbiganalytics.feedmgr.rest.controller.AdminController) DatasourceController(com.thinkbiganalytics.feedmgr.rest.controller.DatasourceController) RunWith(org.junit.runner.RunWith) LocalDateTime(java.time.LocalDateTime) Jackson2ObjectMapperFactory(com.jayway.restassured.mapper.factory.Jackson2ObjectMapperFactory) FeedMetadata(com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata) AccessControlController(com.thinkbiganalytics.security.rest.controller.AccessControlController) ArrayList(java.util.ArrayList) HTTP_OK(java.net.HttpURLConnection.HTTP_OK) FeedCategory(com.thinkbiganalytics.feedmgr.rest.model.FeedCategory) RestResponseStatus(com.thinkbiganalytics.rest.model.RestResponseStatus) JdbcDatasource(com.thinkbiganalytics.metadata.rest.model.data.JdbcDatasource) AlertRange(com.thinkbiganalytics.alerts.rest.model.AlertRange) User(com.thinkbiganalytics.security.rest.model.User) RegisteredTemplate(com.thinkbiganalytics.feedmgr.rest.model.RegisteredTemplate) ObligationGroup(com.thinkbiganalytics.metadata.sla.api.ObligationGroup) Before(org.junit.Before) Uninterruptibles(com.google.common.util.concurrent.Uninterruptibles) FeedCategoryRestController(com.thinkbiganalytics.feedmgr.rest.controller.FeedCategoryRestController) ServiceLevelAgreement(com.thinkbiganalytics.metadata.rest.model.sla.ServiceLevelAgreement) DefaultHiveSchema(com.thinkbiganalytics.discovery.model.DefaultHiveSchema) SearchResult(com.thinkbiganalytics.rest.model.search.SearchResult) File(java.io.File) ExecutedStep(com.thinkbiganalytics.jobrepo.query.model.ExecutedStep) NifiIntegrationRestController(com.thinkbiganalytics.feedmgr.rest.controller.NifiIntegrationRestController) HiveRestController(com.thinkbiganalytics.hive.rest.controller.HiveRestController) ContextConfiguration(org.springframework.test.context.ContextConfiguration) Assert(org.junit.Assert) ContentType(com.jayway.restassured.http.ContentType) ImportComponentOption(com.thinkbiganalytics.feedmgr.rest.model.ImportComponentOption) DefaultExecutedJob(com.thinkbiganalytics.jobrepo.query.model.DefaultExecutedJob) HTTP_BAD_REQUEST(java.net.HttpURLConnection.HTTP_BAD_REQUEST) DefaultExecutedStep(com.thinkbiganalytics.jobrepo.query.model.DefaultExecutedStep) ImportComponentOptionBuilder(com.thinkbiganalytics.feedmgr.rest.model.ImportComponentOptionBuilder) URL(java.net.URL) URISyntaxException(java.net.URISyntaxException) LoggerFactory(org.slf4j.LoggerFactory) ServiceLevelAgreementRestController(com.thinkbiganalytics.feedmgr.rest.controller.ServiceLevelAgreementRestController) HTTP_NO_CONTENT(java.net.HttpURLConnection.HTTP_NO_CONTENT) DeserializationFeature(com.fasterxml.jackson.databind.DeserializationFeature) ObjectMapperSerializer(com.thinkbiganalytics.json.ObjectMapperSerializer) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) ServiceLevelAssessmentsController(com.thinkbiganalytics.jobrepo.rest.controller.ServiceLevelAssessmentsController) FeedVersions(com.thinkbiganalytics.feedmgr.rest.model.FeedVersions) ServiceLevelAgreementGroup(com.thinkbiganalytics.feedmgr.sla.ServiceLevelAgreementGroup) SSHBase(org.apache.tools.ant.taskdefs.optional.ssh.SSHBase) ImportTemplate(com.thinkbiganalytics.feedmgr.service.template.importing.model.ImportTemplate) FeedRestController(com.thinkbiganalytics.feedmgr.rest.controller.FeedRestController) JSON(com.jayway.restassured.http.ContentType.JSON) DefaultTag(com.thinkbiganalytics.discovery.model.DefaultTag) UUID(java.util.UUID) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) FeedSummary(com.thinkbiganalytics.feedmgr.rest.model.FeedSummary) ScheduleIdentifier(com.thinkbiganalytics.scheduler.rest.model.ScheduleIdentifier) List(java.util.List) ImportFeed(com.thinkbiganalytics.feedmgr.service.feed.importing.model.ImportFeed) JodaModule(com.fasterxml.jackson.datatype.joda.JodaModule) ImportComponent(com.thinkbiganalytics.feedmgr.rest.ImportComponent) Jackson2Mapper(com.jayway.restassured.internal.mapping.Jackson2Mapper) ChronoField(java.time.temporal.ChronoField) RequestSpecification(com.jayway.restassured.specification.RequestSpecification) Feed(com.thinkbiganalytics.metadata.api.feed.Feed) HashMap(java.util.HashMap) Response(com.jayway.restassured.response.Response) DefaultField(com.thinkbiganalytics.discovery.model.DefaultField) HashSet(java.util.HashSet) Inject(javax.inject.Inject) TemplatesRestController(com.thinkbiganalytics.feedmgr.rest.controller.TemplatesRestController) NifiFlowProcessGroup(com.thinkbiganalytics.nifi.rest.model.flow.NifiFlowProcessGroup) Project(org.apache.tools.ant.Project) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) SSHExec(org.apache.tools.ant.taskdefs.optional.ssh.SSHExec) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) SystemNamingService(com.thinkbiganalytics.feedmgr.rest.support.SystemNamingService) FieldRuleProperty(com.thinkbiganalytics.policy.rest.model.FieldRuleProperty) TimeUnit(java.util.concurrent.TimeUnit) ServiceLevelAgreementRule(com.thinkbiganalytics.feedmgr.sla.ServiceLevelAgreementRule) DateTimeFormatter(java.time.format.DateTimeFormatter) SerializationFeature(com.fasterxml.jackson.databind.SerializationFeature) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

ServiceLevelAssessment (com.thinkbiganalytics.metadata.rest.model.sla.ServiceLevelAssessment)2 DeserializationFeature (com.fasterxml.jackson.databind.DeserializationFeature)1 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 SerializationFeature (com.fasterxml.jackson.databind.SerializationFeature)1 SimpleModule (com.fasterxml.jackson.databind.module.SimpleModule)1 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 JodaModule (com.fasterxml.jackson.datatype.joda.JodaModule)1 Uninterruptibles (com.google.common.util.concurrent.Uninterruptibles)1 RestAssured (com.jayway.restassured.RestAssured)1 ContentType (com.jayway.restassured.http.ContentType)1 JSON (com.jayway.restassured.http.ContentType.JSON)1 Jackson2Mapper (com.jayway.restassured.internal.mapping.Jackson2Mapper)1 Jackson2ObjectMapperFactory (com.jayway.restassured.mapper.factory.Jackson2ObjectMapperFactory)1 JsonPath (com.jayway.restassured.path.json.JsonPath)1 Response (com.jayway.restassured.response.Response)1 RequestSpecification (com.jayway.restassured.specification.RequestSpecification)1 AlertsController (com.thinkbiganalytics.alerts.rest.controller.AlertsController)1 AlertRange (com.thinkbiganalytics.alerts.rest.model.AlertRange)1 DefaultDataTypeDescriptor (com.thinkbiganalytics.discovery.model.DefaultDataTypeDescriptor)1