Search in sources :

Example 16 with FeedCategory

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

the class SimpleCategoryModelTransform method domainToFeedCategorySimple.

/**
 * Transforms the specified Metadata category to a simple Feed Manager category.
 *
 * @param domainCategory the Metadata category
 * @return the Feed Manager category
 */
@Nullable
public FeedCategory domainToFeedCategorySimple(@Nullable final Category domainCategory, boolean includeProperties, boolean includeSecurityGroups) {
    if (domainCategory != null) {
        FeedCategory category = new FeedCategory();
        category.setId(domainCategory.getId().toString());
        category.setIconColor(domainCategory.getIconColor());
        category.setIcon(domainCategory.getIcon());
        category.setName(domainCategory.getDisplayName());
        // in pre-0.8.4 version of Kylo there was no system name stored for domain categories
        category.setSystemName(domainCategory.getSystemName() == null ? domainCategory.getDisplayName() : domainCategory.getSystemName());
        category.setDescription(domainCategory.getDescription());
        category.setCreateDate(domainCategory.getCreatedTime() != null ? domainCategory.getCreatedTime().toDate() : null);
        category.setUpdateDate(domainCategory.getModifiedTime() != null ? domainCategory.getModifiedTime().toDate() : null);
        if (includeProperties) {
            // Transform user-defined fields and properties
            category.setUserFields(UserPropertyTransform.toUserFields(categoryProvider.getFeedUserFields(domainCategory.getId()).orElse(Collections.emptySet())));
            category.setUserProperties(UserPropertyTransform.toUserProperties(domainCategory.getUserProperties(), categoryProvider.getUserFields()));
        }
        if (includeSecurityGroups) {
            // Convert JCR securitygroup to DTO
            List<com.thinkbiganalytics.feedmgr.rest.model.HadoopSecurityGroup> restSecurityGroups = new ArrayList<>();
            if (domainCategory.getSecurityGroups() != null && domainCategory.getSecurityGroups().size() > 0) {
                for (Object group : domainCategory.getSecurityGroups()) {
                    HadoopSecurityGroup hadoopSecurityGroup = (HadoopSecurityGroup) group;
                    com.thinkbiganalytics.feedmgr.rest.model.HadoopSecurityGroup restSecurityGroup = new com.thinkbiganalytics.feedmgr.rest.model.HadoopSecurityGroup();
                    restSecurityGroup.setDescription(hadoopSecurityGroup.getDescription());
                    restSecurityGroup.setId(hadoopSecurityGroup.getGroupId());
                    restSecurityGroup.setName(hadoopSecurityGroup.getName());
                    restSecurityGroups.add(restSecurityGroup);
                }
            }
            category.setSecurityGroups(restSecurityGroups);
        }
        return category;
    } else {
        return null;
    }
}
Also used : HadoopSecurityGroup(com.thinkbiganalytics.metadata.api.security.HadoopSecurityGroup) FeedCategory(com.thinkbiganalytics.feedmgr.rest.model.FeedCategory) ArrayList(java.util.ArrayList) Nullable(javax.annotation.Nullable)

Example 17 with FeedCategory

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

the class IntegrationTestBase method deleteExistingCategories.

protected void deleteExistingCategories() {
    LOG.info("Deleting existing categories");
    // start clean - delete all categories if there
    FeedCategory[] categories = getCategories();
    for (FeedCategory category : categories) {
        deleteCategory(category.getId());
    }
    categories = getCategories();
    Assert.assertTrue(categories.length == 0);
}
Also used : FeedCategory(com.thinkbiganalytics.feedmgr.rest.model.FeedCategory)

Example 18 with FeedCategory

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

the class IntegrationTestBase method createSimpleFeed.

protected FeedMetadata createSimpleFeed(String feedName, String testFile) {
    FeedCategory category = createCategory(FUNCTIONAL_TESTS);
    ImportTemplate template = importSimpleTemplate();
    FeedMetadata request = makeCreateFeedRequest(category, template, feedName, testFile);
    FeedMetadata response = createFeed(request).getFeedMetadata();
    Assert.assertEquals(request.getFeedName(), response.getFeedName());
    return response;
}
Also used : FeedCategory(com.thinkbiganalytics.feedmgr.rest.model.FeedCategory) FeedMetadata(com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata) ImportTemplate(com.thinkbiganalytics.feedmgr.service.template.importing.model.ImportTemplate)

Example 19 with FeedCategory

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

the class FeedIT method testDataIngestFeed.

@Test
public void testDataIngestFeed() throws Exception {
    prepare();
    importSystemFeeds();
    copyDataToDropzone();
    // create new category
    FeedCategory category = createCategory(CATEGORY_NAME);
    ImportTemplate ingest = importDataIngestTemplate();
    // create standard ingest feed
    FeedMetadata feed = getCreateFeedRequest(category, ingest, createNewFeedName());
    FeedMetadata response = createFeed(feed).getFeedMetadata();
    Assert.assertEquals(feed.getFeedName(), response.getFeedName());
    waitForFeedToComplete();
    assertExecutedJobs(response.getFeedName(), response.getFeedId());
    failJobs(response.getCategoryAndFeedName());
    abandonAllJobs(response.getCategoryAndFeedName());
}
Also used : FeedCategory(com.thinkbiganalytics.feedmgr.rest.model.FeedCategory) FeedMetadata(com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata) ImportTemplate(com.thinkbiganalytics.feedmgr.service.template.importing.model.ImportTemplate) Test(org.junit.Test)

Example 20 with FeedCategory

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

the class NifiRestTest method testCreateFeed1.

// @Test
public void testCreateFeed1() {
    TemplateDTO templateDTO = restClient.getTemplateByName("New Data Ingest");
    String inputType = "org.apache.nifi.processors.standard.GetFile";
    NifiProcessorSchedule schedule = new NifiProcessorSchedule();
    schedule.setSchedulingStrategy("TIMER_DRIVEN");
    schedule.setSchedulingPeriod("10 sec");
    String inputPortName = "From Data Ingest Feed";
    String feedOutputPortName = "To Data Ingest";
    FeedMetadata feedMetadata = new FeedMetadata();
    feedMetadata.setCategory(new FeedCategory());
    feedMetadata.getCategory().setSystemName("online");
    feedMetadata.setSystemFeedName("Scotts Feed");
    CreateFeedBuilder.newFeed(restClient, nifiFlowCache, feedMetadata, templateDTO.getId(), new PropertyExpressionResolver(), propertyDescriptorTransform, createFeedBuilderCache, templateConnectionUtil).inputProcessorType(inputType).feedSchedule(schedule).addInputOutputPort(new InputOutputPort(inputPortName, feedOutputPortName)).build();
}
Also used : FeedCategory(com.thinkbiganalytics.feedmgr.rest.model.FeedCategory) TemplateDTO(org.apache.nifi.web.api.dto.TemplateDTO) FeedMetadata(com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata) InputOutputPort(com.thinkbiganalytics.nifi.feedmgr.InputOutputPort) PropertyExpressionResolver(com.thinkbiganalytics.feedmgr.nifi.PropertyExpressionResolver) NifiProcessorSchedule(com.thinkbiganalytics.nifi.rest.model.NifiProcessorSchedule)

Aggregations

FeedCategory (com.thinkbiganalytics.feedmgr.rest.model.FeedCategory)32 FeedMetadata (com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata)18 ImportTemplate (com.thinkbiganalytics.feedmgr.service.template.importing.model.ImportTemplate)8 Category (com.thinkbiganalytics.metadata.api.category.Category)8 ArrayList (java.util.ArrayList)7 FeedSummary (com.thinkbiganalytics.feedmgr.rest.model.FeedSummary)5 NifiProperty (com.thinkbiganalytics.nifi.rest.model.NifiProperty)5 Test (org.junit.Test)5 RegisteredTemplate (com.thinkbiganalytics.feedmgr.rest.model.RegisteredTemplate)4 IOException (java.io.IOException)4 PropertyExpressionResolver (com.thinkbiganalytics.feedmgr.nifi.PropertyExpressionResolver)3 NifiFeed (com.thinkbiganalytics.feedmgr.rest.model.NifiFeed)3 UploadProgressMessage (com.thinkbiganalytics.feedmgr.rest.model.UploadProgressMessage)3 HadoopSecurityGroup (com.thinkbiganalytics.metadata.api.security.HadoopSecurityGroup)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 Sets (com.google.common.collect.Sets)2 DefaultTableSchema (com.thinkbiganalytics.discovery.model.DefaultTableSchema)2 DefaultTag (com.thinkbiganalytics.discovery.model.DefaultTag)2 MetadataFieldAnnotationFieldNameResolver (com.thinkbiganalytics.feedmgr.MetadataFieldAnnotationFieldNameResolver)2 ImportComponent (com.thinkbiganalytics.feedmgr.rest.ImportComponent)2