use of org.apache.nifi.controller.scheduling.StandardProcessScheduler in project nifi by apache.
the class TestStandardControllerServiceProvider method validateEnableServices2.
/**
* This test is similar to the above, but different combination of service
* dependencies
*/
@Test
public void validateEnableServices2() {
StandardProcessScheduler scheduler = createScheduler();
FlowController controller = Mockito.mock(FlowController.class);
StandardControllerServiceProvider provider = new StandardControllerServiceProvider(controller, scheduler, null, stateManagerProvider, variableRegistry, niFiProperties);
ProcessGroup procGroup = new MockProcessGroup(controller);
Mockito.when(controller.getGroup(Mockito.anyString())).thenReturn(procGroup);
ControllerServiceNode A = provider.createControllerService(ServiceC.class.getName(), "A", systemBundle.getBundleDetails().getCoordinate(), null, false);
ControllerServiceNode B = provider.createControllerService(ServiceA.class.getName(), "B", systemBundle.getBundleDetails().getCoordinate(), null, false);
ControllerServiceNode C = provider.createControllerService(ServiceB.class.getName(), "C", systemBundle.getBundleDetails().getCoordinate(), null, false);
ControllerServiceNode D = provider.createControllerService(ServiceA.class.getName(), "D", systemBundle.getBundleDetails().getCoordinate(), null, false);
ControllerServiceNode F = provider.createControllerService(ServiceA.class.getName(), "F", systemBundle.getBundleDetails().getCoordinate(), null, false);
procGroup.addControllerService(A);
procGroup.addControllerService(B);
procGroup.addControllerService(C);
procGroup.addControllerService(D);
procGroup.addControllerService(F);
setProperty(A, ServiceC.REQ_SERVICE_1.getName(), "B");
setProperty(A, ServiceC.REQ_SERVICE_2.getName(), "D");
setProperty(B, ServiceA.OTHER_SERVICE.getName(), "C");
setProperty(F, ServiceA.OTHER_SERVICE.getName(), "D");
setProperty(D, ServiceA.OTHER_SERVICE.getName(), "C");
provider.enableControllerServices(Arrays.asList(C, F, A, B, D));
assertTrue(A.isActive());
assertTrue(B.isActive());
assertTrue(C.isActive());
assertTrue(D.isActive());
assertTrue(F.isActive());
}
Aggregations