You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by da...@apache.org on 2015/06/27 02:03:57 UTC

[01/17] incubator-nifi git commit: NIFI-632 initial checkin

Repository: incubator-nifi
Updated Branches:
  refs/heads/develop f58972e56 -> 40b55efbd


NIFI-632 initial checkin


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

Branch: refs/heads/develop
Commit: 30055dd0c84909a1c8fcd9113ee2f1a3d5467a50
Parents: 86cbfab
Author: danbress <db...@onyxconsults.com>
Authored: Thu May 28 19:35:29 2015 -0400
Committer: danbress <db...@onyxconsults.com>
Committed: Tue Jun 9 21:34:20 2015 -0400

----------------------------------------------------------------------
 .../nifi-framework/nifi-documentation/pom.xml   |   5 +
 .../nifi/documentation/DocGeneratorTest.java    |  79 ++++++++++++
 .../src/test/resources/conf/nifi.properties     | 129 +++++++++++++++++++
 3 files changed, 213 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/30055dd0/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/pom.xml b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/pom.xml
index a92aebf..340f2c5 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/pom.xml
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/pom.xml
@@ -35,5 +35,10 @@
             <artifactId>nifi-processor-utils</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/30055dd0/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java
new file mode 100644
index 0000000..c077540
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java
@@ -0,0 +1,79 @@
+package org.apache.nifi.documentation;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.nifi.nar.ExtensionMapping;
+import org.apache.nifi.nar.NarUnpacker;
+import org.apache.nifi.stream.io.StreamUtils;
+import org.apache.nifi.util.NiFiProperties;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.mockito.internal.util.io.IOUtil;
+
+public class DocGeneratorTest {
+
+    @Test
+    public void testProcessorLoadsNarResources() throws IOException {
+        TemporaryFolder temporaryFolder = new TemporaryFolder();
+        temporaryFolder.create();
+
+        System.out.println("temp folder: " + temporaryFolder.getRoot());
+        
+        NiFiProperties properties = loadSpecifiedProperties("/conf/nifi.properties");
+        properties.setProperty(NiFiProperties.COMPONENT_DOCS_DIRECTORY, temporaryFolder.getRoot().getAbsolutePath());
+
+        final ExtensionMapping extensionMapping = NarUnpacker.unpackNars(properties);
+
+        DocGenerator.generate(properties);      
+
+        File processorDirectory = new File(temporaryFolder.getRoot(), "org.apache.nifi.TestProcessor");
+        File indexHtml = new File(processorDirectory, "index.html");
+        
+        String generatedHtml = FileUtils.readFileToString(indexHtml);
+        Assert.assertNotNull(generatedHtml);
+    }
+    
+    private static String toString(String fileName) {
+        return fileName;
+    }
+    
+    private NiFiProperties loadSpecifiedProperties(String propertiesFile) {
+        String file = DocGeneratorTest.class.getResource(propertiesFile).getFile();
+
+        System.setProperty(NiFiProperties.PROPERTIES_FILE_PATH, file);
+
+        NiFiProperties properties = NiFiProperties.getInstance();
+
+        // clear out existing properties
+        for (String prop : properties.stringPropertyNames()) {
+            properties.remove(prop);
+        }
+
+        InputStream inStream = null;
+        try {
+            inStream = new BufferedInputStream(new FileInputStream(file));
+            properties.load(inStream);
+        } catch (final Exception ex) {
+            throw new RuntimeException("Cannot load properties file due to "
+                    + ex.getLocalizedMessage(), ex);
+        } finally {
+            if (null != inStream) {
+                try {
+                    inStream.close();
+                } catch (final Exception ex) {
+                    /**
+                     * do nothing *
+                     */
+                }
+            }
+        }
+
+        return properties;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/30055dd0/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/conf/nifi.properties
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/conf/nifi.properties b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/conf/nifi.properties
new file mode 100644
index 0000000..92e4a92
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/conf/nifi.properties
@@ -0,0 +1,129 @@
+# 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.
+
+# Core Properties #
+nifi.version=nifi-test 3.0.0
+nifi.flow.configuration.file=./target/flow.xml.gz
+nifi.flow.configuration.archive.dir=./target/archive/
+nifi.flowcontroller.autoResumeState=true
+nifi.flowcontroller.graceful.shutdown.period=10 sec
+nifi.flowservice.writedelay.interval=2 sec
+nifi.administrative.yield.duration=30 sec
+
+nifi.reporting.task.configuration.file=./target/reporting-tasks.xml
+nifi.controller.service.configuration.file=./target/controller-services.xml
+nifi.templates.directory=./target/templates
+nifi.ui.banner.text=UI Banner Text
+nifi.ui.autorefresh.interval=30 sec
+nifi.nar.library.directory=./target/NarUnpacker/lib/
+nifi.nar.library.directory.alt=./target/NarUnpacker/lib2/
+
+nifi.nar.working.directory=./target/work/nar/
+
+# H2 Settings
+nifi.database.directory=./target/database_repository
+nifi.h2.url.append=;LOCK_TIMEOUT=25000;WRITE_DELAY=0;AUTO_SERVER=FALSE
+
+# FlowFile Repository
+nifi.flowfile.repository.directory=./target/test-repo
+nifi.flowfile.repository.partitions=1
+nifi.flowfile.repository.checkpoint.interval=2 mins
+nifi.queue.swap.threshold=20000
+nifi.swap.storage.directory=./target/test-repo/swap
+nifi.swap.in.period=5 sec
+nifi.swap.in.threads=1
+nifi.swap.out.period=5 sec
+nifi.swap.out.threads=4
+
+# Content Repository
+nifi.content.claim.max.appendable.size=10 MB
+nifi.content.claim.max.flow.files=100
+nifi.content.repository.directory.default=./target/content_repository
+
+# Provenance Repository Properties
+nifi.provenance.repository.storage.directory=./target/provenance_repository
+nifi.provenance.repository.max.storage.time=24 hours
+nifi.provenance.repository.max.storage.size=1 GB
+nifi.provenance.repository.rollover.time=5 mins
+nifi.provenance.repository.rollover.size=100 MB
+
+# Site to Site properties
+nifi.remote.input.socket.port=9990
+nifi.remote.input.secure=true
+
+# web properties #
+nifi.web.war.directory=./target/lib
+nifi.web.http.host=
+nifi.web.http.port=8080
+nifi.web.https.host=
+nifi.web.https.port=
+nifi.web.jetty.working.directory=./target/work/jetty
+
+# security properties #
+nifi.sensitive.props.key=key
+nifi.sensitive.props.algorithm=PBEWITHMD5AND256BITAES-CBC-OPENSSL
+nifi.sensitive.props.provider=BC
+
+nifi.security.keystore=
+nifi.security.keystoreType=
+nifi.security.keystorePasswd=
+nifi.security.keyPasswd=
+nifi.security.truststore=
+nifi.security.truststoreType=
+nifi.security.truststorePasswd=
+nifi.security.needClientAuth=
+nifi.security.authorizedUsers.file=./target/conf/authorized-users.xml
+nifi.security.user.credential.cache.duration=24 hours
+nifi.security.user.authority.provider=nifi.authorization.FileAuthorizationProvider
+nifi.security.support.new.account.requests=
+nifi.security.default.user.roles=
+
+# cluster common properties (cluster manager and nodes must have same values) #
+nifi.cluster.protocol.heartbeat.interval=5 sec
+nifi.cluster.protocol.is.secure=false
+nifi.cluster.protocol.socket.timeout=30 sec
+nifi.cluster.protocol.connection.handshake.timeout=45 sec
+# if multicast is used, then nifi.cluster.protocol.multicast.xxx properties must be configured #
+nifi.cluster.protocol.use.multicast=false
+nifi.cluster.protocol.multicast.address=
+nifi.cluster.protocol.multicast.port=
+nifi.cluster.protocol.multicast.service.broadcast.delay=500 ms
+nifi.cluster.protocol.multicast.service.locator.attempts=3
+nifi.cluster.protocol.multicast.service.locator.attempts.delay=1 sec
+
+# cluster node properties (only configure for cluster nodes) #
+nifi.cluster.is.node=false
+nifi.cluster.node.address=
+nifi.cluster.node.protocol.port=
+nifi.cluster.node.protocol.threads=2
+# if multicast is not used, nifi.cluster.node.unicast.xxx must have same values as nifi.cluster.manager.xxx #
+nifi.cluster.node.unicast.manager.address=
+nifi.cluster.node.unicast.manager.protocol.port=
+nifi.cluster.node.unicast.manager.authority.provider.port=
+
+# cluster manager properties (only configure for cluster manager) #
+nifi.cluster.is.manager=false
+nifi.cluster.manager.address=
+nifi.cluster.manager.protocol.port=
+nifi.cluster.manager.authority.provider.port=
+nifi.cluster.manager.authority.provider.threads=10
+nifi.cluster.manager.node.firewall.file=
+nifi.cluster.manager.node.event.history.size=10
+nifi.cluster.manager.node.api.connection.timeout=30 sec
+nifi.cluster.manager.node.api.read.timeout=30 sec
+nifi.cluster.manager.node.api.request.threads=10
+nifi.cluster.manager.flow.retrieval.delay=5 sec
+nifi.cluster.manager.protocol.threads=10
+nifi.cluster.manager.safemode.duration=0 sec


[10/17] incubator-nifi git commit: NIFI-632 creating service definition files

Posted by da...@apache.org.
NIFI-632 creating service definition files


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

Branch: refs/heads/develop
Commit: 56d369e3357c91effffa42c8c96e9c8706422590
Parents: 089a27f
Author: danbress <db...@onyxconsults.com>
Authored: Mon Jun 8 22:06:38 2015 -0400
Committer: danbress <db...@onyxconsults.com>
Committed: Tue Jun 9 21:34:27 2015 -0400

----------------------------------------------------------------------
 ...ache.nifi.controller.repository.ContentRepository | 15 +++++++++++++++
 ...che.nifi.controller.repository.FlowFileRepository | 15 +++++++++++++++
 ...he.nifi.controller.repository.FlowFileSwapManager | 15 +++++++++++++++
 ...ntroller.status.history.ComponentStatusRepository | 15 +++++++++++++++
 4 files changed, 60 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/56d369e3/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.repository.ContentRepository
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.repository.ContentRepository b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.repository.ContentRepository
new file mode 100644
index 0000000..6e0227b
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.repository.ContentRepository
@@ -0,0 +1,15 @@
+# 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.
+org.apache.nifi.controller.repository.FileSystemRepository
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/56d369e3/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.repository.FlowFileRepository
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.repository.FlowFileRepository b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.repository.FlowFileRepository
new file mode 100644
index 0000000..0a91746
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.repository.FlowFileRepository
@@ -0,0 +1,15 @@
+# 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.
+org.apache.nifi.controller.repository.WriteAheadFlowFileRepository
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/56d369e3/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.repository.FlowFileSwapManager
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.repository.FlowFileSwapManager b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.repository.FlowFileSwapManager
new file mode 100644
index 0000000..e5c63ac
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.repository.FlowFileSwapManager
@@ -0,0 +1,15 @@
+# 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.
+org.apache.nifi.controller.FileSystemSwapManager
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/56d369e3/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.status.history.ComponentStatusRepository
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.status.history.ComponentStatusRepository b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.status.history.ComponentStatusRepository
new file mode 100644
index 0000000..b197ace
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.status.history.ComponentStatusRepository
@@ -0,0 +1,15 @@
+# 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.
+org.apache.nifi.controller.status.history.VolatileComponentStatusRepository
\ No newline at end of file


[06/17] incubator-nifi git commit: NIFI-632 cleaning up tests

Posted by da...@apache.org.
NIFI-632 cleaning up tests


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

Branch: refs/heads/develop
Commit: e4e9efad4428cf3dd57ee52658f93d75c1a55be5
Parents: 4074ec3
Author: danbress <db...@onyxconsults.com>
Authored: Sat May 30 12:04:54 2015 -0400
Committer: danbress <db...@onyxconsults.com>
Committed: Tue Jun 9 21:34:24 2015 -0400

----------------------------------------------------------------------
 .../nifi/documentation/DocGeneratorTest.java    | 31 ++++++++++++--------
 1 file changed, 19 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e4e9efad/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java
index 320c7c8..83db414 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java
@@ -1,3 +1,19 @@
+/*
+ * 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.documentation;
 
 import java.io.BufferedInputStream;
@@ -8,15 +24,12 @@ import java.io.InputStream;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.nifi.nar.ExtensionManager;
-import org.apache.nifi.nar.ExtensionMapping;
 import org.apache.nifi.nar.NarClassLoaders;
 import org.apache.nifi.nar.NarUnpacker;
-import org.apache.nifi.stream.io.StreamUtils;
 import org.apache.nifi.util.NiFiProperties;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
-import org.mockito.internal.util.io.IOUtil;
 
 public class DocGeneratorTest {
 
@@ -25,18 +38,16 @@ public class DocGeneratorTest {
         TemporaryFolder temporaryFolder = new TemporaryFolder();
         temporaryFolder.create();
 
-        System.out.println("temp folder: " + temporaryFolder.getRoot());
-        
         NiFiProperties properties = loadSpecifiedProperties("/conf/nifi.properties");
         properties.setProperty(NiFiProperties.COMPONENT_DOCS_DIRECTORY, temporaryFolder.getRoot().getAbsolutePath());
 
-        final ExtensionMapping extensionMapping = NarUnpacker.unpackNars(properties);
+        NarUnpacker.unpackNars(properties);
 
         NarClassLoaders.load(properties);
 
         ExtensionManager.discoverExtensions();
 
-        DocGenerator.generate(properties);      
+        DocGenerator.generate(properties);
 
         File processorDirectory = new File(temporaryFolder.getRoot(), "org.apache.nifi.processors.WriteResourceToStream");
         File indexHtml = new File(processorDirectory, "index.html");
@@ -44,11 +55,7 @@ public class DocGeneratorTest {
         String generatedHtml = FileUtils.readFileToString(indexHtml);
         Assert.assertNotNull(generatedHtml);
     }
-    
-    private static String toString(String fileName) {
-        return fileName;
-    }
-    
+
     private NiFiProperties loadSpecifiedProperties(String propertiesFile) {
         String file = DocGeneratorTest.class.getResource(propertiesFile).getFile();
 


[12/17] incubator-nifi git commit: NIFI-632 calling annotations as part of initialization(@OnRemoved, @OnShutdown)

Posted by da...@apache.org.
NIFI-632 calling annotations as part of initialization(@OnRemoved, @OnShutdown)


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

Branch: refs/heads/develop
Commit: 53b86d7a6cdde754d34a9eb2745f270a4b57d5a9
Parents: 56d369e
Author: danbress <db...@onyxconsults.com>
Authored: Tue Jun 9 21:08:55 2015 -0400
Committer: danbress <db...@onyxconsults.com>
Committed: Tue Jun 9 21:34:28 2015 -0400

----------------------------------------------------------------------
 .../init/ControllerServiceInitializer.java      |  14 +-
 .../init/ProcessorInitializer.java              |  12 +-
 .../init/ReportingTaskingInitializer.java       |   9 ++
 .../mock/MockConfigurationContext.java          |  38 +++++
 .../documentation/mock/MockProcessContext.java  |  85 ++++++++++++
 .../documentation/util/ReflectionUtils.java     | 139 +++++++++++++++++++
 .../FullyDocumentedControllerService.java       |  63 +++++++--
 .../example/FullyDocumentedProcessor.java       |  49 ++++++-
 .../example/FullyDocumentedReportingTask.java   |  46 +++++-
 .../html/HtmlDocumentationWriterTest.java       |  33 ++++-
 .../html/ProcessorDocumentationWriterTest.java  |  19 ++-
 11 files changed, 478 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/53b86d7a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ControllerServiceInitializer.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ControllerServiceInitializer.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ControllerServiceInitializer.java
index 0f654ec..976c7a5 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ControllerServiceInitializer.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ControllerServiceInitializer.java
@@ -16,16 +16,21 @@
  */
 package org.apache.nifi.documentation.init;
 
+import org.apache.nifi.annotation.lifecycle.OnRemoved;
+import org.apache.nifi.annotation.lifecycle.OnShutdown;
 import org.apache.nifi.components.ConfigurableComponent;
 import org.apache.nifi.controller.ControllerService;
 import org.apache.nifi.documentation.ConfigurableComponentInitializer;
+import org.apache.nifi.documentation.mock.MockConfigurationContext;
 import org.apache.nifi.documentation.mock.MockControllerServiceInitializationContext;
+import org.apache.nifi.documentation.mock.MockProcessorLogger;
+import org.apache.nifi.documentation.util.ReflectionUtils;
+import org.apache.nifi.logging.ProcessorLog;
 import org.apache.nifi.nar.NarCloseable;
 import org.apache.nifi.reporting.InitializationException;
 
 /**
- * Initializes a ControllerService using a
- * MockControllerServiceInitializationContext
+ * Initializes a ControllerService using a MockControllerServiceInitializationContext
  *
  *
  */
@@ -37,6 +42,11 @@ public class ControllerServiceInitializer implements ConfigurableComponentInitia
 
         try (NarCloseable narCloseable = NarCloseable.withNarLoader()) {
             controllerService.initialize(new MockControllerServiceInitializationContext());
+
+            final ProcessorLog logger = new MockProcessorLogger();
+            final MockConfigurationContext context = new MockConfigurationContext();
+            ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnRemoved.class, null, controllerService, logger, context);
+            ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnShutdown.class, null, controllerService, logger, context);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/53b86d7a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ProcessorInitializer.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ProcessorInitializer.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ProcessorInitializer.java
index 331db71..7f3357c 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ProcessorInitializer.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ProcessorInitializer.java
@@ -16,9 +16,15 @@
  */
 package org.apache.nifi.documentation.init;
 
+import org.apache.nifi.annotation.lifecycle.OnRemoved;
+import org.apache.nifi.annotation.lifecycle.OnShutdown;
 import org.apache.nifi.components.ConfigurableComponent;
 import org.apache.nifi.documentation.ConfigurableComponentInitializer;
+import org.apache.nifi.documentation.mock.MockProcessContext;
 import org.apache.nifi.documentation.mock.MockProcessorInitializationContext;
+import org.apache.nifi.documentation.mock.MockProcessorLogger;
+import org.apache.nifi.documentation.util.ReflectionUtils;
+import org.apache.nifi.logging.ProcessorLog;
 import org.apache.nifi.nar.NarCloseable;
 import org.apache.nifi.processor.Processor;
 
@@ -34,7 +40,11 @@ public class ProcessorInitializer implements ConfigurableComponentInitializer {
         Processor processor = (Processor) component;
         try (NarCloseable narCloseable = NarCloseable.withNarLoader()) {
             processor.initialize(new MockProcessorInitializationContext());
+
+            final ProcessorLog logger = new MockProcessorLogger();
+            final MockProcessContext context = new MockProcessContext();
+            ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnRemoved.class, null, processor, logger, context);
+            ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnShutdown.class, null, processor, logger, context);
         }
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/53b86d7a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ReportingTaskingInitializer.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ReportingTaskingInitializer.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ReportingTaskingInitializer.java
index 49291a7..90642e4 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ReportingTaskingInitializer.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ReportingTaskingInitializer.java
@@ -16,9 +16,14 @@
  */
 package org.apache.nifi.documentation.init;
 
+import org.apache.nifi.annotation.lifecycle.OnRemoved;
+import org.apache.nifi.annotation.lifecycle.OnShutdown;
 import org.apache.nifi.components.ConfigurableComponent;
 import org.apache.nifi.documentation.ConfigurableComponentInitializer;
+import org.apache.nifi.documentation.mock.MockConfigurationContext;
+import org.apache.nifi.documentation.mock.MockProcessorLogger;
 import org.apache.nifi.documentation.mock.MockReportingInitializationContext;
+import org.apache.nifi.documentation.util.ReflectionUtils;
 import org.apache.nifi.nar.NarCloseable;
 import org.apache.nifi.reporting.InitializationException;
 import org.apache.nifi.reporting.ReportingTask;
@@ -35,6 +40,10 @@ public class ReportingTaskingInitializer implements ConfigurableComponentInitial
         ReportingTask reportingTask = (ReportingTask) component;
         try (NarCloseable narCloseable = NarCloseable.withNarLoader()) {
             reportingTask.initialize(new MockReportingInitializationContext());
+
+            final MockConfigurationContext context = new MockConfigurationContext();
+            ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnRemoved.class, null, reportingTask, new MockProcessorLogger(), context);
+            ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnShutdown.class, null, reportingTask, new MockProcessorLogger(), context);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/53b86d7a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockConfigurationContext.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockConfigurationContext.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockConfigurationContext.java
new file mode 100644
index 0000000..1ba5499
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockConfigurationContext.java
@@ -0,0 +1,38 @@
+/*
+ * 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.documentation.mock;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.PropertyValue;
+import org.apache.nifi.controller.ConfigurationContext;
+
+public class MockConfigurationContext implements ConfigurationContext {
+
+    @Override
+    public PropertyValue getProperty(PropertyDescriptor property) {
+        return null;
+    }
+
+    @Override
+    public Map<PropertyDescriptor, String> getProperties() {
+        return Collections.emptyMap();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/53b86d7a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessContext.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessContext.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessContext.java
new file mode 100644
index 0000000..76d7d3d
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessContext.java
@@ -0,0 +1,85 @@
+/*
+ * 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.documentation.mock;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.PropertyValue;
+import org.apache.nifi.controller.ControllerServiceLookup;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.Relationship;
+
+public class MockProcessContext implements ProcessContext {
+
+    @Override
+    public PropertyValue getProperty(PropertyDescriptor descriptor) {
+        return null;
+    }
+
+    @Override
+    public PropertyValue getProperty(String propertyName) {
+        return null;
+    }
+
+    @Override
+    public PropertyValue newPropertyValue(String rawValue) {
+        return null;
+    }
+
+    @Override
+    public void yield() {
+
+    }
+
+    @Override
+    public int getMaxConcurrentTasks() {
+        return 0;
+    }
+
+    @Override
+    public String getAnnotationData() {
+        return "";
+    }
+
+    @Override
+    public Map<PropertyDescriptor, String> getProperties() {
+        return Collections.emptyMap();
+    }
+
+    @Override
+    public String encrypt(String unencrypted) {
+        return unencrypted;
+    }
+
+    @Override
+    public String decrypt(String encrypted) {
+        return encrypted;
+    }
+
+    @Override
+    public ControllerServiceLookup getControllerServiceLookup() {
+        return new MockControllerServiceLookup();
+    }
+
+    @Override
+    public Set<Relationship> getAvailableRelationships() {
+        return Collections.emptySet();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/53b86d7a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/util/ReflectionUtils.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/util/ReflectionUtils.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/util/ReflectionUtils.java
new file mode 100644
index 0000000..449bd07
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/util/ReflectionUtils.java
@@ -0,0 +1,139 @@
+/*
+ * 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.documentation.util;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.nifi.logging.ProcessorLog;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class is a copy of org.apache.nifi.util.ReflectionUtils.  Ultimately the documentation generation
+ * component should be moved to a place where it can depend on this directly instead of copying it in.
+ *
+ *
+ */
+public class ReflectionUtils {
+
+    private final static Logger LOG = LoggerFactory.getLogger(ReflectionUtils.class);
+    /**
+     * Invokes all methods on the given instance that have been annotated with the given preferredAnnotation and if no such method exists will invoke all methods on the given instance that have been
+     * annotated with the given alternateAnnotation, if any exists. If the signature of the method that is defined in <code>instance</code> uses 1 or more parameters, those parameters must be
+     * specified by the <code>args</code> parameter. However, if more arguments are supplied by the <code>args</code> parameter than needed, the extra arguments will be ignored.
+     *
+     * @param preferredAnnotation preferred
+     * @param alternateAnnotation alternate
+     * @param instance instance
+     * @param logger the ProcessorLog to use for logging any errors. If null, will use own logger, but that will not generate bulletins or easily tie to the Processor's log messages.
+     * @param args args
+     * @return <code>true</code> if all appropriate methods were invoked and returned without throwing an Exception, <code>false</code> if one of the methods threw an Exception or could not be
+     * invoked; if <code>false</code> is returned, an error will have been logged.
+     */
+    public static boolean quietlyInvokeMethodsWithAnnotations(
+            final Class<? extends Annotation> preferredAnnotation, final Class<? extends Annotation> alternateAnnotation, final Object instance, final ProcessorLog logger, final Object... args) {
+        final List<Class<? extends Annotation>> annotationClasses = new ArrayList<>(alternateAnnotation == null ? 1 : 2);
+        annotationClasses.add(preferredAnnotation);
+        if (alternateAnnotation != null) {
+            annotationClasses.add(alternateAnnotation);
+        }
+
+        boolean annotationFound = false;
+        for (final Class<? extends Annotation> annotationClass : annotationClasses) {
+            if (annotationFound) {
+                break;
+            }
+
+            for (final Method method : instance.getClass().getMethods()) {
+                if (method.isAnnotationPresent(annotationClass)) {
+                    annotationFound = true;
+
+                    final boolean isAccessible = method.isAccessible();
+                    method.setAccessible(true);
+
+                    try {
+                        final Class<?>[] argumentTypes = method.getParameterTypes();
+                        if (argumentTypes.length > args.length) {
+                            if (logger == null) {
+                                LOG.error("Unable to invoke method {} on {} because method expects {} parameters but only {} were given",
+                                        new Object[]{method.getName(), instance, argumentTypes.length, args.length});
+                            } else {
+                                logger.error("Unable to invoke method {} on {} because method expects {} parameters but only {} were given",
+                                        new Object[]{method.getName(), instance, argumentTypes.length, args.length});
+                            }
+
+                            return false;
+                        }
+
+                        for (int i = 0; i < argumentTypes.length; i++) {
+                            final Class<?> argType = argumentTypes[i];
+                            if (!argType.isAssignableFrom(args[i].getClass())) {
+                                if (logger == null) {
+                                    LOG.error("Unable to invoke method {} on {} because method parameter {} is expected to be of type {} but argument passed was of type {}",
+                                            new Object[]{method.getName(), instance, i, argType, args[i].getClass()});
+                                } else {
+                                    logger.error("Unable to invoke method {} on {} because method parameter {} is expected to be of type {} but argument passed was of type {}",
+                                            new Object[]{method.getName(), instance, i, argType, args[i].getClass()});
+                                }
+
+                                return false;
+                            }
+                        }
+
+                        try {
+                            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);
+                            }
+                        } catch (final InvocationTargetException ite) {
+                            if (logger == null) {
+                                LOG.error("Unable to invoke method {} on {} due to {}", new Object[]{method.getName(), instance, ite.getCause()});
+                                LOG.error("", ite.getCause());
+                            } else {
+                                logger.error("Unable to invoke method {} on {} due to {}", new Object[]{method.getName(), instance, ite.getCause()});
+                            }
+                        } catch (final IllegalAccessException | IllegalArgumentException t) {
+                            if (logger == null) {
+                                LOG.error("Unable to invoke method {} on {} due to {}", new Object[]{method.getName(), instance, t});
+                                LOG.error("", t);
+                            } else {
+                                logger.error("Unable to invoke method {} on {} due to {}", new Object[]{method.getName(), instance, t});
+                            }
+
+                            return false;
+                        }
+                    } finally {
+                        if (!isAccessible) {
+                            method.setAccessible(false);
+                        }
+                    }
+                }
+            }
+        }
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/53b86d7a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/example/FullyDocumentedControllerService.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/example/FullyDocumentedControllerService.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/example/FullyDocumentedControllerService.java
index cd68267..ea5f622 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/example/FullyDocumentedControllerService.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/example/FullyDocumentedControllerService.java
@@ -22,26 +22,32 @@ import java.util.List;
 
 import org.apache.nifi.annotation.documentation.CapabilityDescription;
 import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnRemoved;
+import org.apache.nifi.annotation.lifecycle.OnShutdown;
 import org.apache.nifi.components.PropertyDescriptor;
 import org.apache.nifi.controller.AbstractControllerService;
+import org.apache.nifi.controller.ConfigurationContext;
 import org.apache.nifi.processor.util.StandardValidators;
 
-@CapabilityDescription("A documented controller service that can help you do things")
-@Tags({"one", "two", "three"})
-public class FullyDocumentedControllerService extends AbstractControllerService implements SampleService{
+@CapabilityDescription("A documented controller service that can help you do things")
+@Tags({ "one", "two", "three" })
+public class FullyDocumentedControllerService extends AbstractControllerService implements SampleService {
 
-    public static final PropertyDescriptor KEYSTORE = new PropertyDescriptor.Builder().name("Keystore Filename")
-            .description("The fully-qualified filename of the Keystore").defaultValue(null)
+    public static final PropertyDescriptor KEYSTORE = new PropertyDescriptor.Builder().name("Keystore Filename").description("The fully-qualified filename of the Keystore").defaultValue(null)
             .addValidator(StandardValidators.FILE_EXISTS_VALIDATOR).sensitive(false).build();
-    public static final PropertyDescriptor KEYSTORE_TYPE = new PropertyDescriptor.Builder().name("Keystore Type")
-            .description("The Type of the Keystore").allowableValues("JKS", "PKCS12")
+    public static final PropertyDescriptor KEYSTORE_TYPE = new PropertyDescriptor.Builder().name("Keystore Type").description("The Type of the Keystore").allowableValues("JKS", "PKCS12")
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR).defaultValue("JKS").sensitive(false).build();
-    public static final PropertyDescriptor KEYSTORE_PASSWORD = new PropertyDescriptor.Builder()
-            .name("Keystore Password").defaultValue(null).description("The password for the Keystore")
+    public static final PropertyDescriptor KEYSTORE_PASSWORD = new PropertyDescriptor.Builder().name("Keystore Password").defaultValue(null).description("The password for the Keystore")
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR).sensitive(true).build();
 
     private static final List<PropertyDescriptor> properties;
 
+    private int onRemovedNoArgs = 0;
+    private int onRemovedArgs = 0;
+
+    private int onShutdownNoArgs = 0;
+    private int onShutdownArgs = 0;
+
     static {
         List<PropertyDescriptor> props = new ArrayList<>();
         props.add(KEYSTORE);
@@ -53,10 +59,45 @@ public class FullyDocumentedControllerService extends AbstractControllerService
     @Override
     protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
         return properties;
-    }
+    }
 
     @Override
     public void doSomething() {
-        // TODO Auto-generated method stub
+    }
+
+    @OnRemoved
+    public void onRemovedNoArgs() {
+        onRemovedNoArgs++;
+    }
+
+    @OnRemoved
+    public void onRemovedArgs(ConfigurationContext context) {
+        onRemovedArgs++;
+    }
+
+    @OnShutdown
+    public void onShutdownNoArgs() {
+        onShutdownNoArgs++;
+    }
+
+    @OnShutdown
+    public void onShutdownArgs(ConfigurationContext context) {
+        onShutdownArgs++;
+    }
+
+    public int getOnRemovedNoArgs() {
+        return onRemovedNoArgs;
+    }
+
+    public int getOnRemovedArgs() {
+        return onRemovedArgs;
+    }
+
+    public int getOnShutdownNoArgs() {
+        return onShutdownNoArgs;
+    }
+
+    public int getOnShutdownArgs() {
+        return onShutdownArgs;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/53b86d7a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/example/FullyDocumentedProcessor.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/example/FullyDocumentedProcessor.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/example/FullyDocumentedProcessor.java
index 178a144..379c10b 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/example/FullyDocumentedProcessor.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/example/FullyDocumentedProcessor.java
@@ -23,13 +23,15 @@ import java.util.List;
 import java.util.Set;
 
 import org.apache.nifi.annotation.behavior.DynamicProperty;
-import org.apache.nifi.annotation.documentation.CapabilityDescription;
 import org.apache.nifi.annotation.behavior.DynamicRelationship;
 import org.apache.nifi.annotation.behavior.ReadsAttribute;
-import org.apache.nifi.annotation.documentation.SeeAlso;
-import org.apache.nifi.annotation.documentation.Tags;
 import org.apache.nifi.annotation.behavior.WritesAttribute;
 import org.apache.nifi.annotation.behavior.WritesAttributes;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.SeeAlso;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnRemoved;
+import org.apache.nifi.annotation.lifecycle.OnShutdown;
 import org.apache.nifi.components.AllowableValue;
 import org.apache.nifi.components.PropertyDescriptor;
 import org.apache.nifi.processor.AbstractProcessor;
@@ -88,6 +90,12 @@ public class FullyDocumentedProcessor extends AbstractProcessor {
     private List<PropertyDescriptor> properties;
     private Set<Relationship> relationships;
 
+    private int onRemovedNoArgs = 0;
+    private int onRemovedArgs = 0;
+
+    private int onShutdownNoArgs = 0;
+    private int onShutdownArgs = 0;
+
     @Override
     protected void init(ProcessorInitializationContext context) {
         final List<PropertyDescriptor> properties = new ArrayList<>();
@@ -126,4 +134,39 @@ public class FullyDocumentedProcessor extends AbstractProcessor {
                 .description("This is a property you can use or not").dynamic(true).build();
     }
 
+    @OnRemoved
+    public void onRemovedNoArgs() {
+        onRemovedNoArgs++;
+    }
+
+    @OnRemoved
+    public void onRemovedArgs(ProcessContext context) {
+        onRemovedArgs++;
+    }
+
+    @OnShutdown
+    public void onShutdownNoArgs() {
+        onShutdownNoArgs++;
+    }
+
+    @OnShutdown
+    public void onShutdownArgs(ProcessContext context) {
+        onShutdownArgs++;
+    }
+
+    public int getOnRemovedNoArgs() {
+        return onRemovedNoArgs;
+    }
+
+    public int getOnRemovedArgs() {
+        return onRemovedArgs;
+    }
+
+    public int getOnShutdownNoArgs() {
+        return onShutdownNoArgs;
+    }
+
+    public int getOnShutdownArgs() {
+        return onShutdownArgs;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/53b86d7a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/example/FullyDocumentedReportingTask.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/example/FullyDocumentedReportingTask.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/example/FullyDocumentedReportingTask.java
index 17e446a..43929be 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/example/FullyDocumentedReportingTask.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/example/FullyDocumentedReportingTask.java
@@ -20,8 +20,11 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.controller.ConfigurationContext;
 import org.apache.nifi.annotation.documentation.CapabilityDescription;
 import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnRemoved;
+import org.apache.nifi.annotation.lifecycle.OnShutdown;
 import org.apache.nifi.reporting.AbstractReportingTask;
 import org.apache.nifi.reporting.ReportingContext;
 
@@ -35,6 +38,12 @@ public class FullyDocumentedReportingTask extends AbstractReportingTask {
                     "Specifies whether or not to show the difference in values between the current status and the previous status")
             .required(true).allowableValues("true", "false").defaultValue("true").build();
 
+    private int onRemovedNoArgs = 0;
+    private int onRemovedArgs = 0;
+
+    private int onShutdownNoArgs = 0;
+    private int onShutdownArgs = 0;
+
     @Override
     public final List<PropertyDescriptor> getSupportedPropertyDescriptors() {
         final List<PropertyDescriptor> descriptors = new ArrayList<>();
@@ -44,7 +53,42 @@ public class FullyDocumentedReportingTask extends AbstractReportingTask {
 
     @Override
     public void onTrigger(ReportingContext context) {
-        // TODO Auto-generated method stub
 
     }
+
+    @OnRemoved
+    public void onRemovedNoArgs() {
+        onRemovedNoArgs++;
+    }
+
+    @OnRemoved
+    public void onRemovedArgs(ConfigurationContext context) {
+        onRemovedArgs++;
+    }
+
+    @OnShutdown
+    public void onShutdownNoArgs() {
+        onShutdownNoArgs++;
+    }
+
+    @OnShutdown
+    public void onShutdownArgs(ConfigurationContext context) {
+        onShutdownArgs++;
+    }
+
+    public int getOnRemovedNoArgs() {
+        return onRemovedNoArgs;
+    }
+
+    public int getOnRemovedArgs() {
+        return onRemovedArgs;
+    }
+
+    public int getOnShutdownNoArgs() {
+        return onShutdownNoArgs;
+    }
+
+    public int getOnShutdownArgs() {
+        return onShutdownArgs;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/53b86d7a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/HtmlDocumentationWriterTest.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/HtmlDocumentationWriterTest.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/HtmlDocumentationWriterTest.java
index 9179ed2..d85e19b 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/HtmlDocumentationWriterTest.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/HtmlDocumentationWriterTest.java
@@ -28,26 +28,30 @@ import org.apache.nifi.documentation.example.ControllerServiceWithLogger;
 import org.apache.nifi.documentation.example.FullyDocumentedControllerService;
 import org.apache.nifi.documentation.example.FullyDocumentedReportingTask;
 import org.apache.nifi.documentation.example.ReportingTaskWithLogger;
+import org.apache.nifi.documentation.init.ControllerServiceInitializer;
+import org.apache.nifi.documentation.init.ReportingTaskingInitializer;
 import org.apache.nifi.documentation.mock.MockControllerServiceInitializationContext;
 import org.apache.nifi.documentation.mock.MockReportingInitializationContext;
 import org.apache.nifi.reporting.InitializationException;
 import org.apache.nifi.reporting.ReportingTask;
+import org.junit.Assert;
 import org.junit.Test;
 
 public class HtmlDocumentationWriterTest {
 
     @Test
     public void testJoin() {
-        assertEquals("a, b, c", HtmlDocumentationWriter.join(new String[]{"a", "b", "c"}, ", "));
-        assertEquals("a, b", HtmlDocumentationWriter.join(new String[]{"a", "b"}, ", "));
-        assertEquals("a", HtmlDocumentationWriter.join(new String[]{"a"}, ", "));
+        assertEquals("a, b, c", HtmlDocumentationWriter.join(new String[] { "a", "b", "c" }, ", "));
+        assertEquals("a, b", HtmlDocumentationWriter.join(new String[] { "a", "b" }, ", "));
+        assertEquals("a", HtmlDocumentationWriter.join(new String[] { "a" }, ", "));
     }
 
     @Test
     public void testDocumentControllerService() throws InitializationException, IOException {
 
-        ControllerService controllerService = new FullyDocumentedControllerService();
-        controllerService.initialize(new MockControllerServiceInitializationContext());
+        FullyDocumentedControllerService controllerService = new FullyDocumentedControllerService();
+        ControllerServiceInitializer initializer = new ControllerServiceInitializer();
+        initializer.initialize(controllerService);
 
         DocumentationWriter writer = new HtmlDocumentationWriter();
 
@@ -71,13 +75,21 @@ public class HtmlDocumentationWriterTest {
         assertContains(results, "JKS");
         assertContains(results, "PKCS12");
         assertContains(results, "Sensitive Property: true");
+
+        // verify the right OnRemoved and OnShutdown methods were called
+        Assert.assertEquals(1, controllerService.getOnRemovedArgs());
+        Assert.assertEquals(1, controllerService.getOnRemovedNoArgs());
+
+        Assert.assertEquals(1, controllerService.getOnShutdownArgs());
+        Assert.assertEquals(1, controllerService.getOnShutdownNoArgs());
     }
 
     @Test
     public void testDocumentReportingTask() throws InitializationException, IOException {
 
-        ReportingTask reportingTask = new FullyDocumentedReportingTask();
-        reportingTask.initialize(new MockReportingInitializationContext());
+        FullyDocumentedReportingTask reportingTask = new FullyDocumentedReportingTask();
+        ReportingTaskingInitializer initializer = new ReportingTaskingInitializer();
+        initializer.initialize(reportingTask);
 
         DocumentationWriter writer = new HtmlDocumentationWriter();
 
@@ -99,6 +111,13 @@ public class HtmlDocumentationWriterTest {
         assertContains(results, "Specifies whether or not to show the difference in values between the current status and the previous status");
         assertContains(results, "true");
         assertContains(results, "false");
+
+        // verify the right OnRemoved and OnShutdown methods were called
+        Assert.assertEquals(1, reportingTask.getOnRemovedArgs());
+        Assert.assertEquals(1, reportingTask.getOnRemovedNoArgs());
+
+        Assert.assertEquals(1, reportingTask.getOnShutdownArgs());
+        Assert.assertEquals(1, reportingTask.getOnShutdownNoArgs());
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/53b86d7a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/ProcessorDocumentationWriterTest.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/ProcessorDocumentationWriterTest.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/ProcessorDocumentationWriterTest.java
index c421148..fda81fd 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/ProcessorDocumentationWriterTest.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/ProcessorDocumentationWriterTest.java
@@ -27,7 +27,8 @@ import org.apache.nifi.documentation.DocumentationWriter;
 import org.apache.nifi.documentation.example.FullyDocumentedProcessor;
 import org.apache.nifi.documentation.example.NakedProcessor;
 import org.apache.nifi.documentation.example.ProcessorWithLogger;
-import org.apache.nifi.documentation.mock.MockProcessorInitializationContext;
+import org.apache.nifi.documentation.init.ProcessorInitializer;
+import org.junit.Assert;
 import org.junit.Test;
 
 public class ProcessorDocumentationWriterTest {
@@ -35,7 +36,8 @@ public class ProcessorDocumentationWriterTest {
     @Test
     public void testFullyDocumentedProcessor() throws IOException {
         FullyDocumentedProcessor processor = new FullyDocumentedProcessor();
-        processor.initialize(new MockProcessorInitializationContext());
+        ProcessorInitializer initializer = new ProcessorInitializer();
+        initializer.initialize(processor);
 
         DocumentationWriter writer = new HtmlProcessorDocumentationWriter();
 
@@ -70,12 +72,20 @@ public class ProcessorDocumentationWriterTest {
         assertNotContains(results, "No description provided.");
         assertNotContains(results, "No Tags provided.");
         assertNotContains(results, "Additional Details...");
+
+        // verify the right OnRemoved and OnShutdown methods were called
+        Assert.assertEquals(1, processor.getOnRemovedArgs());
+        Assert.assertEquals(1, processor.getOnRemovedNoArgs());
+
+        Assert.assertEquals(1, processor.getOnShutdownArgs());
+        Assert.assertEquals(1, processor.getOnShutdownNoArgs());
     }
 
     @Test
     public void testNakedProcessor() throws IOException {
         NakedProcessor processor = new NakedProcessor();
-        processor.initialize(new MockProcessorInitializationContext());
+        ProcessorInitializer initializer = new ProcessorInitializer();
+        initializer.initialize(processor);
 
         DocumentationWriter writer = new HtmlProcessorDocumentationWriter();
 
@@ -103,7 +113,8 @@ public class ProcessorDocumentationWriterTest {
     @Test
     public void testProcessorWithLoggerInitialization() throws IOException {
         ProcessorWithLogger processor = new ProcessorWithLogger();
-        processor.initialize(new MockProcessorInitializationContext());
+        ProcessorInitializer initializer = new ProcessorInitializer();
+        initializer.initialize(processor);
 
         DocumentationWriter writer = new HtmlProcessorDocumentationWriter();
 



[13/17] incubator-nifi git commit: NIFI-632 moving thread startup from constructor to initialize methods

Posted by da...@apache.org.
NIFI-632 moving thread startup from constructor to initialize methods


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

Branch: refs/heads/develop
Commit: e1a59c47b7373c1165cc10623e4a2c945e470a4b
Parents: 53b86d7
Author: danbress <db...@onyxconsults.com>
Authored: Sat Jun 13 12:22:38 2015 -0400
Committer: danbress <db...@onyxconsults.com>
Committed: Sat Jun 13 12:22:38 2015 -0400

----------------------------------------------------------------------
 .../repository/FileSystemRepository.java        | 34 ++++++++++----------
 .../repository/VolatileContentRepository.java   |  8 ++---
 2 files changed, 21 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e1a59c47/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java
index 3a03fad..1171636 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java
@@ -130,7 +130,6 @@ public class FileSystemRepository implements ContentRepository {
         final String maxArchiveRetentionPeriod = properties.getProperty(NiFiProperties.CONTENT_ARCHIVE_MAX_RETENTION_PERIOD);
         final String maxArchiveSize = properties.getProperty(NiFiProperties.CONTENT_ARCHIVE_MAX_USAGE_PERCENTAGE);
         final String archiveBackPressureSize = properties.getProperty(NiFiProperties.CONTENT_ARCHIVE_BACK_PRESSURE_PERCENTAGE);
-        final String archiveCleanupFrequency = properties.getProperty(NiFiProperties.CONTENT_ARCHIVE_CLEANUP_FREQUENCY);
 
         if ("true".equalsIgnoreCase(enableArchiving)) {
             archiveData = true;
@@ -193,6 +192,23 @@ public class FileSystemRepository implements ContentRepository {
         LOG.info("Initializing FileSystemRepository with 'Always Sync' set to {}", alwaysSync);
         initializeRepository();
 
+        containerCleanupExecutor = new FlowEngine(containers.size(), "Cleanup FileSystemRepository Container", true);
+    }
+
+    @Override
+    public void initialize(final ContentClaimManager claimManager) {
+        this.contentClaimManager = claimManager;
+
+        final NiFiProperties properties = NiFiProperties.getInstance();
+
+        final Map<String, Path> fileRespositoryPaths = properties.getContentRepositoryPaths();
+
+        executor.scheduleWithFixedDelay(new BinDestructableClaims(), 1, 1, TimeUnit.SECONDS);
+        for (int i = 0; i < fileRespositoryPaths.size(); i++) {
+            executor.scheduleWithFixedDelay(new ArchiveOrDestroyDestructableClaims(), 1, 1, TimeUnit.SECONDS);
+        }
+
+        final String archiveCleanupFrequency = properties.getProperty(NiFiProperties.CONTENT_ARCHIVE_CLEANUP_FREQUENCY);
         final long cleanupMillis;
         if (archiveCleanupFrequency == null) {
             cleanupMillis = 1000L;
@@ -203,8 +219,6 @@ public class FileSystemRepository implements ContentRepository {
                 throw new RuntimeException("Invalid value set for property " + NiFiProperties.CONTENT_ARCHIVE_CLEANUP_FREQUENCY);
             }
         }
-
-        containerCleanupExecutor = new FlowEngine(containers.size(), "Cleanup FileSystemRepository Container", true);
         for (final Map.Entry<String, Path> containerEntry : containers.entrySet()) {
             final String containerName = containerEntry.getKey();
             final Path containerPath = containerEntry.getValue();
@@ -214,20 +228,6 @@ public class FileSystemRepository implements ContentRepository {
     }
 
     @Override
-    public void initialize(final ContentClaimManager claimManager) {
-        this.contentClaimManager = claimManager;
-
-        final NiFiProperties properties = NiFiProperties.getInstance();
-
-        final Map<String, Path> fileRespositoryPaths = properties.getContentRepositoryPaths();
-
-        executor.scheduleWithFixedDelay(new BinDestructableClaims(), 1, 1, TimeUnit.SECONDS);
-        for (int i = 0; i < fileRespositoryPaths.size(); i++) {
-            executor.scheduleWithFixedDelay(new ArchiveOrDestroyDestructableClaims(), 1, 1, TimeUnit.SECONDS);
-        }
-    }
-
-    @Override
     public void shutdown() {
         executor.shutdown();
         containerCleanupExecutor.shutdown();

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e1a59c47/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/VolatileContentRepository.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/VolatileContentRepository.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/VolatileContentRepository.java
index 5971865..6109ba3 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/VolatileContentRepository.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/VolatileContentRepository.java
@@ -118,15 +118,15 @@ public class VolatileContentRepository implements ContentRepository {
         }
 
         memoryManager = new MemoryManager(maxBytes, blockSize);
-
-        for (int i = 0; i < 3; i++) {
-            executor.scheduleWithFixedDelay(new CleanupOldClaims(), 1000, 10, TimeUnit.MILLISECONDS);
-        }
     }
 
     @Override
     public void initialize(final ContentClaimManager claimManager) {
         this.claimManager = claimManager;
+
+        for (int i = 0; i < 3; i++) {
+            executor.scheduleWithFixedDelay(new CleanupOldClaims(), 1000, 10, TimeUnit.MILLISECONDS);
+        }
     }
 
     @Override


[05/17] incubator-nifi git commit: NIFI-632 - improving tests

Posted by da...@apache.org.
NIFI-632 - improving tests


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

Branch: refs/heads/develop
Commit: f2818d2263c807f90761b5697ad3df3c727b23fd
Parents: e4e9efa
Author: danbress <db...@onyxconsults.com>
Authored: Sat May 30 12:14:17 2015 -0400
Committer: danbress <db...@onyxconsults.com>
Committed: Tue Jun 9 21:34:24 2015 -0400

----------------------------------------------------------------------
 .../nifi/processors/WriteResourceToStream.java  |   8 ++++----
 .../nifi/documentation/DocGeneratorTest.java    |   4 ++++
 .../src/test/resources/lib/example.nar          | Bin 720984 -> 721040 bytes
 3 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/f2818d22/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/src/main/java/org/apache/nifi/processors/WriteResourceToStream.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/src/main/java/org/apache/nifi/processors/WriteResourceToStream.java b/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/src/main/java/org/apache/nifi/processors/WriteResourceToStream.java
index 7849128..5d595b4 100644
--- a/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/src/main/java/org/apache/nifi/processors/WriteResourceToStream.java
+++ b/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/src/main/java/org/apache/nifi/processors/WriteResourceToStream.java
@@ -35,16 +35,16 @@ import org.apache.nifi.processor.Relationship;
 import org.apache.nifi.processor.exception.ProcessException;
 import org.apache.nifi.processor.io.OutputStreamCallback;
 
-@Tags({ "example" })
-@CapabilityDescription("Provide a description")
+@Tags({ "example", "resources" })
+@CapabilityDescription("This example processor loads a resource from the nar and writes it to the FlowFile content")
 public class WriteResourceToStream extends AbstractProcessor {
 
     public static final Relationship REL_SUCCESS = new Relationship.Builder()
             .name("success")
             .description("files that were successfully processed").build();
     public static final Relationship REL_FAILURE = new Relationship.Builder()
-            .name("success")
-            .description("files that were notsuccessfully processed").build();
+            .name("failure")
+            .description("files that were not successfully processed").build();
 
     private Set<Relationship> relationships;
 

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/f2818d22/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java
index 83db414..9438601 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java
@@ -54,6 +54,10 @@ public class DocGeneratorTest {
         Assert.assertTrue(indexHtml + " should have been generated", indexHtml.exists());
         String generatedHtml = FileUtils.readFileToString(indexHtml);
         Assert.assertNotNull(generatedHtml);
+        Assert.assertTrue(generatedHtml.contains("This example processor loads a resource from the nar and writes it to the FlowFile content"));
+        Assert.assertTrue(generatedHtml.contains("files that were successfully processed"));
+        Assert.assertTrue(generatedHtml.contains("files that were not successfully processed"));
+        Assert.assertTrue(generatedHtml.contains("resources"));
     }
 
     private NiFiProperties loadSpecifiedProperties(String propertiesFile) {

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/f2818d22/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/lib/example.nar
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/lib/example.nar b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/lib/example.nar
index 5c0182b..0bca10b 100644
Binary files a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/lib/example.nar and b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/lib/example.nar differ


[15/17] incubator-nifi git commit: Merge branch 'develop' into NIFI-632

Posted by da...@apache.org.
Merge branch 'develop' into NIFI-632


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

Branch: refs/heads/develop
Commit: 46aa2685e3162ee6afbf68a0ac68d5206cb9c500
Parents: cad8aa1 3295f7f
Author: danbress <db...@onyxconsults.com>
Authored: Mon Jun 15 20:38:54 2015 -0400
Committer: danbress <db...@onyxconsults.com>
Committed: Mon Jun 15 20:38:54 2015 -0400

----------------------------------------------------------------------
 nifi-site/Gruntfile.js                          |  2 +-
 nifi-site/src/pages/html/faq.hbs                |  6 +--
 nifi-site/src/pages/html/people.hbs             |  5 ++
 .../propertytable/jquery.propertytable.js       | 51 +++++++++++++-------
 .../nifi-standard-processors/pom.xml            |  8 ++-
 .../standard/AbstractJsonPathProcessor.java     |  5 +-
 .../additionalDetails.html                      |  2 +-
 .../standard/TestEvaluateJsonPath.java          | 19 ++++++++
 .../resources/TestJson/control-characters.json  |  7 +++
 9 files changed, 79 insertions(+), 26 deletions(-)
----------------------------------------------------------------------



[09/17] incubator-nifi git commit: NIFI-632 using NarCloseable instead of NarThreadContextClassLoader to make sure the right classloader is being used when initializing a component for documentation generation

Posted by da...@apache.org.
NIFI-632 using NarCloseable instead of NarThreadContextClassLoader
to make sure the right classloader is being used when initializing
a component for documentation generation


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

Branch: refs/heads/develop
Commit: 196da2b443645f5029ab9d8ddf381e3a58e42969
Parents: 995a016
Author: danbress <db...@onyxconsults.com>
Authored: Mon Jun 8 22:05:49 2015 -0400
Committer: danbress <db...@onyxconsults.com>
Committed: Tue Jun 9 21:34:26 2015 -0400

----------------------------------------------------------------------
 .../nifi-framework/nifi-documentation/pom.xml   |  4 ---
 .../apache/nifi/documentation/DocGenerator.java | 26 ++++++--------------
 .../init/ControllerServiceInitializer.java      |  6 ++++-
 .../init/ProcessorInitializer.java              |  5 +++-
 .../init/ReportingTaskingInitializer.java       |  5 +++-
 5 files changed, 21 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/196da2b4/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/pom.xml b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/pom.xml
index 66febbb..340f2c5 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/pom.xml
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/pom.xml
@@ -28,10 +28,6 @@
         </dependency>
         <dependency>
             <groupId>org.apache.nifi</groupId>
-            <artifactId>nifi-framework-core-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.nifi</groupId>
             <artifactId>nifi-properties</artifactId>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/196da2b4/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/DocGenerator.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/DocGenerator.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/DocGenerator.java
index c817bfa..7c32bf8 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/DocGenerator.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/DocGenerator.java
@@ -33,7 +33,6 @@ import org.apache.nifi.documentation.init.ControllerServiceInitializer;
 import org.apache.nifi.documentation.init.ProcessorInitializer;
 import org.apache.nifi.documentation.init.ReportingTaskingInitializer;
 import org.apache.nifi.nar.ExtensionManager;
-import org.apache.nifi.nar.NarThreadContextClassLoader;
 import org.apache.nifi.processor.Processor;
 import org.apache.nifi.reporting.InitializationException;
 import org.apache.nifi.reporting.ReportingTask;
@@ -69,25 +68,16 @@ public class DocGenerator {
         logger.debug("Generating documentation for: " + extensionClasses.size() + " components in: "
                 + explodedNiFiDocsDir);
 
-        // save the original class loader and use a NarThreadContextClassLoader
-        final ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
-        try {
-            Thread.currentThread().setContextClassLoader(NarThreadContextClassLoader.getInstance());
-
-            for (final Class<?> extensionClass : extensionClasses) {
-                if (ConfigurableComponent.class.isAssignableFrom(extensionClass)) {
-                    final Class<? extends ConfigurableComponent> componentClass = extensionClass
-                            .asSubclass(ConfigurableComponent.class);
-                    try {
-                        logger.debug("Documenting: " + componentClass);
-                        document(explodedNiFiDocsDir, componentClass);
-                    } catch (Exception e) {
-                        logger.warn("Unable to document: " + componentClass, e);
-                    }
+        for (final Class<?> extensionClass : extensionClasses) {
+            if (ConfigurableComponent.class.isAssignableFrom(extensionClass)) {
+                final Class<? extends ConfigurableComponent> componentClass = extensionClass.asSubclass(ConfigurableComponent.class);
+                try {
+                    logger.debug("Documenting: " + componentClass);
+                    document(explodedNiFiDocsDir, componentClass);
+                } catch (Exception e) {
+                    logger.warn("Unable to document: " + componentClass, e);
                 }
             }
-        } finally {
-            Thread.currentThread().setContextClassLoader(originalClassLoader);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/196da2b4/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ControllerServiceInitializer.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ControllerServiceInitializer.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ControllerServiceInitializer.java
index 3c66485..0f654ec 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ControllerServiceInitializer.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ControllerServiceInitializer.java
@@ -20,6 +20,7 @@ import org.apache.nifi.components.ConfigurableComponent;
 import org.apache.nifi.controller.ControllerService;
 import org.apache.nifi.documentation.ConfigurableComponentInitializer;
 import org.apache.nifi.documentation.mock.MockControllerServiceInitializationContext;
+import org.apache.nifi.nar.NarCloseable;
 import org.apache.nifi.reporting.InitializationException;
 
 /**
@@ -33,6 +34,9 @@ public class ControllerServiceInitializer implements ConfigurableComponentInitia
     @Override
     public void initialize(ConfigurableComponent component) throws InitializationException {
         ControllerService controllerService = (ControllerService) component;
-        controllerService.initialize(new MockControllerServiceInitializationContext());
+
+        try (NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+            controllerService.initialize(new MockControllerServiceInitializationContext());
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/196da2b4/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ProcessorInitializer.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ProcessorInitializer.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ProcessorInitializer.java
index 07e9c3a..331db71 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ProcessorInitializer.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ProcessorInitializer.java
@@ -19,6 +19,7 @@ package org.apache.nifi.documentation.init;
 import org.apache.nifi.components.ConfigurableComponent;
 import org.apache.nifi.documentation.ConfigurableComponentInitializer;
 import org.apache.nifi.documentation.mock.MockProcessorInitializationContext;
+import org.apache.nifi.nar.NarCloseable;
 import org.apache.nifi.processor.Processor;
 
 /**
@@ -31,7 +32,9 @@ public class ProcessorInitializer implements ConfigurableComponentInitializer {
     @Override
     public void initialize(ConfigurableComponent component) {
         Processor processor = (Processor) component;
-        processor.initialize(new MockProcessorInitializationContext());
+        try (NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+            processor.initialize(new MockProcessorInitializationContext());
+        }
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/196da2b4/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ReportingTaskingInitializer.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ReportingTaskingInitializer.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ReportingTaskingInitializer.java
index 6fcfca9..49291a7 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ReportingTaskingInitializer.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ReportingTaskingInitializer.java
@@ -19,6 +19,7 @@ package org.apache.nifi.documentation.init;
 import org.apache.nifi.components.ConfigurableComponent;
 import org.apache.nifi.documentation.ConfigurableComponentInitializer;
 import org.apache.nifi.documentation.mock.MockReportingInitializationContext;
+import org.apache.nifi.nar.NarCloseable;
 import org.apache.nifi.reporting.InitializationException;
 import org.apache.nifi.reporting.ReportingTask;
 
@@ -32,6 +33,8 @@ public class ReportingTaskingInitializer implements ConfigurableComponentInitial
     @Override
     public void initialize(ConfigurableComponent component) throws InitializationException {
         ReportingTask reportingTask = (ReportingTask) component;
-        reportingTask.initialize(new MockReportingInitializationContext());
+        try (NarCloseable narCloseable = NarCloseable.withNarLoader()) {
+            reportingTask.initialize(new MockReportingInitializationContext());
+        }
     }
 }


[02/17] incubator-nifi git commit: NIFI-632 generating a test nar which loads a resource during its init method

Posted by da...@apache.org.
NIFI-632 generating a test nar which loads a resource during its init method


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

Branch: refs/heads/develop
Commit: b4ee97c77135379bb1f659dced51e790050c5eb4
Parents: 30055dd
Author: danbress <db...@onyxconsults.com>
Authored: Sat May 30 11:38:55 2015 -0400
Committer: danbress <db...@onyxconsults.com>
Committed: Tue Jun 9 21:34:21 2015 -0400

----------------------------------------------------------------------
 .../nifi-nifi-example-nar/pom.xml               |  36 +++++++
 .../nifi-nifi-example-processors/pom.xml        |  70 +++++++++++++
 .../nifi/processors/WriteResourceToStream.java  | 102 +++++++++++++++++++
 .../org.apache.nifi.processor.Processor         |  15 +++
 .../src/main/resources/file.txt                 |   1 +
 .../processors/WriteResourceToStreamTest.java   |  47 +++++++++
 nifi/nifi-external/nifi-example-bundle/pom.xml  |  33 ++++++
 nifi/nifi-external/pom.xml                      |   2 +
 8 files changed, 306 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b4ee97c7/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-nar/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-nar/pom.xml b/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-nar/pom.xml
new file mode 100644
index 0000000..55df946
--- /dev/null
+++ b/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-nar/pom.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.nifi</groupId>
+        <artifactId>nifi-example-bundle</artifactId>
+        <version>0.1.1-incubating-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>nifi-nifi-example-nar</artifactId>
+    <packaging>nar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-nifi-example-processors</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b4ee97c7/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/pom.xml b/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/pom.xml
new file mode 100644
index 0000000..b4fbc85
--- /dev/null
+++ b/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/pom.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.nifi</groupId>
+        <artifactId>nifi-example-bundle</artifactId>
+        <version>0.1.1-incubating-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>nifi-nifi-example-processors</artifactId>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-processor-utils</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-mock</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
+                <configuration>
+                    <excludes>
+                        <exclude>src/main/resources/file.txt</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b4ee97c7/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/src/main/java/org/apache/nifi/processors/WriteResourceToStream.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/src/main/java/org/apache/nifi/processors/WriteResourceToStream.java b/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/src/main/java/org/apache/nifi/processors/WriteResourceToStream.java
new file mode 100644
index 0000000..7849128
--- /dev/null
+++ b/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/src/main/java/org/apache/nifi/processors/WriteResourceToStream.java
@@ -0,0 +1,102 @@
+/*
+ * 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;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnScheduled;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.processor.AbstractProcessor;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.ProcessorInitializationContext;
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.nifi.processor.io.OutputStreamCallback;
+
+@Tags({ "example" })
+@CapabilityDescription("Provide a description")
+public class WriteResourceToStream extends AbstractProcessor {
+
+    public static final Relationship REL_SUCCESS = new Relationship.Builder()
+            .name("success")
+            .description("files that were successfully processed").build();
+    public static final Relationship REL_FAILURE = new Relationship.Builder()
+            .name("success")
+            .description("files that were notsuccessfully processed").build();
+
+    private Set<Relationship> relationships;
+
+    private String resourceData;
+
+    @Override
+    protected void init(final ProcessorInitializationContext context) {
+
+        final Set<Relationship> relationships = new HashSet<Relationship>();
+        relationships.add(REL_SUCCESS);
+        relationships.add(REL_FAILURE);
+        this.relationships = Collections.unmodifiableSet(relationships);
+
+        try {
+            this.resourceData = IOUtils.toString(Thread.currentThread()
+                    .getContextClassLoader().getResourceAsStream("file.txt"));
+        } catch (IOException e) {
+            throw new RuntimeException("Unable to load resources", e);
+        }
+    }
+
+    @Override
+    public Set<Relationship> getRelationships() {
+        return this.relationships;
+    }
+
+    @OnScheduled
+    public void onScheduled(final ProcessContext context) {
+
+    }
+
+    @Override
+    public void onTrigger(final ProcessContext context,
+            final ProcessSession session) throws ProcessException {
+        FlowFile flowFile = session.get();
+        if (flowFile == null) {
+            return;
+        }
+
+        try {
+            flowFile = session.write(flowFile, new OutputStreamCallback() {
+
+                @Override
+                public void process(OutputStream out) throws IOException {
+                    IOUtils.write(resourceData, out);
+
+                }
+            });
+            session.transfer(flowFile, REL_SUCCESS);
+        } catch (ProcessException ex) {
+            getLogger().error("Unable to process", ex);
+            session.transfer(flowFile, REL_FAILURE);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b4ee97c7/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor
----------------------------------------------------------------------
diff --git a/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor b/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor
new file mode 100644
index 0000000..9448541
--- /dev/null
+++ b/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor
@@ -0,0 +1,15 @@
+# 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.
+org.apache.nifi.processors.WriteResourceToStream
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b4ee97c7/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/src/main/resources/file.txt
----------------------------------------------------------------------
diff --git a/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/src/main/resources/file.txt b/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/src/main/resources/file.txt
new file mode 100644
index 0000000..f0e1d6c
--- /dev/null
+++ b/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/src/main/resources/file.txt
@@ -0,0 +1 @@
+this came from a resource
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b4ee97c7/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/src/test/java/org/apache/nifi/processors/WriteResourceToStreamTest.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/src/test/java/org/apache/nifi/processors/WriteResourceToStreamTest.java b/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/src/test/java/org/apache/nifi/processors/WriteResourceToStreamTest.java
new file mode 100644
index 0000000..7a84df5
--- /dev/null
+++ b/nifi/nifi-external/nifi-example-bundle/nifi-nifi-example-processors/src/test/java/org/apache/nifi/processors/WriteResourceToStreamTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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;
+
+import org.junit.Assert;
+
+import org.apache.nifi.util.TestRunner;
+import org.apache.nifi.util.TestRunners;
+import org.junit.Before;
+import org.junit.Test;
+
+public class WriteResourceToStreamTest {
+
+    private TestRunner testRunner;
+
+    @Before
+    public void init() {
+        testRunner = TestRunners.newTestRunner(WriteResourceToStream.class);
+    }
+
+    @Test
+    public void testProcessor() {
+        testRunner.enqueue(new byte[] { 1, 2, 3, 4, 5 });
+        testRunner.run();
+        testRunner.assertAllFlowFilesTransferred(WriteResourceToStream.REL_SUCCESS, 1);
+        final byte[] data = testRunner
+                .getFlowFilesForRelationship(WriteResourceToStream.REL_SUCCESS).get(0)
+                .toByteArray();
+        final String stringData = new String(data);
+        Assert.assertEquals("this came from a resource", stringData);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b4ee97c7/nifi/nifi-external/nifi-example-bundle/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-external/nifi-example-bundle/pom.xml b/nifi/nifi-external/nifi-example-bundle/pom.xml
new file mode 100644
index 0000000..f1e4753
--- /dev/null
+++ b/nifi/nifi-external/nifi-example-bundle/pom.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.nifi</groupId>
+        <artifactId>nifi-nar-bundles</artifactId>
+        <version>0.1.1-incubating-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>nifi-example-bundle</artifactId>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>nifi-nifi-example-processors</module>
+        <module>nifi-nifi-example-nar</module>
+    </modules>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b4ee97c7/nifi/nifi-external/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-external/pom.xml b/nifi/nifi-external/pom.xml
index 0c70c4a..8a2e585 100644
--- a/nifi/nifi-external/pom.xml
+++ b/nifi/nifi-external/pom.xml
@@ -26,5 +26,7 @@
     <modules>
         <module>nifi-spark-receiver</module>
         <module>nifi-storm-spout</module>
+        <module>nifi-example-bundle</module>
     </modules>
 </project>
+


[07/17] incubator-nifi git commit: NIFI-632 - fixing parent pom

Posted by da...@apache.org.
NIFI-632 - fixing parent pom


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

Branch: refs/heads/develop
Commit: dc4065a97589fa4e60c18fecea13029b309af95e
Parents: f2818d2
Author: danbress <db...@onyxconsults.com>
Authored: Mon Jun 1 20:20:57 2015 -0400
Committer: danbress <db...@onyxconsults.com>
Committed: Tue Jun 9 21:34:25 2015 -0400

----------------------------------------------------------------------
 nifi/nifi-external/nifi-example-bundle/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/dc4065a9/nifi/nifi-external/nifi-example-bundle/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-external/nifi-example-bundle/pom.xml b/nifi/nifi-external/nifi-example-bundle/pom.xml
index f1e4753..542a673 100644
--- a/nifi/nifi-external/nifi-example-bundle/pom.xml
+++ b/nifi/nifi-external/nifi-example-bundle/pom.xml
@@ -18,7 +18,7 @@
 
     <parent>
         <groupId>org.apache.nifi</groupId>
-        <artifactId>nifi-nar-bundles</artifactId>
+        <artifactId>nifi-external</artifactId>
         <version>0.1.1-incubating-SNAPSHOT</version>
     </parent>
 


[04/17] incubator-nifi git commit: NIFI-632 using NarThreadContextClassLoader when generating documentation

Posted by da...@apache.org.
NIFI-632 using NarThreadContextClassLoader when generating documentation


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

Branch: refs/heads/develop
Commit: 4074ec37858b5fc42074468c981d507cdae4d402
Parents: 6f36c79
Author: danbress <db...@onyxconsults.com>
Authored: Sat May 30 12:04:46 2015 -0400
Committer: danbress <db...@onyxconsults.com>
Committed: Tue Jun 9 21:34:23 2015 -0400

----------------------------------------------------------------------
 .../nifi-framework/nifi-documentation/pom.xml   |  4 +++
 .../apache/nifi/documentation/DocGenerator.java | 27 +++++++++++++-------
 2 files changed, 22 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/4074ec37/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/pom.xml b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/pom.xml
index 340f2c5..66febbb 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/pom.xml
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/pom.xml
@@ -28,6 +28,10 @@
         </dependency>
         <dependency>
             <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-framework-core-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
             <artifactId>nifi-properties</artifactId>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/4074ec37/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/DocGenerator.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/DocGenerator.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/DocGenerator.java
index 0e9ed37..c817bfa 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/DocGenerator.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/DocGenerator.java
@@ -33,6 +33,7 @@ import org.apache.nifi.documentation.init.ControllerServiceInitializer;
 import org.apache.nifi.documentation.init.ProcessorInitializer;
 import org.apache.nifi.documentation.init.ReportingTaskingInitializer;
 import org.apache.nifi.nar.ExtensionManager;
+import org.apache.nifi.nar.NarThreadContextClassLoader;
 import org.apache.nifi.processor.Processor;
 import org.apache.nifi.reporting.InitializationException;
 import org.apache.nifi.reporting.ReportingTask;
@@ -68,17 +69,25 @@ public class DocGenerator {
         logger.debug("Generating documentation for: " + extensionClasses.size() + " components in: "
                 + explodedNiFiDocsDir);
 
-        for (final Class<?> extensionClass : extensionClasses) {
-            if (ConfigurableComponent.class.isAssignableFrom(extensionClass)) {
-                final Class<? extends ConfigurableComponent> componentClass = extensionClass
-                        .asSubclass(ConfigurableComponent.class);
-                try {
-                    logger.debug("Documenting: " + componentClass);
-                    document(explodedNiFiDocsDir, componentClass);
-                } catch (Exception e) {
-                    logger.warn("Unable to document: " + componentClass, e);
+        // save the original class loader and use a NarThreadContextClassLoader
+        final ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
+        try {
+            Thread.currentThread().setContextClassLoader(NarThreadContextClassLoader.getInstance());
+
+            for (final Class<?> extensionClass : extensionClasses) {
+                if (ConfigurableComponent.class.isAssignableFrom(extensionClass)) {
+                    final Class<? extends ConfigurableComponent> componentClass = extensionClass
+                            .asSubclass(ConfigurableComponent.class);
+                    try {
+                        logger.debug("Documenting: " + componentClass);
+                        document(explodedNiFiDocsDir, componentClass);
+                    } catch (Exception e) {
+                        logger.warn("Unable to document: " + componentClass, e);
+                    }
                 }
             }
+        } finally {
+            Thread.currentThread().setContextClassLoader(originalClassLoader);
         }
     }
 


[17/17] incubator-nifi git commit: Merge branch 'develop' into NIFI-632

Posted by da...@apache.org.
Merge branch 'develop' into NIFI-632


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

Branch: refs/heads/develop
Commit: 40b55efbd7082935accb37c17bacbcb8d1f1cd38
Parents: 28bfb70 f58972e
Author: danbress <db...@onyxconsults.com>
Authored: Fri Jun 26 19:14:23 2015 -0400
Committer: danbress <db...@onyxconsults.com>
Committed: Fri Jun 26 19:14:23 2015 -0400

----------------------------------------------------------------------
 .../nifi/provenance/lineage/LineageNode.java    |   1 +
 nifi/nifi-assembly/pom.xml                      |   1 +
 .../nifi/provenance/lineage/EventNode.java      |   2 +
 .../nifi/provenance/lineage/FlowFileNode.java   |   1 +
 .../language/antlr/AttributeExpressionLexer.g   |   1 +
 .../language/antlr/AttributeExpressionParser.g  |   3 +-
 .../attribute/expression/language/Query.java    | 255 ++++++++++------
 .../language/evaluation/BooleanEvaluator.java   |  11 +
 .../language/evaluation/DateEvaluator.java      |  11 +
 .../language/evaluation/Evaluator.java          |  12 +
 .../language/evaluation/NumberEvaluator.java    |  10 +
 .../language/evaluation/StringEvaluator.java    |  11 +
 .../evaluation/functions/AndEvaluator.java      |   6 +-
 .../evaluation/functions/AppendEvaluator.java   |   6 +-
 .../functions/AttributeEvaluator.java           |   4 +-
 .../evaluation/functions/ContainsEvaluator.java |   7 +-
 .../evaluation/functions/DivideEvaluator.java   |   6 +-
 .../evaluation/functions/EndsWithEvaluator.java |   7 +-
 .../evaluation/functions/FindEvaluator.java     |   7 +-
 .../evaluation/functions/FormatEvaluator.java   |   4 +-
 .../functions/GreaterThanEvaluator.java         |   7 +-
 .../functions/GreaterThanOrEqualEvaluator.java  |   7 +-
 .../evaluation/functions/IndexOfEvaluator.java  |   7 +-
 .../functions/LastIndexOfEvaluator.java         |   7 +-
 .../evaluation/functions/LengthEvaluator.java   |   7 +-
 .../evaluation/functions/LessThanEvaluator.java |   7 +-
 .../functions/LessThanOrEqualEvaluator.java     |   7 +-
 .../evaluation/functions/MatchesEvaluator.java  |   7 +-
 .../evaluation/functions/MinusEvaluator.java    |   6 +-
 .../evaluation/functions/ModEvaluator.java      |   6 +-
 .../evaluation/functions/MultiplyEvaluator.java |   6 +-
 .../evaluation/functions/NotEvaluator.java      |   4 +-
 .../functions/NumberToDateEvaluator.java        |   5 +-
 .../evaluation/functions/OrEvaluator.java       |   6 +-
 .../evaluation/functions/PlusEvaluator.java     |   6 +-
 .../evaluation/functions/PrependEvaluator.java  |   6 +-
 .../functions/ReplaceAllEvaluator.java          |   8 +-
 .../functions/ReplaceEmptyEvaluator.java        |   6 +-
 .../evaluation/functions/ReplaceEvaluator.java  |   8 +-
 .../functions/ReplaceNullEvaluator.java         |   6 +-
 .../functions/StartsWithEvaluator.java          |   7 +-
 .../functions/StringToDateEvaluator.java        |   7 +-
 .../functions/SubstringAfterEvaluator.java      |   6 +-
 .../functions/SubstringAfterLastEvaluator.java  |   6 +-
 .../functions/SubstringBeforeEvaluator.java     |   6 +-
 .../functions/SubstringBeforeLastEvaluator.java |   6 +-
 .../functions/SubstringEvaluator.java           |  11 +-
 .../evaluation/functions/ToLowerEvaluator.java  |   6 +-
 .../evaluation/functions/ToNumberEvaluator.java |   7 +-
 .../evaluation/functions/ToRadixEvaluator.java  |  11 +-
 .../evaluation/functions/ToUpperEvaluator.java  |   6 +-
 .../evaluation/functions/TrimEvaluator.java     |   4 +-
 .../functions/UrlDecodeEvaluator.java           |   6 +-
 .../functions/UrlEncodeEvaluator.java           |   6 +-
 .../evaluation/literals/ToLiteralEvaluator.java |  43 +++
 .../evaluation/reduce/JoinEvaluator.java        |   6 +-
 .../selection/AllAttributesEvaluator.java       |   7 +-
 .../selection/AnyAttributeEvaluator.java        |   7 +-
 .../AnyMatchingAttributeEvaluator.java          |  21 --
 .../selection/DelineatedAttributeEvaluator.java |  12 +-
 .../selection/IteratingEvaluator.java           |  33 ++
 .../evaluation/selection/MappingEvaluator.java  |  11 +-
 .../selection/MultiAttributeEvaluator.java      |   3 +-
 .../selection/MultiMatchAttributeEvaluator.java |   5 +
 .../selection/MultiNamedAttributeEvaluator.java |   5 +
 .../expression/language/TestQuery.java          |  54 +++-
 .../org/apache/nifi/util/NiFiProperties.java    |  22 +-
 .../src/main/asciidoc/administration-guide.adoc |   2 +-
 .../asciidoc/expression-language-guide.adoc     |  26 +-
 .../nifi/util/MockConfigurationContext.java     |  18 +-
 .../nifi/util/StandardProcessorTestRunner.java  |  12 +-
 .../java/org/apache/nifi/util/TestRunner.java   |  45 +++
 .../CurrentTestStandardProcessorTestRunner.java |  71 +++++
 .../nifi/cluster/flow/impl/DataFlowDaoImpl.java |  15 +-
 .../repository/StandardProcessSession.java      |   2 +-
 .../repository/StandardProvenanceReporter.java  |   8 +-
 .../src/main/resources/bin/nifi.sh              |   4 +
 .../src/main/resources/conf/nifi.properties     |   3 +
 .../nifi-web-ui/src/main/webapp/css/main.css    |   1 +
 .../src/main/webapp/js/nf/canvas/nf-canvas.js   |   2 +-
 .../js/nf/canvas/nf-controller-service.js       |   4 +-
 .../src/main/webapp/js/nf/nf-common.js          |  17 ++
 .../apache/nifi/processors/kafka/PutKafka.java  | 301 ++++++++++++++-----
 .../nifi/processors/kafka/TestPutKafka.java     | 163 ++++++++++
 .../nifi/provenance/IndexConfiguration.java     |   2 +-
 .../PersistentProvenanceRepository.java         |  90 +++++-
 .../provenance/RepositoryConfiguration.java     |  18 ++
 .../nifi/provenance/StandardRecordReader.java   |  15 +-
 .../provenance/lucene/DeleteIndexAction.java    |   6 +-
 .../nifi/provenance/lucene/DocsReader.java      |   9 +-
 .../nifi/provenance/lucene/IndexSearch.java     |   7 +-
 .../nifi/provenance/lucene/LineageQuery.java    |   6 +-
 .../provenance/serialization/RecordReaders.java |  17 +-
 .../TestPersistentProvenanceRepository.java     |  39 ++-
 .../TestStandardRecordReaderWriter.java         |  10 +-
 .../nifi/processors/standard/ExtractText.java   |   4 +-
 .../nifi/processors/standard/GetHTTP.java       |  17 +-
 .../nifi/processors/standard/MergeContent.java  |  57 ++--
 98 files changed, 1342 insertions(+), 468 deletions(-)
----------------------------------------------------------------------



[14/17] incubator-nifi git commit: NIFI-632 adding VolatileContentRepository and VolatileFlowFile repository to service definition file

Posted by da...@apache.org.
NIFI-632 adding VolatileContentRepository and VolatileFlowFile repository to service definition file


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

Branch: refs/heads/develop
Commit: cad8aa11e1adb57052303912b9adc90aaeff708f
Parents: e1a59c4
Author: danbress <db...@onyxconsults.com>
Authored: Sat Jun 13 12:23:04 2015 -0400
Committer: danbress <db...@onyxconsults.com>
Committed: Sat Jun 13 12:23:04 2015 -0400

----------------------------------------------------------------------
 .../org.apache.nifi.controller.repository.ContentRepository       | 3 ++-
 .../org.apache.nifi.controller.repository.FlowFileRepository      | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/cad8aa11/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.repository.ContentRepository
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.repository.ContentRepository b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.repository.ContentRepository
index 6e0227b..8f68920 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.repository.ContentRepository
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.repository.ContentRepository
@@ -12,4 +12,5 @@
 # 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.
-org.apache.nifi.controller.repository.FileSystemRepository
\ No newline at end of file
+org.apache.nifi.controller.repository.FileSystemRepository
+org.apache.nifi.controller.repository.VolatileContentRepository
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/cad8aa11/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.repository.FlowFileRepository
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.repository.FlowFileRepository b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.repository.FlowFileRepository
index 0a91746..590dbc1 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.repository.FlowFileRepository
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/resources/META-INF/services/org.apache.nifi.controller.repository.FlowFileRepository
@@ -12,4 +12,5 @@
 # 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.
-org.apache.nifi.controller.repository.WriteAheadFlowFileRepository
\ No newline at end of file
+org.apache.nifi.controller.repository.WriteAheadFlowFileRepository
+org.apache.nifi.controller.repository.VolatileFlowFileRepository
\ No newline at end of file


[11/17] incubator-nifi git commit: NIFI-632 moving thread start to init method

Posted by da...@apache.org.
NIFI-632 moving thread start to init method


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

Branch: refs/heads/develop
Commit: 089a27f227afac1bff960d0b8cc0f31d206156d2
Parents: 196da2b
Author: danbress <db...@onyxconsults.com>
Authored: Mon Jun 8 22:06:23 2015 -0400
Committer: danbress <db...@onyxconsults.com>
Committed: Tue Jun 9 21:34:27 2015 -0400

----------------------------------------------------------------------
 .../controller/repository/FileSystemRepository.java   | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/089a27f2/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java
index e212bdb..3a03fad 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java
@@ -193,11 +193,6 @@ public class FileSystemRepository implements ContentRepository {
         LOG.info("Initializing FileSystemRepository with 'Always Sync' set to {}", alwaysSync);
         initializeRepository();
 
-        executor.scheduleWithFixedDelay(new BinDestructableClaims(), 1, 1, TimeUnit.SECONDS);
-        for (int i = 0; i < fileRespositoryPaths.size(); i++) {
-            executor.scheduleWithFixedDelay(new ArchiveOrDestroyDestructableClaims(), 1, 1, TimeUnit.SECONDS);
-        }
-
         final long cleanupMillis;
         if (archiveCleanupFrequency == null) {
             cleanupMillis = 1000L;
@@ -221,6 +216,15 @@ public class FileSystemRepository implements ContentRepository {
     @Override
     public void initialize(final ContentClaimManager claimManager) {
         this.contentClaimManager = claimManager;
+
+        final NiFiProperties properties = NiFiProperties.getInstance();
+
+        final Map<String, Path> fileRespositoryPaths = properties.getContentRepositoryPaths();
+
+        executor.scheduleWithFixedDelay(new BinDestructableClaims(), 1, 1, TimeUnit.SECONDS);
+        for (int i = 0; i < fileRespositoryPaths.size(); i++) {
+            executor.scheduleWithFixedDelay(new ArchiveOrDestroyDestructableClaims(), 1, 1, TimeUnit.SECONDS);
+        }
     }
 
     @Override


[16/17] incubator-nifi git commit: Merge branch 'develop' into NIFI-632

Posted by da...@apache.org.
Merge branch 'develop' into NIFI-632


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

Branch: refs/heads/develop
Commit: 28bfb70e46a3099139e810b5ee93d7335ddb880c
Parents: 46aa268 33848b3
Author: danbress <db...@onyxconsults.com>
Authored: Sun Jun 21 13:21:55 2015 -0400
Committer: danbress <db...@onyxconsults.com>
Committed: Sun Jun 21 13:21:55 2015 -0400

----------------------------------------------------------------------
 nifi-site/src/pages/html/people.hbs             |   5 +
 .../src/main/assembly/dependencies.xml          |   2 +
 nifi/nifi-bootstrap/pom.xml                     |   7 +
 .../org/apache/nifi/bootstrap/NiFiListener.java |  13 +-
 .../java/org/apache/nifi/bootstrap/RunNiFi.java | 395 +++++++------
 .../org/apache/nifi/bootstrap/ShutdownHook.java |   6 +-
 .../nifi/processor/util/SSLProperties.java      |  10 +-
 .../apache/nifi/util/NiFiPropertiesTest.java    |  13 +-
 .../nifi/security/util/SslContextFactory.java   |  15 +-
 .../apache/nifi/util/MockProcessSession.java    |  40 +-
 .../nifi/util/MockProvenanceReporter.java       | 365 ++++++++++--
 .../apache/nifi/util/MockSessionFactory.java    |   8 +-
 .../apache/nifi/util/SharedSessionState.java    |  26 +-
 .../nifi/util/StandardProcessorTestRunner.java  |  34 +-
 .../java/org/apache/nifi/util/TestRunner.java   |  15 +
 .../nifi/controller/StandardFlowFileQueue.java  |  18 +-
 .../repository/StandardProcessSession.java      |  27 +-
 .../repository/StandardProvenanceReporter.java  |  32 +-
 .../repository/VolatileContentRepository.java   |  44 +-
 .../nifi/groups/StandardProcessGroup.java       |   6 +-
 .../TestStandardProvenanceReporter.java         |   7 +-
 .../org/apache/nifi/nar/NarUnpackerTest.java    |  14 +-
 .../src/main/resources/bin/dump-nifi.bat        |   4 +-
 .../src/main/resources/bin/nifi.sh              |  21 +-
 .../src/main/resources/bin/run-nifi.bat         |   4 +-
 .../src/main/resources/bin/start-nifi.bat       |  47 --
 .../src/main/resources/bin/stop-nifi.bat        |  47 --
 .../src/main/resources/conf/logback.xml         |  48 ++
 .../nifi/remote/StandardRootGroupPort.java      |   8 +-
 .../nifi/web/StandardNiFiContentAccess.java     |   2 +-
 .../nifi/web/StandardNiFiServiceFacade.java     |   8 +-
 .../apache/nifi/web/api/ProvenanceResource.java |   4 +-
 .../apache/nifi/web/api/TemplateResource.java   |   2 +-
 .../org/apache/nifi/web/api/dto/DtoFactory.java |   5 +
 .../nifi/web/dao/impl/StandardSnippetDAO.java   |   2 +-
 .../org/apache/nifi/web/util/SnippetUtils.java  |  15 +-
 .../nifi/web/ContentViewerController.java       |   3 +
 .../apache/nifi/web/servlet/DownloadSvg.java    |   2 +-
 .../canvas/controller-service-configuration.jsp |   4 -
 .../src/main/webapp/css/controller-service.css  |  13 -
 .../src/main/webapp/images/iconMoveToParent.png | Bin 0 -> 215 bytes
 .../src/main/webapp/js/nf/canvas/nf-actions.js  |  15 +
 .../main/webapp/js/nf/canvas/nf-canvas-utils.js | 126 +++--
 .../main/webapp/js/nf/canvas/nf-context-menu.js |  12 +-
 .../js/nf/canvas/nf-controller-service.js       |  20 -
 .../nifi/processors/kafka/TestPutKafka.java     |  52 +-
 .../nifi-standard-content-viewer/pom.xml        |   5 +-
 .../web/StandardContentViewerController.java    |   4 +-
 .../prioritizer/NewestFirstPrioritizerTest.java |  16 +-
 .../prioritizer/OldestFirstPrioritizerTest.java |  16 +-
 .../PriorityAttributePrioritizerTest.java       |  27 +-
 .../nifi-standard-processors/pom.xml            | 552 ++++++++++---------
 .../nifi/processors/standard/EvaluateXPath.java |   2 +-
 .../nifi/processors/standard/ExecuteSQL.java    | 157 ++++++
 .../processors/standard/util/JdbcCommon.java    | 165 ++++++
 .../org.apache.nifi.processor.Processor         |   1 +
 .../processors/standard/TestExecuteSQL.java     | 169 ++++++
 .../standard/util/TestJdbcCommon.java           | 155 ++++++
 .../standard/util/TestJdbcHugeStream.java       | 267 +++++++++
 .../nifi-standard-bundle/pom.xml                |   7 +-
 .../apache/nifi/dbcp/DBCPConnectionPool.java    | 181 +++---
 .../nifi/dbcp/DatabaseSystemDescriptor.java     |   1 +
 .../org/apache/nifi/dbcp/DatabaseSystems.java   |   1 +
 .../org/apache/nifi/dbcp/DBCPServiceTest.java   | 160 ++----
 .../cache/server/AbstractCacheServer.java       |   8 +-
 .../distributed/cache/server/CacheServer.java   |   2 +
 .../cache/server/DistributedCacheServer.java    |  65 ++-
 .../cache/server/TestServerAndClient.java       | 292 +++++-----
 .../nifi/ssl/StandardSSLContextService.java     |  91 ++-
 .../org/apache/nifi/ssl/SSLContextService.java  |   1 +
 nifi/pom.xml                                    |  10 +
 71 files changed, 2650 insertions(+), 1271 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/28bfb70e/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/VolatileContentRepository.java
----------------------------------------------------------------------


[08/17] incubator-nifi git commit: NIFI-632 moving NarCloseable and NarThreadContextClassLoader to nifi-nar-utils from nifi-framework-core-api

Posted by da...@apache.org.
NIFI-632 moving NarCloseable and NarThreadContextClassLoader to nifi-nar-utils from nifi-framework-core-api


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

Branch: refs/heads/develop
Commit: 995a01636e12d73d6b8ccb292c49bf32efd0b179
Parents: dc4065a
Author: danbress <db...@onyxconsults.com>
Authored: Mon Jun 8 21:26:35 2015 -0400
Committer: danbress <db...@onyxconsults.com>
Committed: Tue Jun 9 21:34:26 2015 -0400

----------------------------------------------------------------------
 .../java/org/apache/nifi/nar/NarCloseable.java  |  44 -----
 .../nifi/nar/NarThreadContextClassLoader.java   | 187 -------------------
 .../java/org/apache/nifi/nar/NarCloseable.java  |  44 +++++
 .../nifi/nar/NarThreadContextClassLoader.java   | 187 +++++++++++++++++++
 4 files changed, 231 insertions(+), 231 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/995a0163/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/nar/NarCloseable.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/nar/NarCloseable.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/nar/NarCloseable.java
deleted file mode 100644
index b25c90b..0000000
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/nar/NarCloseable.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.nar;
-
-import java.io.Closeable;
-
-/**
- *
- */
-public class NarCloseable implements Closeable {
-
-    public static NarCloseable withNarLoader() {
-        final ClassLoader current = Thread.currentThread().getContextClassLoader();
-        Thread.currentThread().setContextClassLoader(NarThreadContextClassLoader.getInstance());
-        return new NarCloseable(current);
-    }
-
-    private final ClassLoader toSet;
-
-    private NarCloseable(final ClassLoader toSet) {
-        this.toSet = toSet;
-    }
-
-    @Override
-    public void close() {
-        if (toSet != null) {
-            Thread.currentThread().setContextClassLoader(toSet);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/995a0163/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/nar/NarThreadContextClassLoader.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/nar/NarThreadContextClassLoader.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/nar/NarThreadContextClassLoader.java
deleted file mode 100644
index 9471ba6..0000000
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/nar/NarThreadContextClassLoader.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * 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.nar;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-
-import org.apache.nifi.authorization.AuthorityProvider;
-import org.apache.nifi.components.Validator;
-import org.apache.nifi.controller.ControllerService;
-import org.apache.nifi.controller.repository.ContentRepository;
-import org.apache.nifi.controller.repository.FlowFileRepository;
-import org.apache.nifi.controller.repository.FlowFileSwapManager;
-import org.apache.nifi.controller.status.history.ComponentStatusRepository;
-import org.apache.nifi.flowfile.FlowFilePrioritizer;
-import org.apache.nifi.processor.Processor;
-import org.apache.nifi.processor.io.InputStreamCallback;
-import org.apache.nifi.processor.io.OutputStreamCallback;
-import org.apache.nifi.processor.io.StreamCallback;
-import org.apache.nifi.provenance.ProvenanceEventRepository;
-import org.apache.nifi.reporting.ReportingTask;
-
-/**
- * THREAD SAFE
- */
-public class NarThreadContextClassLoader extends URLClassLoader {
-
-    static final ContextSecurityManager contextSecurityManager = new ContextSecurityManager();
-    private final ClassLoader forward = ClassLoader.getSystemClassLoader();
-    private static final List<Class<?>> narSpecificClasses = new ArrayList<>();
-
-    static {
-        narSpecificClasses.add(Processor.class);
-        narSpecificClasses.add(FlowFilePrioritizer.class);
-        narSpecificClasses.add(ReportingTask.class);
-        narSpecificClasses.add(Validator.class);
-        narSpecificClasses.add(InputStreamCallback.class);
-        narSpecificClasses.add(OutputStreamCallback.class);
-        narSpecificClasses.add(StreamCallback.class);
-        narSpecificClasses.add(ControllerService.class);
-        narSpecificClasses.add(AuthorityProvider.class);
-        narSpecificClasses.add(ProvenanceEventRepository.class);
-        narSpecificClasses.add(ComponentStatusRepository.class);
-        narSpecificClasses.add(FlowFileRepository.class);
-        narSpecificClasses.add(FlowFileSwapManager.class);
-        narSpecificClasses.add(ContentRepository.class);
-    }
-
-    private NarThreadContextClassLoader() {
-        super(new URL[0]);
-    }
-
-    @Override
-    public void clearAssertionStatus() {
-        lookupClassLoader().clearAssertionStatus();
-    }
-
-    @Override
-    public URL getResource(String name) {
-        return lookupClassLoader().getResource(name);
-    }
-
-    @Override
-    public InputStream getResourceAsStream(String name) {
-        return lookupClassLoader().getResourceAsStream(name);
-    }
-
-    @Override
-    public Enumeration<URL> getResources(String name) throws IOException {
-        return lookupClassLoader().getResources(name);
-    }
-
-    @Override
-    public Class<?> loadClass(String name) throws ClassNotFoundException {
-        return lookupClassLoader().loadClass(name);
-    }
-
-    @Override
-    public void setClassAssertionStatus(String className, boolean enabled) {
-        lookupClassLoader().setClassAssertionStatus(className, enabled);
-    }
-
-    @Override
-    public void setDefaultAssertionStatus(boolean enabled) {
-        lookupClassLoader().setDefaultAssertionStatus(enabled);
-    }
-
-    @Override
-    public void setPackageAssertionStatus(String packageName, boolean enabled) {
-        lookupClassLoader().setPackageAssertionStatus(packageName, enabled);
-    }
-
-    private ClassLoader lookupClassLoader() {
-        final Class<?>[] classStack = contextSecurityManager.getExecutionStack();
-
-        for (Class<?> currentClass : classStack) {
-            final Class<?> narClass = findNarClass(currentClass);
-            if (narClass != null) {
-                final ClassLoader desiredClassLoader = narClass.getClassLoader();
-
-                // When new Threads are created, the new Thread inherits the ClassLoaderContext of
-                // the caller. However, the call stack of that new Thread may not trace back to any NiFi-specific
-                // code. Therefore, the NarThreadContextClassLoader will be unable to find the appropriate NAR
-                // ClassLoader. As a result, we want to set the ContextClassLoader to the NAR ClassLoader that
-                // contains the class or resource that we are looking for.
-                // This locks the current Thread into the appropriate NAR ClassLoader Context. The framework will change
-                // the ContextClassLoader back to the NarThreadContextClassLoader as appropriate via the
-                // {@link FlowEngine.beforeExecute(Thread, Runnable)} and
-                // {@link FlowEngine.afterExecute(Thread, Runnable)} methods.
-                if (desiredClassLoader instanceof NarClassLoader) {
-                    Thread.currentThread().setContextClassLoader(desiredClassLoader);
-                }
-                return desiredClassLoader;
-            }
-        }
-        return forward;
-    }
-
-    private Class<?> findNarClass(final Class<?> cls) {
-        for (final Class<?> narClass : narSpecificClasses) {
-            if (narClass.isAssignableFrom(cls)) {
-                return cls;
-            } else if (cls.getEnclosingClass() != null) {
-                return findNarClass(cls.getEnclosingClass());
-            }
-        }
-
-        return null;
-    }
-
-    private static class SingletonHolder {
-
-        public static final NarThreadContextClassLoader instance = new NarThreadContextClassLoader();
-    }
-
-    public static NarThreadContextClassLoader getInstance() {
-        return SingletonHolder.instance;
-    }
-
-    static class ContextSecurityManager extends SecurityManager {
-
-        Class<?>[] getExecutionStack() {
-            return getClassContext();
-        }
-    }
-
-    public static <T> T createInstance(final String implementationClassName, final Class<T> typeDefinition) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
-        final ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
-        Thread.currentThread().setContextClassLoader(NarThreadContextClassLoader.getInstance());
-        try {
-            final ClassLoader detectedClassLoaderForType = ExtensionManager.getClassLoader(implementationClassName);
-            final Class<?> rawClass;
-            if (detectedClassLoaderForType == null) {
-                // try to find from the current class loader
-                rawClass = Class.forName(implementationClassName);
-            } else {
-                // try to find from the registered classloader for that type
-                rawClass = Class.forName(implementationClassName, true, ExtensionManager.getClassLoader(implementationClassName));
-            }
-
-            Thread.currentThread().setContextClassLoader(detectedClassLoaderForType);
-            final Class<?> desiredClass = rawClass.asSubclass(typeDefinition);
-            return typeDefinition.cast(desiredClass.newInstance());
-        } finally {
-            Thread.currentThread().setContextClassLoader(originalClassLoader);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/995a0163/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/NarCloseable.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/NarCloseable.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/NarCloseable.java
new file mode 100644
index 0000000..b25c90b
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/NarCloseable.java
@@ -0,0 +1,44 @@
+/*
+ * 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.nar;
+
+import java.io.Closeable;
+
+/**
+ *
+ */
+public class NarCloseable implements Closeable {
+
+    public static NarCloseable withNarLoader() {
+        final ClassLoader current = Thread.currentThread().getContextClassLoader();
+        Thread.currentThread().setContextClassLoader(NarThreadContextClassLoader.getInstance());
+        return new NarCloseable(current);
+    }
+
+    private final ClassLoader toSet;
+
+    private NarCloseable(final ClassLoader toSet) {
+        this.toSet = toSet;
+    }
+
+    @Override
+    public void close() {
+        if (toSet != null) {
+            Thread.currentThread().setContextClassLoader(toSet);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/995a0163/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/NarThreadContextClassLoader.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/NarThreadContextClassLoader.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/NarThreadContextClassLoader.java
new file mode 100644
index 0000000..9471ba6
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/NarThreadContextClassLoader.java
@@ -0,0 +1,187 @@
+/*
+ * 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.nar;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+
+import org.apache.nifi.authorization.AuthorityProvider;
+import org.apache.nifi.components.Validator;
+import org.apache.nifi.controller.ControllerService;
+import org.apache.nifi.controller.repository.ContentRepository;
+import org.apache.nifi.controller.repository.FlowFileRepository;
+import org.apache.nifi.controller.repository.FlowFileSwapManager;
+import org.apache.nifi.controller.status.history.ComponentStatusRepository;
+import org.apache.nifi.flowfile.FlowFilePrioritizer;
+import org.apache.nifi.processor.Processor;
+import org.apache.nifi.processor.io.InputStreamCallback;
+import org.apache.nifi.processor.io.OutputStreamCallback;
+import org.apache.nifi.processor.io.StreamCallback;
+import org.apache.nifi.provenance.ProvenanceEventRepository;
+import org.apache.nifi.reporting.ReportingTask;
+
+/**
+ * THREAD SAFE
+ */
+public class NarThreadContextClassLoader extends URLClassLoader {
+
+    static final ContextSecurityManager contextSecurityManager = new ContextSecurityManager();
+    private final ClassLoader forward = ClassLoader.getSystemClassLoader();
+    private static final List<Class<?>> narSpecificClasses = new ArrayList<>();
+
+    static {
+        narSpecificClasses.add(Processor.class);
+        narSpecificClasses.add(FlowFilePrioritizer.class);
+        narSpecificClasses.add(ReportingTask.class);
+        narSpecificClasses.add(Validator.class);
+        narSpecificClasses.add(InputStreamCallback.class);
+        narSpecificClasses.add(OutputStreamCallback.class);
+        narSpecificClasses.add(StreamCallback.class);
+        narSpecificClasses.add(ControllerService.class);
+        narSpecificClasses.add(AuthorityProvider.class);
+        narSpecificClasses.add(ProvenanceEventRepository.class);
+        narSpecificClasses.add(ComponentStatusRepository.class);
+        narSpecificClasses.add(FlowFileRepository.class);
+        narSpecificClasses.add(FlowFileSwapManager.class);
+        narSpecificClasses.add(ContentRepository.class);
+    }
+
+    private NarThreadContextClassLoader() {
+        super(new URL[0]);
+    }
+
+    @Override
+    public void clearAssertionStatus() {
+        lookupClassLoader().clearAssertionStatus();
+    }
+
+    @Override
+    public URL getResource(String name) {
+        return lookupClassLoader().getResource(name);
+    }
+
+    @Override
+    public InputStream getResourceAsStream(String name) {
+        return lookupClassLoader().getResourceAsStream(name);
+    }
+
+    @Override
+    public Enumeration<URL> getResources(String name) throws IOException {
+        return lookupClassLoader().getResources(name);
+    }
+
+    @Override
+    public Class<?> loadClass(String name) throws ClassNotFoundException {
+        return lookupClassLoader().loadClass(name);
+    }
+
+    @Override
+    public void setClassAssertionStatus(String className, boolean enabled) {
+        lookupClassLoader().setClassAssertionStatus(className, enabled);
+    }
+
+    @Override
+    public void setDefaultAssertionStatus(boolean enabled) {
+        lookupClassLoader().setDefaultAssertionStatus(enabled);
+    }
+
+    @Override
+    public void setPackageAssertionStatus(String packageName, boolean enabled) {
+        lookupClassLoader().setPackageAssertionStatus(packageName, enabled);
+    }
+
+    private ClassLoader lookupClassLoader() {
+        final Class<?>[] classStack = contextSecurityManager.getExecutionStack();
+
+        for (Class<?> currentClass : classStack) {
+            final Class<?> narClass = findNarClass(currentClass);
+            if (narClass != null) {
+                final ClassLoader desiredClassLoader = narClass.getClassLoader();
+
+                // When new Threads are created, the new Thread inherits the ClassLoaderContext of
+                // the caller. However, the call stack of that new Thread may not trace back to any NiFi-specific
+                // code. Therefore, the NarThreadContextClassLoader will be unable to find the appropriate NAR
+                // ClassLoader. As a result, we want to set the ContextClassLoader to the NAR ClassLoader that
+                // contains the class or resource that we are looking for.
+                // This locks the current Thread into the appropriate NAR ClassLoader Context. The framework will change
+                // the ContextClassLoader back to the NarThreadContextClassLoader as appropriate via the
+                // {@link FlowEngine.beforeExecute(Thread, Runnable)} and
+                // {@link FlowEngine.afterExecute(Thread, Runnable)} methods.
+                if (desiredClassLoader instanceof NarClassLoader) {
+                    Thread.currentThread().setContextClassLoader(desiredClassLoader);
+                }
+                return desiredClassLoader;
+            }
+        }
+        return forward;
+    }
+
+    private Class<?> findNarClass(final Class<?> cls) {
+        for (final Class<?> narClass : narSpecificClasses) {
+            if (narClass.isAssignableFrom(cls)) {
+                return cls;
+            } else if (cls.getEnclosingClass() != null) {
+                return findNarClass(cls.getEnclosingClass());
+            }
+        }
+
+        return null;
+    }
+
+    private static class SingletonHolder {
+
+        public static final NarThreadContextClassLoader instance = new NarThreadContextClassLoader();
+    }
+
+    public static NarThreadContextClassLoader getInstance() {
+        return SingletonHolder.instance;
+    }
+
+    static class ContextSecurityManager extends SecurityManager {
+
+        Class<?>[] getExecutionStack() {
+            return getClassContext();
+        }
+    }
+
+    public static <T> T createInstance(final String implementationClassName, final Class<T> typeDefinition) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+        final ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
+        Thread.currentThread().setContextClassLoader(NarThreadContextClassLoader.getInstance());
+        try {
+            final ClassLoader detectedClassLoaderForType = ExtensionManager.getClassLoader(implementationClassName);
+            final Class<?> rawClass;
+            if (detectedClassLoaderForType == null) {
+                // try to find from the current class loader
+                rawClass = Class.forName(implementationClassName);
+            } else {
+                // try to find from the registered classloader for that type
+                rawClass = Class.forName(implementationClassName, true, ExtensionManager.getClassLoader(implementationClassName));
+            }
+
+            Thread.currentThread().setContextClassLoader(detectedClassLoaderForType);
+            final Class<?> desiredClass = rawClass.asSubclass(typeDefinition);
+            return typeDefinition.cast(desiredClass.newInstance());
+        } finally {
+            Thread.currentThread().setContextClassLoader(originalClassLoader);
+        }
+    }
+}


[03/17] incubator-nifi git commit: NIFI-632 Using newly generated example.nar in test code

Posted by da...@apache.org.
NIFI-632 Using newly generated example.nar in test code


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

Branch: refs/heads/develop
Commit: 6f36c7939ba2eba1decfe87d26b152507207119b
Parents: b4ee97c
Author: danbress <db...@onyxconsults.com>
Authored: Sat May 30 11:56:39 2015 -0400
Committer: danbress <db...@onyxconsults.com>
Committed: Tue Jun 9 21:34:23 2015 -0400

----------------------------------------------------------------------
 .../apache/nifi/documentation/DocGenerator.java  |   2 +-
 .../nifi/documentation/DocGeneratorTest.java     |  12 +++++++++---
 .../src/test/resources/conf/nifi.properties      |   4 ++--
 .../src/test/resources/lib/example.nar           | Bin 0 -> 720984 bytes
 .../src/test/resources/lib/jetty.nar             | Bin 0 -> 4638519 bytes
 .../test/resources/lib/nifi-framework-nar.nar    | Bin 0 -> 406 bytes
 6 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/6f36c793/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/DocGenerator.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/DocGenerator.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/DocGenerator.java
index ea033c5..0e9ed37 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/DocGenerator.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/DocGenerator.java
@@ -76,7 +76,7 @@ public class DocGenerator {
                     logger.debug("Documenting: " + componentClass);
                     document(explodedNiFiDocsDir, componentClass);
                 } catch (Exception e) {
-                    logger.warn("Unable to document: " + componentClass);
+                    logger.warn("Unable to document: " + componentClass, e);
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/6f36c793/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java
index c077540..320c7c8 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java
@@ -7,7 +7,9 @@ import java.io.IOException;
 import java.io.InputStream;
 
 import org.apache.commons.io.FileUtils;
+import org.apache.nifi.nar.ExtensionManager;
 import org.apache.nifi.nar.ExtensionMapping;
+import org.apache.nifi.nar.NarClassLoaders;
 import org.apache.nifi.nar.NarUnpacker;
 import org.apache.nifi.stream.io.StreamUtils;
 import org.apache.nifi.util.NiFiProperties;
@@ -19,7 +21,7 @@ import org.mockito.internal.util.io.IOUtil;
 public class DocGeneratorTest {
 
     @Test
-    public void testProcessorLoadsNarResources() throws IOException {
+    public void testProcessorLoadsNarResources() throws IOException, ClassNotFoundException {
         TemporaryFolder temporaryFolder = new TemporaryFolder();
         temporaryFolder.create();
 
@@ -30,11 +32,15 @@ public class DocGeneratorTest {
 
         final ExtensionMapping extensionMapping = NarUnpacker.unpackNars(properties);
 
+        NarClassLoaders.load(properties);
+
+        ExtensionManager.discoverExtensions();
+
         DocGenerator.generate(properties);      
 
-        File processorDirectory = new File(temporaryFolder.getRoot(), "org.apache.nifi.TestProcessor");
+        File processorDirectory = new File(temporaryFolder.getRoot(), "org.apache.nifi.processors.WriteResourceToStream");
         File indexHtml = new File(processorDirectory, "index.html");
-        
+        Assert.assertTrue(indexHtml + " should have been generated", indexHtml.exists());
         String generatedHtml = FileUtils.readFileToString(indexHtml);
         Assert.assertNotNull(generatedHtml);
     }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/6f36c793/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/conf/nifi.properties
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/conf/nifi.properties b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/conf/nifi.properties
index 92e4a92..a0e1389 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/conf/nifi.properties
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/conf/nifi.properties
@@ -27,8 +27,8 @@ nifi.controller.service.configuration.file=./target/controller-services.xml
 nifi.templates.directory=./target/templates
 nifi.ui.banner.text=UI Banner Text
 nifi.ui.autorefresh.interval=30 sec
-nifi.nar.library.directory=./target/NarUnpacker/lib/
-nifi.nar.library.directory.alt=./target/NarUnpacker/lib2/
+nifi.nar.library.directory=./target/test-classes/lib/
+nifi.nar.library.directory.alt=./target/test-classes/lib2/
 
 nifi.nar.working.directory=./target/work/nar/
 

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/6f36c793/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/lib/example.nar
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/lib/example.nar b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/lib/example.nar
new file mode 100644
index 0000000..5c0182b
Binary files /dev/null and b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/lib/example.nar differ

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/6f36c793/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/lib/jetty.nar
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/lib/jetty.nar b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/lib/jetty.nar
new file mode 100644
index 0000000..f92d615
Binary files /dev/null and b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/lib/jetty.nar differ

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/6f36c793/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/lib/nifi-framework-nar.nar
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/lib/nifi-framework-nar.nar b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/lib/nifi-framework-nar.nar
new file mode 100644
index 0000000..d2a8b96
Binary files /dev/null and b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/lib/nifi-framework-nar.nar differ