Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Sievers2013-09-03 10:20:25 -0400
committerJan Sievers2013-09-03 10:20:25 -0400
commit0e812461b1412c0c53818774b18256e06fc65122 (patch)
tree75da413095a1bcdc6202358c15cccb6dfeb46910
parentc900917f72cf5e2f459aab246e532b67801cfcbe (diff)
downloadorg.eclipse.tycho.nexus-0e812461b1412c0c53818774b18256e06fc65122.tar.gz
org.eclipse.tycho.nexus-0e812461b1412c0c53818774b18256e06fc65122.tar.xz
org.eclipse.tycho.nexus-0e812461b1412c0c53818774b18256e06fc65122.zip
Fix unzip cache for virtual version SNAPSHOT
Signed-off-by: Jan Sievers <jan.sievers@sap.com> Also-by: Matthias Vach <matthias.vach@sap.com> Bug: 405154 Change-Id: I314ba868ee9846e4a0491422bebd0984caf24fca
-rw-r--r--unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/cache/LatestVersionRequest.java6
-rw-r--r--unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/cache/LatestVersionConverterTest.java8
2 files changed, 9 insertions, 5 deletions
diff --git a/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/cache/LatestVersionRequest.java b/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/cache/LatestVersionRequest.java
index 452d9b5..f7d8f5d 100644
--- a/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/cache/LatestVersionRequest.java
+++ b/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/cache/LatestVersionRequest.java
@@ -84,11 +84,11 @@ public class LatestVersionRequest extends ParsedRequest {
throw new LocalStorageException(metadataPath(latestVersionDirectory)
+ " does not contain current information in repository " + repository.getId());
}
- final String latestVersionWithoutSnapshot = latestVersion.substring(0,
- latestVersion.length() - "-SNAPSHOT".length());
+ final String latestVersionWithoutSnapshot =
+ latestVersion.substring(0, latestVersion.length() - "-SNAPSHOT".length());
final String pathUpToVersion = latestVersionDirectory + artifactNameStart + "-" + latestVersionWithoutSnapshot;
final String convertedPath = pathUpToVersion + "-" + latestTimestampVersion + artifactNameEnd;
- return new ConversionResult(request.getRequestPath(), convertedPath, latestVersion + "-"
+ return new ConversionResult(request.getRequestPath(), convertedPath, latestVersionWithoutSnapshot + "-"
+ latestTimestampVersion, pathUpToVersion);
}
diff --git a/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/cache/LatestVersionConverterTest.java b/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/cache/LatestVersionConverterTest.java
index 1cf9a32..cd6fe73 100644
--- a/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/cache/LatestVersionConverterTest.java
+++ b/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/cache/LatestVersionConverterTest.java
@@ -11,6 +11,7 @@
package org.eclipse.tycho.nexus.internal.plugin.cache;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.FileInputStream;
@@ -116,14 +117,17 @@ public class LatestVersionConverterTest {
}
private void assertPathConvertion(final ResourceStoreRequest request, final String convertedPath,
- final boolean isPathConverted) throws Exception {
+ final boolean pathConversionExpected) throws Exception {
final MavenRepository repositoryMock =
createRepositoryMock("org/eclipse/tycho/nexus/org.eclipse.tycho.example.target/",
"org/eclipse/tycho/nexus/org.eclipse.tycho.example.target/0.7.1-SNAPSHOT/",
"org/eclipse/tycho/nexus/org.eclipse.tycho.example.target/0.6.1-SNAPSHOT/");
final ConversionResult conversionResult = RequestPathConverter.convert(repositoryMock, request, true);
- assertEquals(isPathConverted, conversionResult.isPathConverted());
+ assertEquals(pathConversionExpected, conversionResult.isPathConverted());
assertEquals(convertedPath, conversionResult.getConvertedPath());
+ if (pathConversionExpected) {
+ assertTrue(convertedPath.contains(conversionResult.getLatestVersion()));
+ }
}
@SuppressWarnings("unchecked")

Back to the top