use of com.thinkbiganalytics.metadata.api.template.TemplateDeletionException in project kylo by Teradata.
the class FeedManagerFeedTest method testFeedTemplates.
@Test
public void testFeedTemplates() {
String categorySystemName = "my_category1";
String feedName = "my_feed1";
String templateName = "my_template1";
setupFeedAndTemplate(categorySystemName, feedName, templateName);
// try to delete the template. This should fail since there are feeds attached to it
Boolean deleteStatus = null;
try {
deleteStatus = deleteTemplate(templateName);
} catch (TemplateDeletionException e) {
Assert.assertNotNull(e);
deleteStatus = false;
}
// assert that we could not delete it
Assert.assertFalse(deleteStatus);
// try to delete the feed
metadata.commit(() -> {
Feed feed = feedTestUtil.findFeed(categorySystemName, feedName);
Assert.assertNotNull(feed);
if (feed != null) {
feedProvider.delete(feed);
}
}, MetadataAccess.SERVICE);
// ensure it is deleted
metadata.read(() -> {
Feed feed = feedTestUtil.findFeed(categorySystemName, feedName);
Assert.assertNull(feed);
}, MetadataAccess.SERVICE);
// try to delete the template. This should succeed since the feeds are gone
deleteStatus = deleteTemplate(templateName);
Assert.assertEquals(deleteStatus.booleanValue(), true);
}
Aggregations