Skip to content

Commit

Permalink
[RESTEASY-2581] Introducing profile in order to run tests with standa…
Browse files Browse the repository at this point in the history
…lone-microprofile.xml config (#2399)

Co-authored-by: Fabio Burzigotti <fburzigo@redhat.com>
  • Loading branch information
fabiobrz and Fabio Burzigotti committed May 22, 2020
1 parent da45a6e commit 5bd2ac9
Show file tree
Hide file tree
Showing 40 changed files with 310 additions and 14 deletions.
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
install:
- mvn -B clean
script:
- travis_wait 60 mvn -B -Ptravis -fae -Dserver.version=$SERVER_VERSION ${ELYTRON:+-Delytron} install
- travis_wait 60 mvn -B -Ptravis -fae -Dserver.version=$SERVER_VERSION ${ELYTRON:+-Delytron} ${STANDALONE_MICROPROFILE:+-Dts.standalone.microprofile} install

language: java
jdk:
- openjdk8
- openjdk11
env:
- SERVER_VERSION=18.0.1.Final
- SERVER_VERSION=19.0.0.Beta2
- SERVER_VERSION=19.0.0.Beta2 ELYTRON=true
- SERVER_VERSION=19.0.0.Final
- SERVER_VERSION=19.0.0.Final ELYTRON=true
- SERVER_VERSION=19.0.0.Final STANDALONE_MICROPROFILE=true
jobs:
exclude:
- jdk: openjdk11
Expand Down
9 changes: 9 additions & 0 deletions testsuite/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ Run testsuite or test connecting to a running server:
Keep in mind that the remote server needs to be started with the option `-Dnode=127.0.0.1` or the binding IP in order for some tests to work properly.

### Use standalone-micoprofile.xml configuration
Starting with Wildfly 19.0.0.Final, a set of new files were added to the
distribution in order to start the server up with a MicroProfile-oriented
configuration.
Passing the `-Dts.standalone.microprofile` property to Maven will force
the usage of `standalone-microprofile.xml` configuration file:

> mvn clean verify -Dserver.home=PATH_TO_WIDLFLY_HOME -Dts.standalone.microprofile
### Test logs
Test logs are stored in ``/MODULE_NAME/target/surefire-reports/TEST_NAME-output.txt``

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.jboss.resteasy.category;

/**
* Marker interface for tests which are expected to fail because of SmallRye
* MicroProfile OpenAPI implementation issues, see:<br>
* - https://github.com/smallrye/smallrye-open-api/issues/290 <br>
* - https://github.com/smallrye/smallrye-open-api/issues/248 <br>
* and related fix:
* https://github.com/smallrye/smallrye-open-api/pull/251
* (there could be more issues/fixes about quite the same annotation scanning
* topics, though)
*/
public interface ExpectedFailingBecauseOfSmallRyeMicroprofileOpenApi11 {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.jboss.resteasy.category;

/**
* Marker interface for tests which are expected to fail when WildFly is using
* standalone-microprofile.xml configuration files.
*
*/
public interface ExpectedFailingWithStandaloneMicroprofileConfiguration {

}
22 changes: 22 additions & 0 deletions testsuite/integration-tests-spring/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,28 @@
</plugins>
</build>
</profile>
<!--
Test against MicroProfile config.
standalone-microprofile.xml is used to replace occurrences of
standalone-full.xml in Arquillian configuration (arquillian.xml)
-->
<profile>
<id>standalone.microprofile.profile</id>
<activation>
<property>
<name>ts.standalone.microprofile</name>
</property>
</activation>
<properties>
<jboss.server.config.file.name>standalone-microprofile.xml</jboss.server.config.file.name>
<!--
Excluding those tests that would need modules
which are in standalone-full.xml but not in
standalone-microprofile.xml
-->
<additional.surefire.excluded.groups>org.jboss.resteasy.category.ExpectedFailingWithStandaloneMicroprofileConfiguration</additional.surefire.excluded.groups>
</properties>
</profile>
</profiles>

<build>
Expand Down
22 changes: 22 additions & 0 deletions testsuite/integration-tests-spring/inmodule/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,28 @@
</plugins>
</build>
</profile>
<!--
Test against MicroProfile config.
standalone-microprofile.xml is used to replace occurrences of
standalone-full.xml in Arquillian configuration (arquillian.xml)
-->
<profile>
<id>standalone.microprofile.profile</id>
<activation>
<property>
<name>ts.standalone.microprofile</name>
</property>
</activation>
<properties>
<jboss.server.config.file.name>standalone-microprofile.xml</jboss.server.config.file.name>
<!--
Excluding those tests that would need modules
which are in standalone-full.xml but not in
standalone-microprofile.xml
-->
<additional.surefire.excluded.groups>org.jboss.resteasy.category.ExpectedFailingWithStandaloneMicroprofileConfiguration</additional.surefire.excluded.groups>
</properties>
</profile>
</profiles>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.as.arquillian.api.ServerSetup;
import org.jboss.resteasy.category.ExpectedFailingWithStandaloneMicroprofileConfiguration;
import org.jboss.resteasy.category.NotForForwardCompatibility;
import org.jboss.resteasy.client.jaxrs.ResteasyClient;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
Expand Down Expand Up @@ -168,6 +169,7 @@ public void testNotSupportedException() {
* @tpSince RESTEasy 3.1.0
*/
@Test
@Category(ExpectedFailingWithStandaloneMicroprofileConfiguration.class)
public void testNotAuthorizedException() {
Response response = nonAutorizedClient.target(generateURL("/secured/json")).request()
.post(Entity.entity("{\"name\":\"Zack\"}", MediaType.APPLICATION_JSON_TYPE));
Expand All @@ -180,15 +182,15 @@ public void testNotAuthorizedException() {
* @tpSince RESTEasy 3.1.0
*/
@Test
@Category(NotForForwardCompatibility.class)
@Category({NotForForwardCompatibility.class, ExpectedFailingWithStandaloneMicroprofileConfiguration.class})
public void testForbiddenException() {
Response response = userAuthorizedClient.target(generateURL("/secured/json")).request()
.post(Entity.entity("{\"name\":\"Zack\"}", MediaType.APPLICATION_JSON_TYPE));
Assert.assertEquals(HttpResponseCodes.SC_FORBIDDEN, response.getStatus());
}

@Test
@Category(NotForForwardCompatibility.class)
@Category({NotForForwardCompatibility.class, ExpectedFailingWithStandaloneMicroprofileConfiguration.class})
public void testOK() {
Response response = authorizedClient.target(generateURL("/secured/json")).request()
.post(Entity.entity("{\"name\":\"Zack\"}", MediaType.APPLICATION_JSON_TYPE));
Expand Down
22 changes: 22 additions & 0 deletions testsuite/integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,28 @@
</plugins>
</build>
</profile>
<!--
Test against MicroProfile config.
standalone-microprofile.xml is used to replace occurrences of
standalone-full.xml in Arquillian configuration (arquillian.xml)
-->
<profile>
<id>standalone.microprofile.profile</id>
<activation>
<property>
<name>ts.standalone.microprofile</name>
</property>
</activation>
<properties>
<jboss.server.config.file.name>standalone-microprofile.xml</jboss.server.config.file.name>
<!--
Excluding those tests that would need modules
which are in standalone-full.xml but not in
standalone-microprofile.xml
-->
<additional.surefire.excluded.groups>org.jboss.resteasy.category.ExpectedFailingWithStandaloneMicroprofileConfiguration,org.jboss.resteasy.category.ExpectedFailingBecauseOfSmallRyeMicroprofileOpenApi11</additional.surefire.excluded.groups>
</properties>
</profile>
</profiles>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.resteasy.category.ExpectedFailingWithStandaloneMicroprofileConfiguration;
import org.jboss.resteasy.test.cdi.basic.resource.AsynchronousResource;
import org.jboss.resteasy.test.cdi.basic.resource.AsynchronousStateless;
import org.jboss.resteasy.test.cdi.basic.resource.AsynchronousStatelessLocal;
Expand All @@ -15,6 +16,7 @@
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;

import javax.ws.rs.client.Client;
Expand Down Expand Up @@ -60,6 +62,9 @@ public static Archive<?> createTestArchive() {
* @tpSince RESTEasy 3.0.16
*/
@Test
@Category({
ExpectedFailingWithStandaloneMicroprofileConfiguration.class} // java.lang.NoClassDefFoundError: javax/ejb/AsyncResult (MP is missing EJB3)
)
public void testAsynchJaxRs() throws Exception {
Client client = ClientBuilder.newClient();
WebTarget base = client.target(generateURL("/asynch/simple"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.apache.logging.log4j.Logger;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.resteasy.category.ExpectedFailingWithStandaloneMicroprofileConfiguration;
import org.jboss.resteasy.test.ContainerConstants;
import org.jboss.resteasy.util.HttpResponseCodes;
import org.jboss.resteasy.utils.PermissionUtil;
Expand All @@ -21,6 +22,7 @@
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;

import java.io.BufferedReader;
Expand Down Expand Up @@ -48,6 +50,9 @@

@RunWith(Arquillian.class)
@RunAsClient
@Category({
ExpectedFailingWithStandaloneMicroprofileConfiguration.class // java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet (MP is missing JSF)
})
public class CDIResourceTest {

protected static final Logger logger = LogManager.getLogger(CDIResourceTest.class.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.logging.Logger;
import org.jboss.resteasy.category.ExpectedFailingWithStandaloneMicroprofileConfiguration;
import org.jboss.resteasy.test.cdi.basic.resource.EJBApplication;
import org.jboss.resteasy.test.cdi.basic.resource.EJBBook;
import org.jboss.resteasy.test.cdi.basic.resource.EJBBookReader;
Expand All @@ -26,6 +27,7 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;

import javax.inject.Inject;
Expand All @@ -52,6 +54,10 @@
* @tpSince RESTEasy 3.0.16
*/
@RunWith(Arquillian.class)

@Category({
ExpectedFailingWithStandaloneMicroprofileConfiguration.class // MP is missing EJB3
})
public class EJBTest {

private static Logger log = Logger.getLogger(EJBTest.class);
Expand All @@ -76,6 +82,7 @@ public static Archive<?> createTestArchive() {
.addClasses(EJBBookReader.class, EJBBookReaderImpl.class)
.addClasses(EJBBookWriterImpl.class)
.addClasses(EJBResourceParent.class, EJBLocalResource.class, EJBRemoteResource.class, EJBBookResource.class)
.addClass(ExpectedFailingWithStandaloneMicroprofileConfiguration.class)
.setWebXML(EJBTest.class.getPackage(), "ejbtest_web.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
// Arquillian in the deployment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.resteasy.category.ExpectedFailingWithStandaloneMicroprofileConfiguration;
import org.jboss.resteasy.test.cdi.basic.resource.EjbExceptionUnwrapFooException;
import org.jboss.resteasy.test.cdi.basic.resource.EjbExceptionUnwrapFooExceptionMapper;
import org.jboss.resteasy.test.cdi.basic.resource.EjbExceptionUnwrapFooResource;
Expand All @@ -20,6 +21,7 @@
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;

import javax.ws.rs.client.Client;
Expand Down Expand Up @@ -109,6 +111,9 @@ public void testNoDefaultsResource() throws Exception {
* @tpSince RESTEasy 3.0.16
*/
@Test
@Category({
ExpectedFailingWithStandaloneMicroprofileConfiguration.class // fails because /basic is not found (MP is missing EJB3)
})
public void testLocatingResource() throws Exception {
{
Response response = client.target(generateURL("/locating/basic")).request().get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.resteasy.category.ExpectedFailingWithStandaloneMicroprofileConfiguration;
import org.jboss.resteasy.test.cdi.basic.resource.OutOfBandResource;
import org.jboss.resteasy.test.cdi.basic.resource.OutOfBandResourceIntf;
import org.jboss.resteasy.util.HttpResponseCodes;
Expand All @@ -19,22 +20,27 @@
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;

/**
/**MDBInjectionTest.java
* @tpSubChapter CDI
* @tpChapter Integration tests
* @tpTestCaseDetails Regression test for RESTEASY-1049.
* @tpSince RESTEasy 3.0.16
*/
@RunWith(Arquillian.class)
@RunAsClient
@Category({
ExpectedFailingWithStandaloneMicroprofileConfiguration.class
})
public class OutOfBandTest {

@Deployment
public static Archive<?> createTestArchive() {
WebArchive war = TestUtil.prepareArchive("RESTEASY-1008")
.addClasses(OutOfBandResourceIntf.class, OutOfBandResource.class)
.addClass(ExpectedFailingWithStandaloneMicroprofileConfiguration.class)
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
return war;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.resteasy.category.ExpectedFailingWithStandaloneMicroprofileConfiguration;
import org.jboss.resteasy.test.cdi.basic.resource.SingletonLocalIF;
import org.jboss.resteasy.test.cdi.basic.resource.SingletonRootResource;
import org.jboss.resteasy.test.cdi.basic.resource.SingletonSubResource;
Expand All @@ -18,6 +19,7 @@
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;

import javax.ws.rs.client.Client;
Expand All @@ -33,6 +35,9 @@
*/
@RunWith(Arquillian.class)
@RunAsClient
@Category({
ExpectedFailingWithStandaloneMicroprofileConfiguration.class // java.lang.NoClassDefFoundError: javax/ejb/EJBException (MP is missing EJB3)
})
public class SingletonTest {
static Client client;
protected static final Logger logger = LogManager.getLogger(SingletonTest.class.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.resteasy.api.validation.ViolationReport;
import org.jboss.resteasy.category.ExpectedFailingWithStandaloneMicroprofileConfiguration;
import org.jboss.resteasy.test.cdi.ejb.resource.EJBCDIValidationEJBProxyGreeterResource;
import org.jboss.resteasy.test.cdi.ejb.resource.EJBCDIValidationEJBProxyGreeting;
import org.jboss.resteasy.utils.PermissionUtil;
Expand All @@ -24,6 +25,7 @@
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;

/**
Expand All @@ -34,6 +36,9 @@
*/
@RunWith(Arquillian.class)
@RunAsClient
@Category({
ExpectedFailingWithStandaloneMicroprofileConfiguration.class // MP is missing EJB3
})
public class EJBCDIValidationEJBProxyTest {

private static final String VALID_REQUEST = "{\n"
Expand All @@ -50,6 +55,7 @@ public class EJBCDIValidationEJBProxyTest {
public static Archive<?> createTestArchive() {
WebArchive war = TestUtil.prepareArchive(EJBCDIValidationEJBProxyTest.class.getSimpleName());
war.addClass(EJBCDIValidationEJBProxyGreeting.class);
war.addClass(ExpectedFailingWithStandaloneMicroprofileConfiguration.class);
war.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
war.setWebXML(EJBCDIValidationEJBProxyTest.class.getPackage(), "web.xml");
war.addAsManifestResource(PermissionUtil.createPermissionsXmlAsset(
Expand Down

0 comments on commit 5bd2ac9

Please sign in to comment.