Package org.codehaus.dna.tools.verifier

Examples of org.codehaus.dna.tools.verifier.ComponentVerifier


    }

    public void testVerifyDependencyMetaDataThatNoPassesDueToMissingType()
        throws Exception
    {
        final ComponentVerifier verifier = new ComponentVerifier();
        final List issues = new ArrayList();
        final Properties parameters = new Properties();
        parameters.setProperty( "optional", "false" );
        verifier.verifyDependencyMetaData( LifecycleExtendingService.class,
                                           new Attribute( "dna.dependency", parameters ),
                                           issues );
        assertSingleIssue( issues,
                           "The dna.dependency attribute does not specify the parameter type.",
                           true, false );
View Full Code Here


    }

    public void testVerifyDependencyMetaDataThatNoPassesDueToMissingKey()
        throws Exception
    {
        final ComponentVerifier verifier = new ComponentVerifier();
        final List issues = new ArrayList();
        final Properties parameters = new Properties();
        parameters.setProperty( "optional", "false" );
        parameters.setProperty( "type", ActionListener.class.getName() );
        final Attribute attribute = new Attribute( "dna.dependency", parameters );
        verifier.verifyDependencyMetaData( LifecycleExtendingService.class,
                                           attribute,
                                           issues );
        assertSingleIssue( issues,
                           "The dna.dependency attribute does not specify the parameter key.",
                           true, false );
View Full Code Here

    }

    public void testVerifyDependencyMetaDataThatPassesDueToNotImplementingComposable()
        throws Exception
    {
        final ComponentVerifier verifier = new ComponentVerifier();
        final List issues = new ArrayList();
        verifier.verifyDependencyMetaData( Object.class, issues );
        assertNoIssues( issues );
    }
View Full Code Here

    }

    public void testVerifyDependencyMetaDataThatPassesDueToNoMetaData()
        throws Exception
    {
        final ComponentVerifier verifier = new ComponentVerifier();
        final List issues = new ArrayList();
        MetaClassIntrospector.setAccessor( new SimpleAccessor() );
        MetaClassIntrospector.clearCompleteCache();
        verifier.verifyDependencyMetaData( BasicComponent.class, issues );
        assertNoIssues( issues );
    }
View Full Code Here

    }

    public void testVerifyDependencyMetaDataThatPassesWithMetaData()
        throws Exception
    {
        final ComponentVerifier verifier = new ComponentVerifier();
        final List issues = new ArrayList();
        MetaClassIntrospector.setAccessor( new AccessorWithDependencyMetaData() );
        MetaClassIntrospector.clearCompleteCache();
        verifier.verifyDependencyMetaData( BasicComponent.class, issues );
        assertNoIssues( issues );
    }
View Full Code Here

    }

    public void testVerifyConfigurationMetaDataThatPassesAsNotConfigurable()
        throws Exception
    {
        final ComponentVerifier verifier = new ComponentVerifier();
        final List issues = new ArrayList();
        MetaClassIntrospector.setAccessor( new AccessorWithDependencyMetaData() );
        MetaClassIntrospector.clearCompleteCache();
        verifier.verifyConfigurationMetaData( Object.class, issues );
        assertNoIssues( issues );
    }
View Full Code Here

    }

    public void testVerifyConfigurationMetaDataThatPassesAsNoMetaData()
        throws Exception
    {
        final ComponentVerifier verifier = new ComponentVerifier();
        final List issues = new ArrayList();
        MetaClassIntrospector.setAccessor( new SimpleAccessor() );
        MetaClassIntrospector.clearCompleteCache();
        verifier.verifyConfigurationMetaData( BasicComponent.class, issues );
        assertNoIssues( issues );
    }
View Full Code Here

    }

    public void testVerifyConfigurationMetaDataThatPassesAsValidMetaData()
        throws Exception
    {
        final ComponentVerifier verifier = new ComponentVerifier();
        final List issues = new ArrayList();

        final Properties parameters = new Properties();
        parameters.setProperty( "location", "BasicComponent-schema.xml" );
        final Attribute[] attributes = new Attribute[]
        {
            new Attribute( "dna.configuration", parameters )
        };
        final ParameterDescriptor param =
            new ParameterDescriptor( "X", Configuration.class.getName() );
        final ParameterDescriptor[] params = new ParameterDescriptor[]{param};
        final MethodDescriptor method =
            new MethodDescriptor( "configure", "", params, attributes, attributes );
        final ClassDescriptor descriptor =
            new ClassDescriptor( BasicComponent.class.getName(),
                                 Attribute.EMPTY_SET,
                                 Attribute.EMPTY_SET,
                                 FieldDescriptor.EMPTY_SET,
                                 new MethodDescriptor[]{method} );
        final RegistrationMetaClassAccessor accessor = new RegistrationMetaClassAccessor();
        accessor.registerDescriptor( descriptor );
        MetaClassIntrospector.setAccessor( accessor );
        MetaClassIntrospector.clearCompleteCache();
        verifier.verifyConfigurationMetaData( BasicComponent.class, issues );
        assertNoIssues( issues );
    }
View Full Code Here

    }

    public void testVerifyConfigurationMetaDataThatNoPassesAsInvalidMetaData()
        throws Exception
    {
        final ComponentVerifier verifier = new ComponentVerifier();
        final List issues = new ArrayList();

        final Properties parameters = new Properties();
        final Attribute[] attributes = new Attribute[]
        {
            new Attribute( "dna.configuration", parameters )
        };
        final ParameterDescriptor param =
            new ParameterDescriptor( "X", Configuration.class.getName() );
        final ParameterDescriptor[] params = new ParameterDescriptor[]{param};
        final MethodDescriptor method =
            new MethodDescriptor( "configure", "", params, attributes, attributes );
        final ClassDescriptor descriptor =
            new ClassDescriptor( BasicComponent.class.getName(),
                                 Attribute.EMPTY_SET,
                                 Attribute.EMPTY_SET,
                                 FieldDescriptor.EMPTY_SET,
                                 new MethodDescriptor[]{method} );
        final RegistrationMetaClassAccessor accessor = new RegistrationMetaClassAccessor();
        accessor.registerDescriptor( descriptor );
        MetaClassIntrospector.setAccessor( accessor );
        MetaClassIntrospector.clearCompleteCache();
        verifier.verifyConfigurationMetaData( BasicComponent.class, issues );

        assertSingleIssue( issues,
                           "The dna.configuration attribute is missing the " +
                           "location parameter.",
                           true, false );
View Full Code Here

    }

    public void testverifyLocationThatPasses()
        throws Exception
    {
        final ComponentVerifier verifier = new ComponentVerifier();
        final List issues = new ArrayList();
        MetaClassIntrospector.setAccessor( new AccessorWithDependencyMetaData() );
        MetaClassIntrospector.clearCompleteCache();
        verifier.verifyLocation( BasicComponent.class,
                                 "BasicComponent-schema.xml",
                                 issues );
        assertNoIssues( issues );
    }
View Full Code Here

TOP

Related Classes of org.codehaus.dna.tools.verifier.ComponentVerifier

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.