Package org.codehaus.metaclass.model

Examples of org.codehaus.metaclass.model.Attribute


    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


        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)",
                      "Blah-schema.xml", result.getParameter( "location" ) );
    }
View Full Code Here

        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)",
                      "Blah-schema.xml", result.getParameter( "location" ) );
    }
View Full Code Here

    {
        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)",
                      MockJavaSource.PREFIX + "Foo",
                      result.getParameter( "type" ) );
        assertEquals( "attribute.parameter(key)",
                      MockJavaSource.PREFIX + "Foo",
                      result.getParameter( "key" ) );
        assertEquals( "attribute.parameter(optional)",
                      "true",
                      result.getParameter( "optional" ) );
    }
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 );
View Full Code Here

        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)",
                      MockJavaSource.PREFIX + "Foo",
                      result.getParameter( "type" ) );
        assertEquals( "attribute.parameter(key)",
                      MockJavaSource.PREFIX + "Foo",
                      result.getParameter( "key" ) );
        assertEquals( "attribute.parameter(optional)",
                      "false",
                      result.getParameter( "optional" ) );
    }
View Full Code Here

        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)",
                      "Blah-schema.xml", result.getParameter( "location" ) );
    }
View Full Code Here

        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)",
                      "Meep.xml", result.getParameter( "location" ) );
    }
View Full Code Here

        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)",
                      "Blah-schema.xml", result.getParameter( "location" ) );
        assertEquals( "attribute.parameter(type)",
                      "MeepSchemaLanguage", result.getParameter( "type" ) );
    }
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

TOP

Related Classes of org.codehaus.metaclass.model.Attribute

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.