use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class UpgradeTest method testRefuseUnsatisfiedCommandline.
/**
* Checks "gu upgrade 1.1.0". Should fail because ruby is not available in 1.1.x
*/
@Test
public void testRefuseUnsatisfiedCommandline() throws Exception {
initVersion("1.0.0.0");
ComponentInfo ci = new ComponentInfo("org.graalvm.ruby", "Installed Ruby", "1.0.0.0");
textParams.add("1.1.0");
storage.installed.add(ci);
exception.expect(FailedOperationException.class);
exception.expectMessage("UPGRADE_ComponentsCannotMigrate");
UpgradeCommand cmd = new UpgradeCommand();
cmd.init(this, this);
cmd.execute();
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class UpgradeTest method testRefuseUpgradeUnsatisfiedComponent.
@Test
public void testRefuseUpgradeUnsatisfiedComponent() throws Exception {
exception.expect(FailedOperationException.class);
exception.expectMessage("UPGRADE_ComponentsCannotMigrate");
initVersion("1.0.0.0");
ComponentInfo ci = new ComponentInfo("org.graalvm.ruby", "Installed Ruby", "1.0.0.0");
storage.installed.add(ci);
helper.resetExistingComponents();
ComponentInfo info = helper.findGraalVersion(Version.fromString("1.1.0").match(Version.Match.Type.COMPATIBLE));
assertNotNull(info);
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class DirectoryMetaLoader method loadPaths.
@Override
public void loadPaths() {
ComponentInfo cinfo = getComponentInfo();
Set<String> emptyDirectories = new HashSet<>();
List<String> files = new ArrayList<>();
try {
Files.walk(rootDir).forEachOrdered((Path en) -> {
String eName = SystemUtils.toCommonPath(en);
if (eName.startsWith(META_INF_PATH)) {
return;
}
int li = eName.lastIndexOf("/", Files.isDirectory(en) ? eName.length() - 2 : eName.length() - 1);
if (li > 0) {
emptyDirectories.remove(eName.substring(0, li + 1));
}
if (Files.isDirectory(en)) {
// directory names always come first
emptyDirectories.add(eName);
} else {
files.add(eName);
}
});
addFiles(new ArrayList<>(emptyDirectories));
// sort empty directories first
Collections.sort(files);
cinfo.addPaths(files);
addFiles(files);
} catch (IOException ex) {
throw new UncheckedIOException(ex);
}
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class DirectoryStorageTest method loadComponentFiles.
/**
* Should strip whitespaces around.
*
* @throws Exception
*/
@Test
public void loadComponentFiles() throws Exception {
copyDir("list1", registryPath);
ComponentInfo info = loadLastComponent("fastr");
storage.loadComponentFiles(info);
List<String> paths = info.getPaths();
assertEquals(Arrays.asList("bin/", "bin/R", "bin/Rscript"), paths.subList(0, 3));
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class DirectoryStorageTest method testGraalVMCoreComponentNative.
@Test
public void testGraalVMCoreComponentNative() throws Exception {
// fake a release file
Files.copy(dataFile("release_simple.properties"), graalVMPath.resolve("release"));
Path meta = registryPath.resolve(BundleConstants.GRAAL_COMPONENT_ID + ".meta");
// create the component storage, tag core component with .meta file
Files.createFile(meta);
Set<ComponentInfo> infos = storage.loadComponentMetadata(BundleConstants.GRAAL_COMPONENT_ID);
assertEquals(1, infos.size());
ComponentInfo ci = infos.iterator().next();
assertTrue(ci.isNativeComponent());
}
Aggregations