Search in sources :

Example 1 with JarArchive

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

the class DownloadURLIterableTest method testURLParameter.

@Test
public void testURLParameter() throws Exception {
    initURLComponent("persist/data/truffleruby3.jar", "test://graalvm.io/download/truffleruby.zip");
    this.textParams.add("test://graalvm.io/download/truffleruby.zip");
    DownloadURLIterable iterable = new DownloadURLIterable(this, this);
    Iterator<ComponentParam> it = iterable.iterator();
    assertTrue(it.hasNext());
    ComponentParam p = it.next();
    assertEquals("test://graalvm.io/download/truffleruby.zip", p.getSpecification());
    MetadataLoader ldr = p.createMetaLoader();
    assertFalse(p.isComplete());
    ComponentInfo ci = ldr.getComponentInfo();
    assertTrue(p.isComplete());
    assertEquals("ruby", ci.getId());
    assertEquals("0.33-dev", ci.getVersionString());
    JarArchive jf = (JarArchive) ldr.getArchive();
    Archive.FileEntry je = jf.getJarEntry("META-INF/MANIFEST.MF");
    assertNotNull(je);
    jf.close();
}
Also used : JarArchive(org.graalvm.component.installer.jar.JarArchive) JarArchive(org.graalvm.component.installer.jar.JarArchive) MetadataLoader(org.graalvm.component.installer.persist.MetadataLoader) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Example 2 with JarArchive

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

the class InstallerTest method setupComponentInstall.

private void setupComponentInstall(String relativePath) throws IOException {
    File f = dataFile(relativePath).toFile();
    JarFile jf = new JarFile(f);
    loader = new JarMetaLoader(jf, this);
    componentInfo = loader.createComponentInfo();
    componentJarFile = new JarArchive(jf);
    loader.loadPaths();
    installer = new Installer(fb(), fileOps, componentInfo, registry, registry, componentJarFile);
    installer.setInstallPath(targetPath);
    installer.setLicenseRelativePath(SystemUtils.fromCommonRelative(loader.getLicensePath()));
}
Also used : JarArchive(org.graalvm.component.installer.jar.JarArchive) JarFile(java.util.jar.JarFile) JarFile(java.util.jar.JarFile) File(java.io.File) JarMetaLoader(org.graalvm.component.installer.jar.JarMetaLoader)

Example 3 with JarArchive

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

the class CatalogIterableTest method testDirectURLJarClosedAfterJar.

@Test
public void testDirectURLJarClosedAfterJar() throws Exception {
    addRemoteComponent("persist/data/truffleruby3.jar", "test://graalvm.io/download/truffleruby.zip", false);
    rparam = new DownloadURLParam(url, rparam.getDisplayName(), rparam.getSpecification(), this, false);
    components.add(param);
    JarArchive jf = (JarArchive) rparam.getArchive();
    assertNotNull(jf.getEntry("META-INF"));
    rparam.close();
    exception.expect(IllegalStateException.class);
    jf.getEntry("META-INF");
}
Also used : JarArchive(org.graalvm.component.installer.jar.JarArchive) DownloadURLParam(org.graalvm.component.installer.DownloadURLIterable.DownloadURLParam) Test(org.junit.Test)

Example 4 with JarArchive

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

the class CatalogIterableTest method testDirectURLJarClosedAfterMeta.

@Test
public void testDirectURLJarClosedAfterMeta() throws Exception {
    addRemoteComponent("persist/data/truffleruby3.jar", "test://graalvm.io/download/truffleruby.zip", false);
    rparam = new DownloadURLParam(url, rparam.getDisplayName(), rparam.getSpecification(), this, false);
    components.add(param);
    URL remoteU = rparam.createMetaLoader().getComponentInfo().getRemoteURL();
    assertEquals(url, remoteU);
    JarArchive jf = (JarArchive) rparam.getArchive();
    assertNotNull(jf.getEntry("META-INF"));
    rparam.close();
    exception.expect(IllegalStateException.class);
    jf.getEntry("META-INF");
}
Also used : JarArchive(org.graalvm.component.installer.jar.JarArchive) DownloadURLParam(org.graalvm.component.installer.DownloadURLIterable.DownloadURLParam) URL(java.net.URL) Test(org.junit.Test)

Aggregations

JarArchive (org.graalvm.component.installer.jar.JarArchive)4 Test (org.junit.Test)3 DownloadURLParam (org.graalvm.component.installer.DownloadURLIterable.DownloadURLParam)2 File (java.io.File)1 URL (java.net.URL)1 JarFile (java.util.jar.JarFile)1 JarMetaLoader (org.graalvm.component.installer.jar.JarMetaLoader)1 ComponentInfo (org.graalvm.component.installer.model.ComponentInfo)1 MetadataLoader (org.graalvm.component.installer.persist.MetadataLoader)1