Package org.drools.workbench.models.datamodel.rule

Examples of org.drools.workbench.models.datamodel.rule.RuleAttribute


    @Test
    public void testAttr() {
        RuleModel m = new RuleModel();
        m.attributes = new RuleAttribute[ 1 ];
        m.attributes[ 0 ] = new RuleAttribute( "enabled",
                                               "true" );
        final String drl = ruleModelPersistence.marshal( m );

        assertTrue( drl.indexOf( "enabled true" ) > 0 );
View Full Code Here


    @Test
    public void testCalendars() {
        //BZ1059232 - Guided rule editor: calendars attribute is broken when a list of calendars is used
        RuleModel m = new RuleModel();
        m.attributes = new RuleAttribute[ 1 ];
        m.attributes[ 0 ] = new RuleAttribute( "calendars",
                                               "a, b" );
        final String drl = ruleModelPersistence.marshal( m );

        assertTrue( drl.indexOf( "calendars \"a\", \"b\"" ) > 0 );
    }
View Full Code Here

    @Test
    public void testCalendarsWithQuotes() {
        //BZ1059232 - Guided rule editor: calendars attribute is broken when a list of calendars is used
        RuleModel m = new RuleModel();
        m.attributes = new RuleAttribute[ 1 ];
        m.attributes[ 0 ] = new RuleAttribute( "calendars",
                                               "\"a\", \"b\"" );
        final String drl = ruleModelPersistence.marshal( m );

        assertTrue( drl.indexOf( "calendars \"a\", \"b\"" ) > 0 );
    }
View Full Code Here

    @Test
    public void testCalendarsWithQuotesAroundWholeValue() {
        //BZ1059232 - Guided rule editor: calendars attribute is broken when a list of calendars is used
        RuleModel m = new RuleModel();
        m.attributes = new RuleAttribute[ 1 ];
        m.attributes[ 0 ] = new RuleAttribute( "calendars",
                                               "\"a, b\"" );
        final String drl = ruleModelPersistence.marshal( m );

        assertTrue( drl.indexOf( "calendars \"a\", \"b\"" ) > 0 );
    }
View Full Code Here

    private RuleModel getComplexModel( boolean useDsl ) {
        final RuleModel m = new RuleModel();
        m.name = "Complex Rule";

        m.addAttribute( new RuleAttribute( "no-loop",
                                           "true" ) );
        m.addAttribute( new RuleAttribute( "salience",
                                           "-10" ) );
        m.addAttribute( new RuleAttribute( "agenda-group",
                                           "aGroup" ) );

        final FactPattern pat = new FactPattern( "Person" );
        pat.setBoundName( "p1" );
        final SingleFieldConstraint con = new SingleFieldConstraint();
View Full Code Here

    public void testLiteralBigDecimalMvel() {

        RuleModel m = new RuleModel();
        m.name = "test literal bigdecimal";

        m.addAttribute( new RuleAttribute( "dialect",
                                           "mvel" ) );

        FactPattern p = new FactPattern( "Person" );
        SingleFieldConstraint con = new SingleFieldConstraint();
        con.setFieldType( DataType.TYPE_NUMERIC_BIGDECIMAL );
View Full Code Here

    public void testLiteralBigIntegerMvel() {

        RuleModel m = new RuleModel();
        m.name = "test literal biginteger";

        m.addAttribute( new RuleAttribute( "dialect",
                                           "mvel" ) );

        FactPattern p = new FactPattern( "Person" );
        SingleFieldConstraint con = new SingleFieldConstraint();
        con.setFieldType( DataType.TYPE_NUMERIC_BIGINTEGER );
View Full Code Here

    public void testLiteralBigDecimalJava() {

        RuleModel m = new RuleModel();
        m.name = "test literal bigdecimal";

        m.addAttribute( new RuleAttribute( "dialect",
                                           "java" ) );

        FactPattern p = new FactPattern( "Person" );
        SingleFieldConstraint con = new SingleFieldConstraint();
        con.setFieldType( DataType.TYPE_NUMERIC_BIGDECIMAL );
View Full Code Here

    public void testLiteralBigIntegerJava() {

        RuleModel m = new RuleModel();
        m.name = "test literal biginteger";

        m.addAttribute( new RuleAttribute( "dialect",
                                           "java" ) );

        FactPattern p = new FactPattern( "Person" );
        SingleFieldConstraint con = new SingleFieldConstraint();
        con.setFieldType( DataType.TYPE_NUMERIC_BIGINTEGER );
View Full Code Here

        RuleModel m = new RuleModel();

        String s = RuleModelDRLPersistenceImpl.getInstance().marshal( m );
        assertTrue( s.indexOf( "mvel" ) > -1 );

        m.addAttribute( new RuleAttribute( "dialect",
                                           "goober" ) );
        s = RuleModelDRLPersistenceImpl.getInstance().marshal( m );
        assertFalse( s.indexOf( "mvel" ) > -1 );
        assertTrue( s.indexOf( "goober" ) > -1 );
    }
View Full Code Here

TOP

Related Classes of org.drools.workbench.models.datamodel.rule.RuleAttribute

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.