This is an automated email from the ASF dual-hosted git repository. mattyb149 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/master by this push: new 41fef55 NIFI-6917 - fix doc for dynamic properties variables support in JMS Connection Factory Provider 41fef55 is described below commit 41fef551c3cc4e33e9586351f4507b4f090be3a6 Author: Pierre Villard <pierre.villard...@gmail.com> AuthorDate: Wed Dec 4 03:45:04 2019 +0100 NIFI-6917 - fix doc for dynamic properties variables support in JMS Connection Factory Provider Signed-off-by: Matthew Burgess <mattyb...@apache.org> This closes #3914 --- .../nifi/jms/cf/JMSConnectionFactoryProvider.java | 4 +++- .../jms/cf/JMSConnectionFactoryProviderTest.java | 21 ++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/cf/JMSConnectionFactoryProvider.java b/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/cf/JMSConnectionFactoryProvider.java index b831162..b8382a1 100644 --- a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/cf/JMSConnectionFactoryProvider.java +++ b/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/cf/JMSConnectionFactoryProvider.java @@ -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(); } diff --git a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-processors/src/test/java/org/apache/nifi/jms/cf/JMSConnectionFactoryProviderTest.java b/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-processors/src/test/java/org/apache/nifi/jms/cf/JMSConnectionFactoryProviderTest.java index b50a3d4..867db0d 100644 --- a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-processors/src/test/java/org/apache/nifi/jms/cf/JMSConnectionFactoryProviderTest.java +++ b/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-processors/src/test/java/org/apache/nifi/jms/cf/JMSConnectionFactoryProviderTest.java @@ -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)); } }