Merge pull request #3497 from vramik/KEYCLOAK-3899
KEYCLOAK-3899 Make migration properties available in tests
This commit is contained in:
commit
a2e00e4c3b
2 changed files with 34 additions and 2 deletions
|
@ -139,12 +139,40 @@
|
|||
<properties>
|
||||
<migrated.auth.server.version>${migration.project.version}</migrated.auth.server.version>
|
||||
</properties>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<migrated.auth.server.version>${migrated.auth.server.version}</migrated.auth.server.version>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>test-product-migration</id>
|
||||
<properties>
|
||||
<migrated.auth.server.version>${migration.product.version}</migrated.auth.server.version>
|
||||
</properties>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<migrated.auth.server.version>${migrated.auth.server.version}</migrated.auth.server.version>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.jboss.arquillian.test.spi.execution.ExecutionDecision;
|
|||
import org.jboss.arquillian.test.spi.execution.TestExecutionDecider;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:vramik@redhat.com">Vlastislav Ramik</a>
|
||||
|
@ -27,6 +28,7 @@ import java.lang.reflect.Method;
|
|||
*/
|
||||
public class MigrationTestExecutionDecider implements TestExecutionDecider {
|
||||
|
||||
private final Logger log = Logger.getLogger(MigrationTestExecutionDecider.class);
|
||||
private static final String MIGRATED_AUTH_SERVER_VERSION_PROPERTY = "migrated.auth.server.version";
|
||||
|
||||
@Override
|
||||
|
@ -35,8 +37,10 @@ public class MigrationTestExecutionDecider implements TestExecutionDecider {
|
|||
String migratedAuthServerVersion = System.getProperty(MIGRATED_AUTH_SERVER_VERSION_PROPERTY);
|
||||
boolean migrationTest = migratedAuthServerVersion != null;
|
||||
Migration migrationAnnotation = method.getAnnotation(Migration.class);
|
||||
|
||||
if (migrationTest && migrationAnnotation != null) {
|
||||
|
||||
if (migrationTest && migrationAnnotation != null) {
|
||||
log.info("migration from version: " + migratedAuthServerVersion);
|
||||
|
||||
String versionFrom = migrationAnnotation.versionFrom();
|
||||
|
||||
if (migratedAuthServerVersion.contains(versionFrom)) {
|
||||
|
|
Loading…
Reference in a new issue