Package org.drools.compiler.lang.dsl

Examples of org.drools.compiler.lang.dsl.DefaultExpander.expand()


        DefaultExpander ex = new DefaultExpander();
        ex.addDSLMapping( file.getMapping() );
        String source = "package something;\n\nrule \"1\"\nwhen\n    Invoke rule executor\nthen\n    Execute rule \"5\"\nend";
        String expected = "package something;\n\nrule \"1\"\nwhen\n    ruleExec: RuleExecutor()\nthen\n    ruleExec.ExecuteSubRule( new Long(5));\nend";
        String drl = ex.expand( source );
        //        System.out.println("["+drl+"]" );
        //        System.out.println("["+expected+"]" );
        assertFalse( ex.hasErrors() );
        assertEquals(expected,
                drl);
View Full Code Here


                file.getErrors().size());
        DefaultExpander ex = new DefaultExpander();
        ex.addDSLMapping(file.getMapping());

        String source = "rule x\nwhen\n key 1 \n key 2 \nthen\nend";
        String drl = ex.expand(source);
        System.out.println(drl);

        assertTrue(drl.contains("attr==1"));
        assertTrue(drl.contains("attr==2"));
        //System.err.println(ex.expand( "rule 'x' \n when \n foo \n then \n end" ));
View Full Code Here

                file.getErrors().size());

        DefaultExpander ex = new DefaultExpander();
        ex.addDSLMapping(file.getMapping());
        String source = "rule 'q'\nagenda-group 'x'\nwhen\n    foo  \nthen\n    bar 42\nend";
        String drl = ex.expand(source);
        assertFalse(ex.hasErrors());

        ex = new DefaultExpander();
        ex.addDSLMapping(file.getMapping());
View Full Code Here

        ex = new DefaultExpander();
        ex.addDSLMapping(file.getMapping());

        source = "rule 'q' agenda-group 'x'\nwhen\n    foos \nthen\n    bar 42\n end";
        drl = ex.expand(source);
        //System.out.println( drl );
        assertTrue(ex.hasErrors());
        assertEquals(1,
                ex.getErrors().size());
        //System.err.println(( (ExpanderException) ex.getErrors().get( 0 )).getMessage());
View Full Code Here

                file.getErrors().size());

        DefaultExpander ex = new DefaultExpander();
        ex.addDSLMapping(file.getMapping());
        String source = "rule 'q'\nagenda-group 'x'\nwhen\n    foo  \nthen\n    bar 42\nend";
        String drl = ex.expand(source);
        assertFalse(ex.hasErrors());

        ex = new DefaultExpander();
        ex.addDSLMapping(file.getMapping());
View Full Code Here

        ex = new DefaultExpander();
        ex.addDSLMapping(file.getMapping());

        source = "rule 'q' agenda-group 'x'\nwhen\n    foos \nthen\n    bar 42\n end";
        drl = ex.expand(source);
        //System.out.println( drl );
        assertTrue(ex.hasErrors());
        assertEquals(1,
                ex.getErrors().size());
        //System.err.println(( (ExpanderException) ex.getErrors().get( 0 )).getMessage());
View Full Code Here

        DefaultExpander ex = new DefaultExpander();
        ex.addDSLMapping(file.getMapping());
        String source = "package something;\n\nrule \"1\"\nwhen\n    Invoke rule executor\nthen\n    Execute rule \"5\"\nend";
        String expected = "package something;\n\nrule \"1\"\nwhen\n   ruleExec: RuleExecutor()\nthen\n   ruleExec.ExecuteSubRule( new Long(5));\nend\n";
        String drl = ex.expand(source);
        //        System.out.println("["+drl+"]" );
        //        System.out.println("["+expected+"]" );
        assertFalse(ex.hasErrors());
        equalsIgnoreWhiteSpace(expected,
                drl);
View Full Code Here

        DefaultExpander ex = new DefaultExpander();
        ex.addDSLMapping(file.getMapping());
        String source = "package something;\n\nrule \"1\"\nwhen\n    Invoke rule executor\nthen\n    Execute rule \"5\"\nend";
        String expected = "package something;\n\nrule \"1\"\nwhen\n    ruleExec: RuleExecutor()\nthen\n    ruleExec.ExecuteSubRule( new Long(5));\nend";
        String drl = ex.expand(source);
        //        System.out.println("["+drl+"]" );
        //        System.out.println("["+expected+"]" );
        assertFalse(ex.hasErrors());
        assertEquals(expected,
                drl);
View Full Code Here

        DefaultExpander ex = new DefaultExpander();
        ex.addDSLMapping(file.getMapping());
        String source = "rule 'q'" + NL + "agenda-group 'x'" + NL + "when" + NL + "    __  " + NL +
                "then" + NL + "    bar 42" + NL + "\tgoober" + NL + "end";
        ex.expand(source);
        assertTrue(ex.hasErrors());
        assertEquals(2,
                ex.getErrors().size());
        ExpanderException err = (ExpanderException) ex.getErrors().get(0);
        assertEquals(4,
View Full Code Here

        DefaultExpander ex = new DefaultExpander();
        ex.addDSLMapping(file.getMapping());
        String source = "rule 'q'" + NL + "agenda-group 'x'" + NL + "when" + NL + "    __  " + NL +
                "then" + NL + "    bar 42" + NL + "\tgoober" + NL + "end";
        ex.expand(source);
        assertTrue(ex.hasErrors());
        assertEquals(2,
                ex.getErrors().size());
        ExpanderException err = (ExpanderException) ex.getErrors().get(0);
        assertEquals(4,
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.