本文整理了Java中org.jboss.shrinkwrap.api.importer.ZipImporter.as()
方法的一些代码示例,展示了ZipImporter.as()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipImporter.as()
方法的具体详情如下:
包路径:org.jboss.shrinkwrap.api.importer.ZipImporter
类名称:ZipImporter
方法名:as
暂无
代码示例来源:origin: javaee/security-soteria
public static WebArchive mavenWar() {
return
create(ZipImporter.class, getProperty("finalName") + ".war")
.importFrom(new File("target/" + getProperty("finalName") + ".war"))
.as(WebArchive.class);
}
代码示例来源:origin: org.glassfish.soteria.test/common
public static WebArchive mavenWar() {
return
create(ZipImporter.class, getProperty("finalName") + ".war")
.importFrom(new File("target/" + getProperty("finalName") + ".war"))
.as(WebArchive.class);
}
代码示例来源:origin: org.jboss.shrinkwrap.osgi/shrinkwrap-osgi
@Override
public <TYPE extends Assignable> TYPE as(Class<TYPE> typeClass) {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
jar.write(baos);
return ShrinkWrap.create(ZipImporter.class).
importFrom(new ByteArrayInputStream(baos.toByteArray())).
as(typeClass);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
代码示例来源:origin: org.wildfly.swarm/container-api
public JavaArchive artifact(String gav, String asName) throws IOException, ModuleLoadException {
final File file = findFile(gav);
if (file == null) {
throw new RuntimeException("Artifact '" + gav + "' not found.");
}
return ShrinkWrap.create(ZipImporter.class, asName == null ? file.getName() : asName)
.importFrom(file)
.as(JavaArchive.class);
}
代码示例来源:origin: wildfly-swarm-archive/ARCHIVE-wildfly-swarm
public JavaArchive artifact(String gav, String asName) throws IOException, ModuleLoadException {
final File file = findFile(gav);
if (file == null) {
throw new RuntimeException("Artifact not found.");
}
return ShrinkWrap.create(ZipImporter.class, asName == null ? file.getName() : asName)
.importFrom(file)
.as(JavaArchive.class);
}
代码示例来源:origin: io.thorntail/container
public JavaArchive artifact(String gav, String asName) throws IOException, ModuleLoadException {
final File file = findFile(gav);
if (file == null) {
throw SwarmMessages.MESSAGES.artifactNotFound(gav);
}
return ShrinkWrap.create(ZipImporter.class, asName == null ? file.getName() : asName)
.importFrom(file)
.as(JavaArchive.class);
}
代码示例来源:origin: thorntail/thorntail
public JavaArchive artifact(String gav, String asName) throws IOException, ModuleLoadException {
final File file = findFile(gav);
if (file == null) {
throw SwarmMessages.MESSAGES.artifactNotFound(gav);
}
return ShrinkWrap.create(ZipImporter.class, asName == null ? file.getName() : asName)
.importFrom(file)
.as(JavaArchive.class);
}
代码示例来源:origin: org.wildfly.swarm/container
public JavaArchive artifact(String gav, String asName) throws IOException, ModuleLoadException {
final File file = findFile(gav);
if (file == null) {
throw SwarmMessages.MESSAGES.artifactNotFound(gav);
}
return ShrinkWrap.create(ZipImporter.class, asName == null ? file.getName() : asName)
.importFrom(file)
.as(JavaArchive.class);
}
代码示例来源:origin: org.jboss.shrinkwrap.resolver/shrinkwrap-resolver-impl-gradle-embedded-archive
@Override
public <TYPE extends Assignable> TYPE as(final Class<TYPE> clazz) {
final File result;
if (buildResult == null) {
result = importFromDefaultLibsDirectory();
} else {
result = importFromConfiguredPath();
}
return ShrinkWrap.create(ZipImporter.class, archive.getName()).importFrom(result).as(clazz);
}
代码示例来源:origin: shrinkwrap/resolver
@Override
public <TYPE extends Assignable> TYPE as(final Class<TYPE> clazz) {
final File result;
if (buildResult == null) {
result = importFromDefaultLibsDirectory();
} else {
result = importFromConfiguredPath();
}
return ShrinkWrap.create(ZipImporter.class, archive.getName()).importFrom(result).as(clazz);
}
代码示例来源:origin: wildfly-swarm-archive/ARCHIVE-wildfly-swarm
@Override
public InputStream openStream() {
return filter(ShrinkWrap.create(ZipImporter.class)
.importFrom(this.delegate.openStream())
.as(JavaArchive.class))
.as(ZipExporter.class)
.exportAsInputStream();
}
代码示例来源:origin: org.kie/kie-wb-monitoring-webapp
@Deployment(testable = false)
public static WebArchive create() {
final String warFile = System.getProperty(ARCHIVE_NAME);
return ShrinkWrap.create(ZipImporter.class,
warFile)
.importFrom(new File("target/" + warFile))
.as(WebArchive.class);
}
代码示例来源:origin: org.jbpm/jbpm-wb-case-mgmt-showcase
@Deployment(testable = false)
public static WebArchive create() {
final String warFile = System.getProperty(ARCHIVE_NAME);
return ShrinkWrap.create(ZipImporter.class,
warFile)
.importFrom(new File("target/" + warFile))
.as(WebArchive.class);
}
代码示例来源:origin: juzu/juzu
private void assertJar(URL url) throws IOException {
URLConnection conn = url.openConnection();
conn.connect();
InputStream in = conn.getInputStream();
JavaArchive archive = ShrinkWrap.create(ZipImporter.class).importFrom(in).as(JavaArchive.class);
Node node = archive.get("/" + ReadFileSystemTestCase.class.getName().replace('.', '/') + ".class");
assertNotNull(node);
}
代码示例来源:origin: org.juzu/juzu-core
private void assertJar(URL url) throws IOException {
URLConnection conn = url.openConnection();
conn.connect();
InputStream in = conn.getInputStream();
JavaArchive archive = ShrinkWrap.create(ZipImporter.class).importFrom(in).as(JavaArchive.class);
Node node = archive.get("/" + ReadFileSystemTestCase.class.getName().replace('.', '/') + ".class");
assertNotNull(node);
}
代码示例来源:origin: jboss-switchyard/release
@Deployment(testable = false, order = 1, name = "picketlink-sts")
public static WebArchive createPicketlinkSTSWar() throws Exception {
File artifactFile = new File(SRC_DIR, "picketlink-sts.war");
if (!artifactFile.isFile()) {
Assert.fail("Failed to resolve artifact '"
+ artifactFile
+ "'. The artifact must be declared as a dependency in your POM, thereby making it available in your local repository.");
}
return ShrinkWrap.create(ZipImporter.class, artifactFile.getName()).importFrom(new ZipFile(artifactFile))
.as(WebArchive.class);
}
代码示例来源:origin: shrinkwrap/shrinkwrap
/**
* SHRINKWRAP-259
*/
@Test
public void createZipImporter() {
final GenericArchive importer = ShrinkWrap.create(ZipImporter.class).as(GenericArchive.class);
Assert.assertTrue("Archive did not have expected suffix", importer.getName().endsWith(".jar"));
}
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-server-ui-backend
public static WebArchive createKieServerWar() {
try {
final File kieServerFile = Maven.configureResolver().workOffline().loadPomFromFile("pom.xml")
.resolve("org.kie.server:kie-server:war:ee7:?").withoutTransitivity().asSingleFile();
return ShrinkWrap.create(ZipImporter.class,
"kie-server.war").importFrom(kieServerFile)
.as(WebArchive.class);
} catch (Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-server-ui-backend
public static WebArchive createKieServerControllerWar() {
try {
final File kieServerControllerFile = Maven.configureResolver().workOffline().loadPomFromFile("pom.xml")
.resolve("org.kie.server:kie-server-controller-standalone:war:ee7:?").withoutTransitivity().asSingleFile();
return ShrinkWrap.create(ZipImporter.class,
"kie-server-controller.war").importFrom(kieServerControllerFile)
.as(WebArchive.class);
} catch (Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
代码示例来源:origin: shrinkwrap/shrinkwrap
@Test
public void testFilter() throws Exception {
String resourcePath = "/test/cl-test.jar";
GenericArchive archive = ShrinkWrap.create(ZipImporter.class).importFrom(
TestIOUtil.createFileFromResourceName("cl-test.jar")).as(GenericArchive.class);
GenericArchive filtered = archive.filter(Filters.include(".*MANIFEST\\.MF"));
// Check that only META-INF/MANIFEST.MF exist in Archive
Assert.assertEquals(2, filtered.getContent().size());
Assert.assertTrue(filtered.contains(ArchivePaths.create("META-INF/MANIFEST.MF")));
}
内容来源于网络,如有侵权,请联系作者删除!