org.apache.nifi.util.TestRunner.run() - java examples

Here are the examples of the java api org.apache.nifi.util.TestRunner.run() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

155 Examples 7

19 View Complete Implementation : TestISPEnrichIP.java
Copyright Apache License 2.0
Author : apache
@Test
public void evaluatingExpressionLanguageShouldAndFindingIpFieldWithSuccessfulLookUpShouldFlowToFoundRelationship() throws Exception {
    testRunner.setProperty(ISPEnrichIP.GEO_DATABASE_FILE, "./");
    testRunner.setProperty(ISPEnrichIP.IP_ADDRESS_ATTRIBUTE, "${ip.fields:substringBefore(',')}");
    final IspResponse ispResponse = getIspResponse("1.2.3.4");
    when(databaseReader.isp(InetAddress.getByName("1.2.3.4"))).thenReturn(ispResponse);
    final Map<String, String> attributes = new HashMap<>();
    attributes.put("ip.fields", "ip0,ip1,ip2");
    attributes.put("ip0", "1.2.3.4");
    testRunner.enqueue(new byte[0], attributes);
    testRunner.run();
    List<MockFlowFile> notFound = testRunner.getFlowFilesForRelationship(ISPEnrichIP.REL_NOT_FOUND);
    List<MockFlowFile> found = testRunner.getFlowFilesForRelationship(ISPEnrichIP.REL_FOUND);
    replacedertEquals(0, notFound.size());
    replacedertEquals(1, found.size());
    FlowFile finishedFound = found.get(0);
    replacedertNotNull(finishedFound.getAttribute("ip0.isp.lookup.micros"));
    replacedertEquals("Apache NiFi - Test ISP", finishedFound.getAttribute("ip0.isp.name"));
    replacedertEquals("Apache NiFi - Test Organization", finishedFound.getAttribute("ip0.isp.organization"));
    replacedertEquals("1337", finishedFound.getAttribute("ip0.isp.asn"));
    replacedertEquals("Apache NiFi - Test Chocolate", finishedFound.getAttribute("ip0.isp.asn.organization"));
}

19 View Complete Implementation : TestPutHive_1_1QL.java
Copyright Apache License 2.0
Author : apache
@Test
public void testWithNullParameter() throws InitializationException, ProcessException, SQLException, IOException {
    final TestRunner runner = TestRunners.newTestRunner(PutHive_1_1QL.clreplaced);
    final File tempDir = folder.getRoot();
    final File dbDir = new File(tempDir, "db");
    final DBCPService service = new MockDBCPService(dbDir.getAbsolutePath());
    runner.addControllerService("dbcp", service);
    runner.enableControllerService(service);
    try (final Connection conn = service.getConnection()) {
        try (final Statement stmt = conn.createStatement()) {
            stmt.executeUpdate(createPersons);
        }
    }
    runner.setProperty(PutHive_1_1QL.HIVE_DBCP_SERVICE, "dbcp");
    final Map<String, String> attributes = new HashMap<>();
    attributes.put("hiveql.args.1.type", String.valueOf(Types.INTEGER));
    attributes.put("hiveql.args.1.value", "1");
    attributes.put("hiveql.args.2.type", String.valueOf(Types.VARCHAR));
    attributes.put("hiveql.args.2.value", "Mark");
    attributes.put("hiveql.args.3.type", String.valueOf(Types.INTEGER));
    runner.enqueue("INSERT INTO PERSONS (ID, NAME, CODE) VALUES (?, ?, ?)".getBytes(), attributes);
    runner.run();
    runner.replacedertAllFlowFilesTransferred(PutHive_1_1QL.REL_SUCCESS, 1);
    try (final Connection conn = service.getConnection()) {
        try (final Statement stmt = conn.createStatement()) {
            final ResultSet rs = stmt.executeQuery("SELECT * FROM PERSONS");
            replacedertTrue(rs.next());
            replacedertEquals(1, rs.getInt(1));
            replacedertEquals("Mark", rs.getString(2));
            replacedertEquals(0, rs.getInt(3));
            replacedertFalse(rs.next());
        }
    }
}

19 View Complete Implementation : DeleteDynamoDBTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void testStringHashStringRangeDeleteThrowsClientException() {
    final DynamoDB mockDynamoDB = new DynamoDB(Regions.AP_NORTHEAST_1) {

        @Override
        public BatchWriteItemOutcome batchWriteItem(TableWriteItems... tableWriteItems) {
            throw new AmazonClientException("clientException");
        }
    };
    deleteDynamoDB = new DeleteDynamoDB() {

        @Override
        protected DynamoDB getDynamoDB() {
            return mockDynamoDB;
        }
    };
    final TestRunner deleteRunner = TestRunners.newTestRunner(deleteDynamoDB);
    deleteRunner.setProperty(AbstractDynamoDBProcessor.ACCESS_KEY, "abcd");
    deleteRunner.setProperty(AbstractDynamoDBProcessor.SECRET_KEY, "cdef");
    deleteRunner.setProperty(AbstractDynamoDBProcessor.REGION, REGION);
    deleteRunner.setProperty(AbstractDynamoDBProcessor.TABLE, stringHashStringRangeTableName);
    deleteRunner.setProperty(AbstractDynamoDBProcessor.HASH_KEY_NAME, "hashS");
    deleteRunner.setProperty(AbstractDynamoDBProcessor.HASH_KEY_VALUE, "h1");
    deleteRunner.setProperty(AbstractDynamoDBProcessor.RANGE_KEY_NAME, "rangeS");
    deleteRunner.setProperty(AbstractDynamoDBProcessor.RANGE_KEY_VALUE, "r1");
    deleteRunner.enqueue(new byte[] {});
    deleteRunner.run(1);
    deleteRunner.replacedertAllFlowFilesTransferred(AbstractDynamoDBProcessor.REL_FAILURE, 1);
    List<MockFlowFile> flowFiles = deleteRunner.getFlowFilesForRelationship(AbstractDynamoDBProcessor.REL_FAILURE);
    for (MockFlowFile flowFile : flowFiles) {
        replacedertEquals("clientException", flowFile.getAttribute(AbstractDynamoDBProcessor.DYNAMODB_ERROR_EXCEPTION_MESSAGE));
    }
}

19 View Complete Implementation : TestCompareFuzzyHash.java
Copyright Apache License 2.0
Author : apache
@Test
public void testTLSHCompareFuzzyHash() {
    double matchingSimilarity = 200;
    runner.setProperty(CompareFuzzyHash.HASH_ALGORITHM, CompareFuzzyHash.allowableValueTLSH.getValue());
    runner.setProperty(CompareFuzzyHash.ATTRIBUTE_NAME, "fuzzyhash.value");
    runner.setProperty(CompareFuzzyHash.HASH_LIST_FILE, "src/test/resources/tlsh.list");
    runner.setProperty(CompareFuzzyHash.MATCH_THRESHOLD, String.valueOf(matchingSimilarity));
    runner.setProperty(CompareFuzzyHash.MATCHING_MODE, CompareFuzzyHash.singleMatch.getValue());
    Map<String, String> attributes = new HashMap<>();
    attributes.put("fuzzyhash.value", tlshInput);
    runner.enqueue("bogus".getBytes(), attributes);
    runner.run();
    runner.replacedertQueueEmpty();
    runner.replacedertAllFlowFilesTransferred(CompareFuzzyHash.REL_FOUND, 1);
    final MockFlowFile outFile = runner.getFlowFilesForRelationship(CompareFuzzyHash.REL_FOUND).get(0);
    outFile.replacedertAttributeEquals("fuzzyhash.value.0.match", "nifi-nar-bundles/nifi-lumberjack-bundle/nifi-lumberjack-processors/pom.xml");
    double similarity = Double.valueOf(outFile.getAttribute("fuzzyhash.value.0.similarity"));
    replacedert.replacedertTrue(similarity <= matchingSimilarity);
    outFile.replacedertAttributeNotExists("fuzzyhash.value.1.match");
}

19 View Complete Implementation : TestGeoEnrichIP.java
Copyright Apache License 2.0
Author : apache
@Test
public void shouldFlowToNotFoundWhenNullResponseFromMaxMind() throws Exception {
    testRunner.setProperty(GeoEnrichIP.GEO_DATABASE_FILE, "./");
    testRunner.setProperty(GeoEnrichIP.IP_ADDRESS_ATTRIBUTE, "ip");
    when(databaseReader.city(InetAddress.getByName("1.2.3.4"))).thenReturn(null);
    final Map<String, String> attributes = new HashMap<>();
    attributes.put("ip", "1.2.3.4");
    testRunner.enqueue(new byte[0], attributes);
    testRunner.run();
    List<MockFlowFile> notFound = testRunner.getFlowFilesForRelationship(GeoEnrichIP.REL_NOT_FOUND);
    List<MockFlowFile> found = testRunner.getFlowFilesForRelationship(GeoEnrichIP.REL_FOUND);
    replacedertEquals(1, notFound.size());
    replacedertEquals(0, found.size());
}

19 View Complete Implementation : TestPutLambda.java
Copyright Apache License 2.0
Author : apache
@Test
public void testSizeGreaterThan6MB() throws Exception {
    runner = TestRunners.newTestRunner(PutLambda.clreplaced);
    runner.setProperty(PutLambda.AWS_LAMBDA_FUNCTION_NAME, "hello");
    runner.replacedertValid();
    byte[] largeInput = new byte[6000001];
    for (int i = 0; i < 6000001; i++) {
        largeInput[i] = 'a';
    }
    runner.enqueue(largeInput);
    runner.run(1);
    runner.replacedertAllFlowFilesTransferred(PutLambda.REL_FAILURE, 1);
}

19 View Complete Implementation : ListGCSBucketTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void testAclOwnerUser() throws Exception {
    reset(storage, mockBlobPage);
    final ListGCSBucket processor = getProcessor();
    final TestRunner runner = buildNewRunner(processor);
    addRequiredPropertiesToRunner(runner);
    runner.replacedertValid();
    final Blob blob = buildMockBlob("test-bucket-1", "test-key-1", 2L);
    final Acl.User mockUser = mock(Acl.User.clreplaced);
    when(mockUser.getEmail()).thenReturn(OWNER_USER_EMAIL);
    when(blob.getOwner()).thenReturn(mockUser);
    final Iterable<Blob> mockList = ImmutableList.of(blob);
    when(mockBlobPage.getValues()).thenReturn(mockList);
    when(mockBlobPage.getNextPage()).thenReturn(null);
    when(storage.list(anyString(), any(Storage.BlobListOption[].clreplaced))).thenReturn(mockBlobPage);
    runner.enqueue("test");
    runner.run();
    runner.replacedertAllFlowFilesTransferred(FetchGCSObject.REL_SUCCESS);
    runner.replacedertTransferCount(FetchGCSObject.REL_SUCCESS, 1);
    final MockFlowFile flowFile = runner.getFlowFilesForRelationship(FetchGCSObject.REL_SUCCESS).get(0);
    replacedertEquals(OWNER_USER_EMAIL, flowFile.getAttribute(OWNER_ATTR));
    replacedertEquals("user", flowFile.getAttribute(OWNER_TYPE_ATTR));
}

19 View Complete Implementation : MoveHDFSTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void testOnScheduledShouldRunCleanly() throws IOException {
    FileUtils.copyDirectory(new File(TEST_DATA_DIRECTORY), new File(INPUT_DIRECTORY));
    MoveHDFS proc = new TestableMoveHDFS(kerberosProperties);
    TestRunner runner = TestRunners.newTestRunner(proc);
    runner.setProperty(MoveHDFS.INPUT_DIRECTORY_OR_FILE, INPUT_DIRECTORY);
    runner.setProperty(MoveHDFS.OUTPUT_DIRECTORY, OUTPUT_DIRECTORY);
    runner.enqueue(new byte[0]);
    runner.run();
    List<MockFlowFile> flowFiles = runner.getFlowFilesForRelationship(MoveHDFS.REL_SUCCESS);
    runner.replacedertAllFlowFilesTransferred(MoveHDFS.REL_SUCCESS);
    replacedert.replacedertEquals(7, flowFiles.size());
}

19 View Complete Implementation : ITAbstractListProcessor.java
Copyright Apache License 2.0
Author : apache
/**
 * <p>
 * Ensures that files are listed when those are old enough:
 * <li>Files with last modified timestamp those are old enough to determine
 * that those are completely written and no further files are expected to be
 * added with the same timestamp.</li>
 * <li>This behavior is expected when a processor is scheduled less
 * frequently, such as hourly or daily.</li>
 * </p>
 */
@Test
public void testAllExistingEntriesEmittedOnFirsreplacederation() throws Exception {
    final long oldTimestamp = System.currentTimeMillis() - getSleepMillis(TimeUnit.MILLISECONDS);
    // These entries have existed before the processor runs at the first time.
    proc.addEnreplacedy("name", "id", oldTimestamp);
    proc.addEnreplacedy("name", "id2", oldTimestamp);
    // First run, the above listed entries should be emitted since it has existed.
    runner.run();
    runner.replacedertAllFlowFilesTransferred(ConcreteListProcessor.REL_SUCCESS, 2);
    runner.clearTransferState();
    // Ensure we have covered the necessary lag period to avoid issues where the processor was immediately scheduled to run again
    Thread.sleep(DEFAULT_SLEEP_MILLIS);
    // Run again without introducing any new entries
    runner.run();
    runner.replacedertAllFlowFilesTransferred(ConcreteListProcessor.REL_SUCCESS, 0);
}

19 View Complete Implementation : TestQueryDNS.java
Copyright Apache License 2.0
Author : apache
@Test
public void testValidDataWithSplit() {
    queryDNSTestRunner.setProperty(QueryDNS.DNS_QUERY_TYPE, "TXT");
    queryDNSTestRunner.setProperty(QueryDNS.DNS_RETRIES, "1");
    queryDNSTestRunner.setProperty(QueryDNS.DNS_TIMEOUT, "1000 ms");
    queryDNSTestRunner.setProperty(QueryDNS.QUERY_INPUT, "${ip_address:getDelimitedField(4, '.'):trim()}" + ".${ip_address:getDelimitedField(3, '.'):trim()}" + ".${ip_address:getDelimitedField(2, '.'):trim()}" + ".${ip_address:getDelimitedField(1, '.'):trim()}" + ".origin.asn.nifi.apache.org");
    queryDNSTestRunner.setProperty(QueryDNS.QUERY_PARSER, QueryDNS.SPLIT.getValue());
    queryDNSTestRunner.setProperty(QueryDNS.QUERY_PARSER_INPUT, "\\|");
    final Map<String, String> attributeMap = new HashMap<>();
    attributeMap.put("ip_address", "123.123.123.123");
    queryDNSTestRunner.enqueue(new byte[0], attributeMap);
    queryDNSTestRunner.enqueue("teste teste teste chocolate".getBytes());
    queryDNSTestRunner.run(1, true, false);
    List<MockFlowFile> results = queryDNSTestRunner.getFlowFilesForRelationship(QueryDNS.REL_FOUND);
    replacedertTrue(results.size() == 1);
    results.get(0).replacedertAttributeEquals("enrich.dns.record0.group5", " Apache NiFi");
}

19 View Complete Implementation : TestExtractAvroMetadata.java
Copyright Apache License 2.0
Author : apache
@Test
public void testExtractionWithItemCount() throws IOException {
    final TestRunner runner = TestRunners.newTestRunner(new ExtractAvroMetadata());
    runner.setProperty(ExtractAvroMetadata.COUNT_ITEMS, "true");
    final Schema schema = new Schema.Parser().parse(new File("src/test/resources/user.avsc"));
    // creates 2 blocks
    final ByteArrayOutputStream out = getOutputStreamWithMultipleUsers(schema, 6000);
    runner.enqueue(out.toByteArray());
    runner.run();
    runner.replacedertAllFlowFilesTransferred(ExtractAvroMetadata.REL_SUCCESS, 1);
    final MockFlowFile flowFile = runner.getFlowFilesForRelationship(ExtractAvroMetadata.REL_SUCCESS).get(0);
    flowFile.replacedertAttributeEquals(ExtractAvroMetadata.ITEM_COUNT_ATTR, "6000");
}

19 View Complete Implementation : ParseEvtxTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void chunkGranularityLifecycleTest() throws IOException, ParserConfigurationException, SAXException {
    String baseName = "testFileName";
    String name = baseName + ".evtx";
    TestRunner testRunner = TestRunners.newTestRunner(ParseEvtx.clreplaced);
    Map<String, String> attributes = new HashMap<>();
    attributes.put(CoreAttributes.FILENAME.key(), name);
    testRunner.enqueue(this.getClreplaced().getClreplacedLoader().getResourcereplacedtream("application-logs.evtx"), attributes);
    testRunner.run();
    List<MockFlowFile> originalFlowFiles = testRunner.getFlowFilesForRelationship(ParseEvtx.REL_ORIGINAL);
    replacedertEquals(1, originalFlowFiles.size());
    MockFlowFile originalFlowFile = originalFlowFiles.get(0);
    originalFlowFile.replacedertAttributeEquals(CoreAttributes.FILENAME.key(), name);
    originalFlowFile.replacedertContentEquals(this.getClreplaced().getClreplacedLoader().getResourcereplacedtream("application-logs.evtx"));
    // We expect the same bad chunks no matter the granularity
    List<MockFlowFile> badChunkFlowFiles = testRunner.getFlowFilesForRelationship(ParseEvtx.REL_BAD_CHUNK);
    replacedertEquals(2, badChunkFlowFiles.size());
    badChunkFlowFiles.get(0).replacedertAttributeEquals(CoreAttributes.FILENAME.key(), parseEvtx.getName(baseName, 1, null, ParseEvtx.EVTX_EXTENSION));
    badChunkFlowFiles.get(1).replacedertAttributeEquals(CoreAttributes.FILENAME.key(), parseEvtx.getName(baseName, 2, null, ParseEvtx.EVTX_EXTENSION));
    List<MockFlowFile> failureFlowFiles = testRunner.getFlowFilesForRelationship(ParseEvtx.REL_FAILURE);
    replacedertEquals(1, failureFlowFiles.size());
    List<MockFlowFile> successFlowFiles = testRunner.getFlowFilesForRelationship(ParseEvtx.REL_SUCCESS);
    replacedertEquals(9, successFlowFiles.size());
    // We expect the same number of records to come out no matter the granularity
    replacedertEquals(EXPECTED_SUCCESSFUL_EVENT_COUNT, validateFlowFiles(successFlowFiles) + validateFlowFiles(failureFlowFiles));
}

19 View Complete Implementation : ITPutKinesisStream.java
Copyright Apache License 2.0
Author : apache
@Test
public void testThreeMessageHello2MBThereWithBatch10MaxBufferSize1MBRunOnceTwoMessageSuccessOneFailed() {
    runner.setProperty(PutKinesisStream.BATCH_SIZE, "10");
    runner.setProperty(PutKinesisStream.MAX_MESSAGE_BUFFER_SIZE_MB, "1 MB");
    runner.replacedertValid();
    byte[] bytes = new byte[(PutKinesisStream.MAX_MESSAGE_SIZE * 2)];
    for (int i = 0; i < bytes.length; i++) {
        bytes[i] = 'a';
    }
    runner.enqueue("hello".getBytes());
    runner.enqueue(bytes);
    runner.enqueue("there".getBytes());
    runner.run(1, true, true);
    List<MockFlowFile> flowFiles = runner.getFlowFilesForRelationship(PutKinesisStream.REL_SUCCESS);
    replacedertEquals(2, flowFiles.size());
    for (MockFlowFile flowFile : flowFiles) {
        flowFile.replacedertAttributeExists(PutKinesisStream.AWS_KINESIS_SEQUENCE_NUMBER);
        flowFile.replacedertAttributeExists(PutKinesisStream.AWS_KINESIS_SHARD_ID);
    }
    List<MockFlowFile> flowFilesFailed = runner.getFlowFilesForRelationship(PutKinesisStream.REL_FAILURE);
    replacedertEquals(1, flowFilesFailed.size());
    for (MockFlowFile flowFileFailed : flowFilesFailed) {
        replacedertNotNull(flowFileFailed.getAttribute(PutKinesisStream.AWS_KINESIS_ERROR_MESSAGE));
    }
}

19 View Complete Implementation : TestPutHBaseJSON.java
Copyright Apache License 2.0
Author : apache
@Test
public void testELWithProvidedRowId() throws IOException, InitializationException {
    final TestRunner runner = getTestRunner("${hbase.table}", "${hbase.colFamily}", "1");
    final MockHBaseClientService hBaseClient = getHBaseClientService(runner);
    runner.setProperty(PutHBaseJSON.ROW_ID, "${hbase.rowId}");
    final Map<String, String> attributes = new HashMap<>();
    attributes.put("hbase.table", "myTable");
    attributes.put("hbase.colFamily", "myColFamily");
    attributes.put("hbase.rowId", "myRowId");
    final String content = "{ \"field1\" : \"value1\", \"field2\" : \"value2\" }";
    runner.enqueue(content.getBytes("UTF-8"), attributes);
    runner.run();
    runner.replacedertAllFlowFilesTransferred(PutHBaseCell.REL_SUCCESS);
    final MockFlowFile outFile = runner.getFlowFilesForRelationship(PutHBaseCell.REL_SUCCESS).get(0);
    outFile.replacedertContentEquals(content);
    replacedertNotNull(hBaseClient.getFlowFilePuts());
    replacedertEquals(1, hBaseClient.getFlowFilePuts().size());
    final List<PutFlowFile> puts = hBaseClient.getFlowFilePuts().get("myTable");
    replacedertEquals(1, puts.size());
    final Map<String, byte[]> expectedColumns = new HashMap<>();
    expectedColumns.put("field1", hBaseClient.toBytes("value1"));
    expectedColumns.put("field2", hBaseClient.toBytes("value2"));
    HBaseTestUtil.verifyPut("myRowId", "myColFamily", expectedColumns, puts);
    final List<ProvenanceEventRecord> events = runner.getProvenanceEvents();
    replacedertEquals(1, events.size());
    HBaseTestUtil.verifyEvent(runner.getProvenanceEvents(), "hbase://myTable/myRowId", ProvenanceEventType.SEND);
}

19 View Complete Implementation : PutAzureEventHubTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void testMessageIsSentWithoutParreplacedioningKeyIfNotSpecifiedOrNotPopulated() {
    MockedEventhubClientMockPutAzureEventHub processor = new PutAzureEventHubTest.MockedEventhubClientMockPutAzureEventHub();
    MockitoAnnotations.initMocks(processor);
    EventHubClient eventHubClient = processor.getEventHubClient();
    when(eventHubClient.send(any(EventData.clreplaced), anyString())).thenThrow(new RuntimeException("Parreplacedion-key-full method called despite key is Not required or not populated."));
    when(eventHubClient.send(any(EventData.clreplaced))).thenReturn(CompletableFuture.completedFuture(null));
    testRunner = TestRunners.newTestRunner(processor);
    setUpStandardTestConfig();
    MockFlowFile flowFile = new MockFlowFile(1234);
    flowFile.putAttributes(ImmutableMap.of(TEST_PARreplacedIONING_KEY_ATTRIBUTE_NAME, TEST_PARreplacedIONING_KEY));
    // Key not specified
    testRunner.enqueue(flowFile);
    testRunner.run(1, true);
    Mockito.verify(eventHubClient, never()).send(any(EventData.clreplaced), eq(TEST_PARreplacedIONING_KEY));
    Mockito.verify(eventHubClient).send(any(EventData.clreplaced));
    // Key wanted but not available
    testRunner.setProperty(PutAzureEventHub.PARreplacedIONING_KEY_ATTRIBUTE_NAME, "Non-existing-attribute");
    testRunner.enqueue(flowFile);
    testRunner.run(1, true);
    Mockito.verify(eventHubClient, never()).send(any(EventData.clreplaced), eq(TEST_PARreplacedIONING_KEY));
    Mockito.verify(eventHubClient, times(2)).send(any(EventData.clreplaced));
}

19 View Complete Implementation : DeleteDynamoDBTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void testStringHashStringRangeDeleteNonExistentHashSuccess() {
    final TestRunner deleteRunner = TestRunners.newTestRunner(deleteDynamoDB);
    deleteRunner.setProperty(AbstractDynamoDBProcessor.ACCESS_KEY, "abcd");
    deleteRunner.setProperty(AbstractDynamoDBProcessor.SECRET_KEY, "cdef");
    deleteRunner.setProperty(AbstractDynamoDBProcessor.REGION, REGION);
    deleteRunner.setProperty(AbstractDynamoDBProcessor.TABLE, stringHashStringRangeTableName);
    deleteRunner.setProperty(AbstractDynamoDBProcessor.HASH_KEY_NAME, "hashS");
    deleteRunner.setProperty(AbstractDynamoDBProcessor.RANGE_KEY_NAME, "rangeS");
    deleteRunner.setProperty(AbstractDynamoDBProcessor.HASH_KEY_VALUE, "nonexistent");
    deleteRunner.setProperty(AbstractDynamoDBProcessor.RANGE_KEY_VALUE, "r1");
    deleteRunner.enqueue(new byte[] {});
    deleteRunner.run(1);
    deleteRunner.replacedertAllFlowFilesTransferred(AbstractDynamoDBProcessor.REL_SUCCESS, 1);
}

19 View Complete Implementation : TestPutElasticsearchHttp.java
Copyright Apache License 2.0
Author : apache
@Test
public void testPutElasticSearchOnTriggerIndex() throws IOException {
    // no failures
    runner = TestRunners.newTestRunner(new PutElasticsearchTestProcessor(false));
    runner.setProperty(AbstractElasticsearchHttpProcessor.ES_URL, "http://127.0.0.1:9200");
    runner.setProperty(PutElasticsearchHttp.INDEX, "doc");
    runner.setProperty(PutElasticsearchHttp.TYPE, "status");
    runner.setProperty(PutElasticsearchHttp.BATCH_SIZE, "1");
    runner.setProperty(PutElasticsearchHttp.ID_ATTRIBUTE, "doc_id");
    runner.enqueue(docExample, new HashMap<String, String>() {

        {
            put("doc_id", "28039652140");
        }
    });
    runner.run(1, true, true);
    runner.replacedertAllFlowFilesTransferred(PutElasticsearchHttp.REL_SUCCESS, 1);
    final MockFlowFile out = runner.getFlowFilesForRelationship(PutElasticsearchHttp.REL_SUCCESS).get(0);
    replacedertNotNull(out);
    out.replacedertAttributeEquals("doc_id", "28039652140");
}

19 View Complete Implementation : TestPutLambda.java
Copyright Apache License 2.0
Author : apache
@Test
public void testPutLambdaTooManyRequestsException() {
    runner.setProperty(PutLambda.AWS_LAMBDA_FUNCTION_NAME, "test-function");
    runner.enqueue("TestContent");
    Mockito.when(mockLambdaClient.invoke(Mockito.any(InvokeRequest.clreplaced))).thenThrow(new TooManyRequestsException("TestFail"));
    runner.replacedertValid();
    runner.run(1);
    runner.replacedertAllFlowFilesTransferred(PutLambda.REL_FAILURE, 1);
    final List<MockFlowFile> flowFiles = runner.getFlowFilesForRelationship(PutLambda.REL_FAILURE);
    final MockFlowFile ff0 = flowFiles.get(0);
    replacedertTrue(ff0.isPenalized());
}

19 View Complete Implementation : TestDeleteElasticsearch5.java
Copyright Apache License 2.0
Author : apache
@Test
public void testDeleteNotFound() throws IOException {
    restStatus = RestStatus.NOT_FOUND;
    deleteResponse = new DeleteResponse(null, TYPE1, doreplacedentId, 1, true) {

        @Override
        public RestStatus status() {
            return restStatus;
        }
    };
    runner.enqueue(new byte[] {}, new HashMap<String, String>() {

        {
            put("doreplacedentId", doreplacedentId);
        }
    });
    runner.run(1, true, true);
    runner.replacedertAllFlowFilesTransferred(DeleteElasticsearch5.REL_NOT_FOUND, 1);
    final MockFlowFile out = runner.getFlowFilesForRelationship(DeleteElasticsearch5.REL_NOT_FOUND).get(0);
    replacedertNotNull(out);
    replacedertEquals(DeleteElasticsearch5.UNABLE_TO_DELETE_DOreplacedENT_MESSAGE, out.getAttribute(DeleteElasticsearch5.ES_ERROR_MESSAGE));
    out.replacedertAttributeEquals(DeleteElasticsearch5.ES_REST_STATUS, restStatus.toString());
    out.replacedertAttributeEquals(DeleteElasticsearch5.ES_FILENAME, doreplacedentId);
    out.replacedertAttributeEquals(DeleteElasticsearch5.ES_INDEX, INDEX1);
    out.replacedertAttributeEquals(DeleteElasticsearch5.ES_TYPE, TYPE1);
}

19 View Complete Implementation : TestGetIgniteCache.java
Copyright Apache License 2.0
Author : apache
@Test
public void testGetIgniteCacheDefaultConfOneFlowFileWithPlainKey() throws IOException, InterruptedException {
    replacedume.replacedumeTrue(preJava11);
    getRunner = TestRunners.newTestRunner(getIgniteCache);
    getRunner.setProperty(GetIgniteCache.IGNITE_CACHE_ENTRY_KEY, "mykey");
    getRunner.replacedertValid();
    getRunner.enqueue(new byte[] {});
    getIgniteCache.initialize(getRunner.getProcessContext());
    getIgniteCache.getIgniteCache().put("mykey", "test".getBytes());
    getRunner.run(1, false, true);
    getRunner.replacedertAllFlowFilesTransferred(GetIgniteCache.REL_SUCCESS, 1);
    List<MockFlowFile> getSucessfulFlowFiles = getRunner.getFlowFilesForRelationship(GetIgniteCache.REL_SUCCESS);
    replacedertEquals(1, getSucessfulFlowFiles.size());
    List<MockFlowFile> getFailureFlowFiles = getRunner.getFlowFilesForRelationship(GetIgniteCache.REL_FAILURE);
    replacedertEquals(0, getFailureFlowFiles.size());
    final MockFlowFile getOut = getRunner.getFlowFilesForRelationship(GetIgniteCache.REL_SUCCESS).get(0);
    getOut.replacedertContentEquals("test".getBytes());
    getRunner.shutdown();
}

19 View Complete Implementation : TestSelectHive3QL.java
Copyright Apache License 2.0
Author : apache
@Test
public void testWithNullIntColumn() throws SQLException {
    // remove previous test database, if any
    final File dbLocation = new File(DB_LOCATION);
    dbLocation.delete();
    // load test data to database
    final Connection con = ((Hive3DBCPService) runner.getControllerService("dbcp")).getConnection();
    Statement stmt = con.createStatement();
    try {
        stmt.execute("drop table TEST_NULL_INT");
    } catch (final SQLException sqle) {
    // Nothing to do, probably means the table didn't exist
    }
    stmt.execute("create table TEST_NULL_INT (id integer not null, val1 integer, val2 integer, constraint my_pk primary key (id))");
    stmt.execute("insert into TEST_NULL_INT (id, val1, val2) VALUES (0, NULL, 1)");
    stmt.execute("insert into TEST_NULL_INT (id, val1, val2) VALUES (1, 1, 1)");
    runner.setIncomingConnection(false);
    runner.setProperty(SelectHive3QL.HIVEQL_SELECT_QUERY, "SELECT * FROM TEST_NULL_INT");
    runner.run();
    runner.replacedertAllFlowFilesTransferred(SelectHive3QL.REL_SUCCESS, 1);
    runner.getFlowFilesForRelationship(SelectHive3QL.REL_SUCCESS).get(0).replacedertAttributeEquals(SelectHive3QL.RESULT_ROW_COUNT, "2");
}

19 View Complete Implementation : TestGetIgniteCache.java
Copyright Apache License 2.0
Author : apache
@Test
public void testGetIgniteCacheDefaultConfTwoFlowFilesNoKey() throws IOException, InterruptedException {
    replacedume.replacedumeTrue(preJava11);
    getRunner = TestRunners.newTestRunner(getIgniteCache);
    getRunner.setProperty(GetIgniteCache.IGNITE_CACHE_ENTRY_KEY, "${igniteKey}");
    getRunner.replacedertValid();
    properties1.clear();
    getRunner.enqueue("".getBytes(), properties1);
    getRunner.enqueue("".getBytes(), properties1);
    getIgniteCache.initialize(getRunner.getProcessContext());
    getRunner.run(2, false, true);
    getRunner.replacedertAllFlowFilesTransferred(GetIgniteCache.REL_FAILURE, 2);
    List<MockFlowFile> sucessfulFlowFiles = getRunner.getFlowFilesForRelationship(GetIgniteCache.REL_SUCCESS);
    replacedertEquals(0, sucessfulFlowFiles.size());
    List<MockFlowFile> failureFlowFiles = getRunner.getFlowFilesForRelationship(GetIgniteCache.REL_FAILURE);
    replacedertEquals(2, failureFlowFiles.size());
    final MockFlowFile out1 = getRunner.getFlowFilesForRelationship(GetIgniteCache.REL_FAILURE).get(0);
    out1.replacedertAttributeEquals(GetIgniteCache.IGNITE_GET_FAILED_REASON_ATTRIBUTE_KEY, GetIgniteCache.IGNITE_GET_FAILED_MISSING_KEY_MESSAGE);
    final MockFlowFile out2 = getRunner.getFlowFilesForRelationship(GetIgniteCache.REL_FAILURE).get(1);
    out2.replacedertAttributeEquals(GetIgniteCache.IGNITE_GET_FAILED_REASON_ATTRIBUTE_KEY, GetIgniteCache.IGNITE_GET_FAILED_MISSING_KEY_MESSAGE);
    getRunner.shutdown();
}

19 View Complete Implementation : PutHDFSTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void testPutFileWithCompression() throws IOException {
    PutHDFS proc = new TestablePutHDFS(kerberosProperties, mockFileSystem);
    TestRunner runner = TestRunners.newTestRunner(proc);
    runner.setProperty(PutHDFS.DIRECTORY, "target/test-clreplacedes");
    runner.setProperty(PutHDFS.CONFLICT_RESOLUTION, "replace");
    runner.setProperty(PutHDFS.COMPRESSION_CODEC, "GZIP");
    try (FileInputStream fis = new FileInputStream("src/test/resources/testdata/randombytes-1")) {
        Map<String, String> attributes = new HashMap<>();
        attributes.put(CoreAttributes.FILENAME.key(), "randombytes-1");
        runner.enqueue(fis, attributes);
        runner.run();
    }
    List<MockFlowFile> failedFlowFiles = runner.getFlowFilesForRelationship(new Relationship.Builder().name("failure").build());
    replacedertTrue(failedFlowFiles.isEmpty());
    List<MockFlowFile> flowFiles = runner.getFlowFilesForRelationship(PutHDFS.REL_SUCCESS);
    replacedertEquals(1, flowFiles.size());
    MockFlowFile flowFile = flowFiles.get(0);
    replacedertTrue(mockFileSystem.exists(new Path("target/test-clreplacedes/randombytes-1.gz")));
    replacedertEquals("randombytes-1.gz", flowFile.getAttribute(CoreAttributes.FILENAME.key()));
    replacedertEquals("target/test-clreplacedes", flowFile.getAttribute(PutHDFS.ABSOLUTE_HDFS_PATH_ATTRIBUTE));
}

19 View Complete Implementation : ParseEvtxTest.java
Copyright Apache License 2.0
Author : apache
private void testValidEvents(String granularity, String filename, int expectedCount) {
    TestRunner testRunner = TestRunners.newTestRunner(ParseEvtx.clreplaced);
    testRunner.setProperty(ParseEvtx.GRANULARITY, granularity);
    Map<String, String> attributes = new HashMap<>();
    ClreplacedLoader clreplacedLoader = this.getClreplaced().getClreplacedLoader();
    InputStream resourcereplacedtream = clreplacedLoader.getResourcereplacedtream(filename);
    testRunner.enqueue(resourcereplacedtream, attributes);
    testRunner.run();
    testRunner.replacedertTransferCount(ParseEvtx.REL_SUCCESS, expectedCount);
}

19 View Complete Implementation : PutORCTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void testValidSchemaWithELShouldBeSuccessful() throws InitializationException {
    configure(proc, 10);
    final String filename = "testValidSchemaWithELShouldBeSuccessful-" + System.currentTimeMillis();
    // don't provide my.schema as an attribute
    final Map<String, String> flowFileAttributes = new HashMap<>();
    flowFileAttributes.put(CoreAttributes.FILENAME.key(), filename);
    flowFileAttributes.put("my.schema", schema.toString());
    testRunner.enqueue("trigger", flowFileAttributes);
    testRunner.run();
    testRunner.replacedertAllFlowFilesTransferred(PutORC.REL_SUCCESS, 1);
}

19 View Complete Implementation : TestFetchElasticsearchHttp.java
Copyright Apache License 2.0
Author : apache
@Test
public void testFetchElasticsearchOnTrigger() throws IOException {
    // all docs are found
    runner = TestRunners.newTestRunner(new FetchElasticsearchHttpTestProcessor(true));
    runner.setProperty(AbstractElasticsearchHttpProcessor.ES_URL, "http://127.0.0.1:9200");
    runner.setProperty(FetchElasticsearchHttp.INDEX, "doc");
    runner.replacedertNotValid();
    runner.setProperty(FetchElasticsearchHttp.TYPE, "status");
    runner.replacedertNotValid();
    runner.setProperty(FetchElasticsearchHttp.DOC_ID, "${doc_id}");
    runner.replacedertValid();
    runner.enqueue(docExample, new HashMap<String, String>() {

        {
            put("doc_id", "28039652140");
        }
    });
    runner.run(1, true, true);
    runner.replacedertAllFlowFilesTransferred(FetchElasticsearchHttp.REL_SUCCESS, 1);
    final MockFlowFile out = runner.getFlowFilesForRelationship(FetchElasticsearchHttp.REL_SUCCESS).get(0);
    replacedertNotNull(out);
    out.replacedertAttributeEquals("doc_id", "28039652140");
}

19 View Complete Implementation : ITTagS3Object.java
Copyright Apache License 2.0
Author : apache
@Test
public void testAppendTag() throws Exception {
    String objectKey = "test-file";
    String tagKey = "nifi-key";
    String tagValue = "nifi-val";
    Tag existingTag = new Tag("oldkey", "oldvalue");
    // put file in s3
    putFileWithObjectTag(objectKey, getFileFromResourceName(SAMPLE_FILE_RESOURCE_NAME), Arrays.asList(existingTag));
    // Set up processor
    final TestRunner runner = TestRunners.newTestRunner(new TagS3Object());
    runner.setProperty(TagS3Object.CREDENTIALS_FILE, CREDENTIALS_FILE);
    runner.setProperty(TagS3Object.REGION, REGION);
    runner.setProperty(TagS3Object.BUCKET, BUCKET_NAME);
    runner.setProperty(TagS3Object.TAG_KEY, tagKey);
    runner.setProperty(TagS3Object.TAG_VALUE, tagValue);
    final Map<String, String> attrs = new HashMap<>();
    attrs.put("filename", objectKey);
    runner.enqueue(new byte[0], attrs);
    // tag file
    runner.run(1);
    // Verify processor succeeds
    runner.replacedertAllFlowFilesTransferred(TagS3Object.REL_SUCCESS, 1);
    // Verify new tag and existing exist on S3 object
    GetObjectTaggingResult res = client.getObjectTagging(new GetObjectTaggingRequest(BUCKET_NAME, objectKey));
    replacedertTrue("Expected new tag not found on S3 object", res.getTagSet().contains(new Tag(tagKey, tagValue)));
    replacedertTrue("Expected existing tag not found on S3 object", res.getTagSet().contains(existingTag));
}

19 View Complete Implementation : ITPutLambda.java
Copyright Apache License 2.0
Author : apache
@Test
public void testSizeGreaterThan6MB() throws Exception {
    runner = TestRunners.newTestRunner(PutLambda.clreplaced);
    runner.setProperty(PutLambda.CREDENTIALS_FILE, CREDENTIALS_FILE);
    runner.setProperty(PutLambda.AWS_LAMBDA_FUNCTION_NAME, "hello");
    runner.replacedertValid();
    byte[] largeInput = new byte[6000001];
    for (int i = 0; i < 6000001; i++) {
        largeInput[i] = 'a';
    }
    runner.enqueue(largeInput);
    runner.run(1);
    runner.replacedertAllFlowFilesTransferred(PutLambda.REL_FAILURE, 1);
}

19 View Complete Implementation : ITPutKinesisFirehose.java
Copyright Apache License 2.0
Author : apache
/**
 * Comment out ignore for integration tests (requires creds files)
 */
@Test
public void testIntegrationSuccess() throws Exception {
    runner = TestRunners.newTestRunner(PutKinesisFirehose.clreplaced);
    runner.setProperty(PutKinesisFirehose.CREDENTIALS_FILE, CREDENTIALS_FILE);
    runner.setProperty(PutKinesisFirehose.KINESIS_FIREHOSE_DELIVERY_STREAM_NAME, "testkinesis");
    runner.replacedertValid();
    runner.enqueue("test".getBytes());
    runner.run(1);
    runner.replacedertAllFlowFilesTransferred(PutKinesisFirehose.REL_SUCCESS, 1);
    final List<MockFlowFile> ffs = runner.getFlowFilesForRelationship(FetchS3Object.REL_SUCCESS);
    final MockFlowFile out = ffs.iterator().next();
    out.replacedertContentEquals("test".getBytes());
}

19 View Complete Implementation : TestPutHive_1_1QL.java
Copyright Apache License 2.0
Author : apache
@Test
public void testUnknownFailureRollbackOnFailure() throws InitializationException, ProcessException {
    final TestRunner runner = TestRunners.newTestRunner(PutHive_1_1QL.clreplaced);
    final SQLExceptionService service = new SQLExceptionService(null);
    service.setErrorCode(0);
    runner.addControllerService("dbcp", service);
    runner.enableControllerService(service);
    runner.setProperty(PutHive_1_1QL.HIVE_DBCP_SERVICE, "dbcp");
    runner.setProperty(RollbackOnFailure.ROLLBACK_ON_FAILURE, "true");
    final String sql = "INSERT INTO PERSONS (ID, NAME, CODE) VALUES (?, ?, ?); " + "UPDATE PERSONS SET NAME='George' WHERE ID=?; ";
    final Map<String, String> attributes = new HashMap<>();
    attributes.put("hiveql.args.1.type", String.valueOf(Types.INTEGER));
    attributes.put("hiveql.args.1.value", "1");
    attributes.put("hiveql.args.2.type", String.valueOf(Types.VARCHAR));
    attributes.put("hiveql.args.2.value", "Mark");
    attributes.put("hiveql.args.3.type", String.valueOf(Types.INTEGER));
    attributes.put("hiveql.args.3.value", "84");
    attributes.put("hiveql.args.4.type", String.valueOf(Types.INTEGER));
    attributes.put("hiveql.args.4.value", "1");
    runner.enqueue(sql.getBytes(), attributes);
    try {
        runner.run();
        fail("Should throw ProcessException");
    } catch (replacedertionError e) {
        replacedertTrue(e.getCause() instanceof ProcessException);
    }
    replacedertEquals(1, runner.getQueueSize().getObjectCount());
    runner.replacedertAllFlowFilesTransferred(PutHive_1_1QL.REL_RETRY, 0);
}

19 View Complete Implementation : TestCompareFuzzyHash.java
Copyright Apache License 2.0
Author : apache
@Test
public void testTLSHCompareFuzzyHashWithBlankFile() {
    // This is different from "BlankHashList series of tests in that the file lacks headers and as such is totally
    // invalid
    double matchingSimilarity = 200;
    runner.setProperty(CompareFuzzyHash.HASH_ALGORITHM, CompareFuzzyHash.allowableValueTLSH.getValue());
    runner.setProperty(CompareFuzzyHash.ATTRIBUTE_NAME, "fuzzyhash.value");
    runner.setProperty(CompareFuzzyHash.HASH_LIST_FILE, "src/test/resources/empty.list");
    runner.setProperty(CompareFuzzyHash.MATCH_THRESHOLD, String.valueOf(matchingSimilarity));
    Map<String, String> attributes = new HashMap<>();
    attributes.put("fuzzyhash.value", "E2F0818B7AE7173906A72221570E30979B11C0FC47B518A1E89D257E2343CEC02381ED");
    runner.enqueue("bogus".getBytes(), attributes);
    runner.run();
    runner.replacedertQueueEmpty();
    runner.replacedertAllFlowFilesTransferred(CompareFuzzyHash.REL_NOT_FOUND, 1);
    final MockFlowFile outFile = runner.getFlowFilesForRelationship(CompareFuzzyHash.REL_NOT_FOUND).get(0);
    outFile.replacedertAttributeNotExists("fuzzyhash.value.0.match");
}

19 View Complete Implementation : ITPutKinesisFirehose.java
Copyright Apache License 2.0
Author : apache
@Test
public void test5MessageWithBatch10MaxBufferSize10MBRunOnce5MessageSent() {
    runner = TestRunners.newTestRunner(PutKinesisFirehose.clreplaced);
    runner.setProperty(PutKinesisFirehose.CREDENTIALS_FILE, CREDENTIALS_FILE);
    runner.setProperty(PutKinesisFirehose.BATCH_SIZE, "10");
    runner.setProperty(PutKinesisFirehose.MAX_MESSAGE_BUFFER_SIZE_MB, "1 MB");
    runner.setProperty(PutKinesisFirehose.KINESIS_FIREHOSE_DELIVERY_STREAM_NAME, "testkinesis");
    runner.replacedertValid();
    byte[] bytes = new byte[10];
    for (int i = 0; i < bytes.length; i++) {
        bytes[i] = 'a';
    }
    runner.enqueue(bytes);
    runner.enqueue(bytes.clone());
    runner.enqueue(bytes.clone());
    runner.enqueue(bytes);
    runner.enqueue(bytes.clone());
    runner.run(1, true, true);
    runner.replacedertAllFlowFilesTransferred(PutKinesisFirehose.REL_SUCCESS, 5);
    List<MockFlowFile> flowFiles = runner.getFlowFilesForRelationship(PutKinesisFirehose.REL_SUCCESS);
    replacedertEquals(5, flowFiles.size());
    for (MockFlowFile flowFile : flowFiles) {
        flowFile.replacedertAttributeExists(PutKinesisFirehose.AWS_KINESIS_FIREHOSE_RECORD_ID);
    }
}

19 View Complete Implementation : TestPutHive3QL.java
Copyright Apache License 2.0
Author : apache
@Test
public void testMultipleStatementsWithinFlowFilePlusEmbeddedDelimiter() throws InitializationException, ProcessException, SQLException, IOException {
    final TestRunner runner = TestRunners.newTestRunner(PutHive3QL.clreplaced);
    final File tempDir = folder.getRoot();
    final File dbDir = new File(tempDir, "db");
    final DBCPService service = new MockDBCPService(dbDir.getAbsolutePath());
    runner.addControllerService("dbcp", service);
    runner.enableControllerService(service);
    try (final Connection conn = service.getConnection()) {
        try (final Statement stmt = conn.createStatement()) {
            stmt.executeUpdate(createPersons);
        }
    }
    runner.setProperty(PutHive3QL.HIVE_DBCP_SERVICE, "dbcp");
    final String sql = "INSERT INTO PERSONS (ID, NAME, CODE) VALUES (?, ?, ?); " + "UPDATE PERSONS SET NAME='George\\;' WHERE ID=?; ";
    final Map<String, String> attributes = new HashMap<>();
    attributes.put("hiveql.args.1.type", String.valueOf(Types.INTEGER));
    attributes.put("hiveql.args.1.value", "1");
    attributes.put("hiveql.args.2.type", String.valueOf(Types.VARCHAR));
    attributes.put("hiveql.args.2.value", "Mark");
    attributes.put("hiveql.args.3.type", String.valueOf(Types.INTEGER));
    attributes.put("hiveql.args.3.value", "84");
    attributes.put("hiveql.args.4.type", String.valueOf(Types.INTEGER));
    attributes.put("hiveql.args.4.value", "1");
    runner.enqueue(sql.getBytes(), attributes);
    runner.run();
    // should fail because of the semicolon
    runner.replacedertAllFlowFilesTransferred(PutHive3QL.REL_SUCCESS, 1);
    // Now we can check that the values were inserted by the multi-statement script.
    try (final Connection conn = service.getConnection()) {
        try (final Statement stmt = conn.createStatement()) {
            final ResultSet rs = stmt.executeQuery("SELECT * FROM PERSONS");
            replacedertTrue(rs.next());
            replacedertEquals("Record ID mismatch", 1, rs.getInt(1));
            replacedertEquals("Record NAME mismatch", "George\\;", rs.getString(2));
        }
    }
}

19 View Complete Implementation : TestGetHBase.java
Copyright Apache License 2.0
Author : apache
@Test
public void testChangeTableNameClearsState() {
    final long now = System.currentTimeMillis();
    final Map<String, String> cells = new HashMap<>();
    cells.put("greeting", "hello");
    cells.put("name", "nifi");
    hBaseClient.addResult("row0", cells, now - 2);
    hBaseClient.addResult("row1", cells, now - 1);
    hBaseClient.addResult("row2", cells, now - 1);
    hBaseClient.addResult("row3", cells, now);
    runner.run(100);
    runner.replacedertAllFlowFilesTransferred(GetHBase.REL_SUCCESS, 4);
    // change the table name and run again, should get all the data coming out
    // again because previous state will be wiped
    runner.setProperty(GetHBase.TABLE_NAME, "otherTable");
    hBaseClient.addResult("row0", cells, now - 2);
    hBaseClient.addResult("row1", cells, now - 1);
    hBaseClient.addResult("row2", cells, now - 1);
    hBaseClient.addResult("row3", cells, now);
    runner.run(100);
    runner.replacedertAllFlowFilesTransferred(GetHBase.REL_SUCCESS, 4);
}

19 View Complete Implementation : TestScanAccumulo.java
Copyright Apache License 2.0
Author : apache
private void basicPutSetup(boolean sendFlowFile, String row, String endrow, String cf, String endcf, boolean valueincq, String delim, String auths, Authorizations defaultVis, boolean deletes, int expected) throws Exception {
    String tableName = UUID.randomUUID().toString();
    tableName = tableName.replace("-", "a");
    acreplacedulo.getConnector("root", "preplacedword").tableOperations().create(tableName);
    if (null != defaultVis)
        acreplacedulo.getConnector("root", "preplacedword").securityOperations().changeUserAuthorizations("root", defaultVis);
    TestRunner runner = getTestRunner(tableName, DEFAULT_COLUMN_FAMILY);
    runner.setProperty(ScanAcreplacedulo.START_KEY, row);
    if (!cf.isEmpty())
        runner.setProperty(ScanAcreplacedulo.COLUMNFAMILY, cf);
    if (!endcf.isEmpty())
        runner.setProperty(ScanAcreplacedulo.COLUMNFAMILY_END, endcf);
    runner.setProperty(ScanAcreplacedulo.AUTHORIZATIONS, auths);
    runner.setProperty(ScanAcreplacedulo.END_KEY, endrow);
    AcreplaceduloService client = MockAcreplaceduloService.getService(runner, acreplacedulo.getZooKeepers(), acreplacedulo.getInstanceName(), "root", "preplacedword");
    Set<Key> expectedKeys = generateTestData(runner, row, tableName, valueincq, delim, auths);
    if (sendFlowFile) {
        // This is to coax the processor into reading the data in the reader.l
        runner.enqueue("Test".getBytes("UTF-8"));
    }
    runner.run();
    List<MockFlowFile> results = runner.getFlowFilesForRelationship(ScanAcreplacedulo.REL_SUCCESS);
    for (MockFlowFile ff : results) {
        String attr = ff.getAttribute("record.count");
        replacedert.replacedertEquals(expected, Integer.valueOf(attr).intValue());
    }
    replacedert.replacedertTrue("Wrong count, received " + results.size(), results.size() == 1);
}

19 View Complete Implementation : TestPutIgniteCache.java
Copyright Apache License 2.0
Author : apache
@Test
public void testPutIgniteCacheOnTriggerDefaultConfigurationTwoFlowFiles() throws IOException, InterruptedException {
    replacedume.replacedumeTrue(preJava11);
    runner = TestRunners.newTestRunner(putIgniteCache);
    runner.setProperty(PutIgniteCache.BATCH_SIZE, "5");
    runner.setProperty(PutIgniteCache.CACHE_NAME, CACHE_NAME);
    runner.setProperty(PutIgniteCache.DATA_STREAMER_PER_NODE_BUFFER_SIZE, "1");
    runner.setProperty(PutIgniteCache.IGNITE_CACHE_ENTRY_KEY, "${igniteKey}");
    runner.replacedertValid();
    runner.enqueue("test1".getBytes(), properties1);
    runner.enqueue("test2".getBytes(), properties2);
    runner.run(1, false, true);
    runner.replacedertAllFlowFilesTransferred(PutIgniteCache.REL_SUCCESS, 2);
    List<MockFlowFile> successfulFlowFiles = runner.getFlowFilesForRelationship(PutIgniteCache.REL_SUCCESS);
    replacedertEquals(2, successfulFlowFiles.size());
    List<MockFlowFile> failureFlowFiles = runner.getFlowFilesForRelationship(PutIgniteCache.REL_FAILURE);
    replacedertEquals(0, failureFlowFiles.size());
    final MockFlowFile out1 = runner.getFlowFilesForRelationship(PutIgniteCache.REL_SUCCESS).get(0);
    out1.replacedertAttributeEquals(PutIgniteCache.IGNITE_BATCH_FLOW_FILE_SUCCESSFUL_ITEM_NUMBER, "0");
    out1.replacedertAttributeEquals(PutIgniteCache.IGNITE_BATCH_FLOW_FILE_TOTAL_COUNT, "2");
    out1.replacedertAttributeEquals(PutIgniteCache.IGNITE_BATCH_FLOW_FILE_SUCCESSFUL_COUNT, "2");
    out1.replacedertAttributeEquals(PutIgniteCache.IGNITE_BATCH_FLOW_FILE_ITEM_NUMBER, "0");
    out1.replacedertContentEquals("test1".getBytes());
    replacedert.replacedertArrayEquals("test1".getBytes(), (byte[]) putIgniteCache.getIgniteCache().get("key1"));
    final MockFlowFile out2 = runner.getFlowFilesForRelationship(PutIgniteCache.REL_SUCCESS).get(1);
    out2.replacedertAttributeEquals(PutIgniteCache.IGNITE_BATCH_FLOW_FILE_SUCCESSFUL_ITEM_NUMBER, "1");
    out2.replacedertAttributeEquals(PutIgniteCache.IGNITE_BATCH_FLOW_FILE_TOTAL_COUNT, "2");
    out2.replacedertAttributeEquals(PutIgniteCache.IGNITE_BATCH_FLOW_FILE_ITEM_NUMBER, "1");
    out2.replacedertAttributeEquals(PutIgniteCache.IGNITE_BATCH_FLOW_FILE_SUCCESSFUL_COUNT, "2");
    out2.replacedertContentEquals("test2".getBytes());
    replacedert.replacedertArrayEquals("test2".getBytes(), (byte[]) putIgniteCache.getIgniteCache().get("key2"));
    runner.shutdown();
}

19 View Complete Implementation : ITListS3.java
Copyright Apache License 2.0
Author : apache
@Test
public void testSimpleListUsingCredentialsProviderService() throws Throwable {
    putTestFile("a", getFileFromResourceName(SAMPLE_FILE_RESOURCE_NAME));
    putTestFile("b/c", getFileFromResourceName(SAMPLE_FILE_RESOURCE_NAME));
    putTestFile("d/e", getFileFromResourceName(SAMPLE_FILE_RESOURCE_NAME));
    final TestRunner runner = TestRunners.newTestRunner(new ListS3());
    final AWSCredentialsProviderControllerService serviceImpl = new AWSCredentialsProviderControllerService();
    runner.addControllerService("awsCredentialsProvider", serviceImpl);
    runner.setProperty(serviceImpl, AbstractAWSProcessor.CREDENTIALS_FILE, CREDENTIALS_FILE);
    runner.enableControllerService(serviceImpl);
    runner.replacedertValid(serviceImpl);
    runner.setProperty(ListS3.AWS_CREDENTIALS_PROVIDER_SERVICE, "awsCredentialsProvider");
    runner.setProperty(ListS3.REGION, REGION);
    runner.setProperty(ListS3.BUCKET, BUCKET_NAME);
    runner.run();
    runner.replacedertAllFlowFilesTransferred(ListS3.REL_SUCCESS, 3);
    List<MockFlowFile> flowFiles = runner.getFlowFilesForRelationship(ListS3.REL_SUCCESS);
    flowFiles.get(0).replacedertAttributeEquals("filename", "a");
    flowFiles.get(1).replacedertAttributeEquals("filename", "b/c");
    flowFiles.get(2).replacedertAttributeEquals("filename", "d/e");
}

19 View Complete Implementation : GetHDFSTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void testDirectoryDoesNotExist() {
    GetHDFS proc = new TestableGetHDFS(kerberosProperties);
    TestRunner runner = TestRunners.newTestRunner(proc);
    runner.setProperty(PutHDFS.DIRECTORY, "does/not/exist/${now():format('yyyyMMdd')}");
    runner.setProperty(GetHDFS.KEEP_SOURCE_FILE, "true");
    runner.run();
    List<MockFlowFile> flowFiles = runner.getFlowFilesForRelationship(GetHDFS.REL_SUCCESS);
    replacedertEquals(0, flowFiles.size());
}

19 View Complete Implementation : TestPutS3Object.java
Copyright Apache License 2.0
Author : apache
@Test
public void testPutSinglePart() {
    runner.setProperty("x-custom-prop", "hello");
    prepareTest();
    runner.run(1);
    ArgumentCaptor<PutObjectRequest> captureRequest = ArgumentCaptor.forClreplaced(PutObjectRequest.clreplaced);
    Mockito.verify(mockS3Client, Mockito.times(1)).putObject(captureRequest.capture());
    PutObjectRequest request = captureRequest.getValue();
    replacedertEquals("test-bucket", request.getBucketName());
    runner.replacedertAllFlowFilesTransferred(PutS3Object.REL_SUCCESS, 1);
    List<MockFlowFile> flowFiles = runner.getFlowFilesForRelationship(PutS3Object.REL_SUCCESS);
    MockFlowFile ff0 = flowFiles.get(0);
    ff0.replacedertAttributeEquals(CoreAttributes.FILENAME.key(), "testfile.txt");
    ff0.replacedertAttributeEquals(PutS3Object.S3_ETAG_ATTR_KEY, "test-etag");
    ff0.replacedertAttributeEquals(PutS3Object.S3_VERSION_ATTR_KEY, "test-version");
}

19 View Complete Implementation : QueryCassandraTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void testProcessorJsonOutput() {
    setUpStandardProcessorConfig();
    testRunner.setIncomingConnection(false);
    // Test JSON output
    testRunner.setProperty(QueryCreplacedandra.OUTPUT_FORMAT, QueryCreplacedandra.JSON_FORMAT);
    testRunner.run(1, true, true);
    testRunner.replacedertAllFlowFilesTransferred(QueryCreplacedandra.REL_SUCCESS, 1);
    List<MockFlowFile> files = testRunner.getFlowFilesForRelationship(QueryCreplacedandra.REL_SUCCESS);
    replacedertNotNull(files);
    replacedertEquals("One file should be transferred to success", 1, files.size());
    replacedertEquals("{\"results\":[{\"user_id\":\"user1\",\"first_name\":\"Joe\",\"last_name\":\"Smith\"," + "\"emails\":[\"[email protected]\"],\"top_places\":[\"New York, NY\",\"Santa Clara, CA\"]," + "\"todo\":{\"2016-01-03 05:00:00+0000\":\"Set my alarm \\\"for\\\" a month from now\"}," + "\"registered\":\"false\",\"scale\":1.0,\"metric\":2.0}," + "{\"user_id\":\"user2\",\"first_name\":\"Mary\",\"last_name\":\"Jones\"," + "\"emails\":[\"[email protected]\"],\"top_places\":[\"Orlando, FL\"]," + "\"todo\":{\"2016-02-03 05:00:00+0000\":\"Get milk and bread\"}," + "\"registered\":\"true\",\"scale\":3.0,\"metric\":4.0}]}", new String(files.get(0).toByteArray()));
}

19 View Complete Implementation : TestPutElasticsearchHttpRecord.java
Copyright Apache License 2.0
Author : apache
@Test
public void testPutElasticsearchOnTriggerWithIndexFromAttribute() throws IOException {
    runner = TestRunners.newTestRunner(new PutElasticsearchHttpRecordTestProcessor(false));
    generateTestData();
    runner.setProperty(AbstractElasticsearchHttpProcessor.ES_URL, "http://127.0.0.1:9200");
    runner.setProperty(PutElasticsearchHttpRecord.INDEX, "${i}");
    runner.setProperty(PutElasticsearchHttpRecord.TYPE, "${type}");
    runner.setProperty(PutElasticsearchHttpRecord.ID_RECORD_PATH, "/id");
    runner.enqueue(new byte[0], new HashMap<String, String>() {

        {
            put("doc_id", "28039652144");
            put("i", "doc");
            put("type", "status");
        }
    });
    runner.run(1, true, true);
    runner.replacedertAllFlowFilesTransferred(PutElasticsearchHttpRecord.REL_SUCCESS, 1);
    final MockFlowFile out = runner.getFlowFilesForRelationship(PutElasticsearchHttpRecord.REL_SUCCESS).get(0);
    replacedertNotNull(out);
    runner.clearTransferState();
    // Now try an empty attribute value, should fail
    runner.enqueue(new byte[0], new HashMap<String, String>() {

        {
            put("doc_id", "28039652144");
            put("type", "status");
        }
    });
    runner.run(1, true, true);
    runner.replacedertAllFlowFilesTransferred(PutElasticsearchHttpRecord.REL_FAILURE, 1);
    final MockFlowFile out2 = runner.getFlowFilesForRelationship(PutElasticsearchHttpRecord.REL_FAILURE).get(0);
    replacedertNotNull(out2);
}

19 View Complete Implementation : TestListS3.java
Copyright Apache License 2.0
Author : apache
@Test
public void testWriteUserMetadata() {
    runner.setProperty(ListS3.REGION, "eu-west-1");
    runner.setProperty(ListS3.BUCKET, "test-bucket");
    runner.setProperty(ListS3.WRITE_USER_METADATA, "true");
    Date lastModified = new Date();
    ObjectListing objectListing = new ObjectListing();
    S3ObjectSummary objectSummary1 = new S3ObjectSummary();
    objectSummary1.setBucketName("test-bucket");
    objectSummary1.setKey("a");
    objectSummary1.setLastModified(lastModified);
    objectListing.getObjectSummaries().add(objectSummary1);
    Mockito.when(mockS3Client.listObjects(Mockito.any(ListObjectsRequest.clreplaced))).thenReturn(objectListing);
    runner.run();
    ArgumentCaptor<GetObjectMetadataRequest> captureRequest = ArgumentCaptor.forClreplaced(GetObjectMetadataRequest.clreplaced);
    Mockito.verify(mockS3Client, Mockito.times(1)).getObjectMetadata(captureRequest.capture());
    GetObjectMetadataRequest request = captureRequest.getValue();
    replacedertEquals("test-bucket", request.getBucketName());
    replacedertEquals("a", request.getKey());
    Mockito.verify(mockS3Client, Mockito.never()).listVersions(Mockito.any());
}

19 View Complete Implementation : TestDeleteSQS.java
Copyright Apache License 2.0
Author : apache
@Test
public void testDeleteWithCustomReceiptHandle() {
    runner.setProperty(DeleteSQS.QUEUE_URL, "https://sqs.us-west-2.amazonaws.com/123456789012/test-queue-000000000");
    runner.setProperty(DeleteSQS.RECEIPT_HANDLE, "${custom.receipt.handle}");
    final Map<String, String> ffAttributes = new HashMap<>();
    ffAttributes.put("filename", "1.txt");
    ffAttributes.put("custom.receipt.handle", "test-receipt-handle-1");
    runner.enqueue("TestMessageBody", ffAttributes);
    runner.replacedertValid();
    runner.run(1);
    ArgumentCaptor<DeleteMessageBatchRequest> captureDeleteRequest = ArgumentCaptor.forClreplaced(DeleteMessageBatchRequest.clreplaced);
    Mockito.verify(mockSQSClient, Mockito.times(1)).deleteMessageBatch(captureDeleteRequest.capture());
    DeleteMessageBatchRequest deleteRequest = captureDeleteRequest.getValue();
    replacedertEquals("test-receipt-handle-1", deleteRequest.getEntries().get(0).getReceiptHandle());
    runner.replacedertAllFlowFilesTransferred(DeleteSQS.REL_SUCCESS, 1);
}

19 View Complete Implementation : ITListS3.java
Copyright Apache License 2.0
Author : apache
@Test
public void testSimpleListWithPrefixAndVersions() throws Throwable {
    putTestFile("a", getFileFromResourceName(SAMPLE_FILE_RESOURCE_NAME));
    putTestFile("b/c", getFileFromResourceName(SAMPLE_FILE_RESOURCE_NAME));
    putTestFile("d/e", getFileFromResourceName(SAMPLE_FILE_RESOURCE_NAME));
    final TestRunner runner = TestRunners.newTestRunner(new ListS3());
    runner.setProperty(ListS3.CREDENTIALS_FILE, CREDENTIALS_FILE);
    runner.setProperty(ListS3.REGION, REGION);
    runner.setProperty(ListS3.BUCKET, BUCKET_NAME);
    runner.setProperty(ListS3.PREFIX, "b/");
    runner.setProperty(ListS3.USE_VERSIONS, "true");
    runner.run();
    runner.replacedertAllFlowFilesTransferred(ListS3.REL_SUCCESS, 1);
    List<MockFlowFile> flowFiles = runner.getFlowFilesForRelationship(ListS3.REL_SUCCESS);
    flowFiles.get(0).replacedertAttributeEquals("filename", "b/c");
}

19 View Complete Implementation : ITListS3.java
Copyright Apache License 2.0
Author : apache
@Test
public void testObjectTagsWritten() {
    List<Tag> objectTags = new ArrayList<>();
    objectTags.add(new Tag("dummytag1", "dummyvalue1"));
    objectTags.add(new Tag("dummytag2", "dummyvalue2"));
    putFileWithObjectTag("b/fileWithTag", getFileFromResourceName(SAMPLE_FILE_RESOURCE_NAME), objectTags);
    final TestRunner runner = TestRunners.newTestRunner(new ListS3());
    runner.setProperty(ListS3.CREDENTIALS_FILE, CREDENTIALS_FILE);
    runner.setProperty(ListS3.PREFIX, "b/");
    runner.setProperty(ListS3.REGION, REGION);
    runner.setProperty(ListS3.BUCKET, BUCKET_NAME);
    runner.setProperty(ListS3.WRITE_OBJECT_TAGS, "true");
    runner.run();
    runner.replacedertAllFlowFilesTransferred(ListS3.REL_SUCCESS, 1);
    MockFlowFile flowFiles = runner.getFlowFilesForRelationship(ListS3.REL_SUCCESS).get(0);
    flowFiles.replacedertAttributeEquals("filename", "b/fileWithTag");
    flowFiles.replacedertAttributeExists("s3.tag.dummytag1");
    flowFiles.replacedertAttributeExists("s3.tag.dummytag2");
    flowFiles.replacedertAttributeEquals("s3.tag.dummytag1", "dummyvalue1");
    flowFiles.replacedertAttributeEquals("s3.tag.dummytag2", "dummyvalue2");
}

19 View Complete Implementation : ListGCSBucketTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void testEmptyList() throws Exception {
    reset(storage, mockBlobPage);
    final ListGCSBucket processor = getProcessor();
    final TestRunner runner = buildNewRunner(processor);
    addRequiredPropertiesToRunner(runner);
    runner.replacedertValid();
    final Iterable<Blob> mockList = ImmutableList.of();
    when(mockBlobPage.getValues()).thenReturn(mockList);
    when(mockBlobPage.getNextPage()).thenReturn(null);
    when(storage.list(anyString(), any(Storage.BlobListOption[].clreplaced))).thenReturn(mockBlobPage);
    runner.enqueue("test");
    runner.run();
    runner.replacedertTransferCount(ListGCSBucket.REL_SUCCESS, 0);
    replacedertEquals("No state should be persisted on an empty return", -1L, runner.getStateManager().getState(Scope.CLUSTER).getVersion());
}

19 View Complete Implementation : TestSelectHiveQL.java
Copyright Apache License 2.0
Author : apache
@Test
public void testMaxRowsPerFlowFileWithMaxFragments() throws ClreplacedNotFoundException, SQLException, InitializationException, IOException {
    // load test data to database
    final Connection con = ((DBCPService) runner.getControllerService("dbcp")).getConnection();
    Statement stmt = con.createStatement();
    InputStream in;
    MockFlowFile mff;
    try {
        stmt.execute("drop table TEST_QUERY_DB_TABLE");
    } catch (final SQLException sqle) {
    // Ignore this error, probably a "table does not exist" since Derby doesn't yet support DROP IF EXISTS [DERBY-4842]
    }
    stmt.execute("create table TEST_QUERY_DB_TABLE (id integer not null, name varchar(100), scale float, created_on timestamp, bignum bigint default 0)");
    int rowCount = 0;
    // create larger row set
    for (int batch = 0; batch < 100; batch++) {
        stmt.execute("insert into TEST_QUERY_DB_TABLE (id, name, scale, created_on) VALUES (" + rowCount + ", 'Joe Smith', 1.0, '1962-09-23 03:23:34.234')");
        rowCount++;
    }
    runner.setIncomingConnection(false);
    runner.setProperty(SelectHiveQL.HIVEQL_SELECT_QUERY, "SELECT * FROM TEST_QUERY_DB_TABLE");
    runner.setProperty(SelectHiveQL.MAX_ROWS_PER_FLOW_FILE, "9");
    Integer maxFragments = 3;
    runner.setProperty(SelectHiveQL.MAX_FRAGMENTS, maxFragments.toString());
    runner.run();
    runner.replacedertAllFlowFilesTransferred(SelectHiveQL.REL_SUCCESS, maxFragments);
    for (int i = 0; i < maxFragments; i++) {
        mff = runner.getFlowFilesForRelationship(SelectHiveQL.REL_SUCCESS).get(i);
        in = new ByteArrayInputStream(mff.toByteArray());
        replacedertEquals(9, getNumberOfRecordsFromStream(in));
        mff.replacedertAttributeExists("fragment.identifier");
        replacedertEquals(Integer.toString(i), mff.getAttribute("fragment.index"));
        replacedertEquals(maxFragments.toString(), mff.getAttribute("fragment.count"));
    }
    runner.clearTransferState();
}

19 View Complete Implementation : TestGetHBase.java
Copyright Apache License 2.0
Author : apache
@Test
public void testInitialTimeCurrentTime() {
    runner.setProperty(GetHBase.INITIAL_TIMERANGE, GetHBase.CURRENT_TIME);
    final long now = System.currentTimeMillis();
    final Map<String, String> cells = new HashMap<>();
    cells.put("greeting", "hello");
    cells.put("name", "nifi");
    hBaseClient.addResult("row0", cells, now - 4000);
    hBaseClient.addResult("row1", cells, now - 3000);
    hBaseClient.addResult("row2", cells, now - 2000);
    hBaseClient.addResult("row3", cells, now - 1000);
    // should not get any output because the mock results have a time before current time
    runner.run(100);
    runner.replacedertAllFlowFilesTransferred(GetHBase.REL_SUCCESS, 0);
}

19 View Complete Implementation : ITFetchS3Object.java
Copyright Apache License 2.0
Author : apache
@Test
public void testSimpleGet() throws IOException {
    putTestFile("test-file", getFileFromResourceName(SAMPLE_FILE_RESOURCE_NAME));
    final TestRunner runner = TestRunners.newTestRunner(new FetchS3Object());
    runner.setProperty(FetchS3Object.CREDENTIALS_FILE, CREDENTIALS_FILE);
    runner.setProperty(FetchS3Object.REGION, REGION);
    runner.setProperty(FetchS3Object.BUCKET, BUCKET_NAME);
    final Map<String, String> attrs = new HashMap<>();
    attrs.put("filename", "test-file");
    runner.enqueue(new byte[0], attrs);
    runner.run(1);
    runner.replacedertAllFlowFilesTransferred(FetchS3Object.REL_SUCCESS, 1);
    final List<MockFlowFile> ffs = runner.getFlowFilesForRelationship(FetchS3Object.REL_SUCCESS);
    MockFlowFile ff = ffs.get(0);
    ff.replacedertAttributeNotExists(PutS3Object.S3_SSE_ALGORITHM);
    ff.replacedertContentEquals(getFileFromResourceName(SAMPLE_FILE_RESOURCE_NAME));
}

19 View Complete Implementation : PutGCSObjectTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void testAclAttributeDomain() throws Exception {
    reset(storage, blob);
    final PutGCSObject processor = getProcessor();
    final TestRunner runner = buildNewRunner(processor);
    addRequiredPropertiesToRunner(runner);
    runner.replacedertValid();
    when(storage.create(any(BlobInfo.clreplaced), any(InputStream.clreplaced), any(Storage.BlobWriteOption.clreplaced))).thenReturn(blob);
    final Acl.Domain mockDomain = mock(Acl.Domain.clreplaced);
    when(mockDomain.getDomain()).thenReturn(OWNER_DOMAIN);
    when(blob.getOwner()).thenReturn(mockDomain);
    runner.enqueue("test");
    runner.run();
    runner.replacedertAllFlowFilesTransferred(PutGCSObject.REL_SUCCESS);
    runner.replacedertTransferCount(PutGCSObject.REL_SUCCESS, 1);
    final MockFlowFile mockFlowFile = runner.getFlowFilesForRelationship(PutGCSObject.REL_SUCCESS).get(0);
    mockFlowFile.replacedertAttributeEquals(OWNER_ATTR, OWNER_DOMAIN);
    mockFlowFile.replacedertAttributeEquals(OWNER_TYPE_ATTR, "domain");
}