use of org.graalvm.component.installer.DownloadURLIterable.DownloadURLParam 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.DownloadURLIterable.DownloadURLParam 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");
}
use of org.graalvm.component.installer.DownloadURLIterable.DownloadURLParam in project graal by oracle.
the class CatalogIterableTest method testDirectURLAccessedJustOnce.
@Test
public void testDirectURLAccessedJustOnce() 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);
assertTrue(Handler.isVisited(url));
assertTrue(rparam.isComplete());
Handler.clearVisited();
Archive jf = rparam.getArchive();
assertNotNull(jf);
assertFalse(Handler.isVisited(url));
}
use of org.graalvm.component.installer.DownloadURLIterable.DownloadURLParam in project graal by oracle.
the class CatalogIterableTest method testMetaAccessesDirectURL.
@Test
public void testMetaAccessesDirectURL() 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);
assertTrue(Handler.isVisited(url));
assertTrue(rparam.isComplete());
}
use of org.graalvm.component.installer.DownloadURLIterable.DownloadURLParam 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");
}
Aggregations