Merge container-handling into cluster-testing

This commit is contained in:
Tomas Kyjovsky 2016-02-07 21:37:13 +01:00
commit 1c792ad769
4 changed files with 195 additions and 118 deletions

View file

@ -22,21 +22,23 @@ import org.jboss.arquillian.test.spi.execution.TestExecutionDecider;
/** /**
* @author <a href="mailto:vramik@redhat.com">Vlastislav Ramik</a> * @author <a href="mailto:vramik@redhat.com">Vlastislav Ramik</a>
* @author tkyjovsk (refactoring)
*/ */
public class MigrationTestExecutionDecider implements TestExecutionDecider { public class MigrationTestExecutionDecider implements TestExecutionDecider {
public static final String MIGRATED_AUTH_SERVER_VERSION_PROPERTY = "migrated.auth.server.version";
@Override @Override
public ExecutionDecision decide(Method method) { 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); Migration migrationAnnotation = method.getAnnotation(Migration.class);
if (migrationTest && migrationAnnotation != null) { if (migrationTest && migrationAnnotation != null) {
String versionFrom = migrationAnnotation.versionFrom(); String versionFrom = migrationAnnotation.versionFrom();
String version = System.getProperty("version");
if (version.equals(versionFrom)) { if (migratedAuthServerVersion.equals(versionFrom)) {
return ExecutionDecision.execute(); return ExecutionDecision.execute();
} else { } else {
return ExecutionDecision.dontExecute(method.getName() + "doesn't fit with migration version."); return ExecutionDecision.dontExecute(method.getName() + "doesn't fit with migration version.");

View file

@ -110,9 +110,9 @@
<!-- PREVIOUS VERSIONS OF KEYCLOAK FOR MIGRATION TESTS --> <!-- PREVIOUS VERSIONS OF KEYCLOAK FOR MIGRATION TESTS -->
<container qualifier="migrated-auth-server-wildfly_kc16" mode="manual" > <container qualifier="auth-server-wildfly-kc16" mode="manual" >
<configuration> <configuration>
<property name="enabled">${migration.kc16}</property> <property name="enabled">${auth.server.wildfly.kc16}</property>
<property name="adapterImplClass">org.jboss.as.arquillian.container.managed.ManagedDeployableContainer</property> <property name="adapterImplClass">org.jboss.as.arquillian.container.managed.ManagedDeployableContainer</property>
<property name="jbossHome">${keycloak.migration.home}</property> <property name="jbossHome">${keycloak.migration.home}</property>
<property name="javaVmArguments"> <property name="javaVmArguments">
@ -129,9 +129,9 @@
</configuration> </configuration>
</container> </container>
<container qualifier="migrated-auth-server-wildfly_kc15" mode="manual" > <container qualifier="auth-server-wildfly-kc15" mode="manual" >
<configuration> <configuration>
<property name="enabled">${migration.kc15}</property> <property name="enabled">${auth.server.wildfly.kc15}</property>
<property name="adapterImplClass">org.jboss.as.arquillian.container.managed.ManagedDeployableContainer</property> <property name="adapterImplClass">org.jboss.as.arquillian.container.managed.ManagedDeployableContainer</property>
<property name="jbossHome">${keycloak.migration.home}</property> <property name="jbossHome">${keycloak.migration.home}</property>
<property name="javaVmArguments"> <property name="javaVmArguments">
@ -148,9 +148,9 @@
</configuration> </configuration>
</container> </container>
<container qualifier="migrated-auth-server-wildfly_kc14" mode="manual" > <container qualifier="auth-server-wildfly-kc14" mode="manual" >
<configuration> <configuration>
<property name="enabled">${migration.kc14}</property> <property name="enabled">${auth.server.wildfly.kc14}</property>
<property name="adapterImplClass">org.jboss.as.arquillian.container.managed.ManagedDeployableContainer</property> <property name="adapterImplClass">org.jboss.as.arquillian.container.managed.ManagedDeployableContainer</property>
<property name="jbossHome">${keycloak.migration.home}</property> <property name="jbossHome">${keycloak.migration.home}</property>
<property name="javaVmArguments">-Djboss.socket.binding.port-offset=${auth.server.port.offset} -Xms64m -Xmx512m -XX:MaxPermSize=256m</property> <property name="javaVmArguments">-Djboss.socket.binding.port-offset=${auth.server.port.offset} -Xms64m -Xmx512m -XX:MaxPermSize=256m</property>
@ -159,9 +159,9 @@
</configuration> </configuration>
</container> </container>
<container qualifier="migrated-auth-server-wildfly_kc13" mode="manual" > <container qualifier="auth-server-wildfly-kc13" mode="manual" >
<configuration> <configuration>
<property name="enabled">${migration.kc13}</property> <property name="enabled">${auth.server.wildfly.kc13}</property>
<property name="adapterImplClass">org.jboss.as.arquillian.container.managed.ManagedDeployableContainer</property> <property name="adapterImplClass">org.jboss.as.arquillian.container.managed.ManagedDeployableContainer</property>
<property name="jbossHome">${keycloak.migration.home}</property> <property name="jbossHome">${keycloak.migration.home}</property>
<property name="javaVmArguments">-Djboss.socket.binding.port-offset=${auth.server.port.offset} -Xms64m -Xmx512m -XX:MaxPermSize=256m</property> <property name="javaVmArguments">-Djboss.socket.binding.port-offset=${auth.server.port.offset} -Xms64m -Xmx512m -XX:MaxPermSize=256m</property>
@ -170,9 +170,9 @@
</configuration> </configuration>
</container> </container>
<container qualifier="migrated-auth-server-wildfly_kc12" mode="manual" > <container qualifier="auth-server-wildfly-kc12" mode="manual" >
<configuration> <configuration>
<property name="enabled">${migration.kc12}</property> <property name="enabled">${auth.server.wildfly.kc12}</property>
<property name="adapterImplClass">org.jboss.as.arquillian.container.managed.ManagedDeployableContainer</property> <property name="adapterImplClass">org.jboss.as.arquillian.container.managed.ManagedDeployableContainer</property>
<property name="jbossHome">${keycloak.migration.home}</property> <property name="jbossHome">${keycloak.migration.home}</property>
<property name="javaVmArguments">-Djboss.socket.binding.port-offset=${auth.server.port.offset} -Xms64m -Xmx512m -XX:MaxPermSize=256m</property> <property name="javaVmArguments">-Djboss.socket.binding.port-offset=${auth.server.port.offset} -Xms64m -Xmx512m -XX:MaxPermSize=256m</property>

View file

@ -207,7 +207,7 @@
</artifactItem> </artifactItem>
<artifactItem> <artifactItem>
<groupId>org.keycloak</groupId> <groupId>org.keycloak</groupId>
<artifactId>saml-post-signatures</artifactId> <artifactId>sales-post-sig</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<type>war</type> <type>war</type>
</artifactItem> </artifactItem>

View file

@ -1,20 +1,20 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!-- <!--
~ Copyright 2016 Red Hat, Inc. and/or its affiliates ~ Copyright 2016 Red Hat, Inc. and/or its affiliates
~ and other contributors as indicated by the @author tags. ~ and other contributors as indicated by the @author tags.
~ ~
~ Licensed under the Apache License, Version 2.0 (the "License"); ~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License. ~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at ~ You may obtain a copy of the License at
~ ~
~ http://www.apache.org/licenses/LICENSE-2.0 ~ http://www.apache.org/licenses/LICENSE-2.0
~ ~
~ Unless required by applicable law or agreed to in writing, software ~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS, ~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and ~ See the License for the specific language governing permissions and
~ limitations under the License. ~ limitations under the License.
--> -->
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
@ -65,9 +65,6 @@
<arquillian-wildfly-container.version>8.2.0.Final</arquillian-wildfly-container.version> <arquillian-wildfly-container.version>8.2.0.Final</arquillian-wildfly-container.version>
<version.shrinkwrap.resolvers>2.1.1</version.shrinkwrap.resolvers> <version.shrinkwrap.resolvers>2.1.1</version.shrinkwrap.resolvers>
<skip.unpack.server>true</skip.unpack.server>
<skip.unpack.migrated.server>true</skip.unpack.migrated.server>
<skip.install.adapters>true</skip.install.adapters>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
@ -122,7 +119,6 @@
<auth.server.ssl.required>${auth.server.ssl.required}</auth.server.ssl.required> <auth.server.ssl.required>${auth.server.ssl.required}</auth.server.ssl.required>
<startup.timeout.sec>${startup.timeout.sec}</startup.timeout.sec> <startup.timeout.sec>${startup.timeout.sec}</startup.timeout.sec>
<jboss.server.config.dir>${jboss.server.config.dir}</jboss.server.config.dir> <jboss.server.config.dir>${jboss.server.config.dir}</jboss.server.config.dir>
<skip.install.adapters>${skip.install.adapters}</skip.install.adapters>
</systemPropertyVariables> </systemPropertyVariables>
<properties> <properties>
<property> <property>
@ -133,52 +129,6 @@
<failIfNoTests>false</failIfNoTests> <failIfNoTests>false</failIfNoTests>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-migrated-server</id>
<phase>generate-test-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<skip>${skip.unpack.migrated.server}</skip>
<artifactItems>
<artifactItem>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>${migrated.server.artifactId}</artifactId>
<version>${project.version}</version>
<type>zip</type>
</artifactItem>
</artifactItems>
<outputDirectory>${containers.home}</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
<execution>
<id>unpack-server</id>
<phase>generate-test-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<skip>${skip.unpack.server}</skip>
<artifactItems>
<artifactItem>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>${server.artifactId}</artifactId>
<version>${project.version}</version>
<type>zip</type>
</artifactItem>
</artifactItems>
<outputDirectory>${containers.home}</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId> <artifactId>maven-resources-plugin</artifactId>
@ -444,8 +394,6 @@
<profile> <profile>
<id>auth-server-wildfly</id> <id>auth-server-wildfly</id>
<properties> <properties>
<skip.unpack.server>false</skip.unpack.server>
<server.artifactId>integration-arquillian-server-wildfly</server.artifactId>
<auth.server.container>auth-server-wildfly</auth.server.container> <auth.server.container>auth-server-wildfly</auth.server.container>
<startup.timeout.sec>300</startup.timeout.sec> <startup.timeout.sec>300</startup.timeout.sec>
<adapter.test.props/> <adapter.test.props/>
@ -474,6 +422,31 @@
</systemPropertyVariables> </systemPropertyVariables>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-auth-server-wildfly</id>
<phase>generate-test-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-server-wildfly</artifactId>
<version>${project.version}</version>
<type>zip</type>
</artifactItem>
</artifactItems>
<outputDirectory>${containers.home}</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
</build> </build>
@ -482,8 +455,6 @@
<profile> <profile>
<id>auth-server-eap7</id> <id>auth-server-eap7</id>
<properties> <properties>
<skip.unpack.server>false</skip.unpack.server>
<server.artifactId>integration-arquillian-server-eap7</server.artifactId>
<auth.server.container>auth-server-eap7</auth.server.container> <auth.server.container>auth-server-eap7</auth.server.container>
<startup.timeout.sec>300</startup.timeout.sec> <startup.timeout.sec>300</startup.timeout.sec>
<adapter.test.props/> <adapter.test.props/>
@ -530,6 +501,31 @@
</systemPropertyVariables> </systemPropertyVariables>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-auth-server-eap</id>
<phase>generate-test-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-server-eap7</artifactId>
<version>${project.version}</version>
<type>zip</type>
</artifactItem>
</artifactItems>
<outputDirectory>${containers.home}</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
</build> </build>
@ -537,12 +533,82 @@
<!-- Profiles for migration tests--> <!-- Profiles for migration tests-->
<profile>
<id>migration</id>
<activation>
<property>
<name>migrated.auth.server.version</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-properties</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireProperty>
<property>migrated.auth.server.version</property>
</requireProperty>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-migrated-auth-server-wildfly</id>
<phase>generate-test-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>${migrated.auth.server.artifactId}</artifactId>
<version>${project.version}</version>
<type>zip</type>
</artifactItem>
</artifactItems>
<outputDirectory>${containers.home}</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<migrated.auth.server.version>${migrated.auth.server.version}</migrated.auth.server.version>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile> <profile>
<id>migration-kc16</id> <id>migration-kc16</id>
<activation>
<property>
<name>migrated.auth.server.version</name>
<value>1.6.1.Final</value>
</property>
</activation>
<properties> <properties>
<skip.unpack.migrated.server>false</skip.unpack.migrated.server> <migrated.auth.server.artifactId>integration-arquillian-server-wildfly-kc16</migrated.auth.server.artifactId>
<server.version>1.6.1.Final</server.version>
<migrated.server.artifactId>integration-arquillian-server-wildfly-kc16</migrated.server.artifactId>
</properties> </properties>
<build> <build>
<pluginManagement> <pluginManagement>
@ -552,11 +618,9 @@
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration> <configuration>
<systemPropertyVariables> <systemPropertyVariables>
<migration>true</migration> <auth.server.wildfly.kc16>true</auth.server.wildfly.kc16>
<migration.kc16>true</migration.kc16> <keycloak.migration.home>${containers.home}/keycloak-${migrated.auth.server.version}</keycloak.migration.home>
<keycloak.migration.home>${containers.home}/keycloak-${server.version}</keycloak.migration.home>
<keycloak.migration.file>src/test/resources/migration-test/migration-realm-16.json</keycloak.migration.file> <keycloak.migration.file>src/test/resources/migration-test/migration-realm-16.json</keycloak.migration.file>
<version>${server.version}</version>
</systemPropertyVariables> </systemPropertyVariables>
</configuration> </configuration>
</plugin> </plugin>
@ -567,10 +631,14 @@
<profile> <profile>
<id>migration-kc15</id> <id>migration-kc15</id>
<activation>
<property>
<name>migrated.auth.server.version</name>
<value>1.5.1.Final</value>
</property>
</activation>
<properties> <properties>
<skip.unpack.migrated.server>false</skip.unpack.migrated.server> <migrated.auth.server.artifactId>integration-arquillian-server-wildfly-kc15</migrated.auth.server.artifactId>
<server.version>1.5.1.Final</server.version>
<migrated.server.artifactId>integration-arquillian-server-wildfly-kc15</migrated.server.artifactId>
</properties> </properties>
<build> <build>
<pluginManagement> <pluginManagement>
@ -580,11 +648,9 @@
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration> <configuration>
<systemPropertyVariables> <systemPropertyVariables>
<migration>true</migration> <auth.server.wildfly.kc15>true</auth.server.wildfly.kc15>
<migration.kc15>true</migration.kc15> <keycloak.migration.home>${containers.home}/keycloak-${migrated.auth.server.version}</keycloak.migration.home>
<keycloak.migration.home>${containers.home}/keycloak-${server.version}</keycloak.migration.home>
<keycloak.migration.file>src/test/resources/migration-test/migration-realm-15.json</keycloak.migration.file> <keycloak.migration.file>src/test/resources/migration-test/migration-realm-15.json</keycloak.migration.file>
<version>${server.version}</version>
</systemPropertyVariables> </systemPropertyVariables>
</configuration> </configuration>
</plugin> </plugin>
@ -595,10 +661,14 @@
<profile> <profile>
<id>migration-kc14</id> <id>migration-kc14</id>
<activation>
<property>
<name>migrated.auth.server.version</name>
<value>1.4.0.Final</value>
</property>
</activation>
<properties> <properties>
<skip.unpack.migrated.server>false</skip.unpack.migrated.server> <migrated.auth.server.artifactId>integration-arquillian-server-wildfly-kc14</migrated.auth.server.artifactId>
<server.version>1.4.0.Final</server.version>
<migrated.server.artifactId>integration-arquillian-server-wildfly-kc14</migrated.server.artifactId>
</properties> </properties>
<build> <build>
<pluginManagement> <pluginManagement>
@ -608,9 +678,8 @@
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration> <configuration>
<systemPropertyVariables> <systemPropertyVariables>
<migration>true</migration> <auth.server.wildfly.kc14>true</auth.server.wildfly.kc14>
<migration.kc14>true</migration.kc14> <keycloak.migration.home>${containers.home}/keycloak-${migrated.auth.server.version}</keycloak.migration.home>
<keycloak.migration.home>${containers.home}/keycloak-${server.version}</keycloak.migration.home>
</systemPropertyVariables> </systemPropertyVariables>
</configuration> </configuration>
</plugin> </plugin>
@ -621,10 +690,14 @@
<profile> <profile>
<id>migration-kc13</id> <id>migration-kc13</id>
<activation>
<property>
<name>migrated.auth.server.version</name>
<value>1.3.1.Final</value>
</property>
</activation>
<properties> <properties>
<skip.unpack.migrated.server>false</skip.unpack.migrated.server> <migrated.auth.server.artifactId>integration-arquillian-server-wildfly-kc13</migrated.auth.server.artifactId>
<server.version>1.3.1.Final</server.version>
<migrated.server.artifactId>integration-arquillian-server-wildfly-kc13</migrated.server.artifactId>
</properties> </properties>
<build> <build>
<pluginManagement> <pluginManagement>
@ -634,9 +707,8 @@
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration> <configuration>
<systemPropertyVariables> <systemPropertyVariables>
<migration>true</migration> <auth.server.wildfly.kc13>true</auth.server.wildfly.kc13>
<migration.kc13>true</migration.kc13> <keycloak.migration.home>${containers.home}/keycloak-${migrated.auth.server.version}</keycloak.migration.home>
<keycloak.migration.home>${containers.home}/keycloak-${server.version}</keycloak.migration.home>
</systemPropertyVariables> </systemPropertyVariables>
</configuration> </configuration>
</plugin> </plugin>
@ -647,10 +719,14 @@
<profile> <profile>
<id>migration-kc12</id> <id>migration-kc12</id>
<activation>
<property>
<name>migrated.auth.server.version</name>
<value>1.2.0.Final</value>
</property>
</activation>
<properties> <properties>
<skip.unpack.migrated.server>false</skip.unpack.migrated.server> <migrated.auth.server.artifactId>integration-arquillian-server-wildfly-kc12</migrated.auth.server.artifactId>
<server.version>1.2.0.Final</server.version>
<migrated.server.artifactId>integration-arquillian-server-wildfly-kc12</migrated.server.artifactId>
</properties> </properties>
<build> <build>
<pluginManagement> <pluginManagement>
@ -660,9 +736,8 @@
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration> <configuration>
<systemPropertyVariables> <systemPropertyVariables>
<migration>true</migration> <auth.server.wildfly.kc12>true</auth.server.wildfly.kc12>
<migration.kc12>true</migration.kc12> <keycloak.migration.home>${containers.home}/keycloak-${migrated.auth.server.version}</keycloak.migration.home>
<keycloak.migration.home>${containers.home}/keycloak-${server.version}</keycloak.migration.home>
</systemPropertyVariables> </systemPropertyVariables>
</configuration> </configuration>
</plugin> </plugin>