From 1752ac8e63f2243cc4ccedba9641efaa6d985ce9 Mon Sep 17 00:00:00 2001 From: Tomas Kyjovsky Date: Sun, 7 Feb 2016 21:30:54 +0100 Subject: [PATCH] Refactoring of auth-server-* and auth server migration Maven profiles --- .../MigrationTestExecutionDecider.java | 14 +- .../base/src/test/resources/arquillian.xml | 20 +- .../integration-arquillian/tests/pom.xml | 277 +++++++++++------- 3 files changed, 194 insertions(+), 117 deletions(-) diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/migration/MigrationTestExecutionDecider.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/migration/MigrationTestExecutionDecider.java index b0dfe21a9f..333c5ddef9 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/migration/MigrationTestExecutionDecider.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/migration/MigrationTestExecutionDecider.java @@ -22,21 +22,23 @@ import org.jboss.arquillian.test.spi.execution.TestExecutionDecider; /** * @author Vlastislav Ramik + * @author tkyjovsk (refactoring) */ public class MigrationTestExecutionDecider implements TestExecutionDecider { + public static final String MIGRATED_AUTH_SERVER_VERSION_PROPERTY = "migrated.auth.server.version"; + @Override public ExecutionDecision decide(Method method) { - - boolean migrationTest = "true".equals(System.getProperty("migration", "false")); + + String migratedAuthServerVersion = System.getProperty(MIGRATED_AUTH_SERVER_VERSION_PROPERTY); + boolean migrationTest = migratedAuthServerVersion != null; Migration migrationAnnotation = method.getAnnotation(Migration.class); - + if (migrationTest && migrationAnnotation != null) { String versionFrom = migrationAnnotation.versionFrom(); - String version = System.getProperty("version"); - - if (version.equals(versionFrom)) { + if (migratedAuthServerVersion.equals(versionFrom)) { return ExecutionDecision.execute(); } else { return ExecutionDecision.dontExecute(method.getName() + "doesn't fit with migration version."); diff --git a/testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml b/testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml index 555f3ce35a..6c13daa20b 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml +++ b/testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml @@ -110,9 +110,9 @@ - + - ${migration.kc16} + ${auth.server.wildfly.kc16} org.jboss.as.arquillian.container.managed.ManagedDeployableContainer ${keycloak.migration.home} @@ -129,9 +129,9 @@ - + - ${migration.kc15} + ${auth.server.wildfly.kc15} org.jboss.as.arquillian.container.managed.ManagedDeployableContainer ${keycloak.migration.home} @@ -148,9 +148,9 @@ - + - ${migration.kc14} + ${auth.server.wildfly.kc14} org.jboss.as.arquillian.container.managed.ManagedDeployableContainer ${keycloak.migration.home} -Djboss.socket.binding.port-offset=${auth.server.port.offset} -Xms64m -Xmx512m -XX:MaxPermSize=256m @@ -159,9 +159,9 @@ - + - ${migration.kc13} + ${auth.server.wildfly.kc13} org.jboss.as.arquillian.container.managed.ManagedDeployableContainer ${keycloak.migration.home} -Djboss.socket.binding.port-offset=${auth.server.port.offset} -Xms64m -Xmx512m -XX:MaxPermSize=256m @@ -170,9 +170,9 @@ - + - ${migration.kc12} + ${auth.server.wildfly.kc12} org.jboss.as.arquillian.container.managed.ManagedDeployableContainer ${keycloak.migration.home} -Djboss.socket.binding.port-offset=${auth.server.port.offset} -Xms64m -Xmx512m -XX:MaxPermSize=256m diff --git a/testsuite/integration-arquillian/tests/pom.xml b/testsuite/integration-arquillian/tests/pom.xml index 92c02bd178..06511a2905 100644 --- a/testsuite/integration-arquillian/tests/pom.xml +++ b/testsuite/integration-arquillian/tests/pom.xml @@ -1,20 +1,20 @@ +~ Copyright 2016 Red Hat, Inc. and/or its affiliates +~ and other contributors as indicated by the @author tags. +~ +~ Licensed under the Apache License, Version 2.0 (the "License"); +~ you may not use this file except in compliance with the License. +~ You may obtain a copy of the License at +~ +~ http://www.apache.org/licenses/LICENSE-2.0 +~ +~ Unless required by applicable law or agreed to in writing, software +~ distributed under the License is distributed on an "AS IS" BASIS, +~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +~ See the License for the specific language governing permissions and +~ limitations under the License. +--> @@ -65,9 +65,6 @@ 8.2.0.Final 2.1.1 - true - true - true @@ -122,7 +119,6 @@ ${auth.server.ssl.required} ${startup.timeout.sec} ${jboss.server.config.dir} - ${skip.install.adapters} @@ -133,52 +129,6 @@ false - - org.apache.maven.plugins - maven-dependency-plugin - - - unpack-migrated-server - generate-test-resources - - unpack - - - ${skip.unpack.migrated.server} - - - org.keycloak.testsuite - ${migrated.server.artifactId} - ${project.version} - zip - - - ${containers.home} - true - - - - unpack-server - generate-test-resources - - unpack - - - ${skip.unpack.server} - - - org.keycloak.testsuite - ${server.artifactId} - ${project.version} - zip - - - ${containers.home} - true - - - - org.apache.maven.plugins maven-resources-plugin @@ -443,8 +393,6 @@ auth-server-wildfly - false - integration-arquillian-server-wildfly auth-server-wildfly 300 @@ -472,6 +420,31 @@ + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack-auth-server-wildfly + generate-test-resources + + unpack + + + + + org.keycloak.testsuite + integration-arquillian-server-wildfly + ${project.version} + zip + + + ${containers.home} + true + + + + @@ -480,8 +453,6 @@ auth-server-eap7 - false - integration-arquillian-server-eap7 auth-server-eap7 300 @@ -528,6 +499,31 @@ + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack-auth-server-eap + generate-test-resources + + unpack + + + + + org.keycloak.testsuite + integration-arquillian-server-eap7 + ${project.version} + zip + + + ${containers.home} + true + + + + @@ -535,12 +531,82 @@ + + migration + + + migrated.auth.server.version + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + enforce-properties + + enforce + + + + + migrated.auth.server.version + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack-migrated-auth-server-wildfly + generate-test-resources + + unpack + + + + + org.keycloak.testsuite + ${migrated.auth.server.artifactId} + ${project.version} + zip + + + ${containers.home} + true + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + ${migrated.auth.server.version} + + + + + + + migration-kc16 + + + migrated.auth.server.version + 1.6.1.Final + + - false - 1.6.1.Final - integration-arquillian-server-wildfly-kc16 + integration-arquillian-server-wildfly-kc16 @@ -550,11 +616,9 @@ maven-surefire-plugin - true - true - ${containers.home}/keycloak-${server.version} + true + ${containers.home}/keycloak-${migrated.auth.server.version} src/test/resources/migration-test/migration-realm-16.json - ${server.version} @@ -565,10 +629,14 @@ migration-kc15 + + + migrated.auth.server.version + 1.5.1.Final + + - false - 1.5.1.Final - integration-arquillian-server-wildfly-kc15 + integration-arquillian-server-wildfly-kc15 @@ -578,11 +646,9 @@ maven-surefire-plugin - true - true - ${containers.home}/keycloak-${server.version} + true + ${containers.home}/keycloak-${migrated.auth.server.version} src/test/resources/migration-test/migration-realm-15.json - ${server.version} @@ -593,10 +659,14 @@ migration-kc14 + + + migrated.auth.server.version + 1.4.0.Final + + - false - 1.4.0.Final - integration-arquillian-server-wildfly-kc14 + integration-arquillian-server-wildfly-kc14 @@ -606,9 +676,8 @@ maven-surefire-plugin - true - true - ${containers.home}/keycloak-${server.version} + true + ${containers.home}/keycloak-${migrated.auth.server.version} @@ -619,10 +688,14 @@ migration-kc13 + + + migrated.auth.server.version + 1.3.1.Final + + - false - 1.3.1.Final - integration-arquillian-server-wildfly-kc13 + integration-arquillian-server-wildfly-kc13 @@ -632,9 +705,8 @@ maven-surefire-plugin - true - true - ${containers.home}/keycloak-${server.version} + true + ${containers.home}/keycloak-${migrated.auth.server.version} @@ -645,10 +717,14 @@ migration-kc12 + + + migrated.auth.server.version + 1.2.0.Final + + - false - 1.2.0.Final - integration-arquillian-server-wildfly-kc12 + integration-arquillian-server-wildfly-kc12 @@ -658,9 +734,8 @@ maven-surefire-plugin - true - true - ${containers.home}/keycloak-${server.version} + true + ${containers.home}/keycloak-${migrated.auth.server.version}