activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From johnament <...@git.apache.org>
Subject [GitHub] activemq-artemis pull request: Connection Factory updates
Date Thu, 04 Jun 2015 01:55:50 GMT
Github user johnament commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/15#discussion_r31688005
  
    --- Diff: tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ConnectionTest.java
---
    @@ -65,6 +67,33 @@ public void testManyConnections() throws Exception
        //
     
        @Test
    +   public void testThroughNewConnectionFactory() throws Exception
    +   {
    +      testThroughNewConnectionFactory(new ActiveMQConnectionFactory());
    +      testThroughNewConnectionFactory(new ActiveMQConnectionFactory("tcp://localhost:61616"));
    +      testThroughNewConnectionFactory(new ActiveMQConnectionFactory("tcp://localhost:61616",
"guest", "guest"));
    +   }
    +
    +   private void testThroughNewConnectionFactory(ActiveMQConnectionFactory factory) throws
Exception
    +   {
    +      Connection conn = factory.createConnection();
    +      conn.close();
    +
    +      try (JMSContext ctx = factory.createContext())
    +      {
    +         ctx.createProducer().send(ctx.createQueue("queue"),"Test");
    +      }
    +
    +      try (JMSContext ctx = factory.createContext())
    +      {
    +         Assert.assertNotNull(ctx.createConsumer(ctx.createQueue("queue")).receiveNoWait());
    +         Assert.assertNull(ctx.createConsumer(ctx.createQueue("queue")).receiveNoWait());
    +      }
    +
    +      factory.close();
    --- End diff --
    
    Seems like it would be a good idea for the connection factory to be auto closeable even
if the spec doesn't say so.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message