gpt4 book ai didi

org.jboss.shrinkwrap.api.exporter.ZipExporter.exportTo()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 06:04:40 26 4
gpt4 key购买 nike

本文整理了Java中org.jboss.shrinkwrap.api.exporter.ZipExporter.exportTo()方法的一些代码示例,展示了ZipExporter.exportTo()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipExporter.exportTo()方法的具体详情如下:
包路径:org.jboss.shrinkwrap.api.exporter.ZipExporter
类名称:ZipExporter
方法名:exportTo

ZipExporter.exportTo介绍

暂无

代码示例

代码示例来源:origin: hibernate/hibernate-orm

protected File buildLargeJar() throws Exception {
  final String fileName = "large.jar";
  final JavaArchive archive = ShrinkWrap.create( JavaArchive.class, fileName );
  // Build a large jar by adding a lorem ipsum file repeatedly.
  final Path loremipsumTxtFile = Paths.get( ScannerTests.class.getResource(
      "/org/hibernate/jpa/test/packaging/loremipsum.txt" ).toURI() );
  for ( int i = 0; i < 100; i++ ) {
    ArchivePath path = ArchivePaths.create( "META-INF/file" + i );
    archive.addAsResource( loremipsumTxtFile.toFile(), path );
  }
  File testPackage = new File( shrinkwrapArchiveDirectory, fileName );
  archive.as( ZipExporter.class ).exportTo( testPackage, true );
  return testPackage;
}

代码示例来源:origin: cbeust/testng

public static File generateJar(
  Class<?>[] classes, String[] resources, String prefix, String archiveName)
  throws IOException {
 File jarFile = File.createTempFile(prefix, ".jar");
 JavaArchive archive = ShrinkWrap.create(JavaArchive.class, archiveName).addClasses(classes);
 for (String resource : resources) {
  archive = archive.addAsResource(resource);
 }
 archive.as(ZipExporter.class).exportTo(jarFile, true);
 return jarFile;
}

代码示例来源:origin: crashub/crash

@Override
 public ClassLoader getClassLoader(JavaArchive jar) throws Exception {
  File tmp = File.createTempFile("crash", ".jar");
  assertTrue(tmp.delete());
  jar.as(ZipExporter.class).exportTo(tmp);
  return new URLClassLoader(new URL[]{tmp.toURI().toURL()});
 }
});

代码示例来源:origin: resteasy/Resteasy

war.as(ZipExporter.class).exportTo(new File("target", war.getName()), true);

代码示例来源:origin: crashub/crash

@Override
protected void setUp() throws Exception {
 java.io.File warFile = java.io.File.createTempFile("test", ".war");
 warFile.deleteOnExit();
 JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "foo.jar");
 jar.addClass(FSTestCase.class);
 WebArchive war = ShrinkWrap.create(WebArchive.class);
 war.addAsLibraries(jar);
 ZipExporter exporter = war.as(ZipExporter.class);
 exporter.exportTo(warFile, true);
 this.warFile = warFile;
}

代码示例来源:origin: crashub/crash

public static File toFile(Archive archive, String ext) {
 File tmp = assertTmpFile(ext);
 if (tmp.delete()) {
  ZipExporter exporter = archive.as(ZipExporter.class);
  exporter.exportTo(tmp);
  tmp.deleteOnExit();
  return tmp;
 } else {
  throw failure("Could not delete tmp file " + tmp.getAbsolutePath());
 }
}

代码示例来源:origin: crashub/crash

public void testDuplicateResource() throws Exception {
 java.io.File file = java.io.File.createTempFile("test", ".jar");
 file.deleteOnExit();
 JavaArchive jar = ShrinkWrap.create(JavaArchive.class);
 jar.addClass(FSTestCase.class);
 jar.as(ZipExporter.class).exportTo(file, true);
 URLDriver driver = new URLDriver();
 driver.merge(file.toURI().toURL());
 driver.merge(file.toURI().toURL());
 Node node = driver.child(driver.child(driver.child(driver.child(driver.root(), "org"), "crsh"), "vfs"), "FSTestCase.class");
 Iterator<InputStream> i = driver.open(node);
 assertTrue(i.hasNext());
 i.next();
 assertTrue(i.hasNext());
 i.next();
 assertFalse(i.hasNext());
}

代码示例来源:origin: crashub/crash

final File tmp = File.createTempFile("crash", ".war");
assertTrue(tmp.delete());
war.as(ZipExporter.class).exportTo(tmp);
final byte[] bytes = Utils.readAsBytes(jar.get("foo/A.class").getAsset().openStream());
return new ClassLoader(Thread.currentThread().getContextClassLoader()) {

代码示例来源:origin: crashub/crash

archive.addClass(FSTestCase.class);
ZipExporter exporter = archive.as(ZipExporter.class);
exporter.exportTo(file, true);

代码示例来源:origin: wildfly/wildfly-core

/**
 * Exports given archive to the given file path.
 *
 * @param archive
 * @param filePath
 */
public static void saveArchive(Archive<?> archive, String filePath) {
  archive.as(ZipExporter.class).exportTo(new File(filePath), true);
}

代码示例来源:origin: org.wildfly/wildfly-testsuite-shared

/**
 * Exports given archive to the given folder.
 *
 * @param archive archive to export (not-<code>null</code>)
 * @param folderPath
 */
public static void saveArchiveToFolder(Archive<?> archive, String folderPath) {
  final File exportFile = new File(folderPath, archive.getName());
  LOGGER.trace("Exporting archive: " + exportFile.getAbsolutePath());
  archive.as(ZipExporter.class).exportTo(exportFile, true);
}

代码示例来源:origin: camunda/camunda-bpm-platform

wa.as(ZipExporter.class).exportTo(new File(webAppPath), true);

代码示例来源:origin: org.infinispan.server/infinispan-server-testsuite

private static void deployToServers(Archive<?> archive, String jarName) {
 File deployment = new File(System.getProperty("server1.dist"), "/standalone/deployments/" + jarName);
 archive.as(ZipExporter.class).exportTo(deployment, true);
 deployments.add(deployment);
}

代码示例来源:origin: org.wildfly.swarm/container

long sizeof(Entry entry) {
  if (entry.size == null) {
    SizingOutputStream sizingOutputStream = new SizingOutputStream();
    entry.archive.as(ZipExporter.class).exportTo(sizingOutputStream);
    entry.size = sizingOutputStream.getSize();
  }
  return entry.size;
}

代码示例来源:origin: com.java-adventures.junit/glassfish-junit-rule

public void deploy(Archive<?> archive) {
  try {
    ZipExporter exporter = archive.as(ZipExporter.class);
    File file = tmpFolder.newFile(archive.getName());
    exporter.exportTo(file, true);
    final String appName = getDeployer().deploy(file);
    log.info("Application {} deployed as {}", archive.getName(),
        appName);
  } catch (Exception e) {
    throw new RuntimeException("Deployment failed", e);
  }
}

代码示例来源:origin: org.juzu/juzu-core

@Test
public void testJarEntry() throws Exception {
 File tmp = File.createTempFile("juzu", ".jar");
 tmp.deleteOnExit();
 FileOutputStream baos = new FileOutputStream(tmp);
 jar.as(ZipExporter.class).exportTo(baos);
 URL url = new URL("jar:" + tmp.toURI().toURL() + "!/");
 assertFS(url);
}

代码示例来源:origin: juzu/juzu

@Test
public void testJarEntry() throws Exception {
 File tmp = File.createTempFile("juzu", ".jar");
 tmp.deleteOnExit();
 FileOutputStream baos = new FileOutputStream(tmp);
 jar.as(ZipExporter.class).exportTo(baos);
 URL url = new URL("jar:" + tmp.toURI().toURL() + "!/");
 assertFS(url);
}

代码示例来源:origin: org.wildfly.swarm/tools

public void repackageWar(File file) throws IOException {
  this.log.info("Repackaging .war: " + file);
  Path backupPath = get(file);
  move(file, backupPath, this.log);
  Archive original = ShrinkWrap.create(JavaArchive.class);
  try (InputStream inputStream = Files.newInputStream(backupPath)) {
    original.as(ZipImporter.class).importFrom(inputStream);
  }
  WebInfLibFilteringArchive repackaged = new WebInfLibFilteringArchive(original, this.dependencyManager);
  repackaged.as(ZipExporter.class).exportTo(file, true);
  this.log.info("Repackaged .war: " + file);
}

代码示例来源:origin: org.infinispan.server/infinispan-server-testsuite

@BeforeClass
public static void before() throws Exception {
  String serverDir = System.getProperty("server1.dist");
  JavaArchive jar = ShrinkWrap.create(JavaArchive.class);
  jar.addClass(LocalAuthTestServerTask.class);
  jar.addAsServiceProvider(ServerTask.class, LocalAuthTestServerTask.class);
  File f = new File(serverDir, "/standalone/deployments/custom-task-auth.jar");
  jar.as(ZipExporter.class).exportTo(f, true);
}

代码示例来源:origin: org.apache.meecrowave/meecrowave-arquillian

@Override
public ProtocolMetaData deploy(final Archive<?> archive) throws DeploymentException {
  final File dump = toArchiveDump(archive);
  archive.as(ZipExporter.class).exportTo(dump, true);
  final String context = sanitizeName(archive);
  container.deployWebapp(context, dump);
  final int port = configuration.isSkipHttp() ? configuration.getHttpsPort() : configuration.getHttpPort();
  return new ProtocolMetaData()
      .addContext(new HTTPContext(configuration.getHost(), port)
          .add(new Servlet("arquillian", context)));
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com