Skip to content

Commit

Permalink
[JBRULES-2244] add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
mariofusco committed Apr 2, 2012
1 parent 947c761 commit e53219d
Showing 1 changed file with 25 additions and 0 deletions.
Expand Up @@ -10711,4 +10711,29 @@ public boolean isOddArgsNr(int... args) {
return args.length % 2 == 1;
}
}

@Test
public void testPackageImportWithMvelDialect() throws Exception {
// JBRULES-2244
String str = "package org.drools.test;\n" +
"import org.drools.*\n" +
"dialect \"mvel\"\n" +
"rule R1 no-loop when\n" +
" $p : Person( )" +
" $c : Cheese( )" +
"then\n" +
" modify($p) { setCheese($c) };\n" +
"end\n";

KnowledgeBase kbase = loadKnowledgeBaseFromString( str );
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

Person p = new Person("Mario", 38);
ksession.insert(p);
Cheese c = new Cheese("Gorgonzola");
ksession.insert(c);

assertEquals(1, ksession.fireAllRules());
assertSame(c, p.getCheese());
}
}

0 comments on commit e53219d

Please sign in to comment.