Package org.codehaus.dna.tools.metaclass

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


    extends TestCase
{
    public void testProcessClassAttributeWithoutTransformations()
        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();
        final Attribute attribute = new Attribute( "ignored" );
        final Attribute result =
            interceptor.processClassAttribute( new MockJavaClass(), attribute );
        assertNotNull( "attribute", result );
        assertEquals( "attribute.name", "ignored", result.getName() );
        assertEquals( "attribute.value", null, result.getValue() );
        assertEquals( "attribute.parameterCount", 0, result.getParameterCount() );
    }
View Full Code Here


    }

    public void testProcessClassAttributeWithDNAService()
        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();
        final Properties parameters = new Properties();
        parameters.setProperty( "type", "X" );
        final Attribute attribute = new Attribute( "dna.service", parameters );
        final Attribute result =
            interceptor.processClassAttribute( new MockJavaClass(), attribute );
        assertNotNull( "attribute", result );
        assertEquals( "attribute.name", "dna.service", result.getName() );
        assertEquals( "attribute.value", null, result.getValue() );
        assertEquals( "attribute.parameterCount", 1, result.getParameterCount() );
        assertEquals( "attribute.parameter(type)",
View Full Code Here

    }

    public void testProcessClassAttributeWithDNAServiceMissingType()
        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();
        final Attribute attribute = new Attribute( "dna.service" );
        try
        {
            final MockJavaClass clazz = new MockJavaClass();
            clazz.setName( "Blah" );
            interceptor.processClassAttribute( clazz, attribute );
        }
        catch( final IllegalArgumentException iae )
        {
            return;
        }
View Full Code Here

    }

    public void testProcessMethodAttributeWithDNAConfigurationWith()
        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();
        final Attribute attribute = new Attribute( "ignored" );
        final Attribute result =
            interceptor.processMethodAttribute( new JavaMethod(), attribute );
        assertNotNull( "attribute", result );
        assertEquals( "attribute.name", "ignored", result.getName() );
        assertEquals( "attribute.value", null, result.getValue() );
        assertEquals( "attribute.parameterCount", 0, result.getParameterCount() );
    }
View Full Code Here

    }

    public void testProcessMethodAttributeWithoutTransformations()
        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();
        final Attribute attribute = new Attribute( "ignored" );
        final Attribute result =
            interceptor.processMethodAttribute( new JavaMethod(), attribute );
        assertNotNull( "attribute", result );
        assertEquals( "attribute.name", "ignored", result.getName() );
        assertEquals( "attribute.value", null, result.getValue() );
        assertEquals( "attribute.parameterCount", 0, result.getParameterCount() );
    }
View Full Code Here

    }

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

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

        final JavaMethod javaMethod = new JavaMethod();
        javaMethod.setParentClass( clazz );
        final Attribute attribute = new Attribute( "dna.configuration" );
        final Attribute result =
            interceptor.processMethodAttribute( javaMethod, 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 testProcessMethodForParameters()
        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();

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

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

    }

    public void testProcessMethodForDependencySpecifyingOptionalAttribute()
        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();
        final Properties parameters = new Properties();
        parameters.setProperty( "type", "Foo" );
        parameters.setProperty( "optional", "true" );
        final Attribute attribute = new Attribute( "dna.dependency", parameters );
        final JavaMethod method = new JavaMethod();
        method.setParentClass( new MockJavaClass() );
        final Attribute result =
            interceptor.processMethodAttribute( method, attribute );
        assertNotNull( "attribute", result );
        assertEquals( "attribute.name", "dna.dependency", result.getName() );
        assertEquals( "attribute.value", null, result.getValue() );
        assertEquals( "attribute.parameterCount", 3, result.getParameterCount() );
        assertEquals( "attribute.parameter(type)",
View Full Code Here

    }

    public void testProcessMethodForDependencyNotSpecifyingType()
        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();
        final Properties parameters = new Properties();
        final Attribute attribute = new Attribute( "dna.dependency", parameters );
        final JavaMethod method = new JavaMethod();
        method.setParentClass( new MockJavaClass() );
        try
        {
            interceptor.processMethodAttribute( method, attribute );
        }
        catch( final IllegalArgumentException iae )
        {
            return;
        }
View Full Code Here

    }

    public void testProcessMethodForDependencySpecifyingJustType()
        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();
        final Properties parameters = new Properties();
        parameters.setProperty( "type", "Foo" );
        final Attribute attribute = new Attribute( "dna.dependency", parameters );
        final JavaMethod method = new JavaMethod();
        method.setParentClass( new MockJavaClass() );
        final Attribute result =
            interceptor.processMethodAttribute( method, attribute );
        assertNotNull( "attribute", result );
        assertEquals( "attribute.name", "dna.dependency", result.getName() );
        assertEquals( "attribute.value", null, result.getValue() );
        assertEquals( "attribute.parameterCount", 3, result.getParameterCount() );
        assertEquals( "attribute.parameter(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.