Search in sources :

Example 1 with CatalogIterable

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

the class CatalogInstallTest method testInstallDepsOnCommandLineCommon.

private void testInstallDepsOnCommandLineCommon() throws Exception {
    paramIterable = new CatalogIterable(this, this);
    textParams.add("r");
    textParams.add("llvm-toolchain");
    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 2 with CatalogIterable

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

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

the class CatalogInstallTest method testRejectMismatchingCatalog.

/**
 * Checks that mismatched catalog is rejected entirely.
 *
 * @throws Exception
 */
@Test
public void testRejectMismatchingCatalog() throws Exception {
    setupVersion("1.0.0-rc1");
    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(IncompatibleException.class);
    exception.expectMessage("REMOTE_UnsupportedGraalVersion");
    setupCatalog(null);
    textParams.add("ruby");
    paramIterable = new CatalogIterable(this, this);
    paramIterable.iterator().next();
}
Also used : IOException(java.io.IOException) CatalogIterable(org.graalvm.component.installer.remote.CatalogIterable) URL(java.net.URL) URLConnection(java.net.URLConnection) Test(org.junit.Test)

Example 4 with CatalogIterable

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

the class CatalogInstallTest method testInstallCorrectJavaVersion8.

/**
 * Tests, that a correct java version flavour gets selected if the catalog contains two flavours
 * of the component in the requested version.
 */
@Test
public void testInstallCorrectJavaVersion8() throws Exception {
    storage.graalInfo.put(CommonConstants.CAP_JAVA_VERSION, "8");
    setupVersion("1.0.0.0");
    setupCatalog("catalogMultiFlavours.properties");
    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);
    List<Installer> installers = cmd.getInstallers();
    assertEquals(1, installers.size());
}
Also used : CatalogIterable(org.graalvm.component.installer.remote.CatalogIterable) Test(org.junit.Test)

Example 5 with CatalogIterable

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

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