use of java.lang.reflect.ReflectPermission in project wildfly by wildfly.
the class InfinispanResourceRefTestCase method deployment.
@Deployment
public static Archive<?> deployment() {
WebArchive war = ShrinkWrap.create(WebArchive.class, "infinispan-resource-ref.war");
war.addClasses(InfinispanBean.class, InfinispanResourceRefTestCase.class);
war.addAsWebInfResource(getWebXml(), "web.xml");
war.setManifest(new StringAsset(Descriptors.create(ManifestDescriptor.class).attribute("Dependencies", "org.infinispan export").exportAsString()));
war.addAsManifestResource(createPermissionsXmlAsset(new MBeanPermission("-#-[-]", "queryNames"), new MBeanPermission("org.infinispan.*[jboss.infinispan:*,type=Cache]", "registerMBean"), new ReflectPermission("suppressAccessChecks"), new RuntimePermission("accessDeclaredMembers"), new RuntimePermission("getClassLoader")), "permissions.xml");
return war;
}
use of java.lang.reflect.ReflectPermission in project wildfly by wildfly.
the class JCETestCase method deployment.
@Deployment
public static Archive<?> deployment() throws Exception {
final JavaArchive jce = ShrinkWrap.create(JavaArchive.class, "jcetest.jar").addPackage(DummyProvider.class.getPackage());
final File jceJar = new File("target/jcetest.jar");
jce.as(ZipExporter.class).exportTo(jceJar, true);
final File signedJceJar = new File("target/jcetestsigned.jar");
JavaArchive signedJce;
if (isJCETestable()) {
// see genkey-jcetest-keystore in pom.xml for the keystore creation
final JarSignerUtil signer = new JarSignerUtil(new File("target/jcetest.keystore"), "password", "password", /* alias */
"test");
signer.sign(jceJar, signedJceJar);
signer.verify(signedJceJar);
signedJce = ShrinkWrap.create(ZipImporter.class, "jcetestsigned.jar").importFrom(signedJceJar).as(JavaArchive.class);
} else {
log.trace("skipping the test since it can run on Oracle JDK only");
signedJce = jce;
}
final WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war").addClasses(ControllerServlet.class);
final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "jcetest.ear").addAsLibrary(signedJce).addAsModule(war).addAsManifestResource(JCETestCase.class.getPackage(), "jboss-deployment-structure.xml", "jboss-deployment-structure.xml");
// ControllerServlet and DummyProvider need the following perms for their "dirty" game
ear.addAsManifestResource(createPermissionsXmlAsset(new FilePermission("target/jcetest.keystore", "read"), new RuntimePermission("accessDeclaredMembers"), new ReflectPermission("suppressAccessChecks"), new RuntimePermission("accessClassInPackage.sun.security.validator"), new SecurityPermission("putProviderProperty.DP"), new SecurityPermission("insertProvider"), new RuntimePermission("getProtectionDomain")), "permissions.xml");
return ear;
}
use of java.lang.reflect.ReflectPermission in project wildfly by wildfly.
the class ResourceAdapterCapacityPoliciesTestCase method createResourceAdapter.
@Deployment
public static Archive<?> createResourceAdapter() {
ResourceAdapterArchive rar = ShrinkWrap.create(ResourceAdapterArchive.class, "capacity-policies-test.rar");
rar.addAsManifestResource(LazyResourceAdapter.class.getPackage(), "ra-notx.xml", "ra.xml");
JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "capacity-policies-test.jar");
jar.addClass(LazyResourceAdapter.class).addClass(LazyManagedConnectionFactory.class).addClass(LazyManagedConnection.class).addClass(LazyConnection.class).addClass(LazyConnectionImpl.class).addClass(LazyXAResource.class).addClass(LazyLocalTransaction.class).addClass(LazyManagedConnectionMetaData.class).addClass(LazyConnectionFactory.class).addClass(LazyConnectionFactoryImpl.class);
jar.addClasses(ResourceAdapterCapacityPoliciesTestCase.class, AbstractMgmtServerSetupTask.class, AbstractMgmtTestBase.class, JcaMgmtBase.class, ContainerResourceMgmtTestBase.class, MgmtOperationException.class, ManagementOperations.class, JcaTestsUtil.class, TimeoutUtil.class);
rar.addAsManifestResource(new StringAsset("Dependencies: javax.inject.api,org.jboss.as.connector," + "org.jboss.as.controller,org.jboss.dmr,org.jboss.staxmapper," + "org.jboss.ironjacamar.impl, org.jboss.ironjacamar.jdbcadapters,org.jboss.remoting\n"), "MANIFEST.MF");
rar.addAsManifestResource(createPermissionsXmlAsset(new RemotingPermission("createEndpoint"), new RemotingPermission("connect"), new FilePermission(System.getProperty("jboss.inst") + "/standalone/tmp/auth/*", "read"), new PropertyPermission("ts.timeout.factor", "read"), new RuntimePermission("accessDeclaredMembers"), new ReflectPermission("suppressAccessChecks")), "permissions.xml");
rar.addAsLibrary(jar);
return rar;
}
use of java.lang.reflect.ReflectPermission 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");
}
}
use of java.lang.reflect.ReflectPermission in project wildfly by wildfly.
the class DeploymentHelper method getWebArchiveWithPermissions.
public WebArchive getWebArchiveWithPermissions(final String archiveName) {
final String javaHome = TestSuiteEnvironment.getSystemProperty("java.home");
final String serverHostPort = TestSuiteEnvironment.getServerAddress() + ":" + TestSuiteEnvironment.getHttpPort();
final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, archiveName + ".war").addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")).addAsManifestResource(PermissionUtils.createPermissionsXmlAsset(new ReflectPermission("suppressAccessChecks"), new ReflectPermission("accessDeclaredMembers"), // Permissions for port access
new PropertyPermission("management.address", "read"), new PropertyPermission("node0", "read"), new PropertyPermission("jboss.http.port", "read"), new SocketPermission(serverHostPort, "connect,resolve"), // Permissions for the new client creation
new RuntimePermission("accessDeclaredMembers"), new RuntimePermission("createClassLoader"), new RuntimePermission("getClassLoader"), new RuntimePermission("org.apache.cxf.permission"), new RuntimePermission("accessClassInPackage.com.sun.org.apache.xerces.internal.jaxp"), new FilePermission(javaHome + File.separator + "lib" + File.separator + "wsdl.properties", "read"), new PropertyPermission("user.dir", "read"), new PropertyPermission("arquillian.debug", "read"), new FilePermission(System.getProperty("basedir") + File.separator + "target" + File.separator + "workdir" + File.separator + "xcatalog", "read")), "permissions.xml");
return webArchive;
}
Aggregations