Search in sources :

Example 6 with CatalogIterable

use of org.graalvm.component.installer.remote.CatalogIterable 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 7 with CatalogIterable

use of org.graalvm.component.installer.remote.CatalogIterable 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 8 with CatalogIterable

use of org.graalvm.component.installer.remote.CatalogIterable in project graal by oracle.

the class CatalogInstallTest method testRejectMetaDontDownloadPackage.

/**
 * Checks that mismatched version is rejected based on catalog metadata, and the component URL
 * is not opened at all.
 *
 * Because of versioning support, the "ruby" will not be even identifier as available, as it
 * requires an incompatible graalvm version.
 */
@Test
public void testRejectMetaDontDownloadPackage() throws Exception {
    setupVersion("0.33-dev");
    URL rubyURL = new URL("test://release/graalvm-ruby.zip");
    Handler.bind(rubyURL.toString(), new URLConnection(rubyURL) {

        @Override
        public void connect() throws IOException {
            throw new UnsupportedOperationException("Should not be touched");
        }
    });
    exception.expect(DependencyException.Mismatch.class);
    exception.expectMessage("VERIFY_ObsoleteGraalVM");
    setupCatalog(null);
    paramIterable = new CatalogIterable(this, this);
    textParams.add("ruby");
    InstallCommand cmd = new InstallCommand();
    cmd.init(this, withBundle(InstallCommand.class));
    cmd.execute();
}
Also used : IOException(java.io.IOException) DependencyException(org.graalvm.component.installer.DependencyException) CatalogIterable(org.graalvm.component.installer.remote.CatalogIterable) URL(java.net.URL) URLConnection(java.net.URLConnection) Test(org.junit.Test)

Example 9 with CatalogIterable

use of org.graalvm.component.installer.remote.CatalogIterable in project graal by oracle.

the class CatalogInstallTest method testInstallWithBrokenDeps.

@Test
public void testInstallWithBrokenDeps() throws Exception {
    setupVersion("19.3-dev");
    setupCatalog(null);
    paramIterable = new CatalogIterable(this, this);
    textParams.add("additional");
    InstallCommand cmd = new InstallCommand();
    cmd.init(this, withBundle(InstallCommand.class));
    cmd.executionInit();
    exception.expect(FailedOperationException.class);
    exception.expectMessage("INSTALL_UnresolvedDependencies");
    try {
        cmd.executeStep(cmd::prepareInstallation, false);
    } catch (FailedOperationException ex) {
        Set<String> u = cmd.getUnresolvedDependencies();
        assertFalse(u.isEmpty());
        assertEquals("org.graalvm.unknown", u.iterator().next());
        throw ex;
    }
}
Also used : FailedOperationException(org.graalvm.component.installer.FailedOperationException) Set(java.util.Set) CatalogIterable(org.graalvm.component.installer.remote.CatalogIterable) Test(org.junit.Test)

Example 10 with CatalogIterable

use of org.graalvm.component.installer.remote.CatalogIterable 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

CatalogIterable (org.graalvm.component.installer.remote.CatalogIterable)33 Test (org.junit.Test)22 ComponentInfo (org.graalvm.component.installer.model.ComponentInfo)7 URL (java.net.URL)5 ComponentParam (org.graalvm.component.installer.ComponentParam)5 CatalogContents (org.graalvm.component.installer.model.CatalogContents)5 IOException (java.io.IOException)4 Path (java.nio.file.Path)4 ArrayList (java.util.ArrayList)4 RemoteCatalogDownloader (org.graalvm.component.installer.remote.RemoteCatalogDownloader)4 URLConnection (java.net.URLConnection)3 Version (org.graalvm.component.installer.Version)3 GraalEditionList (org.graalvm.component.installer.remote.GraalEditionList)2 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 InputStream (java.io.InputStream)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 CommandInput (org.graalvm.component.installer.CommandInput)1