use of com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata in project kylo by Teradata.
the class IntegrationTestBase method makeCreateFeedRequest.
protected FeedMetadata makeCreateFeedRequest(FeedCategory category, ImportTemplate template, String feedName, String testFile) {
FeedMetadata feed = new FeedMetadata();
feed.setFeedName(feedName);
feed.setSystemFeedName(feedName.toLowerCase());
feed.setCategory(category);
feed.setTemplateId(template.getTemplateId());
feed.setTemplateName(template.getTemplateName());
feed.setDescription("Created by functional test");
feed.setInputProcessorType("org.apache.nifi.processors.standard.GetFile");
List<NifiProperty> properties = new ArrayList<>();
NifiProperty fileFilter = new NifiProperty("764d053d-015e-1000-b8a2-763cd17080e1", "cffa8f24-d097-3c7a-7d04-26b7feff81ab", "File Filter", testFile);
fileFilter.setProcessGroupName("NiFi Flow");
fileFilter.setProcessorName("GetFile");
fileFilter.setProcessorType("org.apache.nifi.processors.standard.GetFile");
fileFilter.setTemplateValue("mydata\\d{1,3}.csv");
fileFilter.setInputProperty(true);
fileFilter.setUserEditable(true);
properties.add(fileFilter);
feed.setProperties(properties);
FeedSchedule schedule = new FeedSchedule();
schedule.setConcurrentTasks(1);
schedule.setSchedulingPeriod("15 sec");
schedule.setSchedulingStrategy("TIMER_DRIVEN");
feed.setSchedule(schedule);
feed.setDataOwner("Marketing");
List<Tag> tags = new ArrayList<>();
tags.add(new DefaultTag("functional tests"));
tags.add(new DefaultTag("for category " + category.getName()));
feed.setTags(tags);
User owner = new User();
owner.setSystemName("dladmin");
owner.setDisplayName("Data Lake Admin");
Set<String> groups = new HashSet<>();
groups.add("admin");
groups.add("user");
owner.setGroups(groups);
feed.setOwner(owner);
return feed;
}
use of com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata in project kylo by Teradata.
the class FeedLoadTest method loadTest.
/**
* Bulk load a template into NiFi and Kylo
* categories are named 'category_#
* feeds are named cat_#_feedName_#
*
* @param templatePath the template to use
* @param feedName the name of the feed
* @param categories the number of categories to use/create
* @param feedsInCategory the number of feeds to create in each category
* @param startingCategoryId the category number to use for the first category
* @throws Exception
*/
private void loadTest(String templatePath, String feedName, int categories, int feedsInCategory, int startingCategoryId) throws Exception {
ImportTemplate ingestTemplate = importTemplate(templatePath);
for (int i = startingCategoryId; i < (startingCategoryId + categories); i++) {
// create new category
String categoryName = "category_" + i;
FeedCategory category = getorCreateCategoryByName(categoryName);
Integer maxFeedId = category.getRelatedFeeds();
maxFeedId += 1;
for (int j = maxFeedId; j < (feedsInCategory + maxFeedId); j++) {
try {
String updateFeedName = "cat_" + i + "_" + feedName + "_" + j;
FeedMetadata feed = getCreateFeedRequest(category, ingestTemplate, updateFeedName);
long start = System.currentTimeMillis();
FeedMetadata response = createFeed(feed).getFeedMetadata();
LOG.info("Time to save: {} was: {} ms ", updateFeedName, (System.currentTimeMillis() - start));
} catch (Exception e) {
}
}
}
}
use of com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata in project kylo by Teradata.
the class EntityLevelAccessIT method getEditFeedRequest.
private FeedMetadata getEditFeedRequest() {
FeedMetadata editFeedRequest = makeCreateFeedRequest(category, template, feed.getFeedName(), TEST_FILE);
editFeedRequest.setId(feed.getId());
editFeedRequest.setFeedId(feed.getFeedId());
editFeedRequest.setDescription("New Description");
editFeedRequest.setIsNew(false);
return editFeedRequest;
}
use of com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata in project kylo by Teradata.
the class EntityLevelAccessIT method assertAnalystCanEditFeed.
private void assertAnalystCanEditFeed() {
LOG.debug("EntityLevelAccessIT.assertAnalystCanEditFeed");
runAs(ANALYST);
FeedMetadata editFeedRequest = getEditFeedRequest();
NifiFeed feed = createFeed(editFeedRequest);
Assert.assertTrue(feed.getErrorMessages() == null);
}
use of com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata in project kylo by Teradata.
the class EntityLevelAccessIT method assertAnalystCantEditFeed.
private void assertAnalystCantEditFeed(String[] errorMessages) {
LOG.debug("EntityLevelAccessIT.assertAnalystCantEditFeed");
runAs(ANALYST);
FeedMetadata editFeedRequest = getEditFeedRequest();
NifiFeed feed = createFeed(editFeedRequest);
LOG.debug("EntityLevelAccessIT.assertAnalystCantEditFeed - asserting analyst cant create the feed");
if (feed.getErrorMessages() != null && feed.getErrorMessages().get(0) != null) {
LOG.debug("Analyst feed error message is {}.", feed.getErrorMessages().get(0));
}
Assert.assertEquals(1, feed.getErrorMessages().size());
Assert.assertTrue(Arrays.asList(errorMessages).stream().anyMatch(msg -> feed.getErrorMessages().get(0).startsWith(msg)));
}
Aggregations