Search in sources :

Example 1 with ComponentCatalog

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

the class CatalogInstallTest method testInstallDependencyFromSameDirectory.

/**
 * Checks that dependencies can be loaded from the same directory as the installed Component.
 */
@Test
public void testInstallDependencyFromSameDirectory() throws Exception {
    Path ruby193Source = dataFile("../repo/19.3.0.0/r");
    Path llvm193Source = dataFile("../repo/19.3.0.0/llvm-toolchain");
    // they should be next to eah other
    assertEquals(ruby193Source.getParent(), llvm193Source.getParent());
    files.add(ruby193Source.toFile());
    setupVersion("19.3.0.0");
    // no external catalog
    downloader = new RemoteCatalogDownloader(this, this, (URL) null);
    downloader.addLocalChannelSource(new SoftwareChannelSource(ruby193Source.getParent().toFile().toURI().toString()));
    catalogFactory = new CatalogFactory() {

        @Override
        public ComponentCatalog createComponentCatalog(CommandInput input) {
            return new CatalogContents(CatalogInstallTest.this, downloader.getStorage(), input.getLocalRegistry());
        }

        @Override
        public List<GraalEdition> listEditions(ComponentRegistry targetGraalVM) {
            return Collections.emptyList();
        }
    };
    FileIterable fit = new FileIterable(this, this);
    fit.setCatalogFactory(catalogFactory);
    paramIterable = fit;
    InstallCommand cmd = new InstallCommand();
    cmd.init(this, withBundle(InstallCommand.class));
    cmd.executionInit();
    cmd.executeStep(cmd::prepareInstallation, false);
    assertFalse(cmd.getDependencies().isEmpty());
}
Also used : Path(java.nio.file.Path) ComponentCatalog(org.graalvm.component.installer.ComponentCatalog) SoftwareChannelSource(org.graalvm.component.installer.SoftwareChannelSource) URL(java.net.URL) CommandInput(org.graalvm.component.installer.CommandInput) ComponentRegistry(org.graalvm.component.installer.model.ComponentRegistry) CatalogContents(org.graalvm.component.installer.model.CatalogContents) RemoteCatalogDownloader(org.graalvm.component.installer.remote.RemoteCatalogDownloader) List(java.util.List) FileIterable(org.graalvm.component.installer.FileIterable) Test(org.junit.Test)

Example 2 with ComponentCatalog

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

the class InstallLicensedCatalogTest method initCatalogIterable.

private void initCatalogIterable(URL u) {
    GraalChannel channel = new GraalChannel(this, this, getLocalRegistry());
    channel.setIndexURL(u);
    cfactory = new CatalogFactory() {

        @Override
        public ComponentCatalog createComponentCatalog(CommandInput input) {
            try {
                return new CatalogContents(InstallLicensedCatalogTest.this, channel.getStorage(), localRegistry);
            } catch (IOException ex) {
                fail("Unexpected exception");
                return null;
            }
        }

        @Override
        public List<GraalEdition> listEditions(ComponentRegistry targetGraalVM) {
            return Collections.emptyList();
        }
    };
    paramIterable = new CatalogIterable(this, this);
}
Also used : ComponentCatalog(org.graalvm.component.installer.ComponentCatalog) GraalChannel(org.graalvm.component.installer.gds.GraalChannel) CommandInput(org.graalvm.component.installer.CommandInput) ComponentRegistry(org.graalvm.component.installer.model.ComponentRegistry) CatalogContents(org.graalvm.component.installer.model.CatalogContents) List(java.util.List) IOException(java.io.IOException) CatalogIterable(org.graalvm.component.installer.remote.CatalogIterable)

Example 3 with ComponentCatalog

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

the class DirectoryCatalogProviderTest method openCatalog.

ComponentCatalog openCatalog(SoftwareChannel ch, Version v) throws IOException {
    ComponentCatalog cc = new CatalogContents(this, ch.getStorage(), getLocalRegistry(), v);
    cc.getComponentIDs();
    return cc;
}
Also used : ComponentCatalog(org.graalvm.component.installer.ComponentCatalog) CatalogContents(org.graalvm.component.installer.model.CatalogContents)

Example 4 with ComponentCatalog

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

the class RemoteCatalogDownloaderTest method openCatalog.

ComponentCatalog openCatalog(SoftwareChannel ch, Version v) throws IOException {
    ComponentCatalog cc = new CatalogContents(this, ch.getStorage(), getLocalRegistry(), v);
    cc.getComponentIDs();
    return cc;
}
Also used : ComponentCatalog(org.graalvm.component.installer.ComponentCatalog) CatalogContents(org.graalvm.component.installer.model.CatalogContents)

Example 5 with ComponentCatalog

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

the class RemoteCatalogDownloaderTest method testSingleNonMatchingCatalogIgnored.

/**
 * Checks that if a single catalog does not correspond to graalvm version, other catalogs will
 * be read.
 *
 * @throws Exception
 */
@Test
public void testSingleNonMatchingCatalogIgnored() throws Exception {
    setupJoinedCatalog("catalogMultiPart1.properties");
    ComponentCatalog col = openCatalog(rcd);
    // need to incorporate requirements, too... they are tested in CatalogIterable
    CatalogIterable catIt = new CatalogIterable(this, this);
    catIt.setRemoteRegistry(col);
    textParams.add("r");
    textParams.add("ruby");
    textParams.add("python");
    Iterator<ComponentParam> iter = catIt.iterator();
    ComponentParam p = iter.next();
    ComponentInfo info;
    assertNotNull(p);
    info = p.createMetaLoader().getComponentInfo();
    assertEquals("1.0.0.0", info.getVersion().toString());
    p = iter.next();
    assertNotNull(p);
    info = p.createMetaLoader().getComponentInfo();
    assertEquals("1.0.0.0", info.getVersion().toString());
    // python cannot be found, an exception expected
    assertTrue(iter.hasNext());
    try {
        p = iter.next();
        fail("No python for 1.0.0");
    } catch (FailedOperationException ex) {
    }
}
Also used : ComponentCatalog(org.graalvm.component.installer.ComponentCatalog) FailedOperationException(org.graalvm.component.installer.FailedOperationException) ComponentParam(org.graalvm.component.installer.ComponentParam) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Aggregations

ComponentCatalog (org.graalvm.component.installer.ComponentCatalog)8 CatalogContents (org.graalvm.component.installer.model.CatalogContents)7 List (java.util.List)4 CommandInput (org.graalvm.component.installer.CommandInput)4 ComponentRegistry (org.graalvm.component.installer.model.ComponentRegistry)4 Test (org.junit.Test)4 ComponentInfo (org.graalvm.component.installer.model.ComponentInfo)3 RemoteCatalogDownloader (org.graalvm.component.installer.remote.RemoteCatalogDownloader)3 URL (java.net.URL)2 ComponentParam (org.graalvm.component.installer.ComponentParam)2 IOException (java.io.IOException)1 Path (java.nio.file.Path)1 FailedOperationException (org.graalvm.component.installer.FailedOperationException)1 FileIterable (org.graalvm.component.installer.FileIterable)1 SoftwareChannelSource (org.graalvm.component.installer.SoftwareChannelSource)1 GraalChannel (org.graalvm.component.installer.gds.GraalChannel)1 MetadataLoader (org.graalvm.component.installer.persist.MetadataLoader)1 CatalogIterable (org.graalvm.component.installer.remote.CatalogIterable)1