?? sbusinessexample16beantest.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);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -