StandardFDExtensionManager implements FDExtensionManager { @Override public FDControllerService createControllerService(final String type, final Bundle bundle) { final ControllerServiceDefinition manifestControllerService = locateManifestControllerService(type, bundle); return createControllerService(type, bundle, manifestControllerService); } 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 testCreateControllerServiceWhenExists() { final org.apache.nifi.registry.flow.Bundle bundle = getRequestBundle(systemBundle); final FDControllerService controllerService = extensionManager.createControllerService(sslContextService.getType(), bundle); assertNotNull(controllerService); assertNotNull(controllerService.getComponentConfiguration()); assertNotNull(controllerService.getComponentDefinition()); assertEquals(sslContextService.getType(), controllerService.getComponentDefinition().getType()); assertEquals(sslContextService.getGroup(), controllerService.getComponentDefinition().getGroup()); assertEquals(sslContextService.getArtifact(), controllerService.getComponentDefinition().getArtifact()); assertEquals(sslContextService.getVersion(), controllerService.getComponentDefinition().getVersion()); }
@Test(expected = IllegalArgumentException.class) public void testCreateControllerServiceWhenTypeDoesNotExist() { final org.apache.nifi.registry.flow.Bundle bundle = getRequestBundle(systemBundle); extensionManager.createControllerService("does-not-exist", bundle); }
@Test(expected = IllegalArgumentException.class) public void testCreateControllerServiceWhenBundleDoesNotExist() { final org.apache.nifi.registry.flow.Bundle bundle = getRequestBundle(systemBundle); bundle.setGroup("does-not-exist"); extensionManager.createControllerService(sslContextService.getType(), bundle); }