Search in sources :

Example 1 with Classes

use of org.apache.openejb.testing.Classes in project tomee by apache.

the class ActiveMQResourceAdapterControlTest method app.

@Module
@Classes(value = Mdb.class)
public EjbModule app() {
    return new EjbModule(new EjbJar("test"), new OpenejbJar() {

        {
            setId("test");
            getEjbDeployment().add(new EjbDeployment() {

                {
                    setEjbName("ejb/Mdb");
                    getProperties().put("MdbActiveOnStartup", "false");
                    getProperties().put("MdbJMXControl", "default:type=test");
                }
            });
        }
    });
}
Also used : OpenejbJar(org.apache.openejb.jee.oejb3.OpenejbJar) EjbModule(org.apache.openejb.config.EjbModule) EjbDeployment(org.apache.openejb.jee.oejb3.EjbDeployment) EjbJar(org.apache.openejb.jee.EjbJar) EjbModule(org.apache.openejb.config.EjbModule) Module(org.apache.openejb.testing.Module) Classes(org.apache.openejb.testing.Classes)

Example 2 with Classes

use of org.apache.openejb.testing.Classes in project tomee by apache.

the class ApplicationComposerDeployer method deploy.

@Override
public AppModule deploy(final AppModule appModule) throws OpenEJBException {
    if (!appModule.isStandaloneModule()) {
        return appModule;
    }
    for (final EjbModule ejbModule : appModule.getEjbModules()) {
        if (ejbModule.getFinder() == null) {
            continue;
        }
        WebModule webModule = null;
        for (final WebModule web : appModule.getWebModules()) {
            if (!web.getModuleId().equals(ejbModule.getModuleId())) {
                continue;
            }
            webModule = web;
            break;
        }
        if (webModule == null) {
            continue;
        }
        for (final Class<?> clazz : ejbModule.getFinder().findAnnotatedClasses(ApplicationComposer.class)) {
            final ApplicationComposer applicationComposer = clazz.getAnnotation(ApplicationComposer.class);
            final Descriptor descriptor = clazz.getAnnotation(Descriptor.class);
            if (descriptor != null) {
                configureDescriptor(appModule, descriptor);
            }
            final Descriptors descriptors = clazz.getAnnotation(Descriptors.class);
            if (descriptors != null) {
                for (final Descriptor d : descriptors.value()) {
                    configureDescriptor(appModule, descriptor);
                }
            }
            final Classes classes = clazz.getAnnotation(Classes.class);
            if (classes != null) {
                configureClasses(webModule, ejbModule, applicationComposer, classes);
            }
            Object instance = null;
            final AnnotationFinder finder = new AnnotationFinder(new ClassesArchive(org.apache.openejb.util.Classes.ancestors(clazz)));
            for (final Method m : finder.findAnnotatedMethods(org.apache.openejb.testing.Module.class)) {
                instance = configureModule(appModule, ejbModule, clazz, instance, m);
            }
            for (final Method m : finder.findAnnotatedMethods(Configuration.class)) {
                instance = configureConfiguration(appModule, clazz, instance, m);
            }
            final JaxrsProviders jaxrsProviders = clazz.getAnnotation(JaxrsProviders.class);
            if (jaxrsProviders != null) {
                for (final Class<?> c : jaxrsProviders.value()) {
                    webModule.getJaxrsProviders().add(c.getName());
                }
            }
        }
    }
    return appModule;
}
Also used : Method(java.lang.reflect.Method) JaxrsProviders(org.apache.openejb.testing.JaxrsProviders) ApplicationComposer(org.apache.openejb.api.configuration.ApplicationComposer) ClassesArchive(org.apache.xbean.finder.archive.ClassesArchive) Descriptor(org.apache.openejb.testing.Descriptor) Descriptors(org.apache.openejb.testing.Descriptors) AnnotationFinder(org.apache.xbean.finder.AnnotationFinder) Classes(org.apache.openejb.testing.Classes)

Example 3 with Classes

use of org.apache.openejb.testing.Classes in project tomee by apache.

the class CdiDecoratorMultipleDelegateCallsTest method classes.

@Module
@Classes({ ServiceImpl.class })
public EjbModule classes() {
    final Beans beans = new Beans();
    beans.addDecorator(ServiceDecorator.class);
    final EjbModule jar = new EjbModule(new EjbJar());
    jar.setBeans(beans);
    return jar;
}
Also used : Beans(org.apache.openejb.jee.Beans) EjbModule(org.apache.openejb.config.EjbModule) EjbJar(org.apache.openejb.jee.EjbJar) EjbModule(org.apache.openejb.config.EjbModule) Module(org.apache.openejb.testing.Module) Classes(org.apache.openejb.testing.Classes)

Example 4 with Classes

use of org.apache.openejb.testing.Classes in project tomee by apache.

the class BasicInjectionTest method app.

@Module
@Classes(cdi = true, value = { Configuration.class })
public StatelessBean app() throws Exception {
    final StatelessBean bean = new StatelessBean(WidgetBean.class);
    bean.setLocalBean(new Empty());
    return bean;
}
Also used : Empty(org.apache.openejb.jee.Empty) StatelessBean(org.apache.openejb.jee.StatelessBean) Module(org.apache.openejb.testing.Module) Classes(org.apache.openejb.testing.Classes)

Example 5 with Classes

use of org.apache.openejb.testing.Classes in project tomee by apache.

the class ResourceAdapterDeliveryActiveTest method app.

@Module
@Classes(value = Mdb.class)
public EjbModule app() {
    return new EjbModule(new EjbJar("test") {

        {
            addEnterpriseBean(new MessageDrivenBean("ejb/Mdb", Mdb.class) {

                {
                    setActivationConfig(new ActivationConfig());
                    getActivationConfig().addProperty("DeliveryActive", "false");
                    getActivationConfig().addProperty("MdbJMXControl", "default:type=test");
                }
            });
        }
    });
}
Also used : MessageDrivenBean(org.apache.openejb.jee.MessageDrivenBean) EjbModule(org.apache.openejb.config.EjbModule) EjbJar(org.apache.openejb.jee.EjbJar) ActivationConfig(org.apache.openejb.jee.ActivationConfig) EjbModule(org.apache.openejb.config.EjbModule) Module(org.apache.openejb.testing.Module) Classes(org.apache.openejb.testing.Classes)

Aggregations

Classes (org.apache.openejb.testing.Classes)12 Module (org.apache.openejb.testing.Module)10 EjbModule (org.apache.openejb.config.EjbModule)5 EjbJar (org.apache.openejb.jee.EjbJar)5 WebApp (org.apache.openejb.jee.WebApp)3 Method (java.lang.reflect.Method)2 Properties (java.util.Properties)2 ActivationConfig (org.apache.openejb.jee.ActivationConfig)2 Empty (org.apache.openejb.jee.Empty)2 MessageDrivenBean (org.apache.openejb.jee.MessageDrivenBean)2 StatelessBean (org.apache.openejb.jee.StatelessBean)2 EjbDeployment (org.apache.openejb.jee.oejb3.EjbDeployment)2 OpenejbJar (org.apache.openejb.jee.oejb3.OpenejbJar)2 AnnotationFinder (org.apache.xbean.finder.AnnotationFinder)2 ClassesArchive (org.apache.xbean.finder.archive.ClassesArchive)2 Closeable (java.io.Closeable)1 File (java.io.File)1 IOException (java.io.IOException)1 Field (java.lang.reflect.Field)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1