org.apache.nifi.registry.flow.VersionedProcessor Java Examples
The following examples show how to use
org.apache.nifi.registry.flow.VersionedProcessor.
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: StandardFlowComparator.java From nifi-registry with Apache License 2.0 | 6 votes |
private void compare(final VersionedProcessor processorA, final VersionedProcessor processorB, final Set<FlowDifference> differences) { if (compareComponents(processorA, processorB, differences)) { return; } addIfDifferent(differences, DifferenceType.ANNOTATION_DATA_CHANGED, processorA, processorB, VersionedProcessor::getAnnotationData); addIfDifferent(differences, DifferenceType.AUTO_TERMINATED_RELATIONSHIPS_CHANGED, processorA, processorB, VersionedProcessor::getAutoTerminatedRelationships); addIfDifferent(differences, DifferenceType.BULLETIN_LEVEL_CHANGED, processorA, processorB, VersionedProcessor::getBulletinLevel); addIfDifferent(differences, DifferenceType.BUNDLE_CHANGED, processorA, processorB, VersionedProcessor::getBundle); addIfDifferent(differences, DifferenceType.CONCURRENT_TASKS_CHANGED, processorA, processorB, VersionedProcessor::getConcurrentlySchedulableTaskCount); addIfDifferent(differences, DifferenceType.EXECUTION_MODE_CHANGED, processorA, processorB, VersionedProcessor::getExecutionNode); addIfDifferent(differences, DifferenceType.PENALTY_DURATION_CHANGED, processorA, processorB, VersionedProcessor::getPenaltyDuration); addIfDifferent(differences, DifferenceType.RUN_DURATION_CHANGED, processorA, processorB, VersionedProcessor::getRunDurationMillis); addIfDifferent(differences, DifferenceType.RUN_SCHEDULE_CHANGED, processorA, processorB, VersionedProcessor::getSchedulingPeriod); addIfDifferent(differences, DifferenceType.SCHEDULING_STRATEGY_CHANGED, processorA, processorB, VersionedProcessor::getSchedulingStrategy); addIfDifferent(differences, DifferenceType.SCHEDULED_STATE_CHANGED, processorA, processorB, VersionedProcessor::getScheduledState); addIfDifferent(differences, DifferenceType.STYLE_CHANGED, processorA, processorB, VersionedProcessor::getStyle); addIfDifferent(differences, DifferenceType.YIELD_DURATION_CHANGED, processorA, processorB, VersionedProcessor::getYieldDuration); compareProperties(processorA, processorB, processorA.getProperties(), processorB.getProperties(), processorA.getPropertyDescriptors(), processorB.getPropertyDescriptors(), differences); }
Example #2
Source File: NiFiRegistryFlowMapperTest.java From nifi with Apache License 2.0 | 6 votes |
private void verifyProcessor(final VersionedProcessor versionedProcessor, final ProcessorNode processorNode, final String expectedGroupIdentifier) { assertEquals(processorNode.getName(), versionedProcessor.getName()); assertEquals(flowMapper.getGroupId(processorNode.getIdentifier()), versionedProcessor.getIdentifier()); assertEquals(expectedGroupIdentifier, versionedProcessor.getGroupIdentifier()); assertEquals(processorNode.getPosition().getX(), versionedProcessor.getPosition().getX(), 0); assertEquals(processorNode.getPosition().getY(), versionedProcessor.getPosition().getY(), 0); final PropertyDescriptor propertyDescriptor = processorNode.getProperties().keySet().iterator().next(); final VersionedPropertyDescriptor versionedPropertyDescriptor = versionedProcessor.getPropertyDescriptors().get(propertyDescriptor.getName()); assertTrue(versionedProcessor.getProperties().containsKey(propertyDescriptor.getName())); assertNotNull(versionedPropertyDescriptor); assertEquals(propertyDescriptor.getName(), versionedPropertyDescriptor.getName()); assertEquals(propertyDescriptor.getDisplayName(), versionedPropertyDescriptor.getDisplayName()); assertEquals(propertyDescriptor.isSensitive(), versionedPropertyDescriptor.isSensitive()); }
Example #3
Source File: TestJAXBVersionedProcessGroupSerializer.java From nifi-registry with Apache License 2.0 | 5 votes |
@Test public void testSerializeDeserializeFlowSnapshot() throws SerializationException { final VersionedSerializer<VersionedProcessGroup> serializer = new JAXBVersionedProcessGroupSerializer(); final VersionedProcessGroup processGroup1 = new VersionedProcessGroup(); processGroup1.setIdentifier("pg1"); processGroup1.setName("My Process Group"); final VersionedProcessor processor1 = new VersionedProcessor(); processor1.setIdentifier("processor1"); processor1.setName("My Processor 1"); // make sure nested objects are serialized/deserialized processGroup1.getProcessors().add(processor1); final ByteArrayOutputStream out = new ByteArrayOutputStream(); serializer.serialize(1, processGroup1, out); final String snapshotStr = new String(out.toByteArray(), StandardCharsets.UTF_8); //System.out.println(snapshotStr); final ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); in.mark(1024); final int version = serializer.readDataModelVersion(in); Assert.assertEquals(1, version); in.reset(); final VersionedProcessGroup deserializedProcessGroup1 = serializer.deserialize(in); Assert.assertEquals(processGroup1.getIdentifier(), deserializedProcessGroup1.getIdentifier()); Assert.assertEquals(processGroup1.getName(), deserializedProcessGroup1.getName()); Assert.assertEquals(1, deserializedProcessGroup1.getProcessors().size()); final VersionedProcessor deserializedProcessor1 = deserializedProcessGroup1.getProcessors().iterator().next(); Assert.assertEquals(processor1.getIdentifier(), deserializedProcessor1.getIdentifier()); Assert.assertEquals(processor1.getName(), deserializedProcessor1.getName()); }
Example #4
Source File: TestRegistryService.java From nifi-registry with Apache License 2.0 | 5 votes |
private VersionedProcessor createVersionedProcessor(String name){ VersionedProcessor processor = new VersionedProcessor(); processor.setName(name); processor.setIdentifier(name); processor.setProperties(new HashMap<>()); return processor; }
Example #5
Source File: NiFiRegProcessorSchemaFunction.java From nifi-minifi with Apache License 2.0 | 5 votes |
@Override public ProcessorSchema apply(final VersionedProcessor versionedProcessor) { Map<String, Object> map = new HashMap<>(); map.put(NAME_KEY, versionedProcessor.getName()); map.put(ID_KEY, versionedProcessor.getIdentifier()); map.put(CLASS_KEY, versionedProcessor.getType()); map.put(SCHEDULING_STRATEGY_KEY, versionedProcessor.getSchedulingStrategy()); map.put(SCHEDULING_PERIOD_KEY, versionedProcessor.getSchedulingPeriod()); map.put(CommonPropertyKeys.MAX_CONCURRENT_TASKS_KEY, versionedProcessor.getConcurrentlySchedulableTaskCount()); map.put(ProcessorSchema.PENALIZATION_PERIOD_KEY, versionedProcessor.getPenaltyDuration()); map.put(CommonPropertyKeys.YIELD_PERIOD_KEY, versionedProcessor.getYieldDuration()); Long runDurationMillis = versionedProcessor.getRunDurationMillis(); if (runDurationMillis != null) { map.put(ProcessorSchema.RUN_DURATION_NANOS_KEY, runDurationMillis * 1000); } final List<String> autoTerminateRelationships = new ArrayList<>(nullToEmpty(versionedProcessor.getAutoTerminatedRelationships())); map.put(ProcessorSchema.AUTO_TERMINATED_RELATIONSHIPS_LIST_KEY, autoTerminateRelationships); map.put(PROPERTIES_KEY, new HashMap<>(nullToEmpty(versionedProcessor.getProperties()))); String annotationData = versionedProcessor.getAnnotationData(); if(annotationData != null && !annotationData.isEmpty()) { map.put(ANNOTATION_DATA_KEY, annotationData); } return new ProcessorSchema(map); }
Example #6
Source File: FlowDifferenceFilters.java From nifi with Apache License 2.0 | 5 votes |
/** * Determines whether or not the given Process Group has a Connection whose source is the given Processor and that contains the given relationship * * @param processGroup the process group * @param processor the source processor * @param relationship the relationship * * @return <code>true</code> if such a connection exists, <code>false</code> otherwise. */ private static boolean hasConnection(final VersionedProcessGroup processGroup, final VersionedProcessor processor, final String relationship) { for (final VersionedConnection connection : processGroup.getConnections()) { if (connection.getSource().getId().equals(processor.getIdentifier()) && connection.getSelectedRelationships().contains(relationship)) { return true; } } return false; }
Example #7
Source File: NiFiRegistryFlowMapper.java From nifi with Apache License 2.0 | 5 votes |
public VersionedProcessor mapProcessor(final ProcessorNode procNode, final ControllerServiceProvider serviceProvider, final Set<String> includedGroupIds, final Map<String, ExternalControllerServiceReference> externalControllerServiceReferences) { final VersionedProcessor processor = new InstantiatedVersionedProcessor(procNode.getIdentifier(), procNode.getProcessGroupIdentifier()); processor.setIdentifier(getId(procNode.getVersionedComponentId(), procNode.getIdentifier())); processor.setGroupIdentifier(getGroupId(procNode.getProcessGroupIdentifier())); processor.setType(procNode.getCanonicalClassName()); processor.setAnnotationData(procNode.getAnnotationData()); processor.setAutoTerminatedRelationships(procNode.getAutoTerminatedRelationships().stream().map(Relationship::getName).collect(Collectors.toSet())); processor.setBulletinLevel(procNode.getBulletinLevel().name()); processor.setBundle(mapBundle(procNode.getBundleCoordinate())); processor.setComments(procNode.getComments()); processor.setConcurrentlySchedulableTaskCount(procNode.getMaxConcurrentTasks()); processor.setExecutionNode(procNode.getExecutionNode().name()); processor.setName(procNode.getName()); processor.setPenaltyDuration(procNode.getPenalizationPeriod()); processor.setPosition(mapPosition(procNode.getPosition())); processor.setProperties(mapProperties(procNode, serviceProvider)); processor.setPropertyDescriptors(mapPropertyDescriptors(procNode, serviceProvider, includedGroupIds, externalControllerServiceReferences)); processor.setRunDurationMillis(procNode.getRunDuration(TimeUnit.MILLISECONDS)); processor.setSchedulingPeriod(procNode.getSchedulingPeriod()); processor.setSchedulingStrategy(procNode.getSchedulingStrategy().name()); processor.setStyle(procNode.getStyle()); processor.setYieldDuration(procNode.getYieldPeriod()); processor.setScheduledState(procNode.getScheduledState() == ScheduledState.DISABLED ? org.apache.nifi.registry.flow.ScheduledState.DISABLED : org.apache.nifi.registry.flow.ScheduledState.ENABLED); return processor; }
Example #8
Source File: TestFlowDifferenceFilters.java From nifi with Apache License 2.0 | 5 votes |
@Test public void testFilterAddedRemotePortsWithNonRemoteInputPort() { VersionedProcessor versionedProcessor = new VersionedProcessor(); versionedProcessor.setComponentType(ComponentType.PROCESSOR); StandardFlowDifference flowDifference = new StandardFlowDifference( DifferenceType.COMPONENT_ADDED, null, versionedProcessor, null, null, ""); // predicate should return true because we do want to include changes for adding a non-port Assert.assertTrue(FlowDifferenceFilters.FILTER_ADDED_REMOVED_REMOTE_PORTS.test(flowDifference)); }
Example #9
Source File: TestFlowContentSerializer.java From nifi-registry with Apache License 2.0 | 4 votes |
@Test public void testSerializeDeserializeFlowContent() { final VersionedProcessor processor1 = new VersionedProcessor(); processor1.setIdentifier("processor1"); processor1.setName("My Processor 1"); final VersionedProcessGroup processGroup1 = new VersionedProcessGroup(); processGroup1.setIdentifier("pg1"); processGroup1.setName("My Process Group"); processGroup1.getProcessors().add(processor1); final VersionedFlowSnapshot snapshot = new VersionedFlowSnapshot(); snapshot.setFlowContents(processGroup1); final FlowContent flowContent = new FlowContent(); flowContent.setFlowSnapshot(snapshot); final ByteArrayOutputStream out = new ByteArrayOutputStream(); serializer.serializeFlowContent(flowContent, out); //final String json = new String(out.toByteArray(), StandardCharsets.UTF_8); //System.out.println(json); final ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); // make sure we can read the version from the input stream and it should be the current version final Integer version = serializer.readDataModelVersion(in); assertEquals(serializer.getCurrentDataModelVersion(), version); assertEquals(false, serializer.isProcessGroupVersion(version)); // make sure we can deserialize back to FlowContent final FlowContent deserializedFlowContent = serializer.deserializeFlowContent(version, in); assertNotNull(deserializedFlowContent); final VersionedFlowSnapshot deserializedSnapshot = deserializedFlowContent.getFlowSnapshot(); assertNotNull(deserializedSnapshot); final VersionedProcessGroup deserializedProcessGroup1 = deserializedSnapshot.getFlowContents(); assertNotNull(deserializedProcessGroup1); assertEquals(processGroup1.getIdentifier(), deserializedProcessGroup1.getIdentifier()); assertEquals(processGroup1.getName(), deserializedProcessGroup1.getName()); assertEquals(1, deserializedProcessGroup1.getProcessors().size()); final VersionedProcessor deserializedProcessor1 = deserializedProcessGroup1.getProcessors().iterator().next(); assertEquals(processor1.getIdentifier(), deserializedProcessor1.getIdentifier()); assertEquals(processor1.getName(), deserializedProcessor1.getName()); }
Example #10
Source File: UnsecuredNiFiRegistryClientIT.java From nifi-registry with Apache License 2.0 | 4 votes |
private static VersionedFlowSnapshot buildSnapshot(VersionedFlow flow, int num) { final VersionedFlowSnapshotMetadata snapshotMetadata = new VersionedFlowSnapshotMetadata(); snapshotMetadata.setBucketIdentifier(flow.getBucketIdentifier()); snapshotMetadata.setFlowIdentifier(flow.getIdentifier()); snapshotMetadata.setVersion(num); snapshotMetadata.setComments("This is snapshot #" + num); final VersionedProcessGroup rootProcessGroup = new VersionedProcessGroup(); rootProcessGroup.setIdentifier("root-pg"); rootProcessGroup.setName("Root Process Group"); final VersionedProcessGroup subProcessGroup = new VersionedProcessGroup(); subProcessGroup.setIdentifier("sub-pg"); subProcessGroup.setName("Sub Process Group"); rootProcessGroup.getProcessGroups().add(subProcessGroup); final Map<String,String> processorProperties = new HashMap<>(); processorProperties.put("Prop 1", "Val 1"); processorProperties.put("Prop 2", "Val 2"); final Map<String, VersionedPropertyDescriptor> propertyDescriptors = new HashMap<>(); final VersionedProcessor processor1 = new VersionedProcessor(); processor1.setIdentifier("p1"); processor1.setName("Processor 1"); processor1.setProperties(processorProperties); processor1.setPropertyDescriptors(propertyDescriptors); final VersionedProcessor processor2 = new VersionedProcessor(); processor2.setIdentifier("p2"); processor2.setName("Processor 2"); processor2.setProperties(processorProperties); processor2.setPropertyDescriptors(propertyDescriptors); subProcessGroup.getProcessors().add(processor1); subProcessGroup.getProcessors().add(processor2); final VersionedFlowSnapshot snapshot = new VersionedFlowSnapshot(); snapshot.setSnapshotMetadata(snapshotMetadata); snapshot.setFlowContents(rootProcessGroup); return snapshot; }
Example #11
Source File: ComponentFactory.java From nifi with Apache License 2.0 | 4 votes |
public StatelessProcessorWrapper createProcessor(final VersionedProcessor versionedProcessor, final boolean materializeContent, final StatelessControllerServiceLookup controllerServiceLookup, final VariableRegistry variableRegistry, final Set<URL> classpathUrls, final ParameterContext parameterContext) throws ProcessorInstantiationException { final String type = versionedProcessor.getType(); final String identifier = versionedProcessor.getIdentifier(); final Bundle bundle = getAvailableBundle(versionedProcessor.getBundle(), type); if (bundle == null) { throw new IllegalStateException("Unable to find bundle for coordinate " + versionedProcessor.getBundle().getGroup() + ":" + versionedProcessor.getBundle().getArtifact() + ":" + versionedProcessor.getBundle().getVersion()); } final ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader(); try { final ClassLoader detectedClassLoader = extensionManager.createInstanceClassLoader(type, identifier, bundle, classpathUrls == null ? Collections.emptySet() : classpathUrls); logger.debug("Setting context class loader to {} (parent = {}) to create {}", detectedClassLoader, detectedClassLoader.getParent(), type); final Class<?> rawClass = Class.forName(type, true, detectedClassLoader); Thread.currentThread().setContextClassLoader(detectedClassLoader); final Object extensionInstance = rawClass.newInstance(); final ComponentLog componentLog = new SLF4JComponentLog(extensionInstance); final Processor processor = (Processor) extensionInstance; final ProcessorInitializationContext initializationContext = new StatelessProcessorInitializationContext(versionedProcessor.getIdentifier(), processor, controllerServiceLookup); processor.initialize(initializationContext); // If no classpath urls were provided, check if we need to add additional classpath URL's based on configured properties. if (classpathUrls == null) { final Set<URL> additionalClasspathUrls = getAdditionalClasspathResources(processor.getPropertyDescriptors(), processor.getIdentifier(), versionedProcessor.getProperties(), parameterContext, variableRegistry,componentLog); if (!additionalClasspathUrls.isEmpty()) { return createProcessor(versionedProcessor, materializeContent, controllerServiceLookup, variableRegistry, additionalClasspathUrls, parameterContext); } } final StatelessProcessorWrapper processorWrapper = new StatelessProcessorWrapper(versionedProcessor.getIdentifier(), processor, null, controllerServiceLookup, variableRegistry, materializeContent, detectedClassLoader, parameterContext); // Configure the Processor processorWrapper.setAnnotationData(versionedProcessor.getAnnotationData()); versionedProcessor.getProperties().forEach(processorWrapper::setProperty); for (String relationship : versionedProcessor.getAutoTerminatedRelationships()) { processorWrapper.addAutoTermination(new Relationship.Builder().name(relationship).build()); } return processorWrapper; } catch (final Exception e) { throw new ProcessorInstantiationException(type, e); } finally { if (ctxClassLoader != null) { Thread.currentThread().setContextClassLoader(ctxClassLoader); } } }
Example #12
Source File: StatelessFlow.java From nifi with Apache License 2.0 | 4 votes |
private Set<VersionedProcessor> findProcessorsRecursive(final VersionedProcessGroup group) { final Set<VersionedProcessor> processors = new HashSet<>(); findProcessorsRecursive(group, processors); return processors; }
Example #13
Source File: StatelessFlow.java From nifi with Apache License 2.0 | 4 votes |
private void findProcessorsRecursive(final VersionedProcessGroup group, final Set<VersionedProcessor> processors) { processors.addAll(group.getProcessors()); group.getProcessGroups().forEach(child -> findProcessorsRecursive(child, processors)); }
Example #14
Source File: FlowDifferenceFilters.java From nifi with Apache License 2.0 | 4 votes |
public static boolean isNewRelationshipAutoTerminatedAndDefaulted(final FlowDifference fd, final VersionedProcessGroup processGroup, final FlowManager flowManager) { if (fd.getDifferenceType() != DifferenceType.AUTO_TERMINATED_RELATIONSHIPS_CHANGED) { return false; } if (!(fd.getComponentA() instanceof VersionedProcessor) || !(fd.getComponentB() instanceof InstantiatedVersionedProcessor)) { // Should not happen, since only processors have auto-terminated relationships. return false; } final VersionedProcessor processorA = (VersionedProcessor) fd.getComponentA(); final VersionedProcessor processorB = (VersionedProcessor) fd.getComponentB(); // Determine if this Flow Difference indicates that Processor B has all of the same Auto-Terminated Relationships as Processor A, plus some. // If that is the case, then it may be that a new Relationship was added, defaulting to 'Auto-Terminated' and that Processor B is still auto-terminated. // We want to be able to identify that case. final Set<String> autoTerminatedA = replaceNull(processorA.getAutoTerminatedRelationships(), Collections.emptySet()); final Set<String> autoTerminatedB = replaceNull(processorB.getAutoTerminatedRelationships(), Collections.emptySet()); // If B is smaller than A, then B cannot possibly contain all of A. So use that as a first comparison to avoid the expense of #containsAll if (autoTerminatedB.size() < autoTerminatedA.size() || !autoTerminatedB.containsAll(autoTerminatedA)) { // If B does not contain all of A, then the FlowDifference is indicative of some other change. return false; } final InstantiatedVersionedProcessor instantiatedVersionedProcessor = (InstantiatedVersionedProcessor) processorB; final ProcessorNode processorNode = flowManager.getProcessorNode(instantiatedVersionedProcessor.getInstanceId()); if (processorNode == null) { return false; } final Set<String> newlyAddedAutoTerminated = new HashSet<>(autoTerminatedB); newlyAddedAutoTerminated.removeAll(autoTerminatedA); for (final String relationshipName : newlyAddedAutoTerminated) { final Relationship relationship = processorNode.getRelationship(relationshipName); if (relationship == null) { return false; } final boolean defaultAutoTerminated = relationship.isAutoTerminated(); if (!defaultAutoTerminated) { return false; } if (hasConnection(processGroup, processorA, relationshipName)) { return false; } } return true; }
Example #15
Source File: ImportFlowIT.java From nifi with Apache License 2.0 | 4 votes |
private VersionedFlowSnapshot createFlowSnapshot(final List<ControllerServiceNode> controllerServices, final List<ProcessorNode> processors, final Set<Parameter> parameters) { final VersionedFlowSnapshotMetadata snapshotMetadata = new VersionedFlowSnapshotMetadata(); snapshotMetadata.setAuthor("unit-test"); snapshotMetadata.setBucketIdentifier("unit-test-bucket"); snapshotMetadata.setFlowIdentifier("unit-test-flow"); snapshotMetadata.setTimestamp(System.currentTimeMillis()); snapshotMetadata.setVersion(1); final Bucket bucket = new Bucket(); bucket.setCreatedTimestamp(System.currentTimeMillis()); bucket.setIdentifier("unit-test-bucket"); bucket.setName("Unit Test Bucket"); final VersionedFlow flow = new VersionedFlow(); flow.setBucketIdentifier("unit-test-bucket"); flow.setBucketName("Unit Test Bucket"); flow.setCreatedTimestamp(System.currentTimeMillis()); flow.setIdentifier("unit-test-flow"); flow.setName("Unit Test Flow"); final BundleCoordinate coordinate = getSystemBundle().getBundleDetails().getCoordinate(); final Bundle bundle = new Bundle(); bundle.setArtifact(coordinate.getId()); bundle.setGroup(coordinate.getGroup()); bundle.setVersion(coordinate.getVersion()); final NiFiRegistryFlowMapper flowMapper = new NiFiRegistryFlowMapper(getExtensionManager()); final Set<VersionedProcessor> versionedProcessors = new HashSet<>(); for (final ProcessorNode processor : processors) { final VersionedProcessor versionedProcessor = flowMapper.mapProcessor(processor, getFlowController().getControllerServiceProvider(), Collections.emptySet(), new HashMap<>()); versionedProcessors.add(versionedProcessor); processor.setVersionedComponentId(versionedProcessor.getIdentifier()); } final Set<VersionedControllerService> services = new HashSet<>(); for (final ControllerServiceNode serviceNode : controllerServices) { final VersionedControllerService service = flowMapper.mapControllerService(serviceNode, getFlowController().getControllerServiceProvider(), Collections.emptySet(), new HashMap<>()); services.add(service); serviceNode.setVersionedComponentId(service.getIdentifier()); } final VersionedProcessGroup flowContents = new VersionedProcessGroup(); flowContents.setIdentifier("unit-test-flow-contents"); flowContents.setName("Unit Test"); flowContents.setProcessors(versionedProcessors); flowContents.setControllerServices(services); final VersionedFlowSnapshot versionedFlowSnapshot = new VersionedFlowSnapshot(); versionedFlowSnapshot.setSnapshotMetadata(snapshotMetadata); versionedFlowSnapshot.setBucket(bucket); versionedFlowSnapshot.setFlow(flow); versionedFlowSnapshot.setFlowContents(flowContents); if (parameters != null) { final Set<VersionedParameter> versionedParameters = new HashSet<>(); for (final Parameter parameter : parameters) { final VersionedParameter versionedParameter = new VersionedParameter(); versionedParameter.setName(parameter.getDescriptor().getName()); versionedParameter.setValue(parameter.getValue()); versionedParameter.setSensitive(parameter.getDescriptor().isSensitive()); versionedParameters.add(versionedParameter); } final VersionedParameterContext versionedParameterContext = new VersionedParameterContext(); versionedParameterContext.setName("Unit Test Context"); versionedParameterContext.setParameters(versionedParameters); versionedFlowSnapshot.setParameterContexts(Collections.singletonMap(versionedParameterContext.getName(), versionedParameterContext)); flowContents.setParameterContextName("Unit Test Context"); } return versionedFlowSnapshot; }