Search in sources :

Example 1 with ComponentStorage

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

the class GraalChannelTest method testLoadComponentStorage.

@Test
public void testLoadComponentStorage() throws Exception {
    Path p = dataFile("data/releases2.json");
    channel.setAllowUpdates(false);
    channel.setIndexURL(p.toUri().toURL());
    ComponentStorage store = channel.getStorage();
    Collection<String> cids = store.listComponentIDs();
    assertEquals(5, cids.size());
}
Also used : Path(java.nio.file.Path) ComponentStorage(org.graalvm.component.installer.model.ComponentStorage) Test(org.junit.Test)

Example 2 with ComponentStorage

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

the class GraalChannelTest method testThrowEmptyStorage.

@Test
public void testThrowEmptyStorage() throws Exception {
    try {
        channel.throwEmptyStorage();
        fail("Exception expected");
    } catch (IncompatibleException ex) {
    // ok
    }
    ComponentStorage chStorage = channel.throwEmptyStorage();
    assertNotNull("Stub storage expected for 2nd time", chStorage);
    assertEquals(0, chStorage.listComponentIDs().size());
    assertEquals(0, chStorage.loadComponentMetadata("org.graalvm").size());
    assertEquals(0, chStorage.loadGraalVersionInfo().size());
}
Also used : ComponentStorage(org.graalvm.component.installer.model.ComponentStorage) IncompatibleException(org.graalvm.component.installer.IncompatibleException) Test(org.junit.Test)

Example 3 with ComponentStorage

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

the class RemoteCatalogDownloaderTest method checkMultipleCatalogResults.

private void checkMultipleCatalogResults(RemoteCatalogDownloader d) throws Exception {
    URL clu1 = getClass().getResource("catalogMultiPart1.properties");
    Handler.bind(FIRST_CATALOG_URL, clu1);
    URL clu2 = getClass().getResource("catalogMultiPart3.properties");
    Handler.bind(SECOND_CATALOG_URL, clu2);
    ComponentStorage store = d.getStorage();
    Set<String> ids = store.listComponentIDs();
    assertTrue(ids.contains("ruby"));
    assertTrue(ids.contains("r"));
}
Also used : ComponentStorage(org.graalvm.component.installer.model.ComponentStorage) URL(java.net.URL)

Example 4 with ComponentStorage

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

the class RemoteCatalogDownloaderTest method testParseCatalogOverride.

/**
 * Checks that simple explicit URL given 'the old way' will define a catalog that will be
 * loaded.
 *
 * @throws Exception
 */
@Test
public void testParseCatalogOverride() throws Exception {
    storage.graalInfo.put(CommonConstants.CAP_GRAALVM_VERSION, "0.33-dev");
    String single = "test://graalv.org/test/catalog.properties";
    RemoteCatalogDownloader d = new RemoteCatalogDownloader(this, this, single);
    List<SoftwareChannelSource> sources = d.getChannelSources();
    assertNotNull(sources);
    assertEquals(1, sources.size());
    assertEquals(single, sources.get(0).getLocationURL());
    URL clu1 = getClass().getResource("catalogMultiVersions.properties");
    Handler.bind(single, clu1);
    ComponentStorage store = d.getStorage();
    Set<String> ids = store.listComponentIDs();
    assertTrue(ids.contains("ruby"));
    assertTrue(Handler.isVisited(new URL(single)));
}
Also used : ComponentStorage(org.graalvm.component.installer.model.ComponentStorage) SoftwareChannelSource(org.graalvm.component.installer.SoftwareChannelSource) URL(java.net.URL) Test(org.junit.Test)

Aggregations

ComponentStorage (org.graalvm.component.installer.model.ComponentStorage)4 Test (org.junit.Test)3 URL (java.net.URL)2 Path (java.nio.file.Path)1 IncompatibleException (org.graalvm.component.installer.IncompatibleException)1 SoftwareChannelSource (org.graalvm.component.installer.SoftwareChannelSource)1