I guys,
I'm using TomEE 1.6.0 (jax-rs) with a custom Application :
@ApplicationPath("/rest")
public class Whatever extends Application {...}
I do it in order to customize the base path for my REST services and to add a custom provider for every endpoints of this Application :
<?xml version="1.0" encoding="UTF-8"?>
<openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1">
<pojo-deployment class-name="Whatever">
<properties>
cxf.jaxrs.providers = WhateverProvider
</properties>
</pojo-deployment>
</openejb-jar>
I have a sample JAX-RS endpoint defined like this :
@Path("/whatever")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public class WhateverEndpoint {...}
Everything works fine when deploying in TomEE jax-rs (tomee-maven-plugin:start).
I can call my services on /rest/whatever
The problem is when I want to unit test this service with TomEE Embedded, WhateverEndpoint is not deployed...
The configuration I use for the tests setup (@BeforeClass) is the following :
Properties properties = new Properties();
properties.setProperty(OpenEjbContainer.OPENEJB_EMBEDDED_REMOTABLE, "true");
context = EJBContainer.createEJBContainer(properties).getContext();
I can test the DAO and so on but not the Endpoints...
When I add a @javax.ejb.* annotation like this :
@Singleton
@Path("/whatever")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public class WhateverEndpoint {...}
I have something better in the logs :
INFO - Initializing network services
INFO - REST Application: http://127.0.0.1:4204/web -> org.apache.openejb.server.rest.InternalApplication
INFO - Service URI: http://127.0.0.1:4204/web/whatever -> EJB Whatever
INFO - GET http://127.0.0.1:4204/web/whatever/a -> A a(HttpServletRequest)
INFO - ** Bound Services **
INFO - NAME IP PORT
INFO - httpejbd 127.0.0.1 4204
INFO - admin 127.0.0.1 4200
INFO - ejbd 127.0.0.1 4201
INFO - ejbds 127.0.0.1 4203
What should I do to make it works properly with my custom JAX-RS Application, Path and Provider, just like the TomEE JAX-RS do and without adding ejb annotations ? Should I define additional properties and which one when creating my EJBContainer ? I've see some in the sample applications :
But none of them are working.
Here is my pom.xml :
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0-5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>tomee-embedded</artifactId>
<version>${tomee.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>openejb-cxf-rs</artifactId>
<version>${openejb.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>tomee-jaxrs</artifactId>
<version>${tomee.version}</version>
<scope>test</scope>
</dependency>