/* JFox, the OpenSource J2EE Application Server
 *
 * Distributable under GNU LGPL license by gun.org
 * more details please visit http://www.huihoo.org/jfox
 */

package org.jfox.examples.ejb.protocol;

import javax.naming.Context;
import javax.naming.InitialContext;

import junit.framework.TestCase;

/**
 * @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
 */

public class TestMain extends TestCase {
    private TestProtocolHome home = null;
    private TestProtocol ejb = null;

    protected void setUp() throws Exception {
        Context ctx = new InitialContext();
        Object obj = ctx.lookup("/ejb/TestProtocolEJB");
        home = (TestProtocolHome) javax.rmi.PortableRemoteObject.narrow(obj, TestProtocolHome.class);
//      ((ExtendedEJBHome)home).useProtocol("soap");
        ejb = home.create();

    }

    protected void tearDown() throws Exception {
        super.tearDown();
    }

    public void testJRMP() throws Exception {
        String voice = ejb.invokeByJRMP();
        System.out.println("invoke by JRMP: " + voice);
    }

    public void testLOCAL() throws Exception {
        String voice = ejb.invokeByLOCAL();
        System.out.println("invoke by LOCAL: " + voice);
    }

    public void testJRMP_SSL() throws Exception {
        String voice = ejb.invokeByJRMP_SSL();
        System.out.println("invoke by JRMP_SSL: " + voice);
    }

    public void testSOAP() throws Exception {
        String voice = ejb.invokeBySOAP();
        System.out.println("invoke by SOAP: " + voice);
    }

    public static void main(String[] args) {

    }
}
