use of org.graalvm.component.installer.persist.ComponentPackageLoader in project graal by oracle.
the class RemotePropertiesStorage method createVersionedComponent.
private ComponentInfo createVersionedComponent(String versoPrefix, Properties filtered, String id, String tag) throws IOException {
URL downloadURL;
String s = filtered.getProperty(versoPrefix + id.toLowerCase());
if (s == null) {
return null;
}
// try {
downloadURL = new URL(baseURL, s);
// NOI18N
String prefix = versoPrefix + id.toLowerCase() + "-";
String hashS = filtered.getProperty(prefix + PROPERTY_HASH);
byte[] hash = hashS == null ? null : toHashBytes(id, hashS);
ComponentPackageLoader ldr = new ComponentPackageLoader(tag, new PrefixedPropertyReader(prefix, filtered), feedback);
ComponentInfo info = ldr.createComponentInfo();
info.setRemoteURL(downloadURL);
info.setShaDigest(hash);
info.setOrigin(baseURL.toString());
return configureComponentInfo(info);
}
use of org.graalvm.component.installer.persist.ComponentPackageLoader in project graal by oracle.
the class ComponentRegistryTest method setUp.
@Before
public void setUp() throws Exception {
registry = new ComponentRegistry(this, mockStorage);
try (JarFile jf = new JarFile(dataFile("truffleruby2.jar").toFile())) {
ComponentPackageLoader ldr = new JarMetaLoader(jf, this);
rubyInfo = ldr.createComponentInfo();
ldr.loadPaths();
ldr.loadSymlinks();
}
fakeInfo = new ComponentInfo("org.graalvm.fake", "Fake component", "0.32");
fakeInfo.addPaths(Arrays.asList("jre/bin/ruby", "jre/languages/fake/nothing"));
mockStorage.installed.add(fakeInfo);
}
use of org.graalvm.component.installer.persist.ComponentPackageLoader in project graal by oracle.
the class VerifierTest method testGraalCapabilitiesMismatch.
@Test
public void testGraalCapabilitiesMismatch() throws Exception {
try (JarFile jf = new JarFile(dataFile("truffleruby2.jar").toFile())) {
ComponentPackageLoader ldr = new JarMetaLoader(jf, this);
rubyInfo = ldr.createComponentInfo();
ldr.loadPaths();
ldr.loadSymlinks();
}
mockStorage.graalInfo.put(CAP_OS_NAME, "LiNuy");
Verifier vfy = new Verifier(this, registry, registry);
exception.expect(DependencyException.Mismatch.class);
exception.expectMessage("VERIFY_Dependency_Failed");
vfy.validateRequirements(rubyInfo);
}
use of org.graalvm.component.installer.persist.ComponentPackageLoader in project graal by oracle.
the class CommandTestBase method initURLComponent.
protected void initURLComponent(String relativeJar, String spec) throws IOException {
clu = getClass().getResource(relativeJar);
url = new URL(spec);
Handler.bind(url.toString(), clu);
File f = dataFile(relativeJar).toFile();
JarFile jf = new JarFile(f, false);
ComponentPackageLoader cpl = new JarMetaLoader(jf, this);
info = cpl.getComponentInfo();
// unknown in catalog metadata
info.setLicensePath(null);
info.setRemoteURL(url);
param = rparam = new DownloadURLParam(url, spec, spec, this, false);
}
use of org.graalvm.component.installer.persist.ComponentPackageLoader in project graal by oracle.
the class CommandTestBase method initRemoteComponent.
protected void initRemoteComponent(String relativeJar, String u, String disp, String spec) throws IOException {
clu = getClass().getResource(relativeJar);
url = new URL(u);
Handler.bind(url.toString(), clu);
File f = dataFile(relativeJar).toFile();
JarFile jf = new JarFile(f, false);
ComponentPackageLoader cpl = new JarMetaLoader(jf, this);
info = cpl.getComponentInfo();
// unknown in catalog metadata
info.setLicensePath(null);
info.setRemoteURL(url);
param = rparam = new CatalogItemParam(this, info, disp, spec, this, false);
}
Aggregations