Package org.codehaus.loom.xmlpolicy.runtime

Examples of org.codehaus.loom.xmlpolicy.runtime.DefaultPolicy


        final CodeSource codeSource = new CodeSource( url, new Certificate[ 0 ] );
        final AllPermission allPermission = new AllPermission();
        final HashMap grants = new HashMap();
        grants.put( codeSource, new Permission[]{allPermission} );

        final Policy policy = new DefaultPolicy( grants );
        policy.refresh();
        final PermissionCollection resultPermissions = policy.getPermissions( codeSource );
        final Enumeration enumeration = resultPermissions.elements();
        while( enumeration.hasMoreElements() )
        {
            final Permission permission = (Permission)enumeration.nextElement();
            assertEquals( "Permissions for codeSource" + codeSource,
View Full Code Here


        final CodeSource codeSource = new CodeSource( url, new Certificate[ 0 ] );
        final AllPermission allPermission = new AllPermission();
        final HashMap grants = new HashMap();
        grants.put( codeSource, new Permission[]{allPermission} );

        final Policy policy = new DefaultPolicy( grants );
        policy.refresh();
        final PermissionCollection resultPermissions = policy.getPermissions( new CodeSource( null, new Certificate[ 0 ] ) );
        final Enumeration enumeration = resultPermissions.elements();
        assertEquals( "Permissions for codeSource" + codeSource,
                      false, enumeration.hasMoreElements() );
    }
View Full Code Here

    }

    public void testPolicyAccessPermissionForNonSpecifiedCodeBase()
        throws Exception
    {
        final Policy policy = new DefaultPolicy();
        policy.refresh();

        final URL url = new URL( "http://spice.sourceforge.net/-" );
        final CodeSource codeSource = new CodeSource( url, new Certificate[ 0 ] );
        final PermissionCollection permissions = policy.getPermissions( codeSource );
        assertEquals( "Expect no permissions for http://...", false, permissions.elements().hasMoreElements() );

        final CodeSource otherCodeSource = new CodeSource( null, new Certificate[ 0 ] );
        final PermissionCollection otherPermissions = policy.getPermissions( otherCodeSource );
        assertEquals( "Expect no permissions for null location", false, otherPermissions.elements().hasMoreElements() );
    }
View Full Code Here

    }

    public Policy createPolicy( Map grants )
        throws Exception
    {
        return new DefaultPolicy( grants );
    }
View Full Code Here

TOP

Related Classes of org.codehaus.loom.xmlpolicy.runtime.DefaultPolicy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.