Skip to content

Commit

Permalink
[JBRULES-3640] add test case - issue already fixed by JBRULES-3658
Browse files Browse the repository at this point in the history
  • Loading branch information
mariofusco committed Oct 29, 2012
1 parent 63dfb78 commit 7e3ac11
Showing 1 changed file with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.drools.CommonTestMethodBase;
import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseFactory;
import org.drools.Person;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
Expand Down Expand Up @@ -179,4 +180,53 @@ public void testAnalyzeConditionWithVariableRegExp() throws Exception {

assertEquals(2, ksession.fireAllRules());
}

@Test
public void testShareAlphaNodesRegardlessDoubleOrSingleQuotes() {
// JBRULES-3640
String str =
"declare RecordA\n" +
" id : long\n" +
"end\n" +
"\n" +
"declare RecordB\n" +
" id : long\n" +
"role : String\n" +
"end\n" +
"\n" +
"rule \"insert data 1\"\n" +
" salience 10\n" +
" when\n" +
" then\n" +
" insert (new RecordA(100));\n" +
" insert (new RecordB(100, \"1\"));\n" +
" insert (new RecordB(100, \"2\"));\n" +
"end\n" +
"\n" +
"rule \"test 1\"\n" +
" when\n" +
" a : RecordA( )\n" +
" b : RecordB( id == b.id, role == '1' )\n" +
" then\n" +
"end\n" +
"\n" +
"rule \"test 2\"\n" +
" when\n" +
" a : RecordA( )\n" +
" b : RecordB( id == b.id, role == \"1\" )\n" +
" then\n" +
"end\n" +
"\n" +
"rule \"test 3\"\n" +
" when\n" +
" a : RecordA( )\n" +
" b : RecordB( id == b.id, role == \"2\" )\n" +
" then\n" +
"end\n";

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

assertEquals(4, ksession.fireAllRules());
}
}

0 comments on commit 7e3ac11

Please sign in to comment.