use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class DirectoryStorageTest method testKnowsNativeComponent.
@Test
public void testKnowsNativeComponent() throws Exception {
copyDir("list3", registryPath);
Collection<String> ids = storage.listComponentIDs();
assertTrue(ids.contains("fastr"));
assertTrue(ids.contains("ruby"));
Set<ComponentInfo> cis = storage.loadComponentMetadata("ruby");
assertEquals(1, cis.size());
ComponentInfo ci = cis.iterator().next();
assertTrue(ci.isNativeComponent());
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class DirectoryStorageTest method testLoadComponentMetadata.
/**
* Test of loadComponentMetadata method, of class RegistryStorage.
*/
@Test
public void testLoadComponentMetadata() throws Exception {
copyDir("list1", registryPath);
ComponentInfo info = loadLastComponent("fastr");
assertEquals("org.graalvm.fastr", info.getId());
assertEquals("1.0", info.getVersionString());
assertEquals("0.32", info.getRequiredGraalValues().get("graalvm_version"));
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class DirectoryStorageTest method testCheckedAcceptedURLLicense.
/**
* Acceptance test must use transliteration, too.
*
* @throws Exception
*/
@Test
public void testCheckedAcceptedURLLicense() throws Exception {
String urlString = "http://acme.org/license.txt";
copyDir("list1", registryPath);
ComponentInfo info = loadLastComponent("fastr");
enableLicensesForTesting();
storage.recordLicenseAccepted(info, urlString, "This is a dummy license", null);
assertNotNull(storage.licenseAccepted(info, urlString));
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class DirectoryStorageTest method testLicensesNotRecorded.
/**
* Checks that no license is recorded, as the feature must be disabled.
*/
@Test
public void testLicensesNotRecorded() 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 saveComponentOptionalTags.
@Test
public void saveComponentOptionalTags() throws Exception {
ComponentInfo info = new ComponentInfo("x", "y", "2.0");
info.setPolyglotRebuild(true);
info.addWorkingDirectories(Arrays.asList("jre/languages/test/scrap", "jre/lib/test/scrapdir"));
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-optional.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