add installing adapter tests via cli scripts, checking server log
This commit is contained in:
parent
554da73398
commit
6c3c08e711
12 changed files with 151 additions and 153 deletions
|
@ -209,31 +209,6 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</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>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
||||||
xmlns:xalan="http://xml.apache.org/xalan"
|
|
||||||
xmlns:j="urn:jboss:domain:4.0"
|
|
||||||
xmlns:ds="urn:jboss:domain:datasources:4.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"/>
|
|
||||||
<extension module="org.keycloak.keycloak-saml-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"/>
|
|
||||||
<subsystem xmlns="urn:jboss:domain:keycloak-saml: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>
|
|
|
@ -40,6 +40,11 @@
|
||||||
<artifactId>keycloak-as7-adapter-dist</artifactId>
|
<artifactId>keycloak-as7-adapter-dist</artifactId>
|
||||||
<type>zip</type>
|
<type>zip</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-saml-as7-adapter-dist</artifactId>
|
||||||
|
<type>zip</type>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -77,6 +82,13 @@
|
||||||
<type>zip</type>
|
<type>zip</type>
|
||||||
<outputDirectory>${adapter.libs.as7}</outputDirectory>
|
<outputDirectory>${adapter.libs.as7}</outputDirectory>
|
||||||
</artifactItem>
|
</artifactItem>
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-saml-as7-adapter-dist</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<outputDirectory>${adapter.libs.as7}</outputDirectory>
|
||||||
|
</artifactItem>
|
||||||
</artifactItems>
|
</artifactItems>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
|
|
|
@ -40,6 +40,11 @@
|
||||||
<artifactId>keycloak-eap6-adapter-dist</artifactId>
|
<artifactId>keycloak-eap6-adapter-dist</artifactId>
|
||||||
<type>zip</type>
|
<type>zip</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-saml-eap6-adapter-dist</artifactId>
|
||||||
|
<type>zip</type>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -67,7 +72,7 @@
|
||||||
<artifactId>maven-dependency-plugin</artifactId>
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>unpack-eap6-with-adapter</id>
|
<id>unpack-eap6-with-adapters</id>
|
||||||
<phase>generate-resources</phase>
|
<phase>generate-resources</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>unpack</goal>
|
<goal>unpack</goal>
|
||||||
|
@ -88,6 +93,13 @@
|
||||||
<type>zip</type>
|
<type>zip</type>
|
||||||
<outputDirectory>${adapter.libs.eap6}</outputDirectory>
|
<outputDirectory>${adapter.libs.eap6}</outputDirectory>
|
||||||
</artifactItem>
|
</artifactItem>
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-saml-eap6-adapter-dist</artifactId>
|
||||||
|
<version>${version.adapter.dist}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<outputDirectory>${adapter.libs.eap6}</outputDirectory>
|
||||||
|
</artifactItem>
|
||||||
</artifactItems>
|
</artifactItems>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
<exclude.adapters>-</exclude.adapters>
|
<exclude.adapters>-</exclude.adapters>
|
||||||
|
|
||||||
<arquillian.xml.stylesheet>src/main/xslt/arquillian.xsl</arquillian.xml.stylesheet>
|
<arquillian.xml.stylesheet>src/main/xslt/arquillian.xsl</arquillian.xml.stylesheet>
|
||||||
|
<skip.install.adapters>false</skip.install.adapters>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -50,6 +51,24 @@
|
||||||
</artifactItems>
|
</artifactItems>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>unpack-add-user-json</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>**/keycloak-add-user.json</includes>
|
||||||
|
</artifactItem>
|
||||||
|
</artifactItems>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -108,6 +127,31 @@
|
||||||
</excludes>
|
</excludes>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>copy-admin-user-json-file</id>
|
||||||
|
<phase>process-test-resources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-resources</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${jboss.server.config.dir}</outputDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>${project.build.directory}/dependency</directory>
|
||||||
|
<includes>
|
||||||
|
<include>keycloak-add-user.json</include>
|
||||||
|
</includes>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</pluginManagement>
|
</pluginManagement>
|
||||||
</build>
|
</build>
|
||||||
|
|
|
@ -31,6 +31,11 @@
|
||||||
<artifactId>keycloak-wildfly-adapter-dist</artifactId>
|
<artifactId>keycloak-wildfly-adapter-dist</artifactId>
|
||||||
<type>zip</type>
|
<type>zip</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-saml-wildfly-adapter-dist</artifactId>
|
||||||
|
<type>zip</type>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -68,6 +73,13 @@
|
||||||
<type>zip</type>
|
<type>zip</type>
|
||||||
<outputDirectory>${adapter.libs.wildfly}</outputDirectory>
|
<outputDirectory>${adapter.libs.wildfly}</outputDirectory>
|
||||||
</artifactItem>
|
</artifactItem>
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-saml-wildfly-adapter-dist</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<outputDirectory>${adapter.libs.wildfly}</outputDirectory>
|
||||||
|
</artifactItem>
|
||||||
</artifactItems>
|
</artifactItems>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
|
@ -77,7 +89,6 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.18.1</version>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<systemPropertyVariables>
|
<systemPropertyVariables>
|
||||||
<app.server.wildfly>true</app.server.wildfly>
|
<app.server.wildfly>true</app.server.wildfly>
|
||||||
|
@ -145,20 +156,20 @@
|
||||||
<goal>copy-resources</goal>
|
<goal>copy-resources</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<outputDirectory>${app.server.wildfly.home}/standalone/configuration</outputDirectory>
|
<outputDirectory>${app.server.wildfly.home}/standalone/configuration</outputDirectory>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
<directory>src/main/keystore</directory>
|
<directory>src/main/keystore</directory>
|
||||||
<includes>
|
<includes>
|
||||||
<include>adapter.jks</include>
|
<include>adapter.jks</include>
|
||||||
<include>keycloak.truststore</include>
|
<include>keycloak.truststore</include>
|
||||||
</includes>
|
</includes>
|
||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
<nonFilteredFileExtensions>
|
<nonFilteredFileExtensions>
|
||||||
<nonFilteredFileExtension>jks</nonFilteredFileExtension>
|
<nonFilteredFileExtension>jks</nonFilteredFileExtension>
|
||||||
<nonFilteredFileExtension>truststore</nonFilteredFileExtension>
|
<nonFilteredFileExtension>truststore</nonFilteredFileExtension>
|
||||||
</nonFilteredFileExtensions>
|
</nonFilteredFileExtensions>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
|
|
|
@ -73,6 +73,13 @@
|
||||||
<exclude.account>**/account/**/*Test.java</exclude.account>
|
<exclude.account>**/account/**/*Test.java</exclude.account>
|
||||||
</properties>
|
</properties>
|
||||||
</profile>
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>no-client</id>
|
||||||
|
<properties>
|
||||||
|
<!-- Exclude all account management tests. -->
|
||||||
|
<exclude.account>**/client/**/*Test.java</exclude.account>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
<profile>
|
<profile>
|
||||||
<id>adapters-only</id>
|
<id>adapters-only</id>
|
||||||
<properties>
|
<properties>
|
||||||
|
|
|
@ -23,7 +23,6 @@ import org.jboss.arquillian.core.api.annotation.Observes;
|
||||||
import org.jboss.arquillian.test.spi.annotation.ClassScoped;
|
import org.jboss.arquillian.test.spi.annotation.ClassScoped;
|
||||||
import org.jboss.arquillian.test.spi.annotation.SuiteScoped;
|
import org.jboss.arquillian.test.spi.annotation.SuiteScoped;
|
||||||
import org.jboss.arquillian.container.spi.event.container.AfterStart;
|
import org.jboss.arquillian.container.spi.event.container.AfterStart;
|
||||||
import org.jboss.arquillian.container.spi.event.container.BeforeStart;
|
|
||||||
import org.jboss.arquillian.test.spi.event.suite.BeforeClass;
|
import org.jboss.arquillian.test.spi.event.suite.BeforeClass;
|
||||||
import org.jboss.arquillian.test.spi.event.suite.BeforeSuite;
|
import org.jboss.arquillian.test.spi.event.suite.BeforeSuite;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
@ -35,6 +34,7 @@ import org.keycloak.testsuite.util.OAuthClient;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.auth.page.AuthRealm.ADMIN;
|
import static org.keycloak.testsuite.auth.page.AuthRealm.ADMIN;
|
||||||
import static org.keycloak.testsuite.auth.page.AuthRealm.MASTER;
|
import static org.keycloak.testsuite.auth.page.AuthRealm.MASTER;
|
||||||
|
import static org.keycloak.testsuite.util.WaitUtils.pause;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -78,7 +78,10 @@ public class ContainersTestEnricher {
|
||||||
private ContainerController controller;
|
private ContainerController controller;
|
||||||
private LinkedList<Container> containers;
|
private LinkedList<Container> containers;
|
||||||
|
|
||||||
|
private String jbossHomePath;
|
||||||
private final boolean migrationTests = System.getProperty("migration", "false").equals("true");
|
private final boolean migrationTests = System.getProperty("migration", "false").equals("true");
|
||||||
|
private final boolean skipInstallAdapters = System.getProperty("skip.install.adapters", "false").equals("true");
|
||||||
|
private boolean alreadyInstalled = false;
|
||||||
private boolean alreadyStopped = false;
|
private boolean alreadyStopped = false;
|
||||||
private boolean init = false;
|
private boolean init = false;
|
||||||
|
|
||||||
|
@ -110,16 +113,12 @@ public class ContainersTestEnricher {
|
||||||
*/
|
*/
|
||||||
public void afterStart(@Observes AfterStart event) throws IOException, InterruptedException {
|
public void afterStart(@Observes AfterStart event) throws IOException, InterruptedException {
|
||||||
Container container = containers.pollFirst();
|
Container container = containers.pollFirst();
|
||||||
String jbossHomePath = null;
|
|
||||||
|
|
||||||
if (isJBossBased(container)) {
|
if (isJBossBased(container)) {
|
||||||
jbossHomePath = container.getContainerConfiguration().getContainerProperties().get("jbossHome");
|
jbossHomePath = container.getContainerConfiguration().getContainerProperties().get("jbossHome");
|
||||||
log.debug("jbossHome: " + jbossHomePath + "\n");
|
log.debug("jbossHome: " + jbossHomePath + "\n");
|
||||||
|
|
||||||
if (System.getProperty("check.server.log", "true").equals("true")) {
|
|
||||||
checkServerLog(jbossHomePath);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
checkServerLog(jbossHomePath);
|
||||||
|
|
||||||
if (migrationTests && !alreadyStopped) {
|
if (migrationTests && !alreadyStopped) {
|
||||||
log.info("\n\n### Stopping keycloak " + System.getProperty("version", "- previous") + " ###\n");
|
log.info("\n\n### Stopping keycloak " + System.getProperty("version", "- previous") + " ###\n");
|
||||||
|
@ -127,44 +126,52 @@ public class ContainersTestEnricher {
|
||||||
log.info("\n\n### Starting keycloak current version ###\n");
|
log.info("\n\n### Starting keycloak current version ###\n");
|
||||||
alreadyStopped = true;
|
alreadyStopped = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isJBossBased(container) && container.getName().startsWith("app-server")) {
|
if (!alreadyInstalled && !skipInstallAdapters && isJBossBased(container)) {
|
||||||
log.info("Installing adapter to app server via cli script");
|
|
||||||
String jbossCliPath = jbossHomePath + "/bin/jboss-cli.sh";
|
String jbossCliPath = jbossHomePath + "/bin/jboss-cli.sh";
|
||||||
String scriptPathArg = "--file=" + jbossHomePath + "/bin/adapter-install.cli";
|
String adapterScriptPathArg = "--file=" + jbossHomePath + "/bin/adapter-install.cli";
|
||||||
|
String samlAdapterScriptPathArg = "--file=" + jbossHomePath + "/bin/adapter-install-saml.cli";
|
||||||
String managementPort = container.getContainerConfiguration().getContainerProperties().get("managementPort");
|
String managementPort = container.getContainerConfiguration().getContainerProperties().get("managementPort");
|
||||||
String controllerArg = "--controller=localhost:" + managementPort;
|
String controllerArg = "--controller=localhost:" + managementPort;
|
||||||
|
|
||||||
execCommand(new String[]{"/bin/sh", jbossCliPath, "--connect", scriptPathArg, controllerArg});
|
log.info("Installing adapter to app server via cli script");
|
||||||
log.debug("Restarting container");
|
execCommand(new String[]{"/bin/sh", jbossCliPath, "--connect", adapterScriptPathArg, controllerArg});
|
||||||
|
log.info("Installing saml adapter to app server via cli script");
|
||||||
|
execCommand(new String[]{"/bin/sh", jbossCliPath, "--connect", samlAdapterScriptPathArg, controllerArg});
|
||||||
|
log.info("Restarting container");
|
||||||
execCommand(new String[]{"/bin/sh", jbossCliPath, "--connect", "--command=:reload", controllerArg});
|
execCommand(new String[]{"/bin/sh", jbossCliPath, "--connect", "--command=:reload", controllerArg});
|
||||||
|
pause(5000);
|
||||||
|
log.info("Container restarted");
|
||||||
|
checkServerLog(jbossHomePath);
|
||||||
|
if (container.getName().startsWith("app-server")) {
|
||||||
|
alreadyInstalled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void execCommand(String... command) throws IOException, InterruptedException {
|
private void execCommand(String... command) throws IOException, InterruptedException {
|
||||||
Process process = Runtime.getRuntime().exec(command);
|
Process process = Runtime.getRuntime().exec(command);
|
||||||
|
|
||||||
printOutput(process.getInputStream());
|
|
||||||
|
|
||||||
if (process.waitFor(10, TimeUnit.SECONDS)) {
|
if (process.waitFor(10, TimeUnit.SECONDS)) {
|
||||||
if (process.exitValue() != 0) {
|
if (process.exitValue() != 0) {
|
||||||
log.error("Std Error:");
|
throw new RuntimeException("Adapter installation failed. Process exitValue: "
|
||||||
printOutput(process.getErrorStream());
|
+ process.exitValue() + "; <error output>\n" + getOutput(process.getErrorStream())
|
||||||
throw new RuntimeException("Adapter installation failed.");
|
+ "</error output>");
|
||||||
}
|
}
|
||||||
|
log.debug("process.isAlive(): " + process.isAlive());
|
||||||
} else {
|
} else {
|
||||||
process.destroy();
|
process.destroyForcibly();
|
||||||
throw new RuntimeException("Timeout after 10 seconds.");
|
throw new RuntimeException("Timeout after 10 seconds.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printOutput(InputStream is) throws IOException {
|
private String getOutput(InputStream is) throws IOException {
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
while (reader.ready()) {
|
while (reader.ready()) {
|
||||||
builder.append(reader.readLine());
|
builder.append(reader.readLine());
|
||||||
}
|
}
|
||||||
log.info(builder);
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isJBossBased(Container container) {
|
private boolean isJBossBased(Container container) {
|
||||||
|
@ -182,19 +189,22 @@ public class ContainersTestEnricher {
|
||||||
* check server logs whether there are no ERRORs or SEVEREs
|
* check server logs whether there are no ERRORs or SEVEREs
|
||||||
*/
|
*/
|
||||||
private void checkServerLog(String jbossHomePath) throws IOException {
|
private void checkServerLog(String jbossHomePath) throws IOException {
|
||||||
File serverLog = new File(jbossHomePath + "/standalone/log/server.log");
|
if (jbossHomePath != null && System.getProperty("check.server.log", "true").equals("true")) {
|
||||||
String serverLogContent = FileUtils.readFileToString(serverLog);
|
File serverLog = new File(jbossHomePath + "/standalone/log/server.log");
|
||||||
|
String serverLogContent = FileUtils.readFileToString(serverLog);
|
||||||
|
|
||||||
boolean containsError
|
boolean containsError
|
||||||
= serverLogContent.contains("ERROR")
|
= serverLogContent.contains("ERROR")
|
||||||
|| serverLogContent.contains("SEVERE")
|
|| serverLogContent.contains("SEVERE")
|
||||||
|| serverLogContent.contains("Exception ");
|
|| serverLogContent.contains("Exception ");
|
||||||
//There is expected string "Exception" in server log: Adding provider
|
//There is expected string "Exception" in server log: Adding provider
|
||||||
//singleton org.keycloak.services.resources.ModelExceptionMapper
|
//singleton org.keycloak.services.resources.ModelExceptionMapper
|
||||||
|
|
||||||
if (containsError) {
|
if (containsError) {
|
||||||
throw new RuntimeException(serverLog.getPath() + " contains ERROR.");
|
throw new RuntimeException(serverLog.getPath() + " contains ERROR.");
|
||||||
}
|
}
|
||||||
|
log.info(serverLog.getPath() + " doesn't contain Error");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void beforeSuite(@Observes BeforeSuite event) {
|
public void beforeSuite(@Observes BeforeSuite event) {
|
||||||
|
|
|
@ -10,24 +10,14 @@ import static org.keycloak.testsuite.util.MailServerConfiguration.*;
|
||||||
*/
|
*/
|
||||||
public final class SuiteContext {
|
public final class SuiteContext {
|
||||||
|
|
||||||
private boolean adminPasswordUpdated;
|
|
||||||
private final Map<String, String> smtpServer = new HashMap<>();
|
private final Map<String, String> smtpServer = new HashMap<>();
|
||||||
|
|
||||||
public SuiteContext() {
|
public SuiteContext() {
|
||||||
this.adminPasswordUpdated = false;
|
|
||||||
smtpServer.put("from", FROM);
|
smtpServer.put("from", FROM);
|
||||||
smtpServer.put("host", HOST);
|
smtpServer.put("host", HOST);
|
||||||
smtpServer.put("port", PORT);
|
smtpServer.put("port", PORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAdminPasswordUpdated() {
|
|
||||||
return adminPasswordUpdated;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAdminPasswordUpdated(boolean adminPasswordUpdated) {
|
|
||||||
this.adminPasswordUpdated = adminPasswordUpdated;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, String> getSmtpServer() {
|
public Map<String, String> getSmtpServer() {
|
||||||
return smtpServer;
|
return smtpServer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ import org.keycloak.testsuite.util.OAuthClient;
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
import org.keycloak.testsuite.auth.page.AuthServer;
|
import org.keycloak.testsuite.auth.page.AuthServer;
|
||||||
import org.keycloak.testsuite.auth.page.AuthServerContextRoot;
|
import org.keycloak.testsuite.auth.page.AuthServerContextRoot;
|
||||||
import static org.keycloak.testsuite.util.URLAssert.*;
|
|
||||||
import org.keycloak.testsuite.auth.page.AuthRealm;
|
import org.keycloak.testsuite.auth.page.AuthRealm;
|
||||||
import static org.keycloak.testsuite.auth.page.AuthRealm.ADMIN;
|
import static org.keycloak.testsuite.auth.page.AuthRealm.ADMIN;
|
||||||
import static org.keycloak.testsuite.auth.page.AuthRealm.MASTER;
|
import static org.keycloak.testsuite.auth.page.AuthRealm.MASTER;
|
||||||
|
@ -90,12 +89,6 @@ public abstract class AbstractKeycloakTest {
|
||||||
|
|
||||||
driverSettings();
|
driverSettings();
|
||||||
|
|
||||||
if (!suiteContext.isAdminPasswordUpdated()) {
|
|
||||||
log.debug("updating admin password");
|
|
||||||
updateMasterAdminPassword();
|
|
||||||
suiteContext.setAdminPasswordUpdated(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
importTestRealms();
|
importTestRealms();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,13 +99,6 @@ public abstract class AbstractKeycloakTest {
|
||||||
Timer.printStats();
|
Timer.printStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMasterAdminPassword() {
|
|
||||||
welcomePage.navigateTo();
|
|
||||||
if (!welcomePage.isPasswordSet()) {
|
|
||||||
welcomePage.setPassword("admin", "admin");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deleteAllCookiesForMasterRealm() {
|
public void deleteAllCookiesForMasterRealm() {
|
||||||
masterRealmPage.navigateTo();
|
masterRealmPage.navigateTo();
|
||||||
log.debug("deleting cookies in master realm");
|
log.debug("deleting cookies in master realm");
|
||||||
|
|
|
@ -5,12 +5,11 @@
|
||||||
"enabled" : true,
|
"enabled" : true,
|
||||||
"credentials" : [ {
|
"credentials" : [ {
|
||||||
"type" : "password",
|
"type" : "password",
|
||||||
"hashedSaltedValue" : "6K5rvcPu3dXndZOhpzLAVbFtcdlUhbGCrUyV0NNzeS61IdhMpjH8Mf4y/Ag/vHZkw4Ayvtvb9/1iMNOzxR0M6g==",
|
"hashedSaltedValue" : "dqalJHLkWhUJZO/q6+z1fvXOohTcGCXcvoU8xCEyvTxGN4wmLx7DtyhKuefggh6Bkx1I2eBTEX4tiWggwyXMDw==",
|
||||||
"salt" : "/6M1jTMUB0uR8EOkksFn/A==",
|
"salt" : "3fBAt5GAGGxFrV9fznpZHQ==",
|
||||||
"hashIterations" : 100000,
|
"hashIterations" : 100000,
|
||||||
"algorithm" : "pbkdf2"
|
"algorithm" : "pbkdf2"
|
||||||
} ],
|
} ],
|
||||||
"realmRoles" : [ "admin" ]
|
"realmRoles" : [ "admin" ]
|
||||||
} ],
|
} ]
|
||||||
"identityFederationEnabled" : false
|
|
||||||
} ]
|
} ]
|
|
@ -41,6 +41,7 @@
|
||||||
<version.shrinkwrap.resolvers>2.1.1</version.shrinkwrap.resolvers>
|
<version.shrinkwrap.resolvers>2.1.1</version.shrinkwrap.resolvers>
|
||||||
<skip.unpack.server>true</skip.unpack.server>
|
<skip.unpack.server>true</skip.unpack.server>
|
||||||
<skip.unpack.previous>true</skip.unpack.previous>
|
<skip.unpack.previous>true</skip.unpack.previous>
|
||||||
|
<skip.install.adapters>true</skip.install.adapters>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
|
@ -95,6 +96,7 @@
|
||||||
<auth.server.ssl.required>${auth.server.ssl.required}</auth.server.ssl.required>
|
<auth.server.ssl.required>${auth.server.ssl.required}</auth.server.ssl.required>
|
||||||
<startup.timeout.sec>${startup.timeout.sec}</startup.timeout.sec>
|
<startup.timeout.sec>${startup.timeout.sec}</startup.timeout.sec>
|
||||||
<jboss.server.config.dir>${project.build.directory}/undertow-configuration</jboss.server.config.dir>
|
<jboss.server.config.dir>${project.build.directory}/undertow-configuration</jboss.server.config.dir>
|
||||||
|
<skip.install.adapters>${skip.install.adapters}</skip.install.adapters>
|
||||||
</systemPropertyVariables>
|
</systemPropertyVariables>
|
||||||
<properties>
|
<properties>
|
||||||
<property>
|
<property>
|
||||||
|
@ -152,6 +154,7 @@
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-resources-plugin</artifactId>
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
@ -416,6 +419,7 @@
|
||||||
<startup.timeout.sec>300</startup.timeout.sec>
|
<startup.timeout.sec>300</startup.timeout.sec>
|
||||||
<adapter.test.props/>
|
<adapter.test.props/>
|
||||||
<keycloak.home>${containers.home}/keycloak-${project.version}</keycloak.home>
|
<keycloak.home>${containers.home}/keycloak-${project.version}</keycloak.home>
|
||||||
|
<jboss.server.config.dir>${keycloak.home}/standalone/configuration</jboss.server.config.dir>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -448,7 +452,7 @@
|
||||||
<goal>copy-resources</goal>
|
<goal>copy-resources</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<outputDirectory>${keycloak.home}/standalone/configuration</outputDirectory>
|
<outputDirectory>${jboss.server.config.dir}</outputDirectory>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
<directory>src/test/resources</directory>
|
<directory>src/test/resources</directory>
|
||||||
|
@ -512,6 +516,7 @@
|
||||||
<startup.timeout.sec>300</startup.timeout.sec>
|
<startup.timeout.sec>300</startup.timeout.sec>
|
||||||
<adapter.test.props/>
|
<adapter.test.props/>
|
||||||
<keycloak.home>${containers.home}/keycloak-${version.eap6.server.dist}</keycloak.home>
|
<keycloak.home>${containers.home}/keycloak-${version.eap6.server.dist}</keycloak.home>
|
||||||
|
<jboss.server.config.dir>${keycloak.home}/standalone/configuration</jboss.server.config.dir>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -570,7 +575,7 @@
|
||||||
<goal>copy-resources</goal>
|
<goal>copy-resources</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<outputDirectory>${keycloak.home}/standalone/configuration</outputDirectory>
|
<outputDirectory>${jboss.server.config.dir}</outputDirectory>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
<directory>src/test/resources</directory>
|
<directory>src/test/resources</directory>
|
||||||
|
|
Loading…
Reference in a new issue