You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/08/26 23:16:44 UTC

[GitHub] [nifi] MikeThomsen opened a new pull request #5350: NIFI-9085 through NIFI-9095 (JUnit refactor of multiple modules)

MikeThomsen opened a new pull request #5350:
URL: https://github.com/apache/nifi/pull/5350


   <!--
     Licensed to the Apache Software Foundation (ASF) under one or more
     contributor license agreements.  See the NOTICE file distributed with
     this work for additional information regarding copyright ownership.
     The ASF licenses this file to You under the Apache License, Version 2.0
     (the "License"); you may not use this file except in compliance with
     the License.  You may obtain a copy of the License at
         http://www.apache.org/licenses/LICENSE-2.0
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
   -->
   Thank you for submitting a contribution to Apache NiFi.
   
   Please provide a short description of the PR here:
   
   #### Description of PR
   
   _Enables X functionality; fixes bug NIFI-YYYY._
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [ ] Is there a JIRA ticket associated with this PR? Is it referenced 
        in the commit message?
   
   - [ ] Does your PR title start with **NIFI-XXXX** where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
   
   - [ ] Has your PR been rebased against the latest commit within the target branch (typically `main`)?
   
   - [ ] Is your initial contribution a single, squashed commit? _Additional commits in response to PR reviewer feedback should be made on this branch and pushed to allow change tracking. Do not `squash` or use `--force` when pushing to allow for clean monitoring of changes._
   
   ### For code changes:
   - [ ] Have you ensured that the full suite of tests is executed via `mvn -Pcontrib-check clean install` at the root `nifi` folder?
   - [ ] Have you written or updated unit tests to verify your changes?
   - [ ] Have you verified that the full build is successful on JDK 8?
   - [ ] Have you verified that the full build is successful on JDK 11?
   - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
   - [ ] If applicable, have you updated the `LICENSE` file, including the main `LICENSE` file under `nifi-assembly`?
   - [ ] If applicable, have you updated the `NOTICE` file, including the main `NOTICE` file found under `nifi-assembly`?
   - [ ] If adding new Properties, have you added `.displayName` in addition to .name (programmatic access) for each of the new properties?
   
   ### For documentation related changes:
   - [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
   
   ### Note:
   Please ensure that once the PR is submitted, you check GitHub Actions CI for build issues and submit an update to your PR as soon as possible.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] exceptionfactory commented on a change in pull request #5350: NIFI-9085 through NIFI-9095 (JUnit refactor of multiple modules)

Posted by GitBox <gi...@apache.org>.
exceptionfactory commented on a change in pull request #5350:
URL: https://github.com/apache/nifi/pull/5350#discussion_r749350885



##########
File path: nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-processors/src/test/java/org/apache/nifi/processors/elasticsearch/ITPutElasticsearch.java
##########
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.elasticsearch;
+
+import org.apache.nifi.util.TestRunner;
+import org.apache.nifi.util.TestRunners;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.io.InputStream;
+import java.util.HashMap;
+
+public class ITPutElasticsearch {
+    private InputStream docExample;
+
+    @BeforeEach
+    public void setUp() {
+        ClassLoader classloader = Thread.currentThread().getContextClassLoader();
+        docExample = classloader.getResourceAsStream("DocumentExample.json");
+    }
+
+    /**
+     * Tests basic ES functionality against a local or test ES cluster
+     */
+    @Test
+    public void testPutElasticSearchBasic() {
+        System.out.println("Starting test " + new Object() {
+        }.getClass().getEnclosingMethod().getName());
+        final TestRunner runner = TestRunners.newTestRunner(new PutElasticsearch());
+
+        //Local Cluster - Mac pulled from brew
+        runner.setProperty(AbstractElasticsearchTransportClientProcessor.CLUSTER_NAME, "elasticsearch_brew");
+        runner.setProperty(AbstractElasticsearchTransportClientProcessor.HOSTS, "127.0.0.1:9300");
+        runner.setProperty(AbstractElasticsearchTransportClientProcessor.PING_TIMEOUT, "5s");
+        runner.setProperty(AbstractElasticsearchTransportClientProcessor.SAMPLER_INTERVAL, "5s");
+
+        runner.setProperty(PutElasticsearch.INDEX, "doc");
+        runner.setProperty(PutElasticsearch.BATCH_SIZE, "1");
+
+        runner.setProperty(PutElasticsearch.TYPE, "status");
+        runner.setProperty(PutElasticsearch.ID_ATTRIBUTE, "doc_id");
+        runner.assertValid();
+
+        runner.enqueue(docExample, new HashMap<String, String>() {{
+            put("doc_id", "28039652140");
+        }});
+
+
+        runner.enqueue(docExample);
+        runner.run(1, true, true);
+
+        runner.assertAllFlowFilesTransferred(PutElasticsearch.REL_SUCCESS, 1);
+    }
+
+    @Test
+    public void testPutElasticSearchBatch() {
+        System.out.println("Starting test " + new Object() {
+        }.getClass().getEnclosingMethod().getName());

Review comment:
       System.out.println() usage should be removed

##########
File path: nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-processors/src/test/java/org/apache/nifi/processors/elasticsearch/ITPutElasticsearchHttp.java
##########
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.elasticsearch;
+
+import org.apache.nifi.util.TestRunner;
+import org.apache.nifi.util.TestRunners;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.io.InputStream;
+import java.util.HashMap;
+
+public class ITPutElasticsearchHttp {
+    private InputStream docExample;
+
+    @BeforeEach
+    public void setUp() {
+        ClassLoader classloader = Thread.currentThread().getContextClassLoader();
+        docExample = classloader.getResourceAsStream("DocumentExample.json");
+    }
+
+    /**
+     * Tests basic ES functionality against a local or test ES cluster
+     */
+    @Test
+    public void testPutElasticSearchBasic() {
+        System.out.println("Starting test " + new Object() {
+        }.getClass().getEnclosingMethod().getName());

Review comment:
       System.out.println() usage should be removed

##########
File path: nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-processors/src/test/java/org/apache/nifi/processors/elasticsearch/ITQueryElasticsearchHttp.java
##########
@@ -89,4 +88,53 @@ public void testFetchElasticsearchOnTrigger_IncomingFile() throws IOException {
                 QueryElasticsearchHttp.REL_SUCCESS).get(0);
         assertNotNull(out);
     }
+
+    @Test
+    public void testQueryElasticsearchBasicBehindProxy() {
+        System.out.println("Starting test " + new Object() {
+        }.getClass().getEnclosingMethod().getName());

Review comment:
       System.out.println() usage should be removed




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] exceptionfactory commented on pull request #5350: NIFI-9085 through NIFI-9095 (JUnit refactor of multiple modules)

Posted by GitBox <gi...@apache.org>.
exceptionfactory commented on pull request #5350:
URL: https://github.com/apache/nifi/pull/5350#issuecomment-924510029


   Thanks for the updates on this PR @MikeThomsen. This covers a lot a large number of modules, so it will take some time work through. I noticed the creation of some new integration tests, which makes sense given the existing annotations.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] MikeThomsen commented on pull request #5350: NIFI-9085 through NIFI-9095 (JUnit refactor of multiple modules)

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on pull request #5350:
URL: https://github.com/apache/nifi/pull/5350#issuecomment-918372708


   @exceptionfactory all of the changes should be in now.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] MikeThomsen commented on pull request #5350: NIFI-9085 through NIFI-9095 (JUnit refactor of multiple modules)

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on pull request #5350:
URL: https://github.com/apache/nifi/pull/5350#issuecomment-1061842174


   thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] MikeThomsen commented on pull request #5350: NIFI-9085 through NIFI-9095 (JUnit refactor of multiple modules)

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on pull request #5350:
URL: https://github.com/apache/nifi/pull/5350#issuecomment-933588637


   @exceptionfactory I'll add this to my list to rebase


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] MikeThomsen commented on pull request #5350: NIFI-9085 through NIFI-9095 (JUnit refactor of multiple modules)

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on pull request #5350:
URL: https://github.com/apache/nifi/pull/5350#issuecomment-975687279


   @exceptionfactory should be good to go now


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] exceptionfactory closed pull request #5350: NIFI-9085 through NIFI-9095 (JUnit refactor of multiple modules)

Posted by GitBox <gi...@apache.org>.
exceptionfactory closed pull request #5350:
URL: https://github.com/apache/nifi/pull/5350


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] MikeThomsen commented on pull request #5350: NIFI-9085 through NIFI-9095 (JUnit refactor of multiple modules)

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on pull request #5350:
URL: https://github.com/apache/nifi/pull/5350#issuecomment-1054264281


   @exceptionfactory this one should be ready to review as well.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] MikeThomsen commented on pull request #5350: NIFI-9085 through NIFI-9095 (JUnit refactor of multiple modules)

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on pull request #5350:
URL: https://github.com/apache/nifi/pull/5350#issuecomment-944982216


   @exceptionfactory rebased.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] MikeThomsen commented on pull request #5350: NIFI-9085 through NIFI-9095 (JUnit refactor of multiple modules)

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on pull request #5350:
URL: https://github.com/apache/nifi/pull/5350#issuecomment-920970876


   @exceptionfactory should be ready now


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] exceptionfactory commented on a change in pull request #5350: NIFI-9085 through NIFI-9095 (JUnit refactor of multiple modules)

Posted by GitBox <gi...@apache.org>.
exceptionfactory commented on a change in pull request #5350:
URL: https://github.com/apache/nifi/pull/5350#discussion_r707659758



##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/kinesis/stream/record/TestKinesisRecordProcessorRecord.java
##########
@@ -236,7 +236,7 @@ public void testProcessPoisonPillRecordButNoRawOutputWithCheckpoint() throws Shu
         session.assertTransferCount(ConsumeKinesisStream.REL_PARSE_FAILURE, 0);
 
         // check the "poison pill" record was retried a 2nd time
-        assertNull(verify(kinesisRecord, times(2)).getData());
+        Assertions.assertNull(verify(kinesisRecord, times(2)).getData());

Review comment:
       Change to use static imports.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/lambda/ITPutLambda.java
##########
@@ -108,22 +105,22 @@ public void testIntegrationClientErrorBadMessageBody() throws Exception {
         runner.assertAllFlowFilesTransferred(PutLambda.REL_FAILURE, 1);
         final List<MockFlowFile> ffs = runner.getFlowFilesForRelationship(PutLambda.REL_FAILURE);
         final MockFlowFile out = ffs.iterator().next();
-        assertNull("Function error should be null since there is exception"
-            + out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR), out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR));
-        assertNull("log should not be null", out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_LOG));
-        assertEquals("Status should be equal", null,out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_STATUS_CODE));
-        assertEquals("exception error code should be equal", "InvalidRequestContentException",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_ERROR_CODE));
-        assertEquals("exception exception error type should be equal", "Client",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_ERROR_TYPE));
-        assertEquals("exception exception error code should be equal", "400",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_STATUS_CODE));
-        assertTrue("exception exception error message should be start with",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_MESSAGE)
-               .startsWith("Could not parse request body into json: Unrecognized token 'badbod': was expecting ('true', 'false' or 'null')"));
+        Assertions.assertNull(out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR), "Function error should be null since there is exception"
+            + out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR));
+        Assertions.assertNull(out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_LOG), "log should not be null");
+        Assertions.assertEquals(null,out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_STATUS_CODE), "Status should be equal");
+        Assertions.assertEquals("InvalidRequestContentException",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_ERROR_CODE), "exception error code should be equal");
+        Assertions.assertEquals("Client",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_ERROR_TYPE), "exception exception error type should be equal");
+        Assertions.assertEquals("400",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_STATUS_CODE), "exception exception error code should be equal");
+        Assertions.assertTrue(out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_MESSAGE)
+               .startsWith("Could not parse request body into json: Unrecognized token 'badbod': was expecting ('true', 'false' or 'null')"), "exception exception error message should be start with");

Review comment:
       Change to use static imports.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/lambda/ITPutLambda.java
##########
@@ -86,16 +83,16 @@ public void testIntegrationSuccess() throws Exception {
 
         final List<MockFlowFile> ffs = runner.getFlowFilesForRelationship(PutLambda.REL_SUCCESS);
         final MockFlowFile out = ffs.iterator().next();
-        assertNull("Function error should be null " + out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR), out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR));
-        assertNotNull("log should not be null", out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_LOG));
-        assertEquals("Status should be equal", "200",out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_STATUS_CODE));
+        Assertions.assertNull(out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR), "Function error should be null " + out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR));
+        Assertions.assertNotNull(out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_LOG), "log should not be null");
+        Assertions.assertEquals("200",out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_STATUS_CODE), "Status should be equal");

Review comment:
       Change to use static imports.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/kinesis/stream/record/TestKinesisRecordProcessorRaw.java
##########
@@ -208,10 +208,10 @@ public void testProcessPoisonPillRecordWithCheckpoint() throws ShutdownException
         assertFlowFile(flowFiles.get(1), null, "partition-3", "3", "record-3");
 
         // check the "poison pill" record was retried a 2nd time
-        assertNull(verify(kinesisRecord, times(2)).getPartitionKey());
-        assertNull(verify(kinesisRecord, times(2)).getSequenceNumber());
-        assertNull(verify(kinesisRecord, times(2)).getApproximateArrivalTimestamp());
-        assertNull(verify(kinesisRecord, times(2)).getData());
+        Assertions.assertNull(verify(kinesisRecord, times(2)).getPartitionKey());
+        Assertions.assertNull(verify(kinesisRecord, times(2)).getSequenceNumber());
+        Assertions.assertNull(verify(kinesisRecord, times(2)).getApproximateArrivalTimestamp());
+        Assertions.assertNull(verify(kinesisRecord, times(2)).getData());

Review comment:
       This should be changed to use static imports.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/lambda/ITPutLambda.java
##########
@@ -86,16 +83,16 @@ public void testIntegrationSuccess() throws Exception {
 
         final List<MockFlowFile> ffs = runner.getFlowFilesForRelationship(PutLambda.REL_SUCCESS);
         final MockFlowFile out = ffs.iterator().next();
-        assertNull("Function error should be null " + out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR), out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR));
-        assertNotNull("log should not be null", out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_LOG));
-        assertEquals("Status should be equal", "200",out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_STATUS_CODE));
+        Assertions.assertNull(out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR), "Function error should be null " + out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR));
+        Assertions.assertNotNull(out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_LOG), "log should not be null");
+        Assertions.assertEquals("200",out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_STATUS_CODE), "Status should be equal");
     }
 
     /**
      * Comment out ignore for integration tests (requires creds files)
      */
     @Test
-    @Ignore
+    @Disabled

Review comment:
       Annotation can be removed from integration test class.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/lambda/ITPutLambda.java
##########
@@ -136,10 +133,10 @@ public void testIntegrationFailedBadStreamName() throws Exception {
         runner.assertAllFlowFilesTransferred(PutLambda.REL_FAILURE, 1);
         final List<MockFlowFile> ffs = runner.getFlowFilesForRelationship(PutLambda.REL_FAILURE);
         final MockFlowFile out = ffs.iterator().next();
-        assertNull("Function error should be null since there is exception"
-            + out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR), out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR));
-        assertNull("log should not be null", out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_LOG));
-        assertEquals("Status should be equal", null,out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_STATUS_CODE));
+        Assertions.assertNull(out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR), "Function error should be null since there is exception"
+            + out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR));
+        Assertions.assertNull(out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_LOG), "log should not be null");
+        Assertions.assertEquals(null,out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_STATUS_CODE), "Status should be equal");

Review comment:
       Replace with static imports.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/lambda/TestPutLambda.java
##########
@@ -91,7 +87,7 @@ public void testPutLambdaSimple() {
         ArgumentCaptor<InvokeRequest> captureRequest = ArgumentCaptor.forClass(InvokeRequest.class);
         Mockito.verify(mockLambdaClient, Mockito.times(1)).invoke(captureRequest.capture());
         InvokeRequest request = captureRequest.getValue();
-        assertEquals("test-function", request.getFunctionName());
+        Assertions.assertEquals("test-function", request.getFunctionName());

Review comment:
       Replace with static imports.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/lambda/ITPutLambda.java
##########
@@ -72,7 +69,7 @@ public void testSizeGreaterThan6MB() throws Exception {
      * Comment out ignore for integration tests (requires creds files)
      */
     @Test
-    @Ignore
+    @Disabled

Review comment:
       This annotation can be removed since this is an integration test class.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/lambda/ITPutLambda.java
##########
@@ -108,22 +105,22 @@ public void testIntegrationClientErrorBadMessageBody() throws Exception {
         runner.assertAllFlowFilesTransferred(PutLambda.REL_FAILURE, 1);
         final List<MockFlowFile> ffs = runner.getFlowFilesForRelationship(PutLambda.REL_FAILURE);
         final MockFlowFile out = ffs.iterator().next();
-        assertNull("Function error should be null since there is exception"
-            + out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR), out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR));
-        assertNull("log should not be null", out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_LOG));
-        assertEquals("Status should be equal", null,out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_STATUS_CODE));
-        assertEquals("exception error code should be equal", "InvalidRequestContentException",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_ERROR_CODE));
-        assertEquals("exception exception error type should be equal", "Client",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_ERROR_TYPE));
-        assertEquals("exception exception error code should be equal", "400",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_STATUS_CODE));
-        assertTrue("exception exception error message should be start with",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_MESSAGE)
-               .startsWith("Could not parse request body into json: Unrecognized token 'badbod': was expecting ('true', 'false' or 'null')"));
+        Assertions.assertNull(out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR), "Function error should be null since there is exception"
+            + out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR));
+        Assertions.assertNull(out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_LOG), "log should not be null");
+        Assertions.assertEquals(null,out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_STATUS_CODE), "Status should be equal");
+        Assertions.assertEquals("InvalidRequestContentException",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_ERROR_CODE), "exception error code should be equal");
+        Assertions.assertEquals("Client",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_ERROR_TYPE), "exception exception error type should be equal");
+        Assertions.assertEquals("400",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_STATUS_CODE), "exception exception error code should be equal");
+        Assertions.assertTrue(out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_MESSAGE)
+               .startsWith("Could not parse request body into json: Unrecognized token 'badbod': was expecting ('true', 'false' or 'null')"), "exception exception error message should be start with");
     }
 
     /**
      * Comment out ignore for integration tests (requires creds files)
      */
     @Test
-    @Ignore
+    @Disabled

Review comment:
       Annotation can be removed from integration test class.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/lambda/TestPutLambda.java
##########
@@ -125,7 +121,7 @@ public void testPutLambdaTooManyRequestsException() {
         runner.assertAllFlowFilesTransferred(PutLambda.REL_FAILURE, 1);
         final List<MockFlowFile> flowFiles = runner.getFlowFilesForRelationship(PutLambda.REL_FAILURE);
         final MockFlowFile ff0 = flowFiles.get(0);
-        assertTrue(ff0.isPenalized());
+        Assertions.assertTrue(ff0.isPenalized());

Review comment:
       Replace with static imports.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/AbstractS3IT.java
##########
@@ -185,7 +185,7 @@ protected Path getResourcePath(String resourceName) {
         try {
             path = Paths.get(getClass().getResource(resourceName).toURI());
         } catch (URISyntaxException e) {
-           Assert.fail("Resource: " + resourceName + " does not exist" + e.getLocalizedMessage());
+           Assertions.fail("Resource: " + resourceName + " does not exist" + e.getLocalizedMessage());

Review comment:
       Replace with static imports.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/AbstractS3IT.java
##########
@@ -146,7 +146,7 @@ public static void oneTimeTearDown() {
         }
 
         if (client.doesBucketExist(BUCKET_NAME)) {
-            Assert.fail("Incomplete teardown, subsequent tests might fail");
+            Assertions.fail("Incomplete teardown, subsequent tests might fail");

Review comment:
       Replace with static imports.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/AbstractS3IT.java
##########
@@ -196,7 +196,7 @@ protected File getFileFromResourceName(String resourceName) {
         try {
             uri = this.getClass().getResource(resourceName).toURI();
         } catch (URISyntaxException e) {
-            Assert.fail("Cannot proceed without File : " + resourceName);
+            Assertions.fail("Cannot proceed without File : " + resourceName);

Review comment:
       Replace with static imports.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/kinesis/stream/record/TestKinesisRecordProcessorRecord.java
##########
@@ -294,10 +294,10 @@ public void testProcessUnparsableRecordWithRawOutputWithCheckpoint() throws Shut
         failureFlowFiles.get(0).assertAttributeExists("record.error.message");
 
         // check the invalid json record was *not* retried a 2nd time
-        assertNull(verify(kinesisRecord, times(1)).getPartitionKey());
-        assertNull(verify(kinesisRecord, times(1)).getSequenceNumber());
-        assertNull(verify(kinesisRecord, times(1)).getApproximateArrivalTimestamp());
-        assertNull(verify(kinesisRecord, times(2)).getData());
+        Assertions.assertNull(verify(kinesisRecord, times(1)).getPartitionKey());
+        Assertions.assertNull(verify(kinesisRecord, times(1)).getSequenceNumber());
+        Assertions.assertNull(verify(kinesisRecord, times(1)).getApproximateArrivalTimestamp());
+        Assertions.assertNull(verify(kinesisRecord, times(2)).getData());

Review comment:
       Change to use static imports.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/ITPutS3Object.java
##########
@@ -115,7 +114,7 @@ public static void teardownClass() {
     public void testSimplePut() throws IOException {
         TestRunner runner = initTestRunner();
 
-        Assert.assertTrue(runner.setProperty("x-custom-prop", "hello").isValid());
+        Assertions.assertTrue(runner.setProperty("x-custom-prop", "hello").isValid());

Review comment:
       Replace with static imports throughout this class.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] MikeThomsen commented on pull request #5350: NIFI-9085 through NIFI-9095 (JUnit refactor of multiple modules)

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on pull request #5350:
URL: https://github.com/apache/nifi/pull/5350#issuecomment-919074592


   @exceptionfactory good catches. I'll clear them out. I think when I was going through the other PRs more thoroughly this is one I forgot to hit.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org