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
  • Loading branch information
Fabio Burzigotti committed May 11, 2020
1 parent fc58b95 commit 2a9f6ef
Show file tree
Hide file tree
Showing 39 changed files with 294 additions and 13 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
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 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,16 +20,20 @@
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
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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,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.EJBCDIValidationApplication;
import org.jboss.resteasy.test.cdi.ejb.resource.EJBCDIValidationSingletonResource;
import org.jboss.resteasy.test.cdi.ejb.resource.EJBCDIValidationStatefulResource;
Expand All @@ -27,6 +28,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 Down Expand Up @@ -74,6 +76,7 @@ public static void close() {
* @tpSince RESTEasy 4.0.0
*/
@Test
@Category({ExpectedFailingWithStandaloneMicroprofileConfiguration.class})
public void testStateless() {
// Expect property, parameter violations.
WebTarget base = client.target(generateURL("/rest/stateless/"));
Expand Down Expand Up @@ -134,6 +137,7 @@ public void testStateful() {
* @tpSince RESTEasy 4.0.0
*/
@Test
@Category({ExpectedFailingWithStandaloneMicroprofileConfiguration.class})
public void testSingleton() {
doTestSingleton(1); // Expect property violation when EJB resource gets created.
doTestSingleton(0); // EJB resource has been created: expect no property violation.
Expand Down

0 comments on commit 2a9f6ef

Please sign in to comment.