use of org.graalvm.component.installer.remote.RemoteCatalogDownloader in project graal by oracle.
the class UpgradeTest method initVersion.
private Version initVersion(String s, String catalogResource) throws IOException {
Version v = Version.fromString(s);
storage.graalInfo.put(BundleConstants.GRAAL_VERSION, s);
Path catalogPath = dataFile(catalogResource);
downloader = new RemoteCatalogDownloader(this, this, catalogPath.toUri().toURL());
registry = new CatalogContents(this, downloader.getStorage(), localRegistry);
paramIterable = new CatalogIterable(this, this);
helper = new UpgradeProcess(this, this, registry);
return v;
}
use of org.graalvm.component.installer.remote.RemoteCatalogDownloader in project graal by oracle.
the class CatalogIterableTest method setupCatalog.
private void setupCatalog() throws Exception {
this.storage.graalInfo.put(BundleConstants.GRAAL_VERSION, "19.3-dev");
String relSpec = "commands/cataloginstallDeps.properties";
URL u = getClass().getResource(relSpec);
Handler.bind(TEST_CATALOG_URL, u);
downloader = new RemoteCatalogDownloader(this, this, new URL(TEST_CATALOG_URL));
this.registry = new CatalogContents(this, downloader.getStorage(), getLocalRegistry());
}
use of org.graalvm.component.installer.remote.RemoteCatalogDownloader in project graal by oracle.
the class UpgradeTest method testUpgradeWithDependencies.
/**
* Upgrade an installation with "ruby" to a newer one, where "ruby" has a dependency on an
* additional component. The other component should be auto-installed.
*/
@Test
public void testUpgradeWithDependencies() throws Exception {
initVersion("1.0.0.0", "../repo/catalog-19.3.properties");
ComponentInfo ci = new ComponentInfo("org.graalvm.r", "Installed R", "1.0.0.0");
storage.installed.add(ci);
UpgradeCommand cmd = new UpgradeCommand();
cmd.init(this, this);
textParams.add("r");
ComponentInfo graalInfo = cmd.configureProcess();
assertNotNull(graalInfo);
assertEquals(Version.fromString("19.3.0.0"), graalInfo.getVersion());
boolean installed = cmd.getProcess().installGraalCore(graalInfo);
assertTrue(installed);
factory = new CatalogFactory() {
@Override
public ComponentCatalog createComponentCatalog(CommandInput in) {
RemoteCatalogDownloader dnl = new RemoteCatalogDownloader(in, UpgradeTest.this, downloader.getOverrideCatalogSpec());
// carry over the override spec
return new CatalogContents(UpgradeTest.this, dnl.getStorage(), in.getLocalRegistry());
}
@Override
public List<GraalEdition> listEditions(ComponentRegistry targetGraalVM) {
return Collections.emptyList();
}
};
InstallTrampoline targetInstall = new InstallTrampoline();
cmd.getProcess().configureInstallCommand(targetInstall);
targetInstall.executionInit();
targetInstall.prepareInstallation();
assertTrue(targetInstall.getUnresolvedDependencies().isEmpty());
List<ComponentParam> deps = targetInstall.getDependencies();
assertEquals(1, deps.size());
MetadataLoader ldr = deps.iterator().next().createFileLoader();
assertEquals("org.graalvm.llvm-toolchain", ldr.getComponentInfo().getId());
}
use of org.graalvm.component.installer.remote.RemoteCatalogDownloader in project graal by oracle.
the class UpgradeTest method testUpgradeRespectsTargetCatalogURLs.
/**
* The target GraalVM installation may have configured the catalog URLs differently. When
* installing components or dependencies to the target, the target's URLs / release file
* settings should be respected.
*
* @throws Exception
*/
@Test
public void testUpgradeRespectsTargetCatalogURLs() throws Exception {
URL u = new URL("test://catalog-19.3.properties");
Handler.bind(u.toString(), dataFile("../repo/catalog-19.3.properties").toUri().toURL());
initVersion("1.0.0.0", "../repo/catalog-19.3.properties");
ComponentInfo ci = new ComponentInfo("org.graalvm.r", "Installed R", "1.0.0.0");
storage.installed.add(ci);
UpgradeCommand cmd = new UpgradeCommand();
cmd.init(this, this);
ComponentInfo graalInfo = cmd.configureProcess();
boolean installed = cmd.getProcess().installGraalCore(graalInfo);
assertTrue(installed);
factory = new CatalogFactory() {
@Override
public ComponentCatalog createComponentCatalog(CommandInput in) {
RemoteCatalogDownloader dnl = new RemoteCatalogDownloader(in, UpgradeTest.this, (String) null);
return new CatalogContents(UpgradeTest.this, dnl.getStorage(), in.getLocalRegistry());
}
@Override
public List<GraalEdition> listEditions(ComponentRegistry targetGraalVM) {
return Collections.emptyList();
}
};
InstallTrampoline targetInstall = new InstallTrampoline();
cmd.getProcess().configureInstallCommand(targetInstall);
targetInstall.executionInit();
targetInstall.prepareInstallation();
// verify the URL from the target installation was visited.
assertTrue(Handler.isVisited(u));
}
use of org.graalvm.component.installer.remote.RemoteCatalogDownloader in project graal by oracle.
the class DirectoryCatalogProviderTest method testNoErrorsWithLocalCatalogs.
/**
* Checks that the merging catalog initializes the directory provider correctly.
*
* @throws Exception
*/
@Test
public void testNoErrorsWithLocalCatalogs() throws Exception {
URL clu = getClass().getResource("data/catalog");
URL u = new URL("test://graalvm.io/download/truffleruby.zip");
Handler.bind(u.toString(), clu);
Path testData = dataFile("dir1");
SoftwareChannelSource scs = new SoftwareChannelSource(testData.toUri().toURL().toString(), "local dir");
storage.graalInfo.put(CommonConstants.CAP_GRAALVM_VERSION, "0.33-dev");
FB fb = new FB();
delegateFeedback(fb);
RemoteCatalogDownloader d = new RemoteCatalogDownloader(this, this, u);
d.addLocalChannelSource(scs);
registry = openCatalog(d);
// directory contents scanned / component found
ComponentInfo info = registry.findComponent("org.graalvm.llvm-toolchain");
assertNotNull(info);
// catalog loaded / component found
info = registry.findComponent("ruby");
assertNotNull(info);
// no errors
assertTrue(fb.errs.isEmpty());
}
Aggregations