Examples of PolicyEntry


Examples of org.apache.harmony.security.PolicyEntry

     */
    public void testImpliesCodeSource() throws Exception {
        CodeSource cs1 = new CodeSource(null, (Certificate[])null);
        CodeSource cs2 = new CodeSource(new URL("file://*"),
            (Certificate[])null);
        PolicyEntry pe = new PolicyEntry(null, null, null);

        assertTrue(pe.impliesCodeSource(null));
        assertTrue(pe.impliesCodeSource(cs1));
        assertTrue(pe.impliesCodeSource(cs2));

        pe = new PolicyEntry(cs2, null, null);
        assertFalse(pe.impliesCodeSource(null));
        assertFalse(pe.impliesCodeSource(cs1));
        assertTrue(pe.impliesCodeSource(cs2));
        assertTrue(pe.impliesCodeSource(new CodeSource(new URL("file://-"),
            (Certificate[])null)));
    }
View Full Code Here

Examples of org.apache.harmony.security.PolicyEntry

    /**
     * Null or empty set of Principals of PolicyEntry implies any Principals;
     * otherwise tested set must contain all Principals of PolicyEntry.
     */
    public void testImpliesPrincipals() {
        PolicyEntry pe = new PolicyEntry(null, null, null);
        Principal[] pp1 = new Principal[] {};
        Principal[] pp2 = new Principal[] { new UnresolvedPrincipal("a.b.c",
            "XXX") };
        Principal[] pp3 = new Principal[] {
            new UnresolvedPrincipal("a.b.c", "YYY"),
            new UnresolvedPrincipal("a.b.c", "XXX"),
            new UnresolvedPrincipal("e.f.g", "ZZZ") };

        assertTrue(pe.impliesPrincipals(null));
        assertTrue(pe.impliesPrincipals(pp1));

        pe = new PolicyEntry(null, new HashSet(), null);
        assertTrue(pe.impliesPrincipals(pp3));

        pe = new PolicyEntry(null, Arrays.asList(pp2), null);
        assertFalse(pe.impliesPrincipals(null));
        assertFalse(pe.impliesPrincipals(pp1));
        assertTrue(pe.impliesPrincipals(pp3));
    }
View Full Code Here

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

    public void testNullCodeSourceInEntryCtor()
        throws Exception
    {
        try
        {
            new PolicyEntry( null, new Permissions() );
            fail( "Expected to fail due to null pointer in ctor" );
        }
        catch( final NullPointerException npe )
        {
            assertEquals( "NPE message",
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.