mirror of https://github.com/apache/jclouds.git
JCLOUDS-75: Support '-incubating' release versions
This commit is contained in:
parent
5adc0b963e
commit
a3eea35e53
|
@ -38,9 +38,13 @@ public class JcloudsVersion {
|
|||
static final String VERSION_RESOURCE_FILE = "META-INF/maven/org.apache.jclouds/jclouds-core/pom.properties";
|
||||
private static final String VERSION_PROPERTY_NAME = "version";
|
||||
|
||||
// x.y.z or x.y.z-alpha.n or x.y.z-beta.n or x.y.z-rc.n or x.y.z-SNAPSHOT - see http://semver.org
|
||||
/*
|
||||
* x.y.z or x.y.z-incubating or x.y.z-alpha.n or x.y.z-beta.n or x.y.z-rc.n or x.y.z-SNAPSHOT -
|
||||
* see http://semver.org. Note that x.y.z-incubating does *not* meet the
|
||||
* semver criteria for a *release* version.
|
||||
*/
|
||||
private static final Pattern SEMANTIC_VERSION_PATTERN =
|
||||
Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)(?:-(alpha|beta|rc)\\.(\\d+)|-SNAPSHOT)?");
|
||||
Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)(?:-(alpha|beta|rc)\\.(\\d+)|-incubating|-SNAPSHOT)?");
|
||||
private static final String ALPHA_VERSION_IDENTIFIER = "alpha";
|
||||
private static final String BETA_VERSION_IDENTIFIER = "beta";
|
||||
|
||||
|
|
|
@ -68,6 +68,16 @@ public class JcloudsVersionTest {
|
|||
new JcloudsVersion("1.2.3-rc.4-SNAPSHOT");
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = { IllegalArgumentException.class })
|
||||
public void testFailsIfIncubatingSnapshot() {
|
||||
new JcloudsVersion("1.2.3-incubating-SNAPSHOT");
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = { IllegalArgumentException.class })
|
||||
public void testFailsIfNumberedIncubating() {
|
||||
new JcloudsVersion("1.2.3-incubating.1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtractsVersionFromResourceFile() {
|
||||
JcloudsVersion version = new JcloudsVersion();
|
||||
|
@ -99,9 +109,21 @@ public class JcloudsVersionTest {
|
|||
JcloudsVersion version = new JcloudsVersion("1.2.3");
|
||||
assertFalse(version.alpha, "Expected non-alpha");
|
||||
assertFalse(version.beta, "Expected non-beta");
|
||||
assertFalse(version.releaseCandidate, "Expected non-release candidate");
|
||||
assertNull(version.alphaVersion);
|
||||
assertNull(version.betaVersion);
|
||||
assertNull(version.releaseCandidateVersion);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSupportsIncubatingReleaseVersion() {
|
||||
// *not* a semver-compliant release version!
|
||||
JcloudsVersion version = new JcloudsVersion("1.2.3-incubating");
|
||||
assertFalse(version.alpha, "Expected non-alpha");
|
||||
assertFalse(version.beta, "Expected non-beta");
|
||||
assertFalse(version.releaseCandidate, "Expected non-release candidate");
|
||||
assertNull(version.alphaVersion);
|
||||
assertNull(version.betaVersion);
|
||||
assertNull(version.releaseCandidateVersion);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue