⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sbusinessexample16beantest.java

📁 《精通Spring》源代码
💻 JAVA
字号:
/*
 * Created on 2004-11-13
 * 
 * http://www.open-v.com 提供代码的维护工作
 */
package com.openv.spring;

import junit.framework.TestCase;

import java.util.Hashtable;
import javax.rmi.PortableRemoteObject;
import javax.naming.Context;
import javax.naming.InitialContext;


/**
 * EJB Test Client
 * 
 * @author luoshifei
 */
public class SBusinessExample16BeanTest extends TestCase {

    /** Home interface */
    protected com.openv.spring.SBusinessExample16Home home;

    /**
     * Get the initial naming context
     */
    protected Context getInitialContext() throws Exception {
        Hashtable props = new Hashtable();
        props.put(Context.INITIAL_CONTEXT_FACTORY,
                "org.jnp.interfaces.NamingContextFactory");
        props.put(Context.URL_PKG_PREFIXES,
                "org.jboss.naming:org.jnp.interfaces");
        props.put(Context.PROVIDER_URL, "jnp://localhost:1099");
        Context ctx = new InitialContext(props);
        return ctx;
    }

    /**
     * Get the home interface
     */
    protected com.openv.spring.SBusinessExample16Home getHome()
            throws Exception {
        Context ctx = this.getInitialContext();
        Object o = ctx.lookup("SBusinessExample16Bean");
        com.openv.spring.SBusinessExample16Home intf = 
            (com.openv.spring.SBusinessExample16Home) PortableRemoteObject
                .narrow(o, com.openv.spring.SBusinessExample16Home.class);
        return intf;
    }

    /**
     * Set up the test case
     */
    protected void setUp() throws Exception {
        this.home = this.getHome();
    }

    /**
     * Test for com.openv.spring.SBusinessExample16Remote.getStr(String args)
     */
    public void testGetStr() throws Exception {
        com.openv.spring.SBusinessExample16Remote instance;
        String result;

        // Parameters
        String param0 = "luoshifei";

        // Instance creation
        instance = this.home.create();

        // Method call
        result = instance.getStr(param0);

        System.out.println(result);

        // Various assertions
        // assertNotNull(result);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -