use of org.graalvm.component.installer.model.CatalogContents in project graal by oracle.
the class UpgradeTest method testUpgradeRespectsTargetCatalogURLs.
/**
* The target GraalVM installation may have configured the catalog URLs differently. When
* installing components or dependencies to the target, the target's URLs / release file
* settings should be respected.
*
* @throws Exception
*/
@Test
public void testUpgradeRespectsTargetCatalogURLs() throws Exception {
URL u = new URL("test://catalog-19.3.properties");
Handler.bind(u.toString(), dataFile("../repo/catalog-19.3.properties").toUri().toURL());
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);
ComponentInfo graalInfo = cmd.configureProcess();
boolean installed = cmd.getProcess().installGraalCore(graalInfo);
assertTrue(installed);
factory = new CatalogFactory() {
@Override
public ComponentCatalog createComponentCatalog(CommandInput in) {
RemoteCatalogDownloader dnl = new RemoteCatalogDownloader(in, UpgradeTest.this, (String) null);
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();
// verify the URL from the target installation was visited.
assertTrue(Handler.isVisited(u));
}
use of org.graalvm.component.installer.model.CatalogContents in project graal by oracle.
the class DirectoryCatalogProviderTest method testDifferentRequirementsFiltered.
@Test
public void testDifferentRequirementsFiltered() throws Exception {
Path testData = dataFile("dir1");
DirectoryCatalogProvider prov = new DirectoryCatalogProvider(testData, this);
Set<String> ids = prov.listComponentIDs();
assertEquals(2, ids.size());
// typo is there...
Collection<ComponentInfo> infos = prov.loadComponentMetadata("org.graavm.ruby");
assertEquals(2, infos.size());
CatalogContents contents = new CatalogContents(this, prov, getLocalRegistry());
Version.Match m = getLocalRegistry().getGraalVersion().match(Version.Match.Type.INSTALLABLE);
// check that the JDK11 component gets removed
Collection<ComponentInfo> catInfos = contents.loadComponents("org.graavm.ruby", m, false);
assertEquals(1, catInfos.size());
ComponentInfo ci = catInfos.iterator().next();
assertEquals(testData.resolve("ruby.jar").toUri().toURL(), ci.getRemoteURL());
}
use of org.graalvm.component.installer.model.CatalogContents in project graal by oracle.
the class DirectoryCatalogProviderTest method testSpecificJavaPresent.
@Test
public void testSpecificJavaPresent() throws Exception {
storage.graalInfo.put(CommonConstants.CAP_JAVA_VERSION, "11");
Path testData = dataFile("dir1");
DirectoryCatalogProvider prov = new DirectoryCatalogProvider(testData, this);
Set<String> ids = prov.listComponentIDs();
assertEquals(2, ids.size());
// typo is there...
Collection<ComponentInfo> infos = prov.loadComponentMetadata("org.graavm.ruby");
assertEquals(2, infos.size());
CatalogContents contents = new CatalogContents(this, prov, getLocalRegistry());
Version.Match m = getLocalRegistry().getGraalVersion().match(Version.Match.Type.INSTALLABLE);
// both Ruby should pass: ruby.jar has no jdk restriction
Collection<ComponentInfo> catInfos = contents.loadComponents("org.graavm.ruby", m, false);
assertEquals(2, catInfos.size());
Set<URL> urls = new HashSet<>(Arrays.asList(testData.resolve("ruby.jar").toUri().toURL(), testData.resolve("ruby-11.jar").toUri().toURL()));
Iterator<ComponentInfo> itC = catInfos.iterator();
ComponentInfo ci = itC.next();
assertTrue(urls.remove(ci.getRemoteURL()));
ci = itC.next();
assertTrue(urls.remove(ci.getRemoteURL()));
}
use of org.graalvm.component.installer.model.CatalogContents in project graal by oracle.
the class CatalogCompatTest method openCatalog.
ComponentCatalog openCatalog(SoftwareChannel ch, Version v) throws IOException {
ComponentCatalog cc = new CatalogContents(this, ch.getStorage(), getLocalRegistry(), v);
cc.getComponentIDs();
return cc;
}
use of org.graalvm.component.installer.model.CatalogContents in project graal by oracle.
the class CatalogInstallTest method setupCatalog2.
private void setupCatalog2(String rel) throws IOException {
Path p = dataFile(rel);
URL u = p.toUri().toURL();
downloader = new RemoteCatalogDownloader(this, this, u);
this.registry = new CatalogContents(this, downloader.getStorage(), getLocalRegistry());
}
Aggregations