use of org.drools.compiler.SecondClass in project drools by kiegroup.
the class BetaTest method testDefaultBetaConstrains.
@Test
public void testDefaultBetaConstrains() throws Exception {
final KieBase kbase = SerializationHelper.serializeObject(loadKnowledgeBase("test_DefaultBetaConstraint.drl"));
final KieSession ksession = createKnowledgeSession(kbase);
final List results = new ArrayList();
ksession.setGlobal("results", results);
final FirstClass first = new FirstClass("1", "2", "3", "4", "5");
final FactHandle handle = ksession.insert(first);
ksession.fireAllRules();
assertEquals(1, results.size());
assertEquals("NOT", results.get(0));
ksession.insert(new SecondClass());
ksession.update(handle, first);
ksession.fireAllRules();
assertEquals(2, results.size());
assertEquals("NOT", results.get(1));
ksession.update(handle, first);
ksession.insert(new SecondClass(null, "2", "3", "4", "5"));
ksession.fireAllRules();
assertEquals(3, results.size());
assertEquals("NOT", results.get(2));
ksession.update(handle, first);
ksession.insert(new SecondClass("1", null, "3", "4", "5"));
ksession.fireAllRules();
assertEquals(4, results.size());
assertEquals("NOT", results.get(3));
ksession.update(handle, first);
ksession.insert(new SecondClass("1", "2", null, "4", "5"));
ksession.fireAllRules();
assertEquals(5, results.size());
assertEquals("NOT", results.get(4));
ksession.update(handle, first);
ksession.insert(new SecondClass("1", "2", "3", null, "5"));
ksession.fireAllRules();
assertEquals(6, results.size());
assertEquals("NOT", results.get(5));
ksession.update(handle, first);
ksession.insert(new SecondClass("1", "2", "3", "4", null));
ksession.fireAllRules();
assertEquals(7, results.size());
assertEquals("NOT", results.get(6));
ksession.insert(new SecondClass("1", "2", "3", "4", "5"));
ksession.update(handle, first);
ksession.fireAllRules();
assertEquals(8, results.size());
assertEquals("EQUALS", results.get(7));
}
use of org.drools.compiler.SecondClass in project drools by kiegroup.
the class ImportsTest method testImportColision.
@Test
public void testImportColision() throws Exception {
final Collection<KiePackage> kpkgs1 = loadKnowledgePackages("nested1.drl");
final Collection<KiePackage> kpkgs2 = loadKnowledgePackages("nested2.drl");
final InternalKnowledgeBase kbase = (InternalKnowledgeBase) loadKnowledgeBase();
kbase.addPackages(kpkgs1);
kbase.addPackages(kpkgs2);
final KieSession ksession = createKnowledgeSession(kbase);
SerializationHelper.serializeObject(kbase);
ksession.insert(new FirstClass());
ksession.insert(new SecondClass());
ksession.insert(new FirstClass.AlternativeKey());
ksession.insert(new SecondClass.AlternativeKey());
ksession.fireAllRules();
}
Aggregations