From 040cd8871915d3936f94eb767fa7d0fb93a303d0 Mon Sep 17 00:00:00 2001 From: Juan Gonzalez Date: Wed, 5 Dec 2018 12:49:04 +0100 Subject: [PATCH] Upgrade Wildfly Swarm to Thorntail --- README.md | 8 +-- .../src/main/resources/project-defaults.yml | 8 +++ .../asynchronous/AsyncClassBeanTest.java | 3 +- .../asynchronous/AsyncMethodBeanTest.java | 3 +- .../src/main/resources/project-defaults.yml | 12 ++++ .../AsynchronousBulkheadBeanTest.java | 11 ++- .../ClassLevelCircuitBreakerBeanTest.java | 2 +- .../MethodLevelCircuitBreakerBeanTest.java | 2 +- .../src/main/resources/project-defaults.yml | 8 +++ .../timeout/AsynchronousTimeoutBeanTest.java | 8 ++- .../src/main/resources/META-INF/MP-JWT-SIGNER | 9 --- .../src/main/resources/project-defaults.yml | 8 ++- .../jwtauth/jaxrs/JaxRsTest.java | 7 +- pom.xml | 71 +++---------------- ...ian-swarm.xml => arquillian-thorntail.xml} | 4 +- 15 files changed, 73 insertions(+), 91 deletions(-) create mode 100644 fault-tolerance/asynchronous/src/main/resources/project-defaults.yml create mode 100644 fault-tolerance/bulkhead/src/main/resources/project-defaults.yml create mode 100644 fault-tolerance/timeout/src/main/resources/project-defaults.yml delete mode 100644 jwt-auth/jaxrs/src/main/resources/META-INF/MP-JWT-SIGNER rename test-utils/src/main/resources/{arquillian-swarm.xml => arquillian-thorntail.xml} (82%) diff --git a/README.md b/README.md index a945023..534a0c1 100644 --- a/README.md +++ b/README.md @@ -38,12 +38,12 @@ These are the available container profiles: This profile uses the special "wlp-microProfile1" distribution of Liberty, which contains the MicroProfile APIs out of the box and start up the server per sample. Useful for CI servers. The Liberty version that's used can be set via the ``liberty.version`` property. - * WildFly - * ``wildfly-ci-managed`` + * Thorntail + * ``thorntail`` - This profile is based on WildFly Swarm, and includes the MicroProfile 1.2 fragment. The actual WildFly Swarm code and thus + This profile is based on Thorntail, and includes the MicroProfile 1.2 fragment. The actual Thorntail code and thus the WildFly code is handled internally by the Arquillian connector. - Useful for CI servers. The WildFly Swarm version that's used can be set via the ``wildfly.version`` property. + Useful for CI servers. The Thorntail version that's used can be set via the ``thorntail.version`` property. The containers that download and install a server (the \*-ci-managed profiles) allow you to override the version used, e.g.: diff --git a/fault-tolerance/asynchronous/src/main/resources/project-defaults.yml b/fault-tolerance/asynchronous/src/main/resources/project-defaults.yml new file mode 100644 index 0000000..df70653 --- /dev/null +++ b/fault-tolerance/asynchronous/src/main/resources/project-defaults.yml @@ -0,0 +1,8 @@ +swarm: + hystrix: + command: + default: + execution: + isolation: + thread: + timeoutInMilliseconds: 3500 #MORE THAN MyAsyncBean*Level.AWAIT CONFIGURED IN TESTS diff --git a/fault-tolerance/asynchronous/src/test/java/org/eclipse/microprofile12/faulttolerance/asynchronous/AsyncClassBeanTest.java b/fault-tolerance/asynchronous/src/test/java/org/eclipse/microprofile12/faulttolerance/asynchronous/AsyncClassBeanTest.java index 48554d4..960542c 100644 --- a/fault-tolerance/asynchronous/src/test/java/org/eclipse/microprofile12/faulttolerance/asynchronous/AsyncClassBeanTest.java +++ b/fault-tolerance/asynchronous/src/test/java/org/eclipse/microprofile12/faulttolerance/asynchronous/AsyncClassBeanTest.java @@ -36,7 +36,8 @@ public static WebArchive createDeployment() { return create(WebArchive.class) .addAsLibraries(awaitability()) .addClasses(MyAsyncBeanClassLevel.class) - .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); + .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") + .addAsResource("project-defaults.yml"); } @Test diff --git a/fault-tolerance/asynchronous/src/test/java/org/eclipse/microprofile12/faulttolerance/asynchronous/AsyncMethodBeanTest.java b/fault-tolerance/asynchronous/src/test/java/org/eclipse/microprofile12/faulttolerance/asynchronous/AsyncMethodBeanTest.java index 58f66ec..70be318 100644 --- a/fault-tolerance/asynchronous/src/test/java/org/eclipse/microprofile12/faulttolerance/asynchronous/AsyncMethodBeanTest.java +++ b/fault-tolerance/asynchronous/src/test/java/org/eclipse/microprofile12/faulttolerance/asynchronous/AsyncMethodBeanTest.java @@ -36,7 +36,8 @@ public static WebArchive createDeployment() { return create(WebArchive.class) .addAsLibraries(awaitability()) .addClasses(MyAsyncBeanMethodLevel.class) - .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); + .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") + .addAsResource("project-defaults.yml"); } @Test // Runs on Server diff --git a/fault-tolerance/bulkhead/src/main/resources/project-defaults.yml b/fault-tolerance/bulkhead/src/main/resources/project-defaults.yml new file mode 100644 index 0000000..0e3f4ee --- /dev/null +++ b/fault-tolerance/bulkhead/src/main/resources/project-defaults.yml @@ -0,0 +1,12 @@ +swarm: + hystrix: + threadpool: + default: + maximumSize: 10 #SHOULD BE >= AsynchronousBulkheadBean @Bulkead value + @Bulkhead waitingTaskQueue + allowMaximumSizeToDivergeFromCoreSize: true + command: + default: + execution: + isolation: + thread: + timeoutInMilliseconds: 21500 #MORE THAN (AsynchronousBulkheadBean @Bulkead value + @Bulkhead waitingTaskQueue -1) * AsynchronousBulkheadBean.AWAIT diff --git a/fault-tolerance/bulkhead/src/test/java/org/eclipse/microprofile12/faulttolerance/bulkhead/AsynchronousBulkheadBeanTest.java b/fault-tolerance/bulkhead/src/test/java/org/eclipse/microprofile12/faulttolerance/bulkhead/AsynchronousBulkheadBeanTest.java index 7e5d954..5ca4739 100644 --- a/fault-tolerance/bulkhead/src/test/java/org/eclipse/microprofile12/faulttolerance/bulkhead/AsynchronousBulkheadBeanTest.java +++ b/fault-tolerance/bulkhead/src/test/java/org/eclipse/microprofile12/faulttolerance/bulkhead/AsynchronousBulkheadBeanTest.java @@ -33,7 +33,8 @@ public class AsynchronousBulkheadBeanTest { public static WebArchive createDeployment() { return ShrinkWrap.create(WebArchive.class) .addClasses(AsynchronousBulkheadBean.class) - .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); + .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") + .addAsResource("project-defaults.yml"); } /** @@ -104,8 +105,12 @@ public void bulkheadLimitTest() throws NoSuchMethodException { Logger.getLogger(AsynchronousBulkheadBeanTest.class.getName()).log(Level.SEVERE, null, ie); Assert.fail("Got an unexpected InterruptedException"); } catch (ExecutionException ex) { - Logger.getLogger(AsynchronousBulkheadBeanTest.class.getName()).log(Level.SEVERE, null, ex); - Assert.fail("Got an unexpected ExecutionException"); + if (ex.getCause() instanceof BulkheadException) { + failures ++; + } else { + Logger.getLogger(AsynchronousBulkheadBeanTest.class.getName()).log(Level.SEVERE, null, ex); + Assert.fail("Got an unexpected ExecutionException"); + } } catch (BulkheadException be) { failures ++; } diff --git a/fault-tolerance/circuitbreaker/src/test/java/org/eclipse/microprofile12/faulttolerance/circuitbreaker/ClassLevelCircuitBreakerBeanTest.java b/fault-tolerance/circuitbreaker/src/test/java/org/eclipse/microprofile12/faulttolerance/circuitbreaker/ClassLevelCircuitBreakerBeanTest.java index c82571d..7036cea 100644 --- a/fault-tolerance/circuitbreaker/src/test/java/org/eclipse/microprofile12/faulttolerance/circuitbreaker/ClassLevelCircuitBreakerBeanTest.java +++ b/fault-tolerance/circuitbreaker/src/test/java/org/eclipse/microprofile12/faulttolerance/circuitbreaker/ClassLevelCircuitBreakerBeanTest.java @@ -116,7 +116,7 @@ private List> executeThrowExceptionMethodAsynchronously(int itera boolean shouldThrowException) { List> futures = new ArrayList<>(); - ExecutorService executorService = Executors.newFixedThreadPool(iterations); + ExecutorService executorService = Executors.newSingleThreadExecutor(); Callable task = () -> { classLevelCircuitBreakerBean.throwException(shouldThrowException); diff --git a/fault-tolerance/circuitbreaker/src/test/java/org/eclipse/microprofile12/faulttolerance/circuitbreaker/MethodLevelCircuitBreakerBeanTest.java b/fault-tolerance/circuitbreaker/src/test/java/org/eclipse/microprofile12/faulttolerance/circuitbreaker/MethodLevelCircuitBreakerBeanTest.java index acf4979..d754da5 100644 --- a/fault-tolerance/circuitbreaker/src/test/java/org/eclipse/microprofile12/faulttolerance/circuitbreaker/MethodLevelCircuitBreakerBeanTest.java +++ b/fault-tolerance/circuitbreaker/src/test/java/org/eclipse/microprofile12/faulttolerance/circuitbreaker/MethodLevelCircuitBreakerBeanTest.java @@ -141,7 +141,7 @@ private List> executeThrowExceptionMethodAsynchronously(int itera boolean shouldThrowException) { List> futures = new ArrayList<>(); - ExecutorService executorService = Executors.newFixedThreadPool(iterations); + ExecutorService executorService = Executors.newSingleThreadExecutor(); Callable task = () -> { methodLevelCircuitBreakerBean.throwException(shouldThrowException); diff --git a/fault-tolerance/timeout/src/main/resources/project-defaults.yml b/fault-tolerance/timeout/src/main/resources/project-defaults.yml new file mode 100644 index 0000000..3dc9e9e --- /dev/null +++ b/fault-tolerance/timeout/src/main/resources/project-defaults.yml @@ -0,0 +1,8 @@ +swarm: + hystrix: + command: + default: + execution: + isolation: + thread: + timeoutInMilliseconds: 3500 #MORE THAN AsynchronousTimeoutBean.AWAIT CONFIGURED IN TESTS diff --git a/fault-tolerance/timeout/src/test/java/org/eclipse/microprofile/samples12/timeout/AsynchronousTimeoutBeanTest.java b/fault-tolerance/timeout/src/test/java/org/eclipse/microprofile/samples12/timeout/AsynchronousTimeoutBeanTest.java index bf14b2c..5e00615 100644 --- a/fault-tolerance/timeout/src/test/java/org/eclipse/microprofile/samples12/timeout/AsynchronousTimeoutBeanTest.java +++ b/fault-tolerance/timeout/src/test/java/org/eclipse/microprofile/samples12/timeout/AsynchronousTimeoutBeanTest.java @@ -3,6 +3,7 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import javax.inject.Inject; + import org.eclipse.microprofile.faulttolerance.exceptions.TimeoutException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; @@ -27,7 +28,8 @@ public class AsynchronousTimeoutBeanTest { public static WebArchive createDeployment() { return ShrinkWrap.create(WebArchive.class) .addClasses(AsynchronousTimeoutBean.class) - .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); + .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") + .addAsResource("project-defaults.yml"); } /** @@ -43,6 +45,10 @@ public void timeoutTest() throws InterruptedException, ExecutionException { future.get(); } catch (TimeoutException toe) { return; + } catch (ExecutionException ex) { + if (ex.getCause() instanceof TimeoutException) { + return; + } } Assert.fail(); diff --git a/jwt-auth/jaxrs/src/main/resources/META-INF/MP-JWT-SIGNER b/jwt-auth/jaxrs/src/main/resources/META-INF/MP-JWT-SIGNER deleted file mode 100644 index a1dc20c..0000000 --- a/jwt-auth/jaxrs/src/main/resources/META-INF/MP-JWT-SIGNER +++ /dev/null @@ -1,9 +0,0 @@ ------BEGIN RSA PUBLIC KEY----- -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlivFI8qB4D0y2jy0CfEq -Fyy46R0o7S8TKpsx5xbHKoU1VWg6QkQm+ntyIv1p4kE1sPEQO73+HY8+Bzs75XwR -TYL1BmR1w8J5hmjVWjc6R2BTBGAYRPFRhor3kpM6ni2SPmNNhurEAHw7TaqszP5e -UF/F9+KEBWkwVta+PZ37bwqSE4sCb1soZFrVz/UT/LF4tYpuVYt3YbqToZ3pZOZ9 -AX2o1GCG3xwOjkc4x0W7ezbQZdC9iftPxVHR8irOijJRRjcPDtA6vPKpzLl6CyYn -sIYPd99ltwxTHjr3npfv/3Lw50bAkbT4HeLFxTx4flEoZLKO/g0bAoV2uqBhkA9x -nQIDAQAB ------END RSA PUBLIC KEY----- diff --git a/jwt-auth/jaxrs/src/main/resources/project-defaults.yml b/jwt-auth/jaxrs/src/main/resources/project-defaults.yml index 3d1f591..7976526 100644 --- a/jwt-auth/jaxrs/src/main/resources/project-defaults.yml +++ b/jwt-auth/jaxrs/src/main/resources/project-defaults.yml @@ -4,9 +4,11 @@ swarm: bind: address: localhost microprofile: - jwtauth: + jwt: + default-missing-method-permissions-deny-access: false token: - issuedBy: "org.eclipse.microprofile12" + issued-by: "org.eclipse.microprofile12" + signer-pub-key: classpath:publicKey.pem logging: loggers: io.undertow.request.security: @@ -30,4 +32,4 @@ swarm: code: org.wildfly.extension.undertow.security.jaspi.modules.HTTPSchemeServerAuthModule module: org.wildfly.extension.undertow flag: required - login-module-stack-ref: roles-lm-stack \ No newline at end of file + login-module-stack-ref: roles-lm-stack diff --git a/jwt-auth/jaxrs/src/test/java/org/eclipse/microprofile12/jwtauth/jaxrs/JaxRsTest.java b/jwt-auth/jaxrs/src/test/java/org/eclipse/microprofile12/jwtauth/jaxrs/JaxRsTest.java index 5e9ac60..0df7581 100644 --- a/jwt-auth/jaxrs/src/test/java/org/eclipse/microprofile12/jwtauth/jaxrs/JaxRsTest.java +++ b/jwt-auth/jaxrs/src/test/java/org/eclipse/microprofile12/jwtauth/jaxrs/JaxRsTest.java @@ -44,15 +44,12 @@ public static WebArchive createDeployment() { // Payara Properties file configuring that "org.eclipse.microprofile12" is the valid issuer "payara-mp-jwt.properties" ).addAsResource( - // WildFly file configuring that "org.eclipse.microprofile12" is the valid issuer and setting up + // Thorntail file configuring that "org.eclipse.microprofile12" is the valid issuer and setting up // the security system (domain) such that all artifacts to support MP-Auth JWT are installed "project-defaults.yml" ).addAsResource( - // Payara public key to verify the incoming signed JWT's signature + // Payara/Thorntail public key to verify the incoming signed JWT's signature "publicKey.pem" - ).addAsResource( - // WildFly public key to verify the incoming signed JWT's signature - "META-INF/MP-JWT-SIGNER" ).addAsResource( // WildFly public key to verify the incoming signed JWT's signature "jwt-roles.properties" diff --git a/pom.xml b/pom.xml index 939556d..c8c8f65 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ 5.182-SNAPSHOT 5.182-SNAPSHOT 17.0.0.4 - 2018.4.1 + 2.3.0.Final 1.0.Beta3 5.Beta3-m3 @@ -627,85 +627,38 @@ - + - wildfly-ci-managed + thorntail - - org.jboss.arquillian - arquillian-bom - 1.2.1.Final + io.thorntail + bom + ${thorntail.version} import pom - - org.jboss.arquillian.container - arquillian-container-test-api - 1.2.1.Final - - - - io.undertow - undertow-websockets-jsr - 2.0.4.Final - test - - - - - org.jboss.resteasy - resteasy-client - 3.0.19.Final - test - - - - - org.jboss.logging - jboss-logging - 3.3.2.Final - test - - - org.jboss.resteasy - resteasy-jaxb-provider - 3.0.19.Final - test - - - org.jboss.resteasy - resteasy-json-p-provider - 3.0.19.Final - test - - org.wildfly.swarm + io.thorntail arquillian - ${wildfly.version} test - - org.wildfly.swarm + io.thorntail microprofile - ${wildfly.version} + @@ -713,8 +666,8 @@ - - arquillian-swarm.xml + + arquillian-thorntail.xml @@ -722,8 +675,6 @@ - - nothing diff --git a/test-utils/src/main/resources/arquillian-swarm.xml b/test-utils/src/main/resources/arquillian-thorntail.xml similarity index 82% rename from test-utils/src/main/resources/arquillian-swarm.xml rename to test-utils/src/main/resources/arquillian-thorntail.xml index 97bc9c8..a55b0b3 100644 --- a/test-utils/src/main/resources/arquillian-swarm.xml +++ b/test-utils/src/main/resources/arquillian-thorntail.xml @@ -8,10 +8,10 @@ - but arquillian.xml sets the default protocol to "Servlet 3.0" and there's no way to override that - (see https://issues.jboss.org/browse/ARQ-579) --> - + localhost - ${swarm.arquillian.daemon.port:12345} + ${thorntail.arquillian.daemon.port:12345}