HttpRepository implements Repository { private String upgrade(String path, String version, Pattern versionPattern, String defaultPackaging) { if (versionPattern != null) { String newConfig = upgradePath(path, version, versionPattern); if (newConfig != null && toHttpUri(newConfig, defaultPackaging) != null) { return newConfig; } } URI uri = toHttpUri(version, defaultPackaging); if (uri != null) { return version; } return null; } @Inject  HttpRepository(CoordinatorConfig config);  HttpRepository(Iterable<URI> baseUris, String configShortNamePattern, String configVersionPattern, String binaryVersionPattern); @Override String configShortName(String config); @Override String configRelativize(String config); @Override String configResolve(String config); @Override String configUpgrade(String config, String version); @Override boolean configEqualsIgnoreVersion(String config1, String config2); @Override URI configToHttpUri(String config); @Override String binaryRelativize(String binary); @Override String binaryResolve(String binary); @Override String binaryUpgrade(String binary, String version); @Override boolean binaryEqualsIgnoreVersion(String binary1, String binary2); @Override URI binaryToHttpUri(String binary); static String upgradePath(String spec, String version, Pattern versionPattern); @Override String toString();  }
@Test public void upgrade() throws Exception { Assert.assertEquals(repo.configUpgrade("@apple-1.0.tar.gz", "@2.0"), "@apple-2.0.tar.gz"); Assert.assertEquals(repo.binaryUpgrade("apple-1.0.tar.gz", "2.0"), "apple-2.0.tar.gz"); Assert.assertEquals(repo.configUpgrade("@apple-1.0.tar.gz", "@banana-2.0-SNAPSHOT.tar.gz"), "@banana-2.0-SNAPSHOT.tar.gz"); Assert.assertEquals(repo.binaryUpgrade("apple-1.0.tar.gz", "banana-2.0-SNAPSHOT.tar.gz"), "banana-2.0-SNAPSHOT.tar.gz"); Assert.assertEquals(repo.configUpgrade("@" + new File(repo.getTargetRepo(), "apple-1.0.tar.gz").toURI().toASCIIString(), "@2.0"), "@" + new File(repo.getTargetRepo(), "apple-2.0.tar.gz").toURI().toASCIIString()); Assert.assertEquals(repo.binaryUpgrade(new File(repo.getTargetRepo(), "apple-1.0.tar.gz").toURI().toASCIIString(), "2.0"), new File(repo.getTargetRepo(), "apple-2.0.tar.gz").toURI().toASCIIString()); }