Search in sources :

Example 11 with ComponentRegistry

use of org.graalvm.component.installer.model.ComponentRegistry in project graal by oracle.

the class UpgradeTest method testUpgradeToNextRC.

/**
 * Tests upgrade to a next version's RC.
 */
@Test
public void testUpgradeToNextRC() throws Exception {
    initVersion("1.0.0.0");
    textParams.add("1.1.1-rc");
    UpgradeCommand cmd = new UpgradeCommand();
    cmd.init(this, this);
    assertEquals(0, cmd.execute());
    ComponentRegistry newReg = cmd.getProcess().getNewGraalRegistry();
    assertEquals("1.1.1.0-0.rc.1", newReg.getGraalVersion().toString());
}
Also used : ComponentRegistry(org.graalvm.component.installer.model.ComponentRegistry) Test(org.junit.Test)

Example 12 with ComponentRegistry

use of org.graalvm.component.installer.model.ComponentRegistry in project graal by oracle.

the class UpgradeTest method testUpgradeExact.

/**
 * Tests upgrade to version EXACTLY 1.0.1.
 */
@Test
public void testUpgradeExact() throws Exception {
    initVersion("1.0.0.0");
    textParams.add("python=1.0.1");
    ComponentInfo ci = new ComponentInfo("org.graalvm.python", "Installed Python", "1.0.0.0");
    storage.installed.add(ci);
    UpgradeCommand cmd = new UpgradeCommand();
    cmd.init(this, this);
    assertEquals(0, cmd.execute());
    ComponentRegistry newReg = cmd.getProcess().getNewGraalRegistry();
    ComponentInfo python = newReg.findComponent("python");
    // note the difference, the user string does not contain trailing .0
    assertEquals("1.0.1", python.getVersion().displayString());
}
Also used : ComponentRegistry(org.graalvm.component.installer.model.ComponentRegistry) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Example 13 with ComponentRegistry

use of org.graalvm.component.installer.model.ComponentRegistry 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 14 with ComponentRegistry

use of org.graalvm.component.installer.model.ComponentRegistry in project graal by oracle.

the class UpgradeTest method testUpgradeIfAllowsNewer.

/**
 * Tests NO upgrade to RC when requesting a release.
 */
@Test
public void testUpgradeIfAllowsNewer() throws Exception {
    initVersion("1.0.0.0");
    textParams.add("+1.1.1");
    UpgradeCommand cmd = new UpgradeCommand();
    cmd.init(this, this);
    assertEquals(0, cmd.execute());
    ComponentRegistry newReg = cmd.getProcess().getNewGraalRegistry();
    assertEquals("1.1.1.0-0.rc.1", newReg.getGraalVersion().toString());
}
Also used : ComponentRegistry(org.graalvm.component.installer.model.ComponentRegistry) Test(org.junit.Test)

Example 15 with ComponentRegistry

use of org.graalvm.component.installer.model.ComponentRegistry 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)

Aggregations

ComponentRegistry (org.graalvm.component.installer.model.ComponentRegistry)16 Test (org.junit.Test)8 CatalogContents (org.graalvm.component.installer.model.CatalogContents)5 ComponentInfo (org.graalvm.component.installer.model.ComponentInfo)5 Path (java.nio.file.Path)4 List (java.util.List)4 CommandInput (org.graalvm.component.installer.CommandInput)4 ComponentCatalog (org.graalvm.component.installer.ComponentCatalog)4 URL (java.net.URL)3 RemoteCatalogDownloader (org.graalvm.component.installer.remote.RemoteCatalogDownloader)3 SoftwareChannelSource (org.graalvm.component.installer.SoftwareChannelSource)2 Version (org.graalvm.component.installer.Version)2 DirectoryStorage (org.graalvm.component.installer.persist.DirectoryStorage)2 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Properties (java.util.Properties)1 ComponentInstaller (org.graalvm.component.installer.ComponentInstaller)1 ComponentParam (org.graalvm.component.installer.ComponentParam)1 FailedOperationException (org.graalvm.component.installer.FailedOperationException)1 Feedback (org.graalvm.component.installer.Feedback)1