simonbence commented on code in PR #7661:
URL: https://github.com/apache/nifi/pull/7661#discussion_r1348378366
##########
nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/clustering/JoinClusterWithDifferentFlow.java:
##########
@@ -106,124 +94,72 @@ public void testStartupWithDifferentFlow() throws
IOException, NiFiClientExcepti
node2.stop();
final File node2ConfDir = new File(node2.getInstanceDirectory(),
"conf");
- final File flowXmlFile = new File(node2ConfDir, "flow.xml.gz");
- Files.deleteIfExists(flowXmlFile.toPath());
-
Files.copy(Paths.get("src/test/resources/flows/mismatched-flows/flow2.xml.gz"),
flowXmlFile.toPath());
+ final File flowJsonFile = new File(node2ConfDir, "flow.json.gz");
+ Files.deleteIfExists(flowJsonFile.toPath());
+
Files.copy(Paths.get("src/test/resources/flows/mismatched-flows/flow2.json.gz"),
flowJsonFile.toPath());
node2.start(true);
- final File backupFile = getBackupFile(node2ConfDir);
- final NodeDTO node2Dto = getNodeDtoByApiPort(5672);
+ waitForAllNodesConnected();
+ switchClientToNode(2);
+ final File backupFile = getBackupFile(node2ConfDir);
verifyFlowContentsOnDisk(backupFile);
- disconnectNode(node2Dto);
verifyInMemoryFlowContents();
-
- // Reconnect the node so that we can properly shutdown
- reconnectNode(node2Dto);
}
-
- 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);
-
- final List<File> flowXmlFiles = getFlowXmlFiles(confDir);
- assertEquals(2, flowXmlFiles.size());
+ waitFor(() -> getFlowJsonFiles(confDir).size() == 1);
- flowXmlFiles.removeIf(file -> file.getName().equals("flow.xml.gz"));
+ final List<File> flowJsonFiles = getFlowJsonFiles(confDir);
+ assertEquals(1, flowJsonFiles.size());
- assertEquals(1, flowXmlFiles.size());
- final File backupFile = flowXmlFiles.get(0);
- return backupFile;
+ return flowJsonFiles.iterator().next();
}
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 String loadedFlow = readFlow(new File(confDir, "flow.json.gz"));
Review Comment:
https://issues.apache.org/jira/browse/NIFI-12176
--
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]