Java Code Examples for org.apache.nifi.web.api.dto.ProcessorDTO#setId()

The following examples show how to use org.apache.nifi.web.api.dto.ProcessorDTO#setId() . 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: StandardNiFiWebConfigurationContext.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
private ProcessorDTO buildProcessorDto(String id, final String annotationData, Map<String, String> properties){
    ProcessorDTO processorDto = new ProcessorDTO();
    processorDto.setId(id);
    ProcessorConfigDTO configDto = new ProcessorConfigDTO();
    processorDto.setConfig(configDto);
    configDto.setAnnotationData(annotationData);
    configDto.setProperties(properties);
    return  processorDto;

}
 
Example 2
Source File: ITProcessorAccessControl.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
/**
 * Ensures the WRITE user can put a processor.
 *
 * @throws Exception ex
 */
@Test
public void testWriteUserPutProcessor() throws Exception {
    final ProcessorEntity entity = getRandomProcessor(helper.getWriteUser());
    assertFalse(entity.getPermissions().getCanRead());
    assertTrue(entity.getPermissions().getCanWrite());
    assertNull(entity.getComponent());

    final String updatedName = "Updated Name";

    // attempt to update the name
    final ProcessorDTO requestDto = new ProcessorDTO();
    requestDto.setId(entity.getId());
    requestDto.setName(updatedName);

    final long version = entity.getRevision().getVersion();
    final RevisionDTO requestRevision = new RevisionDTO();
    requestRevision.setVersion(version);
    requestRevision.setClientId(AccessControlHelper.WRITE_CLIENT_ID);

    final ProcessorEntity requestEntity = new ProcessorEntity();
    requestEntity.setId(entity.getId());
    requestEntity.setRevision(requestRevision);
    requestEntity.setComponent(requestDto);

    // perform the request
    final ClientResponse response = updateProcessor(helper.getWriteUser(), requestEntity);

    // ensure successful response
    assertEquals(200, response.getStatus());

    // get the response
    final ProcessorEntity responseEntity = response.getEntity(ProcessorEntity.class);

    // verify
    assertEquals(WRITE_CLIENT_ID, responseEntity.getRevision().getClientId());
    assertEquals(version + 1, responseEntity.getRevision().getVersion().longValue());
}
 
Example 3
Source File: ITProcessorAccessControl.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
/**
 * Ensures the NONE user cannot put a processor.
 *
 * @throws Exception ex
 */
@Test
public void testNoneUserPutProcessor() throws Exception {
    final ProcessorEntity entity = getRandomProcessor(helper.getNoneUser());
    assertFalse(entity.getPermissions().getCanRead());
    assertFalse(entity.getPermissions().getCanWrite());
    assertNull(entity.getComponent());

    final String updatedName = "Updated Name";

    // attempt to update the name
    final ProcessorDTO requestDto = new ProcessorDTO();
    requestDto.setId(entity.getId());
    requestDto.setName(updatedName);

    final long version = entity.getRevision().getVersion();
    final RevisionDTO requestRevision = new RevisionDTO();
    requestRevision.setVersion(version);
    requestRevision.setClientId(AccessControlHelper.NONE_CLIENT_ID);

    final ProcessorEntity requestEntity = new ProcessorEntity();
    requestEntity.setId(entity.getId());
    requestEntity.setRevision(requestRevision);
    requestEntity.setComponent(requestDto);

    // perform the request
    final ClientResponse response = updateProcessor(helper.getNoneUser(), requestEntity);

    // ensure forbidden response
    assertEquals(403, response.getStatus());
}
 
Example 4
Source File: ProcessorSchemaTest.java    From nifi-minifi with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
    config = new ProcessorConfigDTO();

    RelationshipDTO relationshipDTO = new RelationshipDTO();
    relationshipDTO.setName(testRelationship);
    relationshipDTO.setAutoTerminate(true);

    dto = new ProcessorDTO();
    dto.setConfig(config);
    dto.setName(testName);
    dto.setId(testId);
    dto.setType(testProcessorClass);
    config.setSchedulingStrategy(testSchedulingStrategy);
    config.setSchedulingPeriod(testSchedulingPeriod);
    config.setConcurrentlySchedulableTaskCount(testMaxConcurrentTasks);
    config.setPenaltyDuration(testPenalizationPeriod);
    config.setYieldDuration(testYieldDuration);
    config.setRunDurationMillis(testRunDurationNanos / 1000);
    config.setAnnotationData(testAnnotationData);
    dto.setRelationships(Arrays.asList(relationshipDTO));
    Map<String, String> properties = new HashMap<>();
    properties.put(testKey, testValue);
    config.setProperties(properties);

    map = new HashMap<>();
    map.put(CommonPropertyKeys.NAME_KEY, testName);
    map.put(CommonPropertyKeys.ID_KEY, testId);
    map.put(CLASS_KEY, testProcessorClass);
    map.put(CommonPropertyKeys.SCHEDULING_STRATEGY_KEY, testSchedulingStrategy);
    map.put(CommonPropertyKeys.SCHEDULING_PERIOD_KEY, testSchedulingPeriod);
    map.put(CommonPropertyKeys.MAX_CONCURRENT_TASKS_KEY, testMaxConcurrentTasks);
    map.put(ProcessorSchema.PENALIZATION_PERIOD_KEY, testPenalizationPeriod);
    map.put(CommonPropertyKeys.YIELD_PERIOD_KEY, testYieldDuration);
    map.put(ProcessorSchema.RUN_DURATION_NANOS_KEY, testRunDurationNanos);
    map.put(ProcessorSchema.AUTO_TERMINATED_RELATIONSHIPS_LIST_KEY, Arrays.asList(testRelationship));
    map.put(PROPERTIES_KEY, new HashMap<>(properties));
    map.put(ANNOTATION_DATA_KEY, testAnnotationData);
}
 
Example 5
Source File: StandardNiFiWebConfigurationContext.java    From nifi with Apache License 2.0 5 votes vote down vote up
private ProcessorDTO buildProcessorDto(String id, final String annotationData, Map<String, String> properties){
    ProcessorDTO processorDto = new ProcessorDTO();
    processorDto.setId(id);
    ProcessorConfigDTO configDto = new ProcessorConfigDTO();
    processorDto.setConfig(configDto);
    configDto.setAnnotationData(annotationData);
    configDto.setProperties(properties);
    return  processorDto;

}
 
Example 6
Source File: ITProcessorAccessControl.java    From nifi with Apache License 2.0 5 votes vote down vote up
/**
 * Ensures the WRITE user can put a processor.
 *
 * @throws Exception ex
 */
@Test
public void testWriteUserPutProcessor() throws Exception {
    final ProcessorEntity entity = getRandomProcessor(helper.getWriteUser());
    assertFalse(entity.getPermissions().getCanRead());
    assertTrue(entity.getPermissions().getCanWrite());
    assertNull(entity.getComponent());

    final String updatedName = "Updated Name";

    // attempt to update the name
    final ProcessorDTO requestDto = new ProcessorDTO();
    requestDto.setId(entity.getId());
    requestDto.setName(updatedName);

    final long version = entity.getRevision().getVersion();
    final RevisionDTO requestRevision = new RevisionDTO();
    requestRevision.setVersion(version);
    requestRevision.setClientId(AccessControlHelper.WRITE_CLIENT_ID);

    final ProcessorEntity requestEntity = new ProcessorEntity();
    requestEntity.setId(entity.getId());
    requestEntity.setRevision(requestRevision);
    requestEntity.setComponent(requestDto);

    // perform the request
    final Response response = updateProcessor(helper.getWriteUser(), requestEntity);

    // ensure successful response
    assertEquals(200, response.getStatus());

    // get the response
    final ProcessorEntity responseEntity = response.readEntity(ProcessorEntity.class);

    // verify
    assertEquals(WRITE_CLIENT_ID, responseEntity.getRevision().getClientId());
    assertEquals(version + 1, responseEntity.getRevision().getVersion().longValue());
}
 
Example 7
Source File: ITProcessorAccessControl.java    From nifi with Apache License 2.0 5 votes vote down vote up
/**
 * Ensures the NONE user cannot put a processor.
 *
 * @throws Exception ex
 */
@Test
public void testNoneUserPutProcessor() throws Exception {
    final ProcessorEntity entity = getRandomProcessor(helper.getNoneUser());
    assertFalse(entity.getPermissions().getCanRead());
    assertFalse(entity.getPermissions().getCanWrite());
    assertNull(entity.getComponent());

    final String updatedName = "Updated Name";

    // attempt to update the name
    final ProcessorDTO requestDto = new ProcessorDTO();
    requestDto.setId(entity.getId());
    requestDto.setName(updatedName);

    final long version = entity.getRevision().getVersion();
    final RevisionDTO requestRevision = new RevisionDTO();
    requestRevision.setVersion(version);
    requestRevision.setClientId(AccessControlHelper.NONE_CLIENT_ID);

    final ProcessorEntity requestEntity = new ProcessorEntity();
    requestEntity.setId(entity.getId());
    requestEntity.setRevision(requestRevision);
    requestEntity.setComponent(requestDto);

    // perform the request
    final Response response = updateProcessor(helper.getNoneUser(), requestEntity);

    // ensure forbidden response
    assertEquals(403, response.getStatus());
}
 
Example 8
Source File: NiFiClientUtil.java    From nifi with Apache License 2.0 5 votes vote down vote up
public ProcessorEntity updateProcessorConfig(final ProcessorEntity currentEntity, final ProcessorConfigDTO config) throws NiFiClientException, IOException {
    final ProcessorDTO processorDto = new ProcessorDTO();
    processorDto.setConfig(config);
    processorDto.setId(currentEntity.getId());

    final ProcessorEntity updatedEntity = new ProcessorEntity();
    updatedEntity.setRevision(currentEntity.getRevision());
    updatedEntity.setComponent(processorDto);
    updatedEntity.setId(currentEntity.getId());

    return nifiClient.getProcessorClient().updateProcessor(updatedEntity);
}
 
Example 9
Source File: FlowFromDOMFactory.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
public static ProcessorDTO getProcessor(final Element element, final StringEncryptor encryptor) {
    final ProcessorDTO dto = new ProcessorDTO();

    dto.setId(getString(element, "id"));
    dto.setName(getString(element, "name"));
    dto.setType(getString(element, "class"));
    dto.setPosition(getPosition(DomUtils.getChild(element, "position")));
    dto.setStyle(getStyle(DomUtils.getChild(element, "styles")));

    final ProcessorConfigDTO configDto = new ProcessorConfigDTO();
    dto.setConfig(configDto);
    configDto.setComments(getString(element, "comment"));
    configDto.setConcurrentlySchedulableTaskCount(getInt(element, "maxConcurrentTasks"));
    final String schedulingPeriod = getString(element, "schedulingPeriod");
    configDto.setSchedulingPeriod(schedulingPeriod);
    configDto.setPenaltyDuration(getString(element, "penalizationPeriod"));
    configDto.setYieldDuration(getString(element, "yieldPeriod"));
    configDto.setBulletinLevel(getString(element, "bulletinLevel"));
    configDto.setLossTolerant(getBoolean(element, "lossTolerant"));
    final ScheduledState scheduledState = getScheduledState(element);
    dto.setState(scheduledState.toString());

    // handle scheduling strategy
    final String schedulingStrategyName = getString(element, "schedulingStrategy");
    if (schedulingStrategyName == null || schedulingStrategyName.trim().isEmpty()) {
        configDto.setSchedulingStrategy(SchedulingStrategy.TIMER_DRIVEN.name());
    } else {
        configDto.setSchedulingStrategy(schedulingStrategyName.trim());
    }

    // handle execution node
    final String executionNode = getString(element, "executionNode");
    if (executionNode == null || executionNode.trim().isEmpty()) {
        configDto.setExecutionNode(ExecutionNode.ALL.name());
    } else {
        configDto.setExecutionNode(executionNode.trim());
    }

    final Long runDurationNanos = getOptionalLong(element, "runDurationNanos");
    if (runDurationNanos != null) {
        configDto.setRunDurationMillis(TimeUnit.NANOSECONDS.toMillis(runDurationNanos));
    }

    configDto.setProperties(getProperties(element, encryptor));
    configDto.setAnnotationData(getString(element, "annotationData"));

    final Set<String> autoTerminatedRelationships = new HashSet<>();
    final List<Element> autoTerminateList = getChildrenByTagName(element, "autoTerminatedRelationship");
    for (final Element autoTerminateElement : autoTerminateList) {
        autoTerminatedRelationships.add(autoTerminateElement.getTextContent());
    }
    configDto.setAutoTerminatedRelationships(autoTerminatedRelationships);

    return dto;
}
 
Example 10
Source File: ProcessorResource.java    From nifi with Apache License 2.0 4 votes vote down vote up
private ProcessorDTO createDTOWithDesiredRunStatus(final String id, final String runStatus) {
    final ProcessorDTO dto = new ProcessorDTO();
    dto.setId(id);
    dto.setState(runStatus);
    return dto;
}
 
Example 11
Source File: FlowFromDOMFactory.java    From nifi with Apache License 2.0 4 votes vote down vote up
public static ProcessorDTO getProcessor(final Element element, final StringEncryptor encryptor, final FlowEncodingVersion flowEncodingVersion) {
    final ProcessorDTO dto = new ProcessorDTO();

    dto.setId(getString(element, "id"));
    dto.setVersionedComponentId(getString(element, "versionedComponentId"));
    dto.setName(getString(element, "name"));
    dto.setType(getString(element, "class"));
    dto.setBundle(getBundle(DomUtils.getChild(element, "bundle")));
    dto.setPosition(getPosition(DomUtils.getChild(element, "position")));
    dto.setStyle(getStyle(DomUtils.getChild(element, "styles")));

    final ProcessorConfigDTO configDto = new ProcessorConfigDTO();
    dto.setConfig(configDto);
    configDto.setComments(getString(element, "comment"));
    configDto.setConcurrentlySchedulableTaskCount(getInt(element, "maxConcurrentTasks"));
    final String schedulingPeriod = getString(element, "schedulingPeriod");
    configDto.setSchedulingPeriod(schedulingPeriod);
    configDto.setPenaltyDuration(getString(element, "penalizationPeriod"));
    configDto.setYieldDuration(getString(element, "yieldPeriod"));
    configDto.setBulletinLevel(getString(element, "bulletinLevel"));
    configDto.setLossTolerant(getBoolean(element, "lossTolerant"));
    final ScheduledState scheduledState = getScheduledState(element);
    dto.setState(scheduledState.toString());

    // handle scheduling strategy
    final String schedulingStrategyName = getString(element, "schedulingStrategy");
    if (schedulingStrategyName == null || schedulingStrategyName.trim().isEmpty()) {
        configDto.setSchedulingStrategy(SchedulingStrategy.TIMER_DRIVEN.name());
    } else {
        configDto.setSchedulingStrategy(schedulingStrategyName.trim());
    }

    // handle execution node
    final String executionNode = getString(element, "executionNode");
    if (executionNode == null || executionNode.trim().isEmpty()) {
        configDto.setExecutionNode(ExecutionNode.ALL.name());
    } else {
        configDto.setExecutionNode(executionNode.trim());
    }

    final Long runDurationNanos = getOptionalLong(element, "runDurationNanos");
    if (runDurationNanos != null) {
        configDto.setRunDurationMillis(TimeUnit.NANOSECONDS.toMillis(runDurationNanos));
    }

    configDto.setProperties(getProperties(element, encryptor, flowEncodingVersion));
    configDto.setAnnotationData(getString(element, "annotationData"));

    final Set<String> autoTerminatedRelationships = new HashSet<>();
    final List<Element> autoTerminateList = getChildrenByTagName(element, "autoTerminatedRelationship");
    for (final Element autoTerminateElement : autoTerminateList) {
        autoTerminatedRelationships.add(autoTerminateElement.getTextContent());
    }
    configDto.setAutoTerminatedRelationships(autoTerminatedRelationships);

    return dto;
}
 
Example 12
Source File: TestFlowController.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Test(expected = IllegalArgumentException.class)
public void testInstantiateSnippetWhenProcessorMissingBundle() throws Exception {
    final String id = UUID.randomUUID().toString();
    final BundleCoordinate coordinate = systemBundle.getBundleDetails().getCoordinate();
    final ProcessorNode processorNode = controller.getFlowManager().createProcessor(DummyProcessor.class.getName(), id, coordinate);

    // create a processor dto
    final ProcessorDTO processorDTO = new ProcessorDTO();
    processorDTO.setId(UUID.randomUUID().toString()); // use a different id here
    processorDTO.setPosition(new PositionDTO(new Double(0), new Double(0)));
    processorDTO.setStyle(processorNode.getStyle());
    processorDTO.setParentGroupId("1234");
    processorDTO.setInputRequirement(processorNode.getInputRequirement().name());
    processorDTO.setPersistsState(processorNode.getProcessor().getClass().isAnnotationPresent(Stateful.class));
    processorDTO.setRestricted(processorNode.isRestricted());
    processorDTO.setExecutionNodeRestricted(processorNode.isExecutionNodeRestricted());
    processorDTO.setExtensionMissing(processorNode.isExtensionMissing());

    processorDTO.setType(processorNode.getCanonicalClassName());
    processorDTO.setBundle(null); // missing bundle
    processorDTO.setName(processorNode.getName());
    processorDTO.setState(processorNode.getScheduledState().toString());

    processorDTO.setRelationships(new ArrayList<>());

    processorDTO.setDescription("description");
    processorDTO.setSupportsParallelProcessing(!processorNode.isTriggeredSerially());
    processorDTO.setSupportsEventDriven(processorNode.isEventDrivenSupported());
    processorDTO.setSupportsBatching(processorNode.isSessionBatchingSupported());

    ProcessorConfigDTO configDTO = new ProcessorConfigDTO();
    configDTO.setSchedulingPeriod(processorNode.getSchedulingPeriod());
    configDTO.setPenaltyDuration(processorNode.getPenalizationPeriod());
    configDTO.setYieldDuration(processorNode.getYieldPeriod());
    configDTO.setRunDurationMillis(processorNode.getRunDuration(TimeUnit.MILLISECONDS));
    configDTO.setConcurrentlySchedulableTaskCount(processorNode.getMaxConcurrentTasks());
    configDTO.setLossTolerant(processorNode.isLossTolerant());
    configDTO.setComments(processorNode.getComments());
    configDTO.setBulletinLevel(processorNode.getBulletinLevel().name());
    configDTO.setSchedulingStrategy(processorNode.getSchedulingStrategy().name());
    configDTO.setExecutionNode(processorNode.getExecutionNode().name());
    configDTO.setAnnotationData(processorNode.getAnnotationData());

    processorDTO.setConfig(configDTO);

    // create the snippet with the processor
    final FlowSnippetDTO flowSnippetDTO = new FlowSnippetDTO();
    flowSnippetDTO.setProcessors(Collections.singleton(processorDTO));

    // instantiate the snippet
    assertEquals(0, controller.getFlowManager().getRootGroup().getProcessors().size());
    controller.getFlowManager().instantiateSnippet(controller.getFlowManager().getRootGroup(), flowSnippetDTO);
}
 
Example 13
Source File: TestFlowController.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Test
public void testInstantiateSnippetWithProcessor() throws ProcessorInstantiationException {
    final String id = UUID.randomUUID().toString();
    final BundleCoordinate coordinate = systemBundle.getBundleDetails().getCoordinate();
    final ProcessorNode processorNode = controller.getFlowManager().createProcessor(DummyProcessor.class.getName(), id, coordinate);

    // create a processor dto
    final ProcessorDTO processorDTO = new ProcessorDTO();
    processorDTO.setId(UUID.randomUUID().toString()); // use a different id here
    processorDTO.setPosition(new PositionDTO(new Double(0), new Double(0)));
    processorDTO.setStyle(processorNode.getStyle());
    processorDTO.setParentGroupId("1234");
    processorDTO.setInputRequirement(processorNode.getInputRequirement().name());
    processorDTO.setPersistsState(processorNode.getProcessor().getClass().isAnnotationPresent(Stateful.class));
    processorDTO.setRestricted(processorNode.isRestricted());
    processorDTO.setExecutionNodeRestricted(processorNode.isExecutionNodeRestricted());
    processorDTO.setExtensionMissing(processorNode.isExtensionMissing());

    processorDTO.setType(processorNode.getCanonicalClassName());
    processorDTO.setBundle(new BundleDTO(coordinate.getGroup(), coordinate.getId(), coordinate.getVersion()));
    processorDTO.setName(processorNode.getName());
    processorDTO.setState(processorNode.getScheduledState().toString());

    processorDTO.setRelationships(new ArrayList<>());

    processorDTO.setDescription("description");
    processorDTO.setSupportsParallelProcessing(!processorNode.isTriggeredSerially());
    processorDTO.setSupportsEventDriven(processorNode.isEventDrivenSupported());
    processorDTO.setSupportsBatching(processorNode.isSessionBatchingSupported());

    ProcessorConfigDTO configDTO = new ProcessorConfigDTO();
    configDTO.setSchedulingPeriod(processorNode.getSchedulingPeriod());
    configDTO.setPenaltyDuration(processorNode.getPenalizationPeriod());
    configDTO.setYieldDuration(processorNode.getYieldPeriod());
    configDTO.setRunDurationMillis(processorNode.getRunDuration(TimeUnit.MILLISECONDS));
    configDTO.setConcurrentlySchedulableTaskCount(processorNode.getMaxConcurrentTasks());
    configDTO.setLossTolerant(processorNode.isLossTolerant());
    configDTO.setComments(processorNode.getComments());
    configDTO.setBulletinLevel(processorNode.getBulletinLevel().name());
    configDTO.setSchedulingStrategy(processorNode.getSchedulingStrategy().name());
    configDTO.setExecutionNode(processorNode.getExecutionNode().name());
    configDTO.setAnnotationData(processorNode.getAnnotationData());

    processorDTO.setConfig(configDTO);

    // create the snippet with the processor
    final FlowSnippetDTO flowSnippetDTO = new FlowSnippetDTO();
    flowSnippetDTO.setProcessors(Collections.singleton(processorDTO));

    // instantiate the snippet
    assertEquals(0, controller.getFlowManager().getRootGroup().getProcessors().size());
    controller.getFlowManager().instantiateSnippet(controller.getFlowManager().getRootGroup(), flowSnippetDTO);
    assertEquals(1, controller.getFlowManager().getRootGroup().getProcessors().size());
}
 
Example 14
Source File: TestFlowController.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Test
public void testInstantiateSnippetWithDisabledProcessor() throws ProcessorInstantiationException {
    final String id = UUID.randomUUID().toString();
    final BundleCoordinate coordinate = systemBundle.getBundleDetails().getCoordinate();
    final ProcessorNode processorNode = controller.getFlowManager().createProcessor(DummyProcessor.class.getName(), id, coordinate);
    processorNode.disable();

    // create a processor dto
    final ProcessorDTO processorDTO = new ProcessorDTO();
    processorDTO.setId(UUID.randomUUID().toString()); // use a different id here
    processorDTO.setPosition(new PositionDTO(new Double(0), new Double(0)));
    processorDTO.setStyle(processorNode.getStyle());
    processorDTO.setParentGroupId("1234");
    processorDTO.setInputRequirement(processorNode.getInputRequirement().name());
    processorDTO.setPersistsState(processorNode.getProcessor().getClass().isAnnotationPresent(Stateful.class));
    processorDTO.setRestricted(processorNode.isRestricted());
    processorDTO.setExecutionNodeRestricted(processorNode.isExecutionNodeRestricted());
    processorDTO.setExtensionMissing(processorNode.isExtensionMissing());

    processorDTO.setType(processorNode.getCanonicalClassName());
    processorDTO.setBundle(new BundleDTO(coordinate.getGroup(), coordinate.getId(), coordinate.getVersion()));
    processorDTO.setName(processorNode.getName());
    processorDTO.setState(processorNode.getScheduledState().toString());

    processorDTO.setRelationships(new ArrayList<>());

    processorDTO.setDescription("description");
    processorDTO.setSupportsParallelProcessing(!processorNode.isTriggeredSerially());
    processorDTO.setSupportsEventDriven(processorNode.isEventDrivenSupported());
    processorDTO.setSupportsBatching(processorNode.isSessionBatchingSupported());

    ProcessorConfigDTO configDTO = new ProcessorConfigDTO();
    configDTO.setSchedulingPeriod(processorNode.getSchedulingPeriod());
    configDTO.setPenaltyDuration(processorNode.getPenalizationPeriod());
    configDTO.setYieldDuration(processorNode.getYieldPeriod());
    configDTO.setRunDurationMillis(processorNode.getRunDuration(TimeUnit.MILLISECONDS));
    configDTO.setConcurrentlySchedulableTaskCount(processorNode.getMaxConcurrentTasks());
    configDTO.setLossTolerant(processorNode.isLossTolerant());
    configDTO.setComments(processorNode.getComments());
    configDTO.setBulletinLevel(processorNode.getBulletinLevel().name());
    configDTO.setSchedulingStrategy(processorNode.getSchedulingStrategy().name());
    configDTO.setExecutionNode(processorNode.getExecutionNode().name());
    configDTO.setAnnotationData(processorNode.getAnnotationData());

    processorDTO.setConfig(configDTO);

    // create the snippet with the processor
    final FlowSnippetDTO flowSnippetDTO = new FlowSnippetDTO();
    flowSnippetDTO.setProcessors(Collections.singleton(processorDTO));

    // instantiate the snippet
    assertEquals(0, controller.getFlowManager().getRootGroup().getProcessors().size());
    controller.getFlowManager().instantiateSnippet(controller.getFlowManager().getRootGroup(), flowSnippetDTO);
    assertEquals(1, controller.getFlowManager().getRootGroup().getProcessors().size());
    assertTrue(controller.getFlowManager().getRootGroup().getProcessors().iterator().next().getScheduledState().equals(ScheduledState.DISABLED));
}