Search in sources :

Example 11 with ComponentInfo

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

the class CatalogInstallTest method testTwoSameComponentsCommandLineDepsCommon.

private void testTwoSameComponentsCommandLineDepsCommon() throws Exception {
    paramIterable = new CatalogIterable(this, this);
    textParams.add("r");
    textParams.add("r");
    InstallCommand cmd = new InstallCommand();
    cmd.init(this, withBundle(InstallCommand.class));
    cmd.executionInit();
    cmd.executeStep(cmd::prepareInstallation, false);
    cmd.executeStep(cmd::completeInstallers, false);
    List<Installer> instSequence = cmd.getInstallers();
    assertEquals(2, instSequence.size());
    ComponentInfo ci = instSequence.get(0).getComponentInfo();
    assertEquals("org.graalvm.llvm-toolchain", ci.getId());
    ci = instSequence.get(1).getComponentInfo();
    assertEquals("org.graalvm.r", ci.getId());
}
Also used : ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) CatalogIterable(org.graalvm.component.installer.remote.CatalogIterable)

Example 12 with ComponentInfo

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

the class CatalogInstallTest method testDepsBeforeUsageCommon.

private void testDepsBeforeUsageCommon() throws Exception {
    paramIterable = new CatalogIterable(this, this);
    textParams.add("ruby");
    InstallCommand cmd = new InstallCommand();
    cmd.init(this, withBundle(InstallCommand.class));
    cmd.executionInit();
    cmd.executeStep(cmd::prepareInstallation, false);
    cmd.executeStep(cmd::completeInstallers, false);
    List<Installer> instSequence = cmd.getInstallers();
    assertEquals(3, instSequence.size());
    ComponentInfo ci = instSequence.get(0).getComponentInfo();
    assertEquals("org.graalvm.llvm-toolchain", ci.getId());
    ci = instSequence.get(1).getComponentInfo();
    assertEquals("org.graalvm.native-image", ci.getId());
    ci = instSequence.get(2).getComponentInfo();
    assertEquals("org.graalvm.ruby", ci.getId());
}
Also used : ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) CatalogIterable(org.graalvm.component.installer.remote.CatalogIterable)

Example 13 with ComponentInfo

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

the class CatalogInstallTest method testRejectNewerInstallVersion.

/**
 * Version 20.3.0 should not accept 20.3.1 (20.3.1.2, 20.3.1.3, ...) components.
 *
 * @throws Exception
 */
@Test
public void testRejectNewerInstallVersion() throws Exception {
    storage.graalInfo.put(CommonConstants.CAP_GRAALVM_VERSION, "20.3.0");
    setupCatalog("data/catalog21patch.properties");
    textParams.add("llvm-toolchain");
    paramIterable = new CatalogIterable(this, this);
    Iterator<ComponentParam> params = paramIterable.iterator();
    assertTrue(params.hasNext());
    ComponentParam toolchainParam = params.next();
    ComponentInfo toolchainInfo = toolchainParam.createMetaLoader().getComponentInfo();
    assertNotNull(toolchainInfo);
    assertEquals("org.graalvm.llvm-toolchain", toolchainInfo.getId());
    assertEquals("Only release is compatible", "20.3.0", toolchainInfo.getVersion().displayString());
}
Also used : ComponentParam(org.graalvm.component.installer.ComponentParam) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) CatalogIterable(org.graalvm.component.installer.remote.CatalogIterable) Test(org.junit.Test)

Example 14 with ComponentInfo

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

the class CatalogInstallTest method testAcceptCompatibleOlders.

/**
 * Checks that older versions are acceptable.
 *
 * @throws Exception
 */
@Test
public void testAcceptCompatibleOlders() throws Exception {
    storage.graalInfo.put(CommonConstants.CAP_GRAALVM_VERSION, "21.0.0.2");
    setupCatalog("data/catalog21patch.properties");
    Collection<ComponentInfo> infos;
    infos = registry.loadComponents("r", localRegistry.getGraalVersion().match(Version.Match.Type.INSTALLABLE), false);
    assertEquals("1 older version ", 1, infos.size());
    assertEquals("21.0.0", infos.iterator().next().getVersion().displayString());
    infos = registry.loadComponents("python", localRegistry.getGraalVersion().match(Version.Match.Type.INSTALLABLE), false);
    assertEquals("2 older and current versions ", 2, infos.size());
    assertNotNull("21.0.0.2 present", findVersion(infos, "21.0.0.2"));
    assertNotNull("21.0.0.0 present", findVersion(infos, "21.0.0.0"));
    textParams.add("python");
    paramIterable = new CatalogIterable(this, this);
    Iterator<ComponentParam> params = paramIterable.iterator();
    ComponentParam pythonParam = params.next();
    ComponentInfo pythonInfo = pythonParam.createMetaLoader().getComponentInfo();
    assertNotNull(pythonInfo);
    assertEquals("Current version offered", "21.0.0.2", pythonInfo.getVersion().toString());
}
Also used : ComponentParam(org.graalvm.component.installer.ComponentParam) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) CatalogIterable(org.graalvm.component.installer.remote.CatalogIterable) Test(org.junit.Test)

Example 15 with ComponentInfo

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

the class CatalogInstallTest method testAcceptsNewerPatchInstallVersion.

@Test
public void testAcceptsNewerPatchInstallVersion() throws Exception {
    storage.graalInfo.put(CommonConstants.CAP_GRAALVM_VERSION, "21.0.0.0");
    setupCatalog("data/catalog21patch.properties");
    textParams.add("ruby");
    textParams.add("python");
    Collection<ComponentInfo> infos = registry.loadComponents("ruby", localRegistry.getGraalVersion().match(Version.Match.Type.COMPATIBLE), false);
    assertEquals("Release and patch ruby available", 2, infos.size());
    paramIterable = new CatalogIterable(this, this);
    Iterator<ComponentParam> params = paramIterable.iterator();
    assertTrue(params.hasNext());
    ComponentParam rubyParam = params.next();
    ComponentInfo rubyInfo = rubyParam.createMetaLoader().getComponentInfo();
    assertNotNull(rubyInfo);
    assertEquals("org.graalvm.ruby", rubyInfo.getId());
    assertEquals("Only release is compatible", "21.0.0", rubyInfo.getVersion().displayString());
    ComponentParam pythonParam = params.next();
    ComponentInfo pythonInfo = pythonParam.createMetaLoader().getComponentInfo();
    assertNotNull(pythonInfo);
    assertEquals("org.graalvm.python", pythonInfo.getId());
    assertEquals("Patch can be installed", "21.0.0.2", pythonInfo.getVersion().displayString());
}
Also used : ComponentParam(org.graalvm.component.installer.ComponentParam) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) CatalogIterable(org.graalvm.component.installer.remote.CatalogIterable) 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