当前位置: 首页>>代码示例>>Java>>正文


Java ZipExporter类代码示例

本文整理汇总了Java中org.jboss.shrinkwrap.api.exporter.ZipExporter的典型用法代码示例。如果您正苦于以下问题:Java ZipExporter类的具体用法?Java ZipExporter怎么用?Java ZipExporter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ZipExporter类属于org.jboss.shrinkwrap.api.exporter包,在下文中一共展示了ZipExporter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testFractionMatching

import org.jboss.shrinkwrap.api.exporter.ZipExporter; //导入依赖的package包/类
@Test
public void testFractionMatching() throws Exception {
    JAXRSArchive archive = ShrinkWrap.create(JAXRSArchive.class);
    archive.addClass(MyResource.class);
    FractionUsageAnalyzer analyzer = new FractionUsageAnalyzer();

    final File out = Files.createTempFile(archive.getName(), ".war").toFile();
    archive.as(ZipExporter.class).exportTo(out, true);
    out.deleteOnExit();

    analyzer.source(out);
    assertThat(analyzer.detectNeededFractions()
                       .stream()
                       .filter(fd -> fd.getArtifactId().equals("jaxrs"))
                       .count())
            .isEqualTo(1);
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:18,代码来源:FractionUsageAnalyzerTest.java

示例2: testDetectEmptyWarAsUndertow

import org.jboss.shrinkwrap.api.exporter.ZipExporter; //导入依赖的package包/类
@Test
public void testDetectEmptyWarAsUndertow() throws Exception {
    JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "test.war");
    archive.add(EmptyAsset.INSTANCE, "nothing");
    FractionUsageAnalyzer analyzer = new FractionUsageAnalyzer();

    final File out = Files.createTempFile(archive.getName(), ".war").toFile();
    archive.as(ZipExporter.class).exportTo(out, true);
    out.deleteOnExit();

    analyzer.source(out);
    assertThat(analyzer.detectNeededFractions()
                       .stream()
                       .filter(fd -> fd.getArtifactId().equals("undertow"))
                       .count())
            .isEqualTo(1);
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:18,代码来源:FractionUsageAnalyzerTest.java

示例3: testFractionMatching

import org.jboss.shrinkwrap.api.exporter.ZipExporter; //导入依赖的package包/类
@Test
public void testFractionMatching() throws Exception {
    JARArchive archive = ShrinkWrap.create(JARArchive.class);
    archive.addClass(MyTopicMDB.class);
    FractionUsageAnalyzer analyzer = new FractionUsageAnalyzer();

    final File out = Files.createTempFile(archive.getName(), ".war").toFile();
    out.deleteOnExit();
    archive.as(ZipExporter.class).exportTo(out, true);

    analyzer.source(out);
    assertThat(analyzer.detectNeededFractions()
                       .stream()
                       .filter(fd -> fd.getArtifactId().equals("messaging"))
                       .count()).isEqualTo(1);
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:17,代码来源:MessagingTest.java

示例4: testFractionMatchingWebXML

import org.jboss.shrinkwrap.api.exporter.ZipExporter; //导入依赖的package包/类
@Test
public void testFractionMatchingWebXML() throws Exception {
    JARArchive archive = ShrinkWrap.create(JARArchive.class);
    archive.addAsResource("WEB-INF/web.xml");
    FractionUsageAnalyzer analyzer = new FractionUsageAnalyzer();

    final File out = Files.createTempFile(archive.getName(), ".war").toFile();
    out.deleteOnExit();
    archive.as(ZipExporter.class).exportTo(out, true);
    analyzer.source(out);

    assertThat(analyzer.detectNeededFractions()
                   .stream()
                   .filter(fd -> fd.getArtifactId().equals("security"))
                   .count()).isEqualTo(1);
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:17,代码来源:SecurityTest.java

示例5: testFractionMatchingAnnotation

import org.jboss.shrinkwrap.api.exporter.ZipExporter; //导入依赖的package包/类
@Test
public void testFractionMatchingAnnotation() throws Exception {
    JARArchive archive = ShrinkWrap.create(JARArchive.class);
    archive.addClass(SecurityEndpoint.class);
    FractionUsageAnalyzer analyzer = new FractionUsageAnalyzer();

    final File out = Files.createTempFile(archive.getName(), ".war").toFile();
    out.deleteOnExit();
    archive.as(ZipExporter.class).exportTo(out, true);
    analyzer.source(out);

    assertThat(analyzer.detectNeededFractions()
                   .stream()
                   .filter(fd -> fd.getArtifactId().equals("security"))
                   .count()).isEqualTo(1);
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:17,代码来源:SecurityTest.java

示例6: testFractionMatching

import org.jboss.shrinkwrap.api.exporter.ZipExporter; //导入依赖的package包/类
@Test
public void testFractionMatching() throws Exception {
    JARArchive archive = ShrinkWrap.create(JARArchive.class);
    archive.addAsResource("META-INF/persistence.xml");
    FractionUsageAnalyzer analyzer = new FractionUsageAnalyzer();

    final File out = Files.createTempFile(archive.getName(), ".war").toFile();
    out.deleteOnExit();
    archive.as(ZipExporter.class).exportTo(out, true);

    analyzer.source(out);
    assertThat(analyzer.detectNeededFractions()
                   .stream()
                   .filter(fd -> fd.getArtifactId().equals("jpa"))
                   .count()).isEqualTo(1);
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:17,代码来源:JPATest.java

示例7: testFractionMatching

import org.jboss.shrinkwrap.api.exporter.ZipExporter; //导入依赖的package包/类
@Test
public void testFractionMatching() throws Exception {
    JARArchive archive = ShrinkWrap.create(JARArchive.class);
    archive.addAsResource("WEB-INF/faces-config.xml");
    FractionUsageAnalyzer analyzer = new FractionUsageAnalyzer();

    final File out = Files.createTempFile(archive.getName(), ".war").toFile();
    out.deleteOnExit();
    archive.as(ZipExporter.class).exportTo(out, true);
    analyzer.source(out);

    assertThat(analyzer.detectNeededFractions()
                   .stream()
                   .filter(fd -> fd.getArtifactId().equals("jsf"))
                   .count()).isEqualTo(1);
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:17,代码来源:JsfIT.java

示例8: testFractionMatching

import org.jboss.shrinkwrap.api.exporter.ZipExporter; //导入依赖的package包/类
@Test
public void testFractionMatching() throws Exception {
    JARArchive archive = ShrinkWrap.create(JARArchive.class);
    archive.addAsResource("WEB-INF/beans.xml");
    FractionUsageAnalyzer analyzer = new FractionUsageAnalyzer();

    final File out = Files.createTempFile(archive.getName(), ".war").toFile();
    out.deleteOnExit();
    archive.as(ZipExporter.class).exportTo(out, true);
    analyzer.source(out);

    assertThat(analyzer.detectNeededFractions()
                   .stream()
                   .filter(fd -> fd.getArtifactId().equals("cdi"))
                   .count()).isEqualTo(1);
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:17,代码来源:CDITest.java

示例9: testFractionMatchingWEBINFClasses

import org.jboss.shrinkwrap.api.exporter.ZipExporter; //导入依赖的package包/类
@Test
public void testFractionMatchingWEBINFClasses() throws Exception {
    JARArchive archive = ShrinkWrap.create(JARArchive.class);
    archive.addAsResource("WEB-INF/classes/META-INF/beans.xml");
    FractionUsageAnalyzer analyzer = new FractionUsageAnalyzer();

    final File out = Files.createTempFile(archive.getName(), ".war").toFile();
    out.deleteOnExit();
    archive.as(ZipExporter.class).exportTo(out, true);
    analyzer.source(out);

    assertThat(analyzer.detectNeededFractions()
                   .stream()
                   .filter(fd -> fd.getArtifactId().equals("cdi"))
                   .count()).isEqualTo(1);
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:17,代码来源:CDITest.java

示例10: testFractionMatchingMETAINF

import org.jboss.shrinkwrap.api.exporter.ZipExporter; //导入依赖的package包/类
@Test
public void testFractionMatchingMETAINF() throws Exception {
    JARArchive archive = ShrinkWrap.create(JARArchive.class);
    archive.addAsResource("META-INF/beans.xml");
    FractionUsageAnalyzer analyzer = new FractionUsageAnalyzer();

    final File out = Files.createTempFile(archive.getName(), ".war").toFile();
    out.deleteOnExit();
    archive.as(ZipExporter.class).exportTo(out, true);
    analyzer.source(out);

    assertThat(analyzer.detectNeededFractions()
                   .stream()
                   .filter(fd -> fd.getArtifactId().equals("cdi"))
                   .count()).isEqualTo(1);
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:17,代码来源:CDITest.java

示例11: withModules

import org.jboss.shrinkwrap.api.exporter.ZipExporter; //导入依赖的package包/类
public SwarmExecutor withModules(final List<Path> moduleDirs) {
    if (this.executable != null && this.executable instanceof ExecutableJar) {
        throw new RuntimeException("Cannot use modules with an executable jar");
    }
    final File moduleJar = new File(System.getProperty("java.io.tmpdir"),
                                    "swarm-module-overrides.jar");
    final JavaArchive moduleArchive = ShrinkWrap.create(JavaArchive.class);

    boolean modulesAdded = false;
    for (Path moduleDir : moduleDirs) {
        if (moduleDir.toFile().exists()) {
            moduleArchive.addAsResource(moduleDir.toFile(), "modules");
            modulesAdded = true;
        }
    }

    if (modulesAdded) {
        moduleArchive.as(ZipExporter.class)
                .exportTo(moduleJar, true);

        withClasspathEntry(moduleJar.toPath());
    }

    return this;
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:26,代码来源:SwarmExecutor.java

示例12: createJar

import org.jboss.shrinkwrap.api.exporter.ZipExporter; //导入依赖的package包/类
private File createJar(String baseName, Path dir) throws IOException {
    File out = getOutputFile(baseName, dir);
    if (!out.getParentFile().exists() && !out.getParentFile().mkdirs()) {
        this.log.error("Failed to create parent directory for: " + out.getAbsolutePath());
    }
    ZipExporter exporter = this.archive.as(ZipExporter.class);
    try (FileOutputStream fos = new FileOutputStream(out)) {
        if (executable) {
            try (InputStream is = getLaunchScript()) {
                IOUtil.copy(is, fos);
            }
        }
        exporter.exportTo(fos);
    }
    if (executable) {
        if (!out.setExecutable(true)) {
            this.log.error("Failed to set executable flag");
        }
    }
    return out;
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:22,代码来源:BuildTool.java

示例13: resolve

import org.jboss.shrinkwrap.api.exporter.ZipExporter; //导入依赖的package包/类
@Override
public ArtifactSpec resolve(ArtifactSpec spec) throws Exception {
    File resolved = resolvedArtifacts.get(spec);

    if (resolved == null) {
        Archive archive = artifacts.get(spec);
        if (archive != null) {
            resolved = File.createTempFile(spec.artifactId(), ".jar");
            resolved.delete();
            resolved.deleteOnExit();
            archive.as(ZipExporter.class).exportTo(resolved);
            this.resolvedArtifacts.put(spec, resolved);
        }
    }
    spec.file = resolved;
    return spec;

}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:19,代码来源:MockArtifactResolver.java

示例14: createShrinkWrapDomain

import org.jboss.shrinkwrap.api.exporter.ZipExporter; //导入依赖的package包/类
private void createShrinkWrapDomain() {
    ClassLoader originalCl = Thread.currentThread().getContextClassLoader();
    try {
        if (isFatJar()) {
            Module appModule = Module.getBootModuleLoader().loadModule(APPLICATION_MODULE_NAME);
            Thread.currentThread().setContextClassLoader(appModule.getClassLoader());
        }
        Domain domain = ShrinkWrap.getDefaultDomain();
        domain.getConfiguration().getExtensionLoader().addOverride(ZipExporter.class, ZipExporterImpl.class);
        domain.getConfiguration().getExtensionLoader().addOverride(ZipImporter.class, ZipImporterImpl.class);
        domain.getConfiguration().getExtensionLoader().addOverride(ExplodedExporter.class, ExplodedExporterImpl.class);
        domain.getConfiguration().getExtensionLoader().addOverride(ExplodedImporter.class, ExplodedImporterImpl.class);
        domain.getConfiguration().getExtensionLoader().addOverride(JavaArchive.class, JavaArchiveImpl.class);
        domain.getConfiguration().getExtensionLoader().addOverride(WebArchive.class, WebArchiveImpl.class);
    } catch (Exception e) {
        SwarmMessages.MESSAGES.shrinkwrapDomainSetupFailed(e);
    } finally {
        Thread.currentThread().setContextClassLoader(originalCl);
    }
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:21,代码来源:Swarm.java

示例15: addContent

import org.jboss.shrinkwrap.api.exporter.ZipExporter; //导入依赖的package包/类
public byte[] addContent(Archive<?> archive) throws IOException, URISyntaxException {
    try {
        MessageDigest messageDigest = MessageDigest.getInstance("SHA-1");
        byte[] sha1Bytes;
        messageDigest.reset();
        BufferedInputStream bis = new BufferedInputStream(archive.as(ZipExporter.class).exportAsInputStream());
        byte[] bytes = new byte[8192];
        int read;
        while ((read = bis.read(bytes)) > -1) {
            messageDigest.update(bytes, 0, read);
        }
        sha1Bytes = messageDigest.digest();
        String key = toKey(sha1Bytes);
        this.fs.addArchive(archive.getName(), archive);
        this.index.put(key, this.fsMount.getChild(archive.getName()).toURI());
        return sha1Bytes;
    } catch (NoSuchAlgorithmException e) {
        throw new IOException(e);
    }
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:21,代码来源:SwarmContentRepository.java


注:本文中的org.jboss.shrinkwrap.api.exporter.ZipExporter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。