simonbence commented on code in PR #7661:
URL: https://github.com/apache/nifi/pull/7661#discussion_r1338598808


##########
nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/clustering/JoinClusterWithDifferentFlow.java:
##########
@@ -124,61 +115,62 @@ public void testStartupWithDifferentFlow() throws 
IOException, NiFiClientExcepti
     }
 
 
-    private List<File> getFlowXmlFiles(final File confDir) {
-        final File[] flowXmlFileArray = confDir.listFiles(file -> 
file.getName().startsWith("flow") && file.getName().endsWith(".xml.gz"));
-        final List<File> flowXmlFiles = new 
ArrayList<>(Arrays.asList(flowXmlFileArray));
-        return flowXmlFiles;
+    private List<File> getFlowJsonFiles(final File confDir) {
+        final File[] flowJsonFileArray = confDir.listFiles(file -> 
file.getName().startsWith("flow") && file.getName().endsWith(".json.gz"));
+        final List<File> flowJsonFiles = new 
ArrayList<>(Arrays.asList(flowJsonFileArray));
+        return flowJsonFiles;
     }
 
     private File getBackupFile(final File confDir) throws InterruptedException 
{
-        waitFor(() -> getFlowXmlFiles(confDir).size() == 2);
+        waitFor(() -> getFlowJsonFiles(confDir).size() == 2);
 
-        final List<File> flowXmlFiles = getFlowXmlFiles(confDir);
+        final List<File> flowXmlFiles = getFlowJsonFiles(confDir);
         assertEquals(2, flowXmlFiles.size());
 
-        flowXmlFiles.removeIf(file -> file.getName().equals("flow.xml.gz"));
+        flowXmlFiles.removeIf(file -> file.getName().equals("flow.json.gz"));
 
         assertEquals(1, flowXmlFiles.size());
         final File backupFile = flowXmlFiles.get(0);
         return backupFile;
     }
 
-    private void verifyFlowContentsOnDisk(final File backupFile) throws 
IOException {
-        // Read the flow and make sure that the backup looks the same as the 
original. We don't just do a byte comparison because the compression may result 
in different
-        // gzipped bytes and because if the two flows do differ, we want to 
have the String representation so that we can compare to see how they are 
different.
-        final String flowXml = readFlow(backupFile);
-        final String expectedFlow = readFlow(new 
File("src/test/resources/flows/mismatched-flows/flow1.xml.gz"));
-
-        assertEquals(expectedFlow, flowXml);
-
-        // Verify some of the values that were persisted to disk
-        final File confDir = backupFile.getParentFile();
-        final String loadedFlow = readFlow(new File(confDir, "flow.xml.gz"));
-
-        final StandardDocumentProvider documentProvider = new 
StandardDocumentProvider();
-        final Document document = documentProvider.parse(new 
ByteArrayInputStream(loadedFlow.getBytes(StandardCharsets.UTF_8)));
-        final Element rootElement = (Element) 
document.getElementsByTagName("flowController").item(0);
-        final FlowEncodingVersion encodingVersion = 
FlowEncodingVersion.parse(rootElement);
-
-        final NiFiInstance node2 = getNiFiInstance().getNodeInstance(2);
-        final PropertyEncryptor encryptor = 
createEncryptorFromProperties(node2.getProperties());
-        final Element rootGroupElement = (Element) 
rootElement.getElementsByTagName("rootGroup").item(0);
-
-        final ProcessGroupDTO groupDto = 
FlowFromDOMFactory.getProcessGroup(null, rootGroupElement, encryptor, 
encodingVersion);
-        final Set<ProcessGroupDTO> childGroupDtos = 
groupDto.getContents().getProcessGroups();
-        assertEquals(1, childGroupDtos.size());
-
-        final ProcessGroupDTO childGroup = childGroupDtos.iterator().next();
-        assertFalse(childGroup.getId().endsWith("00"));
-        final FlowSnippetDTO childContents = childGroup.getContents();
-
-        final Set<ProcessorDTO> childProcessors = 
childContents.getProcessors();
-        assertEquals(1, childProcessors.size());
-
-        final ProcessorDTO procDto = childProcessors.iterator().next();
-        assertFalse(procDto.getId().endsWith("00"));
-        assertFalse(procDto.getName().endsWith("00"));
-    }
+    // TODO we need a JSON analogue for this

Review Comment:
   I fixed the test within the story. Please take a look. There are some things 
you might want to ask about, especially the removeal of the disconnection. As 
far as I understood it 1. did not work as expected even before the PR 2. was 
unnecessary for the given test scenario. I might miss something so please 
mention if you disagree with any of the changes



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to