Dropped support for non-semver compliant 'x.y.z-rc-n' RC versions

This commit is contained in:
Andrew Phillips 2012-01-16 13:26:33 -05:00
parent 2f2953c603
commit 6b1e8cee34
2 changed files with 9 additions and 18 deletions

View File

@ -39,10 +39,9 @@ public class JcloudsVersion {
static final String VERSION_RESOURCE_FILE = "META-INF/maven/org.jclouds/jclouds-core/pom.properties";
private static final String VERSION_PROPERTY_NAME = "version";
// TODO: stop supporting x.y.z-rc-n after the 1.3.0 release
// x.y.z or x.y.z-rc.n or x.y.z-rc-n, optionally with -SNAPSHOT suffix - see http://semver.org
// x.y.z or x.y.z-rc.n, optionally with -SNAPSHOT suffix - see http://semver.org
private static final Pattern SEMANTIC_VERSION_PATTERN =
Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)(?:-rc[-\\.](\\d+))?(?:-SNAPSHOT)?");
Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)(?:-rc\\.(\\d+))?(?:-SNAPSHOT)?");
private static final JcloudsVersion INSTANCE = new JcloudsVersion();

View File

@ -54,6 +54,12 @@ public class JcloudsVersionTest {
new JcloudsVersion("${project.version}");
}
@Test(expectedExceptions = { IllegalArgumentException.class })
public void testFailsIfNonSemverReleaseCandidate() {
// no longer supported after the 1.3.0 RC cycle
new JcloudsVersion("1.2.3-rc-4");
}
@Test
public void testExtractsVersionFromResourceFile() {
JcloudsVersion version = new JcloudsVersion();
@ -93,29 +99,15 @@ public class JcloudsVersionTest {
assertTrue(version.releaseCandidate, "Expected release candidate");
}
// TODO: remove once x.y.z-rc-n support is dropped after 1.3.0
@Test
public void testRecognisesNonSemverReleaseCandidate() {
JcloudsVersion version = new JcloudsVersion("1.2.3-rc-4");
assertTrue(version.releaseCandidate, "Expected release candidate");
}
@Test
public void testExtractsReleaseCandidateVersion() {
JcloudsVersion version = new JcloudsVersion("1.2.3-rc.4");
assertEquals(Integer.valueOf(4), version.releaseCandidateVersion);
}
// TODO: remove once x.y.z-rc-n support is dropped after 1.3.0
@Test
public void testExtractsNonSemverReleaseCandidateVersion() {
JcloudsVersion version = new JcloudsVersion("1.2.3-rc-4");
assertEquals(Integer.valueOf(4), version.releaseCandidateVersion);
}
@Test
public void testRecognisesReleaseCandidateSnapshot() {
JcloudsVersion version = new JcloudsVersion("1.2.3-rc-4-SNAPSHOT");
JcloudsVersion version = new JcloudsVersion("1.2.3-rc.4-SNAPSHOT");
assertTrue(version.releaseCandidate, "Expected release candidate");
assertTrue(version.snapshot, "Expected snapshot");
}