activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject activemq-artemis git commit: NO-JIRA Fix a test that is not actually testing anything right now
Date Fri, 05 May 2017 20:05:37 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master c253aa65b -> 0711b35e3


NO-JIRA Fix a test that is not actually testing anything right now

The test is improperly configured and the try / catch logic swallows any
errors making it seem as if the test is passing.  

Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/0711b35e
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/0711b35e
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/0711b35e

Branch: refs/heads/master
Commit: 0711b35e3caf9e48c34980e4204eea3e5bd68d9a
Parents: c253aa6
Author: Timothy Bish <tabish121@gmail.com>
Authored: Fri May 5 16:05:04 2017 -0400
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Fri May 5 16:05:04 2017 -0400

----------------------------------------------------------------------
 .../crossprotocol/OpenWireToAMQPTest.java       | 33 +++++++++++++-------
 1 file changed, 22 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0711b35e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/OpenWireToAMQPTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/OpenWireToAMQPTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/OpenWireToAMQPTest.java
index 72f3d7c..a078eb5 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/OpenWireToAMQPTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/OpenWireToAMQPTest.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements. See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -16,25 +16,25 @@
  */
 package org.apache.activemq.artemis.tests.integration.crossprotocol;
 
+import java.util.ArrayList;
+
 import javax.jms.Connection;
 import javax.jms.MessageConsumer;
 import javax.jms.MessageProducer;
 import javax.jms.ObjectMessage;
 import javax.jms.Queue;
 import javax.jms.Session;
-import java.util.ArrayList;
 
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.ActiveMQXAConnectionFactory;
+import org.apache.activemq.artemis.api.core.RoutingType;
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.core.config.Configuration;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
-import org.apache.activemq.artemis.api.core.RoutingType;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.apache.qpid.jms.JmsConnectionFactory;
 import org.junit.After;
-import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -61,7 +61,7 @@ public class OpenWireToAMQPTest extends ActiveMQTestBase {
       serverConfig.setSecurityEnabled(false);
       server.start();
       coreQueue = new SimpleString(queueName);
-      this.server.createQueue(coreQueue, RoutingType.MULTICAST, coreQueue, null, false, false,
-1, false, true);
+      server.createQueue(coreQueue, RoutingType.ANYCAST, coreQueue, null, false, false);
       qpidfactory = new JmsConnectionFactory("amqp://localhost:61616");
    }
 
@@ -74,7 +74,8 @@ public class OpenWireToAMQPTest extends ActiveMQTestBase {
       }
    }
 
-   @Test
+   @SuppressWarnings("unchecked")
+   @Test(timeout = 60000)
    public void testObjectMessage() throws Exception {
       Connection connection = null;
       try {
@@ -82,24 +83,34 @@ public class OpenWireToAMQPTest extends ActiveMQTestBase {
          Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
          Queue queue = session.createQueue(queueName);
          MessageProducer producer = session.createProducer(queue);
-         ArrayList list = new ArrayList();
+         ArrayList<String> list = new ArrayList<>();
          list.add("aString");
          ObjectMessage objectMessage = session.createObjectMessage(list);
          producer.send(objectMessage);
          connection.close();
+      } catch (Exception e) {
+         e.printStackTrace();
+         fail("Failed to send message via OpenWire: " + e.getMessage());
+      } finally {
+         if (connection != null) {
+            connection.close();
+         }
+      }
 
+      try {
          connection = qpidfactory.createConnection();
-         session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         queue = session.createQueue(coreQueue.toString());
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         Queue queue = session.createQueue(queueName);
          MessageConsumer consumer = session.createConsumer(queue);
          connection.start();
          ObjectMessage receive = (ObjectMessage) consumer.receive(5000);
-         Assert.assertNotNull(receive);
-         list = (ArrayList) receive.getObject();
+         assertNotNull(receive);
+         ArrayList<String> list = (ArrayList<String>) receive.getObject();
          assertEquals(list.get(0), "aString");
          connection.close();
       } catch (Exception e) {
          e.printStackTrace();
+         fail("Failed to receive message via AMQP: " + e.getMessage());
       } finally {
          if (connection != null) {
             connection.close();


Mime
View raw message