Skip to content

Commit

Permalink
Merge pull request #912 from asoldano/wildfly902-support
Browse files Browse the repository at this point in the history
Wildfly902 support
  • Loading branch information
asoldano committed Sep 1, 2016
2 parents 553ff1e + ad6c0ce commit e8ddb3e
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 5 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -7,6 +7,7 @@ language: java
jdk:
- oraclejdk8
env:
- SERVER_VERSION=9.0.2.Final
- SERVER_VERSION=10.1.0.Final
- SERVER_VERSION=10.0.0.Final
cache:
Expand Down
@@ -0,0 +1,7 @@
package org.jboss.resteasy.category;

/**
* Marker interface for tests which are expected to fail on WildFly 9.x series
*/
public interface NotForWildFly9 {
}
Expand Up @@ -248,6 +248,11 @@ public static boolean isOpenJDK() {
return System.getProperty("java.runtime.name").toLowerCase().contains("openjdk");
}

public static boolean isWildFly9x() {
final String sv = System.getProperty("server.version");
return ("9.0.2.Final".equals(sv) || "9.0.1.Final".equals(sv) || "9.0.0.Final".equals(sv));
}

public static boolean isOracleJDK() {
if (isOpenJDK()) {
return false;
Expand Down
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.NotForWildFly9;
import org.jboss.resteasy.test.spring.deployment.resource.ContextRefreshResource;
import org.jboss.resteasy.test.spring.deployment.resource.ContextRefreshTrigger;
import org.jboss.resteasy.utils.TestUtilSpring;
Expand All @@ -11,6 +12,7 @@
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.springframework.web.context.WebApplicationContext;
import java.util.Enumeration;
Expand All @@ -23,6 +25,7 @@
* @tpSince RESTEasy 3.0.16
*/
@RunWith(Arquillian.class)
@Category(NotForWildFly9.class) //requires WildFly 10+
public class ContextRefreshDependenciesInDeploymentTest {


Expand All @@ -34,6 +37,7 @@ private static Archive<?> deploy() {
.addClass(ContextRefreshResource.class)
.addClass(ContextRefreshTrigger.class)
.addClass(ContextRefreshDependenciesInDeploymentTest.class)
.addClass(NotForWildFly9.class) //required as this test is not @RunAsClient annotated
.addAsWebInfResource(ContextRefreshDependenciesInDeploymentTest.class.getPackage(), "web.xml", "web.xml")
.addAsWebInfResource(ContextRefreshDependenciesInDeploymentTest.class.getPackage(), "contextRefresh/applicationContext.xml", "applicationContext.xml");
TestUtilSpring.addSpringLibraries(archive);
Expand Down
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.NotForWildFly9;
import org.jboss.resteasy.test.spring.inmodule.resource.ContextRefreshResource;
import org.jboss.resteasy.test.spring.inmodule.resource.ContextRefreshTrigger;
import org.jboss.shrinkwrap.api.Archive;
Expand All @@ -11,6 +12,7 @@
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.springframework.web.context.WebApplicationContext;
import java.util.Enumeration;
Expand All @@ -23,6 +25,7 @@
* @tpSince RESTEasy 3.0.16
*/
@RunWith(Arquillian.class)
@Category(NotForWildFly9.class) //requires WildFly 10+
public class ContextRefreshTest {


Expand All @@ -34,6 +37,7 @@ private static Archive<?> deploy() {
.addClass(ContextRefreshResource.class)
.addClass(ContextRefreshTrigger.class)
.addClass(ContextRefreshTest.class)
.addClass(NotForWildFly9.class) //required as this test is not @RunAsClient annotated
.addAsWebInfResource(ContextRefreshTest.class.getPackage(), "web.xml", "web.xml")
.addAsWebInfResource(ContextRefreshTest.class.getPackage(), "contextRefresh/applicationContext.xml", "applicationContext.xml");
archive.addAsManifestResource(new StringAsset("Dependencies: org.springframework.spring meta-inf\n"), "MANIFEST.MF");
Expand Down
Expand Up @@ -16,8 +16,13 @@ public static void initQueue() throws Exception {
OnlineManagementClient client = TestUtil.clientInit();

// disable security and create queue
TestUtil.runCmd(client, "/subsystem=messaging-activemq/server=default:write-attribute(name=security-enabled,value=false)");
TestUtil.runCmd(client, "/subsystem=messaging-activemq/server=default/jms-queue=test:add(entries=[java:/jms/queue/test])");
if (TestUtil.isWildFly9x()) {
TestUtil.runCmd(client, "/subsystem=messaging/hornetq-server=default:write-attribute(name=security-enabled,value=false)");
TestUtil.runCmd(client, "/subsystem=messaging/hornetq-server=default/jms-queue=test:add(entries=[java:/jms/queue/test])");
} else {
TestUtil.runCmd(client, "/subsystem=messaging-activemq/server=default:write-attribute(name=security-enabled,value=false)");
TestUtil.runCmd(client, "/subsystem=messaging-activemq/server=default/jms-queue=test:add(entries=[java:/jms/queue/test])");
}

// reload server
Administration admin = new Administration(client, 240);
Expand All @@ -31,8 +36,13 @@ public static void destroyQueue() throws Exception {
OnlineManagementClient client = TestUtil.clientInit();

// remove queue and enable security
TestUtil.runCmd(client, "/subsystem=messaging-activemq/server=default:write-attribute(name=security-enabled,value=true)");
TestUtil.runCmd(client, "/subsystem=messaging-activemq/server=default/jms-queue=test:remove");
if (TestUtil.isWildFly9x()) {
TestUtil.runCmd(client, "/subsystem=messaging/hornetq-server=default:write-attribute(name=security-enabled,value=true)");
TestUtil.runCmd(client, "/subsystem=messaging/hornetq-server=default/jms-queue=test:remove");
} else {
TestUtil.runCmd(client, "/subsystem=messaging-activemq/server=default:write-attribute(name=security-enabled,value=true)");
TestUtil.runCmd(client, "/subsystem=messaging-activemq/server=default/jms-queue=test:remove");
}

// reload server
Administration admin = new Administration(client, 240);
Expand Down
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.NotForWildFly9;
import org.jboss.resteasy.test.cdi.injection.resource.CDIInjectionBook;
import org.jboss.resteasy.test.cdi.injection.resource.CDIInjectionBookBag;
import org.jboss.resteasy.test.cdi.injection.resource.CDIInjectionBookBagLocal;
Expand Down Expand Up @@ -56,6 +57,7 @@
*/
@RunWith(Arquillian.class)
@RunAsClient
@Category(NotForWildFly9.class) //fails on 9.x due to: [WFLY-3355] MDB fails to deploy on reload
public class MDBInjectionTest extends AbstractInjectionTestBase {
protected static final Logger log = LogManager.getLogger(MDBInjectionTest.class.getName());

Expand Down
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.NotForWildFly9;
import org.jboss.resteasy.test.cdi.injection.resource.CDIInjectionBook;
import org.jboss.resteasy.test.cdi.injection.resource.CDIInjectionBookBag;
import org.jboss.resteasy.test.cdi.injection.resource.CDIInjectionBookBagLocal;
Expand Down Expand Up @@ -46,6 +47,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.jms.Connection;
Expand Down Expand Up @@ -88,6 +90,7 @@
* @tpSince RESTEasy 3.0.16
*/
@RunWith(Arquillian.class)
@Category(NotForWildFly9.class) //fails on 9.x due to: [WFLY-3355] MDB fails to deploy on reload
public class ReverseInjectionTest extends AbstractInjectionTestBase {
private static Logger log = Logger.getLogger(ReverseInjectionTest.class);

Expand Down Expand Up @@ -140,6 +143,7 @@ public static Archive<?> createTestArchive() {
.addClasses(ReverseInjectionEJBHolderRemote.class, ReverseInjectionEJBHolderLocal.class, ReverseInjectionEJBHolder.class)
.addClasses(ReverseInjectionResource.class)
.addClasses(CDIInjectionNewBean.class, CDIInjectionStereotypedApplicationScope.class, CDIInjectionStereotypedDependentScope.class)
.addClass(NotForWildFly9.class) //required as this test is not @RunAsClient annotated
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsResource(ReverseInjectionTest.class.getPackage(), "persistence.xml", "META-INF/persistence.xml");
return war;
Expand Down
15 changes: 14 additions & 1 deletion testsuite/pom.xml
Expand Up @@ -22,6 +22,7 @@

<properties>
<version.resteasy.testsuite>${project.version}</version.resteasy.testsuite>
<additional.surefire.excluded.groups></additional.surefire.excluded.groups>
</properties>

<build>
Expand All @@ -37,7 +38,7 @@
<node>127.0.0.1</node>
<jboss.home>${jboss.home}</jboss.home>
</systemPropertyVariables>
<excludedGroups>org.jboss.resteasy.category.ExpectedFailing</excludedGroups>
<excludedGroups>org.jboss.resteasy.category.ExpectedFailing,${additional.surefire.excluded.groups}</excludedGroups>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -78,6 +79,18 @@
<server.version>10.0.0.Final</server.version>
</properties>
</profile>
<profile>
<id>server-version-9x-exclusions</id>
<activation>
<property>
<name>server.version</name>
<value>9.0.2.Final</value>
</property>
</activation>
<properties>
<additional.surefire.excluded.groups>org.jboss.resteasy.category.NotForWildFly9</additional.surefire.excluded.groups>
</properties>
</profile>
<!-- If resteasy.version is specified, it will be used for tests instead of the project.version -->
<profile>
<id>custom-resteasy-version</id>
Expand Down

0 comments on commit e8ddb3e

Please sign in to comment.