ConfigSchemaFlowTransformService implements FlowTransformService<ConfigSchema> { @Override public ConfigSchema transform(final VersionedFlowSnapshot versionedFlowSnapshot) throws FlowTransformException { if (versionedFlowSnapshot == null) { throw new IllegalArgumentException("VersionedFlowSnapshot cannot be null"); } try { return ConfigMain.transformVersionedFlowSnapshotToSchema(versionedFlowSnapshot); } catch (Exception e) { throw new FlowTransformException("Unable to transform flow due to: " + e.getMessage(), e); } }  @Override ConfigSchema transform(final VersionedFlowSnapshot versionedFlowSnapshot);  }
@Test public void testTransform() throws FlowTransformException { final VersionedFlowSnapshotMetadata snapshotMetadata = new VersionedFlowSnapshotMetadata(); snapshotMetadata.setBucketIdentifier("bucket 1"); snapshotMetadata.setFlowIdentifier("flow 2"); snapshotMetadata.setVersion(1); snapshotMetadata.setComments("This is snapshot #1"); final VersionedProcessGroup root = new VersionedProcessGroup(); root.setIdentifier("root"); root.setName("Root"); final Map<String,String> props = new HashMap<>(); props.put("Property 1", "Value 1"); final Map<String, VersionedPropertyDescriptor> propDescriptors = new HashMap<>(); final VersionedPropertyDescriptor propDescriptor1 = new VersionedPropertyDescriptor(); propDescriptor1.setName("Property 1"); propDescriptors.put(propDescriptor1.getName(), propDescriptor1); final VersionedProcessor proc1 = new VersionedProcessor(); proc1.setIdentifier("p1"); proc1.setName("Processor 1"); proc1.setProperties(props); proc1.setPropertyDescriptors(propDescriptors); root.getProcessors().add(proc1); final VersionedFlowSnapshot snapshot = new VersionedFlowSnapshot(); snapshot.setSnapshotMetadata(snapshotMetadata); snapshot.setFlowContents(root); final FlowTransformService<ConfigSchema> transformService = new ConfigSchemaFlowTransformService(); final ConfigSchema configSchema = transformService.transform(snapshot); Assert.assertNotNull(configSchema); Assert.assertNotNull(configSchema.getProcessGroupSchema()); Assert.assertNotNull(configSchema.getProcessGroupSchema().getProcessors()); Assert.assertEquals(1, configSchema.getProcessGroupSchema().getProcessors().size()); }