activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r786040 [6/6] - in /activemq/sandbox/activemq-flow: activemq-all/src/test/java/org/apache/activemq/legacy/ activemq-all/src/test/java/org/apache/activemq/legacy/broker/ activemq-all/src/test/java/org/apache/activemq/legacy/broker/advisory/ ...
Date Thu, 18 Jun 2009 12:42:29 GMT
Added: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicRequestReplyTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicRequestReplyTest.java?rev=786040&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicRequestReplyTest.java (added)
+++ activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicRequestReplyTest.java Thu Jun 18 12:42:23 2009
@@ -0,0 +1,209 @@
+/**
+ * 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.legacy.test3;
+
+import java.util.List;
+import java.util.Vector;
+
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @version $Revision: 1.3 $
+ */
+public class JmsTopicRequestReplyTest extends TestSupport implements MessageListener {
+    private static final Log LOG = LogFactory.getLog(JmsTopicRequestReplyTest.class);
+
+    protected boolean useAsyncConsume;
+    private Connection serverConnection;
+    private Connection clientConnection;
+    private MessageProducer replyProducer;
+    private Session serverSession;
+    private Destination requestDestination;
+    private List<JMSException> failures = new Vector<JMSException>();
+    private boolean dynamicallyCreateProducer;
+    private String clientSideClientID;
+
+    public void testSendAndReceive() throws Exception {
+        clientConnection = createConnection();
+        clientConnection.setClientID("ClientConnection:" + getSubject());
+
+        Session session = clientConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+        clientConnection.start();
+
+        Destination replyDestination = createTemporaryDestination(session);
+
+        // lets test the destination
+        clientSideClientID = clientConnection.getClientID();
+
+        // TODO
+        // String value = ActiveMQDestination.getClientId((ActiveMQDestination)
+        // replyDestination);
+        // assertEquals("clientID from the temporary destination must be the
+        // same", clientSideClientID, value);
+        LOG.info("Both the clientID and destination clientID match properly: " + clientSideClientID);
+
+        /* build queues */
+        MessageProducer requestProducer = session.createProducer(requestDestination);
+        MessageConsumer replyConsumer = session.createConsumer(replyDestination);
+
+        /* build requestmessage */
+        TextMessage requestMessage = session.createTextMessage("Olivier");
+        requestMessage.setJMSReplyTo(replyDestination);
+        requestProducer.send(requestMessage);
+
+        LOG.info("Sent request.");
+        LOG.info(requestMessage.toString());
+
+        Message msg = replyConsumer.receive(5000);
+
+        if (msg instanceof TextMessage) {
+            TextMessage replyMessage = (TextMessage)msg;
+            LOG.info("Received reply.");
+            LOG.info(replyMessage.toString());
+            assertEquals("Wrong message content", "Hello: Olivier", replyMessage.getText());
+        } else {
+            fail("Should have received a reply by now");
+        }
+
+        assertEquals("Should not have had any failures: " + failures, 0, failures.size());
+    }
+
+    public void testSendAndReceiveWithDynamicallyCreatedProducer() throws Exception {
+        dynamicallyCreateProducer = true;
+        testSendAndReceive();
+    }
+
+    /**
+     * Use the asynchronous subscription mechanism
+     */
+    public void onMessage(Message message) {
+        try {
+            TextMessage requestMessage = (TextMessage)message;
+
+            LOG.info("Received request.");
+            LOG.info(requestMessage.toString());
+
+            Destination replyDestination = requestMessage.getJMSReplyTo();
+
+            // TODO
+            // String value =
+            // ActiveMQDestination.getClientId((ActiveMQDestination)
+            // replyDestination);
+            // assertEquals("clientID from the temporary destination must be the
+            // same", clientSideClientID, value);
+
+            TextMessage replyMessage = serverSession.createTextMessage("Hello: " + requestMessage.getText());
+
+            replyMessage.setJMSCorrelationID(requestMessage.getJMSMessageID());
+
+            if (dynamicallyCreateProducer) {
+                replyProducer = serverSession.createProducer(replyDestination);
+                replyProducer.send(replyMessage);
+            } else {
+                replyProducer.send(replyDestination, replyMessage);
+            }
+
+            LOG.info("Sent reply.");
+            LOG.info(replyMessage.toString());
+        } catch (JMSException e) {
+            onException(e);
+        }
+    }
+
+    /**
+     * Use the synchronous subscription mechanism
+     */
+    protected void syncConsumeLoop(MessageConsumer requestConsumer) {
+        try {
+            Message message = requestConsumer.receive(5000);
+            if (message != null) {
+                onMessage(message);
+            } else {
+                LOG.error("No message received");
+            }
+        } catch (JMSException e) {
+            onException(e);
+        }
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        serverConnection = createConnection();
+        serverConnection.setClientID("serverConnection:" + getSubject());
+        serverSession = serverConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+        replyProducer = serverSession.createProducer(null);
+
+        requestDestination = createDestination(serverSession);
+
+        /* build queues */
+        final MessageConsumer requestConsumer = serverSession.createConsumer(requestDestination);
+        if (useAsyncConsume) {
+            requestConsumer.setMessageListener(this);
+        } else {
+            Thread thread = new Thread(new Runnable() {
+                public void run() {
+                    syncConsumeLoop(requestConsumer);
+                }
+            });
+            thread.start();
+        }
+        serverConnection.start();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+
+        serverConnection.close();
+        clientConnection.stop();
+        clientConnection.close();
+    }
+
+    protected void onException(JMSException e) {
+        LOG.info("Caught: " + e);
+        e.printStackTrace();
+        failures.add(e);
+    }
+
+    protected Destination createDestination(Session session) throws JMSException {
+        if (topic) {
+            return session.createTopic(getSubject());
+        }
+        return session.createQueue(getSubject());
+    }
+
+    protected Destination createTemporaryDestination(Session session) throws JMSException {
+        if (topic) {
+            return session.createTemporaryTopic();
+        }
+        return session.createTemporaryQueue();
+    }
+
+}

Propchange: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicRequestReplyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicRequestReplyTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveTest.java?rev=786040&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveTest.java (added)
+++ activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveTest.java Thu Jun 18 12:42:23 2009
@@ -0,0 +1,118 @@
+/**
+ * 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.legacy.test3;
+
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.Session;
+import javax.jms.Topic;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @version $Revision: 1.2 $
+ */
+public class JmsTopicSendReceiveTest extends JmsSendReceiveTestSupport {
+    private static final Log LOG = LogFactory.getLog(JmsTopicSendReceiveTest.class);
+
+    protected Connection connection;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        connectionFactory = createConnectionFactory();
+        connection = createConnection();
+        if (durable) {
+            connection.setClientID(getClass().getName());
+        }
+
+        LOG.info("Created connection: " + connection);
+
+        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        consumeSession = createConsumerSession();
+
+        LOG.info("Created session: " + session);
+        LOG.info("Created consumeSession: " + consumeSession);
+        producer = session.createProducer(null);
+        producer.setDeliveryMode(deliveryMode);
+
+        LOG.info("Created producer: " + producer + " delivery mode = " + (deliveryMode == DeliveryMode.PERSISTENT ? "PERSISTENT" : "NON_PERSISTENT"));
+
+        if (topic) {
+            consumerDestination = session.createTopic(getConsumerSubject());
+            producerDestination = session.createTopic(getProducerSubject());
+        } else {
+            consumerDestination = session.createQueue(getConsumerSubject());
+            producerDestination = session.createQueue(getProducerSubject());
+        }
+
+        LOG.info("Created  consumer destination: " + consumerDestination + " of type: " + consumerDestination.getClass());
+        LOG.info("Created  producer destination: " + producerDestination + " of type: " + producerDestination.getClass());
+        consumer = createConsumer();
+        consumer.setMessageListener(this);
+        startConnection();
+
+        LOG.info("Created connection: " + connection);
+    }
+
+    protected void startConnection() throws JMSException {
+        connection.start();
+    }
+
+    protected void tearDown() throws Exception {
+        LOG.info("Dumping stats...");
+        // TODO
+        // connectionFactory.getFactoryStats().dump(new IndentPrinter());
+
+        LOG.info("Closing down connection");
+
+        /** TODO we should be able to shut down properly */
+        session.close();
+        connection.close();
+    }
+
+    /**
+     * Creates a session.
+     * 
+     * @return session
+     * @throws JMSException
+     */
+    protected Session createConsumerSession() throws JMSException {
+        if (useSeparateSession) {
+            return connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        } else {
+            return session;
+        }
+    }
+
+    /**
+     * Creates a durable suscriber or a consumer.
+     * 
+     * @return MessageConsumer - durable suscriber or consumer.
+     * @throws JMSException
+     */
+    protected MessageConsumer createConsumer() throws JMSException {
+        if (durable) {
+            LOG.info("Creating durable consumer");
+            return consumeSession.createDurableSubscriber((Topic)consumerDestination, getName());
+        }
+        return consumeSession.createConsumer(consumerDestination);
+    }
+}

Propchange: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveWithEmbeddedBrokerAndUserIDTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveWithEmbeddedBrokerAndUserIDTest.java?rev=786040&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveWithEmbeddedBrokerAndUserIDTest.java (added)
+++ activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveWithEmbeddedBrokerAndUserIDTest.java Thu Jun 18 12:42:23 2009
@@ -0,0 +1,62 @@
+/**
+ * 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.legacy.test3;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.legacy.broker.BrokerService;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class JmsTopicSendReceiveWithEmbeddedBrokerAndUserIDTest extends JmsTopicSendReceiveWithTwoConnectionsAndEmbeddedBrokerTest {
+    private static final Log LOG = LogFactory.getLog(JmsTopicSendReceiveWithEmbeddedBrokerAndUserIDTest.class);
+
+    protected String userName = "James";
+
+    protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
+        ActiveMQConnectionFactory answer = super.createConnectionFactory();
+        answer.setUserName(userName);
+        return answer;
+    }
+
+    protected void configureBroker(BrokerService answer) throws Exception {
+        answer.setPopulateJMSXUserID(true);
+        super.configureBroker(answer);
+    }
+
+    protected void assertMessagesReceivedAreValid(List receivedMessages) throws JMSException {
+        super.assertMessagesReceivedAreValid(receivedMessages);
+
+        // lets assert that the user ID is set
+        for (Iterator iter = receivedMessages.iterator(); iter.hasNext();) {
+            Message message = (Message)iter.next();
+            String userID = message.getStringProperty("JMSXUserID");
+
+            LOG.info("Received message with userID: " + userID);
+
+            assertEquals("JMSXUserID header", userName, userID);
+        }
+    }
+}

Propchange: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveWithEmbeddedBrokerAndUserIDTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveWithTwoConnectionsAndByteSelectorTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveWithTwoConnectionsAndByteSelectorTest.java?rev=786040&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveWithTwoConnectionsAndByteSelectorTest.java (added)
+++ activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveWithTwoConnectionsAndByteSelectorTest.java Thu Jun 18 12:42:23 2009
@@ -0,0 +1,37 @@
+/**
+ * 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.legacy.test3;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+
+/**
+ * @version $Revision$
+ */
+public class JmsTopicSendReceiveWithTwoConnectionsAndByteSelectorTest extends JmsTopicSendReceiveWithTwoConnectionsTest {
+    
+
+    protected void configureMessage(Message message) throws JMSException {
+        message.setByteProperty("dummy", (byte) 33);
+    }
+
+    protected MessageConsumer createConsumer() throws JMSException {
+        return receiveSession.createConsumer(consumerDestination, "dummy = 33", false);
+    }
+
+}

Propchange: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveWithTwoConnectionsAndByteSelectorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveWithTwoConnectionsAndByteSelectorTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveWithTwoConnectionsAndByteSelectorTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveWithTwoConnectionsAndEmbeddedBrokerTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveWithTwoConnectionsAndEmbeddedBrokerTest.java?rev=786040&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveWithTwoConnectionsAndEmbeddedBrokerTest.java (added)
+++ activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveWithTwoConnectionsAndEmbeddedBrokerTest.java Thu Jun 18 12:42:23 2009
@@ -0,0 +1,69 @@
+/**
+ * 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.legacy.test3;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.legacy.broker.BrokerService;
+
+/**
+ * @version $Revision: 1.3 $
+ */
+public class JmsTopicSendReceiveWithTwoConnectionsAndEmbeddedBrokerTest extends JmsTopicSendReceiveWithTwoConnectionsTest {
+
+    protected BrokerService broker;
+    protected String bindAddress = "tcp://localhost:61616";
+
+    /**
+     * Sets up a test where the producer and consumer have their own connection.
+     * 
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        if (broker == null) {
+            broker = createBroker();
+        }
+        super.setUp();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+
+        if (broker != null) {
+            broker.stop();
+        }
+    }
+
+    /**
+     * Factory method to create a new broker
+     * 
+     * @throws Exception
+     */
+    protected BrokerService createBroker() throws Exception {
+        BrokerService answer = new BrokerService();
+        configureBroker(answer);
+        answer.start();
+        return answer;
+    }
+
+    protected void configureBroker(BrokerService answer) throws Exception {
+        answer.addConnector(bindAddress);
+    }
+
+    protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
+        return new ActiveMQConnectionFactory(bindAddress);
+    }
+}

Propchange: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveWithTwoConnectionsAndEmbeddedBrokerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveWithTwoConnectionsTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveWithTwoConnectionsTest.java?rev=786040&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveWithTwoConnectionsTest.java (added)
+++ activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveWithTwoConnectionsTest.java Thu Jun 18 12:42:23 2009
@@ -0,0 +1,133 @@
+/**
+ * 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.legacy.test3;
+
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.Session;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @version $Revision: 1.3 $
+ */
+public class JmsTopicSendReceiveWithTwoConnectionsTest extends JmsSendReceiveTestSupport {
+
+    private static final Log LOG = LogFactory.getLog(JmsTopicSendReceiveWithTwoConnectionsTest.class);
+
+    protected Connection sendConnection;
+    protected Connection receiveConnection;
+    protected Session receiveSession;
+
+    /**
+     * Sets up a test where the producer and consumer have their own connection.
+     * 
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        connectionFactory = createConnectionFactory();
+
+        LOG.info("Creating send connection");
+        sendConnection = createSendConnection();
+        LOG.info("Starting send connection");
+        sendConnection.start();
+
+        LOG.info("Creating receive connection");
+        receiveConnection = createReceiveConnection();
+        LOG.info("Starting receive connection");
+        receiveConnection.start();
+
+        LOG.info("Created sendConnection: " + sendConnection);
+        LOG.info("Created receiveConnection: " + receiveConnection);
+
+        session = sendConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        receiveSession = receiveConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+        LOG.info("Created sendSession: " + session);
+        LOG.info("Created receiveSession: " + receiveSession);
+
+        producer = session.createProducer(null);
+        producer.setDeliveryMode(deliveryMode);
+
+        LOG.info("Created producer: " + producer + " delivery mode = " + (deliveryMode == DeliveryMode.PERSISTENT ? "PERSISTENT" : "NON_PERSISTENT"));
+
+        if (topic) {
+            consumerDestination = session.createTopic(getConsumerSubject());
+            producerDestination = session.createTopic(getProducerSubject());
+        } else {
+            consumerDestination = session.createQueue(getConsumerSubject());
+            producerDestination = session.createQueue(getProducerSubject());
+        }
+
+        LOG.info("Created  consumer destination: " + consumerDestination + " of type: " + consumerDestination.getClass());
+        LOG.info("Created  producer destination: " + producerDestination + " of type: " + producerDestination.getClass());
+
+        consumer = createConsumer();
+        consumer.setMessageListener(this);
+
+        LOG.info("Started connections");
+    }
+
+    protected MessageConsumer createConsumer() throws JMSException {
+        return receiveSession.createConsumer(consumerDestination);
+    }
+
+    /*
+     * @see junit.framework.TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception {
+        session.close();
+        receiveSession.close();
+        sendConnection.close();
+        receiveConnection.close();
+    }
+
+    /**
+     * Creates a connection.
+     * 
+     * @return Connection
+     * @throws Exception
+     */
+    protected Connection createReceiveConnection() throws Exception {
+        return createConnection();
+    }
+
+    /**
+     * Creates a connection.
+     * 
+     * @return Connection
+     * @throws Exception
+     */
+    protected Connection createSendConnection() throws Exception {
+        return createConnection();
+    }
+
+    /**
+     * Creates an ActiveMQConnectionFactory.
+     * 
+     * @see org.apache.activemq.legacy.test3.TestSupport#createConnectionFactory()
+     */
+    protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
+        return new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
+    }
+}

Propchange: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveWithTwoConnectionsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicSendReceiveWithTwoConnectionsTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicTransactionTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicTransactionTest.java?rev=786040&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicTransactionTest.java (added)
+++ activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicTransactionTest.java Thu Jun 18 12:42:23 2009
@@ -0,0 +1,37 @@
+/**
+ * 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.legacy.test3;
+
+
+
+/**
+ * @version $Revision: 1.3 $
+ */
+public class JmsTopicTransactionTest extends JmsTransactionTestSupport {
+
+    /**
+     * @see org.apache.activemq.legacy.test3.JmsTransactionTestSupport#getJmsResourceProvider()
+     */
+    protected JmsResourceProvider getJmsResourceProvider() {
+        JmsResourceProvider p = new JmsResourceProvider();
+        p.setTopic(true);
+        p.setDurableName("testsub");
+        p.setClientID("testclient");
+        return p;
+    }
+
+}

Propchange: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicTransactionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicTransactionTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicWildcardSendReceiveTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicWildcardSendReceiveTest.java?rev=786040&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicWildcardSendReceiveTest.java (added)
+++ activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicWildcardSendReceiveTest.java Thu Jun 18 12:42:23 2009
@@ -0,0 +1,157 @@
+/**
+ * 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.legacy.test3;
+
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+import org.apache.activemq.command.ActiveMQDestination;
+
+/**
+ * @version $Revision: 1.4 $
+ */
+public class JmsTopicWildcardSendReceiveTest extends JmsTopicSendReceiveTest {
+
+    private String destination1String = "TEST.ONE.ONE";
+    private String destination2String = "TEST.ONE.ONE.ONE";
+    private String destination3String = "TEST.ONE.TWO";
+    private String destination4String = "TEST.TWO.ONE";
+
+    protected void setUp() throws Exception {
+        topic = true;
+        durable = false;
+        deliveryMode = DeliveryMode.NON_PERSISTENT;
+        super.setUp();
+    }
+
+    protected String getConsumerSubject() {
+        return "FOO.>";
+    }
+
+    protected String getProducerSubject() {
+        return "FOO.BAR.HUMBUG";
+    }
+
+    public void testReceiveWildcardTopicEndAsterisk() throws Exception {
+        connection.start();
+        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+        ActiveMQDestination destination1 = (ActiveMQDestination)session.createTopic(destination1String);
+        ActiveMQDestination destination3 = (ActiveMQDestination)session.createTopic(destination3String);
+
+        Message m = null;
+        MessageConsumer consumer = null;
+        String text = null;
+
+        ActiveMQDestination destination6 = (ActiveMQDestination)session.createTopic("TEST.ONE.*");
+        consumer = session.createConsumer(destination6);
+        sendMessage(session, destination1, destination1String);
+        sendMessage(session, destination3, destination3String);
+        m = consumer.receive(1000);
+        assertNotNull(m);
+        text = ((TextMessage)m).getText();
+        if (!(text.equals(destination1String) || text.equals(destination3String))) {
+            fail("unexpected message:" + text);
+        }
+        m = consumer.receive(1000);
+        assertNotNull(m);
+        text = ((TextMessage)m).getText();
+        if (!(text.equals(destination1String) || text.equals(destination3String))) {
+            fail("unexpected message:" + text);
+        }
+        assertNull(consumer.receiveNoWait());
+    }
+
+    public void testReceiveWildcardTopicEndGreaterThan() throws Exception {
+        connection.start();
+        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+        ActiveMQDestination destination1 = (ActiveMQDestination)session.createTopic(destination1String);
+        ActiveMQDestination destination2 = (ActiveMQDestination)session.createTopic(destination2String);
+        ActiveMQDestination destination3 = (ActiveMQDestination)session.createTopic(destination3String);
+
+        Message m = null;
+        MessageConsumer consumer = null;
+        String text = null;
+
+        ActiveMQDestination destination7 = (ActiveMQDestination)session.createTopic("TEST.ONE.>");
+        consumer = session.createConsumer(destination7);
+        sendMessage(session, destination1, destination1String);
+        sendMessage(session, destination2, destination2String);
+        sendMessage(session, destination3, destination3String);
+        m = consumer.receive(1000);
+        assertNotNull(m);
+        text = ((TextMessage)m).getText();
+        if (!(text.equals(destination1String) || text.equals(destination2String) || text.equals(destination3String))) {
+            fail("unexpected message:" + text);
+        }
+        m = consumer.receive(1000);
+        assertNotNull(m);
+        if (!(text.equals(destination1String) || text.equals(destination2String) || text.equals(destination3String))) {
+            fail("unexpected message:" + text);
+        }
+        m = consumer.receive(1000);
+        assertNotNull(m);
+        if (!(text.equals(destination1String) || text.equals(destination2String) || text.equals(destination3String))) {
+            fail("unexpected message:" + text);
+        }
+        assertNull(consumer.receiveNoWait());
+    }
+
+    public void testReceiveWildcardTopicMidAsterisk() throws Exception {
+        connection.start();
+        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+        ActiveMQDestination destination1 = (ActiveMQDestination)session.createTopic(destination1String);
+        ActiveMQDestination destination4 = (ActiveMQDestination)session.createTopic(destination4String);
+
+        Message m = null;
+        MessageConsumer consumer = null;
+        String text = null;
+
+        ActiveMQDestination destination8 = (ActiveMQDestination)session.createTopic("TEST.*.ONE");
+        consumer = session.createConsumer(destination8);
+        sendMessage(session, destination1, destination1String);
+        sendMessage(session, destination4, destination4String);
+        m = consumer.receive(1000);
+        assertNotNull(m);
+        text = ((TextMessage)m).getText();
+        if (!(text.equals(destination1String) || text.equals(destination4String))) {
+            fail("unexpected message:" + text);
+        }
+        m = consumer.receive(1000);
+        assertNotNull(m);
+        text = ((TextMessage)m).getText();
+        if (!(text.equals(destination1String) || text.equals(destination4String))) {
+            fail("unexpected message:" + text);
+        }
+        assertNull(consumer.receiveNoWait());
+
+    }
+
+    private void sendMessage(Session session, Destination destination, String text) throws JMSException {
+        MessageProducer producer = session.createProducer(destination);
+        producer.send(session.createTextMessage(text));
+        producer.close();
+    }
+}

Propchange: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicWildcardSendReceiveTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTopicWildcardSendReceiveTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTransactionTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTransactionTestSupport.java?rev=786040&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTransactionTestSupport.java (added)
+++ activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTransactionTestSupport.java Thu Jun 18 12:42:23 2009
@@ -0,0 +1,708 @@
+/**
+ * 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.legacy.test3;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+import org.apache.activemq.ActiveMQConnection;
+import org.apache.activemq.ActiveMQPrefetchPolicy;
+import org.apache.activemq.legacy.broker.BrokerFactory;
+import org.apache.activemq.legacy.broker.BrokerService;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @version $Revision: 1.9 $
+ */
+public abstract class JmsTransactionTestSupport extends TestSupport implements MessageListener {
+
+    private static final Log LOG = LogFactory.getLog(JmsTransactionTestSupport.class);
+    private static final int MESSAGE_COUNT = 5;
+    private static final String MESSAGE_TEXT = "message";
+
+    protected ConnectionFactory connectionFactory;
+    protected Connection connection;
+    protected Session session;
+    protected MessageConsumer consumer;
+    protected MessageProducer producer;
+    protected JmsResourceProvider resourceProvider;
+    protected Destination destination;
+    protected int batchCount = 10;
+    protected int batchSize = 20;
+    protected BrokerService broker;
+
+    // for message listener test
+    private List<Message> unackMessages = new ArrayList<Message>(MESSAGE_COUNT);
+    private List<Message> ackMessages = new ArrayList<Message>(MESSAGE_COUNT);
+    private boolean resendPhase;
+
+    public JmsTransactionTestSupport() {
+        super();
+    }
+
+    public JmsTransactionTestSupport(String name) {
+        super(name);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        broker = createBroker();
+        broker.start();
+
+        resourceProvider = getJmsResourceProvider();
+        topic = resourceProvider.isTopic();
+        // We will be using transacted sessions.
+        setSessionTransacted();
+        connectionFactory = newConnectionFactory();
+        reconnect();
+    }
+
+    protected void setSessionTransacted() {
+        resourceProvider.setTransacted(true);
+    }
+
+    protected ConnectionFactory newConnectionFactory() throws Exception {
+        return resourceProvider.createConnectionFactory();
+    }
+
+    protected void beginTx() throws Exception {
+        //no-op for local tx
+    }
+
+    protected void commitTx() throws Exception {
+        session.commit();
+    }
+
+    protected void rollbackTx() throws Exception {
+        session.rollback();
+    }
+
+    /**
+     */
+    protected BrokerService createBroker() throws Exception, URISyntaxException {
+        return BrokerFactory.createBroker(new URI("broker://()/localhost?persistent=false"));
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see junit.framework.TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception {
+        LOG.info("Closing down connection");
+
+        session.close();
+        session = null;
+        connection.close();
+        connection = null;
+        broker.stop();
+        broker = null;
+
+        LOG.info("Connection closed.");
+    }
+
+    protected abstract JmsResourceProvider getJmsResourceProvider();
+
+    /**
+     * Sends a batch of messages and validates that the messages are received.
+     * 
+     * @throws Exception
+     */
+    public void testSendReceiveTransactedBatches() throws Exception {
+
+        TextMessage message = session.createTextMessage("Batch Message");
+        for (int j = 0; j < batchCount; j++) {
+            LOG.info("Producing bacth " + j + " of " + batchSize + " messages");
+
+            beginTx();
+            for (int i = 0; i < batchSize; i++) {
+                producer.send(message);
+            }
+            messageSent();
+            commitTx();
+            LOG.info("Consuming bacth " + j + " of " + batchSize + " messages");
+
+            beginTx();
+            for (int i = 0; i < batchSize; i++) {
+                message = (TextMessage)consumer.receive(1000 * 5);
+                assertNotNull("Received only " + i + " messages in batch " + j, message);
+                assertEquals("Batch Message", message.getText());
+            }
+
+            commitTx();
+        }
+    }
+
+    protected void messageSent() throws Exception {
+    }
+
+    /**
+     * Sends a batch of messages and validates that the rollbacked message was
+     * not consumed.
+     * 
+     * @throws Exception
+     */
+    public void testSendRollback() throws Exception {
+        Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message")};
+
+        // sends a message
+        beginTx();
+        producer.send(outbound[0]);
+        commitTx();
+
+        // sends a message that gets rollbacked
+        beginTx();
+        producer.send(session.createTextMessage("I'm going to get rolled back."));
+        rollbackTx();
+
+        // sends a message
+        beginTx();
+        producer.send(outbound[1]);
+        commitTx();
+
+        // receives the first message
+        beginTx();
+        ArrayList<Message> messages = new ArrayList<Message>();
+        LOG.info("About to consume message 1");
+        Message message = consumer.receive(1000);
+        messages.add(message);
+        LOG.info("Received: " + message);
+
+        // receives the second message
+        LOG.info("About to consume message 2");
+        message = consumer.receive(4000);
+        messages.add(message);
+        LOG.info("Received: " + message);
+
+        // validates that the rollbacked was not consumed
+        commitTx();
+        Message inbound[] = new Message[messages.size()];
+        messages.toArray(inbound);
+        assertTextMessagesEqual("Rollback did not work.", outbound, inbound);
+    }
+
+    /**
+     * spec section 3.6 acking a message with automation acks has no effect.
+     * @throws Exception
+     */
+    public void testAckMessageInTx() throws Exception {
+        Message[] outbound = new Message[] {session.createTextMessage("First Message")};
+
+        // sends a message
+        beginTx();
+        producer.send(outbound[0]);
+        outbound[0].acknowledge();
+        commitTx();
+        outbound[0].acknowledge();
+
+        // receives the first message
+        beginTx();
+        ArrayList<Message> messages = new ArrayList<Message>();
+        LOG.info("About to consume message 1");
+        Message message = consumer.receive(1000);
+        messages.add(message);
+        LOG.info("Received: " + message);
+
+        // validates that the rollbacked was not consumed
+        commitTx();
+        Message inbound[] = new Message[messages.size()];
+        messages.toArray(inbound);
+        assertTextMessagesEqual("Message not delivered.", outbound, inbound);
+    }
+
+    /**
+     * Sends a batch of messages and validates that the message sent before
+     * session close is not consumed.
+     *
+     * This test only works with local transactions, not xa.
+     * @throws Exception
+     */
+    public void testSendSessionClose() throws Exception {
+        Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message")};
+
+        // sends a message
+        beginTx();
+        producer.send(outbound[0]);
+        commitTx();
+
+        // sends a message that gets rollbacked
+        beginTx();
+        producer.send(session.createTextMessage("I'm going to get rolled back."));
+        consumer.close();
+
+        reconnectSession();
+
+        // sends a message
+        producer.send(outbound[1]);
+        commitTx();
+
+        // receives the first message
+        ArrayList<Message> messages = new ArrayList<Message>();
+        LOG.info("About to consume message 1");
+        beginTx();
+        Message message = consumer.receive(1000);
+        messages.add(message);
+        LOG.info("Received: " + message);
+
+        // receives the second message
+        LOG.info("About to consume message 2");
+        message = consumer.receive(4000);
+        messages.add(message);
+        LOG.info("Received: " + message);
+
+        // validates that the rollbacked was not consumed
+        commitTx();
+        Message inbound[] = new Message[messages.size()];
+        messages.toArray(inbound);
+        assertTextMessagesEqual("Rollback did not work.", outbound, inbound);
+    }
+
+    /**
+     * Sends a batch of messages and validates that the message sent before
+     * session close is not consumed.
+     * 
+     * @throws Exception
+     */
+    public void testSendSessionAndConnectionClose() throws Exception {
+        Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message")};
+
+        // sends a message
+        beginTx();
+        producer.send(outbound[0]);
+        commitTx();
+
+        // sends a message that gets rollbacked
+        beginTx();
+        producer.send(session.createTextMessage("I'm going to get rolled back."));
+        consumer.close();
+        session.close();
+
+        reconnect();
+
+        // sends a message
+        beginTx();
+        producer.send(outbound[1]);
+        commitTx();
+
+        // receives the first message
+        ArrayList<Message> messages = new ArrayList<Message>();
+        LOG.info("About to consume message 1");
+        beginTx();
+        Message message = consumer.receive(1000);
+        messages.add(message);
+        LOG.info("Received: " + message);
+
+        // receives the second message
+        LOG.info("About to consume message 2");
+        message = consumer.receive(4000);
+        messages.add(message);
+        LOG.info("Received: " + message);
+
+        // validates that the rollbacked was not consumed
+        commitTx();
+        Message inbound[] = new Message[messages.size()];
+        messages.toArray(inbound);
+        assertTextMessagesEqual("Rollback did not work.", outbound, inbound);
+    }
+
+    /**
+     * Sends a batch of messages and validates that the rollbacked message was
+     * redelivered.
+     * 
+     * @throws Exception
+     */
+    public void testReceiveRollback() throws Exception {
+        Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message")};
+
+        // lets consume any outstanding messages from prev test runs
+        beginTx();
+        while (consumer.receive(1000) != null) {
+        }
+        commitTx();
+
+        // sent both messages
+        beginTx();
+        producer.send(outbound[0]);
+        producer.send(outbound[1]);
+        commitTx();
+
+        LOG.info("Sent 0: " + outbound[0]);
+        LOG.info("Sent 1: " + outbound[1]);
+
+        ArrayList<Message> messages = new ArrayList<Message>();
+        beginTx();
+        Message message = consumer.receive(1000);
+        messages.add(message);
+        assertEquals(outbound[0], message);
+        commitTx();
+
+        // rollback so we can get that last message again.
+        beginTx();
+        message = consumer.receive(1000);
+        assertNotNull(message);
+        assertEquals(outbound[1], message);
+        rollbackTx();
+
+        // Consume again.. the prev message should
+        // get redelivered.
+        beginTx();
+        message = consumer.receive(5000);
+        assertNotNull("Should have re-received the message again!", message);
+        messages.add(message);
+        commitTx();
+
+        Message inbound[] = new Message[messages.size()];
+        messages.toArray(inbound);
+        assertTextMessagesEqual("Rollback did not work", outbound, inbound);
+    }
+
+    /**
+     * Sends a batch of messages and validates that the rollbacked message was
+     * redelivered.
+     * 
+     * @throws Exception
+     */
+    public void testReceiveTwoThenRollback() throws Exception {
+        Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message")};
+
+        // lets consume any outstanding messages from prev test runs
+        beginTx();
+        while (consumer.receive(1000) != null) {
+        }
+        commitTx();
+
+        //
+        beginTx();
+        producer.send(outbound[0]);
+        producer.send(outbound[1]);
+        commitTx();
+
+        LOG.info("Sent 0: " + outbound[0]);
+        LOG.info("Sent 1: " + outbound[1]);
+
+        ArrayList<Message> messages = new ArrayList<Message>();
+        beginTx();
+        Message message = consumer.receive(1000);
+        assertEquals(outbound[0], message);
+
+        message = consumer.receive(1000);
+        assertNotNull(message);
+        assertEquals(outbound[1], message);
+        rollbackTx();
+
+        // Consume again.. the prev message should
+        // get redelivered.
+        beginTx();
+        message = consumer.receive(5000);
+        assertNotNull("Should have re-received the first message again!", message);
+        messages.add(message);
+        assertEquals(outbound[0], message);
+        message = consumer.receive(5000);
+        assertNotNull("Should have re-received the second message again!", message);
+        messages.add(message);
+        assertEquals(outbound[1], message);
+
+        assertNull(consumer.receiveNoWait());
+        commitTx();
+
+        Message inbound[] = new Message[messages.size()];
+        messages.toArray(inbound);
+        assertTextMessagesEqual("Rollback did not work", outbound, inbound);
+    }
+
+    /**
+     * Sends a batch of messages and validates that the rollbacked message was
+     * not consumed.
+     * 
+     * @throws Exception
+     */
+    public void testSendReceiveWithPrefetchOne() throws Exception {
+        setPrefetchToOne();
+        Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message"), session.createTextMessage("Third Message"),
+                                            session.createTextMessage("Fourth Message")};
+
+        beginTx();
+        for (int i = 0; i < outbound.length; i++) {
+            // sends a message
+            producer.send(outbound[i]);
+        }
+        commitTx();
+
+        // receives the first message
+        beginTx();
+        for (int i = 0; i < outbound.length; i++) {
+            LOG.info("About to consume message 1");
+            Message message = consumer.receive(1000);
+            assertNotNull(message);
+            LOG.info("Received: " + message);
+        }
+
+        // validates that the rollbacked was not consumed
+        commitTx();
+    }
+
+    /**
+     * Perform the test that validates if the rollbacked message was redelivered
+     * multiple times.
+     * 
+     * @throws Exception
+     */
+    public void testReceiveTwoThenRollbackManyTimes() throws Exception {
+        for (int i = 0; i < 5; i++) {
+            testReceiveTwoThenRollback();
+        }
+    }
+
+    /**
+     * Sends a batch of messages and validates that the rollbacked message was
+     * not consumed. This test differs by setting the message prefetch to one.
+     * 
+     * @throws Exception
+     */
+    public void testSendRollbackWithPrefetchOfOne() throws Exception {
+        setPrefetchToOne();
+        testSendRollback();
+    }
+
+    /**
+     * Sends a batch of messages and and validates that the rollbacked message
+     * was redelivered. This test differs by setting the message prefetch to
+     * one.
+     * 
+     * @throws Exception
+     */
+    public void testReceiveRollbackWithPrefetchOfOne() throws Exception {
+        setPrefetchToOne();
+        testReceiveRollback();
+    }
+
+    /**
+     * Tests if the messages can still be received if the consumer is closed
+     * (session is not closed).
+     * 
+     * @throws Exception see http://jira.codehaus.org/browse/AMQ-143
+     */
+    public void testCloseConsumerBeforeCommit() throws Exception {
+        TextMessage[] outbound = new TextMessage[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message")};
+
+        // lets consume any outstanding messages from prev test runs
+        beginTx();
+        while (consumer.receiveNoWait() != null) {
+        }
+
+        commitTx();
+
+        // sends the messages
+        beginTx();
+        producer.send(outbound[0]);
+        producer.send(outbound[1]);
+        commitTx();
+        LOG.info("Sent 0: " + outbound[0]);
+        LOG.info("Sent 1: " + outbound[1]);
+
+        beginTx();
+        TextMessage message = (TextMessage)consumer.receive(1000);
+        assertEquals(outbound[0].getText(), message.getText());
+        // Close the consumer before the commit. This should not cause the
+        // received message
+        // to rollback.
+        consumer.close();
+        commitTx();
+
+        // Create a new consumer
+        consumer = resourceProvider.createConsumer(session, destination);
+        LOG.info("Created consumer: " + consumer);
+
+        beginTx();
+        message = (TextMessage)consumer.receive(1000);
+        assertEquals(outbound[1].getText(), message.getText());
+        commitTx();
+    }
+
+    public void testChangeMutableObjectInObjectMessageThenRollback() throws Exception {
+        ArrayList<String> list = new ArrayList<String>();
+        list.add("First");
+        Message outbound = session.createObjectMessage(list);
+        outbound.setStringProperty("foo", "abc");
+
+        beginTx();
+        producer.send(outbound);
+        commitTx();
+
+        LOG.info("About to consume message 1");
+        beginTx();
+        Message message = consumer.receive(5000);
+
+        List<String> body = assertReceivedObjectMessageWithListBody(message);
+
+        // now lets try mutate it
+        try {
+            message.setStringProperty("foo", "def");
+            fail("Cannot change properties of the object!");
+        } catch (JMSException e) {
+            LOG.info("Caught expected exception: " + e, e);
+        }
+        body.clear();
+        body.add("This should never be seen!");
+        rollbackTx();
+
+        beginTx();
+        message = consumer.receive(5000);
+        List<String> secondBody = assertReceivedObjectMessageWithListBody(message);
+        assertNotSame("Second call should return a different body", secondBody, body);
+        commitTx();
+    }
+
+    @SuppressWarnings("unchecked")
+    protected List<String> assertReceivedObjectMessageWithListBody(Message message) throws JMSException {
+        assertNotNull("Should have received a message!", message);
+        assertEquals("foo header", "abc", message.getStringProperty("foo"));
+
+        assertTrue("Should be an object message but was: " + message, message instanceof ObjectMessage);
+        ObjectMessage objectMessage = (ObjectMessage)message;
+        List<String> body = (List<String>)objectMessage.getObject();
+        LOG.info("Received body: " + body);
+
+        assertEquals("Size of list should be 1", 1, body.size());
+        assertEquals("element 0 of list", "First", body.get(0));
+        return body;
+    }
+
+    /**
+     * Recreates the connection.
+     * 
+     * @throws JMSException
+     */
+    protected void reconnect() throws Exception {
+
+        if (connection != null) {
+            // Close the prev connection.
+            connection.close();
+        }
+        session = null;
+        connection = resourceProvider.createConnection(connectionFactory);
+        reconnectSession();
+        connection.start();
+    }
+
+    /**
+     * Recreates the connection.
+     * 
+     * @throws JMSException
+     */
+    protected void reconnectSession() throws JMSException {
+        if (session != null) {
+            session.close();
+        }
+
+        session = resourceProvider.createSession(connection);
+        destination = resourceProvider.createDestination(session, getSubject());
+        producer = resourceProvider.createProducer(session, destination);
+        consumer = resourceProvider.createConsumer(session, destination);
+    }
+
+    /**
+     * Sets the prefeftch policy to one.
+     */
+    protected void setPrefetchToOne() {
+        ActiveMQPrefetchPolicy prefetchPolicy = getPrefetchPolicy();
+        prefetchPolicy.setQueuePrefetch(1);
+        prefetchPolicy.setTopicPrefetch(1);
+        prefetchPolicy.setDurableTopicPrefetch(1);
+        prefetchPolicy.setOptimizeDurableTopicPrefetch(1);
+    }
+
+    protected ActiveMQPrefetchPolicy getPrefetchPolicy() {
+        return ((ActiveMQConnection)connection).getPrefetchPolicy();
+    }
+
+    //This test won't work with xa tx so no beginTx() has been added.
+    public void testMessageListener() throws Exception {
+        // send messages
+        for (int i = 0; i < MESSAGE_COUNT; i++) {
+            producer.send(session.createTextMessage(MESSAGE_TEXT + i));
+        }
+        commitTx();
+        consumer.setMessageListener(this);
+        // wait receive
+        waitReceiveUnack();
+        assertEquals(unackMessages.size(), MESSAGE_COUNT);
+        // resend phase
+        waitReceiveAck();
+        assertEquals(ackMessages.size(), MESSAGE_COUNT);
+        // should no longer re-receive
+        consumer.setMessageListener(null);
+        assertNull(consumer.receive(500));
+        reconnect();
+    }
+
+    public void onMessage(Message message) {
+        if (!resendPhase) {
+            unackMessages.add(message);
+            if (unackMessages.size() == MESSAGE_COUNT) {
+                try {
+                    rollbackTx();
+                    resendPhase = true;
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        } else {
+            ackMessages.add(message);
+            if (ackMessages.size() == MESSAGE_COUNT) {
+                try {
+                    commitTx();
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+
+    private void waitReceiveUnack() throws Exception {
+        for (int i = 0; i < 100 && !resendPhase; i++) {
+            Thread.sleep(100);
+        }
+        assertTrue(resendPhase);
+    }
+
+    private void waitReceiveAck() throws Exception {
+        for (int i = 0; i < 100 && ackMessages.size() < MESSAGE_COUNT; i++) {
+            Thread.sleep(100);
+        }
+        assertFalse(ackMessages.size() < MESSAGE_COUNT);
+    }
+}

Propchange: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTransactionTestSupport.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/JmsTransactionTestSupport.java
------------------------------------------------------------------------------
    svn:executable = *

Added: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/TestSupport.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/TestSupport.java?rev=786040&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/TestSupport.java (added)
+++ activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/TestSupport.java Thu Jun 18 12:42:23 2009
@@ -0,0 +1,249 @@
+/**
+ * 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.legacy.test3;
+
+import java.lang.reflect.Array;
+
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.TextMessage;
+
+import junit.framework.TestCase;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.command.ActiveMQMessage;
+import org.apache.activemq.command.ActiveMQQueue;
+import org.apache.activemq.command.ActiveMQTopic;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Useful base class for unit test cases
+ * 
+ * @version $Revision: 1.4 $
+ */
+public abstract class TestSupport extends TestCase {
+    private static final Log LOG = LogFactory.getLog(TestSupport.class);
+    
+    protected ActiveMQConnectionFactory connectionFactory;
+    protected boolean topic = true;
+
+    public TestSupport() {
+        super();
+    }
+
+    public TestSupport(String name) {
+        super(name);
+    }
+
+    /**
+     * Creates an ActiveMQMessage.
+     * 
+     * @return ActiveMQMessage
+     */
+    protected ActiveMQMessage createMessage() {
+        return new ActiveMQMessage();
+    }
+
+    /**
+     * Creates a destination.
+     * 
+     * @param subject - topic or queue name.
+     * @return Destination - either an ActiveMQTopic or ActiveMQQUeue.
+     */
+    protected Destination createDestination(String subject) {
+        if (topic) {
+            return new ActiveMQTopic(subject);
+        } else {
+            return new ActiveMQQueue(subject);
+        }
+    }
+
+    /**
+     * Tests if firstSet and secondSet are equal.
+     * 
+     * @param messsage - string to be displayed when the assertion fails.
+     * @param firstSet[] - set of messages to be compared with its counterpart
+     *                in the secondset.
+     * @param secondSet[] - set of messages to be compared with its counterpart
+     *                in the firstset.
+     * @throws JMSException
+     */
+    protected void assertTextMessagesEqual(Message[] firstSet, Message[] secondSet) throws JMSException {
+        assertTextMessagesEqual("", firstSet, secondSet);
+    }
+
+    /**
+     * Tests if firstSet and secondSet are equal.
+     * 
+     * @param messsage - string to be displayed when the assertion fails.
+     * @param firstSet[] - set of messages to be compared with its counterpart
+     *                in the secondset.
+     * @param secondSet[] - set of messages to be compared with its counterpart
+     *                in the firstset.
+     */
+    protected void assertTextMessagesEqual(String messsage, Message[] firstSet, Message[] secondSet) throws JMSException {
+        assertEquals("Message count does not match: " + messsage, firstSet.length, secondSet.length);
+
+        for (int i = 0; i < secondSet.length; i++) {
+            TextMessage m1 = (TextMessage)firstSet[i];
+            TextMessage m2 = (TextMessage)secondSet[i];
+            assertTextMessageEqual("Message " + (i + 1) + " did not match : ", m1, m2);
+        }
+    }
+
+    /**
+     * Tests if m1 and m2 are equal.
+     * 
+     * @param m1 - message to be compared with m2.
+     * @param m2 - message to be compared with m1.
+     * @throws JMSException
+     */
+    protected void assertEquals(TextMessage m1, TextMessage m2) throws JMSException {
+        assertEquals("", m1, m2);
+    }
+
+    /**
+     * Tests if m1 and m2 are equal.
+     * 
+     * @param message - string to be displayed when the assertion fails.
+     * @param m1 - message to be compared with m2.
+     * @param m2 - message to be compared with m1.
+     */
+    protected void assertTextMessageEqual(String message, TextMessage m1, TextMessage m2) throws JMSException {
+        assertFalse(message + ": expected {" + m1 + "}, but was {" + m2 + "}", m1 == null ^ m2 == null);
+
+        if (m1 == null) {
+            return;
+        }
+
+        assertEquals(message, m1.getText(), m2.getText());
+    }
+
+    /**
+     * Tests if m1 and m2 are equal.
+     * 
+     * @param m1 - message to be compared with m2.
+     * @param m2 - message to be compared with m1.
+     * @throws JMSException
+     */
+    protected void assertEquals(Message m1, Message m2) throws JMSException {
+        assertEquals("", m1, m2);
+    }
+
+    /**
+     * Tests if m1 and m2 are equal.
+     * 
+     * @param message - error message.
+     * @param m1 - message to be compared with m2.
+     * @param m2 -- message to be compared with m1.
+     */
+    protected void assertEquals(String message, Message m1, Message m2) throws JMSException {
+        assertFalse(message + ": expected {" + m1 + "}, but was {" + m2 + "}", m1 == null ^ m2 == null);
+
+        if (m1 == null) {
+            return;
+        }
+
+        assertTrue(message + ": expected {" + m1 + "}, but was {" + m2 + "}", m1.getClass() == m2.getClass());
+
+        if (m1 instanceof TextMessage) {
+            assertTextMessageEqual(message, (TextMessage)m1, (TextMessage)m2);
+        } else {
+            assertEquals(message, m1, m2);
+        }
+    }
+
+    /**
+     * Creates an ActiveMQConnectionFactory.
+     * 
+     * @return ActiveMQConnectionFactory
+     * @throws Exception
+     */
+    protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
+        return new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
+    }
+
+    /**
+     * Factory method to create a new connection.
+     * 
+     * @return connection
+     * @throws Exception
+     */
+    protected Connection createConnection() throws Exception {
+        return getConnectionFactory().createConnection();
+    }
+
+    /**
+     * Creates an ActiveMQ connection factory.
+     * 
+     * @return connectionFactory
+     * @throws Exception
+     */
+    public ActiveMQConnectionFactory getConnectionFactory() throws Exception {
+        if (connectionFactory == null) {
+            connectionFactory = createConnectionFactory();
+            assertTrue("Should have created a connection factory!", connectionFactory != null);
+        }
+
+        return connectionFactory;
+    }
+
+    /**
+     * Returns the consumer subject.
+     * 
+     * @return String
+     */
+    protected String getConsumerSubject() {
+        return getSubject();
+    }
+
+    /**
+     * Returns the producer subject.
+     * 
+     * @return String
+     */
+    protected String getProducerSubject() {
+        return getSubject();
+    }
+
+    /**
+     * Returns the subject.
+     * 
+     * @return String
+     */
+    protected String getSubject() {
+        return getClass().getName() + "." + getName();
+    }
+
+    protected void assertArrayEqual(String message, Object[] expected, Object[] actual) {
+        assertEquals(message + ". Array length", expected.length, actual.length);
+        for (int i = 0; i < expected.length; i++) {
+            assertEquals(message + ". element: " + i, expected[i], actual[i]);
+        }
+    }
+
+    protected void assertPrimitiveArrayEqual(String message, Object expected, Object actual) {
+        int length = Array.getLength(expected);
+        assertEquals(message + ". Array length", length, Array.getLength(actual));
+        for (int i = 0; i < length; i++) {
+            assertEquals(message + ". element: " + i, Array.get(expected, i), Array.get(actual, i));
+        }
+    }
+}

Propchange: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/TestSupport.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test3/TestSupport.java
------------------------------------------------------------------------------
    svn:executable = *

Copied: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test6/JmsMultipleClientsTestSupport.java (from r785745, activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/JmsMultipleClientsTestSupport.java)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test6/JmsMultipleClientsTestSupport.java?p2=activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test6/JmsMultipleClientsTestSupport.java&p1=activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/JmsMultipleClientsTestSupport.java&r1=785745&r2=786040&rev=786040&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/JmsMultipleClientsTestSupport.java (original)
+++ activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test6/JmsMultipleClientsTestSupport.java Thu Jun 18 12:42:23 2009
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.activemq.legacy;
+package org.apache.activemq.legacy.test6;
 
 import java.net.URI;
 import java.util.ArrayList;

Copied: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test6/NioQueueSubscriptionTest.java (from r786032, activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/broker/NioQueueSubscriptionTest.java)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test6/NioQueueSubscriptionTest.java?p2=activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test6/NioQueueSubscriptionTest.java&p1=activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/broker/NioQueueSubscriptionTest.java&r1=786032&r2=786040&rev=786040&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/broker/NioQueueSubscriptionTest.java (original)
+++ activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test6/NioQueueSubscriptionTest.java Thu Jun 18 12:42:23 2009
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.activemq.legacy.broker;
+package org.apache.activemq.legacy.test6;
 
 import java.net.URI;
 import java.util.ArrayList;

Copied: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test6/QueueSubscriptionTest.java (from r786032, activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/broker/QueueSubscriptionTest.java)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test6/QueueSubscriptionTest.java?p2=activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test6/QueueSubscriptionTest.java&p1=activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/broker/QueueSubscriptionTest.java&r1=786032&r2=786040&rev=786040&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/broker/QueueSubscriptionTest.java (original)
+++ activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test6/QueueSubscriptionTest.java Thu Jun 18 12:42:23 2009
@@ -14,11 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.activemq.legacy.broker;
+package org.apache.activemq.legacy.test6;
 
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.command.ActiveMQDestination;
-import org.apache.activemq.legacy.JmsMultipleClientsTestSupport;
 
 public class QueueSubscriptionTest extends JmsMultipleClientsTestSupport {
     protected int messageCount = 1000; // 1000 Messages per producer

Copied: activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test6/TopicSubscriptionTest.java (from r786032, activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/broker/TopicSubscriptionTest.java)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test6/TopicSubscriptionTest.java?p2=activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test6/TopicSubscriptionTest.java&p1=activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/broker/TopicSubscriptionTest.java&r1=786032&r2=786040&rev=786040&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/broker/TopicSubscriptionTest.java (original)
+++ activemq/sandbox/activemq-flow/activemq-client/src/test/java/org/apache/activemq/legacy/test6/TopicSubscriptionTest.java Thu Jun 18 12:42:23 2009
@@ -14,7 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.activemq.legacy.broker;
+package org.apache.activemq.legacy.test6;
+
 
 public class TopicSubscriptionTest extends QueueSubscriptionTest {
 

Copied: activemq/sandbox/activemq-flow/activemq-network/src/test/java/org/apache/activemq/legacy/network/BrokerServiceTest.java (from r786032, activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/broker/BrokerServiceTest.java)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-network/src/test/java/org/apache/activemq/legacy/network/BrokerServiceTest.java?p2=activemq/sandbox/activemq-flow/activemq-network/src/test/java/org/apache/activemq/legacy/network/BrokerServiceTest.java&p1=activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/broker/BrokerServiceTest.java&r1=786032&r2=786040&rev=786040&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-all/src/test/java/org/apache/activemq/legacy/broker/BrokerServiceTest.java (original)
+++ activemq/sandbox/activemq-flow/activemq-network/src/test/java/org/apache/activemq/legacy/network/BrokerServiceTest.java Thu Jun 18 12:42:23 2009
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.activemq.legacy.broker;
+package org.apache.activemq.legacy.network;
 
 import junit.framework.TestCase;
 



Mime
View raw message