Search in sources :

Example 1 with FileIterable

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

Aggregations

URL (java.net.URL)1 Path (java.nio.file.Path)1 List (java.util.List)1 CommandInput (org.graalvm.component.installer.CommandInput)1 ComponentCatalog (org.graalvm.component.installer.ComponentCatalog)1 FileIterable (org.graalvm.component.installer.FileIterable)1 SoftwareChannelSource (org.graalvm.component.installer.SoftwareChannelSource)1 CatalogContents (org.graalvm.component.installer.model.CatalogContents)1 ComponentRegistry (org.graalvm.component.installer.model.ComponentRegistry)1 RemoteCatalogDownloader (org.graalvm.component.installer.remote.RemoteCatalogDownloader)1 Test (org.junit.Test)1