Package org.codehaus.loom.xmlpolicy.metadata

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


        assertEquals( "Policy Grant Count",
                      2,
                      policy.getGrants().length );

        final GrantMetaData grant1 = policy.getGrants()[ 0 ];
        final GrantMetaData grant2 = policy.getGrants()[ 1 ];

        assertEquals( "grant1.getCodebase()",
                      "myCodeBase",
                      grant1.getCodebase() );
        assertEquals( "grant1.getKeyStore()",
                      null,
                      grant1.getKeyStore() );
        assertEquals( "grant1.getSignedBy()",
                      null,
                      grant1.getSignedBy() );

        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,
View Full Code Here


        assertEquals( "Policy Grant Count",
                      1,
                      policy.getGrants().length );

        final GrantMetaData grant1 = policy.getGrants()[ 0 ];

        assertEquals( "grant1.getCodebase()",
                      null,
                      grant1.getCodebase() );
        assertEquals( "grant1.getKeyStore()",
                      null,
                      grant1.getKeyStore() );
        assertEquals( "grant1.getSignedBy()",
                      null,
                      grant1.getSignedBy() );

        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,
View Full Code Here

    public void testNullPermissionsInGrantCtor()
        throws Exception
    {
        try
        {
            new GrantMetaData( 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 testNullPermissionsElementInGrantCtor()
        throws Exception
    {
        try
        {
            new GrantMetaData( null, null, null, 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 testNullSignedByNonNullKeyStoreInGrantCtor()
        throws Exception
    {
        try
        {
            new GrantMetaData( null, null, "default", new PermissionMetaData[0] );
            fail( "Expected to fail due to null pointer in ctor" );
        }
        catch( final NullPointerException npe )
        {
            assertEquals( "NPE message",
View Full Code Here

        assertEquals( "Policy Grant Count",
                      2,
                      policy.getGrants().length );

        final GrantMetaData grant1 = policy.getGrants()[ 0 ];
        final GrantMetaData grant2 = policy.getGrants()[ 1 ];

        assertEquals( "grant1.getCodebase()",
                      "myCodeBase",
                      grant1.getCodebase() );
        assertEquals( "grant1.getKeyStore()",
                      null,
                      grant1.getKeyStore() );
        assertEquals( "grant1.getSignedBy()",
                      null,
                      grant1.getSignedBy() );

        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,
View Full Code Here

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

        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} );
        final TestResolver resolver = new TestResolver();
        try
View Full Code Here

    {
        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 =
            new KeyStoreMetaData( "default", "http://spice.sourceforge.net", "DoDgY" );
        final PolicyMetaData metaData =
            new PolicyMetaData( new KeyStoreMetaData[]{keyStore}, new GrantMetaData[]{grant} );
View Full Code Here

    {
        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 =
            new KeyStoreMetaData( "default", "http://spice.sourceforge.net", "DoDgY" );
        final PolicyMetaData metaData =
            new PolicyMetaData( new KeyStoreMetaData[]{keyStore}, new GrantMetaData[]{grant} );
View Full Code Here

TOP

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

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.