Merge pull request #1806 from tkyjovsk/karaf-fuse-update

Karaf fuse update
This commit is contained in:
Stian Thorgersen 2015-11-10 15:28:36 +01:00
commit e1a07bd5a8
11 changed files with 149 additions and 96 deletions

View file

@ -12,9 +12,6 @@
<name>Adapter Tests on Karaf</name>
<properties>
<karaf.version>3.0.3</karaf.version>
<karaf.home>${containers.home}/apache-karaf-minimal-${karaf.version}</karaf.home>
<!--<karaf.home>${project.build.directory}/assembly</karaf.home>-->
<!--fuse examples expect auth server on 8080-->
<auth.server.port.offset>0</auth.server.port.offset>
@ -27,13 +24,6 @@
<dependencies>
<dependency>
<groupId>org.apache.karaf</groupId>
<artifactId>apache-karaf-minimal</artifactId>
<version>${karaf.version}</version>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-karaf-managed</artifactId>
@ -46,37 +36,97 @@
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>2.12</version>
</dependency>
<dependency>
<groupId>org.apache.sshd</groupId>
<artifactId>sshd-core</artifactId>
<version>0.12.0</version>
</dependency>
<dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.console</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>org.apache.karaf</groupId>
<artifactId>org.apache.karaf.client</artifactId>
<version>3.0.3</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>fuse</id>
<activation>
<property>
<name>fuse.home</name>
</property>
</activation>
<properties>
<karaf.home>${fuse.home}</karaf.home>
<arquillian.xml.stylesheet>src/main/xslt/arquillian-fuse.xsl</arquillian.xml.stylesheet>
</properties>
</profile>
<profile>
<id>karaf</id>
<activation>
<property>
<name>!fuse.home</name>
</property>
</activation>
<properties>
<karaf.version>3.0.3</karaf.version>
<karaf.home>${containers.home}/apache-karaf-minimal-${karaf.version}</karaf.home>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.karaf</groupId>
<artifactId>apache-karaf-minimal</artifactId>
<version>${karaf.version}</version>
<type>zip</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-karaf</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.apache.karaf</groupId>
<artifactId>apache-karaf-minimal</artifactId>
<version>${karaf.version}</version>
<type>zip</type>
<outputDirectory>${containers.home}</outputDirectory>
</artifactItem>
</artifactItems>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-karaf</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.apache.karaf</groupId>
<artifactId>apache-karaf-minimal</artifactId>
<version>${karaf.version}</version>
<type>zip</type>
<outputDirectory>${containers.home}</outputDirectory>
</artifactItem>
</artifactItems>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>

View file

@ -27,7 +27,7 @@ public class CustomKarafContainer extends KarafManagedDeployableContainer<Custom
@Override
public void start() throws LifecycleException {
super.start();
executePostStartCommands();
executeAfterStartCommands();
}
@Override
@ -41,7 +41,7 @@ public class CustomKarafContainer extends KarafManagedDeployableContainer<Custom
return CustomKarafContainerConfiguration.class;
}
protected void executePostStartCommands() throws LifecycleException {
protected void executeAfterStartCommands() throws LifecycleException {
try {
mbeanServer = getMBeanServerConnection(500, TimeUnit.MILLISECONDS);
} catch (TimeoutException ex) {
@ -69,23 +69,32 @@ public class CustomKarafContainer extends KarafManagedDeployableContainer<Custom
String cmd = command.trim().split(" ")[0].trim();
String param = command.trim().split(" ")[1].trim();
log.info(String.format("command: %s, param: %s", cmd, param));
if (cmd.equals("feature:repo-add") || cmd.equals("features:addurl")) {
featureMBean.addRepository(param);
} else if (cmd.equals("feature:repo-remove") || cmd.equals("features:removeurl")) {
featureMBean.removeRepository(param);
} else if (cmd.equals("feature:install") || cmd.equals("features:install")) {
featureMBean.installFeature(param);
} else if (cmd.equals("feature:uninstall") || cmd.equals("features:uninstall")) {
featureMBean.uninstallFeature(param);
} else {
throw new RuntimeException(String.format("Unsupported command: '%s'. "
+ "Supported commands on Karaf: 'feature:repo-add', 'feature:install'\n"
+ "Supported commands on Fuse: 'features:addurl', 'features:install'", cmd));
switch (cmd) {
case "feature:repo-add":
case "features:addurl":
featureMBean.addRepository(param);
break;
case "feature:repo-remove":
case "features:removeurl":
featureMBean.removeRepository(param);
break;
case "feature:install":
case "features:install":
featureMBean.installFeature(param);
break;
case "feature:uninstall":
case "features:uninstall":
featureMBean.uninstallFeature(param);
break;
default:
throw new RuntimeException(String.format("Unsupported command: '%s'. "
+ "Supported after-start commands for Karaf: 'feature:repo-add', 'feature:install', 'feature:repo-remove', 'feature:uninstall'\n"
+ "Supported after-start commands for Fuse: 'features:addurl', 'features:install', 'features:removeurl', 'features:uninstall'", cmd));
}
}
} catch (IOException | RuntimeException | TimeoutException ex) {
stop();
throw new LifecycleException("Error when executing karaf post-start commands.", ex);
throw new LifecycleException("Error when executing karaf after-start commands.", ex);
}
}

View file

@ -0,0 +1,17 @@
package org.keycloak.testsuite.arquillian.karaf;
import org.jboss.arquillian.container.spi.client.container.DeployableContainer;
import org.jboss.arquillian.core.spi.LoadableExtension;
/**
*
* @author tkyjovsk
*/
public class CustomKarafContainerExtension implements LoadableExtension {
@Override
public void register(ExtensionBuilder builder) {
builder.service(DeployableContainer.class, CustomKarafContainer.class);
}
}

View file

@ -0,0 +1 @@
org.keycloak.testsuite.arquillian.karaf.CustomKarafContainerExtension

View file

@ -4,6 +4,8 @@
version="2.0"
exclude-result-prefixes="xalan a">
<xsl:param name="keycloak.version" />
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:strip-space elements="*"/>
@ -23,8 +25,8 @@
<property name="jmxPassword">admin</property>
<property name="commandsAfterStart">
features:addurl mvn:org.keycloak/keycloak-osgi-features/1.7.0.Final-SNAPSHOT/xml/features,
features:addurl mvn:org.keycloak.example.demo/keycloak-fuse-example-features/1.7.0.Final-SNAPSHOT/xml/features,
features:addurl mvn:org.keycloak/keycloak-osgi-features/<xsl:value-of select="$keycloak.version"/>/xml/features,
features:addurl mvn:org.keycloak.example.demo/keycloak-fuse-example-features/<xsl:value-of select="$keycloak.version"/>/xml/features,
features:install keycloak-fuse-example
</property>

View file

@ -4,6 +4,8 @@
version="2.0"
exclude-result-prefixes="xalan a">
<xsl:param name="keycloak.version" />
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:strip-space elements="*"/>
@ -27,8 +29,8 @@
<property name="commandsAfterStart">
feature:repo-add mvn:org.apache.camel.karaf/apache-camel/2.15.1/xml/features,
feature:repo-add mvn:org.apache.cxf.karaf/apache-cxf/3.0.4/xml/features,
feature:repo-add mvn:org.keycloak/keycloak-osgi-features/1.7.0.Final-SNAPSHOT/xml/features,
feature:repo-add mvn:org.keycloak.example.demo/keycloak-fuse-example-features/1.7.0.Final-SNAPSHOT/xml/features,
feature:repo-add mvn:org.keycloak/keycloak-osgi-features/<xsl:value-of select="$keycloak.version"/>/xml/features,
feature:repo-add mvn:org.keycloak.example.demo/keycloak-fuse-example-features/<xsl:value-of select="$keycloak.version"/>/xml/features,
feature:install keycloak-fuse-example
</property>

View file

@ -19,6 +19,8 @@
<app.server.management.port.jmx>10199</app.server.management.port.jmx>
<adapter.test.props>-Dapp.server.base.url=http://localhost:${app.server.http.port} -Dmy.host.name=localhost</adapter.test.props>
<exclude.adapters>-</exclude.adapters>
<arquillian.xml.stylesheet>src/main/xslt/arquillian.xsl</arquillian.xml.stylesheet>
</properties>
<build>
@ -66,7 +68,13 @@
<includes>
<include>arquillian.xml</include>
</includes>
<stylesheet>src/main/xslt/arquillian.xsl</stylesheet>
<stylesheet>${arquillian.xml.stylesheet}</stylesheet>
<parameters>
<parameter>
<name>keycloak.version</name>
<value>${project.version}</value>
</parameter>
</parameters>
<outputDir>${project.build.directory}/dependency</outputDir>
</transformationSet>
</transformationSets>

View file

@ -16,14 +16,6 @@
<exclude.account>-</exclude.account>
</properties>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-karaf-managed</artifactId>
<version>2.1.0.CR18</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>

View file

@ -9,7 +9,6 @@ import org.jboss.arquillian.core.spi.LoadableExtension;
import org.jboss.arquillian.graphene.location.CustomizableURLResourceProvider;
import org.jboss.arquillian.test.spi.enricher.resource.ResourceProvider;
import org.jboss.arquillian.test.spi.execution.TestExecutionDecider;
import org.keycloak.testsuite.arquillian.karaf.CustomKarafContainer;
import org.keycloak.testsuite.arquillian.migration.MigrationTestExecutionDecider;
import org.keycloak.testsuite.arquillian.undertow.CustomUndertowContainer;
@ -34,8 +33,7 @@ public class KeycloakArquillianExtension implements LoadableExtension {
.observer(ContainersTestEnricher.class);
builder
.service(DeployableContainer.class, CustomUndertowContainer.class)
.service(DeployableContainer.class, CustomKarafContainer.class);
.service(DeployableContainer.class, CustomUndertowContainer.class);
builder
.service(TestExecutionDecider.class, MigrationTestExecutionDecider.class);

View file

@ -340,32 +340,6 @@
<artifactId>infinispan-core</artifactId>
</dependency>
<dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>2.12</version>
</dependency>
<dependency>
<groupId>org.apache.sshd</groupId>
<artifactId>sshd-core</artifactId>
<version>0.12.0</version>
</dependency>
<dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.console</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>org.apache.karaf</groupId>
<artifactId>org.apache.karaf.client</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>org.apache.aries.jmx</groupId>
<artifactId>org.apache.aries.jmx</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
<build>
<plugins>