Search in sources :

Example 11 with FeedSummary

use of com.thinkbiganalytics.feedmgr.rest.model.FeedSummary in project kylo by Teradata.

the class IntegrationTestBase method deleteExistingFeeds.

protected void deleteExistingFeeds() {
    LOG.info("Deleting existing feeds");
    // start clean - delete all feeds
    FeedSummary[] feeds = getFeeds();
    for (FeedSummary feed : feeds) {
        deleteFeed(feed.getFeedId());
    }
    feeds = getFeeds();
    Assert.assertTrue(feeds.length == 0);
}
Also used : FeedSummary(com.thinkbiganalytics.feedmgr.rest.model.FeedSummary)

Example 12 with FeedSummary

use of com.thinkbiganalytics.feedmgr.rest.model.FeedSummary in project kylo by Teradata.

the class IntegrationTestBase method getFeeds.

protected FeedSummary[] getFeeds() {
    final ObjectMapper mapper = new ObjectMapper();
    SearchResult<Object> searchResult = getFeedsExpectingStatus(HTTP_OK).as(SearchResultImpl.class);
    return searchResult.getData().stream().map(o -> mapper.convertValue(o, FeedSummary.class)).toArray(FeedSummary[]::new);
}
Also used : ConnectorController(com.thinkbiganalytics.kylo.catalog.rest.controller.ConnectorController) 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) DataSource(com.thinkbiganalytics.kylo.catalog.rest.model.DataSource) 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) DomainType(com.thinkbiganalytics.feedmgr.rest.model.DomainType) 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) IOException(java.io.IOException) DefaultHiveSchema(com.thinkbiganalytics.discovery.model.DefaultHiveSchema) SearchResult(com.thinkbiganalytics.rest.model.search.SearchResult) InputStreamReader(java.io.InputStreamReader) File(java.io.File) DataSourceController(com.thinkbiganalytics.kylo.catalog.rest.controller.DataSourceController) 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) BufferedReader(java.io.BufferedReader) Assert(org.junit.Assert) 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) Parser(com.jayway.restassured.parsing.Parser) FeedSummary(com.thinkbiganalytics.feedmgr.rest.model.FeedSummary) ScheduleIdentifier(com.thinkbiganalytics.scheduler.rest.model.ScheduleIdentifier) DomainTypesController(com.thinkbiganalytics.feedmgr.rest.controller.DomainTypesController) 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) UserProperty(com.thinkbiganalytics.feedmgr.rest.model.UserProperty) 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) PrintStream(java.io.PrintStream) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) SSHExec(org.apache.tools.ant.taskdefs.optional.ssh.SSHExec) Datasource(com.thinkbiganalytics.metadata.rest.model.data.Datasource) 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) Connector(com.thinkbiganalytics.kylo.catalog.rest.model.Connector) DateTimeFormatter(java.time.format.DateTimeFormatter) SerializationFeature(com.fasterxml.jackson.databind.SerializationFeature) InputStream(java.io.InputStream) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 13 with FeedSummary

use of com.thinkbiganalytics.feedmgr.rest.model.FeedSummary in project kylo by Teradata.

the class IntegrationTestBase method enableFeed.

protected void enableFeed(String feedId) {
    LOG.info("Enabling feed {}", feedId);
    Response response = enableFeedExpecting(feedId, HTTP_OK);
    FeedSummary feed = response.as(FeedSummary.class);
    Assert.assertEquals(Feed.State.ENABLED.name(), feed.getState());
}
Also used : Response(com.jayway.restassured.response.Response) FeedSummary(com.thinkbiganalytics.feedmgr.rest.model.FeedSummary)

Example 14 with FeedSummary

use of com.thinkbiganalytics.feedmgr.rest.model.FeedSummary in project kylo by Teradata.

the class DefaultFeedManagerFeedService method enableFeed.

public FeedSummary enableFeed(final String feedId) {
    return metadataAccess.commit(() -> {
        this.accessController.checkPermission(AccessController.SERVICES, FeedServicesAccessControl.EDIT_FEEDS);
        if (StringUtils.isNotBlank(feedId)) {
            FeedMetadata feedMetadata = getFeedById(feedId);
            Feed.ID domainId = feedProvider.resolveFeed(feedId);
            boolean enabled = enableFeed(domainId);
            // re fetch it
            if (enabled) {
                feedMetadata.setState(Feed.State.ENABLED.name());
                serviceLevelAgreementService.enableServiceLevelAgreementSchedule(domainId);
            }
            FeedSummary feedSummary = new FeedSummary(feedMetadata);
            return feedSummary;
        }
        return null;
    });
}
Also used : FeedMetadata(com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata) NifiFeed(com.thinkbiganalytics.feedmgr.rest.model.NifiFeed) Feed(com.thinkbiganalytics.metadata.api.feed.Feed) UIFeed(com.thinkbiganalytics.feedmgr.rest.model.UIFeed) FeedSummary(com.thinkbiganalytics.feedmgr.rest.model.FeedSummary)

Example 15 with FeedSummary

use of com.thinkbiganalytics.feedmgr.rest.model.FeedSummary in project kylo by Teradata.

the class DefaultFeedManagerFeedService method getFeedSummaryForCategory.

@Override
public List<FeedSummary> getFeedSummaryForCategory(final String categoryId) {
    return metadataAccess.read(() -> {
        List<FeedSummary> summaryList = new ArrayList<>();
        boolean hasPermission = this.accessController.hasPermission(AccessController.SERVICES, FeedServicesAccessControl.ACCESS_FEEDS);
        if (hasPermission) {
            Category.ID categoryDomainId = categoryProvider.resolveId(categoryId);
            List<? extends Feed> domainFeeds = feedProvider.findByCategoryId(categoryDomainId);
            if (domainFeeds != null && !domainFeeds.isEmpty()) {
                List<FeedMetadata> feeds = feedModelTransform.domainToFeedMetadata(domainFeeds);
                for (FeedMetadata feed : feeds) {
                    summaryList.add(new FeedSummary(feed));
                }
            }
        }
        return summaryList;
    });
}
Also used : Category(com.thinkbiganalytics.metadata.api.category.Category) FeedMetadata(com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata) ArrayList(java.util.ArrayList) FeedSummary(com.thinkbiganalytics.feedmgr.rest.model.FeedSummary)

Aggregations

FeedSummary (com.thinkbiganalytics.feedmgr.rest.model.FeedSummary)22 FeedMetadata (com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata)11 FeedCategory (com.thinkbiganalytics.feedmgr.rest.model.FeedCategory)10 ArrayList (java.util.ArrayList)9 Feed (com.thinkbiganalytics.metadata.api.feed.Feed)6 UIFeed (com.thinkbiganalytics.feedmgr.rest.model.UIFeed)5 NifiFeed (com.thinkbiganalytics.feedmgr.rest.model.NifiFeed)4 RegisteredTemplate (com.thinkbiganalytics.feedmgr.rest.model.RegisteredTemplate)4 UserProperty (com.thinkbiganalytics.feedmgr.rest.model.UserProperty)4 Category (com.thinkbiganalytics.metadata.api.category.Category)4 FeedNotFoundException (com.thinkbiganalytics.metadata.api.feed.FeedNotFoundException)4 NifiClientRuntimeException (com.thinkbiganalytics.nifi.rest.client.NifiClientRuntimeException)4 NotFoundException (javax.ws.rs.NotFoundException)4 Response (com.jayway.restassured.response.Response)3 DefaultTag (com.thinkbiganalytics.discovery.model.DefaultTag)3 EntityVersionDifference (com.thinkbiganalytics.feedmgr.rest.model.EntityVersionDifference)3 FeedVersions (com.thinkbiganalytics.feedmgr.rest.model.FeedVersions)3 HadoopSecurityGroup (com.thinkbiganalytics.metadata.api.security.HadoopSecurityGroup)3 JcrHadoopSecurityGroup (com.thinkbiganalytics.metadata.modeshape.security.JcrHadoopSecurityGroup)3 FieldRuleProperty (com.thinkbiganalytics.policy.rest.model.FieldRuleProperty)3