Search in sources :

Example 6 with FeedCleanupTriggerEvent

use of com.thinkbiganalytics.metadata.rest.model.event.FeedCleanupTriggerEvent in project kylo by Teradata.

the class JmsCleanupEventConsumerTest method test.

/**
 * Test consuming and dispatching a cleanup trigger event.
 */
@Test
public void test() {
    // Mock event and listener
    final FeedCleanupTriggerEvent event = new FeedCleanupTriggerEvent("FEEDID");
    event.setCategoryName("cat");
    event.setFeedName("feed");
    final CleanupListener listener = Mockito.mock(CleanupListener.class);
    // Test receiving and triggering event
    final JmsCleanupEventConsumer consumer = new JmsCleanupEventConsumer();
    consumer.addListener("cat", "feed", listener);
    consumer.receiveEvent(event);
    Mockito.verify(listener).triggered(event);
    // Test removing listener
    consumer.removeListener(listener);
    consumer.receiveEvent(event);
    Mockito.verifyNoMoreInteractions(listener);
}
Also used : FeedCleanupTriggerEvent(com.thinkbiganalytics.metadata.rest.model.event.FeedCleanupTriggerEvent) CleanupListener(com.thinkbiganalytics.nifi.core.api.cleanup.CleanupListener) Test(org.junit.Test)

Aggregations

FeedCleanupTriggerEvent (com.thinkbiganalytics.metadata.rest.model.event.FeedCleanupTriggerEvent)6 Test (org.junit.Test)5 FeedProperties (com.thinkbiganalytics.metadata.api.feed.FeedProperties)1 CleanupListener (com.thinkbiganalytics.nifi.core.api.cleanup.CleanupListener)1 Map (java.util.Map)1 Properties (java.util.Properties)1 FlowFile (org.apache.nifi.flowfile.FlowFile)1 ProcessException (org.apache.nifi.processor.exception.ProcessException)1 MockFlowFile (org.apache.nifi.util.MockFlowFile)1