Search in sources :

Example 11 with CatalogContents

use of org.graalvm.component.installer.model.CatalogContents 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 12 with CatalogContents

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

the class RemoteCatalogDownloader method getRegistry.

public ComponentCollection getRegistry() {
    if (union == null) {
        union = new CatalogContents(feedback, mergeChannels(), input.getLocalRegistry());
        // get errors early
        union.getComponentIDs();
    }
    return union;
}
Also used : CatalogContents(org.graalvm.component.installer.model.CatalogContents)

Example 13 with CatalogContents

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

the class ListTest method initRemoteStorage.

private void initRemoteStorage() throws MalformedURLException {
    this.remoteStorage = new RemotePropertiesStorage(this, getLocalRegistry(), catalogContents, "linux_amd64", Version.fromString("1.0.0-rc3-dev"), new URL("http://go.to/graalvm"));
    this.registry = new CatalogContents(this, remoteStorage, localRegistry);
}
Also used : RemotePropertiesStorage(org.graalvm.component.installer.remote.RemotePropertiesStorage) CatalogContents(org.graalvm.component.installer.model.CatalogContents) URL(java.net.URL)

Example 14 with CatalogContents

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

the class ListTest method assert110Components.

private void assert110Components(Version v, Version min) throws Exception {
    Path p = dataFile("../repo/catalog.properties");
    try (InputStream is = new FileInputStream(p.toFile())) {
        catalogContents.load(is);
    }
    this.remoteStorage = new RemotePropertiesStorage(this, getLocalRegistry(), catalogContents, "linux_amd64", v, new URL("http://go.to/graalvm"));
    this.registry = new CatalogContents(this, remoteStorage, localRegistry);
    AvailableCommand inst = new AvailableCommand() {

        @Override
        boolean process() {
            super.process();
            // block the actual print
            return false;
        }
    };
    textParams.add("r");
    textParams.add("ruby");
    textParams.add("python");
    inst.init(this, this.withBundle(ListInstalledCommand.class));
    inst.execute();
    Set<String> found = new HashSet<>();
    for (ComponentInfo ci : inst.getComponents()) {
        if (ci.getId().equals(BundleConstants.GRAAL_COMPONENT_ID)) {
            continue;
        }
        assertTrue(found.add(ci.getId().toLowerCase()));
        assertTrue(min.compareTo(ci.getVersion()) <= 0);
    }
    // ruby not present
    assertFalse(found.contains("org.graalvm.ruby"));
    assertTrue(found.contains("org.graalvm.r"));
    assertTrue(found.contains("org.graalvm.python"));
}
Also used : Path(java.nio.file.Path) RemotePropertiesStorage(org.graalvm.component.installer.remote.RemotePropertiesStorage) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) CatalogContents(org.graalvm.component.installer.model.CatalogContents) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) FileInputStream(java.io.FileInputStream) URL(java.net.URL) HashSet(java.util.HashSet)

Example 15 with CatalogContents

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

the class UpgradeTest method testUpgradeWithDependencies.

/**
 * Upgrade an installation with "ruby" to a newer one, where "ruby" has a dependency on an
 * additional component. The other component should be auto-installed.
 */
@Test
public void testUpgradeWithDependencies() throws Exception {
    initVersion("1.0.0.0", "../repo/catalog-19.3.properties");
    ComponentInfo ci = new ComponentInfo("org.graalvm.r", "Installed R", "1.0.0.0");
    storage.installed.add(ci);
    UpgradeCommand cmd = new UpgradeCommand();
    cmd.init(this, this);
    textParams.add("r");
    ComponentInfo graalInfo = cmd.configureProcess();
    assertNotNull(graalInfo);
    assertEquals(Version.fromString("19.3.0.0"), graalInfo.getVersion());
    boolean installed = cmd.getProcess().installGraalCore(graalInfo);
    assertTrue(installed);
    factory = new CatalogFactory() {

        @Override
        public ComponentCatalog createComponentCatalog(CommandInput in) {
            RemoteCatalogDownloader dnl = new RemoteCatalogDownloader(in, UpgradeTest.this, downloader.getOverrideCatalogSpec());
            // carry over the override spec
            return new CatalogContents(UpgradeTest.this, dnl.getStorage(), in.getLocalRegistry());
        }

        @Override
        public List<GraalEdition> listEditions(ComponentRegistry targetGraalVM) {
            return Collections.emptyList();
        }
    };
    InstallTrampoline targetInstall = new InstallTrampoline();
    cmd.getProcess().configureInstallCommand(targetInstall);
    targetInstall.executionInit();
    targetInstall.prepareInstallation();
    assertTrue(targetInstall.getUnresolvedDependencies().isEmpty());
    List<ComponentParam> deps = targetInstall.getDependencies();
    assertEquals(1, deps.size());
    MetadataLoader ldr = deps.iterator().next().createFileLoader();
    assertEquals("org.graalvm.llvm-toolchain", ldr.getComponentInfo().getId());
}
Also used : ComponentCatalog(org.graalvm.component.installer.ComponentCatalog) ComponentParam(org.graalvm.component.installer.ComponentParam) MetadataLoader(org.graalvm.component.installer.persist.MetadataLoader) 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) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Aggregations

CatalogContents (org.graalvm.component.installer.model.CatalogContents)21 RemoteCatalogDownloader (org.graalvm.component.installer.remote.RemoteCatalogDownloader)11 Path (java.nio.file.Path)9 URL (java.net.URL)8 ComponentCatalog (org.graalvm.component.installer.ComponentCatalog)7 ComponentInfo (org.graalvm.component.installer.model.ComponentInfo)6 Version (org.graalvm.component.installer.Version)5 ComponentRegistry (org.graalvm.component.installer.model.ComponentRegistry)5 CatalogIterable (org.graalvm.component.installer.remote.CatalogIterable)5 Test (org.junit.Test)5 List (java.util.List)4 CommandInput (org.graalvm.component.installer.CommandInput)4 HashSet (java.util.HashSet)3 RemotePropertiesStorage (org.graalvm.component.installer.remote.RemotePropertiesStorage)2 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 ComponentParam (org.graalvm.component.installer.ComponentParam)1 FileIterable (org.graalvm.component.installer.FileIterable)1 SoftwareChannelSource (org.graalvm.component.installer.SoftwareChannelSource)1