Package org.codehaus.loom.xmlpolicy.metadata

Examples of org.codehaus.loom.xmlpolicy.metadata.PermissionMetaData


    public void testNullClassNameInPermissionCtor()
        throws Exception
    {
        try
        {
            new PermissionMetaData( null, null, null, null, null );
            fail( "Expected to fail due to null pointer in ctor" );
        }
        catch( final NullPointerException npe )
        {
            assertEquals( "NPE message",
View Full Code Here


    public void testNullKeyStoreNonNullSignedByInPermissionCtor()
        throws Exception
    {
        try
        {
            new PermissionMetaData( "", "", "", "", null );
            fail( "Expected to fail due to null pointer in ctor" );
        }
        catch( final NullPointerException npe )
        {
            assertEquals( "NPE message",
View Full Code Here

    public void testNullSignedByNonNullKeyStoreInPermissionCtor()
        throws Exception
    {
        try
        {
            new PermissionMetaData( "", "","", null, "default" );
            fail( "Expected to fail due to null pointer in ctor" );
        }
        catch( final NullPointerException npe )
        {
            assertEquals( "NPE message",
View Full Code Here

        assertEquals( "grant1.getPermissions().length",
                      1,
                      grant1.getPermissions().length );

        final PermissionMetaData permission1 = grant1.getPermissions()[ 0 ];
        assertEquals( "permission1.getClassname()",
                      "java.io.FilePermission",
                      permission1.getClassname() );
        assertEquals( "permission1.getAction()",
                      "read,write",
                      permission1.getAction() );
        assertEquals( "permission1.getTarget()",
                      "${/}tmp${/}*",
                      permission1.getTarget() );
        assertEquals( "permission1.getKeyStore()",
                      "myKeystore",
                      permission1.getKeyStore() );
        assertEquals( "permission1.getSignedBy()",
                      "Bob",
                      permission1.getSignedBy() );

        assertEquals( "grant2.getCodebase()",
                      "sar:/SAR-INF/lib/*",
                      grant2.getCodebase() );
        assertEquals( "grant2.getKeyStore()",
                      "myKeystore",
                      grant2.getKeyStore() );
        assertEquals( "grant2.getSignedBy()",
                      "Bob",
                      grant2.getSignedBy() );

        assertEquals( "grant2.getPermissions().length",
                      1,
                      grant2.getPermissions().length );

        final PermissionMetaData permission2 = grant2.getPermissions()[ 0 ];
        assertEquals( "permission2.getClassname()",
                      "java.io.FilePermission",
                      permission2.getClassname() );
        assertEquals( "permission2.getAction()",
                      null,
                      permission2.getAction() );
        assertEquals( "permission2.getTarget()",
                      null,
                      permission2.getTarget() );
        assertEquals( "permission2.getKeyStore()",
                      null,
                      permission2.getKeyStore() );
        assertEquals( "permission2.getSignedBy()",
                      null,
                      permission2.getSignedBy() );
    }
View Full Code Here

        assertEquals( "grant1.getPermissions().length",
                      1,
                      grant1.getPermissions().length );

        final PermissionMetaData permission1 = grant1.getPermissions()[ 0 ];
        assertEquals( "permission1.getClassname()",
                      "java.io.FilePermission",
                      permission1.getClassname() );
        assertEquals( "permission1.getAction()",
                      null,
                      permission1.getAction() );
        assertEquals( "permission1.getTarget()",
                      null,
                      permission1.getTarget() );
        assertEquals( "permission1.getKeyStore()",
                      null,
                      permission1.getKeyStore() );
        assertEquals( "permission1.getSignedBy()",
                      null,
                      permission1.getSignedBy() );
    }
View Full Code Here

        assertEquals( "grant1.getPermissions().length",
                      1,
                      grant1.getPermissions().length );

        final PermissionMetaData permission1 = grant1.getPermissions()[ 0 ];
        assertEquals( "permission1.getClassname()",
                      "java.io.FilePermission",
                      permission1.getClassname() );
        assertEquals( "permission1.getAction()",
                      "read,write",
                      permission1.getAction() );
        assertEquals( "permission1.getTarget()",
                      "${/}tmp${/}*",
                      permission1.getTarget() );
        assertEquals( "permission1.getKeyStore()",
                      "default",
                      permission1.getKeyStore() );
        assertEquals( "permission1.getSignedBy()",
                      "Bob",
                      permission1.getSignedBy() );

        assertEquals( "grant2.getCodebase()",
                      "sar:/SAR-INF/lib/*",
                      grant2.getCodebase() );
        assertEquals( "grant2.getKeyStore()",
                      "default",
                      grant2.getKeyStore() );
        assertEquals( "grant2.getSignedBy()",
                      "Bob",
                      grant2.getSignedBy() );

        assertEquals( "grant2.getPermissions().length",
                      1,
                      grant2.getPermissions().length );

        final PermissionMetaData permission2 = grant2.getPermissions()[ 0 ];
        assertEquals( "permission2.getClassname()",
                      "java.io.FilePermission",
                      permission2.getClassname() );
        assertEquals( "permission2.getAction()",
                      null,
                      permission2.getAction() );
        assertEquals( "permission2.getTarget()",
                      null,
                      permission2.getTarget() );
        assertEquals( "permission2.getKeyStore()",
                      null,
                      permission2.getKeyStore() );
        assertEquals( "permission2.getSignedBy()",
                      null,
                      permission2.getSignedBy() );
    }
View Full Code Here

    public void testMetaDataWithAPermission()
        throws Exception
    {
        final PolicyBuilder builder = new PolicyBuilder();
        final PermissionMetaData permission =
            new PermissionMetaData( AllPermission.class.getName(), null, null, null, null );
        final GrantMetaData grant =
            new GrantMetaData( "file:/", null, null,
                               new PermissionMetaData[]{permission} );
        final PolicyMetaData metaData =
            new PolicyMetaData( new KeyStoreMetaData[ 0 ], new GrantMetaData[]{grant} );
View Full Code Here

    public void testMetaDataWithAPermissionAndCerts()
        throws Exception
    {
        final PolicyBuilder builder = new TestPolicyBuilder();
        final PermissionMetaData permission =
            new PermissionMetaData( FilePermission.class.getName(), "/", "read",
                                    null, null );
        final GrantMetaData grant =
            new GrantMetaData( "file:/", "jenny", "default",
                               new PermissionMetaData[]{permission} );
        final KeyStoreMetaData keyStore =
View Full Code Here

    public void testMetaDataWithAPermissionAndMultipleCerts()
        throws Exception
    {
        final PolicyBuilder builder = new TestPolicyBuilder();
        final PermissionMetaData permission =
            new PermissionMetaData( RuntimePermission.class.getName(), "getFactory", null,
                                    null, null );
        final GrantMetaData grant =
            new GrantMetaData( "file:/", "jenny,mischelle,jenny", "default",
                               new PermissionMetaData[]{permission} );
        final KeyStoreMetaData keyStore =
View Full Code Here

    public void testMetaDataWithAPermissionAndCertsAndUnResolverPerm()
        throws Exception
    {
        final PolicyBuilder builder = new TestPolicyBuilder();
        final PermissionMetaData permission =
            new PermissionMetaData( AllPermission.class.getName(), null, null,
                                    "jenny", "default" );
        final GrantMetaData grant =
            new GrantMetaData( "file:/", "jenny", "default",
                               new PermissionMetaData[]{permission} );
        final KeyStoreMetaData keyStore =
View Full Code Here

TOP

Related Classes of org.codehaus.loom.xmlpolicy.metadata.PermissionMetaData

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.