StandardFDExtensionManager implements FDExtensionManager { @Override public FDProcessor createProcessor(final String type, final Bundle bundle) { final ProcessorDefinition manifestProcessor = locateManifestProcessor(type, bundle); return createProcessor(type, bundle, manifestProcessor); } StandardFDExtensionManager(final AgentManifest agentManifest); @Override Set<FDComponentType> getProcessorTypes(); @Override ProcessorDefinition getProcessorDefinition(final String type, final Bundle bundle); @Override FDProcessor createProcessor(final String type, final Bundle bundle); @Override Optional<PropertyDescriptor> getProcessorPropertyDescriptor(final String type, final Bundle bundle, final String propertyName); @Override PropertyDescriptor createDynamicProcessorPropertyDescriptor(final String type, final Bundle bundle, final String propertyName); @Override Set<FDComponentType> getControllerServiceTypes(); @Override ControllerServiceDefinition getControllerServiceDefinition(final String type, final Bundle bundle); @Override FDControllerService createControllerService(final String type, final Bundle bundle); @Override Optional<PropertyDescriptor> getControllerServicePropertyDescriptor(final String type, final Bundle bundle, final String propertyName); @Override PropertyDescriptor createDynamicControllerServicePropertyDescriptor(final String type, final Bundle bundle, final String propertyName);  }
@Test public void testCreateProcessorsWhenExists() { final org.apache.nifi.registry.flow.Bundle bundle = getRequestBundle(httpBundle); final FDProcessor processor = extensionManager.createProcessor(invokeHttpProcessor.getType(), bundle); assertNotNull(processor); assertNotNull(processor.getComponentConfiguration()); assertEquals(invokeHttpProcessor.getType(), processor.getComponentConfiguration().getType()); assertEquals(bundle.getGroup(), processor.getComponentConfiguration().getBundle().getGroup()); assertEquals(bundle.getArtifact(), processor.getComponentConfiguration().getBundle().getArtifact()); assertEquals(bundle.getVersion(), processor.getComponentConfiguration().getBundle().getVersion()); assertNotNull(processor.getComponentDefinition()); assertEquals(invokeHttpProcessor.getType(), processor.getComponentDefinition().getType()); assertEquals(invokeHttpProcessor.getGroup(), processor.getComponentDefinition().getGroup()); assertEquals(invokeHttpProcessor.getArtifact(), processor.getComponentDefinition().getArtifact()); assertEquals(invokeHttpProcessor.getVersion(), processor.getComponentDefinition().getVersion()); }
@Test(expected = IllegalArgumentException.class) public void testCreateProcessorWhenTypeDoesNotExist() { final org.apache.nifi.registry.flow.Bundle bundle = getRequestBundle(httpBundle); extensionManager.createProcessor("does-not-exist", bundle); }
@Test(expected = IllegalArgumentException.class) public void testCreateProcessorWhenBundleDoesNotExist() { final org.apache.nifi.registry.flow.Bundle bundle = getRequestBundle(httpBundle); bundle.setGroup("does-not-exist"); extensionManager.createProcessor(invokeHttpProcessor.getType(), bundle); }