[BROOKLYN-183] Use brooklyn-itest project to check features Add brooklyn-core feature to boot features in apache-brooklyn karaf assembly. Remove custom setting of org.osgi.framework.system.packages.extra.
Depend on apache-brooklyn assembly in brooklyn-itest. Use apache-brooklyn as OSGi runtime for AssemblyTest. Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/06b186fa Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/06b186fa Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/06b186fa Branch: refs/heads/master Commit: 06b186faa74fcbe473ee3e41156ca49b4e56f252 Parents: d944b7a Author: Ciprian Ciubotariu <[email protected]> Authored: Mon Oct 5 15:50:34 2015 +0300 Committer: Ciprian Ciubotariu <[email protected]> Committed: Sun Oct 25 01:04:51 2015 +0300 ---------------------------------------------------------------------- karaf/apache-brooklyn/pom.xml | 11 +- .../src/main/resources/etc/custom.properties | 180 +++++++++---------- karaf/itest/pom.xml | 26 ++- .../java/org/apache/brooklyn/AssemblyTest.java | 117 ++++++++++++ .../test/java/org/apache/brooklyn/MyTest.java | 93 ---------- 5 files changed, 238 insertions(+), 189 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/06b186fa/karaf/apache-brooklyn/pom.xml ---------------------------------------------------------------------- diff --git a/karaf/apache-brooklyn/pom.xml b/karaf/apache-brooklyn/pom.xml index f3374a6..e478e78 100755 --- a/karaf/apache-brooklyn/pom.xml +++ b/karaf/apache-brooklyn/pom.xml @@ -57,14 +57,14 @@ <scope>runtime</scope> </dependency> - <!--dependency> + <dependency> <groupId>org.apache.brooklyn</groupId> - <artifactId>features</artifactId> + <artifactId>brooklyn-features</artifactId> <version>${project.version}</version> <type>xml</type> <classifier>features</classifier> <scope>runtime</scope> - </dependency--> + </dependency> </dependencies> @@ -112,9 +112,10 @@ <bootFeature>ssh</bootFeature> <bootFeature>system</bootFeature> <bootFeature>wrap</bootFeature> - <!--bootFeature>brooklyn-core</bootFeature--> + <!-- brooklyn features --> + <bootFeature>brooklyn-core</bootFeature> </bootFeatures> - </configuration> + </configuration> </plugin> </plugins> </build> http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/06b186fa/karaf/apache-brooklyn/src/main/resources/etc/custom.properties ---------------------------------------------------------------------- diff --git a/karaf/apache-brooklyn/src/main/resources/etc/custom.properties b/karaf/apache-brooklyn/src/main/resources/etc/custom.properties index 912207f..f2db8c2 100644 --- a/karaf/apache-brooklyn/src/main/resources/etc/custom.properties +++ b/karaf/apache-brooklyn/src/main/resources/etc/custom.properties @@ -22,93 +22,93 @@ # All the values specified here will override the default value. # -karaf.systemBundlesStartLevel=50 - -org.osgi.framework.bootdelegation=org.apache.karaf.jaas.boot,!com.sun.xml.messaging.saaj.*,!com.sun.xml.internal.bind.*,sun.*,com.sun.*,javax.transaction,javax.transaction.*,org.apache.xalan.processor,org.apache.xpath.jaxp,org.apache.xml.dtm.ref,org.apache.xerces.jaxp.datatype,org.apache.xerces.stax,org.apache.xerces.parsers,org.apache.xerces.jaxp,org.apache.xerces.jaxp.validation,org.apache.xerces.dom - -org.osgi.framework.system.packages.extra = \ - org.apache.karaf.branding, \ - com.sun.org.apache.xalan.internal.xsltc.trax, \ - com.sun.org.apache.xerces.internal.dom, \ - com.sun.org.apache.xerces.internal.jaxp, \ - com.sun.org.apache.xerces.internal.xni, \ - com.sun.jndi.ldap, \ - org.apache.xalan.extensions; version="2.7.1", \ - org.apache.xalan.xsltc.compiler; version="2.7.1", \ - org.apache.xalan.xsltc.cmdline.getopt; version="2.7.1", \ - org.apache.xalan.xsltc.util; version="2.7.1", \ - org.apache.xalan.transformer; version="2.7.1", \ - org.apache.xalan.xsltc.trax; version="2.7.1", \ - org.apache.xalan.processor; version="2.7.1", \ - org.apache.xalan.lib; version="2.7.1", \ - org.apache.xalan.trace; version="2.7.1", \ - org.apache.xalan.xsltc.compiler.util; version="2.7.1", \ - org.apache.xalan.templates; version="2.7.1", \ - org.apache.xalan.xsltc; version="2.7.1", \ - org.apache.xalan.xsltc.runtime; version="2.7.1", \ - org.apache.xalan; version="2.7.1", \ - org.apache.xalan.xslt; version="2.7.1", \ - org.apache.xalan.lib.sql; version="2.7.1", \ - org.apache.xalan.xsltc.runtime.output; version="2.7.1", \ - org.apache.xalan.xsltc.dom; version="2.7.1", \ - org.apache.xalan.client; version="2.7.1", \ - org.apache.xalan.xsltc.cmdline; version="2.7.1", \ - org.apache.xalan.serialize; version="2.7.1", \ - org.apache.xalan.res; version="2.7.1", \ - org.apache.xml.dtm.ref; version="2.7.1", \ - org.apache.xml.dtm; version="2.7.1", \ - org.apache.xml.dtm.ref.sax2dtm; version="2.7.1", \ - org.apache.xml.dtm.ref.dom2dtm; version="2.7.1", \ - org.apache.xml.res; version="2.7.1", \ - org.apache.xml.serializer.dom3; version="2.7.1", \ - org.apache.xml.serializer; version="2.7.1", \ - org.apache.xml.serializer.utils; version="2.7.1", \ - org.apache.xml.utils.res; version="2.7.1", \ - org.apache.xml.utils; version="2.7.1", \ - org.apache.xpath.functions; version="2.7.1", \ - org.apache.xpath.jaxp; version="2.7.1", \ - org.apache.xpath.patterns; version="2.7.1", \ - org.apache.xpath.objects; version="2.7.1", \ - org.apache.xpath.res; version="2.7.1", \ - org.apache.xpath; version="2.7.1", \ - org.apache.xpath.axes; version="2.7.1", \ - org.apache.xpath.compiler; version="2.7.1", \ - org.apache.xpath.operations; version="2.7.1", \ - org.apache.xpath.domapi; version="2.7.1", \ - org.apache.html.dom; version="2.11.0", \ - org.apache.wml.dom; version="2.11.0", \ - org.apache.wml; version="2.11.0", \ - org.apache.xerces.parsers; version="2.11.0", \ - org.apache.xerces.impl.dtd.models; version="2.11.0", \ - org.apache.xerces.xni.parser; version="2.11.0", \ - org.apache.xerces.impl.dv.xs; version="2.11.0", \ - org.apache.xerces.impl.xs.traversers; version="2.11.0", \ - org.apache.xerces.util; version="2.11.0", \ - org.apache.xerces.impl.dtd; version="2.11.0", \ - org.apache.xerces.jaxp.validation; version="2.11.0", \ - org.apache.xerces.dom3.as; version="2.11.0", \ - org.apache.xerces.impl.dv; version="2.11.0", \ - org.apache.xerces.jaxp; version="2.11.0", \ - org.apache.xerces.jaxp.datatype; version="2.11.0", \ - org.apache.xerces.impl.xpath.regex; version="2.11.0", \ - org.apache.xerces.xni; version="2.11.0", \ - org.apache.xerces.impl.msg; version="2.11.0", \ - org.apache.xerces.impl.dv.util; version="2.11.0", \ - org.apache.xerces.impl.xs.util; version="2.11.0", \ - org.apache.xerces.dom; version="2.11.0", \ - org.apache.xerces.dom.events; version="2.11.0", \ - org.apache.xerces.impl.xs.opti; version="2.11.0", \ - org.apache.xerces.impl; version="2.11.0", \ - org.apache.xerces.xs; version="2.11.0", \ - org.apache.xerces.impl.io; version="2.11.0", \ - org.apache.xerces.xpointer; version="2.11.0", \ - org.apache.xerces.impl.dv.dtd; version="2.11.0", \ - org.apache.xerces.xinclude; version="2.11.0", \ - org.apache.xerces.impl.xpath; version="2.11.0", \ - org.apache.xerces.xs.datatypes; version="2.11.0", \ - org.apache.xerces.impl.xs.identity; version="2.11.0", \ - org.apache.xerces.impl.xs.models; version="2.11.0", \ - org.apache.xerces.xni.grammars; version="2.11.0", \ - org.apache.xerces.impl.xs; version="2.11.0", \ - org.apache.xerces.impl.validation; version="2.11.0", \ - org.apache.xml.serialize; version="2.11.0" \ No newline at end of file +#karaf.systemBundlesStartLevel=50 +# +#org.osgi.framework.bootdelegation=org.apache.karaf.jaas.boot,!com.sun.xml.messaging.saaj.*,!com.sun.xml.internal.bind.*,sun.*,com.sun.*,javax.transaction,javax.transaction.*,org.apache.xalan.processor,org.apache.xpath.jaxp,org.apache.xml.dtm.ref,org.apache.xerces.jaxp.datatype,org.apache.xerces.stax,org.apache.xerces.parsers,org.apache.xerces.jaxp,org.apache.xerces.jaxp.validation,org.apache.xerces.dom +# +#org.osgi.framework.system.packages.extra = \ +# org.apache.karaf.branding, \ +# com.sun.org.apache.xalan.internal.xsltc.trax, \ +# com.sun.org.apache.xerces.internal.dom, \ +# com.sun.org.apache.xerces.internal.jaxp, \ +# com.sun.org.apache.xerces.internal.xni, \ +# com.sun.jndi.ldap, \ +# org.apache.xalan.extensions; version="2.7.1", \ +# org.apache.xalan.xsltc.compiler; version="2.7.1", \ +# org.apache.xalan.xsltc.cmdline.getopt; version="2.7.1", \ +# org.apache.xalan.xsltc.util; version="2.7.1", \ +# org.apache.xalan.transformer; version="2.7.1", \ +# org.apache.xalan.xsltc.trax; version="2.7.1", \ +# org.apache.xalan.processor; version="2.7.1", \ +# org.apache.xalan.lib; version="2.7.1", \ +# org.apache.xalan.trace; version="2.7.1", \ +# org.apache.xalan.xsltc.compiler.util; version="2.7.1", \ +# org.apache.xalan.templates; version="2.7.1", \ +# org.apache.xalan.xsltc; version="2.7.1", \ +# org.apache.xalan.xsltc.runtime; version="2.7.1", \ +# org.apache.xalan; version="2.7.1", \ +# org.apache.xalan.xslt; version="2.7.1", \ +# org.apache.xalan.lib.sql; version="2.7.1", \ +# org.apache.xalan.xsltc.runtime.output; version="2.7.1", \ +# org.apache.xalan.xsltc.dom; version="2.7.1", \ +# org.apache.xalan.client; version="2.7.1", \ +# org.apache.xalan.xsltc.cmdline; version="2.7.1", \ +# org.apache.xalan.serialize; version="2.7.1", \ +# org.apache.xalan.res; version="2.7.1", \ +# org.apache.xml.dtm.ref; version="2.7.1", \ +# org.apache.xml.dtm; version="2.7.1", \ +# org.apache.xml.dtm.ref.sax2dtm; version="2.7.1", \ +# org.apache.xml.dtm.ref.dom2dtm; version="2.7.1", \ +# org.apache.xml.res; version="2.7.1", \ +# org.apache.xml.serializer.dom3; version="2.7.1", \ +# org.apache.xml.serializer; version="2.7.1", \ +# org.apache.xml.serializer.utils; version="2.7.1", \ +# org.apache.xml.utils.res; version="2.7.1", \ +# org.apache.xml.utils; version="2.7.1", \ +# org.apache.xpath.functions; version="2.7.1", \ +# org.apache.xpath.jaxp; version="2.7.1", \ +# org.apache.xpath.patterns; version="2.7.1", \ +# org.apache.xpath.objects; version="2.7.1", \ +# org.apache.xpath.res; version="2.7.1", \ +# org.apache.xpath; version="2.7.1", \ +# org.apache.xpath.axes; version="2.7.1", \ +# org.apache.xpath.compiler; version="2.7.1", \ +# org.apache.xpath.operations; version="2.7.1", \ +# org.apache.xpath.domapi; version="2.7.1", \ +# org.apache.html.dom; version="2.11.0", \ +# org.apache.wml.dom; version="2.11.0", \ +# org.apache.wml; version="2.11.0", \ +# org.apache.xerces.parsers; version="2.11.0", \ +# org.apache.xerces.impl.dtd.models; version="2.11.0", \ +# org.apache.xerces.xni.parser; version="2.11.0", \ +# org.apache.xerces.impl.dv.xs; version="2.11.0", \ +# org.apache.xerces.impl.xs.traversers; version="2.11.0", \ +# org.apache.xerces.util; version="2.11.0", \ +# org.apache.xerces.impl.dtd; version="2.11.0", \ +# org.apache.xerces.jaxp.validation; version="2.11.0", \ +# org.apache.xerces.dom3.as; version="2.11.0", \ +# org.apache.xerces.impl.dv; version="2.11.0", \ +# org.apache.xerces.jaxp; version="2.11.0", \ +# org.apache.xerces.jaxp.datatype; version="2.11.0", \ +# org.apache.xerces.impl.xpath.regex; version="2.11.0", \ +# org.apache.xerces.xni; version="2.11.0", \ +# org.apache.xerces.impl.msg; version="2.11.0", \ +# org.apache.xerces.impl.dv.util; version="2.11.0", \ +# org.apache.xerces.impl.xs.util; version="2.11.0", \ +# org.apache.xerces.dom; version="2.11.0", \ +# org.apache.xerces.dom.events; version="2.11.0", \ +# org.apache.xerces.impl.xs.opti; version="2.11.0", \ +# org.apache.xerces.impl; version="2.11.0", \ +# org.apache.xerces.xs; version="2.11.0", \ +# org.apache.xerces.impl.io; version="2.11.0", \ +# org.apache.xerces.xpointer; version="2.11.0", \ +# org.apache.xerces.impl.dv.dtd; version="2.11.0", \ +# org.apache.xerces.xinclude; version="2.11.0", \ +# org.apache.xerces.impl.xpath; version="2.11.0", \ +# org.apache.xerces.xs.datatypes; version="2.11.0", \ +# org.apache.xerces.impl.xs.identity; version="2.11.0", \ +# org.apache.xerces.impl.xs.models; version="2.11.0", \ +# org.apache.xerces.xni.grammars; version="2.11.0", \ +# org.apache.xerces.impl.xs; version="2.11.0", \ +# org.apache.xerces.impl.validation; version="2.11.0", \ +# org.apache.xml.serialize; version="2.11.0" \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/06b186fa/karaf/itest/pom.xml ---------------------------------------------------------------------- diff --git a/karaf/itest/pom.xml b/karaf/itest/pom.xml index 416d748..2055f44 100644 --- a/karaf/itest/pom.xml +++ b/karaf/itest/pom.xml @@ -145,8 +145,16 @@ </exclusions> </dependency> - </dependencies> + <!-- project deps --> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>apache-brooklyn</artifactId> + <version>${project.version}</version> + <type>zip</type> + <scope>test</scope> + </dependency> + </dependencies> <build> <plugins> @@ -159,6 +167,22 @@ <target>${maven.compiler.target}</target> </configuration> </plugin> + + <plugin> + <groupId>org.apache.servicemix.tooling</groupId> + <artifactId>depends-maven-plugin</artifactId> + <version>1.2</version> + <executions> + <execution> + <id>generate-depends-file</id> + <phase>generate-resources</phase> + <goals> + <goal>generate-depends-file</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> </build> </project> http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/06b186fa/karaf/itest/src/test/java/org/apache/brooklyn/AssemblyTest.java ---------------------------------------------------------------------- diff --git a/karaf/itest/src/test/java/org/apache/brooklyn/AssemblyTest.java b/karaf/itest/src/test/java/org/apache/brooklyn/AssemblyTest.java new file mode 100644 index 0000000..ea620ab --- /dev/null +++ b/karaf/itest/src/test/java/org/apache/brooklyn/AssemblyTest.java @@ -0,0 +1,117 @@ +/* + * 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.brooklyn; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertThat; +import static org.ops4j.pax.exam.CoreOptions.maven; +import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole; +import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features; +import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration; +import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder; +import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel; +import static org.ops4j.pax.exam.MavenUtils.asInProject; + +import java.io.File; + +import javax.inject.Inject; + +import org.apache.karaf.features.BootFinished; +import org.apache.karaf.features.FeaturesService; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel; +import org.ops4j.pax.exam.options.MavenArtifactUrlReference; +import org.ops4j.pax.exam.options.MavenUrlReference; +import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; +import org.ops4j.pax.exam.spi.reactors.PerClass; +import org.osgi.framework.BundleContext; + +/** + * Tests the apache-brooklyn karaf runtime assembly. + */ +@RunWith(PaxExam.class) +@ExamReactorStrategy(PerClass.class) +public class AssemblyTest { + + @Inject + private BundleContext bc; + + @Inject + protected FeaturesService featuresService; + + /** + * To make sure the tests run only when the boot features are fully + * installed + */ + @Inject + BootFinished bootFinished; + + @Configuration + public static Option[] configuration() throws Exception { + return new Option[]{ + karafDistributionConfiguration() + .frameworkUrl(brooklynKarafDist()) + .unpackDirectory(new File("target/paxexam/unpack/")) + .useDeployFolder(false), + configureConsole().ignoreLocalConsole(), + logLevel(LogLevel.INFO), + keepRuntimeFolder(), + features(karafStandardFeaturesRepository(), "eventadmin") + }; + } + + private static MavenArtifactUrlReference brooklynKarafDist() { + return maven() + .groupId("org.apache.brooklyn") + .artifactId("apache-brooklyn") + .type("zip") + .version(asInProject()); + } + + private static MavenUrlReference karafStandardFeaturesRepository() { + return maven() + .groupId("org.apache.karaf.features") + .artifactId("standard") + .type("xml") + .classifier("features") + .version(asInProject()); + } + + @Test + public void shouldHaveBundleContext() { + assertThat(bc, is(notNullValue())); + } + + @Test + public void checkEventFeature() throws Exception { + assertThat(featuresService.isInstalled(featuresService.getFeature("eventadmin")), is(true)); + } + + @Test + public void checkBrooklynCoreFeature() throws Exception { + featuresService.installFeature("brooklyn-core"); + assertThat(featuresService.isInstalled(featuresService.getFeature("brooklyn-core")), is(true)); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/06b186fa/karaf/itest/src/test/java/org/apache/brooklyn/MyTest.java ---------------------------------------------------------------------- diff --git a/karaf/itest/src/test/java/org/apache/brooklyn/MyTest.java b/karaf/itest/src/test/java/org/apache/brooklyn/MyTest.java deleted file mode 100644 index d7b4917..0000000 --- a/karaf/itest/src/test/java/org/apache/brooklyn/MyTest.java +++ /dev/null @@ -1,93 +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.brooklyn; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertThat; -import static org.ops4j.pax.exam.CoreOptions.maven; -import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole; -import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features; -import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration; -import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder; -import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel; - -import java.io.File; - -import javax.inject.Inject; - -import org.apache.karaf.features.BootFinished; -import org.apache.karaf.features.FeaturesService; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.junit.PaxExam; -import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel; -import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; -import org.ops4j.pax.exam.spi.reactors.PerClass; -import org.osgi.framework.BundleContext; - -@RunWith(PaxExam.class) -@ExamReactorStrategy(PerClass.class) -public class MyTest { - - @Inject - private BundleContext bc; - - - @Inject - protected FeaturesService featuresService; - - /** - * To make sure the tests run only when the boot features are fully - * installed - */ - @Inject - BootFinished bootFinished; - - @Configuration - public static Option[] configuration() throws Exception { - return new Option[] { - karafDistributionConfiguration().frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf") - .type("zip").version("4.0.1")) - .unpackDirectory(new File("target/paxexam/unpack/")) - .useDeployFolder(false), - configureConsole().ignoreLocalConsole(), - logLevel(LogLevel.INFO), - keepRuntimeFolder(), - features( - maven().groupId("org.apache.karaf.features") - .artifactId("standard").type("xml") - .classifier("features").version("3.0.3"), - "eventadmin") - }; - } - - @Test - public void shouldHaveBundleContext() { - assertThat(bc, is(notNullValue())); - } - - @Test - public void checkEventFeature() throws Exception { - assertThat(featuresService.isInstalled(featuresService.getFeature("eventadmin")), is(true)); - } - -}
