Search in sources :

Example 96 with EjbJar

use of org.apache.openejb.jee.EjbJar in project tomee by apache.

the class BusinessInterfacesTest method setUp.

@Override
protected void setUp() throws Exception {
    final Assembler assembler = new Assembler();
    config = new ConfigurationFactory();
    ejbModule = new EjbModule(new EjbJar());
    ejbModule.setOpenejbJar(new OpenejbJar());
    ejbJar = ejbModule.getEjbJar();
    strict(false);
}
Also used : OpenejbJar(org.apache.openejb.jee.oejb3.OpenejbJar) Assembler(org.apache.openejb.assembler.classic.Assembler) EjbJar(org.apache.openejb.jee.EjbJar)

Example 97 with EjbJar

use of org.apache.openejb.jee.EjbJar in project tomee by apache.

the class ConfigurationFactoryTest method testConfigureApplicationEjbJar.

@Test
public void testConfigureApplicationEjbJar() throws OpenEJBException {
    // Just to find out whether the validationDisabled message shows up
    SystemInstance.get().setProperty(ConfigurationFactory.VALIDATION_SKIP_PROPERTY, "true");
    final boolean offline = true;
    final ConfigurationFactory factory = new ConfigurationFactory(offline);
    final String id = "testConfigureApplicationEjbJar";
    final EjbJar ejbJar = new EjbJar(id);
    // no real classes engaged so disable metadata (annotation) processing
    ejbJar.setMetadataComplete(true);
    final EjbJarInfo info = factory.configureApplication(ejbJar);
    // not much to assert
    assertEquals(id, info.moduleName);
}
Also used : EjbJarInfo(org.apache.openejb.assembler.classic.EjbJarInfo) EjbJar(org.apache.openejb.jee.EjbJar) Test(org.junit.Test)

Example 98 with EjbJar

use of org.apache.openejb.jee.EjbJar in project tomee by apache.

the class DefaultDataSourceTest method test.

/**
 * Default DataSource should be a JtaManaged DataSource
 *
 * @throws Exception
 */
public void test() throws Exception {
    final ConfigurationFactory config = new ConfigurationFactory();
    final Assembler assembler = new Assembler();
    assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
    assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
    final EjbJar ejbJar = new EjbJar();
    ejbJar.addEnterpriseBean(new SingletonBean(MyBean.class));
    assembler.createApplication(config.configureApplication(new EjbModule(ejbJar)));
    final OpenEjbConfiguration configuration = SystemInstance.get().getComponent(OpenEjbConfiguration.class);
    final ResourceInfo resourceInfo = configuration.facilities.resources.get(0);
    assertEquals("Default JDBC Database", resourceInfo.id);
    assertEquals("true", resourceInfo.properties.getProperty("JtaManaged"));
}
Also used : ResourceInfo(org.apache.openejb.assembler.classic.ResourceInfo) SingletonBean(org.apache.openejb.jee.SingletonBean) TransactionServiceInfo(org.apache.openejb.assembler.classic.TransactionServiceInfo) Assembler(org.apache.openejb.assembler.classic.Assembler) SecurityServiceInfo(org.apache.openejb.assembler.classic.SecurityServiceInfo) EjbJar(org.apache.openejb.jee.EjbJar) OpenEjbConfiguration(org.apache.openejb.assembler.classic.OpenEjbConfiguration)

Example 99 with EjbJar

use of org.apache.openejb.jee.EjbJar in project tomee by apache.

the class CheckNoBusinessMethodTest method noBusinessMethod.

@Keys({ @Key(value = "no.busines.method.case", count = 4), @Key(value = "no.busines.method.args", count = 4), @Key(value = "no.busines.method", count = 4) })
public EjbJar noBusinessMethod() throws OpenEJBException {
    // System.setProperty("openejb.validation.output.level", "VERBOSE");
    final EjbJar ejbJar = new EjbJar();
    final StatelessBean stateLessLocal = new StatelessBean(FooStatelessSession.class);
    stateLessLocal.setLocalHome("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooLocalHome");
    stateLessLocal.setLocal("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooLocal");
    final StatefulBean statefulLocal = new StatefulBean(FooStatefulSession.class);
    statefulLocal.setLocalHome("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooLocalHome");
    statefulLocal.setLocal("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooLocal");
    final StatelessBean stateLessRemote = new StatelessBean(FooRemoteStatelessSession.class);
    stateLessRemote.setHome("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooRemoteHome");
    stateLessRemote.setRemote("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooRemote");
    final StatefulBean statefulRemote = new StatefulBean(FooRemoteStatefulSession.class);
    statefulRemote.setHome("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooRemoteHome");
    statefulRemote.setRemote("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooRemote");
    ejbJar.addEnterpriseBean(stateLessLocal);
    ejbJar.addEnterpriseBean(statefulLocal);
    ejbJar.addEnterpriseBean(stateLessRemote);
    ejbJar.addEnterpriseBean(statefulRemote);
    return ejbJar;
}
Also used : StatelessBean(org.apache.openejb.jee.StatelessBean) StatefulBean(org.apache.openejb.jee.StatefulBean) EjbJar(org.apache.openejb.jee.EjbJar)

Example 100 with EjbJar

use of org.apache.openejb.jee.EjbJar in project tomee by apache.

the class CheckPersistenceUnitUsageTest method noUnitName.

@Keys({ @Key(value = "persistenceUnitRef.noMatches"), @Key(value = "persistenceUnitRef.noUnitName") })
public AppModule noUnitName() {
    final EjbJar ejbJar = new EjbJar();
    ejbJar.addEnterpriseBean(new StatelessBean(FooStatelessOne.class));
    final EjbModule ejbModule = new EjbModule(ejbJar);
    final AppModule appModule = new AppModule(ejbModule.getClassLoader(), ejbModule.getJarLocation());
    appModule.getEjbModules().add(ejbModule);
    final PersistenceUnit pu = new PersistenceUnit("fooUnit");
    final PersistenceUnit pu1 = new PersistenceUnit("fooUnit1");
    final PersistenceUnit pu2 = new PersistenceUnit("fooUnit");
    final org.apache.openejb.jee.jpa.unit.Persistence p = new org.apache.openejb.jee.jpa.unit.Persistence(pu, pu1, pu2);
    final PersistenceModule pm = new PersistenceModule("foo", p);
    appModule.addPersistenceModule(pm);
    return appModule;
}
Also used : AppModule(org.apache.openejb.config.AppModule) EjbModule(org.apache.openejb.config.EjbModule) PersistenceModule(org.apache.openejb.config.PersistenceModule) PersistenceUnit(org.apache.openejb.jee.jpa.unit.PersistenceUnit) StatelessBean(org.apache.openejb.jee.StatelessBean) EjbJar(org.apache.openejb.jee.EjbJar)

Aggregations

EjbJar (org.apache.openejb.jee.EjbJar)242 StatelessBean (org.apache.openejb.jee.StatelessBean)117 Assembler (org.apache.openejb.assembler.classic.Assembler)88 EjbModule (org.apache.openejb.config.EjbModule)81 ConfigurationFactory (org.apache.openejb.config.ConfigurationFactory)76 SecurityServiceInfo (org.apache.openejb.assembler.classic.SecurityServiceInfo)60 TransactionServiceInfo (org.apache.openejb.assembler.classic.TransactionServiceInfo)60 OpenejbJar (org.apache.openejb.jee.oejb3.OpenejbJar)50 Properties (java.util.Properties)49 InitialContext (javax.naming.InitialContext)43 SingletonBean (org.apache.openejb.jee.SingletonBean)42 AppModule (org.apache.openejb.config.AppModule)40 StatefulBean (org.apache.openejb.jee.StatefulBean)33 ProxyFactoryInfo (org.apache.openejb.assembler.classic.ProxyFactoryInfo)31 Module (org.apache.openejb.testing.Module)30 EjbDeployment (org.apache.openejb.jee.oejb3.EjbDeployment)27 LocalInitialContextFactory (org.apache.openejb.core.LocalInitialContextFactory)25 Test (org.junit.Test)25 InitContextFactory (org.apache.openejb.core.ivm.naming.InitContextFactory)24 EjbJarInfo (org.apache.openejb.assembler.classic.EjbJarInfo)21