KEYCLOAK-7550 - adapter tests - Fuse7.1 provider

This commit is contained in:
vramik 2018-06-27 23:44:17 +02:00 committed by Pavel Drozd
parent f10c47955f
commit c97e7e720e
20 changed files with 366 additions and 2 deletions

View file

@ -0,0 +1,86 @@
<?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">
<parent>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers-app-server-karaf</artifactId>
<version>4.1.0.Final-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-arquillian-servers-app-server-fuse71</artifactId>
<packaging>jar</packaging>
<name>App Server - Fuse 7.1</name>
<properties>
<app.server.karaf>fuse71</app.server.karaf>
<app.server.karaf.groupId>org.jboss.fuse</app.server.karaf.groupId>
<app.server.karaf.artifactId>fuse-karaf</app.server.karaf.artifactId>
<app.server.karaf.version>${fuse71.version}</app.server.karaf.version>
<app.server.karaf.unpacked.folder.name>fuse-karaf-${fuse71.version}</app.server.karaf.unpacked.folder.name>
<app.server.karaf.client.auth>-u admin -p admin</app.server.karaf.client.auth>
</properties>
<dependencies>
<dependency>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers-app-server-spi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-util</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-osgi</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireProperty>
<property>fuse71.version</property>
</requireProperty>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,36 @@
/*
* Copyright 2018 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.arquillian.fuse;
import org.jboss.arquillian.container.spi.client.container.DeployableContainer;
import org.jboss.arquillian.core.spi.LoadableExtension;
import org.keycloak.testsuite.utils.arquillian.fuse.CustomFuseContainer;
/**
*
* @author <a href="mailto:vramik@redhat.com">Vlasta Ramik</a>
*/
public class Fuse71AppServerArquillianExtension implements LoadableExtension {
@Override
public void register(ExtensionBuilder builder) {
builder.service(DeployableContainer.class, CustomFuseContainer.class);
}
}

View file

@ -0,0 +1,92 @@
/*
* Copyright 2018 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.arquillian.fuse.container;
import java.util.ArrayList;
import java.util.List;
import org.jboss.arquillian.core.spi.Validate;
import org.jboss.shrinkwrap.descriptor.spi.node.Node;
import org.keycloak.testsuite.arquillian.container.AppServerContainerProvider;
import org.keycloak.testsuite.utils.arquillian.fuse.CustomFuseContainer;
/**
* @author <a href="mailto:vramik@redhat.com">Vlasta Ramik</a>
*/
public class Fuse71AppServerProvider implements AppServerContainerProvider {
private Node configuration;
private static final String containerName = "fuse71";
private final String appServerHome;
private final String appServerJavaHome;
private final String managementUser;
private final String managementPassword;
public Fuse71AppServerProvider() {
appServerHome = System.getProperty("app.server.home");
appServerJavaHome = System.getProperty("app.server.java.home");
managementUser = System.getProperty("app.server.management.user");
managementPassword = System.getProperty("app.server.management.password");
Validate.notNullOrEmpty(appServerHome, "app.server.home is not set.");
Validate.notNullOrEmpty(appServerJavaHome, "app.server.java.home is not set.");
Validate.notNullOrEmpty(managementUser, "app.server.management.user is not set.");
Validate.notNullOrEmpty(managementPassword, "app.server.management.password is not set.");
}
@Override
public String getName() {
return containerName;
}
@Override
public List<Node> getContainers() {
List<Node> containers = new ArrayList<>();
containers.add(standaloneContainer());
return containers;
}
private void createChild(String name, String text) {
configuration.createChild("property").attribute("name", name).text(text);
}
private Node standaloneContainer() {
Node container = new Node("container");
container.attribute("mode", "manual");
container.attribute("qualifier", AppServerContainerProvider.APP_SERVER + "-" + containerName);
configuration = container.createChild("configuration");
createChild("enabled", "true");
createChild("adapterImplClass", CustomFuseContainer.class.getName());
createChild("autostartBundle", "false");
createChild("karafHome", appServerHome);
createChild("javaHome", appServerJavaHome);
createChild("javaVmArguments",
System.getProperty("app.server.karaf.jvm.debug.args", "") + " " +
System.getProperty("adapter.test.props", " ")
);
createChild("jmxServiceURL", "service:jmx:rmi://127.0.0.1:44444/jndi/rmi://127.0.0.1:1099/karaf-root");
createChild("jmxUsername", managementUser);
createChild("jmxPassword", managementPassword);
return container;
}
}

View file

@ -0,0 +1 @@
org.keycloak.testsuite.arquillian.fuse.Fuse71AppServerArquillianExtension

View file

@ -0,0 +1,7 @@
feature:repo-add mvn:org.keycloak/keycloak-osgi-features/${project.version}/xml/features
feature:repo-add mvn:org.keycloak.example.demo/keycloak-fuse-example-features/${project.version}/xml/features
feature:install pax-http-undertow
feature:install keycloak-jaas keycloak-pax-http-undertow
feature:install keycloak-fuse-7.0-example

View file

@ -0,0 +1,9 @@
{
"realm" : "demo",
"resource" : "jaas",
"bearer-only" : true,
"auth-server-url" : "http://localhost:8080/auth",
"ssl-required" : "external",
"use-resource-role-mappings": false,
"principal-attribute": "preferred_username"
}

View file

@ -0,0 +1,9 @@
{
"realm" : "demo",
"resource" : "ssh-jmx-admin-client",
"auth-server-url" : "http://localhost:8080/auth",
"ssl-required" : "external",
"credentials": {
"secret": "password"
}
}

View file

@ -0,0 +1,7 @@
{
"realm" : "demo",
"clientId" : "hawtio-client",
"url" : "http://localhost:8080/auth",
"ssl-required" : "external",
"public-client" : true
}

View file

@ -0,0 +1,9 @@
{
"realm" : "demo",
"resource" : "ssh-jmx-admin-client",
"auth-server-url" : "http://localhost:8080/auth",
"ssl-required" : "external",
"credentials": {
"secret": "password"
}
}

View file

@ -0,0 +1,9 @@
config:edit org.apache.karaf.shell
config:property-set sshRealm keycloak
config:update
system:property -p hawtio.keycloakEnabled true
system:property -p hawtio.realm keycloak
system:property -p hawtio.keycloakClientConfig file://\${karaf.base}/etc/keycloak-hawtio-client.json
system:property -p hawtio.keycloakServerConfig file://\${karaf.base}/etc/keycloak-bearer.json
system:property -p hawtio.rolePrincipalClasses org.keycloak.adapters.jaas.RolePrincipal,org.apache.karaf.jaas.boot.principal.RolePrincipal

View file

@ -0,0 +1,15 @@
config:edit org.ops4j.pax.url.mvn
config:property-set org.ops4j.pax.url.mvn.localRepository ${maven.repo.local}
config:property-set org.ops4j.pax.url.mvn.settings ${maven.local.settings}
config:property-append org.ops4j.pax.url.mvn.repositories ${repositories}
config:update
config:edit org.ops4j.pax.web
config:property-set org.ops4j.pax.web.config.file '${karaf.etc}/undertow.xml'
config:update
config:edit jmx.acl.org.apache.karaf.security.jmx
config:property-append list* viewer
config:property-append set* jmxAdmin
config:property-append * jmxAdmin,admin
config:update

View file

@ -0,0 +1 @@
admin=admin,admin,manager,viewer,ssh,systembundles

View file

@ -255,16 +255,40 @@
</profile>
<profile>
<id>app-server-fuse63</id>
<activation>
<property>
<name>app.server</name>
<value>fuse63</value>
</property>
</activation>
<modules>
<module>fuse63</module>
</modules>
</profile>
<profile>
<id>app-server-fuse70</id>
<activation>
<property>
<name>app.server</name>
<value>fuse70</value>
</property>
</activation>
<modules>
<module>fuse70</module>
</modules>
</profile>
<profile>
<id>app-server-fuse71</id>
<activation>
<property>
<name>app.server</name>
<value>fuse71</value>
</property>
</activation>
<modules>
<module>fuse71</module>
</modules>
</profile>
</profiles>
</project>

View file

@ -617,6 +617,60 @@
</plugins>
</build>
</profile>
<profile>
<id>app-server-fuse71</id>
<activation>
<property>
<name>app.server</name>
<value>fuse71</value>
</property>
</activation>
<properties>
<app.server>fuse71</app.server> <!--in case the profile is called directly-->
<app.server.skip.unpack>false</app.server.skip.unpack>
<!--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>
<app.server.management.user>admin</app.server.management.user>
<app.server.management.password>admin</app.server.management.password>
<app.server.karaf.jvm.debug.args>-agentlib:jdwp=transport=dt_socket,server=y,suspend=${app.server.debug.suspend},address=localhost:${app.server.debug.port}</app.server.karaf.jvm.debug.args>
</properties>
<dependencies>
<dependency>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers-app-server-fuse71</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-karaf-managed</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.commonjava.maven.plugins</groupId>
<artifactId>directory-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<app.server.management.user>${app.server.management.user}</app.server.management.user>
<app.server.management.password>${app.server.management.password}</app.server.management.password>
<app.server.karaf.jvm.debug.args>${app.server.karaf.jvm.debug.args}</app.server.karaf.jvm.debug.args>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>auth-servers-crossdc-undertow</id>
<properties>

View file

@ -37,4 +37,5 @@ public interface ContainerConstants {
public static final String APP_SERVER_FUSE63 = APP_SERVER_PREFIX + "fuse63";
public static final String APP_SERVER_FUSE70 = APP_SERVER_PREFIX + "fuse70";
public static final String APP_SERVER_FUSE71 = APP_SERVER_PREFIX + "fuse71";
}

View file

@ -25,7 +25,7 @@ public class ContainerAssume {
private static final Logger log = Logger.getLogger(ContainerAssume.class);
private static final String fuse6 = "fuse63";
private static final String fuse7 = "fuse70";
private static final String fuse7 = "fuse7";
public static void assumeNotAuthServerUndertow() {
Assume.assumeFalse("Doesn't work on auth-server-undertow",
@ -47,6 +47,6 @@ public class ContainerAssume {
}
public static void assumeNotAppServerFuse7() {
Assume.assumeFalse("The test doesn't work on " + fuse7, fuse7.equals(System.getProperty("app.server")));
Assume.assumeFalse("The test doesn't work on " + fuse7, System.getProperty("app.server").contains(fuse7));
}
}

View file

@ -76,6 +76,7 @@ import org.openqa.selenium.WebDriver;
@AppServerContainer(ContainerConstants.APP_SERVER_FUSE63)
@AppServerContainer(ContainerConstants.APP_SERVER_FUSE70)
@AppServerContainer(ContainerConstants.APP_SERVER_FUSE71)
public class FuseAdminAdapterTest extends AbstractExampleAdapterTest {
@Drone

View file

@ -47,6 +47,7 @@ import org.keycloak.testsuite.util.WaitUtils;
*/
@AppServerContainer(ContainerConstants.APP_SERVER_FUSE63)
@AppServerContainer(ContainerConstants.APP_SERVER_FUSE70)
@AppServerContainer(ContainerConstants.APP_SERVER_FUSE71)
public class FuseExampleAdapterTest extends AbstractExampleAdapterTest {
@Page