Search in sources :

Example 16 with Version

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

the class HeaderParserTest method testReadCapabilities.

@Test
public void testReadCapabilities() {
    Map<String, Object> caps = r("org.graalvm; edition = \"CE\"; native_version:Version=\"19.3\"").parseProvidedCapabilities();
    assertEquals(2, caps.size());
    assertEquals("CE", caps.get("edition"));
    assertNotNull(caps.get("native_version"));
    Version v = (Version) caps.get("native_version");
    assertEquals(Version.fromString("19.3"), v);
}
Also used : Version(org.graalvm.component.installer.Version) Test(org.junit.Test)

Example 17 with Version

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

the class CatalogContentsTest method initVersion.

private Version initVersion(String s) throws IOException {
    Version v = Version.fromString(s);
    storage.graalInfo.put(BundleConstants.GRAAL_VERSION, s);
    Path catalogPath = dataFile("../repo/catalog.properties");
    Properties props = new Properties();
    try (InputStream is = Files.newInputStream(catalogPath)) {
        props.load(is);
    }
    remstorage = new RemotePropertiesStorage(this, getLocalRegistry(), props, "linux_amd64", v, catalogPath.toUri().toURL());
    coll = new CatalogContents(this, remstorage, getLocalRegistry());
    return v;
}
Also used : Path(java.nio.file.Path) Version(org.graalvm.component.installer.Version) RemotePropertiesStorage(org.graalvm.component.installer.remote.RemotePropertiesStorage) InputStream(java.io.InputStream) Properties(java.util.Properties)

Example 18 with Version

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

the class CatalogContentsTest method testDistUpdateFor1901.

/**
 * Checks that the catalog will provide component versions that require to update the
 * distribution for 1.0.1.0. Components in versions 1.1.x.x should be returned.
 */
@Test
public void testDistUpdateFor1901() throws Exception {
    initVersion("1.0.1.0");
    coll.setAllowDistUpdate(true);
    Version v;
    v = coll.findComponent("org.graalvm.ruby").getVersion();
    assertEquals("1.0.1.1", v.toString());
    v = coll.findComponent("org.graalvm.python").getVersion();
    assertEquals("1.1.0.0", v.toString());
    v = coll.findComponent("org.graalvm.r").getVersion();
    assertEquals("1.1.0.1", v.toString());
}
Also used : Version(org.graalvm.component.installer.Version) Test(org.junit.Test)

Example 19 with Version

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

the class MergedCatalogContentsTest method initVersion.

private Version initVersion(String s) throws IOException {
    Version v = Version.fromString(s);
    storage.graalInfo.put(BundleConstants.GRAAL_VERSION, s);
    Path catalogPath = dataFile("catalog-deps.properties");
    Properties props = new Properties();
    try (InputStream is = Files.newInputStream(catalogPath)) {
        props.load(is);
    }
    remstorage = new RemotePropertiesStorage(this, getLocalRegistry(), props, "linux_amd64", v, catalogPath.toUri().toURL());
    coll = new CatalogContents(this, remstorage, getLocalRegistry());
    return v;
}
Also used : Path(java.nio.file.Path) Version(org.graalvm.component.installer.Version) RemotePropertiesStorage(org.graalvm.component.installer.remote.RemotePropertiesStorage) InputStream(java.io.InputStream) Properties(java.util.Properties)

Example 20 with Version

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

the class CatalogCompatTest method testMixedFormatAllowsFutureVersions.

/**
 * Checks that if a catalog mixes in new-format entries, they're read and processed for new
 * versions, too.
 *
 * @throws Exception
 */
@Test
public void testMixedFormatAllowsFutureVersions() 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.INSTALLABLE);
    // 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(3, infos.size());
    Collections.sort(infos, ComponentInfo.versionComparator());
    ComponentInfo one = infos.get(0);
    ComponentInfo two = infos.get(1);
    ComponentInfo three = infos.get(2);
    assertEquals("1.0.0", one.getVersionString());
    assertEquals("1.0.1.0", two.getVersionString());
    assertEquals("1.0.2.0-1", three.getVersionString());
}
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