This is an automated email from the ASF dual-hosted git repository. adriancole pushed a commit to branch rat in repository https://gitbox.apache.org/repos/asf/incubator-zipkin-brave-karaf.git
commit 8d3d416974117d7bd008faf676df45be86b201ee Author: Adrian Cole <[email protected]> AuthorDate: Thu Oct 18 11:36:46 2018 +0800 Uses implicit versions in itests (#8) --- features/pom.xml | 2 -- itests/pom.xml | 8 +++++++ .../java/io/zipkin/brave/itests/BraveTest.java | 27 ++++++++++++++++++---- itests/src/test/resources/exam.properties | 1 + pom.xml | 5 ++++ 5 files changed, 37 insertions(+), 6 deletions(-) diff --git a/features/pom.xml b/features/pom.xml index 73b01f3..cc1b1ef 100644 --- a/features/pom.xml +++ b/features/pom.xml @@ -38,9 +38,7 @@ </resources> <plugins> <plugin> - <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> - <version>3.1.0</version> <executions> <execution> <id>filter</id> diff --git a/itests/pom.xml b/itests/pom.xml index f100dbf..65addcb 100644 --- a/itests/pom.xml +++ b/itests/pom.xml @@ -151,4 +151,12 @@ <scope>test</scope> </dependency> </dependencies> + <build> + <testResources> + <testResource> + <directory>src/test/resources</directory> + <filtering>true</filtering> + </testResource> + </testResources> + </build> </project> diff --git a/itests/src/test/java/io/zipkin/brave/itests/BraveTest.java b/itests/src/test/java/io/zipkin/brave/itests/BraveTest.java index 7b3f15c..47054f7 100644 --- a/itests/src/test/java/io/zipkin/brave/itests/BraveTest.java +++ b/itests/src/test/java/io/zipkin/brave/itests/BraveTest.java @@ -21,8 +21,9 @@ import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDist import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel; +import java.io.InputStream; import java.util.Collection; - +import java.util.Properties; import javax.inject.Inject; import org.junit.Assert; @@ -54,12 +55,13 @@ public class BraveTest { BundleContext context; @Configuration - public static Option[] configuration() { + public static Option[] configuration() throws Exception { MavenArtifactUrlReference karaf = maven().groupId("org.apache.karaf").artifactId("apache-karaf") - .type("zip").version("4.1.5"); + .type("zip") + .version(getVersionFromMaven("org.apache.karaf.features/org.apache.karaf.features.core")); MavenUrlReference brave = maven().groupId("io.zipkin.brave.karaf").artifactId("brave-features").type("xml") - .classifier("features").version("0.1.0-SNAPSHOT"); + .classifier("features").version(getBraveKarafVersion()); return new Option[] { karafDistributionConfiguration().frameworkUrl(karaf).useDeployFolder(false), configureConsole().ignoreLocalConsole(), @@ -109,4 +111,21 @@ public class BraveTest { } throw new RuntimeException("Timeout finding service"); } + + static String getVersionFromMaven(String path) throws Exception { + InputStream is = + BraveTest.class.getResourceAsStream("/META-INF/maven/" + path + "/pom.properties"); + Assert.assertNotNull(is); + Properties p = new Properties(); + p.load(is); + return p.getProperty("version"); + } + + static String getBraveKarafVersion() throws Exception { + InputStream is = BraveTest.class.getResourceAsStream("/exam.properties"); + Assert.assertNotNull(is); + Properties p = new Properties(); + p.load(is); + return p.getProperty("brave-karaf.version"); + } } diff --git a/itests/src/test/resources/exam.properties b/itests/src/test/resources/exam.properties index 14f97f7..1c7a353 100644 --- a/itests/src/test/resources/exam.properties +++ b/itests/src/test/resources/exam.properties @@ -11,3 +11,4 @@ # the License. pax.exam.logging = none pax.exam.service.timeout = 5000 [email protected]@ diff --git a/pom.xml b/pom.xml index f176186..3847d1b 100644 --- a/pom.xml +++ b/pom.xml @@ -317,6 +317,11 @@ </plugin> <plugin> + <artifactId>maven-resources-plugin</artifactId> + <version>3.1.0</version> + </plugin> + + <plugin> <groupId>com.mycila</groupId> <artifactId>license-maven-plugin</artifactId> <version>${license-maven-plugin.version}</version>
