[BROOKLYN-183] Use junit4 in brooklyn-itest pax-exam-4.6.0 is not properly tested with test-ng, leading to obscure behavior
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/61927720 Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/61927720 Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/61927720 Branch: refs/heads/master Commit: 61927720d705ff7f574ae6527790484953901c1d Parents: 8067eed Author: Ciprian Ciubotariu <cheepe...@gmx.net> Authored: Fri Nov 27 20:00:36 2015 +0200 Committer: Ciprian Ciubotariu <cheepe...@gmx.net> Committed: Fri Nov 27 20:12:59 2015 +0200 ---------------------------------------------------------------------- karaf/itest/pom.xml | 18 ++++++++++----- .../java/org/apache/brooklyn/AssemblyTest.java | 24 +++++++------------- 2 files changed, 20 insertions(+), 22 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/61927720/karaf/itest/pom.xml ---------------------------------------------------------------------- diff --git a/karaf/itest/pom.xml b/karaf/itest/pom.xml index 7e10b1b..888727c 100644 --- a/karaf/itest/pom.xml +++ b/karaf/itest/pom.xml @@ -33,7 +33,7 @@ <!-- Pax Exam Dependencies --> <dependency> <groupId>org.ops4j.pax.exam</groupId> - <artifactId>pax-exam-testng</artifactId> + <artifactId>pax-exam-junit4</artifactId> <version>${pax.exam.version}</version> <scope>test</scope> </dependency> @@ -45,6 +45,13 @@ <scope>test</scope> </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> + <!-- Karaf Container --> <dependency> <groupId>org.ops4j.pax.exam</groupId> @@ -90,10 +97,10 @@ </dependency> <dependency> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-atinject_1.0_spec</artifactId> - <version>1.0</version> - <scope>provided</scope> + <groupId>javax.inject</groupId> + <artifactId>javax.inject</artifactId> + <version>1</version> <!-- TODO: version property? --> + <scope>test</scope> </dependency> <dependency> @@ -180,7 +187,6 @@ <executions> <execution> <id>generate-depends-file</id> - <phase>generate-resources</phase> <goals> <goal>generate-depends-file</goal> </goals> http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/61927720/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 index ad67105..49f9ea6 100644 --- a/karaf/itest/src/test/java/org/apache/brooklyn/AssemblyTest.java +++ b/karaf/itest/src/test/java/org/apache/brooklyn/AssemblyTest.java @@ -19,15 +19,12 @@ package org.apache.brooklyn; import static org.ops4j.pax.exam.CoreOptions.maven; -import static org.ops4j.pax.exam.CoreOptions.mavenBundle; 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 static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertTrue; import java.io.File; @@ -35,23 +32,25 @@ import javax.inject.Inject; import org.apache.karaf.features.BootFinished; import org.apache.karaf.features.FeaturesService; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import org.junit.runner.RunWith; +import org.junit.Test; import org.ops4j.pax.exam.Configuration; +import static org.ops4j.pax.exam.CoreOptions.junitBundles; 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.MavenArtifactProvisionOption; 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.ops4j.pax.exam.testng.listener.PaxExam; import org.osgi.framework.BundleContext; -import org.testng.annotations.Listeners; -import org.testng.annotations.Test; /** * Tests the apache-brooklyn karaf runtime assembly. */ -@Listeners(PaxExam.class) +@RunWith(PaxExam.class) @ExamReactorStrategy(PerClass.class) public class AssemblyTest { @@ -79,17 +78,10 @@ public class AssemblyTest { logLevel(LogLevel.INFO), keepRuntimeFolder(), features(karafStandardFeaturesRepository(), "eventadmin"), - addTestNGBundle() + junitBundles() }; } - private static MavenArtifactProvisionOption addTestNGBundle() { - return mavenBundle() - .groupId("org.testng") - .artifactId("testng") - .version(asInProject()); - } - private static MavenArtifactUrlReference brooklynKarafDist() { return maven() .groupId("org.apache.brooklyn")