Search in sources :

Example 1 with JarMetaLoader

use of org.graalvm.component.installer.jar.JarMetaLoader 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);
}
Also used : JarFile(java.util.jar.JarFile) ComponentPackageLoader(org.graalvm.component.installer.persist.ComponentPackageLoader) JarMetaLoader(org.graalvm.component.installer.jar.JarMetaLoader) Before(org.junit.Before)

Example 2 with JarMetaLoader

use of org.graalvm.component.installer.jar.JarMetaLoader 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);
}
Also used : JarFile(java.util.jar.JarFile) DependencyException(org.graalvm.component.installer.DependencyException) ComponentPackageLoader(org.graalvm.component.installer.persist.ComponentPackageLoader) JarMetaLoader(org.graalvm.component.installer.jar.JarMetaLoader) Test(org.junit.Test)

Example 3 with JarMetaLoader

use of org.graalvm.component.installer.jar.JarMetaLoader in project graal by oracle.

the class ComponentPackageLoaderTest method setupLoader.

private void setupLoader() throws IOException {
    File f = dataFile("data/truffleruby2.jar").toFile();
    jf = new JarFile(f);
    loader = new JarMetaLoader(jf, this);
    info = loader.createComponentInfo();
}
Also used : JarFile(java.util.jar.JarFile) JarFile(java.util.jar.JarFile) File(java.io.File) JarMetaLoader(org.graalvm.component.installer.jar.JarMetaLoader)

Example 4 with JarMetaLoader

use of org.graalvm.component.installer.jar.JarMetaLoader in project graal by oracle.

the class LicensePresenterTest method createLicensedComponentInfo.

ComponentInfo createLicensedComponentInfo() throws IOException {
    Path p = dataFile("licensetest.jar");
    JarFile jf = new JarFile(p.toFile());
    loader = new JarMetaLoader(jf, this);
    licensedInfo = loader.completeMetadata();
    return licensedInfo;
}
Also used : Path(java.nio.file.Path) JarFile(java.util.jar.JarFile) JarMetaLoader(org.graalvm.component.installer.jar.JarMetaLoader)

Example 5 with JarMetaLoader

use of org.graalvm.component.installer.jar.JarMetaLoader 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);
}
Also used : JarFile(java.util.jar.JarFile) DownloadURLParam(org.graalvm.component.installer.DownloadURLIterable.DownloadURLParam) JarFile(java.util.jar.JarFile) File(java.io.File) URL(java.net.URL) ComponentPackageLoader(org.graalvm.component.installer.persist.ComponentPackageLoader) JarMetaLoader(org.graalvm.component.installer.jar.JarMetaLoader)

Aggregations

JarFile (java.util.jar.JarFile)11 JarMetaLoader (org.graalvm.component.installer.jar.JarMetaLoader)11 File (java.io.File)6 ComponentPackageLoader (org.graalvm.component.installer.persist.ComponentPackageLoader)6 Test (org.junit.Test)3 IOException (java.io.IOException)2 URL (java.net.URL)2 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1 Attributes (java.util.jar.Attributes)1 Manifest (java.util.jar.Manifest)1 DependencyException (org.graalvm.component.installer.DependencyException)1 DownloadURLParam (org.graalvm.component.installer.DownloadURLIterable.DownloadURLParam)1 MetadataException (org.graalvm.component.installer.MetadataException)1 JarArchive (org.graalvm.component.installer.jar.JarArchive)1 ComponentInfo (org.graalvm.component.installer.model.ComponentInfo)1 CatalogItemParam (org.graalvm.component.installer.remote.CatalogIterable.CatalogItemParam)1 Before (org.junit.Before)1