Skip to content

Instantly share code, notes, and snippets.

@rokon12
Created February 11, 2013 04:43
Show Gist options
  • Save rokon12/4752667 to your computer and use it in GitHub Desktop.
Save rokon12/4752667 to your computer and use it in GitHub Desktop.
OpenEJB Test Case
package com.codexplo.sleepingkit.bean;
import com.codexplo.sleepingkit.domain.User;
import org.junit.Before;
import org.junit.Test;
import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.Properties;
/**
* Created with IntelliJ IDEA.
* User: Bazlur Rahman Rokon
* Date: 2/7/13
* Time: 5:06 PM
*/
public class UserBeanTest {
private UserBean userBean;
private Context context;
@Before
public void bootContainer() throws Exception {
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
context = new InitialContext(props);
userBean = (UserBean) context.lookup("ejb/UserBean");
}
@Test
public void testSaveUser() throws Exception {
User user = new User();
user.setPassword("rokonoid12");
user.setUserName("rokonoid");
user.setEmail("[email protected]");
userBean.saveUser(user);
}
// @Test
public void testUpdate() throws Exception {
}
// @Test
public void testFindAllUser() throws Exception {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment