Search in sources :

Example 16 with SoftwareChannelSource

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

the class GraalEditionListTest method checkOverrideCommon.

private void checkOverrideCommon() throws Exception {
    GraalEditionList list = new GraalEditionList(this, this, getLocalRegistry());
    list.setOverrideCatalogSpec("https://www.graalvm.org/component-catalog/graal-updater-component-catalog-java8x.properties");
    List<GraalEdition> eds = list.editions();
    assertEquals(1, eds.size());
    assertEquals(list.getDefaultEdition(), eds.get(0));
    GraalEdition ge = eds.get(0);
    assertEquals("ce", ge.getId());
    assertSame(ge, list.getEdition(null));
    List<SoftwareChannelSource> channels = ge.getSoftwareSources();
    assertEquals(1, channels.size());
    assertTrue(channels.get(0).getLocationURL().endsWith("java8x.properties"));
}
Also used : GraalEdition(org.graalvm.component.installer.model.GraalEdition) SoftwareChannelSource(org.graalvm.component.installer.SoftwareChannelSource)

Example 17 with SoftwareChannelSource

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

the class GraalEditionListTest method testCheck21MultipleProperties.

@Test
public void testCheck21MultipleProperties() throws Exception {
    loadReleaseFile("release21ce.properties");
    storage.graalInfo.put(CommonConstants.CAP_EDITION, "ce");
    GraalEditionList list = new GraalEditionList(this, this, getLocalRegistry());
    list.setDefaultCatalogSpec(storage.graalInfo.get(CommonConstants.RELEASE_CATALOG_KEY));
    List<GraalEdition> eds = list.editions();
    assertEquals(1, eds.size());
    GraalEdition ge = eds.get(0);
    List<SoftwareChannelSource> sources = ge.getSoftwareSources();
    assertEquals("Expected default edition", "ce", ge.getId());
    assertEquals("Expected 2 sources from multiproperties", 2, sources.size());
}
Also used : GraalEdition(org.graalvm.component.installer.model.GraalEdition) SoftwareChannelSource(org.graalvm.component.installer.SoftwareChannelSource) Test(org.junit.Test)

Example 18 with SoftwareChannelSource

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

the class DirectoryCatalogProviderTest method testNoErrorsWithLocalCatalogs.

/**
 * Checks that the merging catalog initializes the directory provider correctly.
 *
 * @throws Exception
 */
@Test
public void testNoErrorsWithLocalCatalogs() throws Exception {
    URL clu = getClass().getResource("data/catalog");
    URL u = new URL("test://graalvm.io/download/truffleruby.zip");
    Handler.bind(u.toString(), clu);
    Path testData = dataFile("dir1");
    SoftwareChannelSource scs = new SoftwareChannelSource(testData.toUri().toURL().toString(), "local dir");
    storage.graalInfo.put(CommonConstants.CAP_GRAALVM_VERSION, "0.33-dev");
    FB fb = new FB();
    delegateFeedback(fb);
    RemoteCatalogDownloader d = new RemoteCatalogDownloader(this, this, u);
    d.addLocalChannelSource(scs);
    registry = openCatalog(d);
    // directory contents scanned / component found
    ComponentInfo info = registry.findComponent("org.graalvm.llvm-toolchain");
    assertNotNull(info);
    // catalog loaded / component found
    info = registry.findComponent("ruby");
    assertNotNull(info);
    // no errors
    assertTrue(fb.errs.isEmpty());
}
Also used : Path(java.nio.file.Path) SoftwareChannelSource(org.graalvm.component.installer.SoftwareChannelSource) RemoteCatalogDownloader(org.graalvm.component.installer.remote.RemoteCatalogDownloader) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) URL(java.net.URL) Test(org.junit.Test)

Example 19 with SoftwareChannelSource

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

the class DirectoryChannelFactoryTest method testLoadFromEmptyDirectory.

@Test
public void testLoadFromEmptyDirectory() throws Exception {
    Path nf = testFolder.newFolder().toPath();
    Path ruby033 = dataFile("data/truffleruby3.jar");
    Files.copy(ruby033, nf.resolve(ruby033.getFileName()));
    // truffleruby3 declares that version
    storage.graalInfo.put(BundleConstants.GRAAL_VERSION, "0.33-dev");
    downloader = new RemoteCatalogDownloader(this, this, (URL) null);
    SoftwareChannelSource scs = new SoftwareChannelSource(nf.toUri().toString());
    downloader.addLocalChannelSource(scs);
    ComponentInfo info = getRegistry().findComponent("ruby");
    assertNotNull(info);
}
Also used : Path(java.nio.file.Path) SoftwareChannelSource(org.graalvm.component.installer.SoftwareChannelSource) RemoteCatalogDownloader(org.graalvm.component.installer.remote.RemoteCatalogDownloader) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) URL(java.net.URL) Test(org.junit.Test)

Aggregations

SoftwareChannelSource (org.graalvm.component.installer.SoftwareChannelSource)19 Test (org.junit.Test)10 GraalEdition (org.graalvm.component.installer.model.GraalEdition)8 URL (java.net.URL)6 Path (java.nio.file.Path)4 ArrayList (java.util.ArrayList)4 List (java.util.List)4 CommandInput (org.graalvm.component.installer.CommandInput)3 CommonConstants (org.graalvm.component.installer.CommonConstants)3 Feedback (org.graalvm.component.installer.Feedback)3 SoftwareChannel (org.graalvm.component.installer.SoftwareChannel)3 CatalogContents (org.graalvm.component.installer.model.CatalogContents)3 ComponentInfo (org.graalvm.component.installer.model.ComponentInfo)3 ComponentRegistry (org.graalvm.component.installer.model.ComponentRegistry)3 RemoteCatalogDownloader (org.graalvm.component.installer.remote.RemoteCatalogDownloader)3 Collections (java.util.Collections)2 Comparator (java.util.Comparator)2 HashMap (java.util.HashMap)2 Locale (java.util.Locale)2 Map (java.util.Map)2