@@ -0,0 +1,3552 @@
+/**%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 io.hawtjms.provider.stomp.producer;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertNotNull;%0Aimport static org.junit.Assert.assertTrue;%0Aimport io.hawtjms.test.support.StompTestSupport;%0A%0Aimport javax.jms.Message;%0Aimport javax.jms.MessageProducer;%0Aimport javax.jms.Queue;%0Aimport javax.jms.Session;%0A%0Aimport org.apache.activemq.broker.jmx.QueueViewMBean;%0Aimport org.junit.Test;%0A%0A/**%0A * Test JMS Anonymous Producer functionality.%0A */%0Apublic class JmsAnonymousProducerTest extends StompTestSupport %7B%0A%0A    @Test(timeout = 60000)%0A    public void testCreateProducer() throws Exception %7B%0A        connection = createStompConnection();%0A        assertNotNull(connection);%0A        connection.start();%0A%0A        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);%0A        assertNotNull(session);%0A        session.createProducer(null);%0A%0A        assertTrue(brokerService.getAdminView().getTotalProducerCount() == 0);%0A    %7D%0A%0A    @Test(timeout = 60000)%0A    public void testAnonymousSend() throws Exception %7B%0A        connection = createStompConnection();%0A        assertNotNull(connection);%0A        connection.start();%0A%0A        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);%0A        Queue queue = session.createQueue(name.getMethodName());%0A        assertNotNull(session);%0A        MessageProducer producer = session.createProducer(null);%0A%0A        Message message = session.createMessage();%0A        producer.send(queue, message);%0A%0A        QueueViewMBean proxy = getProxyToQueue(name.getMethodName());%0A        assertEquals(1, proxy.getQueueSize());%0A    %7D%0A%0A    @Test(timeout = 60000)%0A    public void testAnonymousSendToMultipleDestinations() throws Exception %7B%0A        connection = createStompConnection();%0A        assertNotNull(connection);%0A        connection.start();%0A%0A        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);%0A        Queue queue1 = session.createQueue(name.getMethodName() + 1);%0A        Queue queue2 = session.createQueue(name.getMethodName() + 2);%0A        Queue queue3 = session.createQueue(name.getMethodName() + 3);%0A        assertNotNull(session);%0A        MessageProducer producer = session.createProducer(null);%0A%0A        Message message = session.createMessage();%0A        producer.send(queue1, message);%0A        producer.send(queue2, message);%0A        producer.send(queue3, message);%0A%0A        QueueViewMBean proxy = getProxyToQueue(name.getMethodName() + 1);%0A        assertEquals(1, proxy.getQueueSize());%0A        proxy = getProxyToQueue(name.getMethodName() + 2);%0A        assertEquals(1, proxy.getQueueSize());%0A        proxy = getProxyToQueue(name.getMethodName() + 3);%0A        assertEquals(1, proxy.getQueueSize());%0A    %7D%0A%7D%0A

Test that shows anonymous producers work.