Search in sources :

Example 46 with ComponentInfo

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

the class UpgradeTest method testIgnoreUnsatisfiedComponentCommandline.

/**
 * Checks "gu upgrade". Should select 1.0.1.0 with ruby 1.0.1.1 since in newer Graals Ruby is
 * not available
 */
@Test
public void testIgnoreUnsatisfiedComponentCommandline() throws Exception {
    initVersion("1.0.0.0");
    ComponentInfo ci = new ComponentInfo("org.graalvm.ruby", "Installed Ruby", "1.0.0.0");
    storage.installed.add(ci);
    options.put(Commands.OPTION_IGNORE_MISSING_COMPONENTS, "");
    UpgradeCommand cmd = new UpgradeCommand();
    cmd.init(this, this);
    cmd.execute();
    Version installedGraalVMVersion = cmd.getProcess().getNewGraalRegistry().getGraalVersion();
    assertEquals("1.1.1-0.rc.1", installedGraalVMVersion.originalString());
    assertNull("Ruby should not be migrated", cmd.getProcess().getNewGraalRegistry().findComponent("ruby"));
}
Also used : Version(org.graalvm.component.installer.Version) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Example 47 with ComponentInfo

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

the class UpgradeTest method testUpgradeToNewestAvailable.

/**
 * Checks "gu upgrade". Should select 1.0.1.0 with ruby 1.0.1.1 since in newer Graals Ruby is
 * not available
 */
@Test
public void testUpgradeToNewestAvailable() throws Exception {
    initVersion("1.0.0.0");
    ComponentInfo ci = new ComponentInfo("org.graalvm.ruby", "Installed Ruby", "1.0.0.0");
    storage.installed.add(ci);
    UpgradeCommand cmd = new UpgradeCommand();
    cmd.init(this, this);
    cmd.execute();
    Version installedGraalVMVersion = cmd.getProcess().getNewGraalRegistry().getGraalVersion();
    Version installedRubyVersion = cmd.getProcess().getNewGraalRegistry().findComponent("ruby").getVersion();
    assertEquals("1.0.1.0", installedGraalVMVersion.toString());
    assertEquals("1.0.1.1", installedRubyVersion.toString());
}
Also used : Version(org.graalvm.component.installer.Version) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Example 48 with ComponentInfo

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

the class UpgradeTest method testInstallNewWithoutCoreUpgrade.

/**
 * Upgrade command is used to install a new component, but the core is most recent one and need
 * not to be upgraded. Component must go to the existing install.
 *
 * @throws Exception
 */
@Test
public void testInstallNewWithoutCoreUpgrade() throws Exception {
    initVersion("1.0.1.0");
    textParams.add("ruby");
    UpgradeCommand cmd = new UpgradeCommand();
    cmd.init(this, this);
    helper = cmd.getProcess();
    ComponentInfo info = cmd.configureProcess();
    assertNotNull(info);
    // will not install core
    assertFalse(helper.installGraalCore(info));
    assertNull(helper.getTargetInfo());
    // found the current graalvm:
    assertEquals(getLocalRegistry().getGraalVersion(), info.getVersion());
    List<ComponentParam> toDownload = helper.allComponents();
    // no component (e.g. migration) was added, requested ruby is in there
    assertEquals(1, toDownload.size());
    assertEquals("org.graalvm.ruby", toDownload.get(0).getShortName());
}
Also used : ComponentParam(org.graalvm.component.installer.ComponentParam) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Example 49 with ComponentInfo

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

the class UpgradeTest method testUpgradeToCompatibleVersionCommandline.

/**
 * Tests "gu upgrade 1.0.1" on 1.0.1 installation. 1.0.1 core should be installed with ruby
 * 1.0.1.1
 */
@Test
public void testUpgradeToCompatibleVersionCommandline() throws Exception {
    initVersion("1.0.0.0");
    textParams.add("1.0.1");
    ComponentInfo ci = new ComponentInfo("org.graalvm.ruby", "Installed Ruby", "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 ruby = newReg.findComponent("ruby");
    assertEquals("1.0.1.1", ruby.getVersion().toString());
}
Also used : ComponentRegistry(org.graalvm.component.installer.model.ComponentRegistry) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Example 50 with ComponentInfo

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

the class UpgradeTest method testUpgradeFromDevToSpecificVersion2.

/**
 * Checks that upgrade will install graal for the specific Component.
 */
@Test
public void testUpgradeFromDevToSpecificVersion2() throws Exception {
    initVersion("1.0.0-dev");
    textParams.add("python=1.0.1");
    UpgradeCommand cmd = new UpgradeCommand();
    cmd.init(this, this);
    ComponentInfo graalInfo = cmd.configureProcess();
    assertNotNull(graalInfo);
    // check that GraalVM appropriate for 1.0.1 component is selected
    assertEquals("1.0.1.0", graalInfo.getVersion().toString());
    assertEquals(1, cmd.getProcess().addedComponents().size());
    ComponentParam p = cmd.getProcess().addedComponents().iterator().next();
    ComponentInfo ci = p.createMetaLoader().getComponentInfo();
    // check that component 1.0.1 will be installed
    assertEquals("1.0.1.0", ci.getVersion().toString());
}
Also used : ComponentParam(org.graalvm.component.installer.ComponentParam) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Aggregations

ComponentInfo (org.graalvm.component.installer.model.ComponentInfo)149 Test (org.junit.Test)94 Path (java.nio.file.Path)36 Version (org.graalvm.component.installer.Version)28 HashSet (java.util.HashSet)20 ArrayList (java.util.ArrayList)19 ComponentParam (org.graalvm.component.installer.ComponentParam)19 IOException (java.io.IOException)13 URL (java.net.URL)11 MetadataLoader (org.graalvm.component.installer.persist.MetadataLoader)10 InputStream (java.io.InputStream)9 HashMap (java.util.HashMap)9 Collection (java.util.Collection)8 List (java.util.List)8 Properties (java.util.Properties)8 Map (java.util.Map)7 Set (java.util.Set)7 Collections (java.util.Collections)6 FailedOperationException (org.graalvm.component.installer.FailedOperationException)6 SystemUtils (org.graalvm.component.installer.SystemUtils)6