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());
}
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);
}
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;
}
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;
}
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) {
}
}
Aggregations