@@ -0,0 +1,3554 @@
+/**%0A * Licensed to the Apache Software Foundation (ASF) under one or more%0A * contributor license agreements.  See the NOTICE file distributed with%0A * this work for additional information regarding copyright ownership.%0A * The ASF licenses this file to You under the Apache License, Version 2.0%0A * (the %22License%22); you may not use this file except in compliance with%0A * the License.  You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.fusesource.amqpjms.jms.consumer;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertNotNull;%0Aimport static org.junit.Assert.assertNull;%0A%0Aimport javax.jms.Connection;%0Aimport javax.jms.Message;%0Aimport javax.jms.MessageConsumer;%0Aimport javax.jms.MessageProducer;%0Aimport javax.jms.Queue;%0Aimport javax.jms.Session;%0Aimport javax.jms.TextMessage;%0A%0Aimport org.fusesource.amqpjms.util.AmqpTestSupport;%0Aimport org.junit.Test;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0Apublic class JmsMessageGroupTest extends AmqpTestSupport %7B%0A%0A    private static final Logger LOG = LoggerFactory.getLogger(JmsMessageGroupTest.class);%0A%0A    @Test%0A    public void testGroupedMessagesDeliveredToOnlyOneConsumer() throws Exception %7B%0A        Connection connection = createAmqpConnection();%0A        connection.start();%0A        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);%0A        Queue queue = session.createQueue(name.getMethodName());%0A        MessageConsumer consumer1 = session.createConsumer(queue);%0A        MessageProducer producer = session.createProducer(queue);%0A%0A        // Send the messages.%0A        for (int i = 0; i %3C 4; i++) %7B%0A            TextMessage message = session.createTextMessage(%22message %22 + i);%0A            message.setStringProperty(%22JMSXGroupID%22, %22TEST-GROUP%22);%0A            message.setIntProperty(%22JMSXGroupSeq%22, i + 1);%0A            LOG.info(%22sending message: %22 + message);%0A            producer.send(message);%0A        %7D%0A%0A        // All the messages should have been sent down connection 1.. just get%0A        // the first 3%0A        for (int i = 0; i %3C 3; i++) %7B%0A            TextMessage m1 = (TextMessage) consumer1.receive(500);%0A            assertNotNull(%22m1 is null for index: %22 + i, m1);%0A            assertEquals(m1.getIntProperty(%22JMSXGroupSeq%22), i + 1);%0A        %7D%0A%0A        // Setup a second connection%0A        Connection connection1 = createAmqpConnection();%0A        connection1.start();%0A        Session session2 = connection1.createSession(false, Session.AUTO_ACKNOWLEDGE);%0A        MessageConsumer consumer2 = session2.createConsumer(queue);%0A%0A        // Close the first consumer.%0A        consumer1.close();%0A%0A        // The last messages should now go the the second consumer.%0A        for (int i = 0; i %3C 1; i++) %7B%0A            TextMessage m1 = (TextMessage) consumer2.receive(500);%0A            assertNotNull(%22m1 is null for index: %22 + i, m1);%0A            assertEquals(m1.getIntProperty(%22JMSXGroupSeq%22), 4 + i);%0A        %7D%0A%0A        // assert that there are no other messages left for the consumer 2%0A        Message m = consumer2.receive(100);%0A        assertNull(%22consumer 2 has some messages left%22, m);%0A        connection.close();%0A        connection1.close();%0A    %7D%0A%7D%0A

Add a basic message group test