Search in sources :

Example 11 with AssemblyDescriptor$JAXB.readAssemblyDescriptor

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

the class EntityManagerPropogationTest method setUp.

public void setUp() throws OpenEJBException, IOException, NamingException {
    System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, InitContextFactory.class.getName());
    System.setProperty("openejb.embedded", "true");
    // Boot up the minimum required OpenEJB components
    final Assembler assembler = new Assembler();
    final ConfigurationFactory config = new ConfigurationFactory();
    assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
    assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
    // Start creating the test application
    // Create an ejb-jar.xml for this app
    final EjbJar ejbJar = new EjbJar();
    ejbJar.addEnterpriseBean(new StatefulBean("PleaseCloseMyExtendedEm", PleaseCloseMyExtendedEmBean.class));
    ejbJar.addEnterpriseBean(new StatefulBean("PleaseCloseMyEm", PleaseCloseMyEmBean.class));
    ejbJar.addEnterpriseBean(new StatelessBean("PleaseCloseMyLessEm", PleaseCloseMyEmBean.class));
    // Add six beans and link them all in a chain
    addStatefulBean(ejbJar, ExtendedContextBean.class, "Extended", "Extendedx2");
    addStatefulBean(ejbJar, ExtendedContextBean.class, "Extendedx2", "Extendedx3");
    addStatefulBean(ejbJar, ExtendedContextBean.class, "Extendedx3", "Extendedx4");
    addStatefulBean(ejbJar, ExtendedContextBean.class, "Extendedx4", "Extendedx5");
    addStatefulBean(ejbJar, ExtendedContextBean.class, "ExtendedToTransaction", "StatelessTransactionToExtended");
    addStatefulBean(ejbJar, ExtendedContextBean.class, "Extendedx5", "Extendedx6");
    ejbJar.addEnterpriseBean(new StatefulBean("Extendedx6", EndNodeBean.class));
    // Add six beans and link them all in a chain
    addStatefulBean(ejbJar, TransactionContextBean.class, "Transaction", "Transactionx2");
    addStatefulBean(ejbJar, TransactionContextBean.class, "Transactionx2", "Transactionx3");
    addStatefulBean(ejbJar, TransactionContextBean.class, "Transactionx3", "Transactionx4");
    addStatefulBean(ejbJar, TransactionContextBean.class, "Transactionx4", "Transactionx5");
    addStatefulBean(ejbJar, TransactionContextBean.class, "Transactionx5", "Transactionx6");
    addStatefulBean(ejbJar, TransactionContextBean.class, "TransactionToExtended", "Extendedx5");
    addStatelessBean(ejbJar, TransactionContextBean.class, "StatelessTransactionToExtended", "Extendedx5");
    ejbJar.addEnterpriseBean(new StatefulBean("Transactionx6", EndNodeBean.class));
    ejbJar.setAssemblyDescriptor(new AssemblyDescriptor());
    ejbJar.getAssemblyDescriptor().addApplicationException(IllegalArgumentException.class, false, true);
    ejbJar.getAssemblyDescriptor().addApplicationException(ArgumentException.class, false, true);
    // List<ContainerTransaction> declared = ejbJar.getAssemblyDescriptor().getContainerTransaction();
    // declared.add(new ContainerTransaction(TransAttribute.REQUIRED, ExtendedContextBean.class.getName(), "Extendedx5", "*"));
    // declared.add(new ContainerTransaction(TransAttribute.REQUIRED, ExtendedContextBean.class.getName(), "TransactionToExtended", "*"));
    final EjbModule ejbModule = new EjbModule(ejbJar);
    // Create an "ear"
    final AppModule appModule = new AppModule(ejbModule.getClassLoader(), "test-app");
    // Add the ejb-jar.xml to the ear
    appModule.getEjbModules().add(ejbModule);
    // Create a persistence-unit for this app
    final PersistenceUnit unit = new PersistenceUnit("testUnit");
    unit.addClass(Color.class);
    unit.setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
    unit.getProperties().setProperty("openjpa.RuntimeUnenhancedClasses", "supported");
    // Add the persistence.xml to the "ear"
    appModule.addPersistenceModule(new PersistenceModule("root", new Persistence(unit)));
    // Configure and assemble the ear -- aka. deploy it
    final AppInfo info = config.configureApplication(appModule);
    assembler.createApplication(info);
}
Also used : AppModule(org.apache.openejb.config.AppModule) StatefulBean(org.apache.openejb.jee.StatefulBean) EjbModule(org.apache.openejb.config.EjbModule) InitContextFactory(org.apache.openejb.core.ivm.naming.InitContextFactory) PersistenceModule(org.apache.openejb.config.PersistenceModule) AppInfo(org.apache.openejb.assembler.classic.AppInfo) Persistence(org.apache.openejb.jee.jpa.unit.Persistence) PersistenceUnit(org.apache.openejb.jee.jpa.unit.PersistenceUnit) TransactionServiceInfo(org.apache.openejb.assembler.classic.TransactionServiceInfo) StatelessBean(org.apache.openejb.jee.StatelessBean) ConfigurationFactory(org.apache.openejb.config.ConfigurationFactory) Assembler(org.apache.openejb.assembler.classic.Assembler) AssemblyDescriptor(org.apache.openejb.jee.AssemblyDescriptor) SecurityServiceInfo(org.apache.openejb.assembler.classic.SecurityServiceInfo) EjbJar(org.apache.openejb.jee.EjbJar)

Example 12 with AssemblyDescriptor$JAXB.readAssemblyDescriptor

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

the class StatefulInterceptorTest method buildTestApp.

public EjbModule buildTestApp() {
    final EjbJar ejbJar = new EjbJar();
    final AssemblyDescriptor ad = ejbJar.getAssemblyDescriptor();
    final EnterpriseBean bean = ejbJar.addEnterpriseBean(new StatefulBean(TargetBean.class));
    Interceptor interceptor;
    interceptor = ejbJar.addInterceptor(new Interceptor(ClassInterceptor.class));
    ad.addInterceptorBinding(new InterceptorBinding(bean, interceptor));
    interceptor = ejbJar.addInterceptor(new Interceptor(DefaultInterceptor.class));
    ad.addInterceptorBinding(new InterceptorBinding("*", interceptor));
    interceptor = ejbJar.addInterceptor(new Interceptor(EchoMethodInterceptor.class));
    final InterceptorBinding binding = ad.addInterceptorBinding(new InterceptorBinding(bean, interceptor));
    binding.setMethod(new NamedMethod("echo"));
    return new EjbModule(this.getClass().getClassLoader(), this.getClass().getSimpleName(), "test", ejbJar, null);
}
Also used : InterceptorBinding(org.apache.openejb.jee.InterceptorBinding) EnterpriseBean(org.apache.openejb.jee.EnterpriseBean) StatefulBean(org.apache.openejb.jee.StatefulBean) EjbModule(org.apache.openejb.config.EjbModule) AssemblyDescriptor(org.apache.openejb.jee.AssemblyDescriptor) NamedMethod(org.apache.openejb.jee.NamedMethod) Interceptor(org.apache.openejb.jee.Interceptor) EjbJar(org.apache.openejb.jee.EjbJar)

Example 13 with AssemblyDescriptor$JAXB.readAssemblyDescriptor

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

the class StatefulSessionSynchronizationTest method test.

public void test() throws Exception {
    System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName());
    final Assembler assembler = new Assembler();
    final ConfigurationFactory config = new ConfigurationFactory();
    assembler.createProxyFactory(config.configureService(ProxyFactoryInfo.class));
    assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
    assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
    final EjbJar ejbJar = new EjbJar();
    final AssemblyDescriptor assemblyDescriptor = ejbJar.getAssemblyDescriptor();
    final Interceptor interceptor = new Interceptor(SimpleInterceptor.class);
    ejbJar.addInterceptor(interceptor);
    // Test SessionSynchronization interface
    final StatefulBean subBeanA = new StatefulBean(SubBeanA.class);
    ejbJar.addEnterpriseBean(subBeanA);
    assemblyDescriptor.addInterceptorBinding(new InterceptorBinding(subBeanA, interceptor));
    // Test configure session synchronization callback methods in deployment plan
    final StatefulBean subBeanB = new StatefulBean(SubBeanB.class);
    subBeanB.setAfterBeginMethod(new NamedMethod(SubBeanB.class.getDeclaredMethod("afterBegin")));
    subBeanB.setBeforeCompletionMethod(new NamedMethod(SubBeanB.class.getDeclaredMethod("beforeCompletion")));
    subBeanB.setAfterCompletionMethod(new NamedMethod(SubBeanB.class.getDeclaredMethod("afterCompletion", boolean.class)));
    ejbJar.addEnterpriseBean(subBeanB);
    assemblyDescriptor.addInterceptorBinding(new InterceptorBinding(subBeanB, interceptor));
    // Test session synchronization methods via annotations
    final StatefulBean subBeanC = new StatefulBean(SubBeanC.class);
    ejbJar.addEnterpriseBean(subBeanC);
    assemblyDescriptor.addInterceptorBinding(new InterceptorBinding(subBeanC, interceptor));
    // Test override the annotations by deployment plan
    final StatefulBean subBeanD = new StatefulBean(SubBeanD.class);
    subBeanD.setAfterBeginMethod(new NamedMethod(SubBeanD.class.getDeclaredMethod("afterBeginNew")));
    subBeanD.setBeforeCompletionMethod(new NamedMethod(SubBeanD.class.getDeclaredMethod("beforeCompletionNew")));
    subBeanD.setAfterCompletionMethod(new NamedMethod(SubBeanD.class.getDeclaredMethod("afterCompletionNew", boolean.class)));
    ejbJar.addEnterpriseBean(subBeanD);
    assemblyDescriptor.addInterceptorBinding(new InterceptorBinding(subBeanD, interceptor));
    // Test only one session synchronization method @AfterBegin
    final StatefulBean subBeanE = new StatefulBean(SubBeanE.class);
    ejbJar.addEnterpriseBean(subBeanE);
    assemblyDescriptor.addInterceptorBinding(new InterceptorBinding(subBeanE, interceptor));
    // Test only one session synchronization method @AfterCompletion
    final StatefulBean subBeanF = new StatefulBean(SubBeanF.class);
    ejbJar.addEnterpriseBean(subBeanF);
    assemblyDescriptor.addInterceptorBinding(new InterceptorBinding(subBeanF, interceptor));
    // Test only one session synchronization method @BeforeCompletion
    final StatefulBean subBeanG = new StatefulBean(SubBeanG.class);
    ejbJar.addEnterpriseBean(subBeanG);
    assemblyDescriptor.addInterceptorBinding(new InterceptorBinding(subBeanG, interceptor));
    // Test SessionSynchronization interface but methods are in the parent class
    // Interceptor is declared on the bean method
    final StatefulBean subBeanH = new StatefulBean(SubBeanH.class);
    ejbJar.addEnterpriseBean(subBeanH);
    // Test SessionSynchronization interface but methods are in the parent class
    // using @LocalBean
    final StatefulBean subBeanI = new StatefulBean(SubBeanI.class);
    ejbJar.addEnterpriseBean(subBeanI);
    final EjbJarInfo ejbJarInfo = config.configureApplication(ejbJar);
    assembler.createApplication(ejbJarInfo);
    final InitialContext context = new InitialContext();
    final List<Call> expectedResult = Arrays.asList(Call.INTERCEPTOR_AFTER_BEGIN, Call.BEAN_AFTER_BEGIN, Call.INTERCEPTOR_AROUND_INVOKE_BEGIN, Call.BEAN_AROUND_INVOKE_BEGIN, Call.BEAN_METHOD, Call.BEAN_AROUND_INVOKE_AFTER, Call.INTERCEPTOR_AROUND_INVOKE_AFTER, Call.INTERCEPTOR_BEFORE_COMPLETION, Call.BEAN_BEFORE_COMPLETION, Call.INTERCEPTOR_AFTER_COMPLETION, Call.BEAN_AFTER_COMPLETION);
    {
        final BeanInterface beanA = (BeanInterface) context.lookup("SubBeanALocal");
        beanA.simpleMethod();
        assertEquals(expectedResult, result);
        result.clear();
    }
    {
        final BeanInterface beanB = (BeanInterface) context.lookup("SubBeanBLocal");
        beanB.simpleMethod();
        assertEquals(expectedResult, result);
        result.clear();
    }
    {
        final BeanInterface beanC = (BeanInterface) context.lookup("SubBeanCLocal");
        beanC.simpleMethod();
        assertEquals(expectedResult, result);
        result.clear();
    }
    {
        final BeanInterface beanD = (BeanInterface) context.lookup("SubBeanDLocal");
        beanD.simpleMethod();
        assertEquals(expectedResult, result);
        result.clear();
    }
    {
        final BeanInterface beanE = (BeanInterface) context.lookup("SubBeanELocal");
        beanE.simpleMethod();
        assertEquals(Arrays.asList(Call.INTERCEPTOR_AFTER_BEGIN, Call.BEAN_AFTER_BEGIN, Call.INTERCEPTOR_AROUND_INVOKE_BEGIN, Call.BEAN_AROUND_INVOKE_BEGIN, Call.BEAN_METHOD, Call.BEAN_AROUND_INVOKE_AFTER, Call.INTERCEPTOR_AROUND_INVOKE_AFTER, Call.INTERCEPTOR_BEFORE_COMPLETION, Call.INTERCEPTOR_AFTER_COMPLETION), result);
        result.clear();
    }
    {
        final BeanInterface beanF = (BeanInterface) context.lookup("SubBeanFLocal");
        beanF.simpleMethod();
        assertEquals(Arrays.asList(Call.INTERCEPTOR_AFTER_BEGIN, Call.INTERCEPTOR_AROUND_INVOKE_BEGIN, Call.BEAN_AROUND_INVOKE_BEGIN, Call.BEAN_METHOD, Call.BEAN_AROUND_INVOKE_AFTER, Call.INTERCEPTOR_AROUND_INVOKE_AFTER, Call.INTERCEPTOR_BEFORE_COMPLETION, Call.INTERCEPTOR_AFTER_COMPLETION, Call.BEAN_AFTER_COMPLETION), result);
        result.clear();
    }
    {
        final BeanInterface beanG = (BeanInterface) context.lookup("SubBeanGLocal");
        beanG.simpleMethod();
        assertEquals(Arrays.asList(Call.INTERCEPTOR_AFTER_BEGIN, Call.INTERCEPTOR_AROUND_INVOKE_BEGIN, Call.BEAN_AROUND_INVOKE_BEGIN, Call.BEAN_METHOD, Call.BEAN_AROUND_INVOKE_AFTER, Call.INTERCEPTOR_AROUND_INVOKE_AFTER, Call.INTERCEPTOR_BEFORE_COMPLETION, Call.BEAN_BEFORE_COMPLETION, Call.INTERCEPTOR_AFTER_COMPLETION), result);
        result.clear();
    }
    final List<Call> synchAndArroundInvokeResult = Arrays.asList(Call.BEAN_AFTER_BEGIN, Call.INTERCEPTOR_AROUND_INVOKE_BEGIN, Call.BEAN_AROUND_INVOKE_BEGIN, Call.BEAN_METHOD, Call.BEAN_AROUND_INVOKE_AFTER, Call.INTERCEPTOR_AROUND_INVOKE_AFTER, Call.BEAN_BEFORE_COMPLETION, Call.BEAN_AFTER_COMPLETION);
    {
        final BeanInterface beanH = (BeanInterface) context.lookup("SubBeanHLocal");
        beanH.simpleMethod();
        assertEquals(synchAndArroundInvokeResult, result);
        result.clear();
    }
    {
        final BeanInterface beanI = (BeanInterface) context.lookup("SubBeanILocalBean");
        beanI.simpleMethod();
        assertEquals(synchAndArroundInvokeResult, result);
        result.clear();
    }
}
Also used : StatefulBean(org.apache.openejb.jee.StatefulBean) LocalInitialContextFactory(org.apache.openejb.core.LocalInitialContextFactory) NamedMethod(org.apache.openejb.jee.NamedMethod) InitialContext(javax.naming.InitialContext) ProxyFactoryInfo(org.apache.openejb.assembler.classic.ProxyFactoryInfo) InterceptorBinding(org.apache.openejb.jee.InterceptorBinding) TransactionServiceInfo(org.apache.openejb.assembler.classic.TransactionServiceInfo) ConfigurationFactory(org.apache.openejb.config.ConfigurationFactory) Assembler(org.apache.openejb.assembler.classic.Assembler) AssemblyDescriptor(org.apache.openejb.jee.AssemblyDescriptor) SecurityServiceInfo(org.apache.openejb.assembler.classic.SecurityServiceInfo) Interceptor(org.apache.openejb.jee.Interceptor) EjbJarInfo(org.apache.openejb.assembler.classic.EjbJarInfo) EjbJar(org.apache.openejb.jee.EjbJar)

Example 14 with AssemblyDescriptor$JAXB.readAssemblyDescriptor

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

the class StatelessInterceptorTest method buildTestApp.

public static EjbModule buildTestApp() throws Exception {
    final EjbJar ejbJar = new EjbJar();
    ejbJar.setId(StatelessInterceptorTest.class.getName());
    final AssemblyDescriptor ad = ejbJar.getAssemblyDescriptor();
    ejbJar.addEnterpriseBean(new StatelessBean(Target2Bean.class));
    final EnterpriseBean bean = ejbJar.addEnterpriseBean(new StatelessBean(TargetBean.class));
    Interceptor interceptor;
    interceptor = ejbJar.addInterceptor(new Interceptor(DefaultInterceptor.class));
    ad.addInterceptorBinding(new InterceptorBinding("*", interceptor));
    {
        interceptor = ejbJar.addInterceptor(new Interceptor(EchoMethodInterceptorViaDD.class));
        final InterceptorBinding binding = ad.addInterceptorBinding(new InterceptorBinding(bean, interceptor));
        binding.setMethod(new NamedMethod(TargetBean.class.getMethod("echo", List.class)));
    }
    {
        interceptor = ejbJar.addInterceptor(new Interceptor(EchoMethodInterceptorViaDD.class));
        final InterceptorBinding binding = ad.addInterceptorBinding(new InterceptorBinding(bean, interceptor));
        binding.setMethod(new NamedMethod(TargetBean.class.getMethod("echo", int.class)));
    }
    {
        interceptor = ejbJar.addInterceptor(new Interceptor(EchoMethodInterceptorViaDD.class));
        final InterceptorBinding binding = ad.addInterceptorBinding(new InterceptorBinding(bean, interceptor));
        binding.setMethod(new NamedMethod(TargetBean.class.getMethod("echo", boolean.class)));
    }
    final EnterpriseBean bean3 = ejbJar.addEnterpriseBean(new StatelessBean(Target3Bean.class));
    final InterceptorBinding binding = ad.addInterceptorBinding(new InterceptorBinding(bean3));
    binding.setExcludeDefaultInterceptors(true);
    binding.setExcludeClassInterceptors(true);
    return new EjbModule(ejbJar);
}
Also used : EnterpriseBean(org.apache.openejb.jee.EnterpriseBean) EjbModule(org.apache.openejb.config.EjbModule) NamedMethod(org.apache.openejb.jee.NamedMethod) InterceptorBinding(org.apache.openejb.jee.InterceptorBinding) StatelessBean(org.apache.openejb.jee.StatelessBean) ArrayList(java.util.ArrayList) List(java.util.List) AssemblyDescriptor(org.apache.openejb.jee.AssemblyDescriptor) Interceptor(org.apache.openejb.jee.Interceptor) EjbJar(org.apache.openejb.jee.EjbJar)

Example 15 with AssemblyDescriptor$JAXB.readAssemblyDescriptor

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

the class TimeoutAroundTest method _testTimeoutAround.

public void _testTimeoutAround() throws Exception {
    System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName());
    final Assembler assembler = new Assembler();
    final ConfigurationFactory config = new ConfigurationFactory();
    assembler.createProxyFactory(config.configureService(ProxyFactoryInfo.class));
    assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
    assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
    final EjbJar ejbJar = new EjbJar();
    final AssemblyDescriptor assemblyDescriptor = ejbJar.getAssemblyDescriptor();
    // Configure AroundTimeout by deployment plan
    final Interceptor interceptorA = new Interceptor(SimpleInterceptorA.class);
    interceptorA.getAroundTimeout().add(new org.apache.openejb.jee.AroundTimeout(SimpleInterceptorA.class.getName(), "interceptorTimeoutAround"));
    ejbJar.addInterceptor(interceptorA);
    // Configure AroundTimeout by annotation
    final Interceptor interceptorB = new Interceptor(SimpleInterceptorB.class);
    ejbJar.addInterceptor(interceptorB);
    // Override AroundTimeout annotation by deployment plan
    final Interceptor interceptorC = new Interceptor(SimpleInterceptorC.class);
    interceptorC.getAroundTimeout().add(new org.apache.openejb.jee.AroundTimeout(SimpleInterceptorC.class.getName(), "interceptorTimeoutAround"));
    ejbJar.addInterceptor(interceptorC);
    // Configure aroundTimeout by deployment plan
    final StatelessBean subBeanA = new StatelessBean(SubBeanA.class);
    subBeanA.addAroundTimeout("beanTimeoutAround");
    ejbJar.addEnterpriseBean(subBeanA);
    assemblyDescriptor.addInterceptorBinding(new InterceptorBinding(subBeanA, interceptorA));
    assemblyDescriptor.addInterceptorBinding(new InterceptorBinding(subBeanA, interceptorB));
    assemblyDescriptor.addInterceptorBinding(new InterceptorBinding(subBeanA, interceptorC));
    // Configure aroundTimeout by annotation
    final StatelessBean subBeanB = new StatelessBean(SubBeanB.class);
    ejbJar.addEnterpriseBean(subBeanB);
    assemblyDescriptor.addInterceptorBinding(new InterceptorBinding(subBeanB, interceptorA));
    assemblyDescriptor.addInterceptorBinding(new InterceptorBinding(subBeanB, interceptorB));
    assemblyDescriptor.addInterceptorBinding(new InterceptorBinding(subBeanB, interceptorC));
    // Override aroundTimeout annotation by deployment plan
    final StatelessBean subBeanC = new StatelessBean(SubBeanC.class);
    subBeanC.addAroundTimeout("beanTimeoutAround");
    ejbJar.addEnterpriseBean(subBeanC);
    assemblyDescriptor.addInterceptorBinding(new InterceptorBinding(subBeanC, interceptorA));
    assemblyDescriptor.addInterceptorBinding(new InterceptorBinding(subBeanC, interceptorB));
    assemblyDescriptor.addInterceptorBinding(new InterceptorBinding(subBeanC, interceptorC));
    final EjbJarInfo ejbJarInfo = config.configureApplication(ejbJar);
    assembler.createApplication(ejbJarInfo);
    final InitialContext context = new InitialContext();
    final List<Call> expectedResult = Arrays.asList(Call.INTERCEPTOR_BEFORE_AROUNDTIMEOUT, Call.INTERCEPTOR_BEFORE_AROUNDTIMEOUT, Call.INTERCEPTOR_BEFORE_AROUNDTIMEOUT, Call.BEAN_BEFORE_AROUNDTIMEOUT, Call.BEAN_TIMEOUT, Call.BEAN_AFTER_AROUNDTIMEOUT, Call.INTERCEPTOR_AFTER_AROUNDTIMEOUT, Call.INTERCEPTOR_AFTER_AROUNDTIMEOUT, Call.INTERCEPTOR_AFTER_AROUNDTIMEOUT);
    {
        final BeanInterface beanA = (BeanInterface) context.lookup("SubBeanALocal");
        beanA.simpleMethod();
        Thread.sleep(5000L);
        assertEquals(expectedResult, result);
        result.clear();
    }
    {
        final BeanInterface beanB = (BeanInterface) context.lookup("SubBeanBLocal");
        beanB.simpleMethod();
        Thread.sleep(5000L);
        assertEquals(expectedResult, result);
        result.clear();
    }
    {
        final BeanInterface beanC = (BeanInterface) context.lookup("SubBeanCLocal");
        beanC.simpleMethod();
        Thread.sleep(5000L);
        assertEquals(expectedResult, result);
        result.clear();
    }
}
Also used : LocalInitialContextFactory(org.apache.openejb.core.LocalInitialContextFactory) InitialContext(javax.naming.InitialContext) ProxyFactoryInfo(org.apache.openejb.assembler.classic.ProxyFactoryInfo) InterceptorBinding(org.apache.openejb.jee.InterceptorBinding) TransactionServiceInfo(org.apache.openejb.assembler.classic.TransactionServiceInfo) StatelessBean(org.apache.openejb.jee.StatelessBean) ConfigurationFactory(org.apache.openejb.config.ConfigurationFactory) Assembler(org.apache.openejb.assembler.classic.Assembler) AssemblyDescriptor(org.apache.openejb.jee.AssemblyDescriptor) SecurityServiceInfo(org.apache.openejb.assembler.classic.SecurityServiceInfo) Interceptor(org.apache.openejb.jee.Interceptor) EjbJarInfo(org.apache.openejb.assembler.classic.EjbJarInfo) EjbJar(org.apache.openejb.jee.EjbJar)

Aggregations

AssemblyDescriptor (org.apache.openejb.jee.AssemblyDescriptor)15 InterceptorBinding (org.apache.openejb.jee.InterceptorBinding)12 EjbJar (org.apache.openejb.jee.EjbJar)11 Interceptor (org.apache.openejb.jee.Interceptor)11 StatelessBean (org.apache.openejb.jee.StatelessBean)7 EnterpriseBean (org.apache.openejb.jee.EnterpriseBean)6 NamedMethod (org.apache.openejb.jee.NamedMethod)4 ArrayList (java.util.ArrayList)3 Assembler (org.apache.openejb.assembler.classic.Assembler)3 SecurityServiceInfo (org.apache.openejb.assembler.classic.SecurityServiceInfo)3 TransactionServiceInfo (org.apache.openejb.assembler.classic.TransactionServiceInfo)3 ConfigurationFactory (org.apache.openejb.config.ConfigurationFactory)3 EjbModule (org.apache.openejb.config.EjbModule)3 ContainerTransaction (org.apache.openejb.jee.ContainerTransaction)3 Method (org.apache.openejb.jee.Method)3 MethodPermission (org.apache.openejb.jee.MethodPermission)3 StatefulBean (org.apache.openejb.jee.StatefulBean)3 EjbDeployment (org.apache.openejb.jee.oejb3.EjbDeployment)3 OpenejbJar (org.apache.openejb.jee.oejb3.OpenejbJar)3 Module (org.apache.openejb.testing.Module)3