KEYCLOAK-7666 - adapter tests - eap6-fuse6 provider

This commit is contained in:
vramik 2018-07-17 09:53:56 +02:00 committed by Pavel Drozd
parent 31f6cf9ab5
commit 54fcbf12b0
22 changed files with 294 additions and 276 deletions

View file

@ -164,7 +164,7 @@
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.0</version>
<version>3.0.1</version>
</plugin>
<plugin>
<groupId>org.commonjava.maven.plugins</groupId>

View file

@ -86,6 +86,8 @@ public class EAPAppServerProvider implements AppServerContainerProvider {
createChild("javaHome", appServerJavaHome);
createChild("jbossArguments",
"-Djboss.server.base.dir=" + appServerHome + "/standalone-test " +
"-Djboss.server.config.dir=" + appServerHome + "/standalone-test/configuration " +
"-Djboss.server.log.dir=" + appServerHome + "/standalone-test/log " +
"-Djboss.socket.binding.port-offset=" + appServerPortOffset + " " +
System.getProperty("adapter.test.props", " ") +
System.getProperty("kie.maven.settings", " ")

View file

@ -1,132 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>integration-arquillian-servers-app-server-jboss</artifactId>
<groupId>org.keycloak.testsuite</groupId>
<version>4.2.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-arquillian-servers-app-server-eap6-fuse</artifactId>
<packaging>pom</packaging>
<name>App Server - JBoss - EAP 6 + Fuse integration</name>
<properties>
<app.server.jboss>eap6-fuse</app.server.jboss>
<app.server.jboss.groupId>org.jboss.as</app.server.jboss.groupId>
<app.server.jboss.artifactId>jboss-as-dist</app.server.jboss.artifactId>
<app.server.jboss.version>${eap6.version}</app.server.jboss.version>
<app.server.jboss.unpacked.folder.name>jboss-eap-6.4</app.server.jboss.unpacked.folder.name>
<fuse.installer.groupId>com.redhat.fuse.eap</fuse.installer.groupId>
<fuse.installer.artifactId>fuse-eap-installer</fuse.installer.artifactId>
<fuse.installer.version>6.3.0.redhat-224</fuse.installer.version>
<app.server.oidc.adapter.artifactId>keycloak-eap6-adapter-dist</app.server.oidc.adapter.artifactId>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-fuse-installer</id>
<phase>generate-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${fuse.installer.groupId}</groupId>
<artifactId>${fuse.installer.artifactId}</artifactId>
<version>${fuse.installer.version}</version>
<type>jar</type>
<outputDirectory>${app.server.jboss.home}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>install-fuse</id>
<phase>process-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${common.resources}/install-fuse.${script.suffix}</executable>
<workingDirectory>${app.server.jboss.home}</workingDirectory>
<environmentVariables>
<JAVA_HOME>${app.server.java.home}</JAVA_HOME>
<JBOSS_HOME>${app.server.jboss.home}</JBOSS_HOME>
<FUSE_INSTALLER_NAME>${fuse.installer.artifactId}-${fuse.installer.version}.jar</FUSE_INSTALLER_NAME>
</environmentVariables>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>copy-hawtio-jsons</id>
<phase>process-test-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${app.server.jboss.home}/standalone/configuration</outputDirectory>
<resources>
<resource>
<directory>${common.resources}</directory>
<includes>
<include>keycloak-hawtio.json</include>
<include>keycloak-hawtio-client.json</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
<id>add-hawtio-to-standalone</id>
<phase>process-test-resources</phase>
<goals>
<goal>transform</goal>
</goals>
<configuration>
<transformationSets>
<transformationSet>
<dir>${app.server.jboss.home}/standalone/configuration</dir>
<includes>
<include>standalone.xml</include>
</includes>
<stylesheet>${common.resources}/add-hawtio.xsl</stylesheet>
<outputDir>${app.server.jboss.home}/standalone/configuration</outputDir>
</transformationSet>
</transformationSets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -28,15 +28,19 @@
<artifactId>integration-arquillian-servers-app-server-eap6</artifactId>
<packaging>jar</packaging>
<name>App Server - EAP 6</name>
<properties>
<app.server.jboss>eap6</app.server.jboss>
<app.server.jboss.groupId>org.jboss.as</app.server.jboss.groupId>
<app.server.jboss.artifactId>jboss-as-dist</app.server.jboss.artifactId>
<app.server.jboss.version>${eap6.version}</app.server.jboss.version>
<app.server.jboss.unpacked.folder.name>jboss-eap-6.4</app.server.jboss.unpacked.folder.name>
<fuse.installer.groupId>com.redhat.fuse.eap</fuse.installer.groupId>
<fuse.installer.artifactId>fuse-eap-installer</fuse.installer.artifactId>
<fuse.installer.version>${fuse63.version}</fuse.installer.version>
<app.server.oidc.adapter.artifactId>keycloak-eap6-adapter-dist</app.server.oidc.adapter.artifactId>
<app.server.saml.adapter.artifactId>keycloak-saml-eap6-adapter-dist</app.server.saml.adapter.artifactId>
@ -76,11 +80,77 @@
<requireProperty>
<property>eap6.version</property>
</requireProperty>
<requireProperty>
<property>fuse63.version</property>
</requireProperty>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>backup-configs-fuse</id>
<phase>generate-test-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${app.server.jboss.home}/standalone-default</outputDirectory>
<resources>
<resource>
<directory>${app.server.jboss.home}/standalone</directory>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-hawtio-jsons</id>
<phase>generate-test-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${app.server.jboss.home}/standalone-fuse/configuration</outputDirectory>
<resources>
<resource>
<directory>${basedir}/src/main/resources/config/fuse</directory>
<includes>
<include>keycloak-hawtio.json</include>
<include>keycloak-hawtio-client.json</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-fuse-installer</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${fuse.installer.groupId}</groupId>
<artifactId>${fuse.installer.artifactId}</artifactId>
<version>${fuse.installer.version}</version>
<type>jar</type>
<outputDirectory>${app.server.jboss.home}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
@ -118,6 +188,22 @@
</environmentVariables>
</configuration>
</execution>
<execution>
<id>install-fuse</id>
<phase>generate-test-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${basedir}/src/main/resources/config/fuse/install-fuse.${script.suffix}</executable>
<workingDirectory>${app.server.jboss.home}/standalone-fuse</workingDirectory>
<environmentVariables>
<JAVA_HOME>${app.server.java.home}</JAVA_HOME>
<JBOSS_HOME>${app.server.jboss.home}</JBOSS_HOME>
<FUSE_INSTALLER_NAME>${fuse.installer.artifactId}-${fuse.installer.version}.jar</FUSE_INSTALLER_NAME>
</environmentVariables>
</configuration>
</execution>
<execution>
<id>add-secured-deployments-eap6</id>
<phase>generate-test-sources</phase>
@ -136,6 +222,64 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
<id>add-hawtio-to-standalone-fuse</id>
<phase>process-test-resources</phase>
<goals>
<goal>transform</goal>
</goals>
<configuration>
<transformationSets>
<transformationSet>
<dir>${app.server.jboss.home}/standalone-fuse/configuration</dir>
<includes>
<include>standalone.xml</include>
</includes>
<stylesheet>${basedir}/src/main/resources/config/fuse/add-hawtio.xsl</stylesheet>
<outputDir>${app.server.jboss.home}/standalone-fuse/configuration</outputDir>
</transformationSet>
</transformationSets>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>move-configs-fuse</id>
<phase>process-test-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<echo message="Rename ./standalone to ./standalone-fuse" />
<move file="${app.server.jboss.home}/standalone"
tofile="${app.server.jboss.home}/standalone-fuse" />
</target>
</configuration>
</execution>
<execution>
<id>restore-configs-after-fuse-installation</id>
<phase>process-test-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<echo message="Rename ./standalone-default to ./standalone" />
<move file="${app.server.jboss.home}/standalone-default"
tofile="${app.server.jboss.home}/standalone" />
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

View file

@ -86,6 +86,8 @@ public class EAP6AppServerProvider implements AppServerContainerProvider {
createChild("javaHome", appServerJavaHome);
createChild("jbossArguments",
"-Djboss.server.base.dir=" + appServerHome + "/standalone-test " +
"-Djboss.server.config.dir=" + appServerHome + "/standalone-test/configuration " +
"-Djboss.server.log.dir=" + appServerHome + "/standalone-test/log " +
"-Djboss.socket.binding.port-offset=" + appServerPortOffset + " " +
System.getProperty("adapter.test.props", " ") +
System.getProperty("kie.maven.settings", " ")

View file

@ -646,18 +646,6 @@
<module>relative</module>
</modules>
</profile>
<profile>
<id>app-server-eap6-fuse</id>
<activation>
<property>
<name>app.server</name>
<value>eap6-fuse</value>
</property>
</activation>
<modules>
<module>eap6-fuse</module>
</modules>
</profile>
</profiles>
</project>

View file

@ -86,6 +86,8 @@ public class WildflyAppServerProvider implements AppServerContainerProvider {
createChild("javaHome", appServerJavaHome);
createChild("jbossArguments",
"-Djboss.server.base.dir=" + appServerHome + "/standalone-test " +
"-Djboss.server.config.dir=" + appServerHome + "/standalone-test/configuration " +
"-Djboss.server.log.dir=" + appServerHome + "/standalone-test/log " +
"-Djboss.socket.binding.port-offset=" + appServerPortOffset + " " +
System.getProperty("adapter.test.props", " ") +
System.getProperty("kie.maven.settings", " ")

View file

@ -86,6 +86,8 @@ public class Wildfly10AppServerProvider implements AppServerContainerProvider {
createChild("javaHome", appServerJavaHome);
createChild("jbossArguments",
"-Djboss.server.base.dir=" + appServerHome + "/standalone-test " +
"-Djboss.server.config.dir=" + appServerHome + "/standalone-test/configuration " +
"-Djboss.server.log.dir=" + appServerHome + "/standalone-test/log " +
"-Djboss.socket.binding.port-offset=" + appServerPortOffset + " " +
System.getProperty("adapter.test.props", " ") +
System.getProperty("kie.maven.settings", " ")

View file

@ -86,6 +86,8 @@ public class Wildfly9AppServerProvider implements AppServerContainerProvider {
createChild("javaHome", appServerJavaHome);
createChild("jbossArguments",
"-Djboss.server.base.dir=" + appServerHome + "/standalone-test " +
"-Djboss.server.config.dir=" + appServerHome + "/standalone-test/configuration " +
"-Djboss.server.log.dir=" + appServerHome + "/standalone-test/log " +
"-Djboss.socket.binding.port-offset=" + appServerPortOffset + " " +
System.getProperty("adapter.test.props", " ") +
System.getProperty("kie.maven.settings", " ")

View file

@ -104,21 +104,12 @@ public class DeploymentArchiveProcessor implements ApplicationArchiveProcessor {
// Ignore archives modifed in specific DeploymentArchiveProcessors, see e.g.
// org.keycloak.testsuite.arquillian.wildfly.container.WildflyDeploymentArchiveProcessor
if (isEAP6AppServer() ||
isEAPAppServer() ||
isWildflyAppServer() ||
isWildfly10AppServer() ||
isWildfly9AppServer() ||
isUndertowAppServer()) {
return;
}
log.info("Processing archive " + archive.getName());
modifyAdapterConfigs(archive, testClass);
modifyWebXml(archive, testClass);
if (isWLSAppServer() || isWASAppServer()) {
log.info("Processing archive " + archive.getName());
modifyAdapterConfigs(archive, testClass);
modifyWebXml(archive, testClass);
MavenResolverSystem resolver = Maven.resolver();
MavenFormatStage dependencies = resolver
.loadPomFromFile("pom.xml")

View file

@ -17,11 +17,20 @@
package org.keycloak.testsuite.arquillian.containers;
/**
*
* The test implementing the interface is expected to maintain container lifecycle
* itself. No app server container will be started.
*
* @author vramik
*/
public interface SelfManagedAppContainerLifecycle {
/**
* Should be called @Before
*/
void startServer();
/**
* Should be called @After
*/
void stopServer();
}

View file

@ -1,55 +0,0 @@
package org.keycloak.testsuite.adapter.example;
import org.jboss.arquillian.graphene.page.Page;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.testsuite.adapter.AbstractExampleAdapterTest;
import org.keycloak.testsuite.adapter.page.HawtioPage;
import org.openqa.selenium.By;
import java.util.List;
import static org.keycloak.testsuite.auth.page.AuthRealm.DEMO;
import static org.keycloak.testsuite.utils.io.IOUtil.loadRealm;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;
import static org.keycloak.testsuite.util.WaitUtils.pause;
import static org.keycloak.testsuite.util.WaitUtils.waitUntilElement;
/**
* @author mhajas
*/
public abstract class AbstractHawtioAdapterTest extends AbstractExampleAdapterTest {
@Page
private HawtioPage hawtioPage;
@Override
public void addAdapterTestRealms(List<RealmRepresentation> testRealms) {
testRealms.add(loadRealm("/adapter-test/hawtio-realm/demorealm.json"));
}
@Test
public void hawtioLoginAndLogoutTest() {
testRealmLoginPage.setAuthRealm(DEMO);
hawtioPage.navigateTo();
waitUntilElement(By.xpath("//body")).is().present();
assertCurrentUrlStartsWith(testRealmLoginPage);
testRealmLoginPage.form().login("root", "password");
waitUntilElement(By.xpath("//body")).is().present();
assertCurrentUrlStartsWith(hawtioPage.toString() + "/welcome", hawtioPage.getDriver());
hawtioPage.logout();
pause(1000);
waitUntilElement(By.xpath("//body")).is().present();
assertCurrentUrlStartsWith(testRealmLoginPage);
hawtioPage.navigateTo();
waitUntilElement(By.xpath("//body")).is().present();
assertCurrentUrlStartsWith(testRealmLoginPage);
}
}

View file

@ -0,0 +1,120 @@
/*
* Copyright 2016 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.keycloak.testsuite.adapter.example.fuse;
import static org.keycloak.testsuite.auth.page.AuthRealm.DEMO;
import static org.keycloak.testsuite.utils.io.IOUtil.loadRealm;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;
import java.io.IOException;
import java.util.List;
import org.jboss.arquillian.container.test.api.ContainerController;
import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.graphene.page.Page;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.testsuite.adapter.AbstractExampleAdapterTest;
import org.keycloak.testsuite.adapter.page.HawtioPage;
import org.keycloak.testsuite.arquillian.AppServerTestEnricher;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
import org.keycloak.testsuite.arquillian.containers.SelfManagedAppContainerLifecycle;
import org.keycloak.testsuite.auth.page.login.OIDCLogin;
import org.keycloak.testsuite.util.DroneUtils;
import org.keycloak.testsuite.util.JavascriptBrowser;
import org.keycloak.testsuite.util.WaitUtils;
import org.openqa.selenium.WebDriver;
/**
* @author mhajas
*/
@AppServerContainer(ContainerConstants.APP_SERVER_EAP6)
public class EAP6Fuse6HawtioAdapterTest extends AbstractExampleAdapterTest implements SelfManagedAppContainerLifecycle {
@ArquillianResource
private ContainerController controller;
@Drone
@JavascriptBrowser
protected WebDriver jsDriver;
@Page
@JavascriptBrowser
private HawtioPage hawtioPage;
@Page
@JavascriptBrowser
private OIDCLogin testRealmLoginPageFuse;
@Override
public void addAdapterTestRealms(List<RealmRepresentation> testRealms) {
testRealms.add(loadRealm("/adapter-test/hawtio-realm/demorealm.json"));
}
@Before
public void addJSDriver() {
DroneUtils.addWebDriver(jsDriver);
}
@Before
@Override
public void startServer() {
try {
AppServerTestEnricher.prepareServerDir("standalone-fuse");
} catch (IOException ex) {
throw new RuntimeException("Wasn't able to prepare server dir.", ex);
}
controller.start(testContext.getAppServerInfo().getQualifier());
}
@After
@Override
public void stopServer() {
controller.stop(testContext.getAppServerInfo().getQualifier());
}
@Test
public void hawtioLoginAndLogoutTest() {
testRealmLoginPageFuse.setAuthRealm(DEMO);
log.debug("Go to hawtioPage");
hawtioPage.navigateTo();
WaitUtils.waitForPageToLoad();
log.debug("log in");
testRealmLoginPageFuse.form().login("root", "password");
WaitUtils.waitForPageToLoad();
assertCurrentUrlStartsWith(hawtioPage.toString() + "/welcome", DroneUtils.getCurrentDriver());
hawtioPage.logout();
WaitUtils.waitForPageToLoad();
assertCurrentUrlStartsWith(testRealmLoginPageFuse);
hawtioPage.navigateTo();
WaitUtils.waitForPageToLoad();
assertCurrentUrlStartsWith(testRealmLoginPageFuse);
}
}

View file

@ -1,41 +0,0 @@
<?xml version="1.0"?>
<!--
~ Copyright 2016 Red Hat, Inc. and/or its affiliates
~ and other contributors as indicated by the @author tags.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-tests-adapters-jboss</artifactId>
<version>4.2.0.Final-SNAPSHOT</version>
</parent>
<artifactId>integration-arquillian-tests-adapters-eap6-fuse</artifactId>
<name>Adapter Tests - JBoss - EAP 6 Fuse</name>
<properties>
<app.server>eap6-fuse</app.server>
<app.server.management.protocol>remote</app.server.management.protocol>
<app.server.management.port>${app.server.management.port.jmx}</app.server.management.port>
</properties>
</project>

View file

@ -1,10 +0,0 @@
package org.keycloak.testsuite.adapter.example;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
* @author mhajas
*/
@AppServerContainer("app-server-eap6-fuse")
public class EAP6FUSEHawtioAdapterTest extends AbstractHawtioAdapterTest {
}

View file

@ -83,12 +83,6 @@
<module>remote</module>
</modules>
</profile>
<profile>
<id>app-server-eap6-fuse</id>
<modules>
<module>eap6-fuse</module>
</modules>
</profile>
</profiles>
</project>