KEYCLOAK-7588 - adapter tests - Fuse6.3 provider

This commit is contained in:
vramik 2018-06-26 11:27:17 +02:00 committed by Pavel Drozd
parent af47bd5da8
commit 39cbf4e9ab
23 changed files with 328 additions and 212 deletions

View file

@ -128,6 +128,22 @@
<artifactId>undertow-embedded</artifactId> <artifactId>undertow-embedded</artifactId>
<version>${undertow-embedded.version}</version> <version>${undertow-embedded.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-karaf-managed</artifactId>
<version>${arquillian-container-karaf.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-osgi</artifactId>
<version>${arquillian-container-karaf.version}</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>

View file

@ -26,8 +26,8 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>integration-arquillian-servers-app-server-fuse63</artifactId> <artifactId>integration-arquillian-servers-app-server-fuse63</artifactId>
<packaging>pom</packaging> <packaging>jar</packaging>
<name>App Server - Karaf - JBoss Fuse 6.3</name> <name>App Server - Fuse 6.3</name>
<properties> <properties>
<app.server.karaf>fuse63</app.server.karaf> <app.server.karaf>fuse63</app.server.karaf>
@ -37,7 +37,30 @@
<app.server.karaf.unpacked.folder.name>jboss-fuse-${fuse63.version}</app.server.karaf.unpacked.folder.name> <app.server.karaf.unpacked.folder.name>jboss-fuse-${fuse63.version}</app.server.karaf.unpacked.folder.name>
<app.server.karaf.client.auth>-u admin -p admin</app.server.karaf.client.auth> <app.server.karaf.client.auth>-u admin -p admin</app.server.karaf.client.auth>
</properties> </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> <build>
<plugins> <plugins>
<plugin> <plugin>

View file

@ -0,0 +1,41 @@
/*
* 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.osgi.OSGiApplicationArchiveProcessor;
import org.jboss.arquillian.container.spi.client.container.DeployableContainer;
import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
import org.jboss.arquillian.core.spi.LoadableExtension;
import org.keycloak.testsuite.utils.arquillian.fuse.CustomFuseContainer;
import org.keycloak.testsuite.utils.arquillian.fuse.KeycloakOSGiApplicationArchiveProcessor;
/**
*
* @author <a href="mailto:vramik@redhat.com">Vlasta Ramik</a>
*/
public class Fuse63AppServerArquillianExtension implements LoadableExtension {
@Override
public void register(ExtensionBuilder builder) {
builder.service(DeployableContainer.class, CustomFuseContainer.class);
builder.override(ApplicationArchiveProcessor.class, OSGiApplicationArchiveProcessor.class, KeycloakOSGiApplicationArchiveProcessor.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 Fuse63AppServerProvider implements AppServerContainerProvider {
private Node configuration;
private static final String containerName = "fuse63";
private final String appServerHome;
private final String appServerJavaHome;
private final String managementUser;
private final String managementPassword;
public Fuse63AppServerProvider() {
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.Fuse63AppServerArquillianExtension

View file

@ -68,7 +68,7 @@
</requireProperty> </requireProperty>
<requireOS> <requireOS>
<family>!windows</family> <family>!windows</family>
<message>Automated Kara/Fuse adapter configuration currently doesn't work on Windows.</message> <message>Automated Karaf/Fuse adapter configuration currently doesn't work on Windows.</message>
</requireOS> </requireOS>
</rules> </rules>
</configuration> </configuration>

View file

@ -46,6 +46,10 @@
<groupId>org.jboss.resteasy</groupId> <groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-undertow</artifactId> <artifactId>resteasy-undertow</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>undertow-embedded</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

View file

@ -136,6 +136,11 @@
<groupId>org.wildfly.arquillian</groupId> <groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId> <artifactId>wildfly-arquillian-container-managed</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.enterprise</artifactId>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
@ -504,6 +509,60 @@
</plugins> </plugins>
</build> </build>
</profile> </profile>
<profile>
<id>app-server-fuse63</id>
<activation>
<property>
<name>app.server</name>
<value>fuse63</value>
</property>
</activation>
<properties>
<app.server>fuse63</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-fuse63</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> <profile>
<id>auth-servers-crossdc-undertow</id> <id>auth-servers-crossdc-undertow</id>
<properties> <properties>

View file

@ -17,8 +17,6 @@
package org.keycloak.testsuite.arquillian; package org.keycloak.testsuite.arquillian;
import org.jboss.arquillian.container.osgi.OSGiApplicationArchiveProcessor;
import org.jboss.arquillian.container.spi.client.container.DeployableContainer;
import org.jboss.arquillian.container.test.impl.enricher.resource.URLResourceProvider; import org.jboss.arquillian.container.test.impl.enricher.resource.URLResourceProvider;
import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor; import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
import org.jboss.arquillian.container.test.spi.client.deployment.DeploymentScenarioGenerator; import org.jboss.arquillian.container.test.spi.client.deployment.DeploymentScenarioGenerator;
@ -32,7 +30,6 @@ import org.jboss.arquillian.test.spi.enricher.resource.ResourceProvider;
import org.jboss.arquillian.test.spi.execution.TestExecutionDecider; import org.jboss.arquillian.test.spi.execution.TestExecutionDecider;
import org.keycloak.testsuite.arquillian.h2.H2TestEnricher; import org.keycloak.testsuite.arquillian.h2.H2TestEnricher;
import org.keycloak.testsuite.arquillian.jmx.JmxConnectorRegistryCreator; import org.keycloak.testsuite.arquillian.jmx.JmxConnectorRegistryCreator;
import org.keycloak.testsuite.arquillian.karaf.CustomKarafContainer;
import org.keycloak.testsuite.arquillian.migration.MigrationTestExecutionDecider; import org.keycloak.testsuite.arquillian.migration.MigrationTestExecutionDecider;
import org.keycloak.testsuite.arquillian.provider.AdminClientProvider; import org.keycloak.testsuite.arquillian.provider.AdminClientProvider;
import org.keycloak.testsuite.arquillian.provider.LoadBalancerControllerProvider; import org.keycloak.testsuite.arquillian.provider.LoadBalancerControllerProvider;
@ -63,7 +60,6 @@ public class KeycloakArquillianExtension implements LoadableExtension {
builder builder
.service(DeploymentScenarioGenerator.class, DeploymentTargetModifier.class) .service(DeploymentScenarioGenerator.class, DeploymentTargetModifier.class)
.service(ApplicationArchiveProcessor.class, DeploymentArchiveProcessor.class) .service(ApplicationArchiveProcessor.class, DeploymentArchiveProcessor.class)
.service(DeployableContainer.class, CustomKarafContainer.class)
.service(TestEnricher.class, CacheStatisticsControllerEnricher.class) .service(TestEnricher.class, CacheStatisticsControllerEnricher.class)
.observer(JmxConnectorRegistryCreator.class) .observer(JmxConnectorRegistryCreator.class)
.observer(AuthServerTestEnricher.class) .observer(AuthServerTestEnricher.class)
@ -76,8 +72,7 @@ public class KeycloakArquillianExtension implements LoadableExtension {
builder builder
.override(ResourceProvider.class, URLResourceProvider.class, URLProvider.class) .override(ResourceProvider.class, URLResourceProvider.class, URLProvider.class)
.override(ResourceProvider.class, CustomizableURLResourceProvider.class, URLProvider.class) .override(ResourceProvider.class, CustomizableURLResourceProvider.class, URLProvider.class)
.override(ResourceProvider.class, ContainerCustomizableURLResourceProvider.class, URLProvider.class) .override(ResourceProvider.class, ContainerCustomizableURLResourceProvider.class, URLProvider.class);
.override(ApplicationArchiveProcessor.class, OSGiApplicationArchiveProcessor.class, KeycloakOSGiApplicationArchiveProcessor.class);
builder builder
.override(Configurator.class, WebDriverFactory.class, KeycloakWebDriverConfigurator.class) .override(Configurator.class, WebDriverFactory.class, KeycloakWebDriverConfigurator.class)

View file

@ -34,4 +34,6 @@ public interface ContainerConstants {
public static final String APP_SERVER_EAP6 = APP_SERVER_PREFIX + "eap6"; public static final String APP_SERVER_EAP6 = APP_SERVER_PREFIX + "eap6";
public static final String APP_SERVER_EAP6_CLUSTER = APP_SERVER_EAP6 + "-ha-node-1;" + APP_SERVER_EAP6 + "-ha-node-2"; public static final String APP_SERVER_EAP6_CLUSTER = APP_SERVER_EAP6 + "-ha-node-1;" + APP_SERVER_EAP6 + "-ha-node-2";
public static final String APP_SERVER_FUSE63 = APP_SERVER_PREFIX + "fuse63";
} }

View file

@ -1,5 +1,25 @@
package org.keycloak.testsuite.adapter.example; /*
* Copyright 2017 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.hamcrest.Matchers.anyOf;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.keycloak.testsuite.auth.page.AuthRealm.DEMO; import static org.keycloak.testsuite.auth.page.AuthRealm.DEMO;
import static org.keycloak.testsuite.utils.io.IOUtil.loadRealm; import static org.keycloak.testsuite.utils.io.IOUtil.loadRealm;
@ -9,9 +29,6 @@ import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.util.Collections; import java.util.Collections;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
@ -30,26 +47,23 @@ import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL; import javax.management.remote.JMXServiceURL;
import org.apache.sshd.client.SshClient; import org.apache.sshd.client.SshClient;
import org.apache.sshd.client.channel.ClientChannel;
import org.apache.sshd.client.future.ConnectFuture; import org.apache.sshd.client.future.ConnectFuture;
import org.apache.sshd.client.channel.ChannelExec;
import org.apache.sshd.client.channel.ClientChannelEvent;
import org.apache.sshd.client.session.ClientSession; import org.apache.sshd.client.session.ClientSession;
import org.apache.sshd.client.session.ClientSession.ClientSessionEvent; import org.apache.sshd.client.session.ClientSession.ClientSessionEvent;
import org.hamcrest.Matchers;
import org.jboss.arquillian.graphene.page.Page; import org.jboss.arquillian.graphene.page.Page;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.keycloak.representations.idm.RealmRepresentation; import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.testsuite.adapter.AbstractExampleAdapterTest; import org.keycloak.testsuite.adapter.AbstractExampleAdapterTest;
import org.keycloak.testsuite.adapter.page.HawtioPage; import org.keycloak.testsuite.adapter.page.HawtioPage;
import org.apache.sshd.client.channel.ChannelExec; import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.apache.sshd.client.channel.ClientChannel.Streaming; import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
import org.apache.sshd.client.channel.ClientChannelEvent;
import org.hamcrest.Matchers;
import static org.hamcrest.Matchers.anyOf;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
public abstract class AbstractFuseAdminAdapterTest extends AbstractExampleAdapterTest { @AppServerContainer(ContainerConstants.APP_SERVER_FUSE63)
public class FuseAdminAdapterTest extends AbstractExampleAdapterTest {
@Page @Page
private HawtioPage hawtioPage; private HawtioPage hawtioPage;

View file

@ -15,23 +15,8 @@
* limitations under the License. * limitations under the License.
*/ */
package org.keycloak.testsuite.adapter.example; package org.keycloak.testsuite.adapter.example.fuse;
import org.jboss.arquillian.graphene.page.Page;
import org.junit.Test;
import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.testsuite.adapter.AbstractExampleAdapterTest;
import org.keycloak.testsuite.adapter.page.fuse.AdminInterface;
import org.keycloak.testsuite.adapter.page.fuse.CustomerListing;
import org.keycloak.testsuite.adapter.page.fuse.CustomerPortalFuseExample;
import org.keycloak.testsuite.adapter.page.fuse.ProductPortalFuseExample;
import org.keycloak.testsuite.auth.page.account.Account;
import org.keycloak.testsuite.util.WaitUtils;
import java.io.File;
import java.util.List;
import org.hamcrest.Matchers;
import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
@ -41,11 +26,27 @@ import static org.keycloak.testsuite.utils.io.IOUtil.loadRealm;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith; import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWithLoginUrlOf; import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWithLoginUrlOf;
import java.io.File;
import java.util.List;
import org.jboss.arquillian.graphene.page.Page;
import org.junit.Test;
import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.testsuite.adapter.AbstractExampleAdapterTest;
import org.keycloak.testsuite.adapter.page.fuse.AdminInterface;
import org.keycloak.testsuite.adapter.page.fuse.CustomerListing;
import org.keycloak.testsuite.adapter.page.fuse.CustomerPortalFuseExample;
import org.keycloak.testsuite.adapter.page.fuse.ProductPortalFuseExample;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
import org.keycloak.testsuite.auth.page.account.Account;
import org.keycloak.testsuite.util.WaitUtils;
/** /**
* *
* @author tkyjovsk * @author tkyjovsk
*/ */
public abstract class AbstractFuseExampleAdapterTest extends AbstractExampleAdapterTest { @AppServerContainer(ContainerConstants.APP_SERVER_FUSE63)
public class FuseExampleAdapterTest extends AbstractExampleAdapterTest {
@Page @Page
protected CustomerPortalFuseExample customerPortal; protected CustomerPortalFuseExample customerPortal;

View file

@ -1,48 +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-karaf</artifactId>
<version>4.1.0.Final-SNAPSHOT</version>
</parent>
<artifactId>integration-arquillian-tests-adapters-fuse63</artifactId>
<name>Adapter Tests - Karaf - JBoss Fuse 6.3</name>
<properties>
<app.server>fuse63</app.server>
<app.server.management.user>admin</app.server.management.user>
<app.server.management.password>admin</app.server.management.password>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
</dependencies>
</project>

View file

@ -1,8 +0,0 @@
package org.keycloak.testsuite.adapter.example;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
@AppServerContainer("app-server-fuse63")
public class Fuse63AdminAdapterTest extends AbstractFuseAdminAdapterTest {
}

View file

@ -1,27 +0,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.
*/
package org.keycloak.testsuite.adapter.example;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
/**
* @author <a href="mailto:vramik@redhat.com">Vlastislav Ramik</a>
*/
@AppServerContainer("app-server-fuse63")
public class Fuse63ExampleAdapterTest extends AbstractFuseExampleAdapterTest {
}

View file

@ -27,11 +27,12 @@ import org.jboss.arquillian.graphene.page.Page;
import org.junit.Test; import org.junit.Test;
import org.openqa.selenium.By; import org.openqa.selenium.By;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import org.keycloak.testsuite.adapter.example.fuse.FuseAdminAdapterTest;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlDoesntStartWith; import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlDoesntStartWith;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith; import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;
@AppServerContainer("app-server-fuse70") @AppServerContainer("app-server-fuse70")
public class Fuse70AdminAdapterTest extends AbstractFuseAdminAdapterTest { public class Fuse70AdminAdapterTest extends FuseAdminAdapterTest {
@Page @Page
protected Hawtio2Page hawtioPage; protected Hawtio2Page hawtioPage;

View file

@ -17,9 +17,10 @@
package org.keycloak.testsuite.adapter.example; package org.keycloak.testsuite.adapter.example;
import org.keycloak.testsuite.adapter.example.fuse.FuseExampleAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer; import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
@AppServerContainer("app-server-fuse70") @AppServerContainer("app-server-fuse70")
public class Fuse70ExampleAdapterTest extends AbstractFuseExampleAdapterTest { public class Fuse70ExampleAdapterTest extends FuseExampleAdapterTest {
} }

View file

@ -47,41 +47,6 @@
</properties> </properties>
<profiles> <profiles>
<profile>
<id>adapter-test-karaf-submodules</id>
<activation>
<file>
<exists>src</exists>
</file>
</activation>
<!--
<build>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireProperty>
<property>auth.server</property>
<regex>(wildfly)|(eap)</regex>
<regexMessage>Karaf/Fuse adapter tests require activation of profile "auth-server-wildfly" or "auth-server-eap".</regexMessage>
</requireProperty>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
-->
</profile>
<profile> <profile>
<id>app-server-karaf3</id> <id>app-server-karaf3</id>
<modules> <modules>
@ -100,12 +65,6 @@
<module>fuse62</module> <module>fuse62</module>
</modules> </modules>
</profile> </profile>
<profile>
<id>app-server-fuse63</id>
<modules>
<module>fuse63</module>
</modules>
</profile>
<profile> <profile>
<id>app-server-fuse70</id> <id>app-server-fuse70</id>
<modules> <modules>

View file

@ -573,35 +573,6 @@
</plugins> </plugins>
</build> </build>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-karaf-managed</artifactId>
<version>${arquillian-container-karaf.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-osgi</artifactId>
<version>${arquillian-container-karaf.version}</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.enterprise</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<profiles> <profiles>
<profile> <profile>

View file

@ -46,5 +46,24 @@
<groupId>org.jboss.shrinkwrap.resolver</groupId> <groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-api-maven</artifactId> <artifactId>shrinkwrap-resolver-api-maven</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-karaf-managed</artifactId>
</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>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.enterprise</artifactId>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

View file

@ -1,4 +1,4 @@
package org.keycloak.testsuite.arquillian.karaf; package org.keycloak.testsuite.utils.arquillian.fuse;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -16,20 +16,19 @@ import org.jboss.arquillian.container.osgi.jmx.JMXDeployableContainer;
import org.jboss.arquillian.container.osgi.jmx.ObjectNameFactory; import org.jboss.arquillian.container.osgi.jmx.ObjectNameFactory;
import org.jboss.arquillian.container.osgi.karaf.managed.KarafManagedContainerConfiguration; import org.jboss.arquillian.container.osgi.karaf.managed.KarafManagedContainerConfiguration;
import org.jboss.arquillian.container.spi.client.container.LifecycleException; import org.jboss.arquillian.container.spi.client.container.LifecycleException;
import org.jboss.logging.Logger;
import org.osgi.jmx.framework.BundleStateMBean; import org.osgi.jmx.framework.BundleStateMBean;
import org.osgi.jmx.framework.FrameworkMBean; import org.osgi.jmx.framework.FrameworkMBean;
import org.osgi.jmx.framework.ServiceStateMBean; import org.osgi.jmx.framework.ServiceStateMBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* KarafManagedDeployableContainer * KarafManagedDeployableContainer
* *
* @author thomas.diesler@jboss.com * @author thomas.diesler@jboss.com
*/ */
public class CustomKarafContainer<T extends KarafManagedContainerConfiguration> extends JMXDeployableContainer<T> { public class CustomFuseContainer<T extends KarafManagedContainerConfiguration> extends JMXDeployableContainer<T> {
static final Logger _logger = LoggerFactory.getLogger(CustomKarafContainer.class.getPackage().getName()); private static final Logger log = Logger.getLogger(CustomFuseContainer.class);
private KarafManagedContainerConfiguration config; private KarafManagedContainerConfiguration config;
private Process process; private Process process;
@ -54,8 +53,7 @@ public class CustomKarafContainer<T extends KarafManagedContainerConfiguration>
MBeanServerConnection mbeanServer = null; MBeanServerConnection mbeanServer = null;
try { try {
mbeanServer = getMBeanServerConnection(500, TimeUnit.MILLISECONDS); mbeanServer = getMBeanServerConnection(500, TimeUnit.MILLISECONDS);
} catch (TimeoutException ex) { } catch (TimeoutException ignore) {
// ignore
} }
if (mbeanServer != null && !config.isAllowConnectingToRunningServer()) { if (mbeanServer != null && !config.isAllowConnectingToRunningServer()) {
@ -76,7 +74,7 @@ public class CustomKarafContainer<T extends KarafManagedContainerConfiguration>
throw new IllegalStateException("Not a valid Karaf home dir: " + karafHomeDir); throw new IllegalStateException("Not a valid Karaf home dir: " + karafHomeDir);
String java = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"; String java = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";
_logger.info(String.format("Using java: %s", java)); log.infof("Using java: %s", java);
List<String> cmd = new ArrayList<>(); List<String> cmd = new ArrayList<>();
cmd.add(java); cmd.add(java);
@ -107,7 +105,7 @@ public class CustomKarafContainer<T extends KarafManagedContainerConfiguration>
StringBuilder classPath = new StringBuilder(); StringBuilder classPath = new StringBuilder();
boolean fuse7 = new File(karafHomeDir, "lib/boot/").exists(); boolean fuse7 = new File(karafHomeDir, "lib/boot/").exists();
if (fuse7) { if (fuse7) {
_logger.info("Adding karaf4 libraries to classpath."); log.info("Adding karaf4 libraries to classpath.");
File karafLibBootDir = new File(karafHomeDir, "lib/boot/"); File karafLibBootDir = new File(karafHomeDir, "lib/boot/");
String[] libs = karafLibBootDir.list((File dir, String name) -> name.endsWith(".jar")); String[] libs = karafLibBootDir.list((File dir, String name) -> name.endsWith(".jar"));
for (String lib : libs) { for (String lib : libs) {
@ -115,7 +113,7 @@ public class CustomKarafContainer<T extends KarafManagedContainerConfiguration>
classPath.append(separator).append(new File(karafLibBootDir, lib)); classPath.append(separator).append(new File(karafLibBootDir, lib));
} }
} else { //fuse6 } else { //fuse6
_logger.info("Adding karaf3 libraries to classpath."); log.info("Adding karaf3 libraries to classpath.");
File karafLibDir = new File(karafHomeDir, "lib"); File karafLibDir = new File(karafHomeDir, "lib");
String[] libs = karafLibDir.list((File dir, String name) -> name.startsWith("karaf")); String[] libs = karafLibDir.list((File dir, String name) -> name.startsWith("karaf"));
for (String lib : libs) { for (String lib : libs) {
@ -134,7 +132,7 @@ public class CustomKarafContainer<T extends KarafManagedContainerConfiguration>
for (String tok : cmd) { for (String tok : cmd) {
cmdstr.append(tok).append(" "); cmdstr.append(tok).append(" ");
} }
_logger.debug("Starting Karaf with: {}", cmdstr); log.debugv("Starting Karaf with: {0}", cmdstr);
try { try {
ProcessBuilder processBuilder = new ProcessBuilder(cmd); ProcessBuilder processBuilder = new ProcessBuilder(cmd);
@ -142,14 +140,15 @@ public class CustomKarafContainer<T extends KarafManagedContainerConfiguration>
processBuilder.redirectErrorStream(true); processBuilder.redirectErrorStream(true);
process = processBuilder.start(); process = processBuilder.start();
new Thread(new ConsoleConsumer()).start(); new Thread(new ConsoleConsumer()).start();
} catch (Exception ex) { } catch (IOException ex) {
throw new LifecycleException("Cannot start managed Karaf container", ex); throw new LifecycleException("Cannot start managed Karaf container", ex);
} }
// Get the MBeanServerConnection // Get the MBeanServerConnection
try { try {
mbeanServer = getMBeanServerConnection(60, TimeUnit.SECONDS); log.debug("Geting the MBeanServerConnection");
} catch (Exception ex) { mbeanServer = getMBeanServerConnection(120, TimeUnit.SECONDS);
} catch (TimeoutException ex) {
destroyKarafProcess(); destroyKarafProcess();
throw new LifecycleException("Cannot obtain MBean server connection", ex); throw new LifecycleException("Cannot obtain MBean server connection", ex);
} }
@ -187,7 +186,7 @@ public class CustomKarafContainer<T extends KarafManagedContainerConfiguration>
} catch (RuntimeException rte) { } catch (RuntimeException rte) {
destroyKarafProcess(); destroyKarafProcess();
throw rte; throw rte;
} catch (Exception ex) { } catch (IOException | InterruptedException | TimeoutException | LifecycleException ex) {
destroyKarafProcess(); destroyKarafProcess();
throw new LifecycleException("Cannot start Karaf container", ex); throw new LifecycleException("Cannot start Karaf container", ex);
} }

View file

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.keycloak.testsuite.arquillian; package org.keycloak.testsuite.utils.arquillian.fuse;
import org.jboss.arquillian.container.osgi.OSGiApplicationArchiveProcessor; import org.jboss.arquillian.container.osgi.OSGiApplicationArchiveProcessor;
import org.jboss.arquillian.test.spi.TestClass; import org.jboss.arquillian.test.spi.TestClass;