use of org.graalvm.component.installer.model.ComponentRegistry in project graal by oracle.
the class UpgradeTest method testUpgradeToNextRC.
/**
* Tests upgrade to a next version's RC.
*/
@Test
public void testUpgradeToNextRC() throws Exception {
initVersion("1.0.0.0");
textParams.add("1.1.1-rc");
UpgradeCommand cmd = new UpgradeCommand();
cmd.init(this, this);
assertEquals(0, cmd.execute());
ComponentRegistry newReg = cmd.getProcess().getNewGraalRegistry();
assertEquals("1.1.1.0-0.rc.1", newReg.getGraalVersion().toString());
}
use of org.graalvm.component.installer.model.ComponentRegistry in project graal by oracle.
the class UpgradeTest method testUpgradeExact.
/**
* Tests upgrade to version EXACTLY 1.0.1.
*/
@Test
public void testUpgradeExact() throws Exception {
initVersion("1.0.0.0");
textParams.add("python=1.0.1");
ComponentInfo ci = new ComponentInfo("org.graalvm.python", "Installed Python", "1.0.0.0");
storage.installed.add(ci);
UpgradeCommand cmd = new UpgradeCommand();
cmd.init(this, this);
assertEquals(0, cmd.execute());
ComponentRegistry newReg = cmd.getProcess().getNewGraalRegistry();
ComponentInfo python = newReg.findComponent("python");
// note the difference, the user string does not contain trailing .0
assertEquals("1.0.1", python.getVersion().displayString());
}
use of org.graalvm.component.installer.model.ComponentRegistry 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());
}
use of org.graalvm.component.installer.model.ComponentRegistry in project graal by oracle.
the class UpgradeTest method testUpgradeIfAllowsNewer.
/**
* Tests NO upgrade to RC when requesting a release.
*/
@Test
public void testUpgradeIfAllowsNewer() throws Exception {
initVersion("1.0.0.0");
textParams.add("+1.1.1");
UpgradeCommand cmd = new UpgradeCommand();
cmd.init(this, this);
assertEquals(0, cmd.execute());
ComponentRegistry newReg = cmd.getProcess().getNewGraalRegistry();
assertEquals("1.1.1.0-0.rc.1", newReg.getGraalVersion().toString());
}
use of org.graalvm.component.installer.model.ComponentRegistry 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));
}
Aggregations