use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class DirectoryStorageTest method testLicensesDecativated.
/**
* Checks that license management is disabled, that is no license is reported as accepted even
* if the data (by some miracle) exist.
*/
@Test
public void testLicensesDecativated() throws Exception {
copyDir("list1", registryPath);
ComponentInfo info = loadLastComponent("fastr");
Path p = registryPath.resolve(SystemUtils.fromCommonString("licenses/cafebabe.accepted/org.graalvm.fastr"));
Files.createDirectories(p.getParent());
Files.write(p, Arrays.asList("ahoj"));
assertNull(storage.licenseAccepted(info, "cafebabe"));
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class DirectoryStorageTest method testSaveComponent.
@Test
public void testSaveComponent() throws Exception {
ComponentInfo info = new ComponentInfo("x", "y", "2.0");
info.addRequiredValue("a", "b");
Path p = registryPath.resolve(SystemUtils.fileName("x.component"));
assertFalse(Files.exists(p));
storage.saveComponent(info);
assertTrue(Files.exists(p));
List<String> lines = Files.readAllLines(p).stream().filter((l) -> !l.startsWith("#")).collect(Collectors.toList());
List<String> golden = Files.readAllLines(dataFile("golden-save-component.properties")).stream().filter((l) -> !l.startsWith("#")).collect(Collectors.toList());
golden.sort(String.CASE_INSENSITIVE_ORDER);
lines.sort(String.CASE_INSENSITIVE_ORDER);
assertEquals(golden, lines);
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class DirectoryStorageTest method testLoadComponentMetadata2.
/**
* Test of loadComponentMetadata method, of class RegistryStorage.
*/
@Test
public void testLoadComponentMetadata2() throws Exception {
copyDir("list1", registryPath);
ComponentInfo info = loadLastComponent("fastr-2");
assertEquals("org.graalvm.fastr", info.getId());
assertTrue(info.isPolyglotRebuild());
assertTrue(info.getWorkingDirectories().contains("jre/languages/test/scrap"));
assertTrue(info.getWorkingDirectories().contains("jre/lib/test/scrapdir"));
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class DirectoryStorageTest method testLoadProvidedCapabilities.
@Test
public void testLoadProvidedCapabilities() throws Exception {
Path p = dataFile("data/core1.component");
ComponentInfo info;
try (InputStream is = Files.newInputStream(p)) {
info = storage.loadMetadataFrom(is);
}
assertEquals("org.graalvm", info.getId());
assertEquals(Version.fromString("1.0.1.0"), info.getProvidedValue("version", Version.class));
assertEquals("ee", info.getProvidedValue("edition", String.class));
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class DirectoryStorageTest method testSaveComponentWithCapabilities.
@Test
public void testSaveComponentWithCapabilities() throws Exception {
ComponentInfo info = new ComponentInfo("x", "y", "2.0");
info.provideValue("a", "foo");
info.provideValue("v", Version.fromString("1.1.1"));
Path p = registryPath.resolve(SystemUtils.fileName("x.component"));
assertFalse(Files.exists(p));
storage.saveComponent(info);
assertTrue(Files.exists(p));
List<String> lines = Files.readAllLines(p).stream().filter((l) -> !l.startsWith("#")).collect(Collectors.toList());
List<String> golden = Files.readAllLines(dataFile("golden-save-component2.properties")).stream().filter((l) -> !l.startsWith("#")).collect(Collectors.toList());
golden.sort(String.CASE_INSENSITIVE_ORDER);
lines.sort(String.CASE_INSENSITIVE_ORDER);
assertEquals(golden, lines);
}
Aggregations