Package org.codehaus.activemq.broker.impl

Source Code of org.codehaus.activemq.broker.impl.AdvisorySupportTest

/**
*
* Copyright 2004 Protique Ltd
*
* Licensed 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.codehaus.activemq.broker.impl;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.jms.DeliveryMode;
import org.codehaus.activemq.broker.BrokerClient;
import org.codehaus.activemq.message.ActiveMQDestination;
import org.codehaus.activemq.message.ActiveMQObjectMessage;
import org.codehaus.activemq.message.ActiveMQTopic;
import org.codehaus.activemq.message.ConnectionInfo;
import org.codehaus.activemq.message.ConsumerInfo;
import org.codehaus.activemq.message.Packet;
import org.codehaus.activemq.message.ProducerInfo;
import org.codehaus.activemq.util.IdGenerator;
import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
import EDU.oswego.cs.dl.util.concurrent.CopyOnWriteArrayList;

/**
* Test advisory subscriptions and messages
*
* @version $Revision: 1.1 $
*/

import junit.framework.TestCase;

/**
*
* AdvisorySupportTest
*/
public class AdvisorySupportTest extends TestCase {
    /*
     * @see TestCase#setUp()
     */
    protected void setUp() throws Exception {
        super.setUp();
    }

    /*
     * @see TestCase#tearDown()
     */
    protected void tearDown() throws Exception {
        super.tearDown();
    }

    /**
     * Constructor for AdvisorySupportTest.
     * @param arg0
     */
    public AdvisorySupportTest(String arg0) {
        super(arg0);
    }

    public void testMatchConsumer(){
        String destName = "foo.bar";
        ActiveMQTopic topic = new ActiveMQTopic(destName);
        ConsumerInfo info = new ConsumerInfo();
        info.setDestination(topic);
       
        ActiveMQTopic advisoryDest = new ActiveMQTopic(ActiveMQDestination.CONSUMER_ADVISORY_PREFIX + destName);
        ConsumerInfo advisory = new ConsumerInfo();
        advisory.setDestination(advisoryDest);
        AdvisorySupport test = new AdvisorySupport();
        assertTrue(test.matchConsumer(advisory, info));
    }
   
    public void testMatchProducer(){
        String destName = "foo.bar";
        ActiveMQTopic topic = new ActiveMQTopic(destName);
        ProducerInfo info = new ProducerInfo();
        info.setDestination(topic);
       
        ActiveMQTopic advisoryDest = new ActiveMQTopic(ActiveMQDestination.PRODUCER_ADVISORY_PREFIX + destName);
        ConsumerInfo advisory = new ConsumerInfo();
        advisory.setDestination(advisoryDest);
        AdvisorySupport test = new AdvisorySupport();
        assertTrue(test.matchProducer(advisory, info));
    }
   
    public void testMatchConnection(){
        String destName = "foo.bar";
        ConnectionInfo info = new ConnectionInfo();
       
       
        ActiveMQTopic advisoryDest = new ActiveMQTopic(ActiveMQDestination.CONNECTION_ADVISORY_PREFIX + destName);
        ConsumerInfo advisory = new ConsumerInfo();
        advisory.setDestination(advisoryDest);
        AdvisorySupport test = new AdvisorySupport();
        assertTrue(test.matchConnection(advisory, info));
    }
}
TOP

Related Classes of org.codehaus.activemq.broker.impl.AdvisorySupportTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.