Search in sources :

Example 11 with Version

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

the class ListTest method testListSpecifiedNewerComponents.

/**
 * Tests that 'list' will print components but just those newer than us.
 */
@Test
public void testListSpecifiedNewerComponents() throws Exception {
    Version v = Version.fromString("1.1.0");
    storage.graalInfo.put(BundleConstants.GRAAL_VERSION, v.originalString());
    assert110Components(v, v);
}
Also used : Version(org.graalvm.component.installer.Version) Test(org.junit.Test)

Example 12 with Version

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

the class DirectoryStorageTest method testLoadProvidedCapabilities.

@Test
public void testLoadProvidedCapabilities() throws Exception {
    Path p = dataFile("data/core1.component");
    ComponentInfo info;
    try (InputStream is = Files.newInputStream(p)) {
        info = storage.loadMetadataFrom(is);
    }
    assertEquals("org.graalvm", info.getId());
    assertEquals(Version.fromString("1.0.1.0"), info.getProvidedValue("version", Version.class));
    assertEquals("ee", info.getProvidedValue("edition", String.class));
}
Also used : Path(java.nio.file.Path) Version(org.graalvm.component.installer.Version) InputStream(java.io.InputStream) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Example 13 with Version

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

the class UpgradeTest method initVersion.

private Version initVersion(String s, String catalogResource) throws IOException {
    Version v = Version.fromString(s);
    storage.graalInfo.put(BundleConstants.GRAAL_VERSION, s);
    Path catalogPath = dataFile(catalogResource);
    downloader = new RemoteCatalogDownloader(this, this, catalogPath.toUri().toURL());
    registry = new CatalogContents(this, downloader.getStorage(), localRegistry);
    paramIterable = new CatalogIterable(this, this);
    helper = new UpgradeProcess(this, this, registry);
    return v;
}
Also used : Path(java.nio.file.Path) Version(org.graalvm.component.installer.Version) CatalogContents(org.graalvm.component.installer.model.CatalogContents) RemoteCatalogDownloader(org.graalvm.component.installer.remote.RemoteCatalogDownloader) CatalogIterable(org.graalvm.component.installer.remote.CatalogIterable)

Example 14 with Version

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

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

Aggregations

Version (org.graalvm.component.installer.Version)44 ComponentInfo (org.graalvm.component.installer.model.ComponentInfo)21 Test (org.junit.Test)19 Path (java.nio.file.Path)10 ArrayList (java.util.ArrayList)7 URL (java.net.URL)5 HashSet (java.util.HashSet)5 Properties (java.util.Properties)5 RemotePropertiesStorage (org.graalvm.component.installer.remote.RemotePropertiesStorage)4 JSONObject (com.oracle.truffle.tools.utils.json.JSONObject)3 IOException (java.io.IOException)3 InputStream (java.io.InputStream)3 ComponentParam (org.graalvm.component.installer.ComponentParam)3 IncompatibleException (org.graalvm.component.installer.IncompatibleException)3 CatalogContents (org.graalvm.component.installer.model.CatalogContents)3 ComponentRegistry (org.graalvm.component.installer.model.ComponentRegistry)3 CatalogIterable (org.graalvm.component.installer.remote.CatalogIterable)3 RemoteCatalogDownloader (org.graalvm.component.installer.remote.RemoteCatalogDownloader)3 JSONException (com.oracle.truffle.tools.utils.json.JSONException)2 JSONTokener (com.oracle.truffle.tools.utils.json.JSONTokener)2