You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ij...@apache.org on 2019/07/19 04:49:36 UTC

[nifi] branch master updated: NIFI-6334 - fix custom validate error in PutBigqueryBatch

This is an automated email from the ASF dual-hosted git repository.

ijokarumawak pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/master by this push:
     new 630c651  NIFI-6334 - fix custom validate error in PutBigqueryBatch
630c651 is described below

commit 630c651226228ab2ed990d679b7588b93303682e
Author: Pierre Villard <pi...@gmail.com>
AuthorDate: Thu Jul 18 15:48:39 2019 +0200

    NIFI-6334 - fix custom validate error in PutBigqueryBatch
    
    This closes #3589.
    
    Signed-off-by: Koji Kawamura <ij...@apache.org>
---
 .../processors/gcp/bigquery/AbstractBigQueryProcessor.java    |  3 ++-
 .../nifi/processors/gcp/bigquery/PutBigQueryBatchTest.java    | 11 ++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/bigquery/AbstractBigQueryProcessor.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/bigquery/AbstractBigQueryProcessor.java
index c249e7e..3751060 100644
--- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/bigquery/AbstractBigQueryProcessor.java
+++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/bigquery/AbstractBigQueryProcessor.java
@@ -35,6 +35,7 @@ import org.apache.nifi.processors.gcp.ProxyAwareTransportFactory;
 import org.apache.nifi.proxy.ProxyConfiguration;
 import org.apache.nifi.util.StringUtils;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -135,7 +136,7 @@ public abstract class AbstractBigQueryProcessor extends AbstractGCPProcessor<Big
 
     @Override
     protected final Collection<ValidationResult> customValidate(ValidationContext validationContext) {
-        final Collection<ValidationResult> results = super.customValidate(validationContext);
+        final Collection<ValidationResult> results = new ArrayList<ValidationResult>(super.customValidate(validationContext));
         ProxyConfiguration.validateProxySpec(validationContext, results, ProxyAwareTransportFactory.PROXY_SPECS);
 
         final boolean projectId = validationContext.getProperty(PROJECT_ID).isSet();
diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/PutBigQueryBatchTest.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/PutBigQueryBatchTest.java
index 7ec5aa9..c4063b3 100644
--- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/PutBigQueryBatchTest.java
+++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/PutBigQueryBatchTest.java
@@ -125,7 +125,6 @@ public class PutBigQueryBatchTest extends AbstractBQTest {
         runner.assertAllFlowFilesTransferred(PutBigQueryBatch.REL_SUCCESS);
     }
 
-
     @Test
     public void testFailedLoad() throws Exception {
         when(table.exists()).thenReturn(Boolean.TRUE);
@@ -150,4 +149,14 @@ public class PutBigQueryBatchTest extends AbstractBQTest {
 
         runner.assertAllFlowFilesTransferred(PutBigQueryBatch.REL_FAILURE);
     }
+
+    @Test
+    public void testMandatoryProjectId() throws Exception {
+        final TestRunner runner = buildNewRunner(getProcessor());
+        addRequiredPropertiesToRunner(runner);
+        runner.assertValid();
+
+        runner.removeProperty(PutBigQueryBatch.PROJECT_ID);
+        runner.assertNotValid();
+    }
 }
\ No newline at end of file