Search in sources :

Example 51 with EjbJar$JAXB

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

the class ThirdSLSBeanTest method module.

@Module
public EjbJar module() {
    final EjbJar ejbJar = new EjbJar();
    final StatelessBean bean = ejbJar.addEnterpriseBean(new StatelessBean(ThirdSLSBean.class));
    final AssemblyDescriptor assembly = ejbJar.getAssemblyDescriptor();
    assembly.addInterceptorBinding(new InterceptorBinding("*", new Interceptor(DefaultInterceptorOne.class)));
    assembly.addInterceptorBinding(new InterceptorBinding("*", new Interceptor(DefaultInterceptorTwo.class)));
    return ejbJar;
}
Also used : InterceptorBinding(org.apache.openejb.jee.InterceptorBinding) StatelessBean(org.apache.openejb.jee.StatelessBean) AssemblyDescriptor(org.apache.openejb.jee.AssemblyDescriptor) Interceptor(org.apache.openejb.jee.Interceptor) EjbJar(org.apache.openejb.jee.EjbJar) Module(org.apache.openejb.testing.Module)

Example 52 with EjbJar$JAXB

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

the class DontFailOnUnusedTagTest method run.

@Test
public void run() throws Exception {
    // this test just validates we passthrough on unknown elements (tomcat will fail/warn)
    try (final InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("webxml31.xml")) {
        final WebApp web = Sxc.unmarshalJavaee(new WebApp$JAXB(), is);
        assertNotNull(web.getAbsoluteOrdering());
    }
}
Also used : InputStream(java.io.InputStream) WebApp(org.apache.openejb.jee.WebApp) WebApp$JAXB(org.apache.openejb.jee.WebApp$JAXB) Test(org.junit.Test)

Example 53 with EjbJar$JAXB

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

the class InjectionTest method setUp.

protected void setUp() throws Exception {
    super.setUp();
    System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName());
    final ConfigurationFactory config = new ConfigurationFactory();
    final Assembler assembler = new Assembler();
    assembler.createProxyFactory(config.configureService(ProxyFactoryInfo.class));
    assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
    assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
    // containers
    final StatelessSessionContainerInfo statelessContainerInfo = config.configureService(StatelessSessionContainerInfo.class);
    statelessContainerInfo.properties.setProperty("TimeOut", "10");
    statelessContainerInfo.properties.setProperty("MaxSize", "0");
    statelessContainerInfo.properties.setProperty("StrictPooling", "false");
    assembler.createContainer(statelessContainerInfo);
    // Setup the descriptor information
    final StatelessBean bean = new StatelessBean(WidgetBean.class);
    bean.addBusinessLocal(Widget.class.getName());
    bean.addBusinessRemote(RemoteWidget.class.getName());
    final EjbJar ejbJar = new EjbJar();
    ejbJar.addEnterpriseBean(bean);
    bean.getEnvEntry().add(new EnvEntry(name("myString"), "java.lang.String", "2"));
    bean.getEnvEntry().add(new EnvEntry(name("myDouble"), "java.lang.Double", "3.0"));
    bean.getEnvEntry().add(new EnvEntry(name("myLong"), "java.lang.Long", "4"));
    bean.getEnvEntry().add(new EnvEntry(name("myFloat"), "java.lang.Float", "5"));
    bean.getEnvEntry().add(new EnvEntry(name("myInteger"), "java.lang.Integer", "6"));
    bean.getEnvEntry().add(new EnvEntry(name("myShort"), "java.lang.Short", "7"));
    bean.getEnvEntry().add(new EnvEntry(name("myBoolean"), "java.lang.Boolean", "false"));
    bean.getEnvEntry().add(new EnvEntry(name("myByte"), "java.lang.Byte", "8"));
    bean.getEnvEntry().add(new EnvEntry(name("myCharacter"), "java.lang.Character", "9"));
    bean.getEnvEntry().add(new EnvEntry(name("myClass"), "java.lang.Class", Widget.class.getName()));
    bean.getEnvEntry().add(new EnvEntry(name("myTimeUnit"), TimeUnit.class.getName(), "HOURS"));
    final EnvEntry entry = new EnvEntry("injectedBoolean", (String) null, "true");
    entry.getInjectionTarget().add((new InjectionTarget(WidgetBean.class.getName(), "injectedBoolean")));
    bean.getEnvEntry().add(entry);
    final ResourceEnvRef resourceEnvRef = new ResourceEnvRef("injectedContext", (String) null);
    resourceEnvRef.getInjectionTarget().add((new InjectionTarget(WidgetBean.class.getName(), "injectedContext")));
    bean.getResourceEnvRef().add(resourceEnvRef);
    assembler.createApplication(config.configureApplication(ejbJar));
}
Also used : StatelessSessionContainerInfo(org.apache.openejb.assembler.classic.StatelessSessionContainerInfo) LocalInitialContextFactory(org.apache.openejb.core.LocalInitialContextFactory) ProxyFactoryInfo(org.apache.openejb.assembler.classic.ProxyFactoryInfo) TransactionServiceInfo(org.apache.openejb.assembler.classic.TransactionServiceInfo) StatelessBean(org.apache.openejb.jee.StatelessBean) InjectionTarget(org.apache.openejb.jee.InjectionTarget) Assembler(org.apache.openejb.assembler.classic.Assembler) SecurityServiceInfo(org.apache.openejb.assembler.classic.SecurityServiceInfo) ResourceEnvRef(org.apache.openejb.jee.ResourceEnvRef) EjbJar(org.apache.openejb.jee.EjbJar) EnvEntry(org.apache.openejb.jee.EnvEntry)

Example 54 with EjbJar$JAXB

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

the class JndiNameFormatTest method deploy.

private void deploy(final String format) throws OpenEJBException, IOException, NamingException {
    SystemInstance.get().setProperty("openejb.jndiname.format", format);
    final ConfigurationFactory config = new ConfigurationFactory();
    assembler = new Assembler();
    assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
    assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
    final AppModule app = new AppModule(this.getClass().getClassLoader(), "test-app");
    final EjbJar ejbJar = new EjbJar();
    ejbJar.addEnterpriseBean(new StatelessBean(EchoImpl.class));
    app.getEjbModules().add(new EjbModule(ejbJar));
    assembler.createApplication(config.configureApplication(app));
}
Also used : TransactionServiceInfo(org.apache.openejb.assembler.classic.TransactionServiceInfo) StatelessBean(org.apache.openejb.jee.StatelessBean) Assembler(org.apache.openejb.assembler.classic.Assembler) SecurityServiceInfo(org.apache.openejb.assembler.classic.SecurityServiceInfo) EjbJar(org.apache.openejb.jee.EjbJar)

Example 55 with EjbJar$JAXB

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

the class JndiNameTest method testOpenejbJar2.

public void testOpenejbJar2() throws Exception {
    System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, InitContextFactory.class.getName());
    final ConfigurationFactory config = new ConfigurationFactory();
    final Assembler assembler = new Assembler();
    assembler.createProxyFactory(config.configureService(ProxyFactoryInfo.class));
    assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
    assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
    // containers
    final StatelessSessionContainerInfo statelessContainerInfo = config.configureService(StatelessSessionContainerInfo.class);
    assembler.createContainer(statelessContainerInfo);
    // Setup the descriptor information
    final EjbModule ejbModule = new EjbModule(new EjbJar(), null);
    ejbModule.getEjbJar().addEnterpriseBean(new StatelessBean(FooBean.class));
    final OpenejbJarType v2 = new OpenejbJarType();
    final SessionBeanType ejbDeployment = new SessionBeanType();
    ejbDeployment.setEjbName("FooBean");
    ejbDeployment.getJndi().add(new org.apache.openejb.jee.oejb2.Jndi("thename", "Local"));
    ejbDeployment.getJndi().add(new org.apache.openejb.jee.oejb2.Jndi("anothername", "Remote"));
    ejbDeployment.getJndi().add(new org.apache.openejb.jee.oejb2.Jndi("loldstyle", "LocalHome"));
    ejbDeployment.getJndi().add(new org.apache.openejb.jee.oejb2.Jndi("roldstyle", "RemoteHome"));
    v2.getEnterpriseBeans().add(ejbDeployment);
    ejbModule.getAltDDs().put("openejb-jar.xml", v2);
    assembler.createApplication(config.configureApplication(ejbModule));
    final InitialContext initialContext = new InitialContext();
    assertName(initialContext, Orange.class, "thename");
    assertName(initialContext, Red.class, "anothername");
    assertName(initialContext, LHYellow.class, "loldstyle");
    assertName(initialContext, RHGreen.class, "roldstyle");
}
Also used : StatelessSessionContainerInfo(org.apache.openejb.assembler.classic.StatelessSessionContainerInfo) OpenejbJarType(org.apache.openejb.jee.oejb2.OpenejbJarType) InitContextFactory(org.apache.openejb.core.ivm.naming.InitContextFactory) InitialContext(javax.naming.InitialContext) ProxyFactoryInfo(org.apache.openejb.assembler.classic.ProxyFactoryInfo) TransactionServiceInfo(org.apache.openejb.assembler.classic.TransactionServiceInfo) StatelessBean(org.apache.openejb.jee.StatelessBean) SessionBeanType(org.apache.openejb.jee.oejb2.SessionBeanType) Assembler(org.apache.openejb.assembler.classic.Assembler) SecurityServiceInfo(org.apache.openejb.assembler.classic.SecurityServiceInfo) 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 Test (org.junit.Test)26 LocalInitialContextFactory (org.apache.openejb.core.LocalInitialContextFactory)25 InitContextFactory (org.apache.openejb.core.ivm.naming.InitContextFactory)24 EjbJarInfo (org.apache.openejb.assembler.classic.EjbJarInfo)21