Package org.drools.smf

Examples of org.drools.smf.DefaultConfiguration


    protected void startConfiguration(String name,
                                      Attributes attrs)
    {
        this.characters = new StringBuffer( );

        DefaultConfiguration config = new DefaultConfiguration( name );

        int numAttrs = attrs.getLength( );

        for ( int i = 0; i < numAttrs; ++i )
        {
            config.setAttribute( attrs.getLocalName( i ),
                                 attrs.getValue( i ) );
        }

        // lets add the namespaces as attributes
        for (Iterator iter = namespaces.entrySet().iterator(); iter.hasNext(); )
        {
            Map.Entry entry = (Map.Entry) iter.next();
            String ns = (String) entry.getKey();
            String value = (String) entry.getValue();
            if (ns == null || ns.length() == 0) {
                ns = "xmlns";
            }
            else
            {
                ns = "xmlns:" + ns;
            }
            config.setAttribute(ns, value);
        }
           
       
        if ( this.configurationStack.isEmpty( ) )
        {
View Full Code Here


     *
     * @return The configuration.
     */
    protected Configuration endConfiguration()
    {
        DefaultConfiguration config = (DefaultConfiguration) this.configurationStack.removeLast( );
        if ( this.characters != null )
        {
            config.setText( this.characters.toString( ) );
        }

        this.characters = null;

        return config;
View Full Code Here

    public void testApplicationDataWithOutImports() throws FactoryException
    {
        RuleBaseContext ruleBaseContext = new RuleBaseContext( );

        DefaultConfiguration configuration = new DefaultConfiguration( "test1" );
        configuration.setText( "java.util.HashMap" );
        configuration.setAttribute( "identifier",
                                    "map" );

        final RuleSet ruleSet = new RuleSet( "test RuleSet",
                                             ruleBaseContext );
View Full Code Here

    public void testApplicationDataWithStaticImports() throws FactoryException
    {
        RuleBaseContext ruleBaseContext = new RuleBaseContext( );

        DefaultConfiguration configuration = new DefaultConfiguration( "test1" );
        configuration.setText( "HashMap" );
        configuration.setAttribute( "identifier",
                                    "map" );

        final RuleSet ruleSet = new RuleSet( "test RuleSet",
                                             ruleBaseContext );
View Full Code Here

    public void testApplicationDataDynamicImports() throws FactoryException
    {
        RuleBaseContext ruleBaseContext = new RuleBaseContext( );

        DefaultConfiguration configuration = new DefaultConfiguration( "test1" );
        configuration.setText( "HashMap" );
        configuration.setAttribute( "identifier",
                                    "map" );

        final RuleSet ruleSet = new RuleSet( "test RuleSet",
                                             ruleBaseContext );
View Full Code Here

    public void testClassOFieldbjectTypeFactoryExceptions() throws Exception
    {
        RuleBaseContext ruleBaseContext = new RuleBaseContext( );

        DefaultConfiguration configuration = new DefaultConfiguration( "test1" );

        final RuleSet ruleSet = new RuleSet( "test RuleSet",
                                             ruleBaseContext );

        final Rule rule = new Rule( "Test Rule 1",
                                    ruleSet );

        Importer importer = new DefaultImporter( );
        rule.setImporter( importer );

        ObjectTypeFactory factory = new ClassFieldObjectTypeFactory( );

        try
        {
            ClassObjectType type = (ClassObjectType) factory.newObjectType( rule,
                                                                            ruleBaseContext,
                                                                            configuration );
            fail( "Should fail, no field name has been specified" );
        }
        catch ( FactoryException e )
        {
            assertEquals( "no class name specified",
                          e.getMessage( ) );
        }

        configuration.setText( "org.drools.semantics.base.Person" );
        try
        {
            ClassObjectType type = (ClassObjectType) factory.newObjectType( rule,
                                                                            ruleBaseContext,
                                                                            configuration );
            fail( "Should fail, no field name has been specified" );
        }
        catch ( FactoryException e )
        {
            assertEquals( "no field name specified",
                          e.getMessage( ) );
        }

        configuration.setAttribute( "field",
                                    "name" );
        try
        {
            ClassObjectType type = (ClassObjectType) factory.newObjectType( rule,
                                                                            ruleBaseContext,
View Full Code Here

    public void testObjectTypeWithOutImports() throws FactoryException
    {
        RuleBaseContext ruleBaseContext = new RuleBaseContext( );

        DefaultConfiguration configuration = new DefaultConfiguration( "test1" );
        configuration.setText( "org.drools.semantics.base.Person" );
        configuration.setAttribute( "field",
                                    "name" );
        configuration.setAttribute( "value",
                                    "bob" );

        final RuleSet ruleSet = new RuleSet( "test RuleSet",
                                             ruleBaseContext );
View Full Code Here

    public void testObjectTypeWithStaticImports() throws FactoryException
    {
        RuleBaseContext ruleBaseContext = new RuleBaseContext( );

        DefaultConfiguration configuration = new DefaultConfiguration( "test1" );
        configuration.setText( "Person" );
        configuration.setAttribute( "field",
                                    "name" );
        configuration.setAttribute( "value",
                                    "bob" );

        final RuleSet ruleSet = new RuleSet( "test RuleSet",
                                             ruleBaseContext );
View Full Code Here

    public void testbjectTypeWithDynamicImports() throws FactoryException
    {
        RuleBaseContext ruleBaseContext = new RuleBaseContext( );

        DefaultConfiguration configuration = new DefaultConfiguration( "test1" );
        configuration.setText( "Person" );
        configuration.setAttribute( "field",
                                    "name" );
        configuration.setAttribute( "value",
                                    "bob" );

        final RuleSet ruleSet = new RuleSet( "test RuleSet",
                                             ruleBaseContext );
View Full Code Here

   
    public void testClassObjectTypeFactoryExceptions() throws Exception
    {
        RuleBaseContext ruleBaseContext = new RuleBaseContext( );

        DefaultConfiguration configuration = new DefaultConfiguration( "test1" );

        final RuleSet ruleSet = new RuleSet( "test RuleSet",
                                             ruleBaseContext );

        final Rule rule = new Rule( "Test Rule 1",
View Full Code Here

TOP

Related Classes of org.drools.smf.DefaultConfiguration

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.