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