Code example for FilePermission

0
 
        PermissionCollection pc = ap.getPermissions(new ProtectionDomain(null,null));
 
        assertNotNull(pc);
 
        Permission testPerm = new FilePermission("/tmp","read");
 
        assertTrue(pc.implies(testPerm));
 
    } 
 
    /**  
     * Simple test of loading a policy file with a single codebase defined that grants specific  
     * FilePermission.  Then test that read and write were granted but delete was not. 
     */ 
    @Test 
    public void testSingleCodebaseFilePermissionLoader() throws Exception 
    { 
        JettyPolicy ap = new JettyPolicy(  MavenTestingUtils.getTestResourceDir("policy-test-2").getAbsolutePath(), evaluator );
         
Stop searching for code, let great code find you!  Add Codota to your java IDE