Search in sources :

Example 1 with VirtualFilePermission

use of org.jboss.vfs.VirtualFilePermission in project wildfly by wildfly.

the class ServletResourceOverlaysTestCase method single.

@Deployment
public static WebArchive single() {
    WebArchive war = ShrinkWrap.create(WebArchive.class, "single.war");
    war.addAsWebResource(new StringAsset("a"), "a.txt");
    war.addAsWebResource(new StringAsset("b"), "b.txt");
    war.addClass(PathAccessCheckServlet.class);
    war.addAsManifestResource(createPermissionsXmlAsset(new FilePermission("/-", "read"), new PropertyPermission("java.io.tmpdir", "read"), new VirtualFilePermission(Paths.get(System.getProperty("java.io.tmpdir"), "noaccess.txt").toFile().getAbsolutePath(), "read")), "permissions.xml");
    JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "test.jar");
    jar.addAsManifestResource(new StringAsset("b - overlay"), new BasicPath("resources", "b.txt"));
    jar.addAsManifestResource(new StringAsset("c - overlay"), new BasicPath("resources", "c.txt"));
    war.addAsLibrary(jar);
    return war;
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) PropertyPermission(java.util.PropertyPermission) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) VirtualFilePermission(org.jboss.vfs.VirtualFilePermission) BasicPath(org.jboss.shrinkwrap.impl.base.path.BasicPath) FilePermission(java.io.FilePermission) VirtualFilePermission(org.jboss.vfs.VirtualFilePermission) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Aggregations

FilePermission (java.io.FilePermission)1 PropertyPermission (java.util.PropertyPermission)1 Deployment (org.jboss.arquillian.container.test.api.Deployment)1 StringAsset (org.jboss.shrinkwrap.api.asset.StringAsset)1 JavaArchive (org.jboss.shrinkwrap.api.spec.JavaArchive)1 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)1 BasicPath (org.jboss.shrinkwrap.impl.base.path.BasicPath)1 VirtualFilePermission (org.jboss.vfs.VirtualFilePermission)1