Java Code Examples for org.jboss.shrinkwrap.api.spec.JavaArchive#as()

The following examples show how to use org.jboss.shrinkwrap.api.spec.JavaArchive#as() . 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: ExtensionUtils.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static StreamExporter createResourceRoot(Class<? extends Extension> extension, Package... additionalPackages) throws IOException {
    final JavaArchive archive = ShrinkWrap.create(JavaArchive.class);
    storePackage(extension.getPackage(), extension.getClassLoader(), archive);
    if (additionalPackages != null) {
        for (Package pkg : additionalPackages) {
            storePackage(pkg, extension.getClassLoader(), archive);
        }
    }

    archive.addAsServiceProvider(Extension.class, extension);
    return archive.as(ZipExporter.class);
}
 
Example 2
Source File: ExtensionSetup.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
static StreamExporter createResourceRoot(Class<? extends Extension> extension, Package... additionalPackages) throws IOException {
    final JavaArchive archive = ShrinkWrap.create(JavaArchive.class);
    archive.addPackage(extension.getPackage());
    if (additionalPackages != null) {
        for (Package pkg : additionalPackages) {
            archive.addPackage(pkg);
        }
    }
    archive.addAsServiceProvider(Extension.class, extension);
    return archive.as(ZipExporter.class);
}
 
Example 3
Source File: ExtensionSetup.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
static StreamExporter createResourceRoot(Class<? extends Extension> extension, Package... additionalPackages) throws IOException {
    final JavaArchive archive = ShrinkWrap.create(JavaArchive.class);
    archive.addPackage(extension.getPackage());
    if (additionalPackages != null) {
        for (Package pkg : additionalPackages) {
            archive.addPackage(pkg);
        }
    }
    archive.addAsServiceProvider(Extension.class, extension);
    return archive.as(ZipExporter.class);
}
 
Example 4
Source File: ProcessStateListenerTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static StreamExporter createResourceRoot(Package... additionalPackages) {
    final JavaArchive archive = ShrinkWrap.create(JavaArchive.class);
    if (additionalPackages != null) {
        for (Package pkg : additionalPackages) {
            archive.addPackage(pkg);
        }
    }
    return archive.as(ZipExporter.class);
}
 
Example 5
Source File: TransformerSubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@BeforeClass
public static void createLegacyJars() throws IOException {
    JavaArchive legacySubsystemArchive = ShrinkWrap.create(JavaArchive.class, "legacy-archive-transformers.jar");
    legacySubsystemArchive.addPackage(VersionedExtension2.class.getPackage());
    StreamExporter exporter = legacySubsystemArchive.as(ZipExporter.class);

    Files.deleteIfExists(LEGACY_ARCHIVE);
    exporter.exportTo(LEGACY_ARCHIVE.toFile());
}
 
Example 6
Source File: TransformerAttachmentAndInspectModelSubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@BeforeClass
public static void createLegacyJars() throws IOException {
    JavaArchive legacySubsystemArchive = ShrinkWrap.create(JavaArchive.class, "legacy-archive.jar");
    legacySubsystemArchive.addPackage(NewExtension.class.getPackage());
    StreamExporter exporter = legacySubsystemArchive.as(ZipExporter.class);
    Files.deleteIfExists(LEGACY_ARCHIVE);
    exporter.exportTo(LEGACY_ARCHIVE.toFile());
}