org.jboss.shrinkwrap.impl.base.path.BasicPath Java Examples

The following examples show how to use org.jboss.shrinkwrap.impl.base.path.BasicPath. 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: DeploymentArchiveUtils.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Create enterprise EAR archive for deployment testing
 *
 * @param archiveName Name of archive
 * @param content Context of page.html file
 * @return Return created {@link File} instance
 */
public static File createEnterpriseArchive(String archiveName, String subArchiveName, String content) {

    WebArchive war = ShrinkWrap.create(WebArchive.class, archiveName);
    war.addAsWebResource(new StringAsset(content), "page.html");
    final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class,
            subArchiveName);
    ear.add(war, new BasicPath("/"), ZipExporter.class);

    final String tempDir = TestSuiteEnvironment.getTmpDir();
    File file = new File(tempDir, ear.getName());
    new ZipExporterImpl(ear).exportTo(file, true);
    return file;
}
 
Example #2
Source File: MicroProfileRestClientTCKArchiveProcessor.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Override
public void process(final Archive<?> archive, final TestClass testClass) {
    if (archive instanceof WebArchive) {

        WebArchive webArchive = (WebArchive) archive;
        final Map<ArchivePath, Node> content = webArchive.getContent();

        final Node node = content.get(new BasicPath("META-INF/certificates-dir.txt"));
        if (node != null) {
            webArchive.addAsResource(node.getAsset(), "META-INF/certificates-dir.txt");
        }
    }
}