当前位置: 首页>>代码示例>>Java>>正文


Java EJBContainer.createEJBContainer方法代码示例

本文整理汇总了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);
  }
}
 
开发者ID:karamelchef,项目名称:kandy,代码行数:17,代码来源:EjbFactory.java

示例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);
}
 
开发者ID:hostettler,项目名称:JEE7-Demo,代码行数:25,代码来源:EJB31Runner.java

示例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();
}
 
开发者ID:apache,项目名称:tomee,代码行数:25,代码来源:DataSourceCipheredExampleTest.java

示例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();
}
 
开发者ID:arcuri82,项目名称:testing_security_development_enterprise_systems,代码行数:10,代码来源:TopUsersTest.java

示例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();
}
 
开发者ID:arcuri82,项目名称:testing_security_development_enterprise_systems,代码行数:8,代码来源:StatefulTest.java

示例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);
}
 
开发者ID:arcuri82,项目名称:testing_security_development_enterprise_systems,代码行数:10,代码来源:TestBase.java

示例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());
}
 
开发者ID:arcuri82,项目名称:pg6100,代码行数:12,代码来源:UserEJBTest.java

示例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();
}
 
开发者ID:arcuri82,项目名称:pg6100,代码行数:10,代码来源:ContainerTestCase.java

示例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);
}
 
开发者ID:psnc-dl,项目名称:darceo,代码行数:18,代码来源:GlassfishTestHelper.java

示例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();	
}
 
开发者ID:rcuprak,项目名称:actionbazaar,代码行数:9,代码来源:DiscountManagerBeanEmbeddedTest.java

示例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();
    }
}
 
开发者ID:tomitribe,项目名称:jcache-cdi,代码行数:10,代码来源:ExtraJCacheExtensionTest.java

示例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");
    }});
}
 
开发者ID:apache,项目名称:tomee,代码行数:10,代码来源:SSHServerTest.java

示例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;
}
 
开发者ID:Tinvention,项目名称:Tinvention-training-JEE,代码行数:8,代码来源:InContainerUtil.java


注:本文中的javax.ejb.embeddable.EJBContainer.createEJBContainer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。