nifi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markap14 <>
Subject [GitHub] nifi pull request: NIFI-1000 Fixed JmsFactory to properly obtain d...
Date Tue, 10 Nov 2015 15:44:20 GMT
Github user markap14 commented on a diff in the pull request:
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/
    @@ -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(),
             final Session jmsSession = wrappedProducer.getSession();
             final MessageProducer producer = wrappedProducer.getProducer();
             final Message message = jmsSession.createTextMessage("Hello World");
    +        getJmsQueue.onTrigger(runner.getProcessContext(), pSession);
    --- End diff --
    Rather than calling onTrigger directly, should use This will handle
the ProcessSession and Process Context for you, as well as the appropriate lifecycle methods.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

View raw message