com.evasion.plugin.junit.ejb.AbstractEBJBTest Maven / Gradle / Ivy
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.evasion.plugin.junit.ejb;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.junit.BeforeClass;
/**
*
* @author sebastien.glon
*/
public abstract class AbstractEBJBTest {
protected static Context ctx;
// ======================================
// = Lifecycle Methods =
// ======================================
@BeforeClass
public static void createContainer() throws Exception {
Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
ctx = new InitialContext(props);
}
protected T lookupBy(Class type) throws NamingException {
return (T) ctx.lookup(""
+ type.getSimpleName());
}
}