CAMEL-6132 - Initial version of the camel-test-karaf module
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/dec1c091 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/dec1c091 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/dec1c091 Branch: refs/heads/master Commit: dec1c09112b8fbc3ba2db0dca2f4e32e82401f05 Parents: 2c153ed Author: Quinn Stevenson <qu...@pronoia-solutions.com> Authored: Wed Mar 30 14:27:59 2016 -0600 Committer: Claus Ibsen <davscl...@apache.org> Committed: Sat Apr 2 16:38:11 2016 +0200 ---------------------------------------------------------------------- components/camel-test-karaf/pom.xml | 241 +++++++++++ .../camel/test/karaf/AbstractFeatureTest.java | 333 +++++++++++++++ .../camel/test/karaf/CamelKarafTestSupport.java | 404 +++++++++++++++++++ components/pom.xml | 1 + tests/camel-itest-karaf/pom.xml | 6 + .../camel/itest/karaf/AbstractFeatureTest.java | 317 --------------- .../apache/camel/itest/karaf/CamelAhcTest.java | 1 + .../camel/itest/karaf/CamelAhcWsTest.java | 1 + .../apache/camel/itest/karaf/CamelAmqpTest.java | 1 + .../apache/camel/itest/karaf/CamelApnsTest.java | 1 + .../karaf/CamelAtmosphereWebsocketTest.java | 1 + .../apache/camel/itest/karaf/CamelAtomTest.java | 1 + .../apache/camel/itest/karaf/CamelAvroTest.java | 1 + .../apache/camel/itest/karaf/CamelAwsTest.java | 1 + .../apache/camel/itest/karaf/CamelBamTest.java | 1 + .../camel/itest/karaf/CamelBarcodeTest.java | 1 + .../camel/itest/karaf/CamelBase64Test.java | 1 + .../itest/karaf/CamelBeanValidatorTest.java | 1 + .../camel/itest/karaf/CamelBeanioTest.java | 1 + .../camel/itest/karaf/CamelBeanstalkTest.java | 1 + .../camel/itest/karaf/CamelBindyTest.java | 1 + .../apache/camel/itest/karaf/CamelBoonTest.java | 1 + .../apache/camel/itest/karaf/CamelBoxTest.java | 1 + .../camel/itest/karaf/CamelBraintreeTest.java | 1 + .../camel/itest/karaf/CamelCacheTest.java | 1 + .../camel/itest/karaf/CamelCassandraqlTest.java | 1 + .../camel/itest/karaf/CamelCastorTest.java | 1 + .../camel/itest/karaf/CamelChunkTest.java | 1 + .../camel/itest/karaf/CamelCmSmsTest.java | 1 + .../apache/camel/itest/karaf/CamelCmisTest.java | 1 + .../camel/itest/karaf/CamelCometdTest.java | 1 + .../camel/itest/karaf/CamelContextTest.java | 1 + .../camel/itest/karaf/CamelCouchDBTest.java | 1 + .../camel/itest/karaf/CamelCryptoTest.java | 1 + .../apache/camel/itest/karaf/CamelCsvTest.java | 1 + .../apache/camel/itest/karaf/CamelCxfTest.java | 1 + .../camel/itest/karaf/CamelDisruptorTest.java | 1 + .../apache/camel/itest/karaf/CamelDnsTest.java | 1 + .../camel/itest/karaf/CamelDockerTest.java | 1 + .../camel/itest/karaf/CamelDozerTest.java | 1 + .../camel/itest/karaf/CamelDropboxTest.java | 1 + .../itest/karaf/CamelElasticsearchTest.java | 1 + .../camel/itest/karaf/CamelElsqlTest.java | 1 + .../apache/camel/itest/karaf/CamelEtcdTest.java | 1 + .../camel/itest/karaf/CamelEventadminTest.java | 1 + .../apache/camel/itest/karaf/CamelExecTest.java | 1 + .../camel/itest/karaf/CamelFacebookTest.java | 1 + .../camel/itest/karaf/CamelFlatpackTest.java | 1 + .../apache/camel/itest/karaf/CamelFopTest.java | 1 + .../camel/itest/karaf/CamelFreemarkerTest.java | 1 + .../apache/camel/itest/karaf/CamelFtpTest.java | 1 + .../camel/itest/karaf/CamelGangliaTest.java | 1 + .../camel/itest/karaf/CamelGeocoderTest.java | 1 + .../apache/camel/itest/karaf/CamelGitTest.java | 1 + .../camel/itest/karaf/CamelGithubTest.java | 1 + .../itest/karaf/CamelGoogleCalendarTest.java | 1 + .../camel/itest/karaf/CamelGoogleDriveTest.java | 1 + .../camel/itest/karaf/CamelGoogleMailTest.java | 1 + .../camel/itest/karaf/CamelGroovyTest.java | 1 + .../apache/camel/itest/karaf/CamelGsonTest.java | 1 + .../itest/karaf/CamelGuavaEventBusTest.java | 1 + .../camel/itest/karaf/CamelGuiceTest.java | 1 + .../camel/itest/karaf/CamelHazelcastTest.java | 1 + .../camel/itest/karaf/CamelHbaseTest.java | 1 + .../camel/itest/karaf/CamelHdfs2Test.java | 1 + .../apache/camel/itest/karaf/CamelHdfsTest.java | 1 + .../camel/itest/karaf/CamelHessianTest.java | 1 + .../camel/itest/karaf/CamelHipchatTest.java | 1 + .../apache/camel/itest/karaf/CamelHl7Test.java | 1 + .../camel/itest/karaf/CamelHttp4Test.java | 1 + .../apache/camel/itest/karaf/CamelHttpTest.java | 1 + .../camel/itest/karaf/CamelHystrixTest.java | 1 + .../camel/itest/karaf/CamelIbatisTest.java | 1 + .../apache/camel/itest/karaf/CamelIcalTest.java | 1 + .../camel/itest/karaf/CamelIgniteTest.java | 1 + .../camel/itest/karaf/CamelInfinispanTest.java | 1 + .../apache/camel/itest/karaf/CamelIrcTest.java | 1 + .../camel/itest/karaf/CamelJCacheTest.java | 1 + .../camel/itest/karaf/CamelJacksonTest.java | 1 + .../camel/itest/karaf/CamelJacksonxmlTest.java | 1 + .../camel/itest/karaf/CamelJasyptTest.java | 1 + .../apache/camel/itest/karaf/CamelJaxbTest.java | 1 + .../apache/camel/itest/karaf/CamelJbpmTest.java | 1 + .../camel/itest/karaf/CamelJcloudsTest.java | 1 + .../apache/camel/itest/karaf/CamelJcrTest.java | 1 + .../apache/camel/itest/karaf/CamelJdbcTest.java | 1 + .../camel/itest/karaf/CamelJettyTest.java | 1 + .../camel/itest/karaf/CamelJgroupsTest.java | 1 + .../apache/camel/itest/karaf/CamelJibxTest.java | 1 + .../apache/camel/itest/karaf/CamelJingTest.java | 1 + .../apache/camel/itest/karaf/CamelJmsTest.java | 1 + .../apache/camel/itest/karaf/CamelJmxTest.java | 1 + .../apache/camel/itest/karaf/CamelJoltTest.java | 1 + .../camel/itest/karaf/CamelJosqlTest.java | 1 + .../apache/camel/itest/karaf/CamelJpaTest.java | 1 + .../camel/itest/karaf/CamelJsonpathTest.java | 1 + .../camel/itest/karaf/CamelJt400Test.java | 1 + .../apache/camel/itest/karaf/CamelJuelTest.java | 1 + .../camel/itest/karaf/CamelJxpathTest.java | 1 + .../camel/itest/karaf/CamelKafkaTest.java | 1 + .../camel/itest/karaf/CamelKratiTest.java | 1 + .../camel/itest/karaf/CamelKubernetesTest.java | 1 + .../apache/camel/itest/karaf/CamelLdapTest.java | 1 + .../camel/itest/karaf/CamelLinkedinTest.java | 1 + .../camel/itest/karaf/CamelLuceneTest.java | 1 + .../apache/camel/itest/karaf/CamelLzfTest.java | 1 + .../apache/camel/itest/karaf/CamelMailTest.java | 1 + .../camel/itest/karaf/CamelMetricsTest.java | 1 + .../camel/itest/karaf/CamelMina2Test.java | 1 + .../apache/camel/itest/karaf/CamelMinaTest.java | 1 + .../apache/camel/itest/karaf/CamelMllpTest.java | 1 + .../camel/itest/karaf/CamelMongodbTest.java | 1 + .../apache/camel/itest/karaf/CamelMqttTest.java | 1 + .../apache/camel/itest/karaf/CamelMsvTest.java | 1 + .../camel/itest/karaf/CamelMustacheTest.java | 1 + .../apache/camel/itest/karaf/CamelMvelTest.java | 1 + .../camel/itest/karaf/CamelMyBatisTest.java | 1 + .../apache/camel/itest/karaf/CamelNatsTest.java | 1 + .../camel/itest/karaf/CamelNetty4HttpTest.java | 1 + .../camel/itest/karaf/CamelNetty4Test.java | 1 + .../camel/itest/karaf/CamelNettyHttpTest.java | 1 + .../camel/itest/karaf/CamelNettyTest.java | 1 + .../apache/camel/itest/karaf/CamelOgnlTest.java | 1 + .../camel/itest/karaf/CamelOlingo2Test.java | 1 + .../camel/itest/karaf/CamelOpenshiftTest.java | 1 + .../camel/itest/karaf/CamelOptaplannerTest.java | 1 + .../apache/camel/itest/karaf/CamelPahoTest.java | 1 + .../camel/itest/karaf/CamelPaxloggingTest.java | 1 + .../apache/camel/itest/karaf/CamelPdfTest.java | 1 + .../camel/itest/karaf/CamelPgeventTest.java | 1 + .../camel/itest/karaf/CamelPrinterTest.java | 1 + .../camel/itest/karaf/CamelProtobufTest.java | 1 + .../camel/itest/karaf/CamelQuartz2Test.java | 1 + .../camel/itest/karaf/CamelQuartzTest.java | 1 + .../camel/itest/karaf/CamelQuickFixTest.java | 1 + .../camel/itest/karaf/CamelRabbitmqTest.java | 1 + .../camel/itest/karaf/CamelRestletTest.java | 1 + .../apache/camel/itest/karaf/CamelRmiTest.java | 1 + .../camel/itest/karaf/CamelRouteboxTest.java | 1 + .../apache/camel/itest/karaf/CamelRssTest.java | 1 + .../apache/camel/itest/karaf/CamelRxTest.java | 1 + .../camel/itest/karaf/CamelSalesforceTest.java | 1 + .../itest/karaf/CamelSapNetweaverTest.java | 1 + .../camel/itest/karaf/CamelSaxonTest.java | 1 + .../camel/itest/karaf/CamelScalaTest.java | 1 + .../camel/itest/karaf/CamelSchematronTest.java | 1 + .../camel/itest/karaf/CamelScriptTest.java | 1 + .../camel/itest/karaf/CamelServicenowTest.java | 1 + .../camel/itest/karaf/CamelServletTest.java | 1 + .../apache/camel/itest/karaf/CamelSipTest.java | 1 + .../apache/camel/itest/karaf/CamelSjmsTest.java | 1 + .../camel/itest/karaf/CamelSlackTest.java | 1 + .../apache/camel/itest/karaf/CamelSmppTest.java | 1 + .../camel/itest/karaf/CamelSnakeyamlTest.java | 1 + .../apache/camel/itest/karaf/CamelSnmpTest.java | 1 + .../apache/camel/itest/karaf/CamelSoapTest.java | 1 + .../apache/camel/itest/karaf/CamelSolrTest.java | 1 + .../camel/itest/karaf/CamelSplunkTest.java | 1 + .../camel/itest/karaf/CamelSpringBatchTest.java | 1 + .../itest/karaf/CamelSpringJavaconfigTest.java | 1 + .../camel/itest/karaf/CamelSpringLdapTest.java | 1 + .../camel/itest/karaf/CamelSpringRedisTest.java | 1 + .../itest/karaf/CamelSpringWebServiceTest.java | 1 + .../apache/camel/itest/karaf/CamelSqlTest.java | 1 + .../apache/camel/itest/karaf/CamelSshTest.java | 1 + .../apache/camel/itest/karaf/CamelStAXTest.java | 1 + .../camel/itest/karaf/CamelStompTest.java | 1 + .../camel/itest/karaf/CamelStreamTest.java | 1 + .../itest/karaf/CamelStringTemplateTest.java | 1 + .../camel/itest/karaf/CamelSwaggerJavaTest.java | 1 + .../camel/itest/karaf/CamelSwaggerTest.java | 1 + .../camel/itest/karaf/CamelSyslogTest.java | 1 + .../camel/itest/karaf/CamelTagsoupTest.java | 1 + .../camel/itest/karaf/CamelTarfileTest.java | 1 + .../camel/itest/karaf/CamelTestSpringTest.java | 1 + .../apache/camel/itest/karaf/CamelTestTest.java | 1 + .../camel/itest/karaf/CamelTwitterTest.java | 1 + .../camel/itest/karaf/CamelUndertowTest.java | 1 + .../itest/karaf/CamelUnivocityParsersTest.java | 1 + .../camel/itest/karaf/CamelUrlrewriteTest.java | 1 + .../camel/itest/karaf/CamelVelocityTest.java | 1 + .../camel/itest/karaf/CamelVertxTest.java | 1 + .../camel/itest/karaf/CamelWeatherTest.java | 1 + .../camel/itest/karaf/CamelWebsocketTest.java | 1 + .../camel/itest/karaf/CamelXmlbeansTest.java | 1 + .../camel/itest/karaf/CamelXmljsonTest.java | 1 + .../camel/itest/karaf/CamelXmlrpcTest.java | 1 + .../camel/itest/karaf/CamelXmlsecurityTest.java | 1 + .../apache/camel/itest/karaf/CamelXmppTest.java | 1 + .../camel/itest/karaf/CamelXstreamTest.java | 1 + .../apache/camel/itest/karaf/CamelYamlTest.java | 1 + .../camel/itest/karaf/CamelYammerTest.java | 1 + .../camel/itest/karaf/CamelZipfileTest.java | 1 + .../camel/itest/karaf/CamelZipkinTest.java | 1 + .../camel/itest/karaf/CamelZookeeperTest.java | 1 + 195 files changed, 1174 insertions(+), 317 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/components/camel-test-karaf/pom.xml ---------------------------------------------------------------------- diff --git a/components/camel-test-karaf/pom.xml b/components/camel-test-karaf/pom.xml new file mode 100644 index 0000000..8497df5 --- /dev/null +++ b/components/camel-test-karaf/pom.xml @@ -0,0 +1,241 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You 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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.camel</groupId> + <artifactId>components</artifactId> + <version>2.18-SNAPSHOT</version> + </parent> + + <artifactId>camel-test-karaf</artifactId> + <name>Camel :: Test :: Karaf</name> + <packaging>bundle</packaging> + <description>Camel Testing Library using Pax Exam, Karaf and JUnit</description> + + <properties> + <karf-test-version>${karaf4-version}</karf-test-version> + <depends-maven-plugin-version>1.3.1</depends-maven-plugin-version> + <camel.osgi.export.pkg>org.apache.camel.test.karaf</camel.osgi.export.pkg> + </properties> + + <dependencies> + <dependency> + <groupId>org.ops4j.pax.exam</groupId> + <artifactId>pax-exam-junit4</artifactId> + </dependency> + <dependency> + <groupId>org.ops4j.pax.exam</groupId> + <artifactId>pax-exam</artifactId> + </dependency> + <dependency> + <groupId>org.ops4j.pax.exam</groupId> + <artifactId>pax-exam-container-karaf</artifactId> + </dependency> + <dependency> + <groupId>org.ops4j.pax.exam</groupId> + <artifactId>pax-exam-link-mvn</artifactId> + </dependency> + <dependency> + <groupId>javax.inject</groupId> + <artifactId>javax.inject</artifactId> + <version>1</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.karaf.features</groupId> + <artifactId>org.apache.karaf.features.core</artifactId> + <version>${karaf-version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.karaf</groupId> + <artifactId>apache-karaf</artifactId> + <version>${karf-test-version}</version> + <type>tar.gz</type> + </dependency> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.configadmin</artifactId> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.core</artifactId> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.compendium</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.karaf</groupId> + <artifactId>apache-camel</artifactId> + <version>${project.version}</version> + <type>pom</type> + </dependency> + + <!-- test and logging --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <pluginManagement> + <plugins> + <!-- Eclipse m2e Lifecycle Management --> + <plugin> + <groupId>org.eclipse.m2e</groupId> + <artifactId>lifecycle-mapping</artifactId> + <version>${lifecycle-mapping-version}</version> + <configuration> + <lifecycleMappingMetadata> + <pluginExecutions> + <pluginExecution> + <pluginExecutionFilter> + <groupId>org.apache.servicemix.tooling</groupId> + <artifactId>depends-maven-plugin</artifactId> + <versionRange>${depends-maven-plugin-version}</versionRange> + <goals> + <goal>generate-depends-file</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore/> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + </plugins> + </pluginManagement> + <plugins> + <!-- generate dependencies versions --> + <plugin> + <groupId>org.apache.servicemix.tooling</groupId> + <artifactId>depends-maven-plugin</artifactId> + <executions> + <execution> + <id>generate-depends-file</id> + <goals> + <goal>generate-depends-file</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <!-- version 2.19.1 causes pax-exam to fail when testing the 2nd/3rd container when testing all --> + <!-- so we use an older version of surefire which works --> + <version>2.18.1</version> + <configuration> + <!-- do not re-run these tests --> + <!-- not supported by older version of surefire --> + <!--<rerunFailingTestsCount>0</rerunFailingTestsCount>--> + <systemPropertyVariables> + <karafVersion>${karaf-version}</karafVersion> + </systemPropertyVariables> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> + <!-- Export-Package>org.apache.camel.test.karaf</Export-Package -->> + <DynamicImport-Package>*</DynamicImport-Package> + <Import-Package/> + <_removeheaders>Import-Package, Private-Package, Include-Resource, Karaf-Info, Require-Capability</_removeheaders> + </instructions> + </configuration> + </plugin> + + </plugins> + </build> + + <profiles> + <profile> + <id>ci-build-profile</id> + <activation> + <property> + <name>maven.repo.local</name> + </property> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <!-- version 2.19.1 causes pax-exam to fail when testing the 2nd/3rd container when testing all --> + <!-- so we use an older version of surefire which works --> + <version>2.18.1</version> + <configuration> + <forkedProcessTimeoutInSeconds>300</forkedProcessTimeoutInSeconds> + <!-- + when the local repo location has been specified, we need to pass + on this information to PAX mvn url + --> + <argLine>-Dorg.ops4j.pax.url.mvn.localRepository=${maven.repo.local}</argLine> + <systemPropertyVariables> + <karafVersion>${karaf-version}</karafVersion> + </systemPropertyVariables> + </configuration> + </plugin> + </plugins> + </build> + </profile> + + <!-- test with older karaf 3.x --> + <profile> + <id>karaf3</id> + <properties> + <karf-test-version>${karaf3-version}</karf-test-version> + </properties> + </profile> + + </profiles> + +</project> http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/components/camel-test-karaf/src/main/java/org/apache/camel/test/karaf/AbstractFeatureTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-karaf/src/main/java/org/apache/camel/test/karaf/AbstractFeatureTest.java b/components/camel-test-karaf/src/main/java/org/apache/camel/test/karaf/AbstractFeatureTest.java new file mode 100644 index 0000000..a893799 --- /dev/null +++ b/components/camel-test-karaf/src/main/java/org/apache/camel/test/karaf/AbstractFeatureTest.java @@ -0,0 +1,333 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.apache.camel.test.karaf; + +import java.io.File; +import java.io.InputStream; +import java.lang.reflect.Field; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Dictionary; +import java.util.EnumSet; +import java.util.Enumeration; +import java.util.Properties; +import javax.inject.Inject; + +import org.apache.camel.CamelContext; +import org.apache.camel.Component; +import org.apache.camel.spi.DataFormat; +import org.apache.camel.spi.Language; +import org.apache.camel.test.AvailablePortFinder; +import org.apache.karaf.features.FeaturesService; +import org.junit.After; +import org.junit.Before; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.CoreOptions; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.ProbeBuilder; +import org.ops4j.pax.exam.TestProbeBuilder; +import org.ops4j.pax.exam.karaf.options.KarafDistributionOption; +import org.ops4j.pax.exam.karaf.options.LogLevelOption; +import org.ops4j.pax.exam.options.UrlReference; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.Filter; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; +import org.osgi.service.blueprint.container.BlueprintContainer; +import org.osgi.util.tracker.ServiceTracker; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static org.junit.Assert.assertNotNull; +import static org.ops4j.pax.exam.CoreOptions.maven; +import static org.ops4j.pax.exam.CoreOptions.mavenBundle; +import static org.ops4j.pax.exam.CoreOptions.vmOption; +import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole; +import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut; +import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder; + +public abstract class AbstractFeatureTest { + + protected static final Logger LOG = LoggerFactory.getLogger(AbstractFeatureTest.class); + + @Inject + protected BundleContext bundleContext; + + @Inject + protected BlueprintContainer blueprintContainer; + + @Inject + protected FeaturesService featuresService; + + @ProbeBuilder + public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) { + // makes sure the generated Test-Bundle contains this import! + probe.setHeader(Constants.DYNAMICIMPORT_PACKAGE, "*"); + return probe; + } + + @Before + public void setUp() throws Exception { + LOG.info("setUp() using BundleContext: {}", bundleContext); + } + + @After + public void tearDown() throws Exception { + LOG.info("tearDown()"); + } + + protected void installCamelFeature(String mainFeature) throws Exception { + if (!mainFeature.startsWith("camel-")) { + mainFeature = "camel-" + mainFeature; + } + LOG.info("Install main feature: {}", mainFeature); + // do not refresh bundles causing out bundle context to be invalid + // TODO: see if we can find a way maybe to install camel.xml as bundle/feature instead of part of unit test (see src/test/resources/OSGI-INF/blueprint) + featuresService.installFeature(mainFeature, EnumSet.of(FeaturesService.Option.NoAutoRefreshBundles)); + } + + protected void testComponent(String component) throws Exception { + testComponent("camel-" + component, component); + } + + protected void testComponent(String mainFeature, String component) throws Exception { + LOG.info("Looking up CamelContext(myCamel) in OSGi Service Registry"); + + installCamelFeature(mainFeature); + + CamelContext camelContext = getOsgiService(bundleContext, CamelContext.class, "(camel.context.name=myCamel)", 20000); + assertNotNull("Cannot find CamelContext with name myCamel", camelContext); + + LOG.info("Getting Camel component: {}", component); + // do not auto start the component as it may not have been configured properly and fail in its start method + Component comp = camelContext.getComponent(component, true, false); + assertNotNull("Cannot get component with name: " + component, comp); + + LOG.info("Found Camel component: {} instance: {} with className: {}", component, comp, comp.getClass()); + } + + protected void testDataFormat(String dataFormat) throws Exception { + testDataFormat("camel-" + dataFormat, dataFormat); + } + + protected void testDataFormat(String mainFeature, String dataFormat) throws Exception { + LOG.info("Looking up CamelContext(myCamel) in OSGi Service Registry"); + + installCamelFeature(mainFeature); + + CamelContext camelContext = getOsgiService(bundleContext, CamelContext.class, "(camel.context.name=myCamel)", 20000); + assertNotNull("Cannot find CamelContext with name myCamel", camelContext); + + LOG.info("Getting Camel dataformat: {}", dataFormat); + DataFormat df = camelContext.resolveDataFormat(dataFormat); + assertNotNull("Cannot get dataformat with name: " + dataFormat, df); + + LOG.info("Found Camel dataformat: {} instance: {} with className: {}", dataFormat, df, df.getClass()); + } + + protected void testLanguage(String language) throws Exception { + testLanguage("camel-" + language, language); + } + + protected void testLanguage(String mainFeature, String language) throws Exception { + LOG.info("Looking up CamelContext(myCamel) in OSGi Service Registry"); + + installCamelFeature(mainFeature); + + CamelContext camelContext = getOsgiService(bundleContext, CamelContext.class, "(camel.context.name=myCamel)", 20000); + assertNotNull("Cannot find CamelContext with name myCamel", camelContext); + + LOG.info("Getting Camel language: {}", language); + Language lan = camelContext.resolveLanguage(language); + assertNotNull("Cannot get language with name: " + language, lan); + + LOG.info("Found Camel language: {} instance: {} with className: {}", language, lan, lan.getClass()); + } + + public static String extractName(Class<?> clazz) { + String name = clazz.getName(); + int id0 = name.indexOf("Camel") + "Camel".length(); + int id1 = name.indexOf("Test"); + StringBuilder sb = new StringBuilder(); + for (int i = id0; i < id1; i++) { + char c = name.charAt(i); + if (Character.isUpperCase(c) && sb.length() > 0) { + sb.append("-"); + } + sb.append(Character.toLowerCase(c)); + } + return sb.toString(); + } + + public static UrlReference getCamelKarafFeatureUrl() { + return mavenBundle(). + groupId("org.apache.camel.karaf"). + artifactId("apache-camel"). + versionAsInProject().type("xml/features"); + } + + private static void switchPlatformEncodingToUTF8() { + try { + System.setProperty("file.encoding", "UTF-8"); + Field charset = Charset.class.getDeclaredField("defaultCharset"); + charset.setAccessible(true); + charset.set(null, null); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private static String getKarafVersion() { + InputStream ins = AbstractFeatureTest.class.getResourceAsStream("/META-INF/maven/dependencies.properties"); + Properties p = new Properties(); + try { + p.load(ins); + } catch (Throwable t) { + // ignore + } + String karafVersion = p.getProperty("org.apache.karaf/apache-karaf/version"); + if (karafVersion == null) { + karafVersion = System.getProperty("karafVersion"); + } + if (karafVersion == null) { + // setup the default version of it + karafVersion = "4.0.4"; + } + return karafVersion; + } + + @Configuration + public static Option[] configure() { + switchPlatformEncodingToUTF8(); + String karafVersion = getKarafVersion(); + LOG.info("*** Apache Karaf version is " + karafVersion + " ***"); + + Option[] options = new Option[]{ + // for remote debugging + //org.ops4j.pax.exam.CoreOptions.vmOption("-Xdebug"), + //org.ops4j.pax.exam.CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5008"), + + // we need INFO logging otherwise we cannot see what happens + new LogLevelOption(LogLevelOption.LogLevel.INFO), + + KarafDistributionOption.karafDistributionConfiguration() + .frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf").type("tar.gz").versionAsInProject()) + .karafVersion(karafVersion) + .name("Apache Karaf") + .useDeployFolder(false).unpackDirectory(new File("target/paxexam/unpack/")), + + // keep the folder so we can look inside when something fails + keepRuntimeFolder(), + + // Disable the SSH port + configureConsole().ignoreRemoteShell(), + + // need to modify the jre.properties to export some com.sun packages that some features rely on + KarafDistributionOption.replaceConfigurationFile("etc/jre.properties", new File("src/test/resources/jre.properties")), + + vmOption("-Dfile.encoding=UTF-8"), + + // Disable the Karaf shutdown port + editConfigurationFilePut("etc/custom.properties", "karaf.shutdown.port", "-1"), + + // Assign unique ports for Karaf + editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", Integer.toString(AvailablePortFinder.getNextAvailable()) ), + editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", Integer.toString(AvailablePortFinder.getNextAvailable())), + editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", Integer.toString(AvailablePortFinder.getNextAvailable())), + + // install junit + CoreOptions.junitBundles(), + + // install camel + KarafDistributionOption.features(getCamelKarafFeatureUrl(), "camel"), + mavenBundle().groupId("org.apache.camel").artifactId("camel-test-karaf").versionAsInProject() + }; + + return options; + } + + @SuppressWarnings("unchecked") + public static <T> T getOsgiService(BundleContext bundleContext, Class<T> type, String filter, long timeout) { + ServiceTracker tracker; + try { + String flt; + if (filter != null) { + if (filter.startsWith("(")) { + flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")" + filter + ")"; + } else { + flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")(" + filter + "))"; + } + } else { + flt = "(" + Constants.OBJECTCLASS + "=" + type.getName() + ")"; + } + Filter osgiFilter = FrameworkUtil.createFilter(flt); + tracker = new ServiceTracker(bundleContext, osgiFilter, null); + tracker.open(true); + // Note that the tracker is not closed to keep the reference + // This is buggy, as the service reference may change i think + Object svc = tracker.waitForService(timeout); + + if (svc == null) { + Dictionary<?, ?> dic = bundleContext.getBundle().getHeaders(); + LOG.warn("Test bundle headers: " + explode(dic)); + + for (ServiceReference ref : asCollection(bundleContext.getAllServiceReferences(null, null))) { + LOG.warn("ServiceReference: " + ref + ", bundle: " + ref.getBundle() + ", symbolicName: " + ref.getBundle().getSymbolicName()); + } + + for (ServiceReference ref : asCollection(bundleContext.getAllServiceReferences(null, flt))) { + LOG.warn("Filtered ServiceReference: " + ref + ", bundle: " + ref.getBundle() + ", symbolicName: " + ref.getBundle().getSymbolicName()); + } + + throw new RuntimeException("Gave up waiting for service " + flt); + } + return type.cast(svc); + } catch (InvalidSyntaxException e) { + throw new IllegalArgumentException("Invalid filter", e); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + + /** + * Explode the dictionary into a <code>,</code> delimited list of <code>key=value</code> pairs. + */ + private static String explode(Dictionary<?, ?> dictionary) { + Enumeration<?> keys = dictionary.keys(); + StringBuilder result = new StringBuilder(); + while (keys.hasMoreElements()) { + Object key = keys.nextElement(); + result.append(String.format("%s=%s", key, dictionary.get(key))); + if (keys.hasMoreElements()) { + result.append(", "); + } + } + return result.toString(); + } + + /** + * Provides an iterable collection of references, even if the original array is <code>null</code>. + */ + private static Collection<ServiceReference> asCollection(ServiceReference[] references) { + return references == null ? new ArrayList<ServiceReference>(0) : Arrays.asList(references); + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/components/camel-test-karaf/src/main/java/org/apache/camel/test/karaf/CamelKarafTestSupport.java ---------------------------------------------------------------------- diff --git a/components/camel-test-karaf/src/main/java/org/apache/camel/test/karaf/CamelKarafTestSupport.java b/components/camel-test-karaf/src/main/java/org/apache/camel/test/karaf/CamelKarafTestSupport.java new file mode 100644 index 0000000..eb64d64 --- /dev/null +++ b/components/camel-test-karaf/src/main/java/org/apache/camel/test/karaf/CamelKarafTestSupport.java @@ -0,0 +1,404 @@ +/* + * 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.apache.camel.test.karaf; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.PrintStream; +import java.net.URL; +import java.security.Principal; +import java.security.PrivilegedExceptionAction; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Dictionary; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Set; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.FutureTask; +import java.util.concurrent.TimeUnit; + +import javax.inject.Inject; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; +import javax.security.auth.Subject; + +import org.apache.felix.service.command.CommandProcessor; +import org.apache.felix.service.command.CommandSession; +import org.apache.karaf.features.Feature; +import org.apache.karaf.features.FeaturesService; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.MavenUtils; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.ProbeBuilder; +import org.ops4j.pax.exam.TestProbeBuilder; +import org.ops4j.pax.exam.karaf.options.LogLevelOption; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.Filter; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; +import org.osgi.util.tracker.ServiceTracker; + +import org.junit.Assert; + +import static org.ops4j.pax.exam.CoreOptions.maven; +import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.*; + +/* + TODO: This file is a copy of KarafTestSupport.java from the Karaf 4 repository. + Eventually there will be a karaf-test module that contains this class, and we'll + be able to use that. For now, use this as a starting point. +*/ +public class CamelKarafTestSupport { + + static final Long COMMAND_TIMEOUT = 30000L; + static final Long SERVICE_TIMEOUT = 30000L; + + ExecutorService executor = Executors.newCachedThreadPool(); + + @Inject + protected BundleContext bundleContext; + + @Inject + protected FeaturesService featuresService; + + @ProbeBuilder + public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) { + probe.setHeader(Constants.DYNAMICIMPORT_PACKAGE, "*,org.apache.felix.service.*;status=provisional"); + return probe; + } + + public File getConfigFile(String path) { + URL res = this.getClass().getResource(path); + if (res == null) { + throw new RuntimeException("Config resource " + path + " not found"); + } + return new File(res.getFile()); + } + + @Configuration + public Option[] config() { + return new Option[]{ + // KarafDistributionOption.debugConfiguration("8889", true), + karafDistributionConfiguration().frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf").versionAsInProject().type("tar.gz")) + .karafVersion(MavenUtils.getArtifactVersion("org.apache.karaf", "apache-karaf")).name("Apache Karaf").unpackDirectory(new File("target/exam")), + keepRuntimeFolder(), + logLevel(LogLevelOption.LogLevel.INFO), + replaceConfigurationFile("etc/org.ops4j.pax.logging.cfg", getConfigFile("/etc/org.ops4j.pax.logging.cfg")), + editConfigurationFilePut("etc/system.properties", "hibernate3.version", System.getProperty("hibernate3.version")), + editConfigurationFilePut("etc/system.properties", "hibernate42.version", System.getProperty("hibernate42.version")), + editConfigurationFilePut("etc/system.properties", "hibernate43.version", System.getProperty("hibernate43.version")), + editConfigurationFilePut("etc/system.properties", "spring31.version", System.getProperty("spring31.version")), + editConfigurationFilePut("etc/system.properties", "spring32.version", System.getProperty("spring32.version")), + editConfigurationFilePut("etc/system.properties", "spring40.version", System.getProperty("spring40.version")), + editConfigurationFilePut("etc/system.properties", "spring41.version", System.getProperty("spring41.version")) + }; + } + + /** + * Executes a shell command and returns output as a String. + * Commands have a default timeout of 10 seconds. + * + * @param command The command to execute + * @param principals The principals (e.g. RolePrincipal objects) to run the command under + * @return + */ + protected String executeCommand(final String command, Principal ... principals) { + return executeCommand(command, COMMAND_TIMEOUT, false, principals); + } + + /** + * Executes a shell command and returns output as a String. + * Commands have a default timeout of 10 seconds. + * + * @param command The command to execute. + * @param timeout The amount of time in millis to wait for the command to execute. + * @param silent Specifies if the command should be displayed in the screen. + * @param principals The principals (e.g. RolePrincipal objects) to run the command under + * @return + */ + protected String executeCommand(final String command, final Long timeout, final Boolean silent, final Principal ... principals) { + + waitForCommandService(command); + String response; + final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + final PrintStream printStream = new PrintStream(byteArrayOutputStream); + final Callable<String> commandCallable = new Callable<String>() { + @Override + public String call() throws Exception { + try { + if (!silent) { + System.err.println(command); + } + final CommandProcessor commandProcessor = getOsgiService(CommandProcessor.class); + final CommandSession commandSession = commandProcessor.createSession(System.in, printStream, System.err); + commandSession.execute(command); + } catch (Exception e) { + throw new RuntimeException(e.getMessage(), e); + } + printStream.flush(); + return byteArrayOutputStream.toString(); + } + }; + + FutureTask<String> commandFuture; + if (principals.length == 0) { + commandFuture = new FutureTask<String>(commandCallable); + } else { + // If principals are defined, run the command callable via Subject.doAs() + commandFuture = new FutureTask<String>(new Callable<String>() { + @Override + public String call() throws Exception { + Subject subject = new Subject(); + subject.getPrincipals().addAll(Arrays.asList(principals)); + return Subject.doAs(subject, new PrivilegedExceptionAction<String>() { + @Override + public String run() throws Exception { + return commandCallable.call(); + } + }); + } + }); + } + + + try { + executor.submit(commandFuture); + response = commandFuture.get(timeout, TimeUnit.MILLISECONDS); + } catch (Exception e) { + e.printStackTrace(System.err); + response = "SHELL COMMAND TIMED OUT: "; + } + + return response; + } + + private void waitForCommandService(String command) { + // the commands are represented by services. Due to the asynchronous nature of services they may not be + // immediately available. This code waits the services to be available, in their secured form. It + // means that the code waits for the command service to appear with the roles defined. + + if (command == null || command.length() == 0) { + return; + } + + int spaceIdx = command.indexOf(' '); + if (spaceIdx > 0) { + command = command.substring(0, spaceIdx); + } + int colonIndx = command.indexOf(':'); + + try { + if (colonIndx > 0) { + String scope = command.substring(0, colonIndx); + String function = command.substring(colonIndx + 1); + waitForService("(&(osgi.command.scope=" + scope + ")(osgi.command.function=" + function + "))", SERVICE_TIMEOUT); + } else { + waitForService("(osgi.command.function=" + command + ")", SERVICE_TIMEOUT); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private void waitForService(String filter, long timeout) throws InvalidSyntaxException, + InterruptedException { + + ServiceTracker st = new ServiceTracker(bundleContext, + bundleContext.createFilter(filter), + null); + + try { + st.open(); + st.waitForService(timeout); + } finally { + st.close(); + } + } + + protected <T> T getOsgiService(Class<T> type, long timeout) { + return getOsgiService(type, null, timeout); + } + + protected <T> T getOsgiService(Class<T> type) { + return getOsgiService(type, null, SERVICE_TIMEOUT); + } + + protected <T> T getOsgiService(Class<T> type, String filter, long timeout) { + ServiceTracker tracker = null; + try { + String flt; + if (filter != null) { + if (filter.startsWith("(")) { + flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")" + filter + ")"; + } else { + flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")(" + filter + "))"; + } + } else { + flt = "(" + Constants.OBJECTCLASS + "=" + type.getName() + ")"; + } + Filter osgiFilter = FrameworkUtil.createFilter(flt); + tracker = new ServiceTracker(bundleContext, osgiFilter, null); + tracker.open(true); + // Note that the tracker is not closed to keep the reference + // This is buggy, as the service reference may change i think + Object svc = type.cast(tracker.waitForService(timeout)); + if (svc == null) { + Dictionary dic = bundleContext.getBundle().getHeaders(); + System.err.println("Test bundle headers: " + explode(dic)); + + for (ServiceReference ref : asCollection(bundleContext.getAllServiceReferences(null, null))) { + System.err.println("ServiceReference: " + ref); + } + + for (ServiceReference ref : asCollection(bundleContext.getAllServiceReferences(null, flt))) { + System.err.println("Filtered ServiceReference: " + ref); + } + + throw new RuntimeException("Gave up waiting for service " + flt); + } + return type.cast(svc); + } catch (InvalidSyntaxException e) { + throw new IllegalArgumentException("Invalid filter", e); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + + /* + * Explode the dictionary into a ,-delimited list of key=value pairs + */ + private static String explode(Dictionary dictionary) { + Enumeration keys = dictionary.keys(); + StringBuffer result = new StringBuffer(); + while (keys.hasMoreElements()) { + Object key = keys.nextElement(); + result.append(String.format("%s=%s", key, dictionary.get(key))); + if (keys.hasMoreElements()) { + result.append(", "); + } + } + return result.toString(); + } + + /** + * Provides an iterable collection of references, even if the original array is null + */ + private static Collection<ServiceReference> asCollection(ServiceReference[] references) { + return references != null ? Arrays.asList(references) : Collections.<ServiceReference>emptyList(); + } + + public JMXConnector getJMXConnector() throws Exception { + return getJMXConnector("karaf", "karaf"); + } + + public JMXConnector getJMXConnector(String userName, String passWord) throws Exception { + JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:1099/karaf-root"); + Hashtable env = new Hashtable(); + String[] credentials = new String[]{userName, passWord}; + env.put("jmx.remote.credentials", credentials); + JMXConnector connector = JMXConnectorFactory.connect(url, env); + return connector; + } + + public void assertFeatureInstalled(String featureName) { + Feature[] features = featuresService.listInstalledFeatures(); + for (Feature feature : features) { + if (featureName.equals(feature.getName())) { + return; + } + } + Assert.fail("Feature " + featureName + " should be installed but is not"); + } + + public void assertFeatureInstalled(String featureName, String featureVersion) { + Feature[] features = featuresService.listInstalledFeatures(); + for (Feature feature : features) { + if (featureName.equals(feature.getName()) && featureVersion.equals(feature.getVersion())) { + return; + } + } + Assert.fail("Feature " + featureName + "/" + featureVersion + " should be installed but is not"); + } + + protected void installAndAssertFeature(String feature) throws Exception { + featuresService.installFeature(feature); + assertFeatureInstalled(feature); + } + + protected void installAndAssertFeature(String feature, String version) throws Exception { + featuresService.installFeature(feature, version); + assertFeatureInstalled(feature, version); + } + + protected void installAssertAndUninstallFeature(String feature) throws Exception { + Set<Feature> featuresBefore = new HashSet<Feature>(Arrays.asList(featuresService.listInstalledFeatures())); + try { + featuresService.installFeature(feature); + assertFeatureInstalled(feature); + } finally { + uninstallNewFeatures(featuresBefore); + } + } + + protected void installAssertAndUninstallFeature(String feature, String version) throws Exception { + Set<Feature> featuresBefore = new HashSet<Feature>(Arrays.asList(featuresService.listInstalledFeatures())); + try { + featuresService.installFeature(feature, version); + assertFeatureInstalled(feature, version); + } finally { + uninstallNewFeatures(featuresBefore); + } + } + + protected void installAssertAndUninstallFeatures(String... feature) throws Exception { + Set<Feature> featuresBefore = new HashSet<Feature>(Arrays.asList(featuresService.listInstalledFeatures())); + try { + for (String curFeature : feature) { + featuresService.installFeature(curFeature); + assertFeatureInstalled(curFeature); + } + } finally { + uninstallNewFeatures(featuresBefore); + } + } + + /** + * The feature service does not uninstall feature dependencies when uninstalling a single feature. + * So we need to make sure we uninstall all features that were newly installed. + * + * @param featuresBefore + */ + protected void uninstallNewFeatures(Set<Feature> featuresBefore) { + Feature[] features = featuresService.listInstalledFeatures(); + for (Feature curFeature : features) { + if (!featuresBefore.contains(curFeature)) { + try { + System.out.println("Uninstalling " + curFeature.getName()); + featuresService.uninstallFeature(curFeature.getName(), curFeature.getVersion()); + } catch (Exception e) { + // e.printStackTrace(); + } + } + } + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/components/pom.xml ---------------------------------------------------------------------- diff --git a/components/pom.xml b/components/pom.xml index edc6ebd..fe209a6 100644 --- a/components/pom.xml +++ b/components/pom.xml @@ -37,6 +37,7 @@ <module>camel-testng</module> <module>camel-test-blueprint</module> <module>camel-test-cdi</module> + <module>camel-test-karaf</module> <module>camel-test-spring</module> <module>camel-test-spring40</module> <module>camel-core-osgi</module> http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/pom.xml ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/pom.xml b/tests/camel-itest-karaf/pom.xml index 47f1c60..6ef00dc 100644 --- a/tests/camel-itest-karaf/pom.xml +++ b/tests/camel-itest-karaf/pom.xml @@ -36,6 +36,12 @@ <dependencies> <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test-karaf</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.ops4j.pax.exam</groupId> <artifactId>pax-exam-junit4</artifactId> <scope>test</scope> http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/AbstractFeatureTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/AbstractFeatureTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/AbstractFeatureTest.java deleted file mode 100644 index 6fa7905..0000000 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/AbstractFeatureTest.java +++ /dev/null @@ -1,317 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.itest.karaf; - -import java.io.File; -import java.io.InputStream; -import java.lang.reflect.Field; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Dictionary; -import java.util.EnumSet; -import java.util.Enumeration; -import java.util.Properties; -import javax.inject.Inject; - -import org.apache.camel.CamelContext; -import org.apache.camel.Component; -import org.apache.camel.spi.DataFormat; -import org.apache.camel.spi.Language; -import org.apache.karaf.features.FeaturesService; -import org.junit.After; -import org.junit.Before; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.CoreOptions; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.ProbeBuilder; -import org.ops4j.pax.exam.TestProbeBuilder; -import org.ops4j.pax.exam.karaf.options.KarafDistributionOption; -import org.ops4j.pax.exam.karaf.options.LogLevelOption; -import org.ops4j.pax.exam.options.UrlReference; -import org.osgi.framework.BundleContext; -import org.osgi.framework.Constants; -import org.osgi.framework.Filter; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceReference; -import org.osgi.service.blueprint.container.BlueprintContainer; -import org.osgi.util.tracker.ServiceTracker; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static org.junit.Assert.assertNotNull; -import static org.ops4j.pax.exam.CoreOptions.maven; -import static org.ops4j.pax.exam.CoreOptions.mavenBundle; -import static org.ops4j.pax.exam.CoreOptions.vmOption; - -public abstract class AbstractFeatureTest { - - protected static final Logger LOG = LoggerFactory.getLogger(AbstractFeatureTest.class); - - @Inject - protected BundleContext bundleContext; - - @Inject - protected BlueprintContainer blueprintContainer; - - @Inject - protected FeaturesService featuresService; - - @ProbeBuilder - public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) { - // makes sure the generated Test-Bundle contains this import! - probe.setHeader(Constants.DYNAMICIMPORT_PACKAGE, "*"); - return probe; - } - - @Before - public void setUp() throws Exception { - LOG.info("setUp() using BundleContext: {}", bundleContext); - } - - @After - public void tearDown() throws Exception { - LOG.info("tearDown()"); - } - - protected void installCamelFeature(String mainFeature) throws Exception { - if (!mainFeature.startsWith("camel-")) { - mainFeature = "camel-" + mainFeature; - } - LOG.info("Install main feature: {}", mainFeature); - // do not refresh bundles causing out bundle context to be invalid - // TODO: see if we can find a way maybe to install camel.xml as bundle/feature instead of part of unit test (see src/test/resources/OSGI-INF/blueprint) - featuresService.installFeature(mainFeature, EnumSet.of(FeaturesService.Option.NoAutoRefreshBundles)); - } - - protected void testComponent(String component) throws Exception { - testComponent("camel-" + component, component); - } - - protected void testComponent(String mainFeature, String component) throws Exception { - LOG.info("Looking up CamelContext(myCamel) in OSGi Service Registry"); - - installCamelFeature(mainFeature); - - CamelContext camelContext = getOsgiService(bundleContext, CamelContext.class, "(camel.context.name=myCamel)", 20000); - assertNotNull("Cannot find CamelContext with name myCamel", camelContext); - - LOG.info("Getting Camel component: {}", component); - // do not auto start the component as it may not have been configured properly and fail in its start method - Component comp = camelContext.getComponent(component, true, false); - assertNotNull("Cannot get component with name: " + component, comp); - - LOG.info("Found Camel component: {} instance: {} with className: {}", component, comp, comp.getClass()); - } - - protected void testDataFormat(String dataFormat) throws Exception { - testDataFormat("camel-" + dataFormat, dataFormat); - } - - protected void testDataFormat(String mainFeature, String dataFormat) throws Exception { - LOG.info("Looking up CamelContext(myCamel) in OSGi Service Registry"); - - installCamelFeature(mainFeature); - - CamelContext camelContext = getOsgiService(bundleContext, CamelContext.class, "(camel.context.name=myCamel)", 20000); - assertNotNull("Cannot find CamelContext with name myCamel", camelContext); - - LOG.info("Getting Camel dataformat: {}", dataFormat); - DataFormat df = camelContext.resolveDataFormat(dataFormat); - assertNotNull("Cannot get dataformat with name: " + dataFormat, df); - - LOG.info("Found Camel dataformat: {} instance: {} with className: {}", dataFormat, df, df.getClass()); - } - - protected void testLanguage(String language) throws Exception { - testLanguage("camel-" + language, language); - } - - protected void testLanguage(String mainFeature, String language) throws Exception { - LOG.info("Looking up CamelContext(myCamel) in OSGi Service Registry"); - - installCamelFeature(mainFeature); - - CamelContext camelContext = getOsgiService(bundleContext, CamelContext.class, "(camel.context.name=myCamel)", 20000); - assertNotNull("Cannot find CamelContext with name myCamel", camelContext); - - LOG.info("Getting Camel language: {}", language); - Language lan = camelContext.resolveLanguage(language); - assertNotNull("Cannot get language with name: " + language, lan); - - LOG.info("Found Camel language: {} instance: {} with className: {}", language, lan, lan.getClass()); - } - - public static String extractName(Class<?> clazz) { - String name = clazz.getName(); - int id0 = name.indexOf("Camel") + "Camel".length(); - int id1 = name.indexOf("Test"); - StringBuilder sb = new StringBuilder(); - for (int i = id0; i < id1; i++) { - char c = name.charAt(i); - if (Character.isUpperCase(c) && sb.length() > 0) { - sb.append("-"); - } - sb.append(Character.toLowerCase(c)); - } - return sb.toString(); - } - - public static UrlReference getCamelKarafFeatureUrl() { - return mavenBundle(). - groupId("org.apache.camel.karaf"). - artifactId("apache-camel"). - versionAsInProject().type("xml/features"); - } - - private static void switchPlatformEncodingToUTF8() { - try { - System.setProperty("file.encoding", "UTF-8"); - Field charset = Charset.class.getDeclaredField("defaultCharset"); - charset.setAccessible(true); - charset.set(null, null); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - private static String getKarafVersion() { - InputStream ins = AbstractFeatureTest.class.getResourceAsStream("/META-INF/maven/dependencies.properties"); - Properties p = new Properties(); - try { - p.load(ins); - } catch (Throwable t) { - // ignore - } - String karafVersion = p.getProperty("org.apache.karaf/apache-karaf/version"); - if (karafVersion == null) { - karafVersion = System.getProperty("karafVersion"); - } - if (karafVersion == null) { - // setup the default version of it - karafVersion = "4.0.4"; - } - return karafVersion; - } - - @Configuration - public static Option[] configure() { - switchPlatformEncodingToUTF8(); - String karafVersion = getKarafVersion(); - LOG.info("*** Apache Karaf version is " + karafVersion + " ***"); - - Option[] options = new Option[]{ - // for remote debugging - //org.ops4j.pax.exam.CoreOptions.vmOption("-Xdebug"), - //org.ops4j.pax.exam.CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5008"), - - // we need INFO logging otherwise we cannot see what happens - new LogLevelOption(LogLevelOption.LogLevel.INFO), - - KarafDistributionOption.karafDistributionConfiguration() - .frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf").type("tar.gz").versionAsInProject()) - .karafVersion(karafVersion) - .name("Apache Karaf") - .useDeployFolder(false).unpackDirectory(new File("target/paxexam/unpack/")), - - // keep the folder so we can look inside when something fails - KarafDistributionOption.keepRuntimeFolder(), - - // need to modify the jre.properties to export some com.sun packages that some features rely on - KarafDistributionOption.replaceConfigurationFile("etc/jre.properties", new File("src/test/resources/jre.properties")), - - vmOption("-Dfile.encoding=UTF-8"), - - // install junit - CoreOptions.junitBundles(), - - // install camel - KarafDistributionOption.features(getCamelKarafFeatureUrl(), "camel") - }; - - return options; - } - - @SuppressWarnings("unchecked") - public static <T> T getOsgiService(BundleContext bundleContext, Class<T> type, String filter, long timeout) { - ServiceTracker tracker; - try { - String flt; - if (filter != null) { - if (filter.startsWith("(")) { - flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")" + filter + ")"; - } else { - flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")(" + filter + "))"; - } - } else { - flt = "(" + Constants.OBJECTCLASS + "=" + type.getName() + ")"; - } - Filter osgiFilter = FrameworkUtil.createFilter(flt); - tracker = new ServiceTracker(bundleContext, osgiFilter, null); - tracker.open(true); - // Note that the tracker is not closed to keep the reference - // This is buggy, as the service reference may change i think - Object svc = tracker.waitForService(timeout); - - if (svc == null) { - Dictionary<?, ?> dic = bundleContext.getBundle().getHeaders(); - LOG.warn("Test bundle headers: " + explode(dic)); - - for (ServiceReference ref : asCollection(bundleContext.getAllServiceReferences(null, null))) { - LOG.warn("ServiceReference: " + ref + ", bundle: " + ref.getBundle() + ", symbolicName: " + ref.getBundle().getSymbolicName()); - } - - for (ServiceReference ref : asCollection(bundleContext.getAllServiceReferences(null, flt))) { - LOG.warn("Filtered ServiceReference: " + ref + ", bundle: " + ref.getBundle() + ", symbolicName: " + ref.getBundle().getSymbolicName()); - } - - throw new RuntimeException("Gave up waiting for service " + flt); - } - return type.cast(svc); - } catch (InvalidSyntaxException e) { - throw new IllegalArgumentException("Invalid filter", e); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - } - - /** - * Explode the dictionary into a <code>,</code> delimited list of <code>key=value</code> pairs. - */ - private static String explode(Dictionary<?, ?> dictionary) { - Enumeration<?> keys = dictionary.keys(); - StringBuilder result = new StringBuilder(); - while (keys.hasMoreElements()) { - Object key = keys.nextElement(); - result.append(String.format("%s=%s", key, dictionary.get(key))); - if (keys.hasMoreElements()) { - result.append(", "); - } - } - return result.toString(); - } - - /** - * Provides an iterable collection of references, even if the original array is <code>null</code>. - */ - private static Collection<ServiceReference> asCollection(ServiceReference[] references) { - return references == null ? new ArrayList<ServiceReference>(0) : Arrays.asList(references); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAhcTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAhcTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAhcTest.java index ccd0aa4..92e51c8 100644 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAhcTest.java +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAhcTest.java @@ -19,6 +19,7 @@ package org.apache.camel.itest.karaf; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; +import org.apache.camel.test.karaf.AbstractFeatureTest; @RunWith(PaxExam.class) public class CamelAhcTest extends AbstractFeatureTest { http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAhcWsTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAhcWsTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAhcWsTest.java index 212cef7..bfa85db 100644 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAhcWsTest.java +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAhcWsTest.java @@ -19,6 +19,7 @@ package org.apache.camel.itest.karaf; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; +import org.apache.camel.test.karaf.AbstractFeatureTest; @RunWith(PaxExam.class) public class CamelAhcWsTest extends AbstractFeatureTest { http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAmqpTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAmqpTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAmqpTest.java index c7ba548..8e9902c 100644 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAmqpTest.java +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAmqpTest.java @@ -19,6 +19,7 @@ package org.apache.camel.itest.karaf; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; +import org.apache.camel.test.karaf.AbstractFeatureTest; @RunWith(PaxExam.class) public class CamelAmqpTest extends AbstractFeatureTest { http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelApnsTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelApnsTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelApnsTest.java index 04cdf43..cc38a85 100644 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelApnsTest.java +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelApnsTest.java @@ -19,6 +19,7 @@ package org.apache.camel.itest.karaf; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; +import org.apache.camel.test.karaf.AbstractFeatureTest; @RunWith(PaxExam.class) public class CamelApnsTest extends AbstractFeatureTest { http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAtmosphereWebsocketTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAtmosphereWebsocketTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAtmosphereWebsocketTest.java index 3745453..b07c3f8 100644 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAtmosphereWebsocketTest.java +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAtmosphereWebsocketTest.java @@ -19,6 +19,7 @@ package org.apache.camel.itest.karaf; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; +import org.apache.camel.test.karaf.AbstractFeatureTest; @RunWith(PaxExam.class) public class CamelAtmosphereWebsocketTest extends AbstractFeatureTest { http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAtomTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAtomTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAtomTest.java index 9051fea..200495e 100644 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAtomTest.java +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAtomTest.java @@ -19,6 +19,7 @@ package org.apache.camel.itest.karaf; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; +import org.apache.camel.test.karaf.AbstractFeatureTest; @RunWith(PaxExam.class) public class CamelAtomTest extends AbstractFeatureTest { http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAvroTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAvroTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAvroTest.java index cd66266..09f9853 100644 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAvroTest.java +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAvroTest.java @@ -19,6 +19,7 @@ package org.apache.camel.itest.karaf; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; +import org.apache.camel.test.karaf.AbstractFeatureTest; @RunWith(PaxExam.class) public class CamelAvroTest extends AbstractFeatureTest { http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAwsTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAwsTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAwsTest.java index 5db6ef5..e55894c 100644 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAwsTest.java +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAwsTest.java @@ -19,6 +19,7 @@ package org.apache.camel.itest.karaf; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; +import org.apache.camel.test.karaf.AbstractFeatureTest; @RunWith(PaxExam.class) public class CamelAwsTest extends AbstractFeatureTest { http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBamTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBamTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBamTest.java index c934858..533990b 100644 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBamTest.java +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBamTest.java @@ -19,6 +19,7 @@ package org.apache.camel.itest.karaf; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; +import org.apache.camel.test.karaf.AbstractFeatureTest; @RunWith(PaxExam.class) public class CamelBamTest extends AbstractFeatureTest { http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBarcodeTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBarcodeTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBarcodeTest.java index 5dbea96..b9ea9d2 100644 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBarcodeTest.java +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBarcodeTest.java @@ -19,6 +19,7 @@ package org.apache.camel.itest.karaf; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; +import org.apache.camel.test.karaf.AbstractFeatureTest; @RunWith(PaxExam.class) public class CamelBarcodeTest extends AbstractFeatureTest { http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBase64Test.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBase64Test.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBase64Test.java index 239318a..fbfbdc2 100644 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBase64Test.java +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBase64Test.java @@ -19,6 +19,7 @@ package org.apache.camel.itest.karaf; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; +import org.apache.camel.test.karaf.AbstractFeatureTest; @RunWith(PaxExam.class) public class CamelBase64Test extends AbstractFeatureTest { http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanValidatorTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanValidatorTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanValidatorTest.java index 5159295..afa5bcc 100644 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanValidatorTest.java +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanValidatorTest.java @@ -19,6 +19,7 @@ package org.apache.camel.itest.karaf; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; +import org.apache.camel.test.karaf.AbstractFeatureTest; @RunWith(PaxExam.class) public class CamelBeanValidatorTest extends AbstractFeatureTest { http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanioTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanioTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanioTest.java index 6975352..ca59bd0 100644 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanioTest.java +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanioTest.java @@ -19,6 +19,7 @@ package org.apache.camel.itest.karaf; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; +import org.apache.camel.test.karaf.AbstractFeatureTest; @RunWith(PaxExam.class) public class CamelBeanioTest extends AbstractFeatureTest { http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanstalkTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanstalkTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanstalkTest.java index 69e851d..6082555 100644 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanstalkTest.java +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanstalkTest.java @@ -19,6 +19,7 @@ package org.apache.camel.itest.karaf; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; +import org.apache.camel.test.karaf.AbstractFeatureTest; @RunWith(PaxExam.class) public class CamelBeanstalkTest extends AbstractFeatureTest { http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBindyTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBindyTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBindyTest.java index 7e106a1..d89b4f7 100644 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBindyTest.java +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBindyTest.java @@ -19,6 +19,7 @@ package org.apache.camel.itest.karaf; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; +import org.apache.camel.test.karaf.AbstractFeatureTest; @RunWith(PaxExam.class) public class CamelBindyTest extends AbstractFeatureTest { http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBoonTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBoonTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBoonTest.java index f24f8fe..6c0cff4 100644 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBoonTest.java +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBoonTest.java @@ -19,6 +19,7 @@ package org.apache.camel.itest.karaf; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; +import org.apache.camel.test.karaf.AbstractFeatureTest; @RunWith(PaxExam.class) public class CamelBoonTest extends AbstractFeatureTest { http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBoxTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBoxTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBoxTest.java index ac0f797..da53d14 100644 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBoxTest.java +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBoxTest.java @@ -19,6 +19,7 @@ package org.apache.camel.itest.karaf; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; +import org.apache.camel.test.karaf.AbstractFeatureTest; @RunWith(PaxExam.class) public class CamelBoxTest extends AbstractFeatureTest { http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBraintreeTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBraintreeTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBraintreeTest.java index c58fad5..017ad4d 100644 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBraintreeTest.java +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBraintreeTest.java @@ -19,6 +19,7 @@ package org.apache.camel.itest.karaf; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; +import org.apache.camel.test.karaf.AbstractFeatureTest; @RunWith(PaxExam.class) public class CamelBraintreeTest extends AbstractFeatureTest { http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelCacheTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelCacheTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelCacheTest.java index fcabe45..692cd61 100644 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelCacheTest.java +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelCacheTest.java @@ -19,6 +19,7 @@ package org.apache.camel.itest.karaf; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; +import org.apache.camel.test.karaf.AbstractFeatureTest; @RunWith(PaxExam.class) public class CamelCacheTest extends AbstractFeatureTest { http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelCassandraqlTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelCassandraqlTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelCassandraqlTest.java index d54da7b..3541b9a 100644 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelCassandraqlTest.java +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelCassandraqlTest.java @@ -19,6 +19,7 @@ package org.apache.camel.itest.karaf; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; +import org.apache.camel.test.karaf.AbstractFeatureTest; @RunWith(PaxExam.class) public class CamelCassandraqlTest extends AbstractFeatureTest { http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelCastorTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelCastorTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelCastorTest.java index f383d40..00f2130 100644 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelCastorTest.java +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelCastorTest.java @@ -19,6 +19,7 @@ package org.apache.camel.itest.karaf; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; +import org.apache.camel.test.karaf.AbstractFeatureTest; @RunWith(PaxExam.class) public class CamelCastorTest extends AbstractFeatureTest { http://git-wip-us.apache.org/repos/asf/camel/blob/dec1c091/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelChunkTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelChunkTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelChunkTest.java index 86d2ee6..744c921 100644 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelChunkTest.java +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelChunkTest.java @@ -19,6 +19,7 @@ package org.apache.camel.itest.karaf; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; +import org.apache.camel.test.karaf.AbstractFeatureTest; @RunWith(PaxExam.class) public class CamelChunkTest extends AbstractFeatureTest {