mirror of
https://github.com/apache/nifi.git
synced 2025-02-17 23:47:08 +00:00
NIFI-2159: Fixed bug that caused relationship names not to get added to fingerprint
This closes #612 Signed-off-by: jpercivall <joepercivall@yahoo.com>
This commit is contained in:
parent
c5889314ca
commit
4f2d17a8d4
@ -856,11 +856,13 @@ public final class FingerprintFactory {
|
|||||||
// destination type
|
// destination type
|
||||||
appendFirstValue(builder, DomUtils.getChildNodesByTagName(connectionElem, "destinationType"));
|
appendFirstValue(builder, DomUtils.getChildNodesByTagName(connectionElem, "destinationType"));
|
||||||
|
|
||||||
|
appendFirstValue(builder, DomUtils.getChildNodesByTagName(connectionElem, "name"));
|
||||||
|
|
||||||
// relationships
|
// relationships
|
||||||
final NodeList relationshipElems = DomUtils.getChildNodesByTagName(connectionElem, "relationship");
|
final NodeList relationshipElems = DomUtils.getChildNodesByTagName(connectionElem, "relationship");
|
||||||
final List<Element> sortedRelationshipElems = sortElements(relationshipElems, getConnectionRelationshipsComparator());
|
final List<Element> sortedRelationshipElems = sortElements(relationshipElems, getConnectionRelationshipsComparator());
|
||||||
for (final Element relationshipElem : sortedRelationshipElems) {
|
for (final Element relationshipElem : sortedRelationshipElems) {
|
||||||
addConnectionRelationshipFingerprint(builder, relationshipElem);
|
builder.append(getValue(relationshipElem, "NO_VALUE"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder;
|
return builder;
|
||||||
@ -885,12 +887,6 @@ public final class FingerprintFactory {
|
|||||||
return builder;
|
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 {
|
private StringBuilder addFunnelFingerprint(final StringBuilder builder, final Element funnelElem) throws FingerprintException {
|
||||||
// id
|
// id
|
||||||
appendFirstValue(builder, DomUtils.getChildNodesByTagName(funnelElem, "id"));
|
appendFirstValue(builder, DomUtils.getChildNodesByTagName(funnelElem, "id"));
|
||||||
|
@ -18,10 +18,12 @@ package org.apache.nifi.fingerprint;
|
|||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@ -52,6 +54,13 @@ public class FingerprintFactoryTest {
|
|||||||
assertFalse(fp1.equals(fp2));
|
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 {
|
private byte[] getResourceBytes(final String resource) throws IOException {
|
||||||
return IOUtils.toByteArray(FingerprintFactoryTest.class.getResourceAsStream(resource));
|
return IOUtils.toByteArray(FingerprintFactoryTest.class.getResourceAsStream(resource));
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@
|
|||||||
</outputPort>
|
</outputPort>
|
||||||
<connection>
|
<connection>
|
||||||
<id>b25c3c8f-8dfe-4dda-950e-b6edfb6c99f4</id>
|
<id>b25c3c8f-8dfe-4dda-950e-b6edfb6c99f4</id>
|
||||||
<name>In</name>
|
<name>In Connection</name>
|
||||||
<bendPoints/>
|
<bendPoints/>
|
||||||
<labelIndex>1</labelIndex>
|
<labelIndex>1</labelIndex>
|
||||||
<zIndex>0</zIndex>
|
<zIndex>0</zIndex>
|
||||||
|
@ -89,7 +89,7 @@
|
|||||||
</outputPort>
|
</outputPort>
|
||||||
<connection>
|
<connection>
|
||||||
<id>b25c3c8f-8dfe-4dda-950e-b6edfb6c99f4</id>
|
<id>b25c3c8f-8dfe-4dda-950e-b6edfb6c99f4</id>
|
||||||
<name>In</name>
|
<name>In Connection</name>
|
||||||
<bendPoints/>
|
<bendPoints/>
|
||||||
<labelIndex>1</labelIndex>
|
<labelIndex>1</labelIndex>
|
||||||
<zIndex>0</zIndex>
|
<zIndex>0</zIndex>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user