Search in sources :

Example 41 with Version

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

the class CatalogCompatTest method testMixedFormatInstallSameRelease.

/**
 * Checks that install will attempt to install the most recent stuff for the current release.
 * Will add the same-release component to existing instalation
 */
@Test
public void testMixedFormatInstallSameRelease() throws Exception {
    storage.graalInfo.put(CommonConstants.CAP_GRAALVM_VERSION, "1.0.0");
    setupCatalogFormat1("catalogFormatMix.properties");
    List<ComponentInfo> infos;
    Version gv = getLocalRegistry().getGraalVersion();
    Version.Match selector = gv.match(Version.Match.Type.MOSTRECENT);
    // check that versions 1.0.0-rcX are ignored for version 1.0.0
    infos = new ArrayList<>(registry.loadComponents("ruby", selector, verbose));
    assertNotNull(infos);
    assertEquals(1, infos.size());
    ComponentInfo one = infos.get(0);
    assertEquals("1.0.0", one.getVersionString());
}
Also used : Version(org.graalvm.component.installer.Version) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Example 42 with Version

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

the class CatalogCompatTest method testOldFormatIgnoresFutureVersionsAvailable.

/**
 * Checks that future versions in OLD format are not accepted.
 */
@Test
public void testOldFormatIgnoresFutureVersionsAvailable() throws Exception {
    storage.graalInfo.put(CommonConstants.CAP_GRAALVM_VERSION, "1.0.0");
    setupCatalogFormat1("catalogFormat2.properties");
    // this is what interprets user input for 'available'
    Version gv = getLocalRegistry().getGraalVersion();
    Version.Match selector = gv.match(Version.Match.Type.INSTALLABLE);
    List<ComponentInfo> infos;
    // check that versions 1.0.0-rcX are ignored for version 1.0.0
    infos = new ArrayList<>(registry.loadComponents("ruby", selector, verbose));
    assertEquals(1, infos.size());
    infos = new ArrayList<>(registry.loadComponents("python", selector, verbose));
    assertEquals(1, infos.size());
    infos = new ArrayList<>(registry.loadComponents("r", selector, verbose));
    assertEquals(1, infos.size());
}
Also used : Version(org.graalvm.component.installer.Version) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Example 43 with Version

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

the class CatalogCompatTest method testOldFormatIgnoresFutureVersionsInstall.

/**
 * Checks that future versions in OLD format are not accepted.
 */
@Test
public void testOldFormatIgnoresFutureVersionsInstall() throws Exception {
    storage.graalInfo.put(CommonConstants.CAP_GRAALVM_VERSION, "1.0.0");
    setupCatalogFormat1("catalogFormat2.properties");
    // copied from CatalogIterable, this is what interprets user input for install
    Version gv = getLocalRegistry().getGraalVersion();
    Version.Match selector = gv.match(Version.Match.Type.MOSTRECENT);
    List<ComponentInfo> infos;
    // check that versions 1.0.0-rcX are ignored for version 1.0.0
    infos = new ArrayList<>(registry.loadComponents("ruby", selector, verbose));
    assertEquals(1, infos.size());
    infos = new ArrayList<>(registry.loadComponents("python", selector, verbose));
    assertEquals(1, infos.size());
    infos = new ArrayList<>(registry.loadComponents("r", selector, verbose));
    assertEquals(1, infos.size());
}
Also used : Version(org.graalvm.component.installer.Version) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Example 44 with Version

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

the class InfoTest method initVersion.

private Version initVersion(String s) throws IOException {
    Version v = Version.fromString(s);
    storage.graalInfo.put(BundleConstants.GRAAL_VERSION, v.toString());
    Path catalogPath = dataFile("../repo/catalog.properties");
    RemoteCatalogDownloader downloader = new RemoteCatalogDownloader(this, this, catalogPath.toUri().toURL());
    registry = new CatalogContents(this, downloader.getStorage(), localRegistry);
    paramIterable = new CatalogIterable(this, this);
    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)

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