Search in sources :

Example 1 with ManifestContainer

use of org.jboss.shrinkwrap.api.container.ManifestContainer in project wildfly by wildfly.

the class FaultToleranceApplicationArchiveProcessor method process.

@Override
public void process(Archive<?> applicationArchive, TestClass testClass) {
    if (!(applicationArchive instanceof ClassContainer)) {
        return;
    }
    ClassContainer<?> classContainer = (ClassContainer<?>) applicationArchive;
    classContainer.addClass(CleanupMetricRegistries.class);
    if (applicationArchive instanceof LibraryContainer) {
        JavaArchive additionalBeanArchive = ShrinkWrap.create(JavaArchive.class);
        additionalBeanArchive.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
        ((LibraryContainer<?>) applicationArchive).addAsLibrary(additionalBeanArchive);
    } else {
        classContainer.addAsResource(EmptyAsset.INSTANCE, "META-INF/beans.xml");
    }
    if (!applicationArchive.contains("META-INF/beans.xml")) {
        applicationArchive.add(EmptyAsset.INSTANCE, "META-INF/beans.xml");
    }
    // Run the TCK with security manager
    if (applicationArchive instanceof ManifestContainer) {
        ManifestContainer<?> mc = (ManifestContainer<?>) applicationArchive;
        mc.addAsManifestResource(createPermissionsXmlAsset(// Permissions required by test instrumentation - arquillian-core.jar and arquillian-testng.jar
        new ReflectPermission("suppressAccessChecks"), new PropertyPermission("*", "read"), new RuntimePermission("accessDeclaredMembers"), // Permissions required by test instrumentation - awaitility.jar
        new RuntimePermission("setDefaultUncaughtExceptionHandler"), new RuntimePermission("modifyThread")), "permissions.xml");
    }
}
Also used : PropertyPermission(java.util.PropertyPermission) ClassContainer(org.jboss.shrinkwrap.api.container.ClassContainer) LibraryContainer(org.jboss.shrinkwrap.api.container.LibraryContainer) ManifestContainer(org.jboss.shrinkwrap.api.container.ManifestContainer) ReflectPermission(java.lang.reflect.ReflectPermission) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive)

Aggregations

ReflectPermission (java.lang.reflect.ReflectPermission)1 PropertyPermission (java.util.PropertyPermission)1 ClassContainer (org.jboss.shrinkwrap.api.container.ClassContainer)1 LibraryContainer (org.jboss.shrinkwrap.api.container.LibraryContainer)1 ManifestContainer (org.jboss.shrinkwrap.api.container.ManifestContainer)1 JavaArchive (org.jboss.shrinkwrap.api.spec.JavaArchive)1