Package org.codehaus.dna.tools.metaclass

Examples of org.codehaus.dna.tools.metaclass.DNAAttributeInterceptor


    }

    public void testProcessConfigurationAttributeWithoutLocationOrType()
        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();

        final MockJavaClass clazz = new MockJavaClass();
        clazz.setName( "Blah" );

        final Attribute attribute = new Attribute( "dna.configuration" );
        final Attribute result =
            interceptor.processConfigurationAttribute( clazz, attribute );
        assertNotNull( "attribute", result );
        assertEquals( "attribute.name", "dna.configuration", result.getName() );
        assertEquals( "attribute.value", null, result.getValue() );
        assertEquals( "attribute.parameterCount", 1, result.getParameterCount() );
        assertEquals( "attribute.parameter(location)",
View Full Code Here


    }

    public void testProcessConfigurationAttributeWithLocation()
        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();

        final MockJavaClass clazz = new MockJavaClass();
        clazz.setName( "Blah" );

        final Properties parameters = new Properties();
        parameters.setProperty( "location", "Meep.xml" );
        final Attribute attribute = new Attribute( "dna.configuration", parameters );
        final Attribute result =
            interceptor.processConfigurationAttribute( clazz, attribute );
        assertNotNull( "attribute", result );
        assertEquals( "attribute.name", "dna.configuration", result.getName() );
        assertEquals( "attribute.value", null, result.getValue() );
        assertEquals( "attribute.parameterCount", 1, result.getParameterCount() );
        assertEquals( "attribute.parameter(location)",
View Full Code Here

    }

    public void testProcessConfigurationAttributeWithType()
        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();

        final MockJavaClass clazz = new MockJavaClass();
        clazz.setName( "Blah" );

        final Properties parameters = new Properties();
        parameters.setProperty( "type", "MeepSchemaLanguage" );
        final Attribute attribute = new Attribute( "dna.configuration", parameters );
        final Attribute result =
            interceptor.processConfigurationAttribute( clazz, attribute );
        assertNotNull( "attribute", result );
        assertEquals( "attribute.name", "dna.configuration", result.getName() );
        assertEquals( "attribute.value", null, result.getValue() );
        assertEquals( "attribute.parameterCount", 2, result.getParameterCount() );
        assertEquals( "attribute.parameter(location)",
View Full Code Here

    }

    public void testDetermineKeyWhenNothingSpecified()
        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();
        final Properties parameters = new Properties();
        final Attribute attribute = new Attribute( "dna.dependency", parameters );
        final String key = interceptor.determineKey( attribute, "com.biz.Foo" );
        assertEquals( "key", "com.biz.Foo", key );
    }
View Full Code Here

    }

    public void testDetermineKeyWhenQualifierSpecified()
        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();
        final Properties parameters = new Properties();
        parameters.setProperty( "qualifier", "x" );
        final Attribute attribute = new Attribute( "dna.dependency", parameters );
        final String key = interceptor.determineKey( attribute, "com.biz.Foo" );
        assertEquals( "key", "com.biz.Foo/x", key );
    }
View Full Code Here

    }

    public void testDetermineKeyWhenKeySpecified()
        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();
        final Properties parameters = new Properties();
        parameters.setProperty( "key", "x" );
        final Attribute attribute = new Attribute( "dna.dependency", parameters );
        final String key = interceptor.determineKey( attribute, "com.biz.Foo" );
        assertEquals( "key", "x", key );
    }
View Full Code Here

    }

    public void testGetSchemaLocationForClassInDefaultPackage()
        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();
        final String location = interceptor.getSchemaLocationFor( "Foo" );
        assertEquals( "location", "Foo-schema.xml", location );
    }
View Full Code Here

    }

    public void testGetSchemaLocationForClassInNonDefaultPackage()
        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();
        final String location = interceptor.getSchemaLocationFor( "com.biz.Foo" );
        assertEquals( "location", "Foo-schema.xml", location );
    }
View Full Code Here

    }

    public void testResolveType()
        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();
        final String type = interceptor.resolveType( new MockJavaClass(), "X" );
        assertEquals( "type", MockJavaSource.PREFIX + "X", type );
    }
View Full Code Here

    }

    public void testResolveTypeOnArray()
        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();
        final String type = interceptor.resolveType( new MockJavaClass(), "X[]" );
        assertEquals( "type", MockJavaSource.PREFIX + "X[]", type );
    }
View Full Code Here

TOP

Related Classes of org.codehaus.dna.tools.metaclass.DNAAttributeInterceptor

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.