pom.xml

539 lines | 26.351 kB Blame History Raw Download
<?xml version="1.0"?>
<!--
~ 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.
-->

<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">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.keycloak.testsuite</groupId>
        <artifactId>integration-arquillian-tests-other</artifactId>
        <version>4.0.0.Beta2</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    
    <groupId>org.keycloak.testsuite</groupId>
    <artifactId>server-config-migration</artifactId>

    <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>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss</groupId>
            <artifactId>jboss-dmr</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-server-dist</artifactId>
            <type>zip</type>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-keycloak-server-dist</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.keycloak</groupId>
                                    <artifactId>keycloak-server-dist</artifactId>
                                    <version>${master.version}</version>
                                    <type>zip</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${project.build.directory}</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-standalone-resources</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <overwrite>true</overwrite>
                            <outputDirectory>${jbossHome}/standalone/configuration</outputDirectory>
                            <resources>          
                                <resource>
                                    <directory>src/test/resources/standalone</directory>
                                    <filtering>false</filtering>
                                </resource>
                            </resources>              
                        </configuration>            
                    </execution>
                    <execution>
                        <id>copy-domain-resources</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <overwrite>true</overwrite>
                            <outputDirectory>${jbossHome}/domain/configuration</outputDirectory>
                            <resources>          
                                <resource>
                                    <directory>src/test/resources/domain</directory>
                                    <filtering>false</filtering>
                                </resource>
                            </resources>              
                        </configuration>            
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>rename-migrated-resources</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <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>read-master-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-standalone.cli</argument>
                            </arguments>
                            <outputFile>${project.build.directory}/master-standalone.txt</outputFile>
                        </configuration>
                    </execution>
                    <execution>
                        <id>read-master-standalone-ha</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-standalone-ha.cli</argument>
                            </arguments>
                            <outputFile>${project.build.directory}/master-standalone-ha.txt</outputFile>
                        </configuration>
                    </execution>
                    <execution>
                        <id>read-master-domain-core-service</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-core-service.cli</argument>
                            </arguments>
                            <outputFile>${project.build.directory}/master-domain-core-service.txt</outputFile>
                        </configuration>
                    </execution>
                    <execution>
                        <id>read-master-domain-extension</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-extension.cli</argument>
                            </arguments>
                            <outputFile>${project.build.directory}/master-domain-extension.txt</outputFile>
                        </configuration>
                    </execution>
                    <execution>
                        <id>read-master-domain-interface</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-interface.cli</argument>
                            </arguments>
                            <outputFile>${project.build.directory}/master-domain-interface.txt</outputFile>
                        </configuration>
                    </execution>
                    <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>process-test-sources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>./jboss-cli.sh</executable>
                            <workingDirectory>${jbossHome}/bin</workingDirectory>
                            <arguments>
                                <argument>--file=migrate-standalone.cli</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>migrate-standalone-ha</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-standalone-ha.cli</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>migrate-domain-standalone</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-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>
                    
                    <execution>
                        <id>read-migrated-standalone</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-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>exec</goal>
                        </goals>
                        <configuration>
                            <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-migrated-domain-core-service</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-core-service.cli</argument>
                            </arguments>
                            <outputFile>${project.build.directory}/migrated-domain-core-service.txt</outputFile>
                        </configuration>
                    </execution>
                    <execution>
                        <id>read-migrated-domain-extension</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-extension.cli</argument>
                            </arguments>
                            <outputFile>${project.build.directory}/migrated-domain-extension.txt</outputFile>
                        </configuration>
                    </execution>
                    <execution>
                        <id>read-migrated-domain-interface</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-interface.cli</argument>
                            </arguments>
                            <outputFile>${project.build.directory}/migrated-domain-interface.txt</outputFile>
                        </configuration>
                    </execution>
                    <execution>
                        <id>read-migrated-domain-standalone</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-standalone.cli</argument>
                            </arguments>
                            <outputFile>${project.build.directory}/migrated-domain-standalone.txt</outputFile>
                        </configuration>
                    </execution>
                    <execution>
                        <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>shutdown</goal>
                        </goals>
                        <configuration>
                            <serverConfig>standalone.xml</serverConfig>
                        </configuration>
                    </execution>
                    <execution>
                        <id>start-stop-standalone-ha</id>
                        <phase>generate-test-resources</phase>
                        <goals>
                            <goal>start</goal>
                            <goal>shutdown</goal>
                        </goals>
                        <configuration>
                            <serverConfig>standalone-ha.xml</serverConfig>
                        </configuration>
                    </execution>
                    <execution>
                        <id>start-stop-domain</id>
                        <phase>generate-test-resources</phase>
                        <goals>
                            <goal>start</goal>
                            <goal>shutdown</goal>
                        </goals>
                        <configuration>
                            <serverType>DOMAIN</serverType>
                            <domainConfig>domain.xml</domainConfig>
                            <server-args>
                                <server-arg>--host-config=host-master.xml</server-arg>
                            </server-args>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>