Java Code Examples for org.apache.nifi.web.api.dto.ControllerServiceDTO#setState()
The following examples show how to use
org.apache.nifi.web.api.dto.ControllerServiceDTO#setState() .
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: FlowFromDOMFactory.java From localization_nifi with Apache License 2.0 | 6 votes |
public static ControllerServiceDTO getControllerService(final Element element, final StringEncryptor encryptor) { final ControllerServiceDTO dto = new ControllerServiceDTO(); dto.setId(getString(element, "id")); dto.setName(getString(element, "name")); dto.setComments(getString(element, "comment")); dto.setType(getString(element, "class")); final boolean enabled = getBoolean(element, "enabled"); dto.setState(enabled ? ControllerServiceState.ENABLED.name() : ControllerServiceState.DISABLED.name()); dto.setProperties(getProperties(element, encryptor)); dto.setAnnotationData(getString(element, "annotationData")); return dto; }
Example 2
Source File: FlowFromDOMFactory.java From nifi with Apache License 2.0 | 6 votes |
public static ControllerServiceDTO getControllerService(final Element element, final StringEncryptor encryptor, final FlowEncodingVersion flowEncodingVersion) { final ControllerServiceDTO dto = new ControllerServiceDTO(); dto.setId(getString(element, "id")); dto.setVersionedComponentId(getString(element, "versionedComponentId")); dto.setName(getString(element, "name")); dto.setComments(getString(element, "comment")); dto.setType(getString(element, "class")); dto.setBundle(getBundle(DomUtils.getChild(element, "bundle"))); final boolean enabled = getBoolean(element, "enabled"); dto.setState(enabled ? ControllerServiceState.ENABLED.name() : ControllerServiceState.DISABLED.name()); dto.setProperties(getProperties(element, encryptor, flowEncodingVersion)); dto.setAnnotationData(getString(element, "annotationData")); return dto; }
Example 3
Source File: TestFlowController.java From nifi with Apache License 2.0 | 5 votes |
@Test(expected = IllegalArgumentException.class) public void testInstantiateSnippetWhenControllerServiceMissingBundle() throws ProcessorInstantiationException { final String id = UUID.randomUUID().toString(); final BundleCoordinate coordinate = systemBundle.getBundleDetails().getCoordinate(); final ControllerServiceNode controllerServiceNode = controller.getFlowManager().createControllerService(ServiceA.class.getName(), id, coordinate, null, true, true); // create the controller service dto final ControllerServiceDTO csDto = new ControllerServiceDTO(); csDto.setId(UUID.randomUUID().toString()); // use a different id csDto.setParentGroupId(controllerServiceNode.getProcessGroup() == null ? null : controllerServiceNode.getProcessGroup().getIdentifier()); csDto.setName(controllerServiceNode.getName()); csDto.setType(controllerServiceNode.getCanonicalClassName()); csDto.setBundle(null); // missing bundle csDto.setState(controllerServiceNode.getState().name()); csDto.setAnnotationData(controllerServiceNode.getAnnotationData()); csDto.setComments(controllerServiceNode.getComments()); csDto.setPersistsState(controllerServiceNode.getControllerServiceImplementation().getClass().isAnnotationPresent(Stateful.class)); csDto.setRestricted(controllerServiceNode.isRestricted()); csDto.setExtensionMissing(controllerServiceNode.isExtensionMissing()); csDto.setDescriptors(new LinkedHashMap<>()); csDto.setProperties(new LinkedHashMap<>()); // create the snippet with the controller service final FlowSnippetDTO flowSnippetDTO = new FlowSnippetDTO(); flowSnippetDTO.setControllerServices(Collections.singleton(csDto)); // instantiate the snippet assertEquals(0, controller.getFlowManager().getRootGroup().getControllerServices(false).size()); controller.getFlowManager().instantiateSnippet(controller.getFlowManager().getRootGroup(), flowSnippetDTO); }
Example 4
Source File: TestFlowController.java From nifi with Apache License 2.0 | 5 votes |
@Test public void testInstantiateSnippetWithControllerService() throws ProcessorInstantiationException { final String id = UUID.randomUUID().toString(); final BundleCoordinate coordinate = systemBundle.getBundleDetails().getCoordinate(); final ControllerServiceNode controllerServiceNode = controller.getFlowManager().createControllerService(ServiceA.class.getName(), id, coordinate, null, true, true); // create the controller service dto final ControllerServiceDTO csDto = new ControllerServiceDTO(); csDto.setId(UUID.randomUUID().toString()); // use a different id csDto.setParentGroupId(controllerServiceNode.getProcessGroup() == null ? null : controllerServiceNode.getProcessGroup().getIdentifier()); csDto.setName(controllerServiceNode.getName()); csDto.setType(controllerServiceNode.getCanonicalClassName()); csDto.setBundle(new BundleDTO(coordinate.getGroup(), coordinate.getId(), coordinate.getVersion())); csDto.setState(controllerServiceNode.getState().name()); csDto.setAnnotationData(controllerServiceNode.getAnnotationData()); csDto.setComments(controllerServiceNode.getComments()); csDto.setPersistsState(controllerServiceNode.getControllerServiceImplementation().getClass().isAnnotationPresent(Stateful.class)); csDto.setRestricted(controllerServiceNode.isRestricted()); csDto.setExtensionMissing(controllerServiceNode.isExtensionMissing()); csDto.setDescriptors(new LinkedHashMap<>()); csDto.setProperties(new LinkedHashMap<>()); // create the snippet with the controller service final FlowSnippetDTO flowSnippetDTO = new FlowSnippetDTO(); flowSnippetDTO.setControllerServices(Collections.singleton(csDto)); // instantiate the snippet assertEquals(0, controller.getFlowManager().getRootGroup().getControllerServices(false).size()); controller.getFlowManager().instantiateSnippet(controller.getFlowManager().getRootGroup(), flowSnippetDTO); assertEquals(1, controller.getFlowManager().getRootGroup().getControllerServices(false).size()); }
Example 5
Source File: ControllerServiceResource.java From nifi with Apache License 2.0 | 4 votes |
private ControllerServiceDTO createDTOWithDesiredRunStatus(final String id, final String runStatus) { final ControllerServiceDTO dto = new ControllerServiceDTO(); dto.setId(id); dto.setState(runStatus); return dto; }