[rules-users] Simple rulebase not behaving as expected : Part 2

Edson Tirelli tirelli at post.com
Thu Aug 23 09:25:48 EDT 2007


   Looks like a bug. Can you please open a JIRA for this?

   Thanks
      Edson

2007/8/23, Dean Jones <dean.m.jones at gmail.com>:
>
> Hello again,
>
> I'm probably missing something fundamental here, but I have the
> following rulebase:
>
> package org.drools.examples
>
> rule "Hello World"
>         when
>             Integer()
>         then
>             System.out.println("Hello world");
> end
>
> rule "Goodbye World"
>         when
>             not Integer()
>         then
>             System.out.println("Goodbye cruel world");
> end
>
> and the following code:
>
> public class TestReadRuleFile {
>
> public static void main(String[] args) throws Exception {
>   PackageBuilder builder = new PackageBuilder();
>   InputStreamReader is = new InputStreamReader(
>    TestReadRuleFile.class.getResourceAsStream("test.drl"));
>   builder.addPackageFromDrl(is);
>   Package pkg = builder.getPackage();
>   RuleBase jbossRulebase = RuleBaseFactory.newRuleBase();
>   jbossRulebase.addPackage(pkg);
>   StatelessSession session = jbossRulebase.newStatelessSession();
>   session.execute(new Float(1));
> }
>
> }
>
> Neither of the rules fire, which is not what I expected - I thought
> that the "Goodbye world" rule would fire. When I switch to using a
> StatefulSession, the rules behave as I expect. Any thoughts on what's
> going on here? Thanks,
>
> Dean.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070823/c5ec3190/attachment.html 


More information about the rules-users mailing list