NIFI-6917 - fix doc for dynamic properties variables support in JMS Connection Factory Provider

Signed-off-by: Matthew Burgess <mattyb149@apache.org>

This closes #3914
This commit is contained in:
Pierre Villard 2019-12-04 03:45:04 +01:00 committed by Matthew Burgess
parent 1898ad44be
commit 41fef551c3
No known key found for this signature in database
GPG Key ID: 05D3DEB8126DAD24
2 changed files with 23 additions and 2 deletions

View File

@ -63,7 +63,8 @@ import org.slf4j.LoggerFactory;
@DynamicProperty(name = "The name of a Connection Factory configuration property.", value = "The value of a given Connection Factory configuration property.",
description = "The properties that are set following Java Beans convention where a property name is derived from the 'set*' method of the vendor "
+ "specific ConnectionFactory's implementation. For example, 'com.ibm.mq.jms.MQConnectionFactory.setChannel(String)' would imply 'channel' "
+ "property and 'com.ibm.mq.jms.MQConnectionFactory.setTransportType(int)' would imply 'transportType' property.")
+ "property and 'com.ibm.mq.jms.MQConnectionFactory.setTransportType(int)' would imply 'transportType' property.",
expressionLanguageScope = ExpressionLanguageScope.VARIABLE_REGISTRY)
@SeeAlso(classNames = {"org.apache.nifi.jms.processors.ConsumeJMS", "org.apache.nifi.jms.processors.PublishJMS"})
public class JMSConnectionFactoryProvider extends AbstractControllerService implements JMSConnectionFactoryProviderDefinition {
@ -134,6 +135,7 @@ public class JMSConnectionFactoryProvider extends AbstractControllerService impl
+ "' property to be set on the provided ConnectionFactory implementation.")
.name(propertyDescriptorName)
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
.dynamic(true)
.build();
}

View File

@ -480,6 +480,25 @@ public class JMSConnectionFactoryProviderTest {
runner.enableControllerService(cfProvider);
assertEquals(cfProvider.getSetProperties(), ImmutableMap.of("connectionNameList", HOSTNAME+"("+PORT+")"));
assertEquals(cfProvider.getSetProperties(), ImmutableMap.of("connectionNameList", HOSTNAME + "(" + PORT + ")"));
}
@Test
public void dynamicPropertiesSetOnSingleTestBrokerConnectionFactory() throws InitializationException {
TestRunner runner = TestRunners.newTestRunner(mock(Processor.class));
JMSConnectionFactoryProviderForTest cfProvider = new JMSConnectionFactoryProviderForTest();
runner.addControllerService(controllerServiceId, cfProvider);
runner.setVariable("test", "dynamicValue");
runner.setProperty(cfProvider, JMSConnectionFactoryProvider.BROKER_URI, SINGLE_TEST_BROKER);
runner.setProperty(cfProvider, JMSConnectionFactoryProvider.CLIENT_LIB_DIR_PATH, dummyResource);
runner.setProperty(cfProvider, JMSConnectionFactoryProvider.CONNECTION_FACTORY_IMPL, TEST_CONNECTION_FACTORY_IMPL);
runner.setProperty(cfProvider, "dynamicProperty", "${test}");
runner.enableControllerService(cfProvider);
assertEquals(cfProvider.getSetProperties(), ImmutableMap.of("dynamicProperty", "dynamicValue", "hostName", HOSTNAME, "port", PORT));
}
}