Package org.drools.lang.descr

Examples of org.drools.lang.descr.PackageDescr


        PackageBuilder builder = new PackageBuilder();

        InputStream in = this.getClass().getResourceAsStream( "/org/jbpm/integrationtests/ruleflow.rfm" );
        assertNotNull( in );

        builder.addPackage( new PackageDescr( "com.sample" ) );

        builder.addRuleFlow( new InputStreamReader( in ) );
        Package pkg = builder.getPackage();
        assertNotNull( pkg );
View Full Code Here


                            "true" );

        InputStream in = this.getClass().getResourceAsStream( "/org/jbpm/integrationtests/ruleflow40.rfm" );
        assertNotNull( in );

        builder.addPackage( new PackageDescr( "com.sample" ) );

        builder.addRuleFlow( new InputStreamReader( in ) );
        Package pkg = builder.getPackage();
        assertNotNull( pkg );
View Full Code Here

    }

    public void testExpanderMultipleConstraintsFlush() throws Exception {
        final DrlParser parser = new DrlParser();
        //this is similar to the other test, but it requires a flush to add the constraints
        final PackageDescr pkg = parser.parse( this.getReader( "expander_multiple_constraints_flush.dslr" ),
                                               this.getReader( "multiple_constraints.dsl" ) );

        assertFalse( parser.getErrors().toString(),
                     parser.hasErrors() );

        final RuleDescr rule = (RuleDescr) pkg.getRules().get( 0 );
        assertEquals( 1,
                      rule.getLhs().getDescrs().size() );

        final PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
        assertEquals( "Person",
View Full Code Here

    public void testBasicBinding() throws Exception {
        final DRLParser parser = parseResource( "basic_binding.drl" );
        parser.compilation_unit();

        final PackageDescr pkg = parser.getPackageDescr();
        final RuleDescr ruleDescr = (RuleDescr) pkg.getRules().get( 0 );

        final AndDescr lhs = ruleDescr.getLhs();
        assertEquals( 1,
                      lhs.getDescrs().size() );
        final PatternDescr cheese = (PatternDescr) lhs.getDescrs().get( 0 );
View Full Code Here

    public void testBoundVariables() throws Exception {
        final DRLParser parser = parseResource( "bindings.drl" );
        parser.compilation_unit();

        final PackageDescr pkg = parser.getPackageDescr();
        final RuleDescr ruleDescr = (RuleDescr) pkg.getRules().get( 0 );

        final AndDescr lhs = ruleDescr.getLhs();
        assertEquals( 2,
                      lhs.getDescrs().size() );
        final PatternDescr cheese = (PatternDescr) lhs.getDescrs().get( 0 );
View Full Code Here

    public void testOrNesting() throws Exception {
        final DRLParser parser = parseResource( "or_nesting.drl" );
        parser.compilation_unit();

        final PackageDescr pack = parser.getPackageDescr();
        assertNotNull( pack );
        assertEquals( 1,
                      pack.getRules().size() );
        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
        assertEquals( "simple_rule",
                      rule.getName() );

        assertEquals( 1,
                      rule.getLhs().getDescrs().size() );
View Full Code Here

    /** Test that explicit "&&", "||" works as expected */
    public void testAndOrRules() throws Exception {
        final DRLParser parser = parseResource( "and_or_rule.drl" );
        parser.compilation_unit();

        final PackageDescr pack = parser.getPackageDescr();
        assertNotNull( pack );
        assertEquals( 1,
                      pack.getRules().size() );
        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
        assertEquals( "simple_rule",
                      rule.getName() );

        //we will have 2 children under the main And node
        final AndDescr and = rule.getLhs();
View Full Code Here

    /** test basic foo : Fact() || Fact() stuff */
    public void testOrWithBinding() throws Exception {
        final DRLParser parser = parseResource( "or_binding.drl" );
        parser.compilation_unit();

        final PackageDescr pack = parser.getPackageDescr();
        assertEquals( 1,
                      pack.getRules().size() );
        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
        assertEquals( 2,
                      rule.getLhs().getDescrs().size() );

        final OrDescr or = (OrDescr) rule.getLhs().getDescrs().get( 0 );
        assertEquals( 2,
View Full Code Here

    /** test basic foo : Fact() || Fact() stuff binding to an "or"*/
    public void testOrBindingComplex() throws Exception {
        final DRLParser parser = parseResource( "or_binding_complex.drl" );
        parser.compilation_unit();

        final PackageDescr pack = parser.getPackageDescr();
        assertEquals( 1,
                      pack.getRules().size() );
        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
        assertEquals( 1,
                      rule.getLhs().getDescrs().size() );

        assertEquals( 1,
                      rule.getLhs().getDescrs().size() );
View Full Code Here

    public void testOrBindingWithBrackets() throws Exception {
        final DRLParser parser = parseResource( "or_binding_with_brackets.drl" );
        parser.compilation_unit();

        final PackageDescr pack = parser.getPackageDescr();
        assertEquals( 1,
                      pack.getRules().size() );
        final RuleDescr rule = (RuleDescr) pack.getRules().get( 0 );
        assertEquals( 1,
                      rule.getLhs().getDescrs().size() );

        assertEquals( 1,
                      rule.getLhs().getDescrs().size() );
View Full Code Here

TOP

Related Classes of org.drools.lang.descr.PackageDescr

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.