keycloak-memoizeit

Merge pull request #4554 from vramik/KEYCLOAK-5672 KEYCLOAK-5672

10/17/2017 3:42:29 AM

Details

diff --git a/testsuite/integration-arquillian/tests/base/pom.xml b/testsuite/integration-arquillian/tests/base/pom.xml
index 9b26254..a04c3c2 100644
--- a/testsuite/integration-arquillian/tests/base/pom.xml
+++ b/testsuite/integration-arquillian/tests/base/pom.xml
@@ -229,14 +229,24 @@
                 </executions>
             </plugin>
 
-            <plugin>
-                <artifactId>maven-antrun-plugin</artifactId>
-                <configuration>
-                    <skip>false</skip>
-                </configuration>
-            </plugin>
         </plugins>
 
     </build>
-    
+
+    <profiles>
+        <profile>
+            <id>auth-servers-crossdc-undertow</id>
+            <properties>
+                <skip.clean.second.cache>false</skip.clean.second.cache>
+            </properties>
+        </profile>
+        <profile>
+            <id>auth-servers-crossdc-jboss</id>
+            <properties>
+                <skip.clean.second.cache>false</skip.clean.second.cache>
+                <skip.copy.auth.crossdc.nodes>false</skip.copy.auth.crossdc.nodes>
+            </properties>
+        </profile>
+    </profiles>
+
 </project>
diff --git a/testsuite/integration-arquillian/tests/other/pom.xml b/testsuite/integration-arquillian/tests/other/pom.xml
index da03e0f..30b229e 100644
--- a/testsuite/integration-arquillian/tests/other/pom.xml
+++ b/testsuite/integration-arquillian/tests/other/pom.xml
@@ -42,6 +42,10 @@
         <module>springboot-tests</module>
     </modules>
 
+    <properties>
+        <skip.unpack.test.resources>false</skip.unpack.test.resources>
+    </properties>
+
     <build>
         <pluginManagement>
             <plugins>
@@ -55,6 +59,7 @@
                                 <goal>unpack</goal>
                             </goals>
                             <configuration>
+                                <skip>${skip.unpack.test.resources}</skip>
                                 <artifactItems>
                                     <artifactItem>
                                         <groupId>org.keycloak.testsuite</groupId>
@@ -78,6 +83,7 @@
                                 <goal>copy-resources</goal>
                             </goals>
                             <configuration>
+                                <skip>${skip.add.user.json}</skip>
                                 <outputDirectory>${auth.server.config.dir}</outputDirectory>
                                 <resources>
                                     <resource>
diff --git a/testsuite/integration-arquillian/tests/other/server-config-migration/pom.xml b/testsuite/integration-arquillian/tests/other/server-config-migration/pom.xml
index 81e5f22..ab1be81 100644
--- a/testsuite/integration-arquillian/tests/other/server-config-migration/pom.xml
+++ b/testsuite/integration-arquillian/tests/other/server-config-migration/pom.xml
@@ -34,8 +34,19 @@
     <name>Keycloak Migration TestSuite For Server Config</name>
 
     <properties>
+        <skip.add.user.json>true</skip.add.user.json>
+        <skip.unpack.test.resources>true</skip.unpack.test.resources>
+        <skip.rename.configs>false</skip.rename.configs>
+        
         <jbossHome>${project.build.directory}/keycloak-${project.version}</jbossHome>
         <migrated.version>1.8.1</migrated.version>
+        <master.version>${project.version}</master.version>
+        
+        <!-- example how to test 'product' config migration
+        <jbossHome>${project.build.directory}/rh-sso-7.1</jbossHome>
+        <migrated.version>1.9.8.Final-redhat-1</migrated.version>
+        <master.version>3.3.0.CR2-redhat-1</master.version>
+        -->
     </properties>
 
     <dependencies>
@@ -56,7 +67,7 @@
             <scope>test</scope>
         </dependency>
     </dependencies>
-    
+
     <build>
         <plugins>
             <plugin>
@@ -64,7 +75,7 @@
                 <artifactId>maven-dependency-plugin</artifactId>
                 <executions>
                     <execution>
-                        <id>unpack</id>
+                        <id>unpack-keycloak-server-dist</id>
                         <phase>process-resources</phase>
                         <goals>
                             <goal>unpack</goal>
@@ -74,7 +85,7 @@
                                 <artifactItem>
                                     <groupId>org.keycloak</groupId>
                                     <artifactId>keycloak-server-dist</artifactId>
-                                    <version>${project.version}</version>
+                                    <version>${master.version}</version>
                                     <type>zip</type>
                                     <overWrite>true</overWrite>
                                     <outputDirectory>${project.build.directory}</outputDirectory>
@@ -84,12 +95,12 @@
                     </execution>
                 </executions>
             </plugin>
-            
+
             <plugin>
                 <artifactId>maven-resources-plugin</artifactId>
                 <executions>
                     <execution>
-                        <id>copy-standalone</id>
+                        <id>copy-standalone-resources</id>
                         <phase>compile</phase>
                         <goals>
                             <goal>copy-resources</goal>
@@ -106,7 +117,7 @@
                         </configuration>            
                     </execution>
                     <execution>
-                        <id>copy-domain</id>
+                        <id>copy-domain-resources</id>
                         <phase>compile</phase>
                         <goals>
                             <goal>copy-resources</goal>
@@ -124,352 +135,314 @@
                     </execution>
                 </executions>
             </plugin>
-            
+
             <plugin>
-                <groupId>com.coderplus.maven.plugins</groupId>
-                <artifactId>copy-rename-maven-plugin</artifactId>
-                <version>1.0.1</version>
+                <artifactId>maven-antrun-plugin</artifactId>
                 <executions>
                     <execution>
-                        <id>rename-keycloak-server-json-standalone</id>
+                        <id>rename-migrated-resources</id>
                         <phase>generate-test-sources</phase>
                         <goals>
-                            <goal>rename</goal>
+                            <goal>run</goal>
                         </goals>
                         <configuration>
-                            <sourceFile>${jbossHome}/standalone/configuration/keycloak-server-${migrated.version}.json</sourceFile>
-                            <destinationFile>${jbossHome}/standalone/configuration/keycloak-server.json</destinationFile>
+                            <skip>${skip.rename.configs}</skip>
+                            <target>
+                                <echo>For migration from versions above 2.1.0 there is no keycloak-server.json supported.</echo>
+                                <move file="${jbossHome}/standalone/configuration/keycloak-server-${migrated.version}.json"
+                                      tofile="${jbossHome}/standalone/configuration/keycloak-server.json"
+                                      verbose="true"
+                                      failonerror="false"/>
+                                <move file="${jbossHome}/domain/configuration/keycloak-server-${migrated.version}.json"
+                                      tofile="${jbossHome}/domain/configuration/keycloak-server.json"
+                                      verbose="true"
+                                      failonerror="false"/>
+                                <move file="${jbossHome}/standalone/configuration/standalone-${migrated.version}.xml"
+                                      tofile="${jbossHome}/standalone/configuration/standalone.xml"
+                                      verbose="true"/>
+                                <move file="${jbossHome}/standalone/configuration/standalone-ha-${migrated.version}.xml"
+                                      tofile="${jbossHome}/standalone/configuration/standalone-ha.xml"
+                                      verbose="true"/>
+                                <move file="${jbossHome}/domain/configuration/domain-${migrated.version}.xml"
+                                      tofile="${jbossHome}/domain/configuration/domain.xml"
+                                      verbose="true"/>
+                                <move file="${jbossHome}/domain/configuration/host-master-${migrated.version}.xml"
+                                      tofile="${jbossHome}/domain/configuration/host-master.xml"
+                                      verbose="true"/>
+                            </target>
                         </configuration>
                     </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>exec-maven-plugin</artifactId>
+                <executions>
                     <execution>
-                        <id>rename-keycloak-server-json-domain</id>
-                        <phase>generate-test-sources</phase>
+                        <id>read-master-standalone</id>
+                        <phase>process-classes</phase>
                         <goals>
-                            <goal>rename</goal>
+                            <goal>exec</goal>
                         </goals>
                         <configuration>
-                            <sourceFile>${jbossHome}/domain/configuration/keycloak-server-${migrated.version}.json</sourceFile>
-                            <destinationFile>${jbossHome}/domain/configuration/keycloak-server.json</destinationFile>
+                            <executable>./jboss-cli.sh</executable>
+                            <workingDirectory>${jbossHome}/bin</workingDirectory>
+                            <arguments>
+                                <argument>--file=${project.build.directory}/classes/cli/read-standalone.cli</argument>
+                            </arguments>
+                            <outputFile>${project.build.directory}/master-standalone.txt</outputFile>
                         </configuration>
                     </execution>
-                </executions>
-            </plugin>
-            
-            <plugin>
-                <groupId>com.google.code.maven-replacer-plugin</groupId>
-                <artifactId>maven-replacer-plugin</artifactId>
-                <executions>
                     <execution>
-                        <id>replaceTokens</id>
-                        <phase>process-test-sources</phase>
+                        <id>read-master-standalone-ha</id>
+                        <phase>process-classes</phase>
                         <goals>
-                            <goal>replace</goal>
+                            <goal>exec</goal>
                         </goals>
                         <configuration>
-                            <!-- Comment out embeds.  For wildfly-maven-plugin,
-                                 CLI commands have to execute against a running
-                                 server. BTW, CLI Comments only work if the # is in the
-                                 first column.
-                            -->
-                            <replacements>
-                                <replacement>
-                                    <token>embed-server</token>
-                                    <value>#embed-server</value>
-                                </replacement>
-                                <replacement>
-                                    <token>embed-host-controller</token>
-                                    <value>#embed-host-controller</value>
-                                </replacement>
-                                <replacement>
-                                    <token>:migrate-json(file=$pathToJson)</token>
-                                    <value>:migrate-json</value>
-                                </replacement>
-                            </replacements>
+                            <executable>./jboss-cli.sh</executable>
+                            <workingDirectory>${jbossHome}/bin</workingDirectory>
+                            <arguments>
+                                <argument>--file=${project.build.directory}/classes/cli/read-standalone-ha.cli</argument>
+                            </arguments>
+                            <outputFile>${project.build.directory}/master-standalone-ha.txt</outputFile>
                         </configuration>
                     </execution>
-                </executions>
-                <configuration>
-                    <regex>false</regex>
-                    <basedir>${jbossHome}</basedir>
-                    <filesToInclude>bin\migrate**.cli</filesToInclude>
-                </configuration>
-            </plugin>
-            
-            <plugin>
-                <groupId>org.wildfly.plugins</groupId>
-                <artifactId>wildfly-maven-plugin</artifactId>
-                <configuration>
-                    <skip>false</skip>
-                    <jbossHome>${jbossHome}</jbossHome>
-                    <port>10990</port>
-                </configuration>
-                
-                <executions>
-                    
-                    <!-- standalone.xml -->
+                    <execution>
+                        <id>read-master-domain-standalone</id>
+                        <phase>process-classes</phase>
+                        <goals>
+                            <goal>exec</goal>
+                        </goals>
+                        <configuration>
+                            <executable>./jboss-cli.sh</executable>
+                            <workingDirectory>${jbossHome}/bin</workingDirectory>
+                            <arguments>
+                                <argument>--file=${project.build.directory}/classes/cli/read-domain-standalone.cli</argument>
+                            </arguments>
+                            <outputFile>${project.build.directory}/master-domain-standalone.txt</outputFile>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>read-master-domain-clustered</id>
+                        <phase>process-classes</phase>
+                        <goals>
+                            <goal>exec</goal>
+                        </goals>
+                        <configuration>
+                            <executable>./jboss-cli.sh</executable>
+                            <workingDirectory>${jbossHome}/bin</workingDirectory>
+                            <arguments>
+                                <argument>--file=${project.build.directory}/classes/cli/read-domain-clustered.cli</argument>
+                            </arguments>
+                            <outputFile>${project.build.directory}/master-domain-clustered.txt</outputFile>
+                        </configuration>
+                    </execution>
+
                     <execution>
                         <id>migrate-standalone</id>
-                        <phase>generate-test-resources</phase>
+                        <phase>process-test-sources</phase>
                         <goals>
-                            <goal>start</goal>
-                            <goal>execute-commands</goal>
-                            <goal>shutdown</goal>
+                            <goal>exec</goal>
                         </goals>
                         <configuration>
-                            <serverConfig>standalone-${migrated.version}.xml</serverConfig>
-                            <java-opts>
-                                <java-opt>-Djboss.socket.binding.port-offset=1000</java-opt>
-                            </java-opts>
-                            <execute-commands>
-                                <scripts>
-                                    <script>${jbossHome}/bin/migrate-standalone.cli</script>
-                                </scripts>
-                            </execute-commands>
+                            <executable>./jboss-cli.sh</executable>
+                            <workingDirectory>${jbossHome}/bin</workingDirectory>
+                            <arguments>
+                                <argument>--file=migrate-standalone.cli</argument>
+                            </arguments>
                         </configuration>
                     </execution>
                     <execution>
-                        <id>read-migrated-standalone</id>
-                        <phase>process-test-resources</phase>
+                        <id>migrate-standalone-ha</id>
+                        <phase>process-test-sources</phase>
                         <goals>
-                            <goal>start</goal>
-                            <goal>execute-commands</goal>
-                            <goal>shutdown</goal>
+                            <goal>exec</goal>
                         </goals>
                         <configuration>
-                            <serverConfig>standalone-${migrated.version}.xml</serverConfig>
-                            <java-opts>
-                                <java-opt>-Djboss.socket.binding.port-offset=1000</java-opt>
-                            </java-opts>
-                            <execute-commands>
-                                <commands>
-                                    <command>echo Reading subsystems for migrated standalone-${migrated.version}.xml</command>
-                                    <command>/subsystem=*/:read-resource(recursive=true)>${project.build.directory}/migrated-standalone-${migrated.version}.txt</command>
-                                </commands>
-                            </execute-commands>
+                            <executable>./jboss-cli.sh</executable>
+                            <workingDirectory>${jbossHome}/bin</workingDirectory>
+                            <arguments>
+                                <argument>--file=migrate-standalone-ha.cli</argument>
+                            </arguments>
                         </configuration>
                     </execution>
                     <execution>
-                        <id>read-master-standalone</id>
-                        <phase>process-test-resources</phase>
+                        <id>migrate-domain-standalone</id>
+                        <phase>process-test-sources</phase>
                         <goals>
-                            <goal>start</goal>
-                            <goal>execute-commands</goal>
-                            <goal>shutdown</goal>
+                            <goal>exec</goal>
                         </goals>
                         <configuration>
-                            <serverConfig>standalone.xml</serverConfig>
-                            <java-opts>
-                                <java-opt>-Djboss.socket.binding.port-offset=1000</java-opt>
-                            </java-opts>
-                            <execute-commands>
-                                <commands>
-                                    <command>echo Reading subsystems for master standalone.xml</command>
-                                    <command>/subsystem=*/:read-resource(recursive=true)>${project.build.directory}/master-standalone.txt</command>
-                                </commands>
-                            </execute-commands>
+                            <executable>./jboss-cli.sh</executable>
+                            <workingDirectory>${jbossHome}/bin</workingDirectory>
+                            <arguments>
+                                <argument>--file=migrate-domain-standalone.cli</argument>
+                            </arguments>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>migrate-domain-clustered</id>
+                        <phase>process-test-sources</phase>
+                        <goals>
+                            <goal>exec</goal>
+                        </goals>
+                        <configuration>
+                            <executable>./jboss-cli.sh</executable>
+                            <workingDirectory>${jbossHome}/bin</workingDirectory>
+                            <arguments>
+                                <argument>--file=migrate-domain-clustered.cli</argument>
+                            </arguments>
+                        </configuration>
+                    </execution>
+
+                    <execution>
+                        <id>remove-temp-data-standalone</id>
+                        <phase>process-test-sources</phase>
+                        <goals>
+                            <goal>exec</goal>
+                        </goals>
+                        <configuration>
+                            <executable>rm</executable>
+                            <workingDirectory>${jbossHome}/standalone</workingDirectory>
+                            <arguments>
+                                <argument>-rf</argument>
+                                <argument>data</argument>
+                                <argument>log</argument>
+                                <argument>tmp</argument>
+                            </arguments>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>remove-temp-data-domain</id>
+                        <phase>process-test-sources</phase>
+                        <goals>
+                            <goal>exec</goal>
+                        </goals>
+                        <configuration>
+                            <executable>rm</executable>
+                            <workingDirectory>${jbossHome}/domain</workingDirectory>
+                            <arguments>
+                                <argument>-rf</argument>
+                                <argument>data/auto-start</argument>
+                                <argument>data/kernel</argument>
+                                <argument>log</argument>
+                                <argument>servers</argument>
+                            </arguments>
                         </configuration>
                     </execution>
                     
-                    <!-- standalone-ha.xml -->
                     <execution>
-                        <id>migrate-standalone-ha</id>
-                        <phase>generate-test-resources</phase>
+                        <id>read-migrated-standalone</id>
+                        <phase>process-test-resources</phase>
                         <goals>
-                            <goal>start</goal>
-                            <goal>execute-commands</goal>
-                            <goal>shutdown</goal>
+                            <goal>exec</goal>
                         </goals>
                         <configuration>
-                            <serverConfig>standalone-ha-${migrated.version}.xml</serverConfig>
-                            <java-opts>
-                                <java-opt>-Djboss.socket.binding.port-offset=1000</java-opt>
-                            </java-opts>
-                            <execute-commands>
-                                <scripts>
-                                    <script>${jbossHome}/bin/migrate-standalone-ha.cli</script>
-                                </scripts>
-                            </execute-commands>
+                            <executable>./jboss-cli.sh</executable>
+                            <workingDirectory>${jbossHome}/bin</workingDirectory>
+                            <arguments>
+                                <argument>--file=${project.build.directory}/classes/cli/read-standalone.cli</argument>
+                            </arguments>
+                            <outputFile>${project.build.directory}/migrated-standalone.txt</outputFile>
                         </configuration>
                     </execution>
                     <execution>
                         <id>read-migrated-standalone-ha</id>
                         <phase>process-test-resources</phase>
                         <goals>
-                            <goal>start</goal>
-                            <goal>execute-commands</goal>
-                            <goal>shutdown</goal>
+                            <goal>exec</goal>
                         </goals>
                         <configuration>
-                            <serverConfig>standalone-ha-${migrated.version}.xml</serverConfig>
-                            <java-opts>
-                                <java-opt>-Djboss.socket.binding.port-offset=1000</java-opt>
-                            </java-opts>
-                            <execute-commands>
-                                <commands>
-                                    <command>echo Reading subsystems for migrated standalone-ha-${migrated.version}.xml</command>
-                                    <command>/subsystem=*/:read-resource(recursive=true)>${project.build.directory}/migrated-standalone-ha-${migrated.version}.txt</command>
-                                </commands>
-                            </execute-commands>
+                            <executable>./jboss-cli.sh</executable>
+                            <workingDirectory>${jbossHome}/bin</workingDirectory>
+                            <arguments>
+                                <argument>--file=${project.build.directory}/classes/cli/read-standalone-ha.cli</argument>
+                            </arguments>
+                            <outputFile>${project.build.directory}/migrated-standalone-ha.txt</outputFile>
                         </configuration>
                     </execution>
                     <execution>
-                        <id>read-master-standalone-ha</id>
+                        <id>read-migrated-domain-standalone</id>
                         <phase>process-test-resources</phase>
                         <goals>
-                            <goal>start</goal>
-                            <goal>execute-commands</goal>
-                            <goal>shutdown</goal>
+                            <goal>exec</goal>
                         </goals>
                         <configuration>
-                            <serverConfig>standalone-ha.xml</serverConfig>
-                            <java-opts>
-                                <java-opt>-Djboss.socket.binding.port-offset=1000</java-opt>
-                            </java-opts>
-                            <execute-commands>
-                                <commands>
-                                    <command>echo Reading subsystems for master standalone-ha.xml</command>
-                                    <command>/subsystem=*/:read-resource(recursive=true)>${project.build.directory}/master-standalone-ha.txt</command>
-                                </commands>
-                            </execute-commands>
+                            <executable>./jboss-cli.sh</executable>
+                            <workingDirectory>${jbossHome}/bin</workingDirectory>
+                            <arguments>
+                                <argument>--file=${project.build.directory}/classes/cli/read-domain-standalone.cli</argument>
+                            </arguments>
+                            <outputFile>${project.build.directory}/migrated-domain-standalone.txt</outputFile>
                         </configuration>
                     </execution>
-                    
-                    <!-- domain.xml -->
                     <execution>
-                        <id>migrate-domain</id>
+                        <id>read-migrated-domain-clustered</id>
+                        <phase>process-test-resources</phase>
+                        <goals>
+                            <goal>exec</goal>
+                        </goals>
+                        <configuration>
+                            <executable>./jboss-cli.sh</executable>
+                            <workingDirectory>${jbossHome}/bin</workingDirectory>
+                            <arguments>
+                                <argument>--file=${project.build.directory}/classes/cli/read-domain-clustered.cli</argument>
+                            </arguments>
+                            <outputFile>${project.build.directory}/migrated-domain-clustered.txt</outputFile>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.wildfly.plugins</groupId>
+                <artifactId>wildfly-maven-plugin</artifactId>
+                <configuration>
+                    <jbossHome>${jbossHome}</jbossHome>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>start-stop-standalone</id>
                         <phase>generate-test-resources</phase>
                         <goals>
                             <goal>start</goal>
-                            <goal>execute-commands</goal>
                             <goal>shutdown</goal>
                         </goals>
                         <configuration>
-                            <serverType>DOMAIN</serverType>
-                            <domainConfig>domain-${migrated.version}.xml</domainConfig>
-                            <server-args>
-                                <server-arg>--host-config=host-master-${migrated.version}.xml</server-arg>
-                            </server-args>
-                            <!-- jboss.server.config.dir is set to trick the migrate-json operation into -->
-                            <!-- finding keycloak-server.json.  Normally, that would be uploaded using   -->
-                            <!-- a file=<localfile> parameter.                                           -->
-                            <!-- Ports are set to avoid conflicts with other server instances.           -->
-                            <java-opts>
-                                <java-opt>-Djboss.management.http.port=10990</java-opt>
-                                <java-opt>-Djboss.management.native.port=10999</java-opt>
-                                <java-opt>-Djboss.server.config.dir=${jbossHome}/domain/configuration/</java-opt>
-                            </java-opts>
-                            <execute-commands>
-                                <scripts>
-                                    <script>${jbossHome}/bin/migrate-domain-standalone.cli</script>
-                                    <script>${jbossHome}/bin/migrate-domain-clustered.cli</script>
-                                </scripts>
-                            </execute-commands>
+                            <serverConfig>standalone.xml</serverConfig>
                         </configuration>
                     </execution>
                     <execution>
-                        <id>read-migrated-domain</id>
-                        <phase>process-test-resources</phase>
+                        <id>start-stop-standalone-ha</id>
+                        <phase>generate-test-resources</phase>
                         <goals>
                             <goal>start</goal>
-                            <goal>execute-commands</goal>
                             <goal>shutdown</goal>
                         </goals>
                         <configuration>
-                            <serverType>DOMAIN</serverType>
-                            <domainConfig>domain-${migrated.version}.xml</domainConfig>
-                            <server-args>
-                                <server-arg>--host-config=host-master-${migrated.version}.xml</server-arg>
-                            </server-args>
-                            <java-opts>
-                                <java-opt>-Djboss.management.http.port=10990</java-opt>
-                                <java-opt>-Djboss.management.native.port=10999</java-opt>
-                            </java-opts>
-                            <execute-commands>
-                                <commands>
-                                    <command>echo Reading subsystems for migrated domain-${migrated.version}.xml</command>
-                                    <command>/profile=auth-server-standalone/subsystem=*/:read-resource(recursive=true)>${project.build.directory}/migrated-domain-standalone-${migrated.version}.txt</command>
-                                    <command>/profile=auth-server-clustered/subsystem=*/:read-resource(recursive=true)>${project.build.directory}/migrated-domain-clustered-${migrated.version}.txt</command>
-                                </commands>
-                            </execute-commands>
+                            <serverConfig>standalone-ha.xml</serverConfig>
                         </configuration>
                     </execution>
                     <execution>
-                        <id>read-master-domain</id>
-                        <phase>process-test-resources</phase>
+                        <id>start-stop-domain</id>
+                        <phase>generate-test-resources</phase>
                         <goals>
                             <goal>start</goal>
-                            <goal>execute-commands</goal>
                             <goal>shutdown</goal>
                         </goals>
                         <configuration>
                             <serverType>DOMAIN</serverType>
                             <domainConfig>domain.xml</domainConfig>
-                            <java-opts>
-                                <java-opt>-Djboss.management.http.port=10990</java-opt>
-                                <java-opt>-Djboss.management.native.port=10999</java-opt>
-                            </java-opts>
                             <server-args>
                                 <server-arg>--host-config=host-master.xml</server-arg>
                             </server-args>
-                            <execute-commands>
-                                <commands>
-                                    <command>echo Reading subsystems for master domain.xml</command>
-                                    <command>/profile=auth-server-standalone/subsystem=*/:read-resource(recursive=true)>${project.build.directory}/master-domain-standalone.txt</command>
-                                    <command>/profile=auth-server-clustered/subsystem=*/:read-resource(recursive=true)>${project.build.directory}/master-domain-clustered.txt</command>
-                                </commands>
-                            </execute-commands>
                         </configuration>
                     </execution>
                 </executions>
             </plugin>
-            
-            <plugin>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <configuration>
-                    <systemPropertyVariables>
-                        <migrated.version>${migrated.version}</migrated.version>
-                    </systemPropertyVariables>
-                </configuration>
-            </plugin>
         </plugins>
     </build>
-    
-    <profiles>
-        <profile>
-            <id>product</id>
-            <properties>
-                <jbossHome>${project.build.directory}/rh-sso-7.1</jbossHome>
-                <migrated.version>1.9.8.Final-redhat-1</migrated.version>
-            </properties>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-dependency-plugin</artifactId>
-                        <executions>
-                            <execution>
-                                <id>unpack</id>
-                                <phase>compile</phase>
-                                <goals>
-                                    <goal>unpack</goal>
-                                </goals>
-                                <configuration>
-                                    <artifactItems>
-                                        <artifactItem>
-                                            <groupId>org.keycloak</groupId>
-                                            <artifactId>keycloak-server-dist</artifactId>
-                                            <version>2.5.4.Final-redhat-1</version>
-                                            <type>zip</type>
-                                            <overWrite>true</overWrite>
-                                            <outputDirectory>${project.build.directory}</outputDirectory>
-                                        </artifactItem>
-                                    </artifactItems>
-                                </configuration>
-                            </execution>
-                        </executions>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
-    </profiles>
+
 </project>
diff --git a/testsuite/integration-arquillian/tests/other/server-config-migration/README.md b/testsuite/integration-arquillian/tests/other/server-config-migration/README.md
new file mode 100644
index 0000000..83b832b
--- /dev/null
+++ b/testsuite/integration-arquillian/tests/other/server-config-migration/README.md
@@ -0,0 +1,56 @@
+# Keycloak Server Config Migration Testsuite
+
+## Test workflow
+There are performed several steps before actual test is executed. The steps are divided into different maven lifecycle phases to make sure it goes in specified wanted order.
+
+### `process-resources`
+Unpack clean keycloak-server-dist 
+
+### `compile`
+Copy standalone/domain resources to `${jbossHome}/standalone/configuration` and `${jbossHome}/domain/configuration`
+
+### `process-classes`
+`maven-exec-plugin` is used to read current master configs and saves the output to `${project.build.directory}/master-${config.name}.txt`
+
+### `generate-test-sources`
+Files `${jbossHome}/standalone/configuration/keycloak-server.json` and `${jbossHome}/domain/configuration/keycloak-server.json` are created.
+
+Configuration files (`standalone.xml`, `standalone-ha.xml`, `domain.xml`, `host-master.xml`) are overwritten by those from previous version.
+
+### `process-test-sources`
+Migration scripts are applied using **offline mode**. Temporary data are removed.
+
+### `generate-test-resources`
+`wildfly-maven-plugin` is used to start and shutdown container with different configs. It is done to let subsystems to upgrade themselves during first run.
+
+### `process-test-resources`
+`maven-exec-plugin` is used to read migrated configs and saves the output to `${project.build.directory}/migrated-${config.name}.txt`
+
+### `default-test`
+`org.keycloak.test.config.migrationConfigMigrationTest` is executed. It compares generated outputs from ${project.build.directory}
+
+If config outputs don't equal to each other, **by default** the test will compare outputs more deeply to get more readable output. It fails on first found difference.
+
+This can be overwritten by adding property: `-Dget.simple.full.comparison=true` to the test command. In that case it'll perform assert on the two config outputs.
+
+## Properties
+
+### maven
+* jbossHome
+    * default: `${project.build.directory}/keycloak-${project.version}`
+    * specifies path to jbossHome dir
+* migrated.version
+    * default: `1.8.1`
+    * specifies version it is migrated from
+* master.version
+    * default: `${project.version}`
+    * specifies version it is migrated to
+
+## How to run tests
+
+note: `keycloak-server-dist` module has to be build first (`mvn install -f keycloak/pom.xml -Pdistribution`)
+
+* `mvn clean install` tests migration from 1.8.1.Final to current master. It goes thru whole test workflow. Deep comparison is done.
+* `mvn clean install -Dget.simple.full.comparison=true` does assert on outputs instead of deep comparison.
+* `mvn clean process-test-sources -Dskip.rename.configs=true` applies migration scripts to current master. It can be used to make sure the current keycloak version doesn't break the scripts.
+* `mvn clean install -Dskip.rename.configs=true` applies scripts to current master **and** verifies the scripts doesn't actually change anything.
diff --git a/testsuite/integration-arquillian/tests/other/server-config-migration/src/main/resources/cli/read-domain-clustered.cli b/testsuite/integration-arquillian/tests/other/server-config-migration/src/main/resources/cli/read-domain-clustered.cli
new file mode 100644
index 0000000..b86672c
--- /dev/null
+++ b/testsuite/integration-arquillian/tests/other/server-config-migration/src/main/resources/cli/read-domain-clustered.cli
@@ -0,0 +1,3 @@
+embed-host-controller --domain-config=domain.xml
+
+/profile=auth-server-clustered/subsystem=*/:read-resource(recursive=true)
diff --git a/testsuite/integration-arquillian/tests/other/server-config-migration/src/main/resources/cli/read-domain-standalone.cli b/testsuite/integration-arquillian/tests/other/server-config-migration/src/main/resources/cli/read-domain-standalone.cli
new file mode 100644
index 0000000..e9a089a
--- /dev/null
+++ b/testsuite/integration-arquillian/tests/other/server-config-migration/src/main/resources/cli/read-domain-standalone.cli
@@ -0,0 +1,3 @@
+embed-host-controller --domain-config=domain.xml
+
+/profile=auth-server-standalone/subsystem=*/:read-resource(recursive=true)
diff --git a/testsuite/integration-arquillian/tests/other/server-config-migration/src/main/resources/cli/read-standalone.cli b/testsuite/integration-arquillian/tests/other/server-config-migration/src/main/resources/cli/read-standalone.cli
new file mode 100644
index 0000000..400d7c8
--- /dev/null
+++ b/testsuite/integration-arquillian/tests/other/server-config-migration/src/main/resources/cli/read-standalone.cli
@@ -0,0 +1,3 @@
+embed-server --server-config=standalone.xml
+
+/subsystem=*/:read-resource(recursive=true)
diff --git a/testsuite/integration-arquillian/tests/other/server-config-migration/src/main/resources/cli/read-standalone-ha.cli b/testsuite/integration-arquillian/tests/other/server-config-migration/src/main/resources/cli/read-standalone-ha.cli
new file mode 100644
index 0000000..a32fb9c
--- /dev/null
+++ b/testsuite/integration-arquillian/tests/other/server-config-migration/src/main/resources/cli/read-standalone-ha.cli
@@ -0,0 +1,3 @@
+embed-server --server-config=standalone-ha.xml
+
+/subsystem=*/:read-resource(recursive=true)
diff --git a/testsuite/integration-arquillian/tests/other/server-config-migration/src/test/java/org/keycloak/test/config/migration/ConfigMigrationTest.java b/testsuite/integration-arquillian/tests/other/server-config-migration/src/test/java/org/keycloak/test/config/migration/ConfigMigrationTest.java
index 7f5ad34..08f2caa 100644
--- a/testsuite/integration-arquillian/tests/other/server-config-migration/src/test/java/org/keycloak/test/config/migration/ConfigMigrationTest.java
+++ b/testsuite/integration-arquillian/tests/other/server-config-migration/src/test/java/org/keycloak/test/config/migration/ConfigMigrationTest.java
@@ -20,10 +20,23 @@ package org.keycloak.test.config.migration;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Deque;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.stream.Collectors;
 import org.jboss.dmr.ModelNode;
+import org.jboss.logging.Logger;
 import org.junit.Assert;
 import org.junit.Test;
 
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+
 /**
  * Compare outputs from jboss-cli read-resource operations.  This compare the total
  * configuration of all subsystems to make sure that the version in master
@@ -34,22 +47,23 @@ import org.junit.Test;
 public class ConfigMigrationTest {
     
     private static final File TARGET_DIR = new File("./target");
-    private final String migratedVersion = System.getProperty("migrated.version");
+    private final Logger log = Logger.getLogger(ConfigMigrationTest.class);
+    private final Deque<String> nav = new LinkedList<>();
 
     @Test
     public void testStandalone() throws IOException {
-        compareConfigs("master-standalone.txt", "migrated-standalone-" + migratedVersion + ".txt");
+        compareConfigs("master-standalone.txt", "migrated-standalone.txt");
     }
     
     @Test
     public void testStandaloneHA() throws IOException {
-        compareConfigs("master-standalone-ha.txt", "migrated-standalone-ha-" + migratedVersion + ".txt");
+        compareConfigs("master-standalone-ha.txt", "migrated-standalone-ha.txt");
     }
     
     @Test
     public void testDomain() throws IOException {
-        compareConfigs("master-domain-standalone.txt", "migrated-domain-standalone-" + migratedVersion + ".txt");
-        compareConfigs("master-domain-clustered.txt", "migrated-domain-clustered-" + migratedVersion + ".txt");
+        compareConfigs("master-domain-standalone.txt", "migrated-domain-standalone.txt");
+        compareConfigs("master-domain-clustered.txt", "migrated-domain-clustered.txt");
     }
     
     private void compareConfigs(String masterConfig, String migratedConfig) throws IOException {
@@ -66,7 +80,117 @@ public class ConfigMigrationTest {
             // A textual diff might have things out of order.
             ModelNode master = ModelNode.fromStream(masterStream);
             ModelNode migrated = ModelNode.fromStream(migratedStream);
-            Assert.assertEquals(master, migrated);
+
+            if (master.equals(migrated)) {
+                // ok
+            } else {
+                if (Boolean.parseBoolean(System.getProperty("get.simple.full.comparison"))) {
+                    assertThat(migrated, is(equalTo(master)));
+                }
+                compareConfigsDeeply("root", master, migrated);
+            }
+        } 
+    }
+    
+    private void compareConfigsDeeply(String id, ModelNode master, ModelNode migrated) {
+        nav.add(id);
+        
+        master.protect();
+        migrated.protect();
+
+        assertEquals(getMessage(), master.getType(), migrated.getType());
+        
+        switch (master.getType()) {
+            case OBJECT:
+                //check nodes are equal
+                if (master.equals(migrated)) {
+                    break;
+                }
+                //check keys are equal
+                assertThat(getMessage(), migrated.keys(), is(equalTo(master.keys())));
+
+                for (String key : master.keys()) {
+                    compareConfigsDeeply(key, master.get(key), migrated.get(key));
+                }
+                break;
+            case LIST:
+                List<ModelNode> masterAsList = new ArrayList<>(master.asList());
+                List<ModelNode> migratedAsList = new ArrayList<>(migrated.asList());
+                
+                if (masterAsList.equals(migratedAsList)) {
+                    break;
+                }
+                
+                masterAsList.sort(nodeStringComparator);
+                migratedAsList.sort(nodeStringComparator);
+                
+                if (masterAsList.toString().contains("subsystem")) {
+                    assertEquals("Subsystem names are not equal.", 
+                            getSubsystemNames(masterAsList).toString(), 
+                            getSubsystemNames(migratedAsList).toString());
+                }
+
+                //remove equaled nodes and keep just different ones
+                List<ModelNode> diffNodesInMaster = new ArrayList<>(masterAsList);
+                diffNodesInMaster.removeAll(migratedAsList);
+                for (ModelNode diffNodeInMaster : diffNodesInMaster) {
+                    String navigation = diffNodeInMaster.getType().toString();
+                    if (diffNodeInMaster.toString().contains("subsystem")) {
+                        navigation = getSubsystemNames(Arrays.asList(diffNodeInMaster)).toString();
+                    } 
+                    compareConfigsDeeply(navigation, 
+                            diffNodeInMaster, 
+                            migratedAsList.get(masterAsList.indexOf(diffNodeInMaster)));
+                }
+                break;
+            case BOOLEAN:
+                assertEquals(getMessage(), master.asBoolean(), migrated.asBoolean());
+                break;
+            case STRING:
+                assertEquals(getMessage(), master.asString(), migrated.asString());
+                break;
+            case UNDEFINED:
+                //nothing to test
+                break;
+            case LONG:
+                assertEquals(getMessage(), master.asLong(), migrated.asLong());
+                break;
+            case EXPRESSION:
+                assertEquals(getMessage(), master.asExpression(), migrated.asExpression());
+                break;
+            case INT:
+                assertEquals(getMessage(), master.asInt(), migrated.asInt());
+                break;
+            case DOUBLE:
+                assertEquals(getMessage(), master.asDouble(), migrated.asDouble(), new Double("0.0"));
+                break;
+            default:
+                assertThat(getMessage(), migrated, is(equalTo(master)));
+                throw new UnsupportedOperationException(getMessage() + ". There is missing case " + master.getType().name());
+        }
+        nav.pollLast();
+    }
+
+    private static final Comparator<ModelNode> nodeStringComparator = (n1, n2) -> {
+        //ascending order
+        return n1.toString().compareTo(n2.toString());
+    };
+    
+    private String getMessage() {
+        return "* navigation -> " + nav.toString() + " * ";
+    }
+
+    private List<String> getSubsystemNames(List<ModelNode> modelNodes) {
+        int index;
+        if (modelNodes.toString().contains("profile")) {
+            index = 9; //domain
+        } else {
+            index = 5; //standalone
         }
+        return modelNodes
+                .stream()
+                .map(ModelNode::toString)
+                .map(s -> s.split("\"")[index])
+                .collect(Collectors.toList());
     }
 }
diff --git a/testsuite/integration-arquillian/tests/other/server-config-migration/src/test/resources/domain/keycloak-server-1.8.1.json b/testsuite/integration-arquillian/tests/other/server-config-migration/src/test/resources/domain/keycloak-server-1.8.1.json
index 89263bf..a5b4d1b 100644
--- a/testsuite/integration-arquillian/tests/other/server-config-migration/src/test/resources/domain/keycloak-server-1.8.1.json
+++ b/testsuite/integration-arquillian/tests/other/server-config-migration/src/test/resources/domain/keycloak-server-1.8.1.json
@@ -1,6 +1,6 @@
 {
     "providers": [
-        "classpath:${jboss.home.dir}/providers/*"
+        "classpath:${jboss.server.config.dir}/providers/*"
     ],
 
     "admin": {
@@ -22,30 +22,21 @@
         "provider": "jpa"
     },
 
-    "userCache": {
-        "default" : {
-            "enabled": true
-        }
-    },
-
     "userSessionPersister": {
         "provider": "jpa"
     },
 
-    "authorizationPersister": {
-        "provider": "jpa"
-    },
-
     "timer": {
         "provider": "basic"
     },
 
     "theme": {
+        "default": "keycloak",
         "staticMaxAge": 2592000,
         "cacheTemplates": true,
         "cacheThemes": true,
         "folder": {
-          "dir": "${jboss.home.dir}/themes"
+          "dir": "${jboss.server.config.dir}/themes"
         }
     },
 
@@ -64,15 +55,8 @@
         }
     },
 
-    "realmCache": {
-        "default" : {
-            "enabled": true
-        }
-    },
-
     "connectionsInfinispan": {
-        "provider": "default",
-        "default": {
+        "default" : {
             "cacheContainer" : "java:comp/env/infinispan/Keycloak"
         }
     }
diff --git a/testsuite/integration-arquillian/tests/other/server-config-migration/src/test/resources/standalone/keycloak-server-1.8.1.json b/testsuite/integration-arquillian/tests/other/server-config-migration/src/test/resources/standalone/keycloak-server-1.8.1.json
index 89263bf..a5b4d1b 100644
--- a/testsuite/integration-arquillian/tests/other/server-config-migration/src/test/resources/standalone/keycloak-server-1.8.1.json
+++ b/testsuite/integration-arquillian/tests/other/server-config-migration/src/test/resources/standalone/keycloak-server-1.8.1.json
@@ -1,6 +1,6 @@
 {
     "providers": [
-        "classpath:${jboss.home.dir}/providers/*"
+        "classpath:${jboss.server.config.dir}/providers/*"
     ],
 
     "admin": {
@@ -22,30 +22,21 @@
         "provider": "jpa"
     },
 
-    "userCache": {
-        "default" : {
-            "enabled": true
-        }
-    },
-
     "userSessionPersister": {
         "provider": "jpa"
     },
 
-    "authorizationPersister": {
-        "provider": "jpa"
-    },
-
     "timer": {
         "provider": "basic"
     },
 
     "theme": {
+        "default": "keycloak",
         "staticMaxAge": 2592000,
         "cacheTemplates": true,
         "cacheThemes": true,
         "folder": {
-          "dir": "${jboss.home.dir}/themes"
+          "dir": "${jboss.server.config.dir}/themes"
         }
     },
 
@@ -64,15 +55,8 @@
         }
     },
 
-    "realmCache": {
-        "default" : {
-            "enabled": true
-        }
-    },
-
     "connectionsInfinispan": {
-        "provider": "default",
-        "default": {
+        "default" : {
             "cacheContainer" : "java:comp/env/infinispan/Keycloak"
         }
     }
diff --git a/testsuite/integration-arquillian/tests/pom.xml b/testsuite/integration-arquillian/tests/pom.xml
index a00aa5d..f4dcc81 100755
--- a/testsuite/integration-arquillian/tests/pom.xml
+++ b/testsuite/integration-arquillian/tests/pom.xml
@@ -113,6 +113,8 @@
         <testsuite.constants>${project.build.directory}/dependency/test-constants.properties</testsuite.constants>
 
         <skip.add.user.json>false</skip.add.user.json>
+        <skip.clean.second.cache>true</skip.clean.second.cache>
+        <skip.copy.auth.crossdc.nodes>true</skip.copy.auth.crossdc.nodes>
         <client.certificate.keystore>${auth.server.config.dir}/client.jks</client.certificate.keystore>
         <client.certificate.keystore.passphrase>secret</client.certificate.keystore.passphrase>
         <client.truststore>${auth.server.config.dir}/keycloak.truststore</client.truststore>
@@ -204,6 +206,7 @@
                             <phase>process-test-resources</phase>
                             <goals><goal>run</goal></goals>
                             <configuration>
+                                <skip>${skip.clean.second.cache}</skip>
                                 <target>
                                     <echo>${cache.server.home}/standalone-dc-2</echo>
                                     <delete failonerror="false" dir="${cache.server.home}/standalone-dc-2" />
@@ -509,6 +512,7 @@
                                         <goal>run</goal>
                                     </goals>
                                     <configuration>
+                                        <skip>${skip.copy.auth.crossdc.nodes}</skip>
                                         <target>
                                             <move todir="${auth.server.crossdc01.home}">
                                                 <fileset dir="${auth.server.home}"/>
@@ -608,16 +612,6 @@
                             </systemPropertyVariables>
                         </configuration>
                     </plugin>
-                    <plugin>
-                        <artifactId>maven-antrun-plugin</artifactId>
-                        <configuration>
-                            <!--
-                                skipping execution for <artifactId>integration-arquillian-tests</artifactId>,
-                                it's re-enabled in <artifactId>integration-arquillian-tests-base</artifactId>
-                            -->
-                            <skip>true</skip>
-                        </configuration>
-                    </plugin>
                 </plugins>
             </build>
         </profile>