nifi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jperciv...@apache.org
Subject nifi git commit: NIFI-2159: Fixed bug that caused relationship names not to get added to fingerprint
Date Wed, 06 Jul 2016 20:48:46 GMT
Repository: nifi
Updated Branches:
  refs/heads/0.x bd69f81af -> 149c6facc


NIFI-2159: Fixed bug that caused relationship names not to get added to fingerprint

This closes #612

Signed-off-by: jpercivall <joepercivall@yahoo.com>


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

Branch: refs/heads/0.x
Commit: 149c6facc7fb9db9d1680baa4f1c8e7792c58031
Parents: bd69f81
Author: Mark Payne <markap14@hotmail.com>
Authored: Wed Jul 6 14:35:51 2016 -0400
Committer: jpercivall <joepercivall@yahoo.com>
Committed: Wed Jul 6 16:37:24 2016 -0400

----------------------------------------------------------------------
 .../org/apache/nifi/fingerprint/FingerprintFactory.java   | 10 +++-------
 .../apache/nifi/fingerprint/FingerprintFactoryTest.java   |  9 +++++++++
 .../src/test/resources/nifi/fingerprint/flow1a.xml        |  2 +-
 .../src/test/resources/nifi/fingerprint/flow1b.xml        |  2 +-
 4 files changed, 14 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/149c6fac/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/fingerprint/FingerprintFactory.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/fingerprint/FingerprintFactory.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/fingerprint/FingerprintFactory.java
index 06a5e3d..07d4a86 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/fingerprint/FingerprintFactory.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/fingerprint/FingerprintFactory.java
@@ -843,11 +843,13 @@ public final class FingerprintFactory {
         // destination type
         appendFirstValue(builder, DomUtils.getChildNodesByTagName(connectionElem, "destinationType"));
 
+        appendFirstValue(builder, DomUtils.getChildNodesByTagName(connectionElem, "name"));
+
         // relationships
         final NodeList relationshipElems = DomUtils.getChildNodesByTagName(connectionElem,
"relationship");
         final List<Element> sortedRelationshipElems = sortElements(relationshipElems,
getConnectionRelationshipsComparator());
         for (final Element relationshipElem : sortedRelationshipElems) {
-            addConnectionRelationshipFingerprint(builder, relationshipElem);
+            builder.append(getValue(relationshipElem, "NO_VALUE"));
         }
 
         return builder;
@@ -872,12 +874,6 @@ public final class FingerprintFactory {
         return builder;
     }
 
-    private StringBuilder addConnectionRelationshipFingerprint(final StringBuilder builder,
final Element relationshipElem) throws FingerprintException {
-        // destination type
-        appendFirstValue(builder, DomUtils.getChildNodesByTagName(relationshipElem, "relationship"));
-        return builder;
-    }
-
     private StringBuilder addFunnelFingerprint(final StringBuilder builder, final Element
funnelElem) throws FingerprintException {
         // id
         appendFirstValue(builder, DomUtils.getChildNodesByTagName(funnelElem, "id"));

http://git-wip-us.apache.org/repos/asf/nifi/blob/149c6fac/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/fingerprint/FingerprintFactoryTest.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/fingerprint/FingerprintFactoryTest.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/fingerprint/FingerprintFactoryTest.java
index ae9624b..bb12e78 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/fingerprint/FingerprintFactoryTest.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/fingerprint/FingerprintFactoryTest.java
@@ -18,10 +18,12 @@ package org.apache.nifi.fingerprint;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
 
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -52,6 +54,13 @@ public class FingerprintFactoryTest {
         assertFalse(fp1.equals(fp2));
     }
 
+    @Test
+    public void testResourceValueInFingerprint() throws IOException {
+        final String fingerprint = fingerprinter.createFingerprint(getResourceBytes("/nifi/fingerprint/flow1a.xml"),
null);
+        assertEquals(3, StringUtils.countMatches(fingerprint, "success"));
+        assertTrue(fingerprint.contains("In Connection"));
+    }
+
     private byte[] getResourceBytes(final String resource) throws IOException {
         return IOUtils.toByteArray(FingerprintFactoryTest.class.getResourceAsStream(resource));
     }

http://git-wip-us.apache.org/repos/asf/nifi/blob/149c6fac/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/resources/nifi/fingerprint/flow1a.xml
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/resources/nifi/fingerprint/flow1a.xml
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/resources/nifi/fingerprint/flow1a.xml
index 81835df..beccdcc 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/resources/nifi/fingerprint/flow1a.xml
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/resources/nifi/fingerprint/flow1a.xml
@@ -89,7 +89,7 @@
             </outputPort>
             <connection>
                 <id>b25c3c8f-8dfe-4dda-950e-b6edfb6c99f4</id>
-                <name>In</name>
+                <name>In Connection</name>
                 <bendPoints/>
                 <labelIndex>1</labelIndex>
                 <zIndex>0</zIndex>

http://git-wip-us.apache.org/repos/asf/nifi/blob/149c6fac/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/resources/nifi/fingerprint/flow1b.xml
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/resources/nifi/fingerprint/flow1b.xml
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/resources/nifi/fingerprint/flow1b.xml
index 4f18156..19ed079 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/resources/nifi/fingerprint/flow1b.xml
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/resources/nifi/fingerprint/flow1b.xml
@@ -89,7 +89,7 @@
             </outputPort>
             <connection>
                 <id>b25c3c8f-8dfe-4dda-950e-b6edfb6c99f4</id>
-                <name>In</name>
+                <name>In Connection</name>
                 <bendPoints/>
                 <labelIndex>1</labelIndex>
                 <zIndex>0</zIndex>


Mime
View raw message