Package org.drools.verifier.misc

Examples of org.drools.verifier.misc.DrlRuleParser


        drl += "    insert( new Person()) \n ";
        drl += "    insert( new Car()) \n ";
        drl += "    insert( new Cheese()) \n ";
        drl += "end ";

        DrlRuleParser s = DrlRuleParser.findRulesDataFromDrl(drl).get(0);

        assertEquals(1, s.getHeader().size());
        assertEquals(2, s.getLhs().size());
        assertEquals(3, s.getRhs().size());
        assertEquals("", s.getDescription());

    }
View Full Code Here


        drl += "  when    then";
        drl += "    applicant.setApproved(true) \n";
        drl += "    applicant.setName( \"Toni\" ) \n";
        drl += "    applicant.setAge( 10 ) \n";
        drl += "end";
        DrlRuleParser s = DrlRuleParser.findRulesDataFromDrl(drl).get(0);

        assertNotNull(s);

        assertEquals(1, s.getHeader().size());
        assertEquals(0, s.getLhs().size());
        assertEquals(3, s.getRhs().size());
        assertEquals("", s.getDescription());

    }
View Full Code Here

        List<DrlRuleParser> list = DrlRuleParser.findRulesDataFromDrl(drl);

        assertEquals(3, list.size());

        DrlRuleParser rd = list.get(0);

        assertNotNull(rd);

        assertEquals(1, rd.getHeader().size());
        assertEquals(2, rd.getLhs().size());
        assertEquals(3, rd.getRhs().size());
        assertEquals(1, rd.getMetadata().size());
        assertNotNull(rd.getDescription());
        assertNotSame("", rd.getDescription());

        DrlRuleParser rd2 = list.get(1);

        assertNotNull(rd2);

        assertEquals(1, rd2.getHeader().size());
        assertEquals(2, rd2.getLhs().size());
        assertEquals(3, rd2.getRhs().size());
        assertEquals(3, rd2.getMetadata().size());
        assertNotNull(rd2.getDescription());

        String description = "Really important information about this rule\n";
        description += "Another line because one was not enough\n\n";

        assertEquals(description, rd2.getDescription());
        assertNotSame("", rd2.getDescription());

        DrlRuleParser rd3 = list.get(2);

        assertNotNull(rd3);

        assertEquals(1, rd3.getHeader().size());
        assertEquals(2, rd3.getLhs().size());
        assertEquals(3, rd3.getRhs().size());
        assertNotNull(rd3.getDescription());
        assertEquals("", rd3.getDescription());
    }
View Full Code Here

            AssetItem assetItem = (AssetItem) assets.next();

            if ( formats.contains( assetItem.getFormat() ) && !assetItem.getDisabled() && !assetItem.isArchived() ) {
                String drl = getDRL( assetItem );
                if ( drl != null ) {
                    DrlRuleParser ruleData = DrlRuleParser.findRulesDataFromDrl( drl ).get( 0 );

                    // Add info about categories
                    List<String> categories = new ArrayList<String>();
                    for ( CategoryItem ci : assetItem.getCategories() ) {
                        categories.add( ci.getName() );
                    }

                    ruleData.getOtherInformation().put( "Categories",
                                                   categories );
                    ruleData.getMetadata().addAll( createMetaData( assetItem ) );

                    rules.add( ruleData );
                }
            }
        }
View Full Code Here

            AssetItem assetItem = (AssetItem) assets.next();

            if ( formats.contains( assetItem.getFormat() ) && !assetItem.getDisabled() && !assetItem.isArchived() ) {
                String drl = getDRL( assetItem );
                if ( drl != null ) {
                    DrlRuleParser ruleData = DrlRuleParser.findRulesDataFromDrl( drl ).get( 0 );

                    // Add info about categories
                    List<String> categories = new ArrayList<String>();
                    for ( CategoryItem ci : assetItem.getCategories() ) {
                        categories.add( ci.getName() );
                    }

                    ruleData.getOtherInformation().put( "Categories",
                                                   categories );
                    ruleData.getMetadata().addAll( createMetaData( assetItem ) );

                    rules.add( ruleData );
                }
            }
        }
View Full Code Here

    drl += "    insert( new Person()) \n ";
    drl += "    insert( new Car()) \n ";
    drl += "    insert( new Cheese()) \n ";
    drl += "end ";

    DrlRuleParser s = DrlRuleParser.findRulesDataFromDrl(drl).get(0);

    assertEquals(1, s.getHeader().size());
    assertEquals(2, s.getLhs().size());
    assertEquals(3, s.getRhs().size());
    assertEquals("", s.getDescription());

  }
View Full Code Here

    drl += "  when    then";
    drl += "    applicant.setApproved(true) \n";
    drl += "    applicant.setName( \"Toni\" ) \n";
    drl += "    applicant.setAge( 10 ) \n";
    drl += "end";
    DrlRuleParser s = DrlRuleParser.findRulesDataFromDrl(drl).get(0);

    assertNotNull(s);

    assertEquals(1, s.getHeader().size());
    assertEquals(0, s.getLhs().size());
    assertEquals(3, s.getRhs().size());
    assertEquals("", s.getDescription());

  }
View Full Code Here

    List<DrlRuleParser> list = DrlRuleParser.findRulesDataFromDrl(drl);

    assertEquals(3, list.size());

    DrlRuleParser rd = list.get(0);

    assertNotNull(rd);

    assertEquals(1, rd.getHeader().size());
    assertEquals(2, rd.getLhs().size());
    assertEquals(3, rd.getRhs().size());
    assertEquals(1, rd.getMetadata().size());
    assertNotNull(rd.getDescription());
    assertNotSame("", rd.getDescription());

    DrlRuleParser rd2 = list.get(1);

    assertNotNull(rd2);

    assertEquals(1, rd2.getHeader().size());
    assertEquals(2, rd2.getLhs().size());
    assertEquals(3, rd2.getRhs().size());
    assertEquals(3, rd2.getMetadata().size());
    assertNotNull(rd2.getDescription());

    String description = "Really important information about this rule\n";
    description += "Another line because one was not enough\n\n";

    assertEquals(description, rd2.getDescription());
    assertNotSame("", rd2.getDescription());

    DrlRuleParser rd3 = list.get(2);

    assertNotNull(rd3);

    assertEquals(1, rd3.getHeader().size());
    assertEquals(2, rd3.getLhs().size());
    assertEquals(3, rd3.getRhs().size());
    assertNotNull(rd3.getDescription());
    assertEquals("", rd3.getDescription());
  }
View Full Code Here

            AssetItem assetItem = (AssetItem) assets.next();

            if ( formats.contains( assetItem.getFormat() ) && !assetItem.getDisabled() && !assetItem.isArchived() ) {
                String drl = getDRL( assetItem );
                if ( drl != null ) {
                    DrlRuleParser ruleData = DrlRuleParser.findRulesDataFromDrl( drl ).get( 0 );

                    // Add info about categories
                    List<String> categories = new ArrayList<String>();
                    for ( CategoryItem ci : assetItem.getCategories() ) {
                        categories.add( ci.getName() );
                    }

                    ruleData.getOtherInformation().put( "Categories",
                                                   categories );
                    ruleData.getMetadata().addAll( createMetaData( assetItem ) );

                    rules.add( ruleData );
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.drools.verifier.misc.DrlRuleParser

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.