Search in sources :

Example 6 with RemoteCatalogDownloader

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;
}
Also used : Path(java.nio.file.Path) Version(org.graalvm.component.installer.Version) CatalogContents(org.graalvm.component.installer.model.CatalogContents) RemoteCatalogDownloader(org.graalvm.component.installer.remote.RemoteCatalogDownloader) CatalogIterable(org.graalvm.component.installer.remote.CatalogIterable)

Example 7 with RemoteCatalogDownloader

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());
}
Also used : CatalogContents(org.graalvm.component.installer.model.CatalogContents) RemoteCatalogDownloader(org.graalvm.component.installer.remote.RemoteCatalogDownloader) URL(java.net.URL)

Example 8 with RemoteCatalogDownloader

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());
}
Also used : ComponentCatalog(org.graalvm.component.installer.ComponentCatalog) ComponentParam(org.graalvm.component.installer.ComponentParam) MetadataLoader(org.graalvm.component.installer.persist.MetadataLoader) CommandInput(org.graalvm.component.installer.CommandInput) ComponentRegistry(org.graalvm.component.installer.model.ComponentRegistry) CatalogContents(org.graalvm.component.installer.model.CatalogContents) RemoteCatalogDownloader(org.graalvm.component.installer.remote.RemoteCatalogDownloader) List(java.util.List) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Example 9 with RemoteCatalogDownloader

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));
}
Also used : ComponentCatalog(org.graalvm.component.installer.ComponentCatalog) URL(java.net.URL) CommandInput(org.graalvm.component.installer.CommandInput) ComponentRegistry(org.graalvm.component.installer.model.ComponentRegistry) CatalogContents(org.graalvm.component.installer.model.CatalogContents) RemoteCatalogDownloader(org.graalvm.component.installer.remote.RemoteCatalogDownloader) List(java.util.List) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Example 10 with RemoteCatalogDownloader

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());
}
Also used : Path(java.nio.file.Path) SoftwareChannelSource(org.graalvm.component.installer.SoftwareChannelSource) RemoteCatalogDownloader(org.graalvm.component.installer.remote.RemoteCatalogDownloader) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) URL(java.net.URL) Test(org.junit.Test)

Aggregations

RemoteCatalogDownloader (org.graalvm.component.installer.remote.RemoteCatalogDownloader)14 CatalogContents (org.graalvm.component.installer.model.CatalogContents)11 URL (java.net.URL)8 Path (java.nio.file.Path)8 ComponentInfo (org.graalvm.component.installer.model.ComponentInfo)6 Test (org.junit.Test)6 CatalogIterable (org.graalvm.component.installer.remote.CatalogIterable)4 List (java.util.List)3 CommandInput (org.graalvm.component.installer.CommandInput)3 ComponentCatalog (org.graalvm.component.installer.ComponentCatalog)3 SoftwareChannelSource (org.graalvm.component.installer.SoftwareChannelSource)3 Version (org.graalvm.component.installer.Version)3 ComponentRegistry (org.graalvm.component.installer.model.ComponentRegistry)3 HashSet (java.util.HashSet)1 ComponentParam (org.graalvm.component.installer.ComponentParam)1 FileIterable (org.graalvm.component.installer.FileIterable)1 MetadataLoader (org.graalvm.component.installer.persist.MetadataLoader)1