You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by de...@apache.org on 2011/02/28 17:19:26 UTC
svn commit: r1075407 -
/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryUriTest.java
Author: dejanb
Date: Mon Feb 28 16:19:26 2011
New Revision: 1075407
URL: http://svn.apache.org/viewvc?rev=1075407&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-2981 - test case for discory uri with params
Added:
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryUriTest.java
Added: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryUriTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryUriTest.java?rev=1075407&view=auto
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryUriTest.java (added)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryUriTest.java Mon Feb 28 16:19:26 2011
@@ -0,0 +1,54 @@
+/**
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.transport.discovery;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.EmbeddedBrokerTestSupport;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.TransportConnector;
+
+import javax.jms.*;
+import java.net.URI;
+
+public class DiscoveryUriTest extends EmbeddedBrokerTestSupport {
+
+ @Override
+ protected BrokerService createBroker() throws Exception {
+ bindAddress = "tcp://localhost:0";
+ BrokerService answer = new BrokerService();
+ answer.setPersistent(isPersistent());
+ TransportConnector connector = new TransportConnector();
+ connector.setUri(new URI(bindAddress));
+ connector.setDiscoveryUri(new URI("multicast://default?group=test"));
+ answer.addConnector(connector);
+ return answer;
+ }
+
+ public void testConnect() throws Exception {
+ ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("discovery:(multicast://default?group=test)?reconnectDelay=1000&maxReconnectAttempts=30&useExponentialBackOff=false");
+ Connection conn = factory.createConnection();
+ conn.start();
+
+ Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer producer = sess.createProducer(sess.createQueue("test"));
+ producer.send(sess.createTextMessage("test"));
+ MessageConsumer consumer = sess.createConsumer(sess.createQueue("test"));
+ Message msg = consumer.receive(1000);
+ assertNotNull(msg);
+ }
+}