Package org.codehaus.metaclass.model

Examples of org.codehaus.metaclass.model.Attribute


    public void testProcessMethodAttributeWithMXAttributeAndComment()
        throws Exception
    {
        final String description = "A Random Thought";
        final PhoenixAttributeInterceptor interceptor = new PhoenixAttributeInterceptor();
        final Attribute attribute = new Attribute( "phoenix:mx-attribute" );
        final JavaMethod method = new JavaMethod();
        method.setComment( description );
        final Attribute result =
            interceptor.processMethodAttribute( method, attribute );
        assertNotNull( "attribute", result );
        assertEquals( "attribute.name", "mx.attribute", result.getName() );
        assertEquals( "attribute.value", null, result.getValue() );
        assertEquals( "attribute.parameterCount",
                      1,
                      result.getParameterCount() );
        assertEquals( "attribute.parameter(description)",
                      description, result.getParameter( "description" ) );
    }
View Full Code Here


    public void testProcessMethodAttributeWithMXOperationAndNoDescriptionOrComment()
        throws Exception
    {
        final PhoenixAttributeInterceptor interceptor = new PhoenixAttributeInterceptor();
        final Attribute attribute = new Attribute( "phoenix:mx-operation" );
        final Attribute result =
            interceptor.processMethodAttribute( new JavaMethod(), attribute );
        assertNotNull( "attribute", result );
        assertEquals( "attribute.name", "mx.operation", result.getName() );
        assertEquals( "attribute.value", null, result.getValue() );
        assertEquals( "attribute.parameterCount",
                      0,
                      result.getParameterCount() );
    }
View Full Code Here

    public void testProcessMethodAttributeWithMXOperationAndDescription()
        throws Exception
    {
        final String description = "A Random Thought";
        final PhoenixAttributeInterceptor interceptor = new PhoenixAttributeInterceptor();
        final Attribute attribute = new Attribute( "phoenix:mx-operation" );
        final JavaMethod field = new JavaMethod();
        final ArrayList tags = new ArrayList();
        tags.add(
            new DefaultDocletTag( "phoenix:mx-description", description ) );
        field.setTags( tags );
        final Attribute result =
            interceptor.processMethodAttribute( field, attribute );
        assertNotNull( "attribute", result );
        assertEquals( "attribute.name", "mx.operation", result.getName() );
        assertEquals( "attribute.value", null, result.getValue() );
        assertEquals( "attribute.parameterCount",
                      1,
                      result.getParameterCount() );
        assertEquals( "attribute.parameter(description)",
                      description, result.getParameter( "description" ) );
    }
View Full Code Here

    public void testProcessMethodAttributeWithMXOperationAndComment()
        throws Exception
    {
        final String description = "A Random Thought";
        final PhoenixAttributeInterceptor interceptor = new PhoenixAttributeInterceptor();
        final Attribute attribute = new Attribute( "phoenix:mx-operation" );
        final JavaMethod field = new JavaMethod();
        field.setComment( description );
        final Attribute result =
            interceptor.processMethodAttribute( field, attribute );
        assertNotNull( "attribute", result );
        assertEquals( "attribute.name", "mx.operation", result.getName() );
        assertEquals( "attribute.value", null, result.getValue() );
        assertEquals( "attribute.parameterCount",
                      1,
                      result.getParameterCount() );
        assertEquals( "attribute.parameter(description)",
                      description, result.getParameter( "description" ) );
    }
View Full Code Here

    public void testProcessMethodAttributeWithPhoenixConfigurationSchema()
        throws Exception
    {
        final PhoenixAttributeInterceptor interceptor = new PhoenixAttributeInterceptor();
        final Attribute attribute = new Attribute(
            "phoenix:configuration-schema" );
        final JavaClass javaClass = new JavaClass( new JavaSource() );
        javaClass.setName( "com.biz.MyClass" );
        final JavaMethod method = new JavaMethod();
        method.setParentClass( javaClass );
        final Attribute result =
            interceptor.processMethodAttribute( method, attribute );
        assertNotNull( "attribute", result );
        assertEquals( "attribute.name",
                      "dna.configuration",
                      result.getName() );
        assertEquals( "attribute.value", null, result.getValue() );
        assertEquals( "attribute.parameterCount",
                      0,
                      result.getParameterCount() );
    }
View Full Code Here

    {
        final PhoenixAttributeInterceptor interceptor = new PhoenixAttributeInterceptor();
        final Properties parameters = new Properties();
        final String type = "BobbaFett";
        parameters.setProperty( "type", type );
        final Attribute attribute = new Attribute(
            "phoenix:configuration-schema", parameters );
        final JavaClass javaClass = new JavaClass( new JavaSource() );
        javaClass.setName( "com.biz.MyClass" );
        final JavaMethod method = new JavaMethod();
        method.setParentClass( javaClass );
        final Attribute result =
            interceptor.processMethodAttribute( method, 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(type)",
                      type, result.getParameter( "type" ) );
    }
View Full Code Here

        throws Exception
    {
        final PhoenixAttributeInterceptor interceptor = new PhoenixAttributeInterceptor();
        final Properties parameters = new Properties();
        parameters.setProperty( "type", "relax-ng" );
        final Attribute attribute = new Attribute(
            "phoenix:configuration-schema", parameters );
        final JavaClass javaClass = new JavaClass( new JavaSource() );
        javaClass.setName( "com.biz.MyClass" );
        final JavaMethod method = new JavaMethod();
        method.setParentClass( javaClass );
        final Attribute result =
            interceptor.processMethodAttribute( method, 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(type)",
                      "http://relaxng.org/ns/structure/1.0",
                      result.getParameter( "type" ) );
    }
View Full Code Here

    {
        final PhoenixAttributeInterceptor interceptor = new PhoenixAttributeInterceptor();
        final Properties parameters = new Properties();
        final String type = "BobbaFett";
        parameters.setProperty( "name", type );
        final Attribute attribute = new Attribute( "phoenix:dependency",
                                                   parameters );
        final Attribute result =
            interceptor.processMethodAttribute( new JavaMethod(), attribute );
        assertNotNull( "attribute", result );
        assertEquals( "attribute.name", "dna.dependency", result.getName() );
        assertEquals( "attribute.value", null, result.getValue() );
        assertEquals( "attribute.parameterCount",
                      1,
                      result.getParameterCount() );
        assertEquals( "attribute.parameter(type)",
                      type, result.getParameter( "type" ) );
    }
View Full Code Here

        final Properties parameters = new Properties();
        final String type = "BobbaFett";
        final String key = "myKey";
        parameters.setProperty( "name", type );
        parameters.setProperty( "role", key );
        final Attribute attribute = new Attribute( "phoenix:dependency",
                                                   parameters );
        final Attribute result =
            interceptor.processMethodAttribute( new JavaMethod(), attribute );
        assertNotNull( "attribute", result );
        assertEquals( "attribute.name", "dna.dependency", result.getName() );
        assertEquals( "attribute.value", null, result.getValue() );
        assertEquals( "attribute.parameterCount",
                      2,
                      result.getParameterCount() );
        assertEquals( "attribute.parameter(type)",
                      type, result.getParameter( "type" ) );
        assertEquals( "attribute.parameter(key)",
                      key, result.getParameter( "key" ) );
    }
View Full Code Here

    public void testProcessClassAttributesWithoutMXService()
        throws Exception
    {
        final PhoenixAttributeInterceptor interceptor = new PhoenixAttributeInterceptor();
        final Attribute[] input = new Attribute[]{
            new Attribute( "RandomJAttribute" )};
        final Attribute[] attributes =
            interceptor.processClassAttributes(
                new JavaClass( new JavaSource() ), input );
        assertEquals( "attributes.length", 1, attributes.length );
        assertEquals( "attributes[0].name",
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.