You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by jo...@apache.org on 2014/12/16 16:57:21 UTC

[1/9] incubator-nifi git commit: NIFI-56: Made test single-threaded

Repository: incubator-nifi
Updated Branches:
  refs/heads/NIFI-169 614349bdf -> 8fb78d2a5


NIFI-56: Made test single-threaded


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/73cc6cbe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/73cc6cbe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/73cc6cbe

Branch: refs/heads/NIFI-169
Commit: 73cc6cbe284faab9a91b4816197a105524b1df41
Parents: 9ccbf8b
Author: Mark Payne <ma...@hotmail.com>
Authored: Mon Dec 15 13:09:08 2014 -0500
Committer: Mark Payne <ma...@hotmail.com>
Committed: Mon Dec 15 13:09:08 2014 -0500

----------------------------------------------------------------------
 .../java/org/apache/nifi/processors/standard/TestScanContent.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/73cc6cbe/nar-bundles/standard-bundle/standard-processors/src/test/java/org/apache/nifi/processors/standard/TestScanContent.java
----------------------------------------------------------------------
diff --git a/nar-bundles/standard-bundle/standard-processors/src/test/java/org/apache/nifi/processors/standard/TestScanContent.java b/nar-bundles/standard-bundle/standard-processors/src/test/java/org/apache/nifi/processors/standard/TestScanContent.java
index 499fb3e..9079f82 100644
--- a/nar-bundles/standard-bundle/standard-processors/src/test/java/org/apache/nifi/processors/standard/TestScanContent.java
+++ b/nar-bundles/standard-bundle/standard-processors/src/test/java/org/apache/nifi/processors/standard/TestScanContent.java
@@ -55,7 +55,7 @@ public class TestScanContent {
             Files.write(dictionaryPath, termBytes, StandardOpenOption.CREATE, StandardOpenOption.WRITE);
 
             final TestRunner runner = TestRunners.newTestRunner(new ScanContent());
-            runner.setThreadCount(3);
+            runner.setThreadCount(1);
             runner.setProperty(ScanContent.DICTIONARY, dictionaryPath.toString());
             runner.setProperty(ScanContent.DICTIONARY_ENCODING, ScanContent.BINARY_ENCODING);
 


[7/9] incubator-nifi git commit: NIFI-35: Provide an EventReporter to the FlowFileSwapManager and provide events for any errors

Posted by jo...@apache.org.
NIFI-35: Provide an EventReporter to the FlowFileSwapManager and provide events for any errors


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/1cc3ce57
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/1cc3ce57
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/1cc3ce57

Branch: refs/heads/NIFI-169
Commit: 1cc3ce57556eb7cf9a5f94b269eb24b284e518eb
Parents: 9e60aa0
Author: Mark Payne <ma...@hotmail.com>
Authored: Mon Dec 15 14:28:11 2014 -0500
Committer: Mark Payne <ma...@hotmail.com>
Committed: Mon Dec 15 14:28:11 2014 -0500

----------------------------------------------------------------------
 .../nifi/controller/FileSystemSwapManager.java  | 33 +++++++++++++++-----
 .../apache/nifi/controller/FlowController.java  | 20 +++++++-----
 .../repository/FlowFileSwapManager.java         |  5 ++-
 3 files changed, 41 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/1cc3ce57/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/FileSystemSwapManager.java
----------------------------------------------------------------------
diff --git a/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/FileSystemSwapManager.java b/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/FileSystemSwapManager.java
index 3af2098..ad95f8e 100644
--- a/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/FileSystemSwapManager.java
+++ b/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/FileSystemSwapManager.java
@@ -61,11 +61,12 @@ import org.apache.nifi.controller.repository.StandardFlowFileRecord;
 import org.apache.nifi.controller.repository.claim.ContentClaim;
 import org.apache.nifi.controller.repository.claim.ContentClaimManager;
 import org.apache.nifi.engine.FlowEngine;
+import org.apache.nifi.events.EventReporter;
 import org.apache.nifi.io.BufferedOutputStream;
 import org.apache.nifi.processor.QueueSize;
+import org.apache.nifi.reporting.Severity;
 import org.apache.nifi.util.FormatUtils;
 import org.apache.nifi.util.NiFiProperties;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -80,10 +81,12 @@ public class FileSystemSwapManager implements FlowFileSwapManager {
     public static final int MINIMUM_SWAP_COUNT = 10000;
     private static final Pattern SWAP_FILE_PATTERN = Pattern.compile("\\d+-.+\\.swap");
     public static final int SWAP_ENCODING_VERSION = 6;
+    public static final String EVENT_CATEGORY = "Swap FlowFiles";
 
     private final ScheduledExecutorService swapQueueIdentifierExecutor;
     private final ScheduledExecutorService swapInExecutor;
     private volatile FlowFileRepository flowFileRepository;
+    private volatile EventReporter eventReporter;
 
     // Maintains a mapping of FlowFile Queue to the a QueueLockWrapper, which provides queue locking and necessary state for swapping back in
     private final ConcurrentMap<FlowFileQueue, QueueLockWrapper> swapMap = new ConcurrentHashMap<>();
@@ -129,9 +132,10 @@ public class FileSystemSwapManager implements FlowFileSwapManager {
         }
     }
 
-    public synchronized void start(final FlowFileRepository flowFileRepository, final QueueProvider connectionProvider, final ContentClaimManager claimManager) {
+    public synchronized void start(final FlowFileRepository flowFileRepository, final QueueProvider connectionProvider, final ContentClaimManager claimManager, final EventReporter eventReporter) {
         this.claimManager = claimManager;
         this.flowFileRepository = flowFileRepository;
+        this.eventReporter = eventReporter;
         swapQueueIdentifierExecutor.scheduleWithFixedDelay(new QueueIdentifier(connectionProvider), swapOutMillis, swapOutMillis, TimeUnit.MILLISECONDS);
         swapInExecutor.scheduleWithFixedDelay(new SwapInTask(), swapInMillis, swapInMillis, TimeUnit.MILLISECONDS);
     }
@@ -437,10 +441,15 @@ public class FileSystemSwapManager implements FlowFileSwapManager {
                                 }
 
                                 if (!swapFile.delete()) {
-                                    logger.warn("Swapped in FlowFiles from file " + swapFile.getAbsolutePath() + " but failed to delete the file; this file can be cleaned up manually");
+                                    final String errMsg = "Swapped in FlowFiles from file " + swapFile.getAbsolutePath() + " but failed to delete the file; this file should be cleaned up manually";
+                                    logger.warn(errMsg);
+                                    eventReporter.reportEvent(Severity.WARNING, EVENT_CATEGORY, errMsg);
                                 }
                             } catch (final Exception e) {
-                                logger.error("Failed to Swap In FlowFiles for {} due to {}", new Object[]{flowFileQueue, e.toString()}, e);
+                                final String errMsg = "Failed to Swap In FlowFiles for " + flowFileQueue + " due to " + e;
+                                logger.error(errMsg);
+                                eventReporter.reportEvent(Severity.ERROR, EVENT_CATEGORY, errMsg);
+                                
                                 if (swapFile != null) {
                                     queue.add(swapFile);
                                 }
@@ -488,7 +497,9 @@ public class FileSystemSwapManager implements FlowFileSwapManager {
                     } catch (final IOException ioe) {
                         recordsSwapped = 0;
                         flowFileQueue.putSwappedRecords(toSwap);
-                        logger.error("Failed to swap out {} FlowFiles from {} to Swap File {} due to {}", new Object[]{toSwap.size(), flowFileQueue, swapLocation, ioe.toString()}, ioe);
+                        final String errMsg = "Failed to swap out " + toSwap.size() + " FlowFiles from " + flowFileQueue + " to Swap File " + swapLocation + " due to " + ioe;
+                        logger.error(errMsg);
+                        eventReporter.reportEvent(Severity.ERROR, EVENT_CATEGORY, errMsg);
                     }
 
                     if (recordsSwapped > 0) {
@@ -549,14 +560,18 @@ public class FileSystemSwapManager implements FlowFileSwapManager {
 
                 final int swapEncodingVersion = in.readInt();
                 if (swapEncodingVersion > SWAP_ENCODING_VERSION) {
-                    throw new IOException("Cannot swap FlowFiles in from " + swapFile + " because the encoding version is "
-                            + swapEncodingVersion + ", which is too new (expecting " + SWAP_ENCODING_VERSION + " or less)");
+                    final String errMsg = "Cannot swap FlowFiles in from " + swapFile + " because the encoding version is "
+                            + swapEncodingVersion + ", which is too new (expecting " + SWAP_ENCODING_VERSION + " or less)";
+
+                    eventReporter.reportEvent(Severity.ERROR, EVENT_CATEGORY, errMsg);
+                    throw new IOException(errMsg);
                 }
 
                 final String connectionId = in.readUTF();
                 final FlowFileQueue queue = queueMap.get(connectionId);
                 if (queue == null) {
                     logger.error("Cannot recover Swapped FlowFiles from Swap File {} because the FlowFiles belong to a Connection with ID {} and that Connection does not exist", swapFile, connectionId);
+                    eventReporter.reportEvent(Severity.ERROR, EVENT_CATEGORY, "Cannot recover Swapped FlowFiles from Swap File " + swapFile + " because the FlowFiles belong to a Connection with ID " + connectionId + " and that Connection does not exist");
                     continue;
                 }
 
@@ -579,7 +594,9 @@ public class FileSystemSwapManager implements FlowFileSwapManager {
                     maxRecoveredId = maxId;
                 }
             } catch (final IOException ioe) {
-                logger.error("Cannot recover Swapped FlowFiles from Swap File {} due to {}", swapFile, ioe.toString());
+                final String errMsg = "Cannot recover Swapped FlowFiles from Swap File " + swapFile + " due to " + ioe;
+                logger.error(errMsg);
+                eventReporter.reportEvent(Severity.ERROR, EVENT_CATEGORY, errMsg);
                 if (logger.isDebugEnabled()) {
                     logger.error("", ioe);
                 }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/1cc3ce57/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/FlowController.java
----------------------------------------------------------------------
diff --git a/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/FlowController.java b/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/FlowController.java
index e1abe4e..545017a 100644
--- a/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/FlowController.java
+++ b/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/FlowController.java
@@ -388,13 +388,7 @@ public class FlowController implements EventAccess, ControllerServiceProvider, H
 
         try {
             this.provenanceEventRepository = createProvenanceRepository(properties);
-            this.provenanceEventRepository.initialize(new EventReporter() {
-                @Override
-                public void reportEvent(final Severity severity, final String category, final String message) {
-                    final Bulletin bulletin = BulletinFactory.createBulletin(category, severity.name(), message);
-                    bulletinRepository.addBulletin(bulletin);
-                }
-            });
+            this.provenanceEventRepository.initialize(createEventReporter(bulletinRepository));
 
             this.contentRepository = createContentRepository(properties);
         } catch (final Exception e) {
@@ -516,6 +510,16 @@ public class FlowController implements EventAccess, ControllerServiceProvider, H
         }
     }
 
+    private static EventReporter createEventReporter(final BulletinRepository bulletinRepository) {
+        return new EventReporter() {
+            @Override
+            public void reportEvent(final Severity severity, final String category, final String message) {
+                final Bulletin bulletin = BulletinFactory.createBulletin(category, severity.name(), message);
+                bulletinRepository.addBulletin(bulletin);
+            }
+        };
+    }
+    
     public void initializeFlow() throws IOException {
         writeLock.lock();
         try {
@@ -537,7 +541,7 @@ public class FlowController implements EventAccess, ControllerServiceProvider, H
             contentRepository.cleanup();
 
             if (flowFileSwapManager != null) {
-                flowFileSwapManager.start(flowFileRepository, this, contentClaimManager);
+                flowFileSwapManager.start(flowFileRepository, this, contentClaimManager, createEventReporter(bulletinRepository));
             }
 
             if (externalSiteListener != null) {

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/1cc3ce57/nifi-api/src/main/java/org/apache/nifi/controller/repository/FlowFileSwapManager.java
----------------------------------------------------------------------
diff --git a/nifi-api/src/main/java/org/apache/nifi/controller/repository/FlowFileSwapManager.java b/nifi-api/src/main/java/org/apache/nifi/controller/repository/FlowFileSwapManager.java
index 739cb2b..c6daab8 100644
--- a/nifi-api/src/main/java/org/apache/nifi/controller/repository/FlowFileSwapManager.java
+++ b/nifi-api/src/main/java/org/apache/nifi/controller/repository/FlowFileSwapManager.java
@@ -17,6 +17,7 @@
 package org.apache.nifi.controller.repository;
 
 import org.apache.nifi.controller.repository.claim.ContentClaimManager;
+import org.apache.nifi.events.EventReporter;
 
 /**
  * Defines a mechanism by which FlowFiles can be move into external storage or
@@ -34,8 +35,10 @@ public interface FlowFileSwapManager {
      * can be obtained and restored
      * @param claimManager the ContentClaimManager to use for interacting with
      * Content Claims
+     * @param reporter the EventReporter that can be used for notifying users of
+     * important events
      */
-    void start(FlowFileRepository flowFileRepository, QueueProvider queueProvider, ContentClaimManager claimManager);
+    void start(FlowFileRepository flowFileRepository, QueueProvider queueProvider, ContentClaimManager claimManager, EventReporter reporter);
 
     /**
      * Shuts down the manager


[9/9] incubator-nifi git commit: NIFI-173 changed meta-inf/dependencies to meta-inf/bundled-dependencies

Posted by jo...@apache.org.
NIFI-173 changed meta-inf/dependencies to meta-inf/bundled-dependencies


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/8fb78d2a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/8fb78d2a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/8fb78d2a

Branch: refs/heads/NIFI-169
Commit: 8fb78d2a5862c7b147e652c1d69c0ba58b10c226
Parents: 3a4c6ed
Author: joewitt <jo...@apache.org>
Authored: Tue Dec 16 10:38:59 2014 -0500
Committer: joewitt <jo...@apache.org>
Committed: Tue Dec 16 10:38:59 2014 -0500

----------------------------------------------------------------------
 .../src/main/java/org/apache/nifi/nar/NarClassLoader.java | 10 +++++-----
 nar-maven-plugin/src/main/java/nifi/NarMojo.java          |  9 ++++++---
 2 files changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/8fb78d2a/nar-bundles/framework-bundle/framework/nar/src/main/java/org/apache/nifi/nar/NarClassLoader.java
----------------------------------------------------------------------
diff --git a/nar-bundles/framework-bundle/framework/nar/src/main/java/org/apache/nifi/nar/NarClassLoader.java b/nar-bundles/framework-bundle/framework/nar/src/main/java/org/apache/nifi/nar/NarClassLoader.java
index b3b7e7f..946c26e 100644
--- a/nar-bundles/framework-bundle/framework/nar/src/main/java/org/apache/nifi/nar/NarClassLoader.java
+++ b/nar-bundles/framework-bundle/framework/nar/src/main/java/org/apache/nifi/nar/NarClassLoader.java
@@ -50,7 +50,7 @@ import org.slf4j.LoggerFactory;
  *
  * <pre>
  *	+META-INF/
- *	+-- dependencies/
+ *	+-- bundled-dependencies/
  *	    +-- &lt;JAR files&gt;
  *	+-- MANIFEST.MF
  * </pre>
@@ -186,9 +186,9 @@ public class NarClassLoader extends URLClassLoader {
     private void updateClasspath(File root) throws IOException {
         addURL(root.toURI().toURL()); // for compiled classes, META-INF/, etc.
 
-        File dependencies = new File(root, "META-INF/dependencies");
+        File dependencies = new File(root, "META-INF/bundled-dependencies");
         if (!dependencies.isDirectory()) {
-            LOGGER.warn(narWorkingDirectory + " does not contain META-INF/dependencies!");
+            LOGGER.warn(narWorkingDirectory + " does not contain META-INF/bundled-dependencies!");
         }
         addURL(dependencies.toURI().toURL());
         if (dependencies.isDirectory()) {
@@ -200,9 +200,9 @@ public class NarClassLoader extends URLClassLoader {
 
     @Override
     protected String findLibrary(final String libname) {
-        File dependencies = new File(narWorkingDirectory, "META-INF/dependencies");
+        File dependencies = new File(narWorkingDirectory, "META-INF/bundled-dependencies");
         if (!dependencies.isDirectory()) {
-            LOGGER.warn(narWorkingDirectory + " does not contain META-INF/dependencies!");
+            LOGGER.warn(narWorkingDirectory + " does not contain META-INF/bundled-dependencies!");
         }
         
         final File nativeDir = new File(dependencies, "native");

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/8fb78d2a/nar-maven-plugin/src/main/java/nifi/NarMojo.java
----------------------------------------------------------------------
diff --git a/nar-maven-plugin/src/main/java/nifi/NarMojo.java b/nar-maven-plugin/src/main/java/nifi/NarMojo.java
index 5196f73..9b70ec0 100644
--- a/nar-maven-plugin/src/main/java/nifi/NarMojo.java
+++ b/nar-maven-plugin/src/main/java/nifi/NarMojo.java
@@ -290,6 +290,9 @@ public class NarMojo extends AbstractMojo {
      */
     @Parameter(property = "overWriteIfNewer", required = false, defaultValue = "true")
     protected boolean overWriteIfNewer;
+    
+    @Parameter( property = "projectBuildDirectory", required = false, defaultValue = "${project.build.directory}")
+    protected File projectBuildDirectory;
 
     /**
      * Used to look up Artifacts in the remote repository.
@@ -499,12 +502,12 @@ public class NarMojo extends AbstractMojo {
     }
 
     private File getClassesDirectory() {
-        final File outputDirectory = new File(project.getBasedir(), "target");
+        final File outputDirectory = projectBuildDirectory;
         return new File(outputDirectory, "classes");
     }
 
     private File getDependenciesDirectory() {
-        return new File(getClassesDirectory(), "META-INF/dependencies");
+        return new File(getClassesDirectory(), "META-INF/bundled-dependencies");
     }
 
     private void makeNar() throws MojoExecutionException {
@@ -518,7 +521,7 @@ public class NarMojo extends AbstractMojo {
     }
 
     public File createArchive() throws MojoExecutionException {
-        final File outputDirectory = new File(project.getBasedir(), "target");
+        final File outputDirectory = projectBuildDirectory;
         File narFile = getNarFile(outputDirectory, finalName, classifier);
         MavenArchiver archiver = new MavenArchiver();
         archiver.setArchiver(jarArchiver);


[6/9] incubator-nifi git commit: NIFI-49: Included patch from Philip Young to include name of default value when not allowed as a property descriptor value

Posted by jo...@apache.org.
NIFI-49: Included patch from Philip Young to include name of default value when not allowed as a property descriptor value


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/9e60aa0f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/9e60aa0f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/9e60aa0f

Branch: refs/heads/NIFI-169
Commit: 9e60aa0f25754751d468ef9cd3da428055c08b4e
Parents: ddfa621
Author: Mark Payne <ma...@hotmail.com>
Authored: Mon Dec 15 13:53:12 2014 -0500
Committer: Mark Payne <ma...@hotmail.com>
Committed: Mon Dec 15 13:53:12 2014 -0500

----------------------------------------------------------------------
 .../nifi/components/TestPropertyDescriptor.java | 59 ++++++++++++++++++++
 1 file changed, 59 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/9e60aa0f/nifi-api/src/test/java/org/apache/nifi/components/TestPropertyDescriptor.java
----------------------------------------------------------------------
diff --git a/nifi-api/src/test/java/org/apache/nifi/components/TestPropertyDescriptor.java b/nifi-api/src/test/java/org/apache/nifi/components/TestPropertyDescriptor.java
new file mode 100644
index 0000000..82b8111
--- /dev/null
+++ b/nifi-api/src/test/java/org/apache/nifi/components/TestPropertyDescriptor.java
@@ -0,0 +1,59 @@
+/*
+ * 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.components;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.nifi.components.PropertyDescriptor.Builder;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+
+/**
+ * Regression test for issue NIFI-49, to ensure that if a Processor's Property's Default Value is not allowed, 
+ * the Exception thrown should indicate what the default value is
+ */
+public class TestPropertyDescriptor {
+
+    private static Builder invalidDescriptorBuilder;
+    private static Builder validDescriptorBuilder;
+    private static String DEFAULT_VALUE = "Default Value";
+    
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+    
+    @BeforeClass
+    public static void setUp() {
+        validDescriptorBuilder = new PropertyDescriptor.Builder().name("").allowableValues("Allowable Value", "Another Allowable Value").defaultValue("Allowable Value");
+        invalidDescriptorBuilder = new PropertyDescriptor.Builder().name("").allowableValues("Allowable Value", "Another Allowable Value").defaultValue(DEFAULT_VALUE);
+    }
+    
+    @Test
+    public void testExceptionThrownByDescriptorWithInvalidDefaultValue() {
+        thrown.expect(IllegalStateException.class);
+        thrown.expectMessage("["+ DEFAULT_VALUE +"]");
+            
+        invalidDescriptorBuilder.build();
+    }
+    
+    @Test
+    public void testNoExceptionThrownByPropertyDescriptorWithValidDefaultValue() {
+        assertNotNull(validDescriptorBuilder.build());
+    }
+}


[3/9] incubator-nifi git commit: NIFI-49: include name of default value if it is not allowed in a property descriptor

Posted by jo...@apache.org.
NIFI-49: include name of default value if it is not allowed in a property descriptor


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/f0bea5c1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/f0bea5c1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/f0bea5c1

Branch: refs/heads/NIFI-169
Commit: f0bea5c156fa0bfc1d7773ae45ea73ba594ba77a
Parents: e04a55d
Author: Mark Payne <ma...@hotmail.com>
Authored: Mon Dec 15 13:21:59 2014 -0500
Committer: Mark Payne <ma...@hotmail.com>
Committed: Mon Dec 15 13:21:59 2014 -0500

----------------------------------------------------------------------
 .../main/java/org/apache/nifi/components/PropertyDescriptor.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/f0bea5c1/nifi-api/src/main/java/org/apache/nifi/components/PropertyDescriptor.java
----------------------------------------------------------------------
diff --git a/nifi-api/src/main/java/org/apache/nifi/components/PropertyDescriptor.java b/nifi-api/src/main/java/org/apache/nifi/components/PropertyDescriptor.java
index c95d449..19600ab 100644
--- a/nifi-api/src/main/java/org/apache/nifi/components/PropertyDescriptor.java
+++ b/nifi-api/src/main/java/org/apache/nifi/components/PropertyDescriptor.java
@@ -425,7 +425,7 @@ public final class PropertyDescriptor implements Comparable<PropertyDescriptor>
                 throw new IllegalStateException("Must specify a name");
             }
             if (!isValueAllowed(defaultValue)) {
-                throw new IllegalStateException("Default value is not in the set of allowable values");
+                throw new IllegalStateException("Default value '" + defaultValue + "' is not in the set of allowable values");
             }
 
             return new PropertyDescriptor(this);


[2/9] incubator-nifi git commit: NIFI-43: Do not throw InvocationTargetException if it is wrapping a RuntimeException; instead just throw the RuntimeException

Posted by jo...@apache.org.
NIFI-43: Do not throw InvocationTargetException if it is wrapping a RuntimeException; instead just throw the RuntimeException


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/e04a55d3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/e04a55d3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/e04a55d3

Branch: refs/heads/NIFI-169
Commit: e04a55d3a5097d1ae3ff5c5a4c8f8ad1e1dc56b9
Parents: 73cc6cb
Author: Mark Payne <ma...@hotmail.com>
Authored: Mon Dec 15 13:14:42 2014 -0500
Committer: Mark Payne <ma...@hotmail.com>
Committed: Mon Dec 15 13:14:42 2014 -0500

----------------------------------------------------------------------
 .../org/apache/nifi/util/ReflectionUtils.java   | 72 +++++++++++---------
 1 file changed, 40 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e04a55d3/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/util/ReflectionUtils.java
----------------------------------------------------------------------
diff --git a/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/util/ReflectionUtils.java b/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/util/ReflectionUtils.java
index 9d52eb3..e15e00a 100644
--- a/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/util/ReflectionUtils.java
+++ b/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/util/ReflectionUtils.java
@@ -42,43 +42,51 @@ public class ReflectionUtils {
      * @throws IllegalAccessException
      */
     public static void invokeMethodsWithAnnotation(final Class<? extends Annotation> annotation, final Object instance, final Object... args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-        for (final Method method : instance.getClass().getMethods()) {
-            if (method.isAnnotationPresent(annotation)) {
-                final boolean isAccessible = method.isAccessible();
-                method.setAccessible(true);
-
-                try {
-                    final Class<?>[] argumentTypes = method.getParameterTypes();
-                    if (argumentTypes.length > args.length) {
-                        throw new IllegalArgumentException(String.format("Unable to invoke method %1$s on %2$s because method expects %3$s parameters but only %4$s were given",
-                                method.getName(), instance, argumentTypes.length, args.length));
-                    }
-
-                    for (int i = 0; i < argumentTypes.length; i++) {
-                        final Class<?> argType = argumentTypes[i];
-                        if (!argType.isAssignableFrom(args[i].getClass())) {
-                            throw new IllegalArgumentException(String.format(
-                                    "Unable to invoke method %1$s on %2$s because method parameter %3$s is expected to be of type %4$s but argument passed was of type %5$s",
-                                    method.getName(), instance, i, argType, args[i].getClass()));
+        try {
+            for (final Method method : instance.getClass().getMethods()) {
+                if (method.isAnnotationPresent(annotation)) {
+                    final boolean isAccessible = method.isAccessible();
+                    method.setAccessible(true);
+    
+                    try {
+                        final Class<?>[] argumentTypes = method.getParameterTypes();
+                        if (argumentTypes.length > args.length) {
+                            throw new IllegalArgumentException(String.format("Unable to invoke method %1$s on %2$s because method expects %3$s parameters but only %4$s were given",
+                                    method.getName(), instance, argumentTypes.length, args.length));
                         }
-                    }
-
-                    if (argumentTypes.length == args.length) {
-                        method.invoke(instance, args);
-                    } else {
-                        final Object[] argsToPass = new Object[argumentTypes.length];
-                        for (int i = 0; i < argsToPass.length; i++) {
-                            argsToPass[i] = args[i];
+    
+                        for (int i = 0; i < argumentTypes.length; i++) {
+                            final Class<?> argType = argumentTypes[i];
+                            if (!argType.isAssignableFrom(args[i].getClass())) {
+                                throw new IllegalArgumentException(String.format(
+                                        "Unable to invoke method %1$s on %2$s because method parameter %3$s is expected to be of type %4$s but argument passed was of type %5$s",
+                                        method.getName(), instance, i, argType, args[i].getClass()));
+                            }
+                        }
+    
+                        if (argumentTypes.length == args.length) {
+                            method.invoke(instance, args);
+                        } else {
+                            final Object[] argsToPass = new Object[argumentTypes.length];
+                            for (int i = 0; i < argsToPass.length; i++) {
+                                argsToPass[i] = args[i];
+                            }
+    
+                            method.invoke(instance, argsToPass);
+                        }
+                    } finally {
+                        if (!isAccessible) {
+                            method.setAccessible(false);
                         }
-
-                        method.invoke(instance, argsToPass);
-                    }
-                } finally {
-                    if (!isAccessible) {
-                        method.setAccessible(false);
                     }
                 }
             }
+        } catch (final InvocationTargetException ite) {
+            if ( ite.getCause() instanceof RuntimeException ) {
+                throw (RuntimeException) ite.getCause();
+            } else {
+                throw ite;
+            }
         }
     }
 


[4/9] incubator-nifi git commit: NIFI-49: Included patch from Philip Young to include name of default vlaue when not allowed as a property descriptor value

Posted by jo...@apache.org.
NIFI-49: Included patch from Philip Young to include name of default vlaue when not allowed as a property descriptor value


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/13160429
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/13160429
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/13160429

Branch: refs/heads/NIFI-169
Commit: 13160429777e6a48a7833174a99f2771c11649ed
Parents: e04a55d
Author: Mark Payne <ma...@hotmail.com>
Authored: Mon Dec 15 13:28:09 2014 -0500
Committer: Mark Payne <ma...@hotmail.com>
Committed: Mon Dec 15 13:28:09 2014 -0500

----------------------------------------------------------------------
 .../main/java/org/apache/nifi/components/PropertyDescriptor.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/13160429/nifi-api/src/main/java/org/apache/nifi/components/PropertyDescriptor.java
----------------------------------------------------------------------
diff --git a/nifi-api/src/main/java/org/apache/nifi/components/PropertyDescriptor.java b/nifi-api/src/main/java/org/apache/nifi/components/PropertyDescriptor.java
index c95d449..ba0f7dc 100644
--- a/nifi-api/src/main/java/org/apache/nifi/components/PropertyDescriptor.java
+++ b/nifi-api/src/main/java/org/apache/nifi/components/PropertyDescriptor.java
@@ -425,7 +425,7 @@ public final class PropertyDescriptor implements Comparable<PropertyDescriptor>
                 throw new IllegalStateException("Must specify a name");
             }
             if (!isValueAllowed(defaultValue)) {
-                throw new IllegalStateException("Default value is not in the set of allowable values");
+                throw new IllegalStateException("Default value ["+ defaultValue +"] is not in the set of allowable values");
             }
 
             return new PropertyDescriptor(this);


[8/9] incubator-nifi git commit: Merge branch 'develop' into NIFI-169

Posted by jo...@apache.org.
Merge branch 'develop' into NIFI-169


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/3a4c6ed8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/3a4c6ed8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/3a4c6ed8

Branch: refs/heads/NIFI-169
Commit: 3a4c6ed887cd2e13aa861ed99028de33678bcbe8
Parents: 614349b 1cc3ce5
Author: joewitt <jo...@apache.org>
Authored: Tue Dec 16 08:16:52 2014 -0500
Committer: joewitt <jo...@apache.org>
Committed: Tue Dec 16 08:16:52 2014 -0500

----------------------------------------------------------------------
 .../nifi/controller/FileSystemSwapManager.java  | 33 ++++++---
 .../apache/nifi/controller/FlowController.java  | 20 +++---
 .../org/apache/nifi/util/ReflectionUtils.java   | 72 +++++++++++---------
 .../processors/standard/TestScanContent.java    |  2 +-
 .../nifi/components/PropertyDescriptor.java     |  2 +-
 .../repository/FlowFileSwapManager.java         |  5 +-
 .../nifi/components/TestPropertyDescriptor.java | 59 ++++++++++++++++
 7 files changed, 142 insertions(+), 51 deletions(-)
----------------------------------------------------------------------



[5/9] incubator-nifi git commit: NIFI-49: Included patch from Philip Young to include name of default vlaue when not allowed as a property descriptor value

Posted by jo...@apache.org.
NIFI-49: Included patch from Philip Young to include name of default vlaue when not allowed as a property descriptor value


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/ddfa621d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/ddfa621d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/ddfa621d

Branch: refs/heads/NIFI-169
Commit: ddfa621dab4f6614e426314e0685106586e08c9f
Parents: 1316042 f0bea5c
Author: Mark Payne <ma...@hotmail.com>
Authored: Mon Dec 15 13:29:35 2014 -0500
Committer: Mark Payne <ma...@hotmail.com>
Committed: Mon Dec 15 13:29:35 2014 -0500

----------------------------------------------------------------------

----------------------------------------------------------------------