Merge pull request #1629 from tkyjovsk/master-squashed

Updates and refactoring of arquillian testsuite.
This commit is contained in:
Stian Thorgersen 2015-09-18 15:12:12 +02:00
commit 09488b8df3
365 changed files with 20190 additions and 3446 deletions

10
pom.xml
View file

@ -1332,7 +1332,6 @@
<id>distribution</id> <id>distribution</id>
<modules> <modules>
<module>distribution</module> <module>distribution</module>
<module>testsuite/integration-arquillian</module>
</modules> </modules>
</profile> </profile>
@ -1341,7 +1340,6 @@
<modules> <modules>
<module>docbook</module> <module>docbook</module>
<module>distribution</module> <module>distribution</module>
<module>testsuite/integration-arquillian</module>
</modules> </modules>
</profile> </profile>
@ -1364,6 +1362,14 @@
</build> </build>
</profile> </profile>
<profile>
<id>arquillian-integration-tests</id>
<modules>
<module>distribution</module>
<module>testsuite/integration-arquillian</module>
</modules>
</profile>
<!-- Configure the JBoss Early Access Maven repository --> <!-- Configure the JBoss Early Access Maven repository -->
<profile> <profile>
<id>jboss-earlyaccess-repository</id> <id>jboss-earlyaccess-repository</id>

View file

@ -1,21 +1,61 @@
Testing admin console with Arquillian # Keycloak Integration Testsuite with Arquillian
=====================================
There are currently two ways of running the tests with help of Arquillian. ## Structure
Remote mode ```
---------- integration-arquillian
├──servers (submodules enabled via profiles)
│ ├──wildfly
│ └──eap6
└──tests
├──base
└──adapters (submodules enabled via profiles, all depend on base)
├──wildfly
├──wildfly-relative (needs servers/wildfly)
├──wildfly8
├──as7
├──tomcat
└──karaf
Just simply typle `mvn verify` and you are all set. This requires the instance of Wildfly with embedded Keycloak to be already running. ```
Managed mode ## General Concepts
------------
You need to pass two arguments to Maven, first is location of your Wildfly server with embedded Keycloak and the other is name of the profile. The testsuite supports **multiple server runtimes** for the Keycloak server.
The **default is Undertow** which is the fastest and easiest option, and runs in the same JVM as the tests.
mvn verify -Pwildfly-8-managed -DjbossHome=/your/server/location Other options are **Wildfly 9** and **EAP 6**. These have some additional requirements and limitations:
1. The selected server module must be built before any tests can be run.
All server-side configuration is done during this build (e.g. datasource configuration).
Once server artifact is built the tests modules can unpack it via `maven-dependency-plugin` into their working directory before running.
2. Before the selected server module can be built the `keycloak/distribution` module also needs to be built.
Browser ### Server Runtimes
-------
There are currently two supported browsers - PhantomJS and Firefox. PhantomJS is the default one, in order to use Firefox just specify `-Dbrowser=firefox` parameter in the Maven command. TODO: explain why separate module, list config options, note on migration modules
### Base Testsuite
login flows + account management
admin ui
abstract adapter tests
### Adapter Tests
test servlets: demo, session
examples
## Running the Tests
### Undertow
### Wildfly or EAP 6
### Adapters
### Supported Browsers

View file

@ -0,0 +1,189 @@
# Keycloak Integration Testsuite with Arquillian
*OUT OF DATE - NEEDS REWRITE*
## Usage
Running the tests: `mvn test` or `mvn clean test`
## Test suite
### Selecting container for Keycloak Server
The testsuite requires a container for Keycloak Server to be selected.
This container is used by all tests in the suite during a single test execution.
*By default* the tests run with server on embedded *Undertow*.
A different container can be selected with profile, e.g. `-Pauth-server-wildfly`.
### Containers Supported for Keycloak Server
| Container | Arquillian Qualifier | Maven | Dependencies |
| --- | --- | --- | --- |
| **Undertow** | `auth-server-undertow` | **default** | `undertow-core`, `resteasy-undertow` |
| **Wildfly 9** | `auth-server-wildfly` | `-Pauth-server-wildfly` | `keycloak-server-dist` or `wildfly-dist`+`keycloak-server-overlay` |
| **EAP 6.4** | `auth-server-eap6` | `-Pauth-server-eap6` | `keycloak-server-dist` or `eap6-dist`+`keycloak-server-overlay` |
See the relevant container definitions in `arquillian.xml` located in the **test resources** folder.
### Test Class Hierarchy
```
AbstractKeycloakTest
├── AbstractAdminConsoleTest
└── AbstractAdapterTest
```
### AbstractKeycloakTest
Handles test realms. Provides Admin Client for REST operations.
* **@BeforeClass**
1. Updates the admin password to enable the admin user.
* **@Before**
1. Initiates admin client
2. Imports test realms. (Loading test realms is overriden in subclasses.)
* **@After**
1. Removes test realms.
2. Closes admin client.
### ContainersTestEnricher
Manages *container lifecycles*.
`ContainersTestEnricher` is a custom Arquillian observer that handles lifecycles of auth server and app server containers for each test class.
Containers are started during `@BeforeClass` and shut down during `@AfterClass` event.
*Optionally* each test class can be annotated with `@AuthServerContainer("qualifier")` and `@AppServerConatiner("qualifier")` annotations
to indicate containers required for the test.
* In case `@AuthServerContainer` is not present the *auth server qualifier* is loaded from `auth.server.container` property.
* In case `@AppServerContainer` is not present or it's value is the same as *auth server qualifier*, the app server isn't started for the test class.
## Admin Console Tests
Tests for admin console are located in `org/keycloak/testsuite/console`.
Related non-test classes are located on the same path in the **main sources**.
Admin console tests are **ENABLED by default**. They can be disabled by `-P no-console`.
## Adapter Tests
Adapter tests are located in `org/keycloak/testsuite/adapter`.
Related non-test classes can be found on the same path in the **main sources**.
Adapter tests are **DISABLED by default**. They can be enabled by profiles.
Multiple profiles can be enabled for a single test execution.
*Note:* When testing adapter with multiple containers in a single run it is better
to use the `--fail-at-end` (`-fae`) strategy instead of the default `--fail-fast` one.
This will allow Maven to continue building other modules even if some of them have test failures.
### Containers Supported for Adapter Tests
| Container | Arquillian Qualifier | Maven | Dependencies |
| --- | --- | --- | --- |
| **Wildfly 9** Relative | `auth-server-wildfly` | `-Pauth-server-wildfly` | `keycloak-server-dist` or `wildfly-dist`+`keycloak-server-overlay`, `keycloak-adapter-dist-wf9` |
| **Wildfly 9** | `app-server-wildfly` | `-Papp-server-wildfly` | `wildfly-dist`, `keycloak-adapter-dist-wf9` |
| **Wildfly 8** | `app-server-wildfly` | `-Papp-server-wildfly8` | `wildfly-dist:8.2.1.Final`, `keycloak-adapter-dist-wf8` |
| **JBoss AS 7** | `app-server-as7` | `-Papp-server-as7` | `jboss-as-dist`, `keycloak-adapter-dist-as7` |
| **Tomcat 8** | `app-server-tomcat` | `-Papp-server-tomcat` | `tomcat`, `keycloak-tomcat8-adapter-dist` |
| **Karaf 3** | `app-server-karaf` | `-Papp-server-karaf` | `apache-camel`, `apache-cxf`, `keycloak-osgi-features`, `keycloak-fuse-example-features` |
See the relevant container definitions in `tests/adapter/<container>/src/main/xslt/arquillian.xsl`.
***Important:*** Arquillian cannot load multiple controllers for JBossAS/Wildfly containers in a single run (because same class name)
but a different controller is required for JBossAS7/EAP6 than for WF8/9. Because of this:
- Adapter tests for *Wildfly 8/9* cannot be run against server on *EAP 6*. `-Papp-server-wildfly*``!auth-server-eap6`
- Adapter tests for *JBossAS 7* can only be run against server on *EAP 6*. `-Papp-server-as7,auth-server-eap6`
### Adapter Test Types
1. Using **test servlets**.
2. Using **example/demo wars**.
```
AbstractKeycloakTest
└── AbstractAdapterTest
├── AbstractServletsAdapterTest
| ├── Relative…
| ├── Wildfly…
| ├── Tomcat…
| …
└── AbstractExampleAdapterTest
├── AbstractDemoExampleAdapterTest
| ├── Relative…
| ├── Wildfly…
| ├── Tomcat…
| …
├── AbstractBasicAuthExampleAdapterTest
| ├── Relative…
| ├── Wildfly…
| ├── Tomcat…
| …
```
### Relative vs Non-relative scenario
The test suite can handle both types.
It automatically modifies imported test realms and deployments' adapter configs based on scenario type.
| Scenario | Description | Realm config (server side) | Adapter config (client side) |
| --- | --- | --- | --- |
| **Relative** | Both Keycloak Server and test apps running in the same container. | client `baseUrl`, `adminUrl` and `redirect-uris` can be relative | `auth-server-url` can be relative |
| **Non-relative** | Test apps run in a different container than Keycloak Server. | client `baseUrl`, `adminUrl` and `redirect-uris` need to include FQDN of the app server | `auth-server-url` needs to include FQDN of the auth server|
### Adapter Libraries Mode
1. **Provided.** By container, e.g. as a subsystem. *Default.*
2. **Bundled.** In the deployed war in `/WEB-INF/libs`. Enable with `-Dadapter.libs.bundled`. *Wildfly only*.
### Adapter Config Mode
1. ~~**Provided.** In `standalone.xml` using `secure-deployment`. *Wildfly only.*~~ WIP
2. **Bundled.** In the deployed war in `/WEB-INF/keycloak.json`. *Default.*
### Adapters Test Coverage
| Module | Coverage | Supported Containers |
| --- | --- | --- |
| ***Test Servlets*** | Good | All |
| **Demo** | Minimal, WIP | `auth-server-wildfly` (relative) |
| **Admin Client** | |
| **Cordova** | |
| **CORS** | |
| **JS Console** | Good | `auth-server-wildfly` (relative) |
| **Providers** | |
| Themes | |
| Multitenancy | WIP | |
| **Basic Auth** | Good | All |
| **Fuse** | Good | `app-server-karaf` |
| SAML | |
| LDAP | |
| Kerberos | |
## Supported Browsers
| Browser | Maven |
| --- | --- |
| **PhantomJS** | `-Dbrowser=phantomjs` **default** |
| **Firefox** | `-Dbrowser=firefox` |
## Custom Arquillian Extensions
Custom extensions are registered in `META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension`.
* Multiple containers extension
* Replaces Arquillian's default container handling.
* Allows to manage multiple container instances of different types within a single test run.
* Allows to skip loading disabled containers based on `enabled` config property in `arquillian.xml`.
* Custom extension
* `ContainersTestEnricher` - Handles lifecycles of auth-server and app-server.
* `CustomUndertowContainer` - A custom container controller for JAX-RS-enabled Undertow with Keycloak Server.
* `DeploymentArchiveProcessor` - Modifies adapter config before deployment on app server based on relative/non-relative scenario.
* `URLProvider` - Fixes URLs injected by Arquillian which contain 127.0.0.1 instead of localhost.
* `JiraTestExecutionDecider` - Skipping tests for unresolved JIRAs.

View file

@ -2,190 +2,44 @@
<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">
<parent> <parent>
<artifactId>keycloak-testsuite-pom</artifactId>
<groupId>org.keycloak</groupId> <groupId>org.keycloak</groupId>
<artifactId>keycloak-testsuite-pom</artifactId>
<version>1.6.0.Final-SNAPSHOT</version> <version>1.6.0.Final-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>keycloak-testsuite-integration-arquillian</artifactId> <groupId>org.keycloak.testsuite</groupId>
<name>KeyCloak Arquillian TestSuite</name> <artifactId>integration-arquillian</artifactId>
<packaging>pom</packaging>
<properties> <name>Keycloak Integration TestSuite with Arquillian</name>
<browser>phantomjs</browser>
<modules>
<arquillian-core.version>1.1.5.Final</arquillian-core.version> <module>servers</module>
<selenium.version>2.45.0</selenium.version> <module>tests</module>
<arquillian-drone.version>1.3.1.Final</arquillian-drone.version> </modules>
<arquillian-phantomjs.version>1.1.4.Final</arquillian-phantomjs.version>
<arquillian-graphene.version>2.0.3.Final</arquillian-graphene.version> <build>
<arquillian-wildfly-container.version>8.1.0.Final</arquillian-wildfly-container.version> <pluginManagement>
<plugins>
<!-- Used in profile "wildfly-8-remote". <plugin>
Set to "false" if admin password has already been updated after first login. --> <groupId>org.apache.maven.plugins</groupId>
<firstAdminLogin>true</firstAdminLogin> <artifactId>maven-surefire-plugin</artifactId>
</properties> <version>2.18.1</version>
</plugin>
<dependencyManagement> <plugin>
<dependencies> <groupId>org.codehaus.mojo</groupId>
<dependency> <artifactId>xml-maven-plugin</artifactId>
<groupId>org.jboss.arquillian.selenium</groupId> <version>1.0</version>
<artifactId>selenium-bom</artifactId> </plugin>
<version>${selenium.version}</version> <plugin>
<type>pom</type> <groupId>org.apache.maven.plugins</groupId>
<scope>import</scope> <artifactId>maven-dependency-plugin</artifactId>
</dependency> <version>2.10</version>
<dependency> </plugin>
<groupId>org.jboss.arquillian</groupId> </plugins>
<artifactId>arquillian-bom</artifactId> </pluginManagement>
<version>${arquillian-core.version}</version> </build>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-drone-bom</artifactId>
<version>${arquillian-drone.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-remote</artifactId>
<version>${arquillian-wildfly-container.version}</version>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId>
<version>${arquillian-wildfly-container.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.graphene</groupId>
<artifactId>graphene-webdriver</artifactId>
<version>${arquillian-graphene.version}</version>
<type>pom</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-phantom-driver</artifactId>
<version>${arquillian-phantomjs.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-server-dist</artifactId>
<scope>test</scope>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
</dependencies>
<profiles>
<profile>
<id>wildfly-8-remote</id>
<dependencies>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-remote</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<shouldDeploy>false</shouldDeploy>
<arquillian.launch>wildfly-8-remote</arquillian.launch>
<browser>${browser}</browser>
<firstAdminLogin>${first.login}</firstAdminLogin>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>wildfly-8-managed</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<install.directory>${project.build.directory}/install</install.directory>
<jbossHome>${install.directory}/keycloak-${project.version}</jbossHome>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>unpack</id>
<phase>process-test-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-server-dist</artifactId>
<type>zip</type>
<overWrite>false</overWrite>
</artifactItem>
</artifactItems>
<outputDirectory>${install.directory}</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<shouldDeploy>false</shouldDeploy>
<arquillian.launch>wildfly-8-managed</arquillian.launch>
<browser>${browser}</browser>
<jbossHome>${jbossHome}</jbossHome>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project> </project>

View file

@ -0,0 +1,29 @@
<assembly>
<id>auth-server-eap6</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${keycloak.server.home}</directory>
<outputDirectory>keycloak-${project.version}</outputDirectory>
<excludes>
<exclude>**/*.sh</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>${keycloak.server.home}</directory>
<outputDirectory>keycloak-${project.version}</outputDirectory>
<includes>
<include>**/*.sh</include>
</includes>
<fileMode>0755</fileMode>
</fileSet>
</fileSets>
</assembly>

View file

@ -0,0 +1,184 @@
<?xml version="1.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">
<parent>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers</artifactId>
<version>1.6.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-arquillian-server-eap6</artifactId>
<packaging>pom</packaging>
<name>Server on EAP 6</name>
<properties>
<keycloak.server.home>${project.build.directory}/unpacked/jboss-eap-6.4</keycloak.server.home>
</properties>
<dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-dist</artifactId>
<version>${jboss.version}</version>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-server-overlay-eap6</artifactId>
<version>${project.version}</version>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-eap6-adapter-dist</artifactId>
<type>zip</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-eap6-and-server-overlay</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-dist</artifactId>
<version>${jboss.version}</version>
<type>zip</type>
<outputDirectory>${project.build.directory}/unpacked</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-server-overlay-eap6</artifactId>
<version>${project.version}</version>
<type>zip</type>
<outputDirectory>${keycloak.server.home}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>move-standalone-keycloak-xml</id>
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<move file="${keycloak.server.home}/standalone/configuration/standalone-keycloak.xml"
tofile="${keycloak.server.home}/standalone/configuration/standalone.xml"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>create-zip</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>adapter-libs-provided</id>
<activation>
<property>
<name>!adapter.libs.bundled</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-adapter</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-eap6-adapter-dist</artifactId>
<version>${project.version}</version>
<type>zip</type>
<outputDirectory>${keycloak.server.home}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
<id>configure-adapter-subsystem</id>
<phase>process-resources</phase>
<goals>
<goal>transform</goal>
</goals>
<configuration>
<transformationSets>
<transformationSet>
<dir>${keycloak.server.home}/standalone/configuration</dir>
<includes>
<include>standalone.xml</include>
</includes>
<stylesheet>src/main/xslt/standalone.xsl</stylesheet>
<outputDir>${keycloak.server.home}/standalone/configuration</outputDir>
</transformationSet>
</transformationSets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View file

@ -0,0 +1,94 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:j="urn:jboss:domain:3.0"
xmlns:ds="urn:jboss:domain:datasources:3.0"
xmlns:k="urn:jboss:domain:keycloak:1.1"
xmlns:sec="urn:jboss:domain:security:1.2"
version="2.0"
exclude-result-prefixes="xalan j ds k sec">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:strip-space elements="*"/>
<xsl:variable name="nsDS" select="'urn:jboss:domain:datasources:'"/>
<!-- Remove keycloak datasource definition. -->
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='datasource' and starts-with(namespace-uri(), $nsDS) and @pool-name='KeycloakDS']">
</xsl:template>
<xsl:param name="jdbc.url" select="'jdbc:h2:${jboss.server.data.dir}/keycloak;AUTO_SERVER=TRUE'"/>
<xsl:param name="driver" select="'h2'"/>
<xsl:param name="username" select="'sa'"/>
<xsl:param name="password" select="'sa'"/>
<xsl:param name="min.poolsize" select="'10'"/>
<xsl:param name="max.poolsize" select="'50'"/>
<xsl:param name="pool.prefill" select="'true'"/>
<xsl:variable name="newDatasourceDefinition">
<datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true">
<connection-url>
<xsl:value-of select="$jdbc.url"/>
</connection-url>
<driver>
<xsl:value-of select="$driver"/>
</driver>
<security>
<user-name>
<xsl:value-of select="$username"/>
</user-name>
<password>
<xsl:value-of select="$password"/>
</password>
</security>
<pool>
<min-pool-size>
<xsl:value-of select="$min.poolsize"/>
</min-pool-size>
<max-pool-size>
<xsl:value-of select="$max.poolsize"/>
</max-pool-size>
<prefill>
<xsl:value-of select="$pool.prefill"/>
</prefill>
</pool>
</datasource>
</xsl:variable>
<xsl:variable name="newDriverDefinition">
<xsl:if test="$driver != 'h2'">
<driver name="{$driver}" module="com.{$driver}" />
</xsl:if>
</xsl:variable>
<!-- Add new datasource definition. -->
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]">
<xsl:copy>
<xsl:copy-of select="$newDatasourceDefinition"/>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<!-- Add new driver definition. -->
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='drivers' and starts-with(namespace-uri(), $nsDS)]">
<xsl:copy>
<xsl:copy-of select="$newDriverDefinition"/>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<!-- Copy everything else. -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,33 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:m="urn:jboss:module:1.3"
version="2.0"
exclude-result-prefixes="xalan m">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" />
<xsl:param name="database" select="''"/>
<xsl:param name="version" select="''"/>
<xsl:variable name="newModuleDefinition">
<module xmlns="urn:jboss:module:1.3" name="com.{$database}">
<resources>
<resource-root path="{$database}-{$version}.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
</xsl:variable>
<!-- clear whole document -->
<xsl:template match="/*" />
<!-- Copy new module definition. -->
<xsl:template match="/*">
<xsl:copy-of select="$newModuleDefinition"/>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,51 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:j="urn:jboss:domain:1.7"
xmlns:ds="urn:jboss:domain:datasources:1.2"
xmlns:k="urn:jboss:domain:keycloak:1.1"
xmlns:sec="urn:jboss:domain:security:1.1"
version="2.0"
exclude-result-prefixes="xalan j ds k sec">
<xsl:param name="config"/>
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="//j:extensions">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<extension module="org.keycloak.keycloak-adapter-subsystem"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//j:profile">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<subsystem xmlns="urn:jboss:domain:keycloak:1.1"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//sec:security-domains">
<xsl:copy>
<xsl:apply-templates select="node()[name(.)='security-domain']"/>
<security-domain name="keycloak">
<authentication>
<login-module code="org.keycloak.adapters.jboss.KeycloakLoginModule" flag="required"/>
</authentication>
</security-domain>
<security-domain name="sp" cache-type="default">
<authentication>
<login-module code="org.picketlink.identity.federation.bindings.wildfly.SAML2LoginModule" flag="required"/>
</authentication>
</security-domain>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,49 @@
<?xml version="1.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">
<parent>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian</artifactId>
<version>1.6.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-arquillian-servers</artifactId>
<packaging>pom</packaging>
<name>Servers</name>
<profiles>
<profile>
<id>auth-server-wildfly</id>
<modules>
<module>wildfly</module>
</modules>
</profile>
<profile>
<id>auth-server-eap6</id>
<modules>
<!--doesn't work yet, WIP-->
<module>eap6</module>
</modules>
</profile>
<profile>
<id>migration-kc14</id>
<modules>
<module>wildfly_kc14</module>
</modules>
</profile>
<profile>
<id>migration-kc13</id>
<modules>
<module>wildfly_kc13</module>
</modules>
</profile>
<profile>
<id>migration-kc12</id>
<modules>
<module>wildfly_kc12</module>
</modules>
</profile>
</profiles>
</project>

View file

@ -0,0 +1,29 @@
<assembly>
<id>auth-server-wildfly</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${keycloak.server.home}</directory>
<outputDirectory>keycloak-${project.version}</outputDirectory>
<excludes>
<exclude>**/*.sh</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>${keycloak.server.home}</directory>
<outputDirectory>keycloak-${project.version}</outputDirectory>
<includes>
<include>**/*.sh</include>
</includes>
<fileMode>0755</fileMode>
</fileSet>
</fileSets>
</assembly>

View file

@ -0,0 +1,372 @@
<?xml version="1.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">
<parent>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers</artifactId>
<version>1.6.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-arquillian-server-wildfly</artifactId>
<packaging>pom</packaging>
<name>Server on Wildfly</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>create-zip</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>server-overlay</id>
<activation>
<property>
<name>server-overlay</name>
</property>
</activation>
<properties>
<keycloak.server.home>${project.build.directory}/unpacked/wildfly-${wildfly.version}</keycloak.server.home>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-wildfly-and-server-overlay</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-dist</artifactId>
<version>${wildfly.version}</version>
<type>zip</type>
<outputDirectory>${project.build.directory}/unpacked</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-server-overlay</artifactId>
<version>${project.version}</version>
<type>zip</type>
<outputDirectory>${keycloak.server.home}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>move-standalone-keycloak-xml</id>
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<move file="${keycloak.server.home}/standalone/configuration/standalone-keycloak.xml"
tofile="${keycloak.server.home}/standalone/configuration/standalone.xml"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>server-dist</id>
<activation>
<property>
<name>!server-overlay</name>
</property>
</activation>
<properties>
<keycloak.server.home>${project.build.directory}/unpacked/keycloak-${project.version}</keycloak.server.home>
</properties>
<dependencies>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-server-dist</artifactId>
<type>zip</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-server</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-server-dist</artifactId>
<version>${project.version}</version>
<type>zip</type>
<outputDirectory>${project.build.directory}/unpacked</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>adapter-libs-provided</id>
<activation>
<property>
<name>!adapter.libs.bundled</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-wf9-adapter-dist</artifactId>
<type>zip</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-adapter</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-wf9-adapter-dist</artifactId>
<version>${project.version}</version>
<type>zip</type>
<outputDirectory>${keycloak.server.home}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
<id>configure-adapter-subsystem</id>
<phase>process-resources</phase>
<goals>
<goal>transform</goal>
</goals>
<configuration>
<transformationSets>
<transformationSet>
<dir>${keycloak.server.home}/standalone/configuration</dir>
<includes>
<include>standalone.xml</include>
</includes>
<stylesheet>src/main/xslt/standalone.xsl</stylesheet>
<outputDir>${keycloak.server.home}/standalone/configuration</outputDir>
</transformationSet>
</transformationSets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>jpa</id>
<properties>
<jdbc.mvn.driver.deployment.dir>${keycloak.server.home}/modules/system/layers/base/com/${jdbc.mvn.artifactId}/main</jdbc.mvn.driver.deployment.dir>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>enforce-properties</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireProperty>
<property>jdbc.mvn.groupId</property>
</requireProperty>
<requireProperty>
<property>jdbc.mvn.artifactId</property>
</requireProperty>
<requireProperty>
<property>jdbc.mvn.version</property>
</requireProperty>
<requireProperty>
<property>keycloak.connectionsJpa.url</property>
</requireProperty>
<requireProperty>
<property>keycloak.connectionsJpa.user</property>
</requireProperty>
<requireProperty>
<property>keycloak.connectionsJpa.password</property>
</requireProperty>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>jdbc-driver</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${jdbc.mvn.groupId}</groupId>
<artifactId>${jdbc.mvn.artifactId}</artifactId>
<version>${jdbc.mvn.version}</version>
<type>jar</type>
</artifactItem>
</artifactItems>
<outputDirectory>${jdbc.mvn.driver.deployment.dir}</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
<id>configure-wildfly-datasource</id>
<phase>process-resources</phase>
<goals>
<goal>transform</goal>
</goals>
<configuration>
<transformationSets>
<!-- create module.xml in modules -->
<transformationSet>
<dir>${keycloak.server.home}/modules/system/layers/base/com/h2database/h2/main</dir>
<stylesheet>src/main/xslt/module.xsl</stylesheet>
<includes>
<include>module.xml</include>
</includes>
<outputDir>${jdbc.mvn.driver.deployment.dir}</outputDir>
<parameters>
<parameter>
<name>database</name>
<value>${jdbc.mvn.artifactId}</value>
</parameter>
<parameter>
<name>version</name>
<value>${jdbc.mvn.version}</value>
</parameter>
</parameters>
</transformationSet>
<!-- add datasource to standalone.xml -->
<transformationSet>
<dir>${keycloak.server.home}/standalone/configuration</dir>
<stylesheet>src/main/xslt/datasource.xsl</stylesheet>
<includes>
<include>standalone.xml</include>
</includes>
<outputDir>${keycloak.server.home}/standalone/configuration</outputDir>
<parameters>
<parameter>
<name>jdbc.url</name>
<value>${keycloak.connectionsJpa.url}</value>
</parameter>
<parameter>
<name>driver</name>
<value>${jdbc.mvn.artifactId}</value>
</parameter>
<parameter>
<name>username</name>
<value>${keycloak.connectionsJpa.user}</value>
</parameter>
<parameter>
<name>password</name>
<value>${keycloak.connectionsJpa.password}</value>
</parameter>
</parameters>
</transformationSet>
<!-- add logger for org.hibernate.dialect.Dialect -->
<transformationSet>
<dir>${keycloak.server.home}/standalone/configuration</dir>
<stylesheet>src/main/xslt/add-dialect-logger.xsl</stylesheet>
<includes>
<include>standalone.xml</include>
</includes>
<outputDir>${keycloak.server.home}/standalone/configuration</outputDir>
</transformationSet>
</transformationSets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
version="2.0"
exclude-result-prefixes="xalan">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:variable name="nsDS" select="'urn:jboss:domain:logging:'"/>
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='root-logger' and starts-with(namespace-uri(), $nsDS)]">
<logger category="org.hibernate.dialect.Dialect">
<level name="ALL"/>
</logger>
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<!-- Copy everything else. -->
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,94 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:j="urn:jboss:domain:3.0"
xmlns:ds="urn:jboss:domain:datasources:3.0"
xmlns:k="urn:jboss:domain:keycloak:1.1"
xmlns:sec="urn:jboss:domain:security:1.2"
version="2.0"
exclude-result-prefixes="xalan j ds k sec">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:strip-space elements="*"/>
<xsl:variable name="nsDS" select="'urn:jboss:domain:datasources:'"/>
<!-- Remove keycloak datasource definition. -->
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='datasource' and starts-with(namespace-uri(), $nsDS) and @pool-name='KeycloakDS']">
</xsl:template>
<xsl:param name="jdbc.url" select="'jdbc:h2:${jboss.server.data.dir}/keycloak;AUTO_SERVER=TRUE'"/>
<xsl:param name="driver" select="'h2'"/>
<xsl:param name="username" select="'sa'"/>
<xsl:param name="password" select="'sa'"/>
<xsl:param name="min.poolsize" select="'10'"/>
<xsl:param name="max.poolsize" select="'50'"/>
<xsl:param name="pool.prefill" select="'true'"/>
<xsl:variable name="newDatasourceDefinition">
<datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true">
<connection-url>
<xsl:value-of select="$jdbc.url"/>
</connection-url>
<driver>
<xsl:value-of select="$driver"/>
</driver>
<security>
<user-name>
<xsl:value-of select="$username"/>
</user-name>
<password>
<xsl:value-of select="$password"/>
</password>
</security>
<pool>
<min-pool-size>
<xsl:value-of select="$min.poolsize"/>
</min-pool-size>
<max-pool-size>
<xsl:value-of select="$max.poolsize"/>
</max-pool-size>
<prefill>
<xsl:value-of select="$pool.prefill"/>
</prefill>
</pool>
</datasource>
</xsl:variable>
<xsl:variable name="newDriverDefinition">
<xsl:if test="$driver != 'h2'">
<driver name="{$driver}" module="com.{$driver}" />
</xsl:if>
</xsl:variable>
<!-- Add new datasource definition. -->
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]">
<xsl:copy>
<xsl:copy-of select="$newDatasourceDefinition"/>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<!-- Add new driver definition. -->
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='drivers' and starts-with(namespace-uri(), $nsDS)]">
<xsl:copy>
<xsl:copy-of select="$newDriverDefinition"/>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<!-- Copy everything else. -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,33 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:m="urn:jboss:module:1.3"
version="2.0"
exclude-result-prefixes="xalan m">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" />
<xsl:param name="database" select="''"/>
<xsl:param name="version" select="''"/>
<xsl:variable name="newModuleDefinition">
<module xmlns="urn:jboss:module:1.3" name="com.{$database}">
<resources>
<resource-root path="{$database}-{$version}.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
</xsl:variable>
<!-- clear whole document -->
<xsl:template match="/*" />
<!-- Copy new module definition. -->
<xsl:template match="/*">
<xsl:copy-of select="$newModuleDefinition"/>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,51 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:j="urn:jboss:domain:3.0"
xmlns:ds="urn:jboss:domain:datasources:3.0"
xmlns:k="urn:jboss:domain:keycloak:1.1"
xmlns:sec="urn:jboss:domain:security:1.2"
version="2.0"
exclude-result-prefixes="xalan j ds k sec">
<xsl:param name="config"/>
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="//j:extensions">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<extension module="org.keycloak.keycloak-adapter-subsystem"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//j:profile">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<subsystem xmlns="urn:jboss:domain:keycloak:1.1"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//sec:security-domains">
<xsl:copy>
<xsl:apply-templates select="node()[name(.)='security-domain']"/>
<security-domain name="keycloak">
<authentication>
<login-module code="org.keycloak.adapters.jboss.KeycloakLoginModule" flag="required"/>
</authentication>
</security-domain>
<security-domain name="sp" cache-type="default">
<authentication>
<login-module code="org.picketlink.identity.federation.bindings.wildfly.SAML2LoginModule" flag="required"/>
</authentication>
</security-domain>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,29 @@
<assembly>
<id>auth-server-wildfly-kc14</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${keycloak.server.home}</directory>
<outputDirectory>keycloak-1.2.0.Final</outputDirectory>
<excludes>
<exclude>**/*.sh</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>${keycloak.server.home}</directory>
<outputDirectory>keycloak-1.2.0.Final</outputDirectory>
<includes>
<include>**/*.sh</include>
</includes>
<fileMode>0755</fileMode>
</fileSet>
</fileSets>
</assembly>

View file

@ -0,0 +1,199 @@
<?xml version="1.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">
<parent>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers</artifactId>
<version>1.6.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-arquillian-server-wildfly-kc12 </artifactId>
<packaging>pom</packaging>
<name>Keycloak 1.2.0.Final on Wildfly</name>
<properties>
<keycloak.server.home>${project.build.directory}/unpacked/keycloak-1.2.0.Final</keycloak.server.home>
<jdbc.mvn.driver.deployment.dir>${keycloak.server.home}/modules/system/layers/base/com/${jdbc.mvn.artifactId}/main</jdbc.mvn.driver.deployment.dir>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>enforce-properties</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireProperty>
<property>jdbc.mvn.groupId</property>
</requireProperty>
<requireProperty>
<property>jdbc.mvn.artifactId</property>
</requireProperty>
<requireProperty>
<property>jdbc.mvn.version</property>
</requireProperty>
<requireProperty>
<property>keycloak.connectionsJpa.url</property>
</requireProperty>
<requireProperty>
<property>keycloak.connectionsJpa.user</property>
</requireProperty>
<requireProperty>
<property>keycloak.connectionsJpa.password</property>
</requireProperty>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-server</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-server-dist</artifactId>
<version>1.2.0.Final</version>
<type>zip</type>
<outputDirectory>${project.build.directory}/unpacked</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>jdbc-driver</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${jdbc.mvn.groupId}</groupId>
<artifactId>${jdbc.mvn.artifactId}</artifactId>
<version>${jdbc.mvn.version}</version>
<type>jar</type>
</artifactItem>
</artifactItems>
<outputDirectory>${jdbc.mvn.driver.deployment.dir}</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
<id>configure-wildfly-datasource</id>
<phase>process-resources</phase>
<goals>
<goal>transform</goal>
</goals>
<configuration>
<transformationSets>
<!-- create module.xml in modules -->
<transformationSet>
<dir>${keycloak.server.home}/modules/system/layers/base/com/h2database/h2/main</dir>
<stylesheet>src/main/xslt/module.xsl</stylesheet>
<includes>
<include>module.xml</include>
</includes>
<outputDir>${jdbc.mvn.driver.deployment.dir}</outputDir>
<parameters>
<parameter>
<name>database</name>
<value>${jdbc.mvn.artifactId}</value>
</parameter>
<parameter>
<name>version</name>
<value>${jdbc.mvn.version}</value>
</parameter>
</parameters>
</transformationSet>
<!-- add datasource to standalone.xml -->
<transformationSet>
<dir>${keycloak.server.home}/standalone/configuration</dir>
<stylesheet>src/main/xslt/datasource.xsl</stylesheet>
<includes>
<include>standalone.xml</include>
</includes>
<outputDir>${keycloak.server.home}/standalone/configuration</outputDir>
<parameters>
<parameter>
<name>jdbc.url</name>
<value>${keycloak.connectionsJpa.url}</value>
</parameter>
<parameter>
<name>driver</name>
<value>${jdbc.mvn.artifactId}</value>
</parameter>
<parameter>
<name>username</name>
<value>${keycloak.connectionsJpa.user}</value>
</parameter>
<parameter>
<name>password</name>
<value>${keycloak.connectionsJpa.password}</value>
</parameter>
</parameters>
</transformationSet>
<!-- add logger for org.hibernate.dialect.Dialect to standalone.xml-->
<transformationSet>
<dir>${keycloak.server.home}/standalone/configuration</dir>
<stylesheet>src/main/xslt/add-dialect-logger.xsl</stylesheet>
<includes>
<include>standalone.xml</include>
</includes>
<outputDir>${keycloak.server.home}/standalone/configuration</outputDir>
</transformationSet>
</transformationSets>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>create-zip</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
version="2.0"
exclude-result-prefixes="xalan">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:variable name="nsDS" select="'urn:jboss:domain:logging:'"/>
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='root-logger' and starts-with(namespace-uri(), $nsDS)]">
<logger category="org.hibernate.dialect.Dialect">
<level name="ALL"/>
</logger>
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<!-- Copy everything else. -->
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,94 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:j="urn:jboss:domain:3.0"
xmlns:ds="urn:jboss:domain:datasources:3.0"
xmlns:k="urn:jboss:domain:keycloak:1.1"
xmlns:sec="urn:jboss:domain:security:1.2"
version="2.0"
exclude-result-prefixes="xalan j ds k sec">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:strip-space elements="*"/>
<xsl:variable name="nsDS" select="'urn:jboss:domain:datasources:'"/>
<!-- Remove keycloak datasource definition. -->
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='datasource' and starts-with(namespace-uri(), $nsDS) and @pool-name='KeycloakDS']">
</xsl:template>
<xsl:param name="jdbc.url" select="'jdbc:h2:${jboss.server.data.dir}/keycloak;AUTO_SERVER=TRUE'"/>
<xsl:param name="driver" select="'h2'"/>
<xsl:param name="username" select="'sa'"/>
<xsl:param name="password" select="'sa'"/>
<xsl:param name="min.poolsize" select="'10'"/>
<xsl:param name="max.poolsize" select="'50'"/>
<xsl:param name="pool.prefill" select="'true'"/>
<xsl:variable name="newDatasourceDefinition">
<datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true">
<connection-url>
<xsl:value-of select="$jdbc.url"/>
</connection-url>
<driver>
<xsl:value-of select="$driver"/>
</driver>
<security>
<user-name>
<xsl:value-of select="$username"/>
</user-name>
<password>
<xsl:value-of select="$password"/>
</password>
</security>
<pool>
<min-pool-size>
<xsl:value-of select="$min.poolsize"/>
</min-pool-size>
<max-pool-size>
<xsl:value-of select="$max.poolsize"/>
</max-pool-size>
<prefill>
<xsl:value-of select="$pool.prefill"/>
</prefill>
</pool>
</datasource>
</xsl:variable>
<xsl:variable name="newDriverDefinition">
<xsl:if test="$driver != 'h2'">
<driver name="{$driver}" module="com.{$driver}" />
</xsl:if>
</xsl:variable>
<!-- Add new datasource definition. -->
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]">
<xsl:copy>
<xsl:copy-of select="$newDatasourceDefinition"/>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<!-- Add new driver definition. -->
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='drivers' and starts-with(namespace-uri(), $nsDS)]">
<xsl:copy>
<xsl:copy-of select="$newDriverDefinition"/>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<!-- Copy everything else. -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,33 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:m="urn:jboss:module:1.3"
version="2.0"
exclude-result-prefixes="xalan m">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" />
<xsl:param name="database" select="''"/>
<xsl:param name="version" select="''"/>
<xsl:variable name="newModuleDefinition">
<module xmlns="urn:jboss:module:1.3" name="com.{$database}">
<resources>
<resource-root path="{$database}-{$version}.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
</xsl:variable>
<!-- clear whole document -->
<xsl:template match="/*" />
<!-- Copy new module definition. -->
<xsl:template match="/*">
<xsl:copy-of select="$newModuleDefinition"/>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,29 @@
<assembly>
<id>auth-server-wildfly-kc14</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${keycloak.server.home}</directory>
<outputDirectory>keycloak-1.3.1.Final</outputDirectory>
<excludes>
<exclude>**/*.sh</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>${keycloak.server.home}</directory>
<outputDirectory>keycloak-1.3.1.Final</outputDirectory>
<includes>
<include>**/*.sh</include>
</includes>
<fileMode>0755</fileMode>
</fileSet>
</fileSets>
</assembly>

View file

@ -0,0 +1,199 @@
<?xml version="1.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">
<parent>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers</artifactId>
<version>1.6.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-arquillian-server-wildfly-kc13</artifactId>
<packaging>pom</packaging>
<name>Keycloak 1.3.1.Final on Wildfly</name>
<properties>
<keycloak.server.home>${project.build.directory}/unpacked/keycloak-1.3.1.Final</keycloak.server.home>
<jdbc.mvn.driver.deployment.dir>${keycloak.server.home}/modules/system/layers/base/com/${jdbc.mvn.artifactId}/main</jdbc.mvn.driver.deployment.dir>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>enforce-properties</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireProperty>
<property>jdbc.mvn.groupId</property>
</requireProperty>
<requireProperty>
<property>jdbc.mvn.artifactId</property>
</requireProperty>
<requireProperty>
<property>jdbc.mvn.version</property>
</requireProperty>
<requireProperty>
<property>keycloak.connectionsJpa.url</property>
</requireProperty>
<requireProperty>
<property>keycloak.connectionsJpa.user</property>
</requireProperty>
<requireProperty>
<property>keycloak.connectionsJpa.password</property>
</requireProperty>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-server</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-server-dist</artifactId>
<version>1.3.1.Final</version>
<type>zip</type>
<outputDirectory>${project.build.directory}/unpacked</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>jdbc-driver</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${jdbc.mvn.groupId}</groupId>
<artifactId>${jdbc.mvn.artifactId}</artifactId>
<version>${jdbc.mvn.version}</version>
<type>jar</type>
</artifactItem>
</artifactItems>
<outputDirectory>${jdbc.mvn.driver.deployment.dir}</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
<id>configure-wildfly-datasource</id>
<phase>process-resources</phase>
<goals>
<goal>transform</goal>
</goals>
<configuration>
<transformationSets>
<!-- create module.xml in modules -->
<transformationSet>
<dir>${keycloak.server.home}/modules/system/layers/base/com/h2database/h2/main</dir>
<stylesheet>src/main/xslt/module.xsl</stylesheet>
<includes>
<include>module.xml</include>
</includes>
<outputDir>${jdbc.mvn.driver.deployment.dir}</outputDir>
<parameters>
<parameter>
<name>database</name>
<value>${jdbc.mvn.artifactId}</value>
</parameter>
<parameter>
<name>version</name>
<value>${jdbc.mvn.version}</value>
</parameter>
</parameters>
</transformationSet>
<!-- add datasource to standalone.xml -->
<transformationSet>
<dir>${keycloak.server.home}/standalone/configuration</dir>
<stylesheet>src/main/xslt/datasource.xsl</stylesheet>
<includes>
<include>standalone.xml</include>
</includes>
<outputDir>${keycloak.server.home}/standalone/configuration</outputDir>
<parameters>
<parameter>
<name>jdbc.url</name>
<value>${keycloak.connectionsJpa.url}</value>
</parameter>
<parameter>
<name>driver</name>
<value>${jdbc.mvn.artifactId}</value>
</parameter>
<parameter>
<name>username</name>
<value>${keycloak.connectionsJpa.user}</value>
</parameter>
<parameter>
<name>password</name>
<value>${keycloak.connectionsJpa.password}</value>
</parameter>
</parameters>
</transformationSet>
<!-- add logger for org.hibernate.dialect.Dialect to standalone.xml-->
<transformationSet>
<dir>${keycloak.server.home}/standalone/configuration</dir>
<stylesheet>src/main/xslt/add-dialect-logger.xsl</stylesheet>
<includes>
<include>standalone.xml</include>
</includes>
<outputDir>${keycloak.server.home}/standalone/configuration</outputDir>
</transformationSet>
</transformationSets>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>create-zip</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
version="2.0"
exclude-result-prefixes="xalan">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:variable name="nsDS" select="'urn:jboss:domain:logging:'"/>
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='root-logger' and starts-with(namespace-uri(), $nsDS)]">
<logger category="org.hibernate.dialect.Dialect">
<level name="ALL"/>
</logger>
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<!-- Copy everything else. -->
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,94 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:j="urn:jboss:domain:3.0"
xmlns:ds="urn:jboss:domain:datasources:3.0"
xmlns:k="urn:jboss:domain:keycloak:1.1"
xmlns:sec="urn:jboss:domain:security:1.2"
version="2.0"
exclude-result-prefixes="xalan j ds k sec">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:strip-space elements="*"/>
<xsl:variable name="nsDS" select="'urn:jboss:domain:datasources:'"/>
<!-- Remove keycloak datasource definition. -->
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='datasource' and starts-with(namespace-uri(), $nsDS) and @pool-name='KeycloakDS']">
</xsl:template>
<xsl:param name="jdbc.url" select="'jdbc:h2:${jboss.server.data.dir}/keycloak;AUTO_SERVER=TRUE'"/>
<xsl:param name="driver" select="'h2'"/>
<xsl:param name="username" select="'sa'"/>
<xsl:param name="password" select="'sa'"/>
<xsl:param name="min.poolsize" select="'10'"/>
<xsl:param name="max.poolsize" select="'50'"/>
<xsl:param name="pool.prefill" select="'true'"/>
<xsl:variable name="newDatasourceDefinition">
<datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true">
<connection-url>
<xsl:value-of select="$jdbc.url"/>
</connection-url>
<driver>
<xsl:value-of select="$driver"/>
</driver>
<security>
<user-name>
<xsl:value-of select="$username"/>
</user-name>
<password>
<xsl:value-of select="$password"/>
</password>
</security>
<pool>
<min-pool-size>
<xsl:value-of select="$min.poolsize"/>
</min-pool-size>
<max-pool-size>
<xsl:value-of select="$max.poolsize"/>
</max-pool-size>
<prefill>
<xsl:value-of select="$pool.prefill"/>
</prefill>
</pool>
</datasource>
</xsl:variable>
<xsl:variable name="newDriverDefinition">
<xsl:if test="$driver != 'h2'">
<driver name="{$driver}" module="com.{$driver}" />
</xsl:if>
</xsl:variable>
<!-- Add new datasource definition. -->
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]">
<xsl:copy>
<xsl:copy-of select="$newDatasourceDefinition"/>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<!-- Add new driver definition. -->
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='drivers' and starts-with(namespace-uri(), $nsDS)]">
<xsl:copy>
<xsl:copy-of select="$newDriverDefinition"/>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<!-- Copy everything else. -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,33 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:m="urn:jboss:module:1.3"
version="2.0"
exclude-result-prefixes="xalan m">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" />
<xsl:param name="database" select="''"/>
<xsl:param name="version" select="''"/>
<xsl:variable name="newModuleDefinition">
<module xmlns="urn:jboss:module:1.3" name="com.{$database}">
<resources>
<resource-root path="{$database}-{$version}.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
</xsl:variable>
<!-- clear whole document -->
<xsl:template match="/*" />
<!-- Copy new module definition. -->
<xsl:template match="/*">
<xsl:copy-of select="$newModuleDefinition"/>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,29 @@
<assembly>
<id>auth-server-wildfly-kc14</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${keycloak.server.home}</directory>
<outputDirectory>keycloak-1.4.0.Final</outputDirectory>
<excludes>
<exclude>**/*.sh</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>${keycloak.server.home}</directory>
<outputDirectory>keycloak-1.4.0.Final</outputDirectory>
<includes>
<include>**/*.sh</include>
</includes>
<fileMode>0755</fileMode>
</fileSet>
</fileSets>
</assembly>

View file

@ -0,0 +1,199 @@
<?xml version="1.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">
<parent>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers</artifactId>
<version>1.6.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-arquillian-server-wildfly-kc14</artifactId>
<packaging>pom</packaging>
<name>Keycloak 1.4.0.Final on Wildfly</name>
<properties>
<keycloak.server.home>${project.build.directory}/unpacked/keycloak-1.4.0.Final</keycloak.server.home>
<jdbc.mvn.driver.deployment.dir>${keycloak.server.home}/modules/system/layers/base/com/${jdbc.mvn.artifactId}/main</jdbc.mvn.driver.deployment.dir>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>enforce-properties</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireProperty>
<property>jdbc.mvn.groupId</property>
</requireProperty>
<requireProperty>
<property>jdbc.mvn.artifactId</property>
</requireProperty>
<requireProperty>
<property>jdbc.mvn.version</property>
</requireProperty>
<requireProperty>
<property>keycloak.connectionsJpa.url</property>
</requireProperty>
<requireProperty>
<property>keycloak.connectionsJpa.user</property>
</requireProperty>
<requireProperty>
<property>keycloak.connectionsJpa.password</property>
</requireProperty>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-server</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-server-dist</artifactId>
<version>1.4.0.Final</version>
<type>zip</type>
<outputDirectory>${project.build.directory}/unpacked</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>jdbc-driver</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${jdbc.mvn.groupId}</groupId>
<artifactId>${jdbc.mvn.artifactId}</artifactId>
<version>${jdbc.mvn.version}</version>
<type>jar</type>
</artifactItem>
</artifactItems>
<outputDirectory>${jdbc.mvn.driver.deployment.dir}</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
<id>configure-wildfly-datasource</id>
<phase>process-resources</phase>
<goals>
<goal>transform</goal>
</goals>
<configuration>
<transformationSets>
<!-- create module.xml in modules -->
<transformationSet>
<dir>${keycloak.server.home}/modules/system/layers/base/com/h2database/h2/main</dir>
<stylesheet>src/main/xslt/module.xsl</stylesheet>
<includes>
<include>module.xml</include>
</includes>
<outputDir>${jdbc.mvn.driver.deployment.dir}</outputDir>
<parameters>
<parameter>
<name>database</name>
<value>${jdbc.mvn.artifactId}</value>
</parameter>
<parameter>
<name>version</name>
<value>${jdbc.mvn.version}</value>
</parameter>
</parameters>
</transformationSet>
<!-- add datasource to standalone.xml -->
<transformationSet>
<dir>${keycloak.server.home}/standalone/configuration</dir>
<stylesheet>src/main/xslt/datasource.xsl</stylesheet>
<includes>
<include>standalone.xml</include>
</includes>
<outputDir>${keycloak.server.home}/standalone/configuration</outputDir>
<parameters>
<parameter>
<name>jdbc.url</name>
<value>${keycloak.connectionsJpa.url}</value>
</parameter>
<parameter>
<name>driver</name>
<value>${jdbc.mvn.artifactId}</value>
</parameter>
<parameter>
<name>username</name>
<value>${keycloak.connectionsJpa.user}</value>
</parameter>
<parameter>
<name>password</name>
<value>${keycloak.connectionsJpa.password}</value>
</parameter>
</parameters>
</transformationSet>
<!-- add logger for org.hibernate.dialect.Dialect to standalone.xml-->
<transformationSet>
<dir>${keycloak.server.home}/standalone/configuration</dir>
<stylesheet>src/main/xslt/add-dialect-logger.xsl</stylesheet>
<includes>
<include>standalone.xml</include>
</includes>
<outputDir>${keycloak.server.home}/standalone/configuration</outputDir>
</transformationSet>
</transformationSets>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>create-zip</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
version="2.0"
exclude-result-prefixes="xalan">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:variable name="nsDS" select="'urn:jboss:domain:logging:'"/>
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='root-logger' and starts-with(namespace-uri(), $nsDS)]">
<logger category="org.hibernate.dialect.Dialect">
<level name="ALL"/>
</logger>
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<!-- Copy everything else. -->
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,94 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:j="urn:jboss:domain:3.0"
xmlns:ds="urn:jboss:domain:datasources:3.0"
xmlns:k="urn:jboss:domain:keycloak:1.1"
xmlns:sec="urn:jboss:domain:security:1.2"
version="2.0"
exclude-result-prefixes="xalan j ds k sec">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:strip-space elements="*"/>
<xsl:variable name="nsDS" select="'urn:jboss:domain:datasources:'"/>
<!-- Remove keycloak datasource definition. -->
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='datasource' and starts-with(namespace-uri(), $nsDS) and @pool-name='KeycloakDS']">
</xsl:template>
<xsl:param name="jdbc.url" select="'jdbc:h2:${jboss.server.data.dir}/keycloak;AUTO_SERVER=TRUE'"/>
<xsl:param name="driver" select="'h2'"/>
<xsl:param name="username" select="'sa'"/>
<xsl:param name="password" select="'sa'"/>
<xsl:param name="min.poolsize" select="'10'"/>
<xsl:param name="max.poolsize" select="'50'"/>
<xsl:param name="pool.prefill" select="'true'"/>
<xsl:variable name="newDatasourceDefinition">
<datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true">
<connection-url>
<xsl:value-of select="$jdbc.url"/>
</connection-url>
<driver>
<xsl:value-of select="$driver"/>
</driver>
<security>
<user-name>
<xsl:value-of select="$username"/>
</user-name>
<password>
<xsl:value-of select="$password"/>
</password>
</security>
<pool>
<min-pool-size>
<xsl:value-of select="$min.poolsize"/>
</min-pool-size>
<max-pool-size>
<xsl:value-of select="$max.poolsize"/>
</max-pool-size>
<prefill>
<xsl:value-of select="$pool.prefill"/>
</prefill>
</pool>
</datasource>
</xsl:variable>
<xsl:variable name="newDriverDefinition">
<xsl:if test="$driver != 'h2'">
<driver name="{$driver}" module="com.{$driver}" />
</xsl:if>
</xsl:variable>
<!-- Add new datasource definition. -->
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]">
<xsl:copy>
<xsl:copy-of select="$newDatasourceDefinition"/>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<!-- Add new driver definition. -->
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]
/*[local-name()='drivers' and starts-with(namespace-uri(), $nsDS)]">
<xsl:copy>
<xsl:copy-of select="$newDriverDefinition"/>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<!-- Copy everything else. -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,33 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:m="urn:jboss:module:1.3"
version="2.0"
exclude-result-prefixes="xalan m">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" />
<xsl:param name="database" select="''"/>
<xsl:param name="version" select="''"/>
<xsl:variable name="newModuleDefinition">
<module xmlns="urn:jboss:module:1.3" name="com.{$database}">
<resources>
<resource-root path="{$database}-{$version}.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
</xsl:variable>
<!-- clear whole document -->
<xsl:template match="/*" />
<!-- Copy new module definition. -->
<xsl:template match="/*">
<xsl:copy-of select="$newModuleDefinition"/>
</xsl:template>
</xsl:stylesheet>

View file

@ -1,121 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.account;
import org.jboss.arquillian.graphene.findby.FindByJQuery;
import org.jboss.arquillian.graphene.page.Page;
import org.junit.After;
import org.junit.Test;
import static org.keycloak.testsuite.admin.util.Constants.ADMIN_PSSWD;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.keycloak.testsuite.admin.AbstractKeycloakTest;
import org.keycloak.testsuite.admin.fragment.FlashMessage;
import org.keycloak.testsuite.admin.model.Account;
import org.keycloak.testsuite.admin.page.account.AccountPage;
import org.keycloak.testsuite.admin.page.account.PasswordPage;
/**
*
* @author Petr Mensik
*/
public class AccountManagementTest extends AbstractKeycloakTest<AccountPage> {
@FindByJQuery(".alert")
private FlashMessage flashMessage;
@Page
private AccountPage accountPage;
@Page
private PasswordPage passwordPage;
private static final String USERNAME = "admin";
private static final String NEW_PASSWORD = "newpassword";
private static final String WRONG_PASSWORD = "wrongpassword";
@Before
public void beforeAccountTest() {
menuPage.goToAccountManagement();
}
@After
public void afterAccountTest() {
accountPage.keycloakConsole();
}
@Test
public void passwordPageValidationTest() {
page.password();
passwordPage.save();
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isError());
passwordPage.setPassword(WRONG_PASSWORD, NEW_PASSWORD);
passwordPage.save();
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isError());
passwordPage.setOldPasswordField(ADMIN_PSSWD);
passwordPage.setNewPasswordField("something");
passwordPage.setConfirmField("something else");
passwordPage.save();
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isError());
}
@Test
public void changePasswordTest() {
page.password();
passwordPage.setPassword(ADMIN_PSSWD, NEW_PASSWORD);
passwordPage.save();
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
page.signOut();
loginPage.login(USERNAME, NEW_PASSWORD);
page.password();
passwordPage.setPassword(NEW_PASSWORD, ADMIN_PSSWD);
passwordPage.save();
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
}
@Test
public void accountPageTest() {
page.account();
Account adminAccount = accountPage.getAccount();
assertEquals(adminAccount.getUsername(), USERNAME);
adminAccount.setEmail("a@b");
adminAccount.setFirstName("John");
adminAccount.setLastName("Smith");
accountPage.setAccount(adminAccount);
accountPage.save();
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
page.signOut();
loginPage.login(USERNAME, ADMIN_PSSWD);
page.account();
assertEquals(adminAccount, accountPage.getAccount());
}
}

View file

@ -1,91 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin;
import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.graphene.page.Page;
import org.jboss.arquillian.junit.Arquillian;
import org.junit.runner.RunWith;
import org.keycloak.testsuite.admin.fragment.Navigation;
import org.keycloak.testsuite.admin.fragment.MenuPage;
import org.keycloak.testsuite.admin.page.LoginPage;
import org.keycloak.testsuite.admin.page.account.PasswordPage;
import static org.keycloak.testsuite.admin.util.Constants.ADMIN_PSSWD;
import static org.keycloak.testsuite.admin.util.URL.ACCOUNT_URL;
import static org.keycloak.testsuite.admin.util.URL.ADMIN_URL;
import org.openqa.selenium.WebDriver;
/**
*
* @author Petr Mensik
*/
@RunWith(Arquillian.class)
public abstract class AbstractTest {
private static Boolean firstAdminLogin;
static {
String s = System.getProperty("firstAdminLogin");
firstAdminLogin = s != null ? Boolean.parseBoolean(s) : null;
}
@Page
protected LoginPage loginPage;
@Page
protected PasswordPage passwordPage;
@Page
protected MenuPage menuPage;
@Page
protected Navigation navigation;
@Drone
protected WebDriver driver;
public void logOut() {
menuPage.logOut();
}
public void loginAsAdmin() {
openAdmin();
loginPage.loginAsAdmin();
if (firstAdminLogin == null) {
firstAdminLogin = driver.getTitle().contains("Update password");
}
if (firstAdminLogin) {
passwordPage.confirmNewPassword(ADMIN_PSSWD);
passwordPage.submit();
firstAdminLogin = false;
}
}
public void openAdmin() {
driver.get(ADMIN_URL);
}
public void openAccount() {
driver.get(ACCOUNT_URL);
}
}

View file

@ -1,162 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.fragment;
import org.jboss.arquillian.drone.api.annotation.Drone;
import static org.jboss.arquillian.graphene.Graphene.waitModel;
import static org.keycloak.testsuite.admin.util.SeleniumUtils.waitGuiForElement;
import org.jboss.arquillian.graphene.findby.FindByJQuery;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
/**
*
* @author Petr Mensik
*/
public class Navigation {
@Drone
private WebDriver driver;
@FindByJQuery("a:contains('Settings')")
private WebElement settingsLink;
@FindByJQuery("a:contains('Users')")
private WebElement usersLink;
@FindByJQuery("a:contains('Roles')")
private WebElement rolesLink;
@FindByJQuery("a:contains('Clients')")
private WebElement clientsLink;
@FindByJQuery("a:contains('OAuth')")
private WebElement oauthLink;
@FindByJQuery("a:contains('Tokens')")
private WebElement tokensLink;
@FindByJQuery("a:contains('Sessions')")
private WebElement sessionLink;
@FindByJQuery("a:contains('Security Defenses')")
private WebElement securityLink;
@FindByJQuery("a:contains('Events')")
private WebElement eventsLink;
@FindByJQuery("a:contains('Login')")
private WebElement loginLink;
@FindByJQuery("a:contains('Themes')")
private WebElement themesLink;
@FindByJQuery("a:contains('Role Mappings')")
private WebElement usersRoleMappings;
@FindByJQuery("a:contains('Add Realm')")
private WebElement addRealm;
@FindByJQuery("a:contains('Authentication')")
private WebElement authentication;
@FindByJQuery("a:contains('Password Policy')")
private WebElement passwordPolicy;
@FindByJQuery("a:contains('Attributes')")
private WebElement attributes;
@FindBy(css = "div h1")
private WebElement currentHeader;
public void selectRealm(String realmName) {
driver.findElement(By.linkText(realmName)).click();
}
public void settings() {
openPage(settingsLink, "Master");
}
public void users() {
openPage(usersLink, "Users");
}
public void roles() {
openPage(rolesLink, "Roles");
}
public void clients() {
openPage(clientsLink, "Clients");
}
public void oauth() {
openPage(oauthLink, "OAuth Clients");
}
public void tokens() {
openPage(tokensLink, "Master");
}
public void sessions() {
openPage(sessionLink, "Sessions");
}
public void security() {
openPage(securityLink, "Master");
}
public void events() {
openPage(eventsLink, "Events");
}
public void login() {
openPage(loginLink, "Master");
}
public void themes() {
openPage(themesLink, "Master");
}
public void roleMappings(String username) {
String usernameCapitalized = Character.toUpperCase(username.charAt(0))
+ username.substring(1);
openPage(usersRoleMappings, usernameCapitalized);
}
public void addRealm() {
openPage(addRealm, "Add Realm");
}
public void passwordPolicy() {
openPage(authentication, "Authentication");
openPage(passwordPolicy, "Authentication");
}
public void attributes() {
openPage(attributes, "Attributes");
}
private void openPage(WebElement page, String headerText) {
waitGuiForElement(page);
page.click();
waitModel().until().element(currentHeader).text().contains(headerText);
}
}

View file

@ -1,93 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.model;
/**
*
* @author Petr Mensik
*/
public class Account {
private String username;
private String email;
private String lastName;
private String firstName;
public Account(String username, String email, String lastName, String firstName) {
this.username = username;
this.email = email;
this.lastName = lastName;
this.firstName = firstName;
}
public String getUsername() {
return username;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Account account = (Account) o;
if (email != null ? !email.equals(account.email) : account.email != null) return false;
if (firstName != null ? !firstName.equals(account.firstName) : account.firstName != null) return false;
if (lastName != null ? !lastName.equals(account.lastName) : account.lastName != null) return false;
if (username != null ? !username.equals(account.username) : account.username != null) return false;
return true;
}
@Override
public int hashCode() {
int result = username != null ? username.hashCode() : 0;
result = 31 * result + (email != null ? email.hashCode() : 0);
result = 31 * result + (lastName != null ? lastName.hashCode() : 0);
result = 31 * result + (firstName != null ? firstName.hashCode() : 0);
return result;
}
}

View file

@ -1,104 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.model;
/**
*
* @author Filip Kiss
*/
public class Client {
private String clientId;
private String name;
private boolean enabled;
private String accessType;
private String uri;
public Client(String clientId, String uri) {
this.name = clientId;
this.clientId = clientId;
this.uri = uri;
this.enabled = true;
}
public Client(String clientId, String name, String uri) {
this.clientId = clientId;
this.uri = uri;
this.enabled = true;
this.name = name;
}
public Client() {
}
public Client(String name, String uri, String accessType, boolean enabled) {
this.name = name;
this.uri = uri;
this.accessType = accessType;
this.enabled = enabled;
}
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public boolean isEnabled() { return enabled; }
public void setEnabled(boolean enabled) { this.enabled = enabled; }
public String getAccessType() { return accessType; }
public void setAccessType(String accessType) { this.accessType = accessType; }
public String getUri() { return uri; }
public void setUri(String uri) { this.uri = uri; }
public String getClientId() {
return clientId;
}
public void setClientId(String clientId) {
this.clientId = clientId;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Client that = (Client) o;
if (enabled != that.enabled) return false;
if (accessType != null ? !accessType.equals(that.accessType) : that.accessType != null) return false;
if (!name.equals(that.name)) return false;
if (!uri.equals(that.uri)) return false;
return true;
}
@Override
public int hashCode() {
int result = name.hashCode();
result = 31 * result + (enabled ? 1 : 0);
result = 31 * result + (accessType != null ? accessType.hashCode() : 0);
result = 31 * result + uri.hashCode();
return result;
}
}

View file

@ -1,72 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.model;
/**
*
* @author Petr Mensik
*/
public class Role {
private String name;
private boolean composite;
private String description;
public Role() {
}
public Role(String name) {
this(name, false, "");
}
public Role(String name, boolean composite) {
this(name, composite, "");
}
public Role(String name, boolean composite, String description) {
this.name = name;
this.composite = composite;
this.description = description;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean isComposite() {
return composite;
}
public void setComposite(boolean composite) {
this.composite = composite;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}

View file

@ -1,146 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.model;
/**
*
* @author Filip Kiss
*/
public class User {
private String userName;
private String password;
private String email;
private String firstName;
private String lastName;
private boolean userEnabled;
private boolean emailVerified;
private String requiredUserActions;
public User() {
this.userEnabled = true;
this.emailVerified = false;
}
public User(String userName) {
this();
this.userName = userName;
}
public User(String userName, String password) {
this(userName);
this.password = password;
}
public User(String userName, String password, String email) {
this(userName, password);
this.email = email;
}
public User(String userName, String password, String email, String firstName, String lastName) {
this(userName, password, email);
this.firstName = firstName;
this.lastName = lastName;
}
public User(String userName, String password, String email, String firstName, String lastName, boolean userEnabled, boolean emailVerified, String requiredUserActions) {
this(userName, password, email, firstName, lastName);
this.requiredUserActions = requiredUserActions;
}
public User(User user) {
this(user.userName, user.password, user.email, user.firstName, user.lastName,
user.userEnabled, user.emailVerified, user.requiredUserActions);
}
public String getUserName() { return userName; }
public void setUserName(String userName) { this.userName = userName; }
public String getEmail() { return email; }
public void setEmail(String email) { this.email = email; }
public String getFirstName() { return firstName; }
public void setFirstName(String firstName) { this.firstName = firstName; }
public String getLastName() { return lastName; }
public void setLastName(String lastName) { this.lastName = lastName; }
public boolean isUserEnabled() { return userEnabled; }
public void setUserEnabled(boolean userEnabled) { this.userEnabled = userEnabled; }
public boolean isEmailVerified() { return emailVerified; }
public void setEmailVerified(boolean emailVerified) { this.emailVerified = emailVerified; }
public String getRequiredUserActions() { return requiredUserActions; }
public void setRequiredUserActions(String requiredUserActions) { this.requiredUserActions = requiredUserActions; }
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
User user = (User) o;
if (emailVerified != user.emailVerified) return false;
if (userEnabled != user.userEnabled) return false;
if (email != null ? !email.equals(user.email) : user.email != null) return false;
if (firstName != null ? !firstName.equals(user.firstName) : user.firstName != null) return false;
if (lastName != null ? !lastName.equals(user.lastName) : user.lastName != null) return false;
if (requiredUserActions != null ? !requiredUserActions.equals(user.requiredUserActions) : user.requiredUserActions != null)
return false;
if (!userName.equals(user.userName)) return false;
return true;
}
@Override
public int hashCode() {
int result = userName.hashCode();
result = 31 * result + (email != null ? email.hashCode() : 0);
result = 31 * result + (firstName != null ? firstName.hashCode() : 0);
result = 31 * result + (lastName != null ? lastName.hashCode() : 0);
result = 31 * result + (userEnabled ? 1 : 0);
result = 31 * result + (emailVerified ? 1 : 0);
result = 31 * result + (requiredUserActions != null ? requiredUserActions.hashCode() : 0);
return result;
}
}

View file

@ -1,48 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.page;
import org.jboss.arquillian.drone.api.annotation.Drone;
import org.keycloak.testsuite.admin.util.Constants;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
/**
*
* @author Petr Mensik
*/
public class AbstractPage {
@Drone
protected WebDriver driver;
@FindBy(css = ".btn-danger")
protected WebElement dangerButton;
@FindBy(css = ".btn-primary")
protected WebElement primaryButton;
@FindBy(css = ".ng-binding.btn.btn-danger")
protected WebElement deleteConfirmationButton;
public void goToPage(String page) {
driver.get(String.format(page, Constants.CURRENT_REALM));
}
}

View file

@ -1,67 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.page;
import static org.keycloak.testsuite.admin.util.Constants.ADMIN_PSSWD;
import static org.keycloak.testsuite.admin.util.SeleniumUtils.waitGuiForElement;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
/**
*
* @author Petr Mensik
*/
public class LoginPage extends AbstractPage {
@FindBy(id = "username")
private WebElement usernameInput;
@FindBy(id = "password")
private WebElement passwordInput;
@FindBy(linkText = "Register")
private WebElement registerLink;
@FindBy(id = "kc-header")
private WebElement loginPageHeader;
public void login(String username, String password) {
waitGuiForElement(usernameInput, "Login form should be visible");
usernameInput.sendKeys(username);
passwordInput.sendKeys(password);
passwordInput.submit();
}
public void loginAsAdmin() {
login("admin", ADMIN_PSSWD);
}
public void goToUserRegistration() {
waitGuiForElement(usernameInput, "Login form should be visible");
registerLink.click();
}
public String getLoginPageHeaderText() {
return loginPageHeader.getText();
}
public WebElement getLoginPageHeader() {
return loginPageHeader;
}
}

View file

@ -1,99 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.page;
import org.keycloak.testsuite.admin.model.User;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import java.util.concurrent.TimeUnit;
import static org.keycloak.testsuite.admin.util.SeleniumUtils.waitGuiForElement;
/**
*
* @author Filip Kiss
*/
public class RegisterPage extends AbstractPage {
@FindBy(id = "username")
private WebElement usernameInput;
@FindBy(id = "email")
private WebElement emailInput;
@FindBy(id = "firstName")
private WebElement firstNameInput;
@FindBy(id = "lastName")
private WebElement lastNameInput;
@FindBy(id = "password")
private WebElement passwordInput;
@FindBy(id = "password-confirm")
private WebElement passwordConfirmInput;
@FindBy(css = "span.kc-feedback-text")
private WebElement feedbackError;
@FindBy(css = "div[id='kc-form-options'] span a")
private WebElement backToLoginForm;
public void registerNewUser(User user) {
registerNewUser(user, user.getPassword());
}
public void registerNewUser(User user, String confirmPassword) {
driver.manage().timeouts().setScriptTimeout(10, TimeUnit.SECONDS);
waitGuiForElement(passwordConfirmInput, "Register form should be visible");
clearAndType(usernameInput, user.getUserName());
clearAndType(firstNameInput, user.getFirstName());
clearAndType(lastNameInput, user.getLastName());
clearAndType(emailInput, user.getEmail());
clearAndType(passwordInput, user.getPassword());
clearAndType(passwordConfirmInput, confirmPassword);
primaryButton.click();
}
public void clearAndType(WebElement webElement, String text) {
webElement.clear();
webElement.sendKeys(text);
}
public boolean isInvalidEmail() {
waitGuiForElement(feedbackError, "Feedback message should be visible");
return feedbackError.getText().equals("Invalid email address.");
}
public boolean isAttributeSpecified(String attribute) {
waitGuiForElement(feedbackError, "Feedback message should be visible");
return !feedbackError.getText().contains("Please specify " + attribute + ".");
}
public boolean isPasswordSame() {
waitGuiForElement(feedbackError, "Feedback message should be visible");
return !feedbackError.getText().equals("Password confirmation doesn't match.");
}
public void backToLoginPage() {
backToLoginForm.click();
}
}

View file

@ -1,82 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.page.account;
import org.jboss.arquillian.graphene.findby.FindByJQuery;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
/**
*
* @author Petr Mensik
*/
public class PasswordPage {
@FindBy(id = "password")
private WebElement passwordInput;
@FindBy(id = "password-new")
private WebElement newPasswordInput;
@FindBy(id = "password-confirm")
private WebElement confirmInput;
@FindByJQuery("button[value='Save']")
private WebElement save;
@FindBy(xpath = "//input[@value='Submit']")
private WebElement submit; // on "update password" page, after first login
public void setPassword(String oldPassword, String newPassword) {
passwordInput.clear();
passwordInput.sendKeys(oldPassword);
confirmNewPassword(newPassword);
}
public void confirmNewPassword(String newPassword) {
newPasswordInput.clear();
newPasswordInput.sendKeys(newPassword);
confirmInput.clear();
confirmInput.sendKeys(newPassword);
}
public void setOldPasswordField(String oldPassword) {
passwordInput.clear();
passwordInput.sendKeys(oldPassword);
}
public void setNewPasswordField(String newPassword) {
newPasswordInput.clear();
newPasswordInput.sendKeys(newPassword);
}
public void setConfirmField(String confirmPassword) {
confirmInput.clear();
confirmInput.sendKeys(confirmPassword);
}
public void save() {
save.click();
}
public void submit() {
submit.click();
}
}

View file

@ -1,134 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.page.settings;
import org.keycloak.testsuite.admin.model.Client;
import org.keycloak.testsuite.admin.page.AbstractPage;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.keycloak.testsuite.admin.util.SeleniumUtils.waitAjaxForElement;
import static org.openqa.selenium.By.cssSelector;
import static org.openqa.selenium.By.linkText;
import static org.openqa.selenium.By.tagName;
/**
*
* @author Filip Kisss
*/
public class ClientPage extends AbstractPage {
@FindBy(id = "clientId")
private WebElement clientId;
@FindBy(id = "name")
private WebElement nameInput;
@FindBy(id = "")
private WebElement enabledSwitchToggle;
@FindBy(id = "accessType")
private WebElement accessTypeDropDownMenu;
@FindBy(id = "newRedirectUri")
private WebElement redirectUriInput;
@FindBy(css = "table[class*='table']")
private WebElement dataTable;
@FindBy(css = "input[class*='search']")
private WebElement searchInput;
@FindBy(id = "createClient")
private WebElement createButton;
@FindBy(id = "removeClient")
protected WebElement removeButton;
public void addClient(Client client) {
primaryButton.click();
waitAjaxForElement(clientId);
clientId.sendKeys(client.getClientId());
nameInput.sendKeys(client.getName());
if (!client.isEnabled()) {
enabledSwitchToggle.click();
}
accessTypeDropDownMenu.sendKeys(client.getAccessType());
redirectUriInput.sendKeys(client.getUri());
primaryButton.click();
}
public void addUri(String uri) {
redirectUriInput.sendKeys(uri);
}
public void removeUri(Client client) {
}
public void confirmAddClient() {
primaryButton.click();
}
public void deleteClient(String clientName) {
searchInput.sendKeys(clientName);
driver.findElement(linkText(clientName)).click();
waitAjaxForElement(removeButton);
removeButton.click();
waitAjaxForElement(deleteConfirmationButton);
deleteConfirmationButton.click();
}
public Client findClient(String clientName) {
waitAjaxForElement(searchInput);
searchInput.sendKeys(clientName);
List<Client> clients = getAllRows();
if (clients.isEmpty()) {
return null;
} else {
assertEquals(1, clients.size());
return clients.get(0);
}
}
private List<Client> getAllRows() {
List<Client> rows = new ArrayList<Client>();
List<WebElement> allRows = dataTable.findElements(cssSelector("tbody tr"));
if (allRows.size() > 1) {
for (WebElement rowElement : allRows) {
if (rowElement.isDisplayed()) {
Client client = new Client();
List<WebElement> tds = rowElement.findElements(tagName("td"));
client.setClientId(tds.get(0).getText());
client.setUri(tds.get(2).getText());
rows.add(client);
}
}
}
return rows;
}
public void goToCreateClient() {
createButton.click();
}
}

View file

@ -1,55 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.page.settings;
import java.util.ArrayList;
import java.util.List;
import org.keycloak.testsuite.admin.fragment.PickList;
import org.keycloak.testsuite.admin.page.AbstractPage;
import org.keycloak.testsuite.admin.model.Role;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.Select;
/**
*
* @author Petr Mensik
*/
public class DefaultRolesPage extends AbstractPage {
@FindBy(id = "")
private PickList realmDefaultRoles;
@FindBy(id = "")
private PickList applicationDefaultRoles;
@FindBy(id = "applications")
private Select applicationsSelect;
public void addDefaultRealmRoles(String... roles) {
realmDefaultRoles.addItems(roles);
}
public void addDefaultRealmRoles(Role... roles) {
List<String> roleList = new ArrayList<String>();
for(Role role : roles) {
roleList.add(role.getName());
}
addDefaultRealmRoles(((String []) roleList.toArray()));
}
}

View file

@ -1,63 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.page.settings;
import org.jboss.arquillian.graphene.findby.FindByJQuery;
import org.keycloak.testsuite.admin.fragment.OnOffSwitch;
import org.keycloak.testsuite.admin.page.AbstractPage;
/**
*
* @author Petr Mensik
*/
public class LoginSettingsPage extends AbstractPage {
@FindByJQuery("div[class='onoffswitch']:eq(0)")
private OnOffSwitch registrationAllowed;
@FindByJQuery("div[class='onoffswitch']:eq(1)")
private OnOffSwitch resetPasswordAllowed;
@FindByJQuery("div[class='onoffswitch']:eq(2)")
private OnOffSwitch rememberMeEnabled;
@FindByJQuery("div[class='onoffswitch']:eq(3)")
private OnOffSwitch verifyEmailEnabled;
@FindByJQuery("div[class='onoffswitch']:eq(4)")
private OnOffSwitch directGrantApiEnabled;
@FindByJQuery("div[class='onoffswitch']:eq(5)")
private OnOffSwitch requireSsl;
public boolean isUserRegistrationAllowed() {
return registrationAllowed.isEnabled();
}
public void enableUserRegistration() {
registrationAllowed.enable();
primaryButton.click();
}
public void disableUserRegistration() {
registrationAllowed.disable();
primaryButton.click();
}
}

View file

@ -1,71 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.page.settings;
import java.util.List;
import org.jboss.arquillian.graphene.findby.ByJQuery;
import org.keycloak.testsuite.admin.model.PasswordPolicy;
import org.keycloak.testsuite.admin.page.AbstractPage;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.Select;
/**
*
* @author Petr Mensik
*/
public class PasswordPolicyPage extends AbstractPage {
@FindBy(tagName = "select")
private Select addPolicySelect;
@FindBy(css = "tr.ng-scope")
private List<WebElement> allRows;
public void addPolicy(PasswordPolicy policy, int value) {
addPolicySelect.selectByVisibleText(policy.getName());
setPolicyValue(policy, value);
primaryButton.click();
}
public void removePolicy(PasswordPolicy policy) {
int policyInputLocation = findPolicy(policy);
allRows.get(policyInputLocation).findElements(By.tagName("button")).get(0).click();
primaryButton.click();
}
public void editPolicy(PasswordPolicy policy, int value) {
setPolicyValue(policy, value);
primaryButton.click();
}
private void setPolicyValue(PasswordPolicy policy, int value) {
int policyInputLocation = findPolicy(policy);
allRows.get(policyInputLocation).findElement(By.tagName("input")).sendKeys(String.valueOf(value));
}
private int findPolicy(PasswordPolicy policy) {
for (int i = 0; i < allRows.size(); i++) {
String policyName = allRows.get(i).findElement(ByJQuery.selector("td:eq(0)")).getText();
if(policyName.equals(policy.getName()))
return i;
}
return 0;
}
}

View file

@ -1,118 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.page.settings;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertEquals;
import org.keycloak.testsuite.admin.page.AbstractPage;
import org.keycloak.testsuite.admin.model.Role;
import static org.openqa.selenium.By.cssSelector;
import static org.openqa.selenium.By.linkText;
import static org.openqa.selenium.By.tagName;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import static org.keycloak.testsuite.admin.util.SeleniumUtils.*;
/**
*
* @author Petr Mensik
*/
public class RolesPage extends AbstractPage {
@FindBy(css = "input[class*='search']")
private WebElement searchInput;
@FindBy(css = "table[class*='table']")
private WebElement dataTable;
@FindBy(id = "name")
private WebElement nameInput;
@FindBy(id = "description")
private WebElement descriptionInput;
@FindBy(id = "compositeSwitch")
private WebElement compositeSwitchToggle;
@FindBy(id = "createRole")
private WebElement createButton;
@FindBy(id = "removeRole")
protected WebElement removeButton;
public boolean isRoleComposite(String roleName) {
return findRole(roleName).isComposite();
}
public void addRole(Role role) {
createButton.click();
waitAjaxForElement(nameInput);
nameInput.sendKeys(role.getName());
if (role.isComposite()) {
compositeSwitchToggle.click();
}
descriptionInput.sendKeys(role.getDescription());
primaryButton.click();
}
public Role findRole(String roleName) {
searchInput.sendKeys(roleName);
List<Role> roles = getAllRows();
assertEquals(1, roles.size());
return roles.get(0);
}
public void editRole(Role role) {
driver.findElement(linkText(role.getName())).click();
waitAjaxForElement(nameInput);
nameInput.sendKeys(role.getName());
if (role.isComposite()) {
compositeSwitchToggle.click();
}
descriptionInput.sendKeys(role.getDescription());
primaryButton.click();
}
public void deleteRole(Role role) {
driver.findElement(linkText(role.getName())).click();
waitAjaxForElement(removeButton);
removeButton.click();
deleteConfirmationButton.click();
}
public void deleteRole(String name) {
deleteRole(new Role(name));
}
private List<Role> getAllRows() {
List<Role> rows = new ArrayList<Role>();
for (WebElement rowElement : dataTable.findElements(cssSelector("tbody tr"))) {
Role role = new Role();
List<WebElement> tds = rowElement.findElements(tagName("td"));
if(!(tds.isEmpty() || tds.get(0).getText().isEmpty())) {
role.setName(tds.get(0).getText());
role.setComposite(Boolean.valueOf(tds.get(1).getText()));
role.setDescription(tds.get(2).getText());
rows.add(role);
}
}
return rows;
}
}

View file

@ -1,109 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.page.settings;
import org.jboss.arquillian.graphene.findby.FindByJQuery;
import org.keycloak.testsuite.admin.fragment.OnOffSwitch;
import org.keycloak.testsuite.admin.page.AbstractPage;
import org.keycloak.testsuite.admin.util.SeleniumUtils;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.Select;
/**
*
* @author Filip Kiss
*/
public class SecurityPage extends AbstractPage {
@FindByJQuery("a:contains('Brute Force Detection')")
private WebElement bruteForceProtectionLink;
@FindByJQuery("div[class='onoffswitch']")
private OnOffSwitch protectionEnabled;
@FindBy(id = "failureFactor")
private WebElement failureFactorInput;
@FindBy(id = "waitIncrement")
private WebElement waitIncrementInput;
@FindBy(id = "waitIncrementUnit")
private Select waitIncrementSelect;
@FindBy(id = "quickLoginCheckMilliSeconds")
private WebElement quickLoginCheckInput;
@FindBy(id = "minimumQuickLoginWait")
private WebElement minQuickLoginWaitInput;
@FindBy(id = "minimumQuickLoginWaitUnit")
private Select minQuickLoginWaitSelect;
@FindBy(id = "maxFailureWait")
private WebElement maxWaitInput;
@FindBy(id = "maxFailureWaitUnit")
private Select maxWaitSelect;
@FindBy(id = "maxDeltaTime")
private WebElement failureResetTimeInput;
@FindBy(id = "maxDeltaTimeUnit")
private Select failureResetTimeSelect;
public void goToAndEnableBruteForceProtectionTab() {
SeleniumUtils.waitGuiForElement(bruteForceProtectionLink);
bruteForceProtectionLink.click();
if(!protectionEnabled.isEnabled()){
protectionEnabled.enable();
}
}
public void setFailureFactorInput(String value){
failureFactorInput.clear();
failureFactorInput.sendKeys(value);
}
public void setWaitIncrementInput(String value){
waitIncrementInput.clear();
waitIncrementInput.sendKeys(value);
}
public void setQuickLoginCheckInput(String value){
quickLoginCheckInput.clear();
quickLoginCheckInput.sendKeys(value);
}
public void setMinQuickLoginWaitInput(String value){
minQuickLoginWaitInput.clear();
minQuickLoginWaitInput.sendKeys(value);
}
public void setMaxWaitInput(String value){
maxWaitInput.clear();
maxWaitInput.sendKeys(value);
}
public void setFailureResetTimeInput(String value){
failureResetTimeInput.clear();
failureResetTimeInput.sendKeys(value);
}
}

View file

@ -1,88 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.page.settings;
import java.util.ArrayList;
import java.util.List;
import org.jboss.arquillian.graphene.findby.FindByJQuery;
import static org.junit.Assert.assertNotNull;
import org.keycloak.testsuite.admin.model.Provider;
import org.keycloak.testsuite.admin.model.SocialProvider;
import org.keycloak.testsuite.admin.page.AbstractPage;
import static org.openqa.selenium.By.tagName;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.Select;
/**
*
* @author Petr Mensik
*/
public class SocialSettingsPage extends AbstractPage {
@FindBy(tagName = "select")
private Select newProviderSelect;
@FindByJQuery("input[class*='form-control']:eq(1)")
private WebElement providerKey;
@FindByJQuery("input[class*='form-control']:eq(2)")
private WebElement providerSecret;
@FindBy(tagName = "tbody")
private WebElement providersTable;
public void addNewProvider(Provider provider) {
newProviderSelect.selectByVisibleText(provider.providerName.getName());
providerKey.sendKeys(provider.key);
providerSecret.sendKeys(provider.secret);
primaryButton.click();
}
public void editProvider(SocialProvider oldProvider, Provider newProvider) {
Provider p = find(oldProvider);
assertNotNull("Provider should have been found", p);
System.out.println(p.providerName);
}
public Provider find(SocialProvider provider){
List<Provider> list = getAllRows();
for(Provider p : list) {
if(p.providerName == provider) {
return p;
}
}
return null;
}
private List<Provider> getAllRows() {
List<Provider> rows = new ArrayList<Provider>();
for (WebElement rowElement : providersTable.findElements(tagName("tr"))) {
Provider provider = new Provider();
List<WebElement> tds = rowElement.findElements(tagName("td"));
if(!(tds.isEmpty() || tds.get(0).getText().isEmpty())) {
provider.providerName = SocialProvider.valueOf(tds.get(0).getText());
provider.key = tds.get(1).getText();
provider.secret = tds.get(2).getText();
rows.add(provider);
}
}
return rows;
}
}

View file

@ -1,65 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.page.settings;
import java.util.concurrent.TimeUnit;
import org.keycloak.testsuite.admin.page.AbstractPage;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.Select;
import static java.lang.String.valueOf;
import static org.keycloak.testsuite.admin.util.SeleniumUtils.waitGuiForElement;
import static org.apache.commons.lang3.text.WordUtils.capitalize;
/**
*
* @author Petr Mensik
*/
public class TokensPage extends AbstractPage {
@FindBy(id = "ssoSessionIdleTimeout")
private WebElement sessionTimeout;
@FindBy(name = "ssoSessionIdleTimeoutUnit")
private Select sessionTimeoutUnit;
@FindBy(id = "ssoSessionMaxLifespan")
private WebElement sessionLifespanTimeout;
@FindBy(name = "ssoSessionMaxLifespanUnit")
private Select sessionLifespanTimeoutUnit;
public void setSessionTimeout(int timeout, TimeUnit unit) {
setTimeout(sessionTimeoutUnit, sessionTimeout, timeout, unit);
}
public void setSessionTimeoutLifespan(int time, TimeUnit unit) {
setTimeout(sessionLifespanTimeoutUnit, sessionLifespanTimeout, time, unit);
}
private void setTimeout(Select timeoutElement, WebElement unitElement,
int timeout, TimeUnit unit) {
waitGuiForElement(sessionTimeout);
timeoutElement.selectByValue(capitalize(unit.name().toLowerCase()));
unitElement.clear();
unitElement.sendKeys(valueOf(timeout));
primaryButton.click();
}
}

View file

@ -1,71 +0,0 @@
package org.keycloak.testsuite.admin.page.settings.user;
import org.keycloak.testsuite.admin.page.AbstractPage;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.Select;
import static org.keycloak.testsuite.admin.util.SeleniumUtils.waitGuiForElement;
/**
* Created by fkiss.
*/
public class RoleMappingsPage extends AbstractPage {
@FindBy(id = "available")
private Select availableRolesSelect;
@FindBy(id = "assigned")
private Select assignedRolesSelect;
@FindBy(id = "realm-composite")
private Select effectiveRolesSelect;
@FindBy(id = "available-client")
private Select availableClientRolesSelect;
@FindBy(id = "assigned-client")
private Select assignedClientRolesSelect;
@FindBy(css = "button[ng-click*='addRealm']")
private WebElement addSelected;
@FindBy(css = "button[ng-click*='addRealm']")
private WebElement addSelectedButton;
@FindBy(css = "button[ng-click*='deleteRealm']")
private WebElement removeSelectedButton;
@FindBy(id = "clients")
private Select clientRolesSelect;
public void addAvailableRole(String role){
waitGuiForElement(By.id("available"));
availableRolesSelect.selectByVisibleText(role);
addSelected.click();
}
public void removeAssignedRole(String client){
waitGuiForElement(By.id("assigned"));
assignedRolesSelect.selectByVisibleText(client);
removeSelectedButton.click();
}
public void selectClientRole(String client){
waitGuiForElement(By.id("clients"));
clientRolesSelect.selectByVisibleText(client);
}
public void addAvailableClientRole(String role){
waitGuiForElement(By.id("available-client"));
availableRolesSelect.selectByVisibleText(role);
addSelected.click();
}
public void removeAssignedClientRole(String client){
waitGuiForElement(By.id("assigned-client"));
assignedClientRolesSelect.selectByVisibleText(client);
removeSelectedButton.click();
}
}

View file

@ -1,204 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.page.settings.user;
import org.jboss.arquillian.graphene.findby.FindByJQuery;
import org.keycloak.testsuite.admin.model.User;
import org.keycloak.testsuite.admin.page.AbstractPage;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertEquals;
import org.keycloak.testsuite.admin.model.UserAction;
import static org.keycloak.testsuite.admin.util.SeleniumUtils.waitAjaxForElement;
import static org.openqa.selenium.By.*;
import org.openqa.selenium.support.ui.Select;
/**
*
* @author Filip Kiss
*/
public class UserPage extends AbstractPage {
@FindBy(id = "username")
private WebElement usernameInput;
@FindBy(id = "email")
private WebElement emailInput;
@FindBy(id = "firstName")
private WebElement firstNameInput;
@FindBy(id = "lastName")
private WebElement lastNameInput;
@FindBy(id = "emailVerified")
private WebElement emailVerifiedSwitchToggle;
@FindBy(css = "label[for='userEnabled']")
private WebElement userEnabledSwitchToggle;
@FindBy(css = "input[class*='select2-input']")
private WebElement requiredUserActionsInput;
@FindByJQuery(".select2-offscreen")
private Select actionsSelect;
@FindBy(id = "password")
private WebElement password;
@FindBy(id = "confirmPassword")
private WebElement confirmPassword;
@FindBy(id = "viewAllUsers")
private WebElement viewAllUsers;
@FindBy(id = "createUser")
private WebElement createUser;
@FindBy(id = "removeUser")
private WebElement removeUser;
@FindBy(css = "input[class*='search']")
private WebElement searchInput;
@FindBy(css = "table[class*='table']")
private WebElement dataTable;
@FindByJQuery("button[kc-cancel] ")
private WebElement cancel;
@FindBy(css = "div[class='input-group-addon'] i")
private WebElement searchButton;
public void addUser(User user) {
createUser.click();
waitAjaxForElement(usernameInput);
usernameInput.sendKeys(user.getUserName());
emailInput.sendKeys(user.getEmail());
firstNameInput.sendKeys(user.getFirstName());
lastNameInput.sendKeys(user.getLastName());
if (!user.isUserEnabled()) {
userEnabledSwitchToggle.click();
}
if (user.isEmailVerified()) {
emailVerifiedSwitchToggle.click();
}
// requiredUserActionsInput.sendKeys(user.getRequiredUserActions());
primaryButton.click();
}
public void addPasswordForUser(User user) {
password.sendKeys(user.getPassword());
confirmPassword.sendKeys(user.getPassword());
dangerButton.click();
waitAjaxForElement(deleteConfirmationButton);
deleteConfirmationButton.click();
}
public User findUser(String username) {
waitAjaxForElement(searchInput);
searchInput.sendKeys(username);
searchButton.click();
List<User> users = getAllRows();
if (users.isEmpty()) {
return null;
} else {
assertEquals(1, users.size());
return users.get(0);
}
}
public void editUser(User user) {
goToUser(user);
waitAjaxForElement(usernameInput);
usernameInput.sendKeys(user.getUserName());
emailInput.sendKeys(user.getEmail());
if (!user.isUserEnabled()) {
userEnabledSwitchToggle.click();
}
if (user.isEmailVerified()) {
emailVerifiedSwitchToggle.click();
}
requiredUserActionsInput.sendKeys(user.getRequiredUserActions());
primaryButton.click();
}
public void deleteUser(String username) {
searchInput.sendKeys(username);
searchButton.click();
driver.findElement(linkText(username)).click();
waitAjaxForElement(removeUser);
removeUser.click();
waitAjaxForElement(deleteConfirmationButton);
deleteConfirmationButton.click();
}
public void cancel() {
cancel.click();
}
public void showAllUsers() {
viewAllUsers.click();
}
public void goToUser(User user) {
dataTable.findElement(linkText(user.getUserName())).click();
}
public void goToUser(String name) {
goToUser(new User(name));
}
public void addAction(UserAction action) {
actionsSelect.selectByValue(action.name());
primaryButton.click();
}
public void removeAction(UserAction action) {
actionsSelect.deselectByValue(action.name());
primaryButton.click();
}
private List<User> getAllRows() {
List<User> users = new ArrayList<User>();
List<WebElement> rows = dataTable.findElements(cssSelector("tbody tr"));
if (rows.size() > 1) {
for (WebElement rowElement : rows) {
if (rowElement.isDisplayed()) {
User user = new User();
List<WebElement> tds = rowElement.findElements(tagName("td"));
if (!(tds.isEmpty() || tds.get(0).getText().isEmpty())) {
user.setUserName(tds.get(0).getText());
user.setLastName(tds.get(1).getText());
user.setFirstName(tds.get(2).getText());
user.setEmail(tds.get(3).getText());
users.add(user);
}
}
}
}
return users;
}
}

View file

@ -1,109 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.test.client;
import org.jboss.arquillian.graphene.findby.FindByJQuery;
import org.junit.Test;
import org.keycloak.testsuite.admin.fragment.FlashMessage;
import org.keycloak.testsuite.admin.model.Client;
import org.keycloak.testsuite.admin.page.settings.ClientPage;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.keycloak.testsuite.admin.AbstractKeycloakTest;
/**
*
* @author Filip Kiss
*/
public class AddNewClientTest extends AbstractKeycloakTest<ClientPage> {
@FindByJQuery(".alert")
private FlashMessage flashMessage;
@Before
public void beforeClientTest() {
navigation.clients();
page.goToCreateClient();
}
@Test
public void addNewClientTest() {
Client newClient = new Client("testClient1", "http://example.com/*");
page.addClient(newClient);
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
navigation.clients();
page.deleteClient(newClient.getName());
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
assertNull(page.findClient(newClient.getName()));
}
@Test
public void addNewClientWithBlankNameTest() {
Client newClient = new Client("", "http://example.com/*");
page.addClient(newClient);
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isDanger());
}
@Test
public void addNewClientWithBlankUriTest() {
Client newClient = new Client("testClient2", "");
page.addClient(newClient);
page.confirmAddClient();
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isDanger());
page.addUri("http://testUri.com/*");
page.confirmAddClient();
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
navigation.clients();
page.deleteClient(newClient.getName());
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
assertNull(page.findClient(newClient.getName()));
}
@Test
public void addNewClientWithTwoUriTest() {
Client newClient = new Client("testClient3", "");
page.addClient(newClient);
page.confirmAddClient();
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isDanger());
page.addUri("http://testUri.com/*");
page.addUri("http://example.com/*");
page.confirmAddClient();
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
navigation.clients();
page.deleteClient(newClient.getName());
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
assertNull(page.findClient(newClient.getName()));
}
}

View file

@ -1,92 +0,0 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.keycloak.testsuite.admin.test.role;
import org.jboss.arquillian.graphene.findby.FindByJQuery;
import org.jboss.arquillian.graphene.page.Page;
import org.junit.Test;
import org.keycloak.testsuite.admin.page.settings.RolesPage;
import org.keycloak.testsuite.admin.model.Role;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Ignore;
import org.keycloak.testsuite.admin.AbstractKeycloakTest;
import org.keycloak.testsuite.admin.fragment.FlashMessage;
import org.keycloak.testsuite.admin.page.settings.user.UserPage;
import static org.openqa.selenium.By.id;
import org.openqa.selenium.support.ui.Select;
/**
*
* @author Petr Mensik
*/
public class AddNewRoleTest extends AbstractKeycloakTest<RolesPage> {
@Page
private UserPage userPage;
@FindByJQuery(".alert")
private FlashMessage flashMessage;
@Before
public void beforeTestAddNewRole() {
navigation.roles();
}
@Test
public void testAddNewRole() {
Role role = new Role("role1");
page.addRole(role);
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
navigation.roles();
assertEquals("role1", page.findRole(role.getName()).getName());
page.deleteRole(role);
}
@Ignore
@Test
public void testAddNewRoleWithLongName() {
String name = "hjewr89y1894yh98(*&*&$jhjkashd)*(&y8934h*&@#hjkahsdj";
page.addRole(new Role(name));
assertNotNull(page.findRole(name));
navigation.roles();
page.deleteRole(name);
}
@Test
public void testAddExistingRole() {
Role role = new Role("role2");
page.addRole(role);
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
navigation.roles();
page.addRole(role);
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isDanger());
navigation.roles();
page.deleteRole(role);
}
@Test
public void testRoleIsAvailableForUsers() {
Role role = new Role("User role");
page.addRole(role);
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
navigation.users();
userPage.showAllUsers();
userPage.goToUser("admin");
navigation.roleMappings("Admin");
Select rolesSelect = new Select(driver.findElement(id("available")));
assertEquals("User role should be present in admin role mapping",
role.getName(), rolesSelect.getOptions().get(0).getText());
navigation.roles();
page.deleteRole(role);
}
}

View file

@ -1,44 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.test.session;
import org.junit.Before;
import org.junit.Test;
import org.keycloak.testsuite.admin.AbstractKeycloakTest;
import org.keycloak.testsuite.admin.page.session.SessionsPage;
import static org.keycloak.testsuite.admin.util.SeleniumUtils.waitGuiForElement;
/**
*
* @author Petr Mensik
*/
public class SessionsTest extends AbstractKeycloakTest<SessionsPage> {
@Before
public void beforeSessionTest() {
navigation.sessions();
}
@Test
public void testLogoutAllSessions() {
page.logoutAllSessions();
waitGuiForElement(loginPage.getLoginPageHeader(), "Home page should be visible after logout");
loginPage.loginAsAdmin();
}
}

View file

@ -1,70 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.test.session;
import java.util.concurrent.TimeUnit;
import org.junit.Before;
import org.junit.Test;
import org.keycloak.testsuite.admin.page.settings.TokensPage;
import static org.jboss.arquillian.graphene.Graphene.waitModel;
import org.keycloak.testsuite.admin.AbstractKeycloakTest;
import static org.keycloak.testsuite.admin.util.SeleniumUtils.waitGuiForElement;
/**
*
* @author Petr Mensik
*/
public class TokensTest extends AbstractKeycloakTest<TokensPage> {
private static final int TIMEOUT = 10;
private static final TimeUnit TIME_UNIT = TimeUnit.SECONDS;
@Before
public void beforeTokensTest() {
navigation.tokens();
}
@Test
public void testTimeoutForRealmSession() throws InterruptedException {
page.setSessionTimeout(TIMEOUT, TIME_UNIT);
TIME_UNIT.sleep(TIMEOUT + 2); //add 2 secs to timeout
driver.navigate().refresh();
waitGuiForElement(loginPage.getLoginPageHeader(), "Home page should be visible after session timeout");
loginPage.loginAsAdmin();
page.setSessionTimeout(30, TimeUnit.MINUTES);
}
@Test
public void testLifespanOfRealmSession() {
page.setSessionTimeoutLifespan(TIMEOUT, TIME_UNIT);
logOut();
loginAsAdmin();
waitModel().withTimeout(TIMEOUT + 2, TIME_UNIT) //adds 2 seconds to the timeout
.pollingEvery(1, TIME_UNIT)
.until("Home page should be visible after session timeout")
.element(loginPage.getLoginPageHeader())
.is()
.present();
loginPage.loginAsAdmin();
navigation.tokens();
page.setSessionTimeoutLifespan(10, TimeUnit.HOURS);
}
}

View file

@ -1,44 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.test.settings;
import org.junit.Before;
import org.junit.Test;
import org.keycloak.testsuite.admin.AbstractKeycloakTest;
import org.keycloak.testsuite.admin.model.PasswordPolicy;
import org.keycloak.testsuite.admin.page.settings.PasswordPolicyPage;
/**
*
* @author Petr Mensik
*/
public class PasswordPolicyTest extends AbstractKeycloakTest<PasswordPolicyPage> {
@Before
public void beforeCredentialsTest() {
navigation.passwordPolicy();
}
@Test
public void testDigitsNumber() {
page.addPolicy(PasswordPolicy.HASH_ITERATIONS, 5);
page.removePolicy(PasswordPolicy.DIGITS);
}
}

View file

@ -1,38 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.test.settings;
import org.junit.Test;
import org.keycloak.testsuite.admin.AbstractKeycloakTest;
import org.keycloak.testsuite.admin.page.settings.SecurityPage;
/**
*
* @author Filip Kiss
*/
public class SecuritySettingsTest extends AbstractKeycloakTest<SecurityPage> {
@Test
public void securitySettingsTest() {
navigation.security();
page.goToAndEnableBruteForceProtectionTab();
//TODO:
}
}

View file

@ -1,66 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.test.settings;
import org.jboss.arquillian.graphene.findby.FindByJQuery;
import static org.junit.Assert.*;
import org.junit.Test;
import org.keycloak.testsuite.admin.page.settings.SocialSettingsPage;
import org.keycloak.testsuite.admin.AbstractKeycloakTest;
import org.keycloak.testsuite.admin.fragment.FlashMessage;
import org.keycloak.testsuite.admin.model.Provider;
import org.keycloak.testsuite.admin.model.SocialProvider;
import org.keycloak.testsuite.admin.util.URL;
/**
*
* @author Petr Mensik
*/
public class SocialSettingsTest extends AbstractKeycloakTest<SocialSettingsPage> {
@FindByJQuery(".alert")
private FlashMessage flashMessage;
// @Test
public void testAddNewProvider() {
page.addNewProvider(new Provider(SocialProvider.FACEBOOK, "klic", "secret"));
flashMessage.waitUntilPresent();
assertTrue("Success message should be displayed", flashMessage.isSuccess());
}
// @Test(expected = NoSuchElementException.class)
public void testDuplicitProvider() {
page.addNewProvider(new Provider(SocialProvider.FACEBOOK, "a", "b"));
}
// @Test
public void testEditProvider() {
page.goToPage(URL.SETTINGS_SOCIAL);
page.editProvider(SocialProvider.FACEBOOK, new Provider(SocialProvider.FACEBOOK, "abc", "def"));
}
// @Test
public void testDeleteProvider() {
}
@Test
public void testAddMultipleProviders() {
}
}

View file

@ -1,56 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.test.settings;
import org.junit.Before;
import org.junit.Test;
import org.keycloak.testsuite.admin.AbstractKeycloakTest;
import org.keycloak.testsuite.admin.model.Theme;
import org.keycloak.testsuite.admin.page.settings.ThemesSettingsPage;
/**
*
* @author Filip Kiss
*/
public class ThemesSettingsTest extends AbstractKeycloakTest<ThemesSettingsPage> {
@Before
public void beforeThemeTest() {
navigation.themes();
}
@Test
public void changeLoginThemeTest() {
page.changeLoginTheme(Theme.BASE.getName());
page.saveTheme();
logOut();
page.verifyBaseTheme();
loginAsAdmin();
navigation.themes();
page.changeLoginTheme(Theme.KEYCLOAK.getName());
page.saveTheme();
logOut();
page.verifyKeycloakTheme();
loginAsAdmin();
}
}

View file

@ -1,119 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.test.user;
import org.jboss.arquillian.graphene.findby.FindByJQuery;
import org.junit.Test;
import org.keycloak.testsuite.admin.fragment.FlashMessage;
import org.keycloak.testsuite.admin.model.User;
import org.keycloak.testsuite.admin.page.settings.user.UserPage;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Ignore;
import org.keycloak.testsuite.admin.AbstractKeycloakTest;
import static org.keycloak.testsuite.admin.util.Users.TEST_USER1;
/**
*
* @author Filip Kiss
*/
public class AddNewUserTest extends AbstractKeycloakTest<UserPage> {
@FindByJQuery(".alert")
private FlashMessage flashMessage;
@Before
public void beforeAddNewUserTest() {
navigation.users();
}
@Test
public void addUserWithInvalidEmailTest() {
String testUsername = "testUserInvEmail";
String invalidEmail = "user.redhat.com";
User testUser = new User(testUsername, "pass", invalidEmail);
page.addUser(testUser);
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isDanger());
navigation.users();
assertNull(page.findUser(testUsername));
}
@Test
public void addUserWithNoUsernameTest() {
User testUser = new User();
page.addUser(testUser);
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isDanger());
}
@Ignore
@Test
public void addUserWithLongNameTest() {
String longUserName = "thisisthelongestnameeveranditcannotbeusedwhencreatingnewuserinkeycloak";
User testUser = new User(longUserName);
navigation.users();
page.addUser(testUser);
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isDanger());
assertNull(page.findUser(testUser.getUserName()));
}
@Test
public void addDuplicatedUser() {
String testUsername = "test_duplicated_user";
User testUser = new User(testUsername);
page.addUser(testUser);
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
navigation.users();
assertNotNull(page.findUser(testUsername));
User testUser2 = new User(testUsername);
page.addUser(testUser2);
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isDanger());
navigation.users();
page.deleteUser(testUsername);
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
assertNull(page.findUser(testUser2.getUserName()));
}
@Test
public void addDisabledUser() {
User disabledUser = new User(TEST_USER1);
disabledUser.setUserEnabled(false);
disabledUser.setUserName("disabled_user");
page.addUser(disabledUser);
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
navigation.users();
page.deleteUser(disabledUser.getUserName());
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
assertNull(page.findUser(disabledUser.getUserName()));
}
}

View file

@ -1,72 +0,0 @@
package org.keycloak.testsuite.admin.test.user;
import org.jboss.arquillian.graphene.findby.FindByJQuery;
import org.jboss.arquillian.graphene.page.Page;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.keycloak.testsuite.admin.AbstractKeycloakTest;
import org.keycloak.testsuite.admin.fragment.FlashMessage;
import org.keycloak.testsuite.admin.model.User;
import org.keycloak.testsuite.admin.page.settings.user.RoleMappingsPage;
import org.keycloak.testsuite.admin.page.settings.user.UserPage;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.openqa.selenium.By.linkText;
/**
* Created by fkiss.
*/
public class RoleMappingsTest extends AbstractKeycloakTest<RoleMappingsPage> {
@Page
private UserPage userPage;
@FindByJQuery(".alert")
private FlashMessage flashMessage;
@Before
public void beforeAddNewUserTest() {
navigation.users();
}
@Test
public void addUserAndAssignRole() {
String testUsername = "tester1";
User testUser = new User(testUsername, "pass");
userPage.addUser(testUser);
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
navigation.users();
userPage.findUser(testUsername);
driver.findElement(linkText(testUsername)).click();
navigation.roleMappings(testUsername);
page.addAvailableRole("create-realm");
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
navigation.users();
userPage.deleteUser(testUsername);
}
@Ignore
@Test
public void addAndRemoveUserAndAssignRole() {
String testUsername = "tester2";
User testUser = new User(testUsername, "pass");
userPage.addUser(testUser);
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
navigation.users();
userPage.findUser(testUsername);
driver.findElement(linkText(testUsername)).click();
navigation.roleMappings(testUsername);
page.addAvailableRole("create-realm");
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
page.removeAssignedRole("create-realm");
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
navigation.users();
userPage.deleteUser(testUsername);
}
}

View file

@ -1,36 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.admin.util;
import org.keycloak.testsuite.admin.model.User;
/**
*
* @author Petr Mensik
*/
public final class Users {
private Users() {
}
public static final User ADMIN = new User("admin", "admin");
public static final User EMPTY_USER = new User();
public static final User TEST_USER1 = new User("user", "password", "user@redhat.com", "user", "test");
}

View file

@ -1,136 +0,0 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* 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.
*/
package org.keycloak.testsuite.login;
import org.jboss.arquillian.graphene.findby.FindByJQuery;
import org.jboss.arquillian.graphene.page.Page;
import org.junit.After;
import org.junit.Ignore;
import org.junit.Test;
import org.keycloak.testsuite.admin.fragment.FlashMessage;
import org.keycloak.testsuite.admin.model.User;
import org.keycloak.testsuite.admin.page.RegisterPage;
import org.keycloak.testsuite.admin.page.settings.user.UserPage;
import static org.junit.Assert.*;
import org.junit.Before;
import org.keycloak.testsuite.admin.AbstractKeycloakTest;
import org.keycloak.testsuite.admin.page.settings.LoginSettingsPage;
import static org.keycloak.testsuite.admin.util.Users.*;
/**
*
* @author Petr Mensik
*/
// Ignoring this test as it's not working and it's duplicating existing tests
@Ignore
public class RegisterNewUserTest extends AbstractKeycloakTest<RegisterPage> {
@Page
private UserPage userPage;
@Page
private LoginSettingsPage loginSettingsPage;
@FindByJQuery(".alert")
private FlashMessage flashMessage;
@Before
public void beforeUserRegistration() {
navigation.settings();
navigation.login();
loginSettingsPage.enableUserRegistration();
logOut();
openAccount();
loginPage.goToUserRegistration();
}
@After
public void afterUserRegistration() {
navigation.settings();
navigation.login();
loginSettingsPage.disableUserRegistration();
}
@Test
public void registerNewUserTest() {
page.registerNewUser(TEST_USER1);
logOut();
loginAsAdmin();
navigation.users();
userPage.deleteUser(TEST_USER1.getUserName());
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
}
@Test
public void registerNewUserWithWrongEmail() {
User testUser = new User(TEST_USER1);
testUser.setEmail("newUser.redhat.com");
page.registerNewUser(testUser);
assertTrue(page.isInvalidEmail());
page.backToLoginPage();
loginAsAdmin();
navigation.users();
assertNull(userPage.findUser(testUser.getUserName()));
}
@Test
public void registerNewUserWithWrongAttributes() {
User testUser = new User();
page.registerNewUser(testUser);
assertFalse(page.isAttributeSpecified("first name"));
testUser.setFirstName("name");
page.registerNewUser(testUser);
assertFalse(page.isAttributeSpecified("last name"));
testUser.setLastName("surname");
page.registerNewUser(testUser);
assertFalse(page.isAttributeSpecified("email"));
testUser.setEmail("mail@redhat.com");
page.registerNewUser(testUser);
assertFalse(page.isAttributeSpecified("username"));
testUser.setUserName("user");
page.registerNewUser(testUser);
assertFalse(page.isAttributeSpecified("password"));
testUser.setPassword("password");
page.registerNewUser(testUser);
logOut();
loginAsAdmin();
navigation.users();
userPage.deleteUser(TEST_USER1.getUserName());
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
}
@Test
public void registerNewUserWithNotMatchingPasswords() {
page.registerNewUser(TEST_USER1, "psswd");
assertFalse(page.isPasswordSame());
page.registerNewUser(TEST_USER1);
logOut();
loginAsAdmin();
navigation.users();
userPage.deleteUser(TEST_USER1.getUserName());
flashMessage.waitUntilPresent();
assertTrue(flashMessage.getText(), flashMessage.isSuccess());
}
}

View file

@ -1,23 +0,0 @@
<arquillian xmlns="http://jboss.org/schema/arquillian"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.org/schema/arquillian
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<container qualifier="wildfly-8-remote">
<protocol type="jmx-as7">
<property name="executionType">REMOTE</property>
</protocol>
</container>
<container qualifier="wildfly-8-managed">
<configuration>
<property name="jbossHome">${jbossHome}</property>
<property name="serverConfig">standalone.xml</property>
</configuration>
</container>
<extension qualifier="webdriver">
<property name="browser">${browser}</property>
</extension>
</arquillian>

View file

@ -0,0 +1,137 @@
<?xml version="1.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">
<parent>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-tests-adapters</artifactId>
<version>1.6.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-arquillian-adapters-as7</artifactId>
<name>Adapter Tests on JBossAS 7</name>
<properties>
<as7.version>7.1.1.Final</as7.version>
<app.server.as7.home>${containers.home}/jboss-as-${as7.version}</app.server.as7.home>
<adapter.libs.as7>${containers.home}/keycloak-as7-adapter-dist</adapter.libs.as7>
</properties>
<dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-dist</artifactId>
<version>${as7.version}</version>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-as7-adapter-dist</artifactId>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-managed</artifactId>
<version>7.2.0.Final</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-as7-and-adapter</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-dist</artifactId>
<version>${as7.version}</version>
<type>zip</type>
<outputDirectory>${containers.home}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-as7-adapter-dist</artifactId>
<type>zip</type>
<outputDirectory>${adapter.libs.as7}</outputDirectory>
</artifactItem>
</artifactItems>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<app.server.as7>true</app.server.as7>
<app.server.as7.home>${app.server.as7.home}</app.server.as7.home>
<adapter.libs.as7>${adapter.libs.as7}</adapter.libs.as7>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>adapter-libs-provided</id>
<activation>
<property>
<name>!adapter.libs.bundled</name>
</property>
</activation>
<properties>
<adapter.libs.as7>${app.server.as7.home}</adapter.libs.as7>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
<id>configure-adapter-subsystem</id>
<phase>process-resources</phase>
<goals>
<goal>transform</goal>
</goals>
<configuration>
<transformationSets>
<transformationSet>
<dir>${app.server.as7.home}/standalone/configuration</dir>
<includes>
<include>standalone.xml</include>
</includes>
<stylesheet>src/main/xslt/standalone.xsl</stylesheet>
<outputDir>${app.server.as7.home}/standalone/configuration</outputDir>
</transformationSet>
</transformationSets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View file

@ -0,0 +1,36 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:a="http://jboss.org/schema/arquillian"
version="2.0"
exclude-result-prefixes="xalan a">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/a:arquillian">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<container qualifier="app-server-as7" mode="manual" >
<configuration>
<property name="enabled">${app.server.as7}</property>
<property name="adapterImplClass">org.jboss.as.arquillian.container.managed.ManagedDeployableContainer</property>
<property name="jbossHome">${app.server.as7.home}</property>
<property name="javaVmArguments">-Djboss.socket.binding.port-offset=${app.server.port.offset} -Xms64m -Xmx512m -XX:MaxPermSize=256m ${adapter.test.props}</property>
<property name="managementAddress">localhost</property>
<property name="managementPort">${app.server.management.port.jmx}</property>
</configuration>
</container>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,51 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:j="urn:jboss:domain:1.2"
xmlns:ds="urn:jboss:domain:datasources:1.0"
xmlns:k="urn:jboss:domain:keycloak:1.1"
xmlns:sec="urn:jboss:domain:security:1.1"
version="2.0"
exclude-result-prefixes="xalan j ds k sec">
<xsl:param name="config"/>
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="//j:extensions">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<extension module="org.keycloak.keycloak-adapter-subsystem"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//j:profile">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<subsystem xmlns="urn:jboss:domain:keycloak:1.1"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//sec:security-domains">
<xsl:copy>
<xsl:apply-templates select="node()[name(.)='security-domain']"/>
<security-domain name="keycloak">
<authentication>
<login-module code="org.keycloak.adapters.jboss.KeycloakLoginModule" flag="required"/>
</authentication>
</security-domain>
<security-domain name="sp" cache-type="default">
<authentication>
<login-module code="org.picketlink.identity.federation.bindings.wildfly.SAML2LoginModule" flag="required"/>
</authentication>
</security-domain>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,12 @@
package org.keycloak.testsuite.adapter.servlet;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
*
* @author tkyjovsk
*/
@AppServerContainer("app-server-as7")
public class AS7DemoServletsAdapterTest extends AbstractDemoServletsAdapterTest {
}

View file

@ -0,0 +1,12 @@
package org.keycloak.testsuite.adapter.servlet;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
*
* @author tkyjovsk
*/
@AppServerContainer("app-server-as7")
public class AS7SessionServletAdapterTest extends AbstractSessionServletAdapterTest {
}

View file

@ -0,0 +1,121 @@
<?xml version="1.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">
<parent>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-tests-adapters</artifactId>
<version>1.6.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-arquillian-adapters-karaf</artifactId>
<name>Adapter Tests on Karaf</name>
<properties>
<karaf.version>3.0.3</karaf.version>
<karaf.home>${project.build.directory}/assembly</karaf.home>
<!--fuse examples expect auth server on 8080-->
<auth.server.port.offset>0</auth.server.port.offset>
<auth.server.http.port>8080</auth.server.http.port>
<auth.server.management.port>9990</auth.server.management.port>
<!--fuse examples expect default karaf http port 8181-->
<app.server.http.port>8181</app.server.http.port>
</properties>
<dependencies>
<!-- for karaf-maven-plugin -->
<dependency>
<groupId>org.apache.karaf.features</groupId>
<artifactId>framework</artifactId>
<version>${karaf.version}</version>
<type>kar</type>
</dependency>
<dependency>
<groupId>org.apache.camel.karaf</groupId>
<artifactId>apache-camel</artifactId>
<version>2.12.5</version>
<classifier>features</classifier>
<type>xml</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf.karaf</groupId>
<artifactId>apache-cxf</artifactId>
<version>2.7.14</version>
<classifier>features</classifier>
<type>xml</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-osgi-features</artifactId>
<version>${project.version}</version>
<classifier>features</classifier>
<type>xml</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.keycloak.example.demo</groupId>
<artifactId>keycloak-fuse-example-features</artifactId>
<version>${project.version}</version>
<classifier>features</classifier>
<type>xml</type>
<scope>runtime</scope>
</dependency>
<!-- for arquillian -->
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-karaf-managed</artifactId>
<version>2.1.0.CR18</version>
</dependency>
<dependency>
<groupId>org.apache.aries.jmx</groupId>
<artifactId>org.apache.aries.jmx</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>${karaf.version}</version>
<extensions>true</extensions>
<executions>
<execution>
<id>prepare-karaf-with-examples</id>
<phase>generate-test-resources</phase>
<goals>
<!-- creates custom karaf distro in ${project.build.directory}/assembly -->
<goal>install-kars</goal>
</goals>
</execution>
</executions>
<configuration>
<bootFeatures>
<!-- this installs all fuse examples -->
<feature>keycloak-fuse-example</feature>
</bootFeatures>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<app.server.karaf>true</app.server.karaf>
<karaf.home>${karaf.home}</karaf.home>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,38 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:a="http://jboss.org/schema/arquillian"
version="2.0"
exclude-result-prefixes="xalan a">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/a:arquillian">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<container qualifier="app-server-karaf" mode="manual" >
<configuration>
<property name="enabled">${app.server.karaf}</property>
<property name="adapterImplClass">org.jboss.arquillian.container.osgi.karaf.managed.KarafManagedDeployableContainer</property>
<property name="autostartBundle">false</property>
<property name="karafHome">${karaf.home}</property>
<property name="javaVmArguments">-agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=n ${adapter.test.props}</property>
<property name="jmxServiceURL">service:jmx:rmi://127.0.0.1:44444/jndi/rmi://127.0.0.1:1099/karaf-root</property>
<property name="jmxUsername">karaf</property>
<property name="jmxPassword">karaf</property>
</configuration>
</container>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,12 @@
package org.keycloak.testsuite.adapter.example;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
*
* @author tkyjovsk
*/
@AppServerContainer("app-server-karaf")
public class KarafFuseExampleAdapterTest extends AbstractFuseExampleAdapterTest {
}

View file

@ -0,0 +1,348 @@
<?xml version="1.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">
<parent>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-tests</artifactId>
<version>1.6.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-arquillian-tests-adapters</artifactId>
<packaging>pom</packaging>
<name>Adapter Tests</name>
<properties>
<app.server.port.offset>200</app.server.port.offset>
<app.server.http.port>8280</app.server.http.port>
<app.server.management.port>10190</app.server.management.port>
<app.server.management.port.jmx>10199</app.server.management.port.jmx>
<adapter.test.props>-Dapp.server.base.url=http://localhost:${app.server.http.port} -Dmy.host.name=localhost</adapter.test.props>
<exclude.adapters>-</exclude.adapters>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-common-arquillian-xml</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-tests-base</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<includes>**/arquillian.xml</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>add-app-server-to-arquillian-xml</id>
<phase>process-resources</phase>
<goals>
<goal>transform</goal>
</goals>
<configuration>
<transformationSets>
<transformationSet>
<dir>${project.build.directory}/dependency</dir>
<includes>
<include>arquillian.xml</include>
</includes>
<stylesheet>src/main/xslt/arquillian.xsl</stylesheet>
<outputDir>${project.build.directory}/dependency</outputDir>
</transformationSet>
</transformationSets>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<arquillian.xml>${project.build.directory}/dependency/arquillian.xml</arquillian.xml>
<app.server.port.offset>${app.server.port.offset}</app.server.port.offset>
<app.server.http.port>${app.server.http.port}</app.server.http.port>
<app.server.management.port>${app.server.management.port}</app.server.management.port>
<app.server.management.port.jmx>${app.server.management.port.jmx}</app.server.management.port.jmx>
<adapter.test.props>${adapter.test.props}</adapter.test.props>
<adapter.libs.mode>bundled</adapter.libs.mode>
<adapter.config.mode>provided</adapter.config.mode>
</systemPropertyVariables>
<excludes>
<exclude>${exclude.adapters}</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>common-for-adapter-tests</id>
<activation>
<file>
<exists>src</exists>
</file>
</activation>
<dependencies>
<dependency>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-tests-base</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-tests-base</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>adapter-libs-provided</id>
<activation>
<property>
<name>!adapter.libs.bundled</name>
</property>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<adapter.libs.mode>provided</adapter.libs.mode>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
<profile>
<id>examples</id>
<activation>
<property>
<name>!skipTests</name>
</property>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>example-wars</id>
<phase>generate-test-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.keycloak.example.demo</groupId>
<artifactId>product-portal-example</artifactId>
<version>${project.version}</version>
<type>war</type>
</artifactItem>
<artifactItem>
<groupId>org.keycloak.example.demo</groupId>
<artifactId>customer-portal-example</artifactId>
<version>${project.version}</version>
<type>war</type>
</artifactItem>
<artifactItem>
<groupId>org.keycloak.example.demo</groupId>
<artifactId>database-service</artifactId>
<version>${project.version}</version>
<type>war</type>
</artifactItem>
<artifactItem>
<groupId>org.keycloak.example.demo</groupId>
<artifactId>js-console</artifactId>
<version>${project.version}</version>
<type>war</type>
</artifactItem>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>examples-multitenant</artifactId>
<version>${project.version}</version>
<type>war</type>
</artifactItem>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>examples-basicauth</artifactId>
<version>${project.version}</version>
<type>war</type>
</artifactItem>
<artifactItem>
<groupId>org.keycloak.example.demo</groupId>
<artifactId>cors-angular-product-example</artifactId>
<version>${project.version}</version>
<type>war</type>
</artifactItem>
<artifactItem>
<groupId>org.keycloak.example.demo</groupId>
<artifactId>cors-database-service</artifactId>
<version>${project.version}</version>
<type>war</type>
</artifactItem>
</artifactItems>
<outputDirectory>${examples.home}</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
<execution>
<id>example-realms</id>
<phase>generate-test-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-examples-dist</artifactId>
<version>${project.version}</version>
<type>zip</type>
<includes>**/*realm.json</includes>
</artifactItem>
</artifactItems>
<outputDirectory>${examples.home}</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<examples.home>${examples.home}</examples.home>
<examples.version.suffix>${project.version}</examples.version.suffix>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${examples.home}</outputDirectory>
<resources>
<resource>
<directory>${basedir}/src/test/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
<profile>
<id>auth-server-wildfly</id>
<modules>
<module>wildfly-relative</module>
</modules>
</profile>
<profile>
<id>app-server-wildfly</id>
<modules>
<module>wildfly</module>
</modules>
</profile>
<profile>
<id>app-server-wildfly8</id>
<modules>
<module>wildfly8</module>
</modules>
</profile>
<profile>
<id>app-server-as7</id>
<modules>
<module>as7</module>
</modules>
</profile>
<profile>
<id>app-server-tomcat</id>
<modules>
<module>tomcat</module>
</modules>
</profile>
<profile>
<id>app-server-karaf</id>
<modules>
<module>karaf</module>
</modules>
</profile>
<profile>
<id>no-adapter-tests</id>
<properties>
<!-- Exclude all adapters tests. -->
<exclude.adapters>**/adapter/**/*Test.java</exclude.adapters>
</properties>
</profile>
</profiles>
</project>

View file

@ -0,0 +1,136 @@
<?xml version="1.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">
<parent>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-tests-adapters</artifactId>
<version>1.6.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-arquillian-adapters-tomcat</artifactId>
<name>Adapter Tests on Tomcat</name>
<properties>
<tomcat.version>8.0.23</tomcat.version>
<tomcat.home>${containers.home}/apache-tomcat-${tomcat.version}</tomcat.home>
<!-- FIXME disabled port-offset because tomcat doesn't support it -->
<app.server.port.offset>0</app.server.port.offset>
<app.server.http.port>8080</app.server.http.port>
<app.server.management.port>9990</app.server.management.port>
</properties>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-tomcat-managed-7</artifactId>
<version>1.0.0.CR7</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>unpack-tomcat-and-adapter</id>
<phase>generate-test-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat</artifactId>
<version>${tomcat.version}</version>
<type>zip</type>
<outputDirectory>${containers.home}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-tomcat8-adapter-dist</artifactId>
<version>${project.version}</version>
<type>zip</type>
<outputDirectory>${tomcat.home}/lib</outputDirectory>
</artifactItem>
</artifactItems>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
<execution>
<id>libs-for-tomcat</id>
<phase>generate-test-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
</artifactItem>
<artifactItem>
<groupId>org.jboss.resteasy</groupId>
<artifactId>jaxrs-api</artifactId>
</artifactItem>
<artifactItem>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
</artifactItem>
<artifactItem>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.4</version>
</artifactItem>
</artifactItems>
<outputDirectory>${tomcat.home}/lib</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
<id>add-tomcat-manager-user</id>
<phase>process-test-resources</phase>
<goals>
<goal>transform</goal>
</goals>
<configuration>
<transformationSets>
<transformationSet>
<dir>${tomcat.home}/conf</dir>
<stylesheet>src/main/xslt/tomcat-users.xsl</stylesheet>
<includes>
<include>tomcat-users.xml</include>
</includes>
<outputDir>${tomcat.home}/conf</outputDir>
</transformationSet>
</transformationSets>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<app.server.tomcat>true</app.server.tomcat>
<tomcat.home>${tomcat.home}</tomcat.home>
<!-- TODO: implement port-offset for tomcat server.xml so we can shift from 8080 -->
<app.server.management.port.tomcat>8089</app.server.management.port.tomcat>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,39 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:a="http://jboss.org/schema/arquillian"
version="2.0"
exclude-result-prefixes="xalan a">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/a:arquillian">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<container qualifier="app-server-tomcat" mode="manual" >
<configuration>
<property name="enabled">${app.server.tomcat}</property>
<property name="adapterImplClass">org.jboss.arquillian.container.tomcat.managed_7.TomcatManagedContainer</property>
<property name="catalinaHome">${tomcat.home}</property>
<property name="catalinaBase">${tomcat.home}</property>
<property name="bindHttpPort">${app.server.http.port}</property>
<property name="jmxPort">${app.server.management.port.tomcat}</property>
<property name="user">manager</property>
<property name="pass">arquillian</property>
<property name="javaVmArguments">${adapter.test.props}</property>
</configuration>
</container>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,23 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:tu="http://tomcat.apache.org/xml"
version="2.0"
exclude-result-prefixes="xalan tu">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no" />
<xsl:strip-space elements="*"/>
<xsl:template match="//tu:tomcat-users">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<user username="manager" password="arquillian" roles="manager-script"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,15 @@
package org.keycloak.testsuite.adapter.example;
import org.junit.Ignore;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
*
* @author tkyjovsk
*/
@AppServerContainer("app-server-tomcat")
@Ignore
public class TomcatBasicAuthExampleAdapterTest extends AbstractBasicAuthExampleAdapterTest {
// TODO find out how to add context.xml dependent on app context (web.xml/module-name)
}

View file

@ -0,0 +1,16 @@
package org.keycloak.testsuite.adapter.example;
import org.junit.Ignore;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
*
* @author tkyjovsk
*/
@AppServerContainer("app-server-tomcat")
@Ignore
public class TomcatDemoExampleAdapterTest extends AbstractDemoExampleAdapterTest {
// TODO find out how to add context.xml dependent on app context (web.xml/module-name)
}

View file

@ -0,0 +1,12 @@
package org.keycloak.testsuite.adapter.servlet;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
*
* @author tkyjovsk
*/
@AppServerContainer("app-server-tomcat")
public class TomcatDemoServletsAdapterTest extends AbstractDemoServletsAdapterTest {
}

View file

@ -0,0 +1,12 @@
package org.keycloak.testsuite.adapter.servlet;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
*
* @author tkyjovsk
*/
@AppServerContainer("app-server-tomcat")
public class TomcatSessionServletAdapterTest extends AbstractSessionServletAdapterTest {
}

View file

@ -0,0 +1,82 @@
<?xml version="1.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">
<parent>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-tests-adapters</artifactId>
<version>1.6.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-arquillian-adapters-wildfly-relative</artifactId>
<name>Adapter Tests on Wildfly Relative</name>
<properties>
<adapter.libs.wildfly>${containers.home}/keycloak-wf9-adapter-dist</adapter.libs.wildfly>
<!--this is needed for adapter tests that load system properties in adapter config-->
<app.server.http.port>${auth.server.http.port}</app.server.http.port>
</properties>
<dependencies>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-wf9-adapter-dist</artifactId>
<type>zip</type>
</dependency>
</dependencies>
<profiles>
<profile>
<id>adapter-libs-bundled</id>
<activation>
<property>
<name>adapter.libs.bundled</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-adapter</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-wf9-adapter-dist</artifactId>
<version>${project.version}</version>
<type>zip</type>
<outputDirectory>${adapter.libs.wildfly}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<adapter.libs.wildfly>${adapter.libs.wildfly}</adapter.libs.wildfly>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View file

@ -0,0 +1,16 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:a="http://jboss.org/schema/arquillian"
version="2.0"
exclude-result-prefixes="xalan a">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,51 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:j="urn:jboss:domain:3.0"
xmlns:ds="urn:jboss:domain:datasources:3.0"
xmlns:k="urn:jboss:domain:keycloak:1.1"
xmlns:sec="urn:jboss:domain:security:1.2"
version="2.0"
exclude-result-prefixes="xalan j ds k sec">
<xsl:param name="config"/>
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="//j:extensions">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<extension module="org.keycloak.keycloak-adapter-subsystem"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//j:profile">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<subsystem xmlns="urn:jboss:domain:keycloak:1.1"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//sec:security-domains">
<xsl:copy>
<xsl:apply-templates select="node()[name(.)='security-domain']"/>
<security-domain name="keycloak">
<authentication>
<login-module code="org.keycloak.adapters.jboss.KeycloakLoginModule" flag="required"/>
</authentication>
</security-domain>
<security-domain name="sp" cache-type="default">
<authentication>
<login-module code="org.picketlink.identity.federation.bindings.wildfly.SAML2LoginModule" flag="required"/>
</authentication>
</security-domain>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,12 @@
package org.keycloak.testsuite.adapter.example;
import org.keycloak.testsuite.arquillian.annotation.AdapterLibsLocationProperty;
/**
*
* @author tkyjovsk
*/
@AdapterLibsLocationProperty("adapter.libs.wildfly")
public class WildflyRelativeBasicAuthExampleAdapterTest extends AbstractBasicAuthExampleAdapterTest {
}

View file

@ -0,0 +1,12 @@
package org.keycloak.testsuite.adapter.example;
import org.keycloak.testsuite.arquillian.annotation.AdapterLibsLocationProperty;
/**
*
* @author fkiss
*/
@AdapterLibsLocationProperty("adapter.libs.wildfly")
public class WildflyRelativeCorsExampleAdapterTest extends AbstractCorsExampleAdapterTest {
}

View file

@ -0,0 +1,12 @@
package org.keycloak.testsuite.adapter.example;
import org.keycloak.testsuite.arquillian.annotation.AdapterLibsLocationProperty;
/**
*
* @author tkyjovsk
*/
@AdapterLibsLocationProperty("adapter.libs.wildfly")
public class WildflyRelativeDemoExampleAdapterTest extends AbstractDemoExampleAdapterTest {
}

View file

@ -0,0 +1,12 @@
package org.keycloak.testsuite.adapter.example;
import org.keycloak.testsuite.arquillian.annotation.AdapterLibsLocationProperty;
/**
*
* @author tkyjovsk
*/
@AdapterLibsLocationProperty("adapter.libs.wildfly")
public class WildflyRelativeJSConsoleExampleAdapterTest extends AbstractJSConsoleExampleAdapterTest {
}

View file

@ -0,0 +1,12 @@
package org.keycloak.testsuite.adapter.servlet;
import org.keycloak.testsuite.arquillian.annotation.AdapterLibsLocationProperty;
/**
*
* @author tkyjovsk
*/
@AdapterLibsLocationProperty("adapter.libs.wildfly")
public class WildflyRelativeDemoServletsAdapterTest extends AbstractDemoServletsAdapterTest {
}

View file

@ -0,0 +1,12 @@
package org.keycloak.testsuite.adapter.servlet;
import org.keycloak.testsuite.arquillian.annotation.AdapterLibsLocationProperty;
/**
*
* @author tkyjovsk
*/
@AdapterLibsLocationProperty("adapter.libs.wildfly")
public class WildflyRelativeSessionServletAdapterTest extends AbstractSessionServletAdapterTest {
}

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<module-name>%CONTEXT_PATH%</module-name>
</web-app>

View file

@ -0,0 +1,134 @@
<?xml version="1.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">
<parent>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-tests-adapters</artifactId>
<version>1.6.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-arquillian-adapters-wildfly</artifactId>
<name>Adapter Tests on Wildfly</name>
<properties>
<app.server.wildfly.home>${containers.home}/wildfly-${wildfly.version}</app.server.wildfly.home>
<adapter.libs.wildfly>${containers.home}/keycloak-wf9-adapter-dist</adapter.libs.wildfly>
</properties>
<dependencies>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-dist</artifactId>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-wf9-adapter-dist</artifactId>
<type>zip</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-wildfly-and-adapter</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-dist</artifactId>
<version>${wildfly.version}</version>
<type>zip</type>
<outputDirectory>${containers.home}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-wf9-adapter-dist</artifactId>
<version>${project.version}</version>
<type>zip</type>
<outputDirectory>${adapter.libs.wildfly}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<systemPropertyVariables>
<app.server.wildfly>true</app.server.wildfly>
<app.server.wildfly.home>${app.server.wildfly.home}</app.server.wildfly.home>
<adapter.libs.wildfly>${adapter.libs.wildfly}</adapter.libs.wildfly>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>adapter-libs-provided</id>
<activation>
<property>
<name>!adapter.libs.bundled</name>
</property>
</activation>
<properties>
<adapter.libs.wildfly>${app.server.wildfly.home}</adapter.libs.wildfly>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
<id>configure-adapter-subsystem</id>
<phase>process-resources</phase>
<goals>
<goal>transform</goal>
</goals>
<configuration>
<transformationSets>
<transformationSet>
<dir>${app.server.wildfly.home}/standalone/configuration</dir>
<includes>
<include>standalone.xml</include>
</includes>
<stylesheet>src/main/xslt/standalone.xsl</stylesheet>
<outputDir>${app.server.wildfly.home}/standalone/configuration</outputDir>
</transformationSet>
</transformationSets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View file

@ -0,0 +1,35 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:a="http://jboss.org/schema/arquillian"
version="2.0"
exclude-result-prefixes="xalan a">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/a:arquillian">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<container qualifier="app-server-wildfly" mode="manual" >
<configuration>
<property name="enabled">${app.server.wildfly}</property>
<property name="adapterImplClass">org.jboss.as.arquillian.container.managed.ManagedDeployableContainer</property>
<property name="jbossHome">${app.server.wildfly.home}</property>
<property name="javaVmArguments">-Djboss.socket.binding.port-offset=${app.server.port.offset} -Xms64m -Xmx512m -XX:MaxPermSize=256m ${adapter.test.props}</property>
<property name="managementPort">${app.server.management.port}</property>
</configuration>
</container>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,51 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:j="urn:jboss:domain:3.0"
xmlns:ds="urn:jboss:domain:datasources:3.0"
xmlns:k="urn:jboss:domain:keycloak:1.1"
xmlns:sec="urn:jboss:domain:security:1.2"
version="2.0"
exclude-result-prefixes="xalan j ds k sec">
<xsl:param name="config"/>
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="//j:extensions">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<extension module="org.keycloak.keycloak-adapter-subsystem"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//j:profile">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<subsystem xmlns="urn:jboss:domain:keycloak:1.1"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//sec:security-domains">
<xsl:copy>
<xsl:apply-templates select="node()[name(.)='security-domain']"/>
<security-domain name="keycloak">
<authentication>
<login-module code="org.keycloak.adapters.jboss.KeycloakLoginModule" flag="required"/>
</authentication>
</security-domain>
<security-domain name="sp" cache-type="default">
<authentication>
<login-module code="org.picketlink.identity.federation.bindings.wildfly.SAML2LoginModule" flag="required"/>
</authentication>
</security-domain>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,14 @@
package org.keycloak.testsuite.adapter.example;
import org.keycloak.testsuite.arquillian.annotation.AdapterLibsLocationProperty;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
*
* @author tkyjovsk
*/
@AppServerContainer("app-server-wildfly")
@AdapterLibsLocationProperty("adapter.libs.wildfly")
public class WildflyBasicAuthExampleAdapterTest extends AbstractBasicAuthExampleAdapterTest {
}

View file

@ -0,0 +1,14 @@
package org.keycloak.testsuite.adapter.servlet;
import org.keycloak.testsuite.arquillian.annotation.AdapterLibsLocationProperty;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
*
* @author tkyjovsk
*/
@AppServerContainer("app-server-wildfly")
@AdapterLibsLocationProperty("adapter.libs.wildfly")
public class WildflyDemoServletsAdapterTest extends AbstractDemoServletsAdapterTest {
}

View file

@ -0,0 +1,14 @@
package org.keycloak.testsuite.adapter.servlet;
import org.keycloak.testsuite.arquillian.annotation.AdapterLibsLocationProperty;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
*
* @author tkyjovsk
*/
@AppServerContainer("app-server-wildfly")
@AdapterLibsLocationProperty("adapter.libs.wildfly")
public class WildflySessionServletAdapterTest extends AbstractSessionServletAdapterTest {
}

View file

@ -0,0 +1,136 @@
<?xml version="1.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">
<parent>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-tests-adapters</artifactId>
<version>1.6.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-arquillian-adapters-wildfly8</artifactId>
<name>Adapter Tests on Wildfly 8</name>
<properties>
<wildfly.version>8.2.1.Final</wildfly.version>
<app.server.wildfly.home>${containers.home}/wildfly-${wildfly.version}</app.server.wildfly.home>
<adapter.libs.wildfly>${containers.home}/keycloak-wf8-adapter-dist</adapter.libs.wildfly>
</properties>
<dependencies>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-dist</artifactId>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-wf8-adapter-dist</artifactId>
<type>zip</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-wildfly-and-adapter</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-dist</artifactId>
<version>${wildfly.version}</version>
<type>zip</type>
<outputDirectory>${containers.home}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-wf8-adapter-dist</artifactId>
<version>${project.version}</version>
<type>zip</type>
<outputDirectory>${adapter.libs.wildfly}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<systemPropertyVariables>
<app.server.wildfly>true</app.server.wildfly>
<app.server.wildfly.home>${app.server.wildfly.home}</app.server.wildfly.home>
<adapter.libs.wildfly>${adapter.libs.wildfly}</adapter.libs.wildfly>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>adapter-libs-provided</id>
<activation>
<property>
<name>!adapter.libs.bundled</name>
</property>
</activation>
<properties>
<adapter.libs.wildfly>${app.server.wildfly.home}</adapter.libs.wildfly>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
<id>configure-adapter-subsystem</id>
<phase>process-resources</phase>
<goals>
<goal>transform</goal>
</goals>
<configuration>
<transformationSets>
<transformationSet>
<dir>${app.server.wildfly.home}/standalone/configuration</dir>
<includes>
<include>standalone.xml</include>
</includes>
<stylesheet>src/main/xslt/standalone.xsl</stylesheet>
<outputDir>${app.server.wildfly.home}/standalone/configuration</outputDir>
</transformationSet>
</transformationSets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View file

@ -0,0 +1,35 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:a="http://jboss.org/schema/arquillian"
version="2.0"
exclude-result-prefixes="xalan a">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/a:arquillian">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<container qualifier="app-server-wildfly" mode="manual" >
<configuration>
<property name="enabled">${app.server.wildfly}</property>
<property name="adapterImplClass">org.jboss.as.arquillian.container.managed.ManagedDeployableContainer</property>
<property name="jbossHome">${app.server.wildfly.home}</property>
<property name="javaVmArguments">-Djboss.socket.binding.port-offset=${app.server.port.offset} -Xms64m -Xmx512m -XX:MaxPermSize=256m ${adapter.test.props}</property>
<property name="managementPort">${app.server.management.port}</property>
</configuration>
</container>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,51 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:j="urn:jboss:domain:2.2"
xmlns:ds="urn:jboss:domain:datasources:2.0"
xmlns:k="urn:jboss:domain:keycloak:1.1"
xmlns:sec="urn:jboss:domain:security:1.2"
version="2.0"
exclude-result-prefixes="xalan j ds k sec">
<xsl:param name="config"/>
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="//j:extensions">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<extension module="org.keycloak.keycloak-adapter-subsystem"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//j:profile">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<subsystem xmlns="urn:jboss:domain:keycloak:1.1"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//sec:security-domains">
<xsl:copy>
<xsl:apply-templates select="node()[name(.)='security-domain']"/>
<security-domain name="keycloak">
<authentication>
<login-module code="org.keycloak.adapters.jboss.KeycloakLoginModule" flag="required"/>
</authentication>
</security-domain>
<security-domain name="sp" cache-type="default">
<authentication>
<login-module code="org.picketlink.identity.federation.bindings.wildfly.SAML2LoginModule" flag="required"/>
</authentication>
</security-domain>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

Some files were not shown because too many files have changed in this diff Show more