Java Code Examples for org.jboss.shrinkwrap.api.ShrinkWrap#createFromZipFile()
The following examples show how to use
org.jboss.shrinkwrap.api.ShrinkWrap#createFromZipFile() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServiceFileCombinationImpl.java From vertx-maven-plugin with Apache License 2.0 | 6 votes |
private static Map<String, List<List<String>>> findDescriptorsFromDependencies(List<File> deps, List<String> patterns) { Map<String, List<List<String>>> map = new LinkedHashMap<>(); for (File file : deps) { JavaArchive archive = ShrinkWrap.createFromZipFile(JavaArchive.class, file); Map<ArchivePath, Node> content = getMatchingFilesFromJar(patterns, archive); for (Map.Entry<ArchivePath, Node> entry : content.entrySet()) { Asset asset = entry.getValue().getAsset(); if (asset != null) { List<String> lines; String path = entry.getKey().get(); lines = read(asset, path); List<List<String>> items = map.computeIfAbsent(path, k -> new ArrayList<>()); items.add(lines); map.put(path, items); } } } return map; }
Example 2
Source File: KeycloakSetupTestIT.java From apicurio-studio with Apache License 2.0 | 5 votes |
private static WebArchive getWar(String gav) { File resolvedApiWar = Maven.resolver() .resolve(gav) .withTransitivity() .asSingleFile(); return ShrinkWrap.createFromZipFile(WebArchive.class, resolvedApiWar); }
Example 3
Source File: MailIntegrationCDITest.java From wildfly-camel with Apache License 2.0 | 5 votes |
@Deployment(order = 1, testable = false, name = GREENMAIL_WAR) public static WebArchive createGreenmailDeployment() { File mailDependencies = Maven.configureResolverViaPlugin(). resolve("com.icegreen:greenmail-webapp:war:1.4.0"). withoutTransitivity(). asSingleFile(); return ShrinkWrap.createFromZipFile(WebArchive.class, mailDependencies); }
Example 4
Source File: VerifyDistributedSetupTestIT.java From apicurio-studio with Apache License 2.0 | 5 votes |
private static WebArchive getWsWar() { File resolvedApiWar = Maven.resolver() .resolve("io.apicurio:apicurio-studio-test-integration-ws:war:" + version.getVersion()) .withTransitivity() .asSingleFile(); return ShrinkWrap.createFromZipFile(WebArchive.class, resolvedApiWar); }
Example 5
Source File: JMSMDBExampleTest.java From wildfly-camel-examples with Apache License 2.0 | 4 votes |
@Deployment(testable = false) public static WebArchive createDeployment() { return ShrinkWrap.createFromZipFile(WebArchive.class, new File("target/examples/example-camel-jms-mdb.war")); }
Example 6
Source File: VerifyBuildArtefactIT.java From thorntail with Apache License 2.0 | 4 votes |
@Deployment public static Archive createDeployment() { return ShrinkWrap.createFromZipFile(JAXRSArchive.class, new File("target/endpoint.war")); }
Example 7
Source File: CxfWsCdiSecureExampleTest.java From wildfly-camel-examples with Apache License 2.0 | 4 votes |
@Deployment public static WebArchive createDeployment() { return ShrinkWrap.createFromZipFile(WebArchive.class, new File("target/examples/example-camel-cxf-jaxws-cdi-secure.war")); }
Example 8
Source File: MailIntegrationTest.java From wildfly-camel with Apache License 2.0 | 4 votes |
@Deployment(managed = false, testable = false, name = GREENMAIL_WAR) public static WebArchive createGreenmailDeployment() { return ShrinkWrap.createFromZipFile(WebArchive.class, new File("target/dependencies/greenmail-webapp.war")); }
Example 9
Source File: CxfWsCdiXmlExampleTest.java From wildfly-camel-examples with Apache License 2.0 | 4 votes |
@Deployment public static WebArchive createDeployment() { return ShrinkWrap.createFromZipFile(WebArchive.class, new File("target/examples/example-camel-cxf-jaxws-cdi-xml.war")); }
Example 10
Source File: MainTest.java From ARCHIVE-wildfly-swarm with Apache License 2.0 | 4 votes |
public void jarFile(File f) { this.jarFile = f; this.archive = ShrinkWrap.createFromZipFile(WebArchive.class, f); }
Example 11
Source File: ActiveMQExampleTest.java From wildfly-camel-examples with Apache License 2.0 | 4 votes |
@Deployment(name = ACTIVEMQ_EXAMPLE_WAR, testable = false, order = 2) public static WebArchive createDeployment() { return ShrinkWrap.createFromZipFile(WebArchive.class, new File("target/examples/" + ACTIVEMQ_EXAMPLE_WAR)); }
Example 12
Source File: JMSSpringExampleTest.java From wildfly-camel-examples with Apache License 2.0 | 4 votes |
@Deployment(testable = false) public static WebArchive createDeployment() { return ShrinkWrap.createFromZipFile(WebArchive.class, new File("target/examples/" + EXAMPLE_CAMEL_JMS_WAR)); }
Example 13
Source File: CDIExampleTest.java From wildfly-camel-examples with Apache License 2.0 | 4 votes |
@Deployment public static WebArchive createDeployment() { return ShrinkWrap.createFromZipFile(WebArchive.class, new File("target/examples/example-camel-cdi.war")); }
Example 14
Source File: JMSExampleTest.java From wildfly-camel-examples with Apache License 2.0 | 4 votes |
@Deployment(testable = false) public static WebArchive createDeployment() { return ShrinkWrap.createFromZipFile(WebArchive.class, new File("target/examples/" + EXAMPLE_CAMEL_JMS_WAR)); }
Example 15
Source File: MainTest.java From thorntail with Apache License 2.0 | 4 votes |
public void jarFile(File f) { this.jarFile = f; this.archive = ShrinkWrap.createFromZipFile(WebArchive.class, f); }
Example 16
Source File: MailExampleTest.java From wildfly-camel-examples with Apache License 2.0 | 4 votes |
@Deployment(managed = false, testable = false, name = EXAMPLE_CAMEL_MAIL_WAR) public static WebArchive createCamelMailDeployment() { return ShrinkWrap.createFromZipFile(WebArchive.class, new File("target/examples/" + EXAMPLE_CAMEL_MAIL_WAR)); }
Example 17
Source File: MainTest.java From wildfly-swarm with Apache License 2.0 | 4 votes |
public void jarFile(File f) { this.jarFile = f; this.archive = ShrinkWrap.createFromZipFile(WebArchive.class, f); }
Example 18
Source File: JPASpringExampleTest.java From wildfly-camel-examples with Apache License 2.0 | 4 votes |
@Deployment(testable = false) public static WebArchive createDeployment() { return ShrinkWrap.createFromZipFile(WebArchive.class, new File("target/examples/" + EXAMPLE_CAMEL_JPA_WAR)); }
Example 19
Source File: PatchingTestUtil.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
static void updateJar(final File source, final File target) throws IOException { final JavaArchive archive = ShrinkWrap.createFromZipFile(JavaArchive.class, source); archive.add(new StringAsset("test " + randomString()), "testFile"); archive.as(ZipExporter.class).exportTo(target); }
Example 20
Source File: PackagingIT.java From vertx-maven-plugin with Apache License 2.0 | 4 votes |
@Test public void testDuplicateManagement() throws VerificationException, IOException { File testDir = initProject(PACKAGING_DUPLICATE); assertThat(testDir).isDirectory(); initVerifier(testDir); prepareProject(testDir, verifier); File A = new File("target/A-1.0.jar"); File B = new File("target/B-1.0.jar"); JavaArchive jarArchive1 = ShrinkWrap.create(JavaArchive.class); jarArchive1.add(new StringAsset("A1"), "/res/A"); jarArchive1.add(new StringAsset("B1"), "/res/B"); jarArchive1.as(ZipExporter.class).exportTo(A, true); JavaArchive jarArchive2 = ShrinkWrap.create(JavaArchive.class); jarArchive2.add(new StringAsset("A2"), "/res/A"); jarArchive2.add(new StringAsset("B2"), "/res/B"); jarArchive2.add(new StringAsset("C2"), "/res/C"); jarArchive2.as(ZipExporter.class).exportTo(B, true); installJarToLocalRepository(verifier.getLocalRepository(), "A", A); installJarToLocalRepository(verifier.getLocalRepository(), "B", B); runPackage(verifier); File out = new File(testDir, "target/vertx-demo-start-0.0.1.BUILD-SNAPSHOT.jar"); assertThat(out).isFile(); JavaArchive archive = ShrinkWrap.createFromZipFile(JavaArchive.class, out); assertNotNull(archive); Asset a = archive.get( "/res/A").getAsset(); Asset b = archive.get( "/res/B").getAsset(); Asset c = archive.get( "/res/C").getAsset(); String content_a = IOUtils.toString(a.openStream(), "UTF-8"); String content_b = IOUtils.toString(b.openStream(), "UTF-8"); String content_c = IOUtils.toString(c.openStream(), "UTF-8"); assertThat(content_a).isEqualToIgnoringCase("A3\n"); assertThat(content_b).isEqualToIgnoringCase("B1"); assertThat(content_c).isEqualToIgnoringCase("C2"); }