Search in sources :

Example 56 with ComponentInfo

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

the class DirectoryStorageTest method testStabilityLevelLoadsOld.

/**
 * Checks that stability level is loaded from the old property as well. Not strictly necessary,
 * but may improve compatibility for older bundled stuff.
 */
@Test
public void testStabilityLevelLoadsOld() throws Exception {
    Files.write(registryPath.resolve("x.component"), Arrays.asList("Bundle-Name=y", "Bundle-Symbolic-Name=x", "Bundle-Version=2.0", "x-GraalVM-Stability=experimental-earlyadopter"));
    Set<ComponentInfo> loaded = storage.loadComponentMetadata("x");
    assertEquals(1, loaded.size());
    ComponentInfo compare = loaded.iterator().next();
    assertEquals(StabilityLevel.Experimental_Earlyadopter, compare.getStability());
}
Also used : ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Example 57 with ComponentInfo

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

the class DirectoryStorageTest method testCheckedAcceptedURLLicenseListed.

/**
 * When listing licenses, Ids cannot be transliterated back, so they are stored\ aside.
 *
 * @throws Exception
 */
@Test
public void testCheckedAcceptedURLLicenseListed() throws Exception {
    String urlString = "http://acme.org/license.txt";
    copyDir("list1", registryPath);
    ComponentInfo info = loadLastComponent("fastr");
    enableLicensesForTesting();
    storage.recordLicenseAccepted(info, urlString, "This is a dummy license", null);
    Map<String, Collection<String>> lics = storage.findAcceptedLicenses();
    assertNotNull(lics.get(urlString));
}
Also used : Collection(java.util.Collection) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Example 58 with ComponentInfo

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

Example 59 with ComponentInfo

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

the class CatalogCompatTest method testOldFormatIgnoresPrevVersionsAvailable.

/**
 * Checks that previous versions (RCs) are ignored with the old format.
 *
 * @throws Exception
 */
@Test
public void testOldFormatIgnoresPrevVersionsAvailable() throws Exception {
    storage.graalInfo.put(CommonConstants.CAP_GRAALVM_VERSION, "1.0.0");
    setupCatalogFormat1("catalogFormat1.properties");
    // 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 60 with ComponentInfo

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

the class CatalogCompatTest method testOldFormatIgnoresPrevVersionsMostRecent.

/**
 * Checks that previous versions (RCs) are ignored with the old format.
 *
 * @throws Exception
 */
@Test
public void testOldFormatIgnoresPrevVersionsMostRecent() throws Exception {
    storage.graalInfo.put(CommonConstants.CAP_GRAALVM_VERSION, "1.0.0");
    setupCatalogFormat1("catalogFormat1.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)

Aggregations

ComponentInfo (org.graalvm.component.installer.model.ComponentInfo)149 Test (org.junit.Test)94 Path (java.nio.file.Path)36 Version (org.graalvm.component.installer.Version)28 HashSet (java.util.HashSet)20 ArrayList (java.util.ArrayList)19 ComponentParam (org.graalvm.component.installer.ComponentParam)19 IOException (java.io.IOException)13 URL (java.net.URL)11 MetadataLoader (org.graalvm.component.installer.persist.MetadataLoader)10 InputStream (java.io.InputStream)9 HashMap (java.util.HashMap)9 Collection (java.util.Collection)8 List (java.util.List)8 Properties (java.util.Properties)8 Map (java.util.Map)7 Set (java.util.Set)7 Collections (java.util.Collections)6 FailedOperationException (org.graalvm.component.installer.FailedOperationException)6 SystemUtils (org.graalvm.component.installer.SystemUtils)6