Search in sources :

Example 71 with EjbJar$JAXB

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

the class CheckInvalidCallbacksTest method test2.

@Keys(@Key(value = "callback.sessionbean.invalidusage", count = 6))
public EjbJar test2() {
    System.setProperty("openejb.validation.output.level", "VERBOSE");
    final EjbJar ejbJar = new EjbJar();
    final StatelessBean sun = ejbJar.addEnterpriseBean(new StatelessBean("SunStateless", Sun.class));
    sun.setLocalHome(SunLocalHome.class.getName());
    sun.setLocal(SunLocal.class.getName());
    final StatefulBean meteor = ejbJar.addEnterpriseBean(new StatefulBean("MeteorStateful", Meteor.class));
    meteor.setLocal(SunLocal.class.getName());
    meteor.setLocalHome(SunLocalHome.class.getName());
    return ejbJar;
}
Also used : StatelessBean(org.apache.openejb.jee.StatelessBean) StatefulBean(org.apache.openejb.jee.StatefulBean) EjbJar(org.apache.openejb.jee.EjbJar)

Example 72 with EjbJar$JAXB

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

the class CheckInvalidCallbacksTest method test3.

@Keys(@Key(value = "callback.invocationcontext.notallowed", count = 4))
public EjbJar test3() {
    final EjbJar ejbJar = new EjbJar();
    ejbJar.addEnterpriseBean(new StatefulBean(CallbackViolatorBean.class));
    return ejbJar;
}
Also used : StatefulBean(org.apache.openejb.jee.StatefulBean) EjbJar(org.apache.openejb.jee.EjbJar)

Example 73 with EjbJar$JAXB

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

the class CheckInvalidInterceptorTest method test.

@Keys({ @Key(value = "interceptor.callback.badReturnType", count = 2), @Key(value = "interceptor.callback.invalidArguments", count = 2), @Key(value = "aroundInvoke.badReturnType", count = 2), @Key(value = "aroundInvoke.invalidArguments", count = 2), @Key("interceptor.callback.missing"), @Key("aroundInvoke.missing"), @Key("interceptorBinding.noSuchEjbName"), @Key("interceptorBinding.ejbNameRequiredWithMethod"), @Key("interceptor.callback.missing.possibleTypo") })
public EjbJar test() throws Exception {
    final EjbJar ejbJar = new EjbJar();
    ejbJar.addEnterpriseBean(new StatelessBean(FooBean.class));
    final Interceptor interceptor = ejbJar.addInterceptor(new org.apache.openejb.jee.Interceptor(CallbackMissingInterceptor.class));
    interceptor.addAroundInvoke("wrongMethod");
    interceptor.addPostConstruct("foo");
    interceptor.addPostConstruct("wrongMethod");
    final List<InterceptorBinding> interceptorBindings = ejbJar.getAssemblyDescriptor().getInterceptorBinding();
    final InterceptorBinding binding = new InterceptorBinding("wrongEjbName");
    // binding.setMethod(new NamedMethod("wrongMethod"));
    interceptorBindings.add(binding);
    final InterceptorBinding binding1 = new InterceptorBinding();
    binding1.setMethod(new NamedMethod("aMethod"));
    interceptorBindings.add(binding1);
    return ejbJar;
}
Also used : InterceptorBinding(org.apache.openejb.jee.InterceptorBinding) StatelessBean(org.apache.openejb.jee.StatelessBean) Interceptor(org.apache.openejb.jee.Interceptor) NamedMethod(org.apache.openejb.jee.NamedMethod) Interceptor(org.apache.openejb.jee.Interceptor) EjbJar(org.apache.openejb.jee.EjbJar)

Example 74 with EjbJar$JAXB

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

the class CheckInvalidInterceptorTest method testDeclaringInterceptorClass.

/**
 * Should not get any failure message, as we explicitly configure the methods in the base class
 *
 * @return
 */
@Keys
public EjbJar testDeclaringInterceptorClass() {
    final EjbJar ejbJar = new EjbJar();
    final Interceptor subInterceptor = ejbJar.addInterceptor(new org.apache.openejb.jee.Interceptor(SubInterceptor.class));
    subInterceptor.getPostConstruct().add(new LifecycleCallback(BaseInterceptor.class.getName(), "interceptPostConstruct"));
    subInterceptor.getPreDestroy().add(new LifecycleCallback(BaseInterceptor.class.getName(), "interceptPreDestroy"));
    subInterceptor.getAroundInvoke().add(new org.apache.openejb.jee.AroundInvoke(BaseInterceptor.class.getName(), "interceptAroundInvoke"));
    subInterceptor.getAroundTimeout().add(new org.apache.openejb.jee.AroundTimeout(BaseInterceptor.class.getName(), "interceptAroundTimeout"));
    return ejbJar;
}
Also used : Interceptor(org.apache.openejb.jee.Interceptor) LifecycleCallback(org.apache.openejb.jee.LifecycleCallback) Interceptor(org.apache.openejb.jee.Interceptor) EjbJar(org.apache.openejb.jee.EjbJar)

Example 75 with EjbJar$JAXB

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

the class CheckInvalidInterceptorTest method test1.

@Keys({ @Key(value = "interceptor.unused", count = 2, type = KeyType.WARNING), @Key("aroundInvoke.invalidArguments") })
public EjbJar test1() {
    final EjbJar ejbJar = new EjbJar();
    ejbJar.addEnterpriseBean(new StatelessBean(BarBean.class));
    final Interceptor unused = ejbJar.addInterceptor(new org.apache.openejb.jee.Interceptor(UnusedInterceptor.class));
    final Interceptor unused1 = ejbJar.addInterceptor(new org.apache.openejb.jee.Interceptor(UnusedInterceptor1.class));
    final Interceptor used = ejbJar.addInterceptor(new org.apache.openejb.jee.Interceptor(UsedInterceptor.class));
    final List<InterceptorBinding> interceptorBindings = ejbJar.getAssemblyDescriptor().getInterceptorBinding();
    final InterceptorBinding binding = new InterceptorBinding("BarBean", used);
    interceptorBindings.add(binding);
    return ejbJar;
}
Also used : InterceptorBinding(org.apache.openejb.jee.InterceptorBinding) StatelessBean(org.apache.openejb.jee.StatelessBean) Interceptor(org.apache.openejb.jee.Interceptor) Interceptor(org.apache.openejb.jee.Interceptor) 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