From c97e7e720e965209605f31655aec79375ac7981e Mon Sep 17 00:00:00 2001 From: vramik Date: Wed, 27 Jun 2018 23:44:17 +0200 Subject: [PATCH] KEYCLOAK-7550 - adapter tests - Fuse7.1 provider --- .../servers/app-server/karaf/fuse71/pom.xml | 86 +++++++++++++++++ .../Fuse71AppServerArquillianExtension.java | 36 ++++++++ .../container/Fuse71AppServerProvider.java | 92 +++++++++++++++++++ ...boss.arquillian.core.spi.LoadableExtension | 1 + ...llian.container.AppServerContainerProvider | 1 + .../src/main/resources/install-features.cli | 7 ++ .../src/main/resources/keycloak-bearer.json | 9 ++ .../resources/keycloak-direct-access.json | 9 ++ .../resources/keycloak-hawtio-client.json | 7 ++ .../src/main/resources/keycloak-hawtio.json | 9 ++ .../src/main/resources/update-config-auth.cli | 9 ++ .../src/main/resources/update-config.cli | 15 +++ .../src/main/resources/users.properties | 1 + .../fuse71/src/saml-adapter-not-supported | 1 + .../servers/app-server/karaf/pom.xml | 24 +++++ .../integration-arquillian/tests/base/pom.xml | 54 +++++++++++ .../containers/ContainerConstants.java | 1 + .../testsuite/util/ContainerAssume.java | 4 +- .../example/fuse/FuseAdminAdapterTest.java | 1 + .../example/fuse/FuseExampleAdapterTest.java | 1 + 20 files changed, 366 insertions(+), 2 deletions(-) create mode 100644 testsuite/integration-arquillian/servers/app-server/karaf/fuse71/pom.xml create mode 100644 testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/java/org/keycloak/testsuite/arquillian/fuse/Fuse71AppServerArquillianExtension.java create mode 100644 testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/java/org/keycloak/testsuite/arquillian/fuse/container/Fuse71AppServerProvider.java create mode 100644 testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension create mode 100644 testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/META-INF/services/org.keycloak.testsuite.arquillian.container.AppServerContainerProvider create mode 100644 testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/install-features.cli create mode 100644 testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/keycloak-bearer.json create mode 100644 testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/keycloak-direct-access.json create mode 100644 testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/keycloak-hawtio-client.json create mode 100644 testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/keycloak-hawtio.json create mode 100644 testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/update-config-auth.cli create mode 100644 testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/update-config.cli create mode 100644 testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/users.properties create mode 100644 testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/saml-adapter-not-supported diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/pom.xml b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/pom.xml new file mode 100644 index 0000000000..14a147645f --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/pom.xml @@ -0,0 +1,86 @@ + + + + + + org.keycloak.testsuite + integration-arquillian-servers-app-server-karaf + 4.1.0.Final-SNAPSHOT + + 4.0.0 + + integration-arquillian-servers-app-server-fuse71 + jar + App Server - Fuse 7.1 + + + fuse71 + org.jboss.fuse + fuse-karaf + ${fuse71.version} + fuse-karaf-${fuse71.version} + -u admin -p admin + + + + + org.keycloak.testsuite + integration-arquillian-servers-app-server-spi + ${project.version} + + + org.keycloak.testsuite + integration-arquillian-util + ${project.version} + + + org.jboss.arquillian.container + arquillian-container-osgi + + + com.google.guava + guava + + + + + + + + + maven-enforcer-plugin + + + + enforce + + + + + fuse71.version + + + + + + + + + + diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/java/org/keycloak/testsuite/arquillian/fuse/Fuse71AppServerArquillianExtension.java b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/java/org/keycloak/testsuite/arquillian/fuse/Fuse71AppServerArquillianExtension.java new file mode 100644 index 0000000000..9e52a0e983 --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/java/org/keycloak/testsuite/arquillian/fuse/Fuse71AppServerArquillianExtension.java @@ -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 Vlasta Ramik + */ +public class Fuse71AppServerArquillianExtension implements LoadableExtension { + + @Override + public void register(ExtensionBuilder builder) { + + builder.service(DeployableContainer.class, CustomFuseContainer.class); + + } + +} diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/java/org/keycloak/testsuite/arquillian/fuse/container/Fuse71AppServerProvider.java b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/java/org/keycloak/testsuite/arquillian/fuse/container/Fuse71AppServerProvider.java new file mode 100644 index 0000000000..0c084b37aa --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/java/org/keycloak/testsuite/arquillian/fuse/container/Fuse71AppServerProvider.java @@ -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 Vlasta Ramik + */ +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 getContainers() { + List 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; + } +} diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension new file mode 100644 index 0000000000..ac525766c9 --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension @@ -0,0 +1 @@ +org.keycloak.testsuite.arquillian.fuse.Fuse71AppServerArquillianExtension diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/META-INF/services/org.keycloak.testsuite.arquillian.container.AppServerContainerProvider b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/META-INF/services/org.keycloak.testsuite.arquillian.container.AppServerContainerProvider new file mode 100644 index 0000000000..a5eec3df91 --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/META-INF/services/org.keycloak.testsuite.arquillian.container.AppServerContainerProvider @@ -0,0 +1 @@ +org.keycloak.testsuite.arquillian.fuse.container.Fuse71AppServerProvider diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/install-features.cli b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/install-features.cli new file mode 100644 index 0000000000..cc8b0cfeba --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/install-features.cli @@ -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 diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/keycloak-bearer.json b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/keycloak-bearer.json new file mode 100644 index 0000000000..b7f6b9ea90 --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/keycloak-bearer.json @@ -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" +} diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/keycloak-direct-access.json b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/keycloak-direct-access.json new file mode 100644 index 0000000000..bc741a9c81 --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/keycloak-direct-access.json @@ -0,0 +1,9 @@ +{ + "realm" : "demo", + "resource" : "ssh-jmx-admin-client", + "auth-server-url" : "http://localhost:8080/auth", + "ssl-required" : "external", + "credentials": { + "secret": "password" + } +} diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/keycloak-hawtio-client.json b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/keycloak-hawtio-client.json new file mode 100644 index 0000000000..97fb5c9747 --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/keycloak-hawtio-client.json @@ -0,0 +1,7 @@ +{ + "realm" : "demo", + "clientId" : "hawtio-client", + "url" : "http://localhost:8080/auth", + "ssl-required" : "external", + "public-client" : true +} diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/keycloak-hawtio.json b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/keycloak-hawtio.json new file mode 100644 index 0000000000..bc741a9c81 --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/keycloak-hawtio.json @@ -0,0 +1,9 @@ +{ + "realm" : "demo", + "resource" : "ssh-jmx-admin-client", + "auth-server-url" : "http://localhost:8080/auth", + "ssl-required" : "external", + "credentials": { + "secret": "password" + } +} diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/update-config-auth.cli b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/update-config-auth.cli new file mode 100644 index 0000000000..7e38734522 --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/update-config-auth.cli @@ -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 diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/update-config.cli b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/update-config.cli new file mode 100644 index 0000000000..b1e19c0f6d --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/update-config.cli @@ -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 diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/users.properties b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/users.properties new file mode 100644 index 0000000000..97e935c74e --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/main/resources/users.properties @@ -0,0 +1 @@ +admin=admin,admin,manager,viewer,ssh,systembundles diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/saml-adapter-not-supported b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/saml-adapter-not-supported new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse71/src/saml-adapter-not-supported @@ -0,0 +1 @@ + diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/pom.xml b/testsuite/integration-arquillian/servers/app-server/karaf/pom.xml index df29f1e48f..0373c5ecc5 100644 --- a/testsuite/integration-arquillian/servers/app-server/karaf/pom.xml +++ b/testsuite/integration-arquillian/servers/app-server/karaf/pom.xml @@ -255,16 +255,40 @@ app-server-fuse63 + + + app.server + fuse63 + + fuse63 app-server-fuse70 + + + app.server + fuse70 + + fuse70 + + app-server-fuse71 + + + app.server + fuse71 + + + + fuse71 + + diff --git a/testsuite/integration-arquillian/tests/base/pom.xml b/testsuite/integration-arquillian/tests/base/pom.xml index 1cf8f024cb..6de123addc 100644 --- a/testsuite/integration-arquillian/tests/base/pom.xml +++ b/testsuite/integration-arquillian/tests/base/pom.xml @@ -617,6 +617,60 @@ + + app-server-fuse71 + + + app.server + fuse71 + + + + fuse71 + false + + + 0 + 8080 + 9990 + + 8181 + + admin + admin + -agentlib:jdwp=transport=dt_socket,server=y,suspend=${app.server.debug.suspend},address=localhost:${app.server.debug.port} + + + + org.keycloak.testsuite + integration-arquillian-servers-app-server-fuse71 + ${project.version} + runtime + + + org.jboss.arquillian.container + arquillian-container-karaf-managed + + + + + + org.commonjava.maven.plugins + directory-maven-plugin + + + maven-surefire-plugin + + + ${app.server.management.user} + ${app.server.management.password} + ${app.server.karaf.jvm.debug.args} + + + + + + auth-servers-crossdc-undertow diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/containers/ContainerConstants.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/containers/ContainerConstants.java index 558686a699..d9cfa6985a 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/containers/ContainerConstants.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/containers/ContainerConstants.java @@ -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"; } diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/ContainerAssume.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/ContainerAssume.java index 84a63b747d..a984facbd3 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/ContainerAssume.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/ContainerAssume.java @@ -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)); } } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/fuse/FuseAdminAdapterTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/fuse/FuseAdminAdapterTest.java index 99a8fbceab..1fa0dcdd96 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/fuse/FuseAdminAdapterTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/fuse/FuseAdminAdapterTest.java @@ -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 diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/fuse/FuseExampleAdapterTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/fuse/FuseExampleAdapterTest.java index 3caadb3943..3625d31a62 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/fuse/FuseExampleAdapterTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/fuse/FuseExampleAdapterTest.java @@ -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