Search in sources :

Example 1 with RemoteCatalogDownloader

use of org.graalvm.component.installer.remote.RemoteCatalogDownloader 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 RemoteCatalogDownloader

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

the class CatalogInstallTest method setupCatalog.

private void setupCatalog(String rel) throws Exception {
    String relSpec;
    if (rel == null) {
        relSpec = "catalog-" + name.getMethodName() + ".properties";
        if (getClass().getResource(relSpec) == null) {
            if (name.getMethodName().contains("Deps")) {
                relSpec = "cataloginstallDeps.properties";
            } else {
                relSpec = "catalogInstallTest.properties";
            }
        }
    } else {
        relSpec = rel;
    }
    URL u = getClass().getResource(relSpec);
    if (u == null) {
        u = getClass().getResource("catalogInstallTest.properties");
    }
    Handler.bind(TEST_CATALOG_URL, u);
    downloader = new RemoteCatalogDownloader(this, this, new URL(TEST_CATALOG_URL));
    this.registry = new CatalogContents(this, downloader.getStorage(), getLocalRegistry());
}
Also used : CatalogContents(org.graalvm.component.installer.model.CatalogContents) RemoteCatalogDownloader(org.graalvm.component.installer.remote.RemoteCatalogDownloader) URL(java.net.URL)

Example 3 with RemoteCatalogDownloader

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

the class InstallVersionsTest method initVersion.

private Version initVersion(String s) throws IOException {
    Version v = Version.fromString(s);
    storage.graalInfo.put(BundleConstants.GRAAL_VERSION, s);
    Path catalogPath = dataFile("../repo/catalog.properties");
    RemoteCatalogDownloader downloader = new RemoteCatalogDownloader(this, this, catalogPath.toUri().toURL());
    registry = new CatalogContents(this, downloader.getStorage(), localRegistry);
    paramIterable = new CatalogIterable(this, this);
    return v;
}
Also used : Path(java.nio.file.Path) Version(org.graalvm.component.installer.Version) CatalogContents(org.graalvm.component.installer.model.CatalogContents) RemoteCatalogDownloader(org.graalvm.component.installer.remote.RemoteCatalogDownloader) CatalogIterable(org.graalvm.component.installer.remote.CatalogIterable)

Example 4 with RemoteCatalogDownloader

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

the class InstallTest method initCatalogIterable.

private void initCatalogIterable(URL u) {
    RemoteCatalogDownloader rcd = new RemoteCatalogDownloader(this, this, u);
    registry = new CatalogContents(this, rcd.getStorage(), localRegistry);
    componentIterable = new CatalogIterable(this, this);
}
Also used : CatalogContents(org.graalvm.component.installer.model.CatalogContents) RemoteCatalogDownloader(org.graalvm.component.installer.remote.RemoteCatalogDownloader) CatalogIterable(org.graalvm.component.installer.remote.CatalogIterable)

Example 5 with RemoteCatalogDownloader

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

the class UninstallTest method setupComponentsWithDeps.

private void setupComponentsWithDeps() throws Exception {
    storage.graalInfo.put(CommonConstants.CAP_GRAALVM_VERSION, "19.3-dev");
    Path catalogFile = dataFile("cataloginstallDeps.properties");
    RemoteCatalogDownloader downloader = new RemoteCatalogDownloader(this, this, catalogFile.toUri().toURL());
    componentCatalog = new CatalogContents(this, downloader.getStorage(), getLocalRegistry());
    ComponentInfo ruby = componentCatalog.findComponent("org.graalvm.ruby");
    ComponentInfo fastr = componentCatalog.findComponent("org.graalvm.r");
    Set<ComponentInfo> deps = new HashSet<>();
    componentCatalog.findDependencies(ruby, true, null, deps);
    componentCatalog.findDependencies(fastr, true, null, deps);
    deps.add(ruby);
    deps.add(fastr);
    storage.installed.addAll(deps);
    deps.forEach((ci) -> ci.setInfoPath(""));
}
Also used : Path(java.nio.file.Path) CatalogContents(org.graalvm.component.installer.model.CatalogContents) RemoteCatalogDownloader(org.graalvm.component.installer.remote.RemoteCatalogDownloader) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) HashSet(java.util.HashSet)

Aggregations

RemoteCatalogDownloader (org.graalvm.component.installer.remote.RemoteCatalogDownloader)14 CatalogContents (org.graalvm.component.installer.model.CatalogContents)11 URL (java.net.URL)8 Path (java.nio.file.Path)8 ComponentInfo (org.graalvm.component.installer.model.ComponentInfo)6 Test (org.junit.Test)6 CatalogIterable (org.graalvm.component.installer.remote.CatalogIterable)4 List (java.util.List)3 CommandInput (org.graalvm.component.installer.CommandInput)3 ComponentCatalog (org.graalvm.component.installer.ComponentCatalog)3 SoftwareChannelSource (org.graalvm.component.installer.SoftwareChannelSource)3 Version (org.graalvm.component.installer.Version)3 ComponentRegistry (org.graalvm.component.installer.model.ComponentRegistry)3 HashSet (java.util.HashSet)1 ComponentParam (org.graalvm.component.installer.ComponentParam)1 FileIterable (org.graalvm.component.installer.FileIterable)1 MetadataLoader (org.graalvm.component.installer.persist.MetadataLoader)1