Skip to content

Commit

Permalink
NIFI-11746 Fixed FlowSynchronizationIT.testComponentsRecreatedOnResta…
Browse files Browse the repository at this point in the history
…rt()

- Ensure that testComponentsRecreatedOnRestart only counts components in its own group

This closes #7466

Signed-off-by: David Handermann <exceptionfactory@apache.org>
(cherry picked from commit 96be737)
  • Loading branch information
markap14 authored and exceptionfactory committed Jul 10, 2023
1 parent 610dbb8 commit 0ee4377
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.apache.nifi.tests.system.NiFiSystemIT;
import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
import org.apache.nifi.toolkit.cli.impl.client.nifi.ProcessorClient;
import org.apache.nifi.toolkit.cli.impl.client.nifi.RequestConfig;
import org.apache.nifi.web.api.dto.ControllerServiceDTO;
import org.apache.nifi.web.api.dto.NodeDTO;
import org.apache.nifi.web.api.dto.PortDTO;
Expand Down Expand Up @@ -73,7 +72,6 @@

public class FlowSynchronizationIT extends NiFiSystemIT {
private static final Logger logger = LoggerFactory.getLogger(FlowSynchronizationIT.class);
private static final RequestConfig DO_NOT_REPLICATE = () -> Collections.singletonMap("X-Request-Replicated", "value");
private static final String RUNNING_STATE = "RUNNING";
private static final String ENABLED_STATE = "ENABLED";
private static final String SENSITIVE_VALUE_MASK = "********";
Expand Down Expand Up @@ -577,12 +575,13 @@ private void restartWithOnlySingleFlowPersistenceFile(final String filenameToDel
@Test
public void testComponentsRecreatedOnRestart() throws NiFiClientException, IOException, InterruptedException {
// Build dataflow with processors at root level and an inner group that contains an input port, output port, and a processor, as well as a Controller Service that the processor will use.
final ProcessorEntity generate = getClientUtil().createProcessor("GenerateFlowFile");
final ProcessGroupEntity group = getClientUtil().createProcessGroup("Inner Group", "root");
final ProcessGroupEntity topLevelGroup = getClientUtil().createProcessGroup("testComponentsRecreatedOnRestart", "root");
final ProcessorEntity generate = getClientUtil().createProcessor("GenerateFlowFile", topLevelGroup.getId());
final ProcessGroupEntity group = getClientUtil().createProcessGroup("Inner Group", topLevelGroup.getId());
final PortEntity inPort = getClientUtil().createInputPort("In", group.getId());
final PortEntity outPort = getClientUtil().createOutputPort("Out", group.getId());
final ProcessorEntity count = getClientUtil().createProcessor("CountFlowFiles", group.getId());
final ProcessorEntity terminate = getClientUtil().createProcessor("TerminateFlowFile");
final ProcessorEntity terminate = getClientUtil().createProcessor("TerminateFlowFile", topLevelGroup.getId());
getClientUtil().updateProcessorSchedulingPeriod(generate, "60 sec");

final ControllerServiceEntity countService = getClientUtil().createControllerService("StandardCountService", group.getId());
Expand Down Expand Up @@ -622,7 +621,7 @@ public void testComponentsRecreatedOnRestart() throws NiFiClientException, IOExc
// is on Node 2.
switchClientToNode(2);

final ProcessGroupFlowEntity flow = getNifiClient().getFlowClient(DO_NOT_REPLICATE).getProcessGroup("root");
final ProcessGroupFlowEntity flow = getNifiClient().getFlowClient(DO_NOT_REPLICATE).getProcessGroup(topLevelGroup.getId());
final FlowDTO flowDto = flow.getProcessGroupFlow().getFlow();
assertEquals(2, flowDto.getConnections().size());
assertEquals(2, flowDto.getProcessors().size());
Expand Down

0 comments on commit 0ee4377

Please sign in to comment.