Package org.codehaus.activecluster

Source Code of org.codehaus.activecluster.TestSupport

/**
*
* 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.activecluster;

import junit.framework.TestCase;

import javax.jms.JMSException;
import java.util.Iterator;
import java.util.Map;

import org.codehaus.activecluster.impl.ActiveMQClusterFactory;

/**
* @version $Revision: 1.2 $
*/
public class TestSupport extends TestCase {
    protected String dumpConnectedNodes(Map nodes) {
        String result = "";
        for (Iterator i = nodes.values().iterator(); i.hasNext();) {

            Object value = i.next();
            if (value instanceof Node) {
                Node node = (Node) value;
                result += node.getName() + ",";
            }
            else {
                System.out.println("Got node of type: " + value.getClass());
                result += value + ",";
            }
        }
        return result;
    }

    protected Cluster createCluster() throws JMSException, ClusterException {
        ClusterFactory factory = new ActiveMQClusterFactory();
        return factory.createCluster("ORG.CODEHAUS.ACTIVEMQ.TEST.CLUSTER");
    }

    protected Cluster createCluster(String name) throws JMSException, ClusterException {
        Cluster cluster = createCluster();
        return cluster;
    }
}
TOP

Related Classes of org.codehaus.activecluster.TestSupport

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.