Search in sources :

Example 6 with PojoDeployment

use of org.apache.openejb.jee.oejb3.PojoDeployment in project tomee by apache.

the class AdvancedProviderConfigTest method service.

@Module
public static EjbModule service() throws Exception {
    final EjbModule module = new EjbModule(new EjbJar(), new OpenejbJar());
    final EnterpriseBean bean = new SingletonBean(AdvancedBean.class).localBean();
    module.getEjbJar().addEnterpriseBean(bean);
    final Resources resources = new Resources();
    final Service feature = new Service("xml", null);
    feature.setClassName(JAXBElementProvider.class.getName());
    feature.getProperties().put("eventHandler", "$handler");
    resources.getService().add(feature);
    final Service handler = new Service("handler", null);
    handler.setClassName(MyValidator.class.getName());
    resources.getService().add(handler);
    module.initResources(resources);
    final PojoDeployment e = new PojoDeployment();
    e.setClassName("jaxrs-application");
    e.getProperties().setProperty("cxf.jaxrs.providers", "xml");
    module.getOpenejbJar().getPojoDeployment().add(e);
    return module;
}
Also used : JAXBElementProvider(org.apache.cxf.jaxrs.provider.JAXBElementProvider) SingletonBean(org.apache.openejb.jee.SingletonBean) OpenejbJar(org.apache.openejb.jee.oejb3.OpenejbJar) EnterpriseBean(org.apache.openejb.jee.EnterpriseBean) EjbModule(org.apache.openejb.config.EjbModule) Service(org.apache.openejb.config.sys.Service) PojoDeployment(org.apache.openejb.jee.oejb3.PojoDeployment) Resources(org.apache.openejb.config.sys.Resources) EjbJar(org.apache.openejb.jee.EjbJar) EjbModule(org.apache.openejb.config.EjbModule) Module(org.apache.openejb.testing.Module)

Example 7 with PojoDeployment

use of org.apache.openejb.jee.oejb3.PojoDeployment in project tomee by apache.

the class CustomContextTest method service.

@Module
public static EjbModule service() throws Exception {
    final EjbModule module = new EjbModule(new EjbJar(), new OpenejbJar());
    final SingletonBean bean = new SingletonBean(CustomContextInjectedBean.class);
    bean.setLocalBean(new Empty());
    module.getEjbJar().addEnterpriseBean(bean);
    final PojoDeployment e = new PojoDeployment();
    e.setClassName("jaxrs-application");
    e.getProperties().setProperty("cxf.jaxrs.providers", CustomProvider.class.getName());
    module.getOpenejbJar().getPojoDeployment().add(e);
    return module;
}
Also used : SingletonBean(org.apache.openejb.jee.SingletonBean) Empty(org.apache.openejb.jee.Empty) OpenejbJar(org.apache.openejb.jee.oejb3.OpenejbJar) EjbModule(org.apache.openejb.config.EjbModule) PojoDeployment(org.apache.openejb.jee.oejb3.PojoDeployment) EjbJar(org.apache.openejb.jee.EjbJar) EjbModule(org.apache.openejb.config.EjbModule) Module(org.apache.openejb.testing.Module)

Example 8 with PojoDeployment

use of org.apache.openejb.jee.oejb3.PojoDeployment in project tomee by apache.

the class FeatureTest method app.

@Module
public EjbModule app() {
    final StatelessBean bean = (StatelessBean) new StatelessBean(MySecondRestClass.class).localBean();
    bean.setRestService(true);
    final EjbJar ejbJar = new EjbJar();
    ejbJar.addEnterpriseBean(bean);
    final OpenejbJar openejbJar = new OpenejbJar();
    final PojoDeployment e = new PojoDeployment();
    openejbJar.getPojoDeployment().add(e);
    e.setClassName("jaxrs-application");
    final Properties properties = e.getProperties();
    properties.setProperty(CxfRsHttpListener.CXF_JAXRS_PREFIX + CxfUtil.FEATURES, "my-feature");
    final EjbModule module = new EjbModule(ejbJar);
    module.setOpenejbJar(openejbJar);
    final Resources resources = new Resources();
    final Service feature = new Service("my-feature", null);
    feature.setClassName(MyFeature.class.getName());
    resources.getService().add(feature);
    module.initResources(resources);
    return module;
}
Also used : OpenejbJar(org.apache.openejb.jee.oejb3.OpenejbJar) StatelessBean(org.apache.openejb.jee.StatelessBean) EjbModule(org.apache.openejb.config.EjbModule) Service(org.apache.openejb.config.sys.Service) PojoDeployment(org.apache.openejb.jee.oejb3.PojoDeployment) Resources(org.apache.openejb.config.sys.Resources) Properties(java.util.Properties) EjbJar(org.apache.openejb.jee.EjbJar) EjbModule(org.apache.openejb.config.EjbModule) Module(org.apache.openejb.testing.Module)

Aggregations

PojoDeployment (org.apache.openejb.jee.oejb3.PojoDeployment)8 EjbModule (org.apache.openejb.config.EjbModule)7 OpenejbJar (org.apache.openejb.jee.oejb3.OpenejbJar)7 EjbJar (org.apache.openejb.jee.EjbJar)6 Service (org.apache.openejb.config.sys.Service)5 Module (org.apache.openejb.testing.Module)5 Resources (org.apache.openejb.config.sys.Resources)4 EnterpriseBean (org.apache.openejb.jee.EnterpriseBean)4 SingletonBean (org.apache.openejb.jee.SingletonBean)4 File (java.io.File)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 JAXBElementProvider (org.apache.cxf.jaxrs.provider.JAXBElementProvider)2 WebModule (org.apache.openejb.config.WebModule)2 URL (java.net.URL)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 LinkedList (java.util.LinkedList)1 Properties (java.util.Properties)1