kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 82f0202f1f0c71a63728e56009765173d5bb14775324316dcd08022f33f2f659 |
|---|---|
| Author | Alexandre Dutra <alexdut@gmail.com> · 2015-10-28 11:59 +01:00 |
| Committer | Alexandre Dutra <alexdut@gmail.com> · 2015-10-28 11:59 +01:00 |
| Parents | 52598c92fd08, 85df6a78b838 |
2 files changed
modified driver-examples/osgi/src/test/java/com/datastax/driver/osgi/MailboxServiceIT.java +1 −21
| @@ -54,7 +54,7 @@ | ||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | private MavenArtifactProvisionOption guavaBundle() { |
| 57 | - return mavenBundle("com.google.guava", "guava", "14.0.1"); | |
| 57 | + return mavenBundle("com.google.guava", "guava", "16.0.1"); | |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | private CompositeOption nettyBundles() { |
| @@ -109,26 +109,6 @@ | ||
| 109 | 109 | ); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - @Configuration | |
| 113 | - public Option[] guava15Config() { | |
| 114 | - return options( | |
| 115 | - driverBundle(), | |
| 116 | - nettyBundles(), | |
| 117 | - guavaBundle().version("15.0"), | |
| 118 | - defaultOptions() | |
| 119 | - ); | |
| 120 | - } | |
| 121 | - | |
| 122 | - @Configuration | |
| 123 | - public Option[] guava16Config() { | |
| 124 | - return options( | |
| 125 | - driverBundle(), | |
| 126 | - nettyBundles(), | |
| 127 | - guavaBundle().version("16.0.1"), | |
| 128 | - defaultOptions() | |
| 129 | - ); | |
| 130 | - } | |
| 131 | - | |
| 132 | 112 | @Configuration |
| 133 | 113 | public Option[] guava17Config() { |
| 134 | 114 | return options( |
modified driver-examples/osgi/src/test/java/com/datastax/driver/osgi/VersionProvider.java +19 −2
| @@ -15,6 +15,9 @@ | ||
| 15 | 15 | */ |
| 16 | 16 | package com.datastax.driver.osgi; |
| 17 | 17 | |
| 18 | +import java.util.regex.Matcher; | |
| 19 | +import java.util.regex.Pattern; | |
| 20 | + | |
| 18 | 21 | import com.jcabi.manifests.Manifests; |
| 19 | 22 | |
| 20 | 23 | /** |
| @@ -25,11 +28,25 @@ | ||
| 25 | 28 | */ |
| 26 | 29 | public class VersionProvider { |
| 27 | 30 | |
| 28 | - private static String PROJECT_VERSION; | |
| 31 | + private static final Pattern versionPattern = Pattern.compile(("(\\d+.\\d+\\.\\d+)(.*)")); | |
| 32 | + | |
| 33 | + private static final String PROJECT_VERSION; | |
| 29 | 34 | static { |
| 30 | 35 | String bundleName = Manifests.read("Bundle-SymbolicName"); |
| 31 | 36 | if (bundleName.equals("com.datastax.driver.osgi")) { |
| 32 | - PROJECT_VERSION = Manifests.read("Bundle-Version").replaceAll("\\.SNAPSHOT", "-SNAPSHOT"); | |
| 37 | + String bundleVersion = Manifests.read("Bundle-Version"); | |
| 38 | + Matcher matcher = versionPattern.matcher(bundleVersion); | |
| 39 | + if(matcher.matches()) { | |
| 40 | + String majorVersion = matcher.group(1); | |
| 41 | + // Replace all instances of '.' after the main version with '-' to properly | |
| 42 | + // resolve the correct version. | |
| 43 | + String rest = matcher.group(2).replaceAll("\\.", "-"); | |
| 44 | + PROJECT_VERSION = majorVersion + rest; | |
| 45 | + } else { | |
| 46 | + // This should never happen, but if we are using a non X.Y.Z version number | |
| 47 | + // we'll just back off to the bundle version. | |
| 48 | + PROJECT_VERSION = bundleVersion; | |
| 49 | + } | |
| 33 | 50 | } else { |
| 34 | 51 | throw new RuntimeException("Couldn't resolve bundle manifest (try building with mvn compile)"); |
| 35 | 52 | } |