diff --git a/testsuite/integration-arquillian/pom.xml b/testsuite/integration-arquillian/pom.xml index b2cd0f275c..674a92f180 100644 --- a/testsuite/integration-arquillian/pom.xml +++ b/testsuite/integration-arquillian/pom.xml @@ -47,6 +47,7 @@ 2.3.1 2.1.0.Final 1.0.1.Final + 2.2.0.Final 1.2.0.Beta2 2.2.6 1.0.0.Alpha2 diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse63/pom.xml b/testsuite/integration-arquillian/servers/app-server/karaf/fuse63/pom.xml index 89eefba677..31352de97d 100644 --- a/testsuite/integration-arquillian/servers/app-server/karaf/fuse63/pom.xml +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse63/pom.xml @@ -58,6 +58,6 @@ - + diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/pom.xml b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/pom.xml new file mode 100644 index 0000000000..8e054a8e6a --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/pom.xml @@ -0,0 +1,63 @@ + + + + + + org.keycloak.testsuite + integration-arquillian-servers-app-server-karaf + 4.0.0.Beta2-SNAPSHOT + + 4.0.0 + + integration-arquillian-servers-app-server-fuse70 + pom + App Server - Karaf - JBoss Fuse 7.0 + + + fuse70 + org.jboss.fuse + jboss-fuse-karaf + ${fuse70.version} + jboss-fuse-karaf-${fuse70.version} + -u admin -p admin + + + + + + maven-enforcer-plugin + + + + enforce + + + + + fuse70.version + + + + + + + + + + diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/install-features.cli b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/install-features.cli new file mode 100644 index 0000000000..e71a92b645 --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/install-features.cli @@ -0,0 +1,3 @@ +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 keycloak-fuse-7.0-example diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/keycloak-direct-access.json b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/keycloak-direct-access.json new file mode 100644 index 0000000000..1b3ce639e7 --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/keycloak-direct-access.json @@ -0,0 +1,9 @@ +{ + "realm": "demo", + "resource": "ssh-jmx-admin-client", + "ssl-required" : "external", + "auth-server-url" : "http://localhost:8080/auth", + "credentials": { + "secret": "password" + } +} diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/keycloak-hawtio-client.json b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/keycloak-hawtio-client.json new file mode 100644 index 0000000000..c28051d85a --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/keycloak-hawtio-client.json @@ -0,0 +1,7 @@ +{ + "realm" : "demo", + "resource" : "hawtio-client", + "auth-server-url" : "http://localhost:8080/auth", + "ssl-required" : "external", + "public-client" : true +} diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/keycloak-hawtio.json b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/keycloak-hawtio.json new file mode 100644 index 0000000000..b7f6b9ea90 --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/keycloak-hawtio.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/fuse70/src/main/resources/update-config-auth.cli b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/update-config-auth.cli new file mode 100644 index 0000000000..b3f63c2090 --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/update-config-auth.cli @@ -0,0 +1,8 @@ +config:edit org.apache.karaf.shell +config:property-set sshRealm keycloak +config:update +system:property -p hawtio.roles admin,user +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.rolePrincipalClasses org.keycloak.adapters.jaas.RolePrincipal,org.apache.karaf.jaas.boot.principal.RolePrincipal diff --git a/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/update-config.cli b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/update-config.cli new file mode 100644 index 0000000000..6c272c6f0d --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/update-config.cli @@ -0,0 +1,10 @@ +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 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/fuse70/src/main/resources/users.properties b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/main/resources/users.properties new file mode 100644 index 0000000000..97e935c74e --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/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/fuse70/src/saml-adapter-not-supported b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/src/saml-adapter-not-supported new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/testsuite/integration-arquillian/servers/app-server/karaf/fuse70/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 7ddfdd9c03..2dfc7bb8ed 100644 --- a/testsuite/integration-arquillian/servers/app-server/karaf/pom.xml +++ b/testsuite/integration-arquillian/servers/app-server/karaf/pom.xml @@ -192,32 +192,78 @@ - + + + enforce-props-when-update-config + + + app.server.karaf.update.config + true + + + + + + maven-enforcer-plugin + + + enforce-props-when-update-config + + enforce + + + + + When updating config maven.local.settings is expected to be explicitly set. + maven.local.settings + + + When updating config maven.repo.local is expected to be explicitly set. + maven.repo.local + + + When updating config repositories is expected to be set. + repositories + + + + + + + + + + app-server-karaf3 karaf3 - + app-server-fuse61 fuse61 - + app-server-fuse62 fuse62 - + app-server-fuse63 fuse63 - - + + + app-server-fuse70 + + fuse70 + + diff --git a/testsuite/integration-arquillian/tests/base/offline-token.txt b/testsuite/integration-arquillian/tests/base/offline-token.txt deleted file mode 100644 index ec747fa47d..0000000000 --- a/testsuite/integration-arquillian/tests/base/offline-token.txt +++ /dev/null @@ -1 +0,0 @@ -null \ No newline at end of file diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/karaf/CustomKarafContainer.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/karaf/CustomKarafContainer.java index 46f43a3201..0b612d0cf2 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/karaf/CustomKarafContainer.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/karaf/CustomKarafContainer.java @@ -1,7 +1,6 @@ package org.keycloak.testsuite.arquillian.karaf; import java.io.File; -import java.io.FilenameFilter; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; @@ -25,7 +24,7 @@ import org.slf4j.LoggerFactory; /** * KarafManagedDeployableContainer - * + * * @author thomas.diesler@jboss.com */ public class CustomKarafContainer extends JMXDeployableContainer { @@ -79,7 +78,7 @@ public class CustomKarafContainer String java = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"; _logger.info(String.format("Using java: %s", java)); - List cmd = new ArrayList(); + List cmd = new ArrayList<>(); cmd.add(java); // JavaVM args @@ -95,6 +94,7 @@ public class CustomKarafContainer cmd.add("-Dkaraf.etc=" + karafHomeDir + "/etc"); cmd.add("-Dkaraf.data=" + karafHomeDir + "/data"); cmd.add("-Dkaraf.instances=" + karafHomeDir + "/instances"); + cmd.add("-Dkaraf.restart.jvm.supported=true"); cmd.add("-Dkaraf.startLocalConsole=false"); cmd.add("-Dkaraf.startRemoteShell=true"); @@ -105,16 +105,23 @@ public class CustomKarafContainer // Classpath StringBuilder classPath = new StringBuilder(); - File karafLibDir = new File(karafHomeDir, "lib"); - String[] libs = karafLibDir.list(new FilenameFilter() { - @Override - public boolean accept(File dir, String name) { - return name.startsWith("karaf"); + boolean fuse7 = new File(karafHomeDir, "lib/boot/").exists(); + if (fuse7) { + _logger.info("Adding karaf4 libraries to classpath."); + File karafLibBootDir = new File(karafHomeDir, "lib/boot/"); + String[] libs = karafLibBootDir.list((File dir, String name) -> name.endsWith(".jar")); + for (String lib : libs) { + String separator = classPath.length() > 0 ? File.pathSeparator : ""; + classPath.append(separator).append(new File(karafLibBootDir, lib)); + } + } else { //fuse6 + _logger.info("Adding karaf3 libraries to classpath."); + File karafLibDir = new File(karafHomeDir, "lib"); + String[] libs = karafLibDir.list((File dir, String name) -> name.startsWith("karaf")); + for (String lib : libs) { + String separator = classPath.length() > 0 ? File.pathSeparator : ""; + classPath.append(separator).append(new File(karafHomeDir, "lib/" + lib)); } - }); - for (String lib : libs) { - String separator = classPath.length() > 0 ? File.pathSeparator : ""; - classPath.append(separator).append(new File(karafHomeDir, "lib/" + lib)); } cmd.add("-classpath"); cmd.add(classPath.toString()); @@ -194,7 +201,7 @@ public class CustomKarafContainer private void destroyKarafProcess() throws LifecycleException { if (process != null) { - process.destroy(); + process.destroy(); try { process.waitFor(); } catch (InterruptedException e) { diff --git a/testsuite/integration-arquillian/tests/other/adapters/karaf/fuse63/pom.xml b/testsuite/integration-arquillian/tests/other/adapters/karaf/fuse63/pom.xml index a383fc6363..116e39bf59 100644 --- a/testsuite/integration-arquillian/tests/other/adapters/karaf/fuse63/pom.xml +++ b/testsuite/integration-arquillian/tests/other/adapters/karaf/fuse63/pom.xml @@ -42,7 +42,6 @@ org.apache.httpcomponents httpclient - ${apache.httpcomponents.version} diff --git a/testsuite/integration-arquillian/tests/other/adapters/karaf/fuse70/pom.xml b/testsuite/integration-arquillian/tests/other/adapters/karaf/fuse70/pom.xml new file mode 100644 index 0000000000..f48c938571 --- /dev/null +++ b/testsuite/integration-arquillian/tests/other/adapters/karaf/fuse70/pom.xml @@ -0,0 +1,48 @@ + + + + + + 4.0.0 + + + org.keycloak.testsuite + integration-arquillian-tests-adapters-karaf + 4.0.0.Beta2-SNAPSHOT + + + integration-arquillian-tests-adapters-fuse70 + + Adapter Tests - Karaf - JBoss Fuse 7.0 + + + fuse70 + + admin + admin + + + + + org.apache.httpcomponents + httpclient + + + + diff --git a/testsuite/integration-arquillian/tests/other/adapters/karaf/fuse70/src/test/java/org/keycloak/testsuite/adapter/example/Fuse70AdminAdapterTest.java b/testsuite/integration-arquillian/tests/other/adapters/karaf/fuse70/src/test/java/org/keycloak/testsuite/adapter/example/Fuse70AdminAdapterTest.java new file mode 100644 index 0000000000..07e66b280a --- /dev/null +++ b/testsuite/integration-arquillian/tests/other/adapters/karaf/fuse70/src/test/java/org/keycloak/testsuite/adapter/example/Fuse70AdminAdapterTest.java @@ -0,0 +1,25 @@ +/* + * 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; + +import org.keycloak.testsuite.arquillian.annotation.AppServerContainer; + +@AppServerContainer("app-server-fuse70") +public class Fuse70AdminAdapterTest extends AbstractFuseAdminAdapterTest { + +} diff --git a/testsuite/integration-arquillian/tests/other/adapters/karaf/fuse70/src/test/java/org/keycloak/testsuite/adapter/example/Fuse70ExampleAdapterTest.java b/testsuite/integration-arquillian/tests/other/adapters/karaf/fuse70/src/test/java/org/keycloak/testsuite/adapter/example/Fuse70ExampleAdapterTest.java new file mode 100644 index 0000000000..1d37add527 --- /dev/null +++ b/testsuite/integration-arquillian/tests/other/adapters/karaf/fuse70/src/test/java/org/keycloak/testsuite/adapter/example/Fuse70ExampleAdapterTest.java @@ -0,0 +1,25 @@ +/* + * 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; + +import org.keycloak.testsuite.arquillian.annotation.AppServerContainer; + +@AppServerContainer("app-server-fuse70") +public class Fuse70ExampleAdapterTest extends AbstractFuseExampleAdapterTest { + +} diff --git a/testsuite/integration-arquillian/tests/other/adapters/karaf/pom.xml b/testsuite/integration-arquillian/tests/other/adapters/karaf/pom.xml index d53a324303..a8b0aca3cb 100644 --- a/testsuite/integration-arquillian/tests/other/adapters/karaf/pom.xml +++ b/testsuite/integration-arquillian/tests/other/adapters/karaf/pom.xml @@ -53,41 +53,6 @@ src - - - - org.jboss.arquillian.container - arquillian-container-karaf-managed - 2.1.0.CR18 - - - - org.apache.aries.jmx - org.apache.aries.jmx - 1.1.1 - - - - jline - jline - 2.12 - - - org.apache.karaf.shell - org.apache.karaf.shell.console - 3.0.3 - - - org.apache.karaf - org.apache.karaf.client - 3.0.3 - - - org.apache.sshd - sshd-core - 1.2.0 - - @@ -113,33 +78,37 @@ - + app-server-karaf3 karaf3 - + app-server-fuse61 fuse61 - + app-server-fuse62 fuse62 - + app-server-fuse63 fuse63 - - + + + app-server-fuse70 + + fuse70 + + - diff --git a/testsuite/integration-arquillian/tests/pom.xml b/testsuite/integration-arquillian/tests/pom.xml index 8339d54fc1..5bf0e379ff 100755 --- a/testsuite/integration-arquillian/tests/pom.xml +++ b/testsuite/integration-arquillian/tests/pom.xml @@ -347,12 +347,12 @@ org.jboss.arquillian.container arquillian-container-karaf-managed - 2.1.0.CR18 + ${arquillian-container-karaf.version} org.jboss.arquillian.container arquillian-container-osgi - 2.1.0.CR18 + ${arquillian-container-karaf.version} com.google.guava