org.jboss.shrinkwrap.api.Archive.delete()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(136)

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

Archive.delete介绍

[英]Removes the Node in the Archive at the ArchivePath indicated by the specified String archivePath. If the path is a directory, recursively removes all contents. If the path does not exist, return null.
[中]在指定字符串ArchivePath指示的ArchivePath处删除存档中的节点。如果路径是目录,则递归删除所有内容。如果路径不存在,则返回null。

代码示例

代码示例来源:origin: org.jboss.shrinkwrap/shrinkwrap-impl-base

/**
 * {@inheritDoc}
 *
 * @see org.jboss.shrinkwrap.api.Archive#delete(org.jboss.shrinkwrap.api.ArchivePath)
 */
@Override
public Node delete(ArchivePath path) {
  return this.getArchive().delete(path);
}

代码示例来源:origin: org.arquillian.liferay/arquillian-deployment-generator-bnd

private void replaceManifest(
  Archive<?> archive, ByteArrayAsset byteArrayAsset) {
  archive.delete(MANIFEST_PATH);
  archive.add(byteArrayAsset, MANIFEST_PATH);
}

代码示例来源:origin: org.jboss.arquillian.extension/arquillian-jacoco

public void removeSignatureFiles(Archive<?> archive) {
  // Remove signatures files if any
  Map<ArchivePath, Node> signatureFiles = getSignatureFiles(archive);
  for (Entry<ArchivePath, Node> entry : signatureFiles.entrySet()) {
    // We don't want these at all - remove
    archive.delete(entry.getKey());
  }
}

代码示例来源:origin: arquillian/arquillian-extension-jacoco

public void removeSignatureFiles(Archive<?> archive) {
  // Remove signatures files if any
  Map<ArchivePath, Node> signatureFiles = getSignatureFiles(archive);
  for (Entry<ArchivePath, Node> entry : signatureFiles.entrySet()) {
    // We don't want these at all - remove
    archive.delete(entry.getKey());
  }
}

代码示例来源:origin: org.arquillian.liferay/arquillian-processor-osgi-allin

@Override
public void replaceManifest(Archive archive, Manifest manifest )
  throws IOException {
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  manifest.write(baos);
  ByteArrayAsset byteArrayAsset = new ByteArrayAsset(baos.toByteArray());
  archive.delete(JarFile.MANIFEST_NAME);
  archive.add(byteArrayAsset, JarFile.MANIFEST_NAME);
}

代码示例来源:origin: arquillian/arquillian-extension-jacoco

private void instrument(Archive<?> archive, Map<ArchivePath, Node> classes) {
    for (Map.Entry<ArchivePath, Node> entry : classes.entrySet()) {
      final Asset original = entry.getValue().getAsset();
      archive.delete(entry.getKey());
      archive.add(new InstrumentedAsset(original), entry.getKey());
    }
  }
}

代码示例来源:origin: org.jboss.arquillian.extension/arquillian-jacoco

private void instrument(Archive<?> archive, Map<ArchivePath, Node> classes) {
    for (Map.Entry<ArchivePath, Node> entry : classes.entrySet()) {
      final Asset original = entry.getValue().getAsset();
      archive.delete(entry.getKey());
      archive.add(new InstrumentedAsset(original), entry.getKey());
    }
  }
}

代码示例来源:origin: org.jboss.arquillian.extension/arquillian-jacoco

public void removeManifestDigests(Archive<?> archive) {
  Map<ArchivePath, Node> manifests = getManifestFiles(archive);
  for (Entry<ArchivePath, Node> entry : manifests.entrySet()) {
    Asset original = entry.getValue().getAsset();
    archive.delete(entry.getKey());
    archive.add(new ManifestAsset(original), entry.getKey());
  }
}

代码示例来源:origin: org.jboss.shrinkwrap/shrinkwrap-impl-base

/**
 * {@inheritDoc}
 *
 * @see org.jboss.shrinkwrap.api.Archive#delete(java.lang.String)
 */
@Override
public Node delete(String archivePath) {
  Validate.notNull(archivePath, "No path was specified");
  return getArchive().delete(archivePath);
}

代码示例来源:origin: org.arquillian.liferay/arquillian-processor-osgi-allin

@Override
public void replaceBundleActivatorsFile(
    Archive archive, String fileName, List<String> bundleActivators)
  throws IOException {
  ByteArrayOutputStream bundleActivatorAsOutputStream =
    _getBundleActivatorAsOutputStream(bundleActivators);
  ByteArrayAsset byteArrayAsset = new ByteArrayAsset(
    bundleActivatorAsOutputStream.toByteArray());
  archive.delete(fileName);
  archive.add(byteArrayAsset, fileName);
}

代码示例来源:origin: com.kumuluz.ee.testing/kumuluzee-arquillian-container

private static void moveDir(Archive<?> archive, String source, String target) {
  if (archive.contains(source)) {
    Archive<?> tmp = ShrinkWrap.create(JavaArchive.class);
    copyDir(archive, tmp, source, target);
    archive.merge(tmp);
    archive.delete(source);
  }
}

代码示例来源:origin: org.jboss.forge.test/arquillian-forge-core

@Override
  public void process(Archive<?> archive)
  {
   if ("arquillian-core.jar".equals(archive.getName()))
   {
     Node node = archive.get("org/jboss/shrinkwrap/descriptor");
     if (node != null)
      archive.delete(node.getPath());
   }
  }
}

代码示例来源:origin: wildfly-swarm-archive/ARCHIVE-wildfly-swarm

@Override
protected Archive<?> filter(Archive<?> archive) {
  final Set<ArtifactSpec> moduleSpecs = dependencyManager.getModuleDependencies();
  final Set<ArtifactSpec> nonSwarmSpecs = dependencyManager.getNonSwarmDependencies();
  archive.getContent().values().stream()
      .filter(node -> node.getPath().get().startsWith(WEB_INF_LIB))
      .filter(node -> !nodeIsInArtifactList(node, nonSwarmSpecs, false)
          && (nodeIsInArtifactList(node, moduleSpecs, true)
          || nodeIsSwarmArtifact(node)))
      .forEach(node -> archive.delete(node.getPath()));
  return archive;
}

代码示例来源:origin: io.thorntail/tools

protected void filter(ResolvedDependencies resolvedDependencies) {
  Set<ArchivePath> remove = new HashSet<>();
  filter(remove, getArchive().get(ArchivePaths.root()), resolvedDependencies);
  for (ArchivePath each : remove) {
    getArchive().delete(each);
  }
}

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

protected void filter(ResolvedDependencies resolvedDependencies) {
  Set<ArchivePath> remove = new HashSet<>();
  filter(remove, getArchive().get(ArchivePaths.root()), resolvedDependencies);
  for (ArchivePath each : remove) {
    getArchive().delete(each);
  }
}

代码示例来源:origin: org.arquillian.container/arquillian-droidium-container

@Override
  protected File process(File toResign) throws Exception {

    Archive<?> apk = ShrinkWrap.createFromZipFile(JavaArchive.class, toResign);
    apk.delete("META-INF");

    File toSign = new File(androidSDK.getPlatformConfiguration().getTmpDir(), DroidiumFileUtils.getRandomAPKFileName());
    DroidiumFileUtils.export(apk, toSign);

    return super.process(toSign);
  }
}

代码示例来源:origin: org.jboss.shrinkwrap/shrinkwrap-impl-base

@Override
public T deleteClass(String fullyQualifiedClassName) throws IllegalArgumentException {
  Validate.notNull(fullyQualifiedClassName, "Class name must be specified");
  ArchivePath path = new BasicPath(getClassesPath(), AssetUtil.getFullPathForClassResource(fullyQualifiedClassName));
  getArchive().delete(path);
  return covarientReturn();
}

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

@Override
public T deleteClass(String fullyQualifiedClassName) throws IllegalArgumentException {
  Validate.notNull(fullyQualifiedClassName, "Class name must be specified");
  ArchivePath path = new BasicPath(getClassesPath(), AssetUtil.getFullPathForClassResource(fullyQualifiedClassName));
  getArchive().delete(path);
  return covarientReturn();
}

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

/**
 * Ensure deleting an asset requires a path
 *
 * @throws Exception
 */
@Test(expected = IllegalArgumentException.class)
public void testDeleteAssetRequiresArchivePath() throws Exception {
  Archive<T> archive = getArchive();
  archive.delete((ArchivePath) null);
  Assert.fail("Should have throw an IllegalArgumentException");
}

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

/**
 * Ensure deleting a missing asset returns correct status
 *
 * @throws Exception
 */
@Test
public void testDeleteMissingAsset() throws Exception {
  Archive<T> archive = getArchive();
  ArchivePath location = new BasicPath("/", "test.properties");
  Assert.assertNull("Deleting a non-existent Asset should return null", archive.delete(location));
}

相关文章