Search in sources :

Example 6 with MetadataProviderService

use of com.thinkbiganalytics.nifi.core.api.metadata.MetadataProviderService in project kylo by Teradata.

the class GetFeedsHistoryReindexTest method testErrorGettingFeedsToReindex.

@Test
public void testErrorGettingFeedsToReindex() throws Exception {
    final String METADATA_SERVICE_IDENTIFIER = "MockMetadataProviderService_ErrorGettingFeedsToReindex";
    final TestRunner runner = TestRunners.newTestRunner(GetFeedsHistoryReindex.class);
    final MetadataProviderService metadataService = new MockMetadataProviderService_ErrorGettingFeedsToReindex();
    runner.addControllerService(METADATA_SERVICE_IDENTIFIER, metadataService);
    runner.enableControllerService(metadataService);
    runner.setProperty(GetFeedsHistoryReindex.METADATA_SERVICE, METADATA_SERVICE_IDENTIFIER);
    runner.run(1);
    runner.assertQueueEmpty();
    runner.assertTransferCount(GetFeedsHistoryReindex.REL_FOUND, 0);
    runner.assertTransferCount(GetFeedsHistoryReindex.REL_NOT_FOUND, 0);
    runner.assertTransferCount(GetFeedsHistoryReindex.REL_FAILURE, 1);
    runner.assertTransferCount(GetFeedsHistoryReindex.REL_ORIGINAL, 0);
    List<MockFlowFile> results = runner.getFlowFilesForRelationship(GetFeedsHistoryReindex.REL_FAILURE);
    MockFlowFile resultFlowFile = results.get(0);
    resultFlowFile.assertAttributeNotExists(GetFeedsHistoryReindex.FEEDS_TOTAL_COUNT_FOR_HISTORY_REINDEX_KEY);
    resultFlowFile.assertAttributeNotExists(GetFeedsHistoryReindex.FEEDS_TOTAL_IDS_FOR_HISTORY_REINDEX_KEY);
    resultFlowFile.assertAttributeNotExists(GetFeedsHistoryReindex.FEEDS_CHECK_TIME_UTC_FOR_HISTORY_REINDEX_KEY);
}
Also used : MockFlowFile(org.apache.nifi.util.MockFlowFile) TestRunner(org.apache.nifi.util.TestRunner) MetadataProviderService(com.thinkbiganalytics.nifi.core.api.metadata.MetadataProviderService) Test(org.junit.Test)

Example 7 with MetadataProviderService

use of com.thinkbiganalytics.nifi.core.api.metadata.MetadataProviderService in project kylo by Teradata.

the class UpdateFeedHistoryReindexTest method setFeedStatus_ValidStateExpressionLanguage.

@Test
public void setFeedStatus_ValidStateExpressionLanguage() throws Exception {
    final String METADATA_SERVICE_IDENTIFIER = "MockMetadataProviderService_Minimal";
    final TestRunner runner = TestRunners.newTestRunner(UpdateFeedHistoryReindex.class);
    final MetadataProviderService metadataService = new MockMetadataProviderService_Minimal();
    runner.addControllerService(METADATA_SERVICE_IDENTIFIER, metadataService);
    runner.enableControllerService(metadataService);
    runner.setProperty(UpdateFeedHistoryReindex.METADATA_SERVICE, METADATA_SERVICE_IDENTIFIER);
    runner.setProperty(UpdateFeedHistoryReindex.FEED_ID, "feed-0-id");
    runner.setProperty(UpdateFeedHistoryReindex.FEED_REINDEX_STATUS, "${history.reindex.feed.status.for.update}");
    runner.assertValid();
}
Also used : TestRunner(org.apache.nifi.util.TestRunner) Matchers.anyString(org.mockito.Matchers.anyString) MetadataProviderService(com.thinkbiganalytics.nifi.core.api.metadata.MetadataProviderService) Test(org.junit.Test)

Example 8 with MetadataProviderService

use of com.thinkbiganalytics.nifi.core.api.metadata.MetadataProviderService in project kylo by Teradata.

the class UpdateFeedHistoryReindexTest method setFeedStatus_ValidStateCompletedWithSuccess.

@Test
public void setFeedStatus_ValidStateCompletedWithSuccess() throws Exception {
    final String METADATA_SERVICE_IDENTIFIER = "MockMetadataProviderService_Minimal";
    final TestRunner runner = TestRunners.newTestRunner(UpdateFeedHistoryReindex.class);
    final MetadataProviderService metadataService = new MockMetadataProviderService_Minimal();
    runner.addControllerService(METADATA_SERVICE_IDENTIFIER, metadataService);
    runner.enableControllerService(metadataService);
    runner.setProperty(UpdateFeedHistoryReindex.METADATA_SERVICE, METADATA_SERVICE_IDENTIFIER);
    runner.setProperty(UpdateFeedHistoryReindex.FEED_ID, "feed-0-id");
    runner.setProperty(UpdateFeedHistoryReindex.FEED_REINDEX_STATUS, "COMPLETED_WITH_SUCCESS");
    runner.assertValid();
}
Also used : TestRunner(org.apache.nifi.util.TestRunner) Matchers.anyString(org.mockito.Matchers.anyString) MetadataProviderService(com.thinkbiganalytics.nifi.core.api.metadata.MetadataProviderService) Test(org.junit.Test)

Example 9 with MetadataProviderService

use of com.thinkbiganalytics.nifi.core.api.metadata.MetadataProviderService in project kylo by Teradata.

the class UpdateFeedHistoryReindexTest method setFeedStatus_ValidStateCompletedWithFailure.

@Test
public void setFeedStatus_ValidStateCompletedWithFailure() throws Exception {
    final String METADATA_SERVICE_IDENTIFIER = "MockMetadataProviderService_Minimal";
    final TestRunner runner = TestRunners.newTestRunner(UpdateFeedHistoryReindex.class);
    final MetadataProviderService metadataService = new MockMetadataProviderService_Minimal();
    runner.addControllerService(METADATA_SERVICE_IDENTIFIER, metadataService);
    runner.enableControllerService(metadataService);
    runner.setProperty(UpdateFeedHistoryReindex.METADATA_SERVICE, METADATA_SERVICE_IDENTIFIER);
    runner.setProperty(UpdateFeedHistoryReindex.FEED_ID, "feed-0-id");
    runner.setProperty(UpdateFeedHistoryReindex.FEED_REINDEX_STATUS, "COMPLETED_WITH_FAILURE");
    runner.assertValid();
}
Also used : TestRunner(org.apache.nifi.util.TestRunner) Matchers.anyString(org.mockito.Matchers.anyString) MetadataProviderService(com.thinkbiganalytics.nifi.core.api.metadata.MetadataProviderService) Test(org.junit.Test)

Example 10 with MetadataProviderService

use of com.thinkbiganalytics.nifi.core.api.metadata.MetadataProviderService in project kylo by Teradata.

the class UpdateFeedHistoryReindexTest method setFeedStatus_InvalidState.

@Test
public void setFeedStatus_InvalidState() throws Exception {
    final String METADATA_SERVICE_IDENTIFIER = "MockMetadataProviderService_Minimal";
    final TestRunner runner = TestRunners.newTestRunner(UpdateFeedHistoryReindex.class);
    final MetadataProviderService metadataService = new MockMetadataProviderService_Minimal();
    runner.addControllerService(METADATA_SERVICE_IDENTIFIER, metadataService);
    runner.enableControllerService(metadataService);
    runner.setProperty(UpdateFeedHistoryReindex.METADATA_SERVICE, METADATA_SERVICE_IDENTIFIER);
    runner.setProperty(UpdateFeedHistoryReindex.FEED_ID, "feed-0-id");
    runner.setProperty(UpdateFeedHistoryReindex.FEED_REINDEX_STATUS, "NOT_VALID_STATE");
    runner.assertNotValid();
}
Also used : TestRunner(org.apache.nifi.util.TestRunner) Matchers.anyString(org.mockito.Matchers.anyString) MetadataProviderService(com.thinkbiganalytics.nifi.core.api.metadata.MetadataProviderService) Test(org.junit.Test)

Aggregations

MetadataProviderService (com.thinkbiganalytics.nifi.core.api.metadata.MetadataProviderService)21 Test (org.junit.Test)14 TestRunner (org.apache.nifi.util.TestRunner)13 Matchers.anyString (org.mockito.Matchers.anyString)9 MockFlowFile (org.apache.nifi.util.MockFlowFile)5 FlowFile (org.apache.nifi.flowfile.FlowFile)4 ComponentLog (org.apache.nifi.logging.ComponentLog)4 ProcessException (org.apache.nifi.processor.exception.ProcessException)3 Before (org.junit.Before)3 IOException (java.io.IOException)2 DBCPService (org.apache.nifi.dbcp.DBCPService)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 GetTableDataSupport (com.thinkbiganalytics.ingest.GetTableDataSupport)1 Feed (com.thinkbiganalytics.metadata.rest.model.feed.Feed)1 FeedDataHistoryReindexParams (com.thinkbiganalytics.metadata.rest.model.feed.reindex.FeedDataHistoryReindexParams)1 FeedsForDataHistoryReindex (com.thinkbiganalytics.metadata.rest.model.feed.reindex.FeedsForDataHistoryReindex)1 HistoryReindexingStatus (com.thinkbiganalytics.metadata.rest.model.feed.reindex.HistoryReindexingStatus)1 CleanupEventService (com.thinkbiganalytics.nifi.core.api.cleanup.CleanupEventService)1 ApplySecurityPolicy (com.thinkbiganalytics.nifi.security.ApplySecurityPolicy)1 InputStreamReaderRunnable (com.thinkbiganalytics.nifi.util.InputStreamReaderRunnable)1