[
https://issues.apache.org/jira/browse/NIFI-1000?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14998773#comment-14998773
]
ASF GitHub Bot commented on NIFI-1000:
--------------------------------------
Github user markap14 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/118#discussion_r44421395
--- Diff:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestGetJMSQueue.java
---
@@ -24,73 +29,116 @@
import javax.jms.Session;
import javax.jms.StreamMessage;
+import org.apache.nifi.processor.Relationship;
import org.apache.nifi.processors.standard.util.JmsFactory;
import org.apache.nifi.processors.standard.util.JmsProperties;
import org.apache.nifi.processors.standard.util.WrappedMessageProducer;
+import org.apache.nifi.util.MockFlowFile;
+import org.apache.nifi.util.MockProcessSession;
+import org.apache.nifi.util.StandardProcessorTestRunner;
import org.apache.nifi.util.TestRunner;
import org.apache.nifi.util.TestRunners;
import org.apache.nifi.web.Revision;
+import org.junit.Test;
public class TestGetJMSQueue {
- @org.junit.Ignore
+ @Test
public void testSendTextToQueue() throws Exception {
- final TestRunner runner =
TestRunners.newTestRunner(GetJMSQueue.class);
+ GetJMSQueue getJmsQueue = new GetJMSQueue();
+ StandardProcessorTestRunner runner = (StandardProcessorTestRunner)
TestRunners.newTestRunner(getJmsQueue);
runner.setProperty(JmsProperties.JMS_PROVIDER,
JmsProperties.ACTIVEMQ_PROVIDER);
- runner.setProperty(JmsProperties.URL, "tcp://localhost:61616");
+ runner.setProperty(JmsProperties.URL,
"vm://localhost?broker.persistent=false");
runner.setProperty(JmsProperties.DESTINATION_TYPE,
JmsProperties.DESTINATION_TYPE_QUEUE);
runner.setProperty(JmsProperties.DESTINATION_NAME,
"queue.testing");
runner.setProperty(JmsProperties.ACKNOWLEDGEMENT_MODE,
JmsProperties.ACK_MODE_AUTO);
+
+ MockProcessSession pSession = (MockProcessSession)
runner.getProcessSessionFactory().createSession();
WrappedMessageProducer wrappedProducer =
JmsFactory.createMessageProducer(runner.getProcessContext(), true);
final Session jmsSession = wrappedProducer.getSession();
final MessageProducer producer = wrappedProducer.getProducer();
-
final Message message = jmsSession.createTextMessage("Hello
World");
producer.send(message);
jmsSession.commit();
+
+ getJmsQueue.onTrigger(runner.getProcessContext(), pSession);
--- End diff --
Rather than calling onTrigger directly, should use TestRunner.run(). This
will handle the ProcessSession and Process Context for you, as well as the
appropriate lifecycle methods.
> GetJMSQueue adds wrong value for jms.JMSDestination attribute
> -------------------------------------------------------------
>
> Key: NIFI-1000
> URL: https://issues.apache.org/jira/browse/NIFI-1000
> Project: Apache NiFi
> Issue Type: Bug
> Components: Extensions
> Reporter: Mark Payne
> Assignee: Oleg Zhurakousky
> Labels: newbie
> Fix For: 0.4.0
>
>
> I used LogAttribute to view the output of messages pulled via GetJMSQueue.
> The Destination's name was the wrong value:
> Key: 'jms.JMSDestination'
> Value: 'org.apache.qpid.amqp_1_0.jms.impl.QueueImpl@1a5bf541'
> It appears that the attribute is being set to the toString() of the
> destination, rather than obtaining the actual name
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)