use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class InstallerTest method testUninstallComponentWithUserROFiles.
@Test
public void testUninstallComponentWithUserROFiles() throws Exception {
if (System.getProperty("os.name").toLowerCase().contains("windows")) {
return;
}
setupComponentInstall("trufflerubyWork.jar");
installer.setPermissions(loader.loadPermissions());
installer.setSymlinks(loader.loadSymlinks());
// install
installer.install();
ComponentInfo savedInfo = installer.getComponentInfo();
Path langPath = targetPath.resolve(SystemUtils.fromCommonString("jre/languages/ruby"));
Path roPath = langPath.resolve(SystemUtils.fromCommonString("doc/user"));
// and add a new file to that dir:
Path uf = roPath.resolve(SystemUtils.fileName("userFile.txt"));
Files.write(uf, Arrays.asList("This file", "Should vanish"));
Files.setPosixFilePermissions(uf, PosixFilePermissions.fromString("r--r-----"));
Files.setPosixFilePermissions(roPath, PosixFilePermissions.fromString("r-xr-xr-x"));
// now uninstall, fileName a new installer.
Uninstaller uninstaller = new Uninstaller(fb(), fileOps, savedInfo, registry);
uninstaller.setInstallPath(targetPath);
uninstaller.uninstallContent();
assertFalse("All files should be removed after uninstall", Files.list(targetPath).findAny().isPresent());
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class ListTest method testListSpecifiedComponents.
/**
* Tests that 'list' will print matching components.
*/
@Test
public void testListSpecifiedComponents() throws Exception {
storage.installed.add(new ComponentInfo("org.graalvm.R", "FastR", Version.fromString("1.0.0")));
storage.installed.add(new ComponentInfo("org.graalvm.ruby", "Ruby", Version.fromString("1.0.0")));
storage.installed.add(new ComponentInfo("org.graalvm.python", "Python", Version.fromString("1.0.0")));
ListInstalledCommand inst = new ListInstalledCommand() {
@Override
boolean process() {
super.process();
// block the actual print
return false;
}
};
textParams.add("ruby");
textParams.add("r");
textParams.add("python");
inst.init(this, this);
inst.execute();
Set<String> found = new HashSet<>();
assertEquals(3, inst.getComponents().size());
for (ComponentInfo ci : inst.getComponents()) {
assertTrue(found.add(ci.getId().toLowerCase()));
}
assertTrue(found.contains("org.graalvm.r"));
assertTrue(found.contains("org.graalvm.ruby"));
assertTrue(found.contains("org.graalvm.python"));
}
use of org.graalvm.component.installer.model.ComponentInfo 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(""));
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class UninstallTest method testUninstallLibraryFailure.
/**
* Schedules uninstallation of a library. One component should become broken.
*/
@Test
public void testUninstallLibraryFailure() throws Exception {
setupComponentsWithDeps();
UninstallCommand uc = new UninstallCommand();
uc.init(this, this.withBundle(UninstallCommand.class));
textParams.add("org.graalvm.native-image");
uc.prepareUninstall();
assertFalse(uc.getBrokenDependencies().isEmpty());
assertEquals(1, uc.getUninstallComponents().size());
ComponentInfo nimage = localRegistry.findComponent("org.graalvm.native-image");
ComponentInfo ruby = localRegistry.findComponent("org.graalvm.ruby");
assertSame(nimage, uc.getUninstallComponents().iterator().next());
Collection<ComponentInfo> broken = uc.getBrokenDependencies().get(nimage);
assertNotNull(broken);
assertSame(ruby, broken.iterator().next());
exception.expect(FailedOperationException.class);
exception.expectMessage("UNINSTALL_BreakDependenciesTerminate");
uc.checkBrokenDependencies();
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class DirectoryStorageTest method testGraalVMCoreComponentRegular.
@Test
public void testGraalVMCoreComponentRegular() throws Exception {
Files.copy(dataFile("release_simple.properties"), graalVMPath.resolve("release"));
Set<ComponentInfo> infos = storage.loadComponentMetadata(BundleConstants.GRAAL_COMPONENT_ID);
assertEquals(1, infos.size());
ComponentInfo ci = infos.iterator().next();
assertFalse(ci.isNativeComponent());
}
Aggregations