Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Test
- public void shouldBeAbleToImportFromUrl() {
- final String targetURL = "https://repository.jboss.org/nexus/content/groups/public/org/jboss/shrinkwrap/shrinkwrap-api/1.2.2/shrinkwrap-api-1.2.2.jar";
- final URL url;
- try {
- url = new URL(targetURL);
- } catch (final MalformedURLException murle) {
- throw new RuntimeException(murle);
- }
- final InputStream remoteContents;
- try {
- remoteContents = url.openStream();
- } catch (final IOException ioe) {
- throw new RuntimeException(ioe);
- }
- // Represent as SW
- final JavaArchive archive = ShrinkWrap.create(ZipImporter.class).importFrom(remoteContents).as(JavaArchive.class);
- // Print out
- System.out.println(archive.toString(true));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement