StandardFDExtensionManager implements FDExtensionManager { @Override public Optional<PropertyDescriptor> getProcessorPropertyDescriptor(final String type, final Bundle bundle, final String propertyName) { final ProcessorDefinition manifestProcessor = locateManifestProcessor(type, bundle); final Map<String,PropertyDescriptor> propertyDescriptors = manifestProcessor.getPropertyDescriptors(); if (propertyDescriptors == null || !propertyDescriptors.containsKey(propertyName)) { return Optional.empty(); } else { return Optional.of(propertyDescriptors.get(propertyName)); } } 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 testGetProcessorPropertyDescriptorWhenExists() { final String propertyName = "SSL Context Service"; final org.apache.nifi.registry.flow.Bundle bundle = getRequestBundle(httpBundle); final Optional<PropertyDescriptor> propertyDescriptor = extensionManager.getProcessorPropertyDescriptor( invokeHttpProcessor.getType(), bundle, propertyName); assertTrue(propertyDescriptor.isPresent()); assertEquals(propertyName, propertyDescriptor.get().getName()); }
@Test public void testGetProcessorPropertyDescriptorWhenDoesNotExist() { final String propertyName = "DOES NOT EXIST"; final org.apache.nifi.registry.flow.Bundle bundle = getRequestBundle(httpBundle); final Optional<PropertyDescriptor> propertyDescriptor = extensionManager.getProcessorPropertyDescriptor( invokeHttpProcessor.getType(), bundle, propertyName); assertFalse(propertyDescriptor.isPresent()); }