Java Code Examples for org.apache.nifi.controller.ProcessorNode#enable()

The following examples show how to use org.apache.nifi.controller.ProcessorNode#enable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestProcessorLifecycle.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
@Test
public void validateEnableOperation() throws Exception {
    fc = this.buildFlowControllerForTest();
    ProcessGroup testGroup = fc.createProcessGroup(UUID.randomUUID().toString());
    this.setControllerRootGroup(fc, testGroup);
    final ProcessorNode testProcNode = fc.createProcessor(TestProcessor.class.getName(),
            UUID.randomUUID().toString());

    assertEquals(ScheduledState.STOPPED, testProcNode.getScheduledState());
    assertEquals(ScheduledState.STOPPED, testProcNode.getPhysicalScheduledState());
    // validates idempotency
    for (int i = 0; i < 2; i++) {
        testProcNode.enable();
    }
    assertEquals(ScheduledState.STOPPED, testProcNode.getScheduledState());
    assertEquals(ScheduledState.STOPPED, testProcNode.getPhysicalScheduledState());
    testProcNode.disable();
    assertEquals(ScheduledState.DISABLED, testProcNode.getScheduledState());
    assertEquals(ScheduledState.DISABLED, testProcNode.getPhysicalScheduledState());
}
 
Example 2
Source File: ProcessorLifecycleIT.java    From nifi with Apache License 2.0 6 votes vote down vote up
@Test
public void validateEnableOperation() throws Exception {
    final FlowManagerAndSystemBundle fcsb = this.buildFlowControllerForTest();
    flowManager = fcsb.getFlowManager();
    ProcessGroup testGroup = flowManager.createProcessGroup(UUID.randomUUID().toString());
    final ProcessorNode testProcNode = flowManager.createProcessor(TestProcessor.class.getName(),
            UUID.randomUUID().toString(), fcsb.getSystemBundle().getBundleDetails().getCoordinate());

    assertCondition(() -> ScheduledState.STOPPED == testProcNode.getScheduledState());
    assertCondition(() -> ScheduledState.STOPPED == testProcNode.getPhysicalScheduledState());
    // validates idempotency
    for (int i = 0; i < 2; i++) {
        testProcNode.enable();
    }
    assertCondition(() -> ScheduledState.STOPPED == testProcNode.getScheduledState());
    assertCondition(() -> ScheduledState.STOPPED == testProcNode.getPhysicalScheduledState());
    testProcNode.disable();
    assertCondition(() -> ScheduledState.DISABLED == testProcNode.getScheduledState());
    assertCondition(() -> ScheduledState.DISABLED == testProcNode.getPhysicalScheduledState());
}
 
Example 3
Source File: StandardProcessScheduler.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
@Override
public synchronized void enableProcessor(final ProcessorNode procNode) {
    procNode.enable();
}
 
Example 4
Source File: StandardProcessScheduler.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Override
public synchronized void enableProcessor(final ProcessorNode procNode) {
    procNode.enable();
}