本文整理汇总了Java中javax.ejb.embeddable.EJBContainer.createEJBContainer方法的典型用法代码示例。如果您正苦于以下问题:Java EJBContainer.createEJBContainer方法的具体用法?Java EJBContainer.createEJBContainer怎么用?Java EJBContainer.createEJBContainer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.ejb.embeddable.EJBContainer
的用法示例。
在下文中一共展示了EJBContainer.createEJBContainer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initContainer
import javax.ejb.embeddable.EJBContainer; //导入方法依赖的package包/类
@Before
public void initContainer() throws Exception {
/*
This will start an embedded container, which we ll save us
from having to start it as an external process and deploy
our WAR on it.
However, embedded containers only provide reduced functionalities,
see page 231 in Chapter 7 and
http://arquillian.org/blog/2012/04/13/the-danger-of-embedded-containers/
In generate, better to avoid the embedded containers,
although I will use them in some simple examples just to
simplify the execution of the tests
*/
Map<String, Object> properties = new HashMap<>();
properties.put(EJBContainer.MODULES, new File("target/classes"));
ec = EJBContainer.createEJBContainer(properties);
ctx = ec.getContext();
}
开发者ID:arcuri82,项目名称:testing_security_development_enterprise_systems,代码行数:23,代码来源:UserBeanInEmbeddedContainerTest.java
示例2: EjbFactory
import javax.ejb.embeddable.EJBContainer; //导入方法依赖的package包/类
private EjbFactory() {
if (container == null) {
Properties properties = new Properties();
properties.put("myTransactionManager", "new://TransactionManager?type=TransactionManager");
properties.put("myTransactionManager.defaultTransactionTimeout", "3hr"); //hour
properties.put("jdbc/bankWorkTestResource", "new://Resource?type=DataSource");
properties.put("jdbc/bankWorkTestResource.JdbcDriver", "com.mysql.jdbc.Driver");
properties.put("jdbc/bankWorkTestResource.JdbcUrl", databaseUrl);
properties.put("jdbc/bankWorkTestResource.UserName", databaseUser);
properties.put("jdbc/bankWorkTestResource.Password", databasePass);
container = EJBContainer.createEJBContainer(properties);
}
}
示例3: withBeforeClasses
import javax.ejb.embeddable.EJBContainer; //导入方法依赖的package包/类
@Override
protected Statement withBeforeClasses(Statement statement) {
Properties p = new Properties();
// set the initial context factory
p.put("java.naming.factory.initial ",
"org.apache.openejb.client.LocalInitialContextFactory");
// create some resources
p.put("jdbc/StudentsDS", "new://Resource?type=DataSource");
p.put("jdbc/StudentsDS.JdbcDriver", "org.apache.derby.jdbc.EmbeddedDriver");
p.put("jdbc/StudentsDS.JdbcUrl", "jdbc:derby:memory:studentDB;create=true");
// set some openejb flags
p.put("openejb.jndiname.format", "{ejbName}/{interfaceClass}");
p.put("openejb.descriptors.output", "true");
p.put("openejb.validation.output.level", "verbose");
p.put("JEE6DemoPersistence.eclipselink.target-database", "DERBY");
p.put("JEE6DemoPersistence.eclipselink.logging.level", "INFO");
p.put("JEE6DemoPersistence.eclipselink.ddl-generation", "create-tables");
ejbContainer = EJBContainer.createEJBContainer(p);
return super.withBeforeClasses(statement);
}
示例4: accessDatasourceWithMyImplementation
import javax.ejb.embeddable.EJBContainer; //导入方法依赖的package包/类
@Test
public void accessDatasourceWithMyImplementation() throws Exception {
// define the datasource
Properties properties = new Properties();
properties.setProperty("ProtectedDatasource", "new://Resource?type=DataSource");
properties.setProperty("ProtectedDatasource.JdbcDriver", "org.hsqldb.jdbcDriver");
properties.setProperty("ProtectedDatasource.JdbcUrl", "jdbc:hsqldb:mem:protected");
properties.setProperty("ProtectedDatasource.UserName", USER);
properties.setProperty("ProtectedDatasource.Password", "3MdniFr3v3NLLuoY");
properties.setProperty("ProtectedDatasource.PasswordCipher", "reverse");
properties.setProperty("ProtectedDatasource.JtaManaged", "true");
// start the context and makes junit test injections
EJBContainer container = EJBContainer.createEJBContainer(properties);
Context context = container.getContext();
context.bind("inject", this);
// test the datasource
assertNotNull(dataSource);
assertNotNull(dataSource.getConnection());
// closing the context
container.close();
}
示例5: initContainer
import javax.ejb.embeddable.EJBContainer; //导入方法依赖的package包/类
@Before
public void initContainer() throws Exception {
Map<String, Object> properties = new HashMap<>();
properties.put(EJBContainer.MODULES, new File("target/classes"));
ec = EJBContainer.createEJBContainer(properties);
ctx = ec.getContext();
initDB();
}
示例6: initContainer
import javax.ejb.embeddable.EJBContainer; //导入方法依赖的package包/类
@Before
public void initContainer() throws Exception {
Map<String, Object> properties = new HashMap<>();
properties.put(EJBContainer.MODULES, new File("target/classes"));
ec = EJBContainer.createEJBContainer(properties);
ctx = ec.getContext();
}
示例7: initContainer
import javax.ejb.embeddable.EJBContainer; //导入方法依赖的package包/类
@Before
public void initContainer() throws Exception {
/*
Using an embedded JEE container...
recall, this is done just to simplify those examples, but
you will have to use Arquillian when testing an actual application
*/
Map<String, Object> properties = new HashMap<>();
properties.put(EJBContainer.MODULES, new File("target/classes"));
ec = EJBContainer.createEJBContainer(properties);
ctx = ec.getContext();
}
开发者ID:arcuri82,项目名称:testing_security_development_enterprise_systems,代码行数:15,代码来源:CounterTestBaseJEE.java
示例8: initContainer
import javax.ejb.embeddable.EJBContainer; //导入方法依赖的package包/类
@BeforeClass
public static void initContainer() throws Exception {
Map<String, Object> properties = new HashMap<>();
properties.put(EJBContainer.MODULES, new File("target/classes"));
ec = EJBContainer.createEJBContainer(properties);
ctx = ec.getContext();
queriesEJB = getEJB(QueriesEJB.class);
}
示例9: initContainer
import javax.ejb.embeddable.EJBContainer; //导入方法依赖的package包/类
@BeforeClass
public static void initContainer() throws Exception {
Map<String, Object> properties = new HashMap<>();
properties.put(EJBContainer.MODULES, new File("target/classes"));
ec = EJBContainer.createEJBContainer(properties);
ctx = ec.getContext();
//as it is @Stateless, can init just once before running the test suite
userEJB = (UserEJB) ctx.lookup("java:global/classes/"+UserEJB.class.getSimpleName()+"!"+UserEJB.class.getName());
}
示例10: setupContainer
import javax.ejb.embeddable.EJBContainer; //导入方法依赖的package包/类
@BeforeClass
public static void setupContainer() throws Exception {
HashMap<String, Object> config = new HashMap<>();
config.put( EJBContainer.MODULES, new File( "target/classes" ) );
container = EJBContainer.createEJBContainer( config );
context = container.getContext();
}
示例11: createContainer
import javax.ejb.embeddable.EJBContainer; //导入方法依赖的package包/类
/**
* Creates a new EJB container.
*
* @return EJB container
* @throws Exception
* if something went wrong
*/
public static EJBContainer createContainer()
throws Exception {
Map<String, String> props = new HashMap<String, String>();
props.put("org.glassfish.ejb.embedded.glassfish.installation.root",
"../../wrdz-common/business/src/test/glassfish");
props.put("org.glassfish.ejb.embedded.glassfish.instance.root",
"../../wrdz-common/business/src/test/glassfish/domains/wrdz-domain");
props.put(EJBContainer.APP_NAME, APPLICATION_NAME);
return EJBContainer.createEJBContainer(props);
}
示例12: setUpClass
import javax.ejb.embeddable.EJBContainer; //导入方法依赖的package包/类
@BeforeClass
public static void setUpClass() {
Map<String, Object> properties = new HashMap<>();
properties.put("org.glassfish.ejb.embedded.glassfish.instance.root",
"./src/test/domain");
ejbContainer = EJBContainer.createEJBContainer(properties);
ctx = ejbContainer.getContext();
}
示例13: setUp
import javax.ejb.embeddable.EJBContainer; //导入方法依赖的package包/类
@Before
public void setUp() {
try {
container = EJBContainer.createEJBContainer();
container.getContext().bind("inject", this);
} catch (Exception e) {
e.printStackTrace();
}
}
示例14: start
import javax.ejb.embeddable.EJBContainer; //导入方法依赖的package包/类
@BeforeClass
public static void start() {
System.setProperty("openejb.server.ssh.key", "src/test/key/ssh-key");
System.setProperty("openejb.logger.external", "true");
container = EJBContainer.createEJBContainer(new HashMap<Object, Object>() {{
put(OpenEjbContainer.OPENEJB_EMBEDDED_REMOTABLE, "true");
put(DeploymentFilterable.CLASSPATH_FILTER_SYSTEMAPPS, "false");
}});
}
示例15: getEJBContainer
import javax.ejb.embeddable.EJBContainer; //导入方法依赖的package包/类
public synchronized static EJBContainer getEJBContainer() {
if (container == null) {
Map<String, Object> properties = new HashMap<String, Object>();
container = EJBContainer.createEJBContainer(properties);
}
return container;
}