[jboss-svn-commits] JBL Code SVN: r31293 - labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Jan 28 21:47:15 EST 2010
Author: tirelli
Date: 2010-01-28 21:47:15 -0500 (Thu, 28 Jan 2010)
New Revision: 31293
Modified:
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/AccumulateNodeAssertRetractTest.data
Log:
JBRULES-2340: improving accumulate test
Modified: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/AccumulateNodeAssertRetractTest.data
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/AccumulateNodeAssertRetractTest.data 2010-01-29 02:17:07 UTC (rev 31292)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/AccumulateNodeAssertRetractTest.data 2010-01-29 02:47:15 UTC (rev 31293)
@@ -14,9 +14,12 @@
LeftTupleSink:
sink, acc;
Facts:
- new Person('darth', 35, "brie"), new Person('bobba', 36, 'stilton'),
- new Cheese('brie', 10), new Cheese('brie', 12),
- new Cheese('stilton', 15), new Cheese('muzzarella', 12);
+ new Person('darth', 35, "brie"), // h0
+ new Person('bobba', 36, 'stilton'), // h1
+ new Cheese('brie', 10), // h2
+ new Cheese('brie', 12), // h3
+ new Cheese('stilton', 15), // h4
+ new Cheese('brie', 12); // h5
/**
* check single left assertion and retraction
@@ -79,67 +82,91 @@
/**
* check single right then left assertion
- *
+ */
Test "single right then left assertion"
assert:
- otnRight1, [h2];
- otnLeft1, [h1];
- col1:
+ acc, [h2];
+ acc, [[h1]];
+ acc:
leftMemory, [[h1]];
rightMemory, [h2];
- sink1:
- verify, assert, count, 1;
- verify, assert, tuple0[1].object.isEmpty();
+ sink:
+ verify, assert, count, 0;
verify, modify, count, 0; // checking, just in case
+ verify, retract, count, 0;
retract:
- otnLeft1, [h1];
- otnRight1, [h2];
- sink1:
- verify, retract, count, 1;
+ acc, [[h1]];
+ acc, [h2];
+ acc:
+ leftMemory, [];
+ rightMemory, [];
+ sink:
+ verify, retract, count, 0;
verify, modify, count, 0;
+ verify, assert, count, 0;
/**
* assert two left and two right, with incremental first removal
- *
-Test "two left and two right"
+ */
+Test "testing modifies"
assert:
- otnLeft1, [h0, h1];
- otnRight1, [h2, h3];
- col1:
+ acc, [[h0], [h1]];
+ acc, [h2, h3];
+ acc:
leftMemory, [[h0]];
leftMemory, [[h1]];
rightMemory, [h2, h3];
- sink1:
- verify, assert, count, 2;
- verify, modify, count, 2;
+ sink:
+ verify, assert, count, 1; // only h0 matches and propagates
+ verify, modify, count, 0; // still no modifies
verify, assert, tuple0[0], is( h0 );
+ verify, assert, tuple0[1].object == 22; // that is the result of the sum
+ assert:
+ acc, [h4, h5];
+ acc:
+ leftMemory, [[h0]];
+ leftMemory, [[h1]];
+ rightMemory, [h2, h3, h5];
+ rightMemory, [h4];
+ sink:
+ verify, assert, count, 2; // h4 also matched h1 now, so we got a new assert
verify, assert, tuple1[0], is( h1 );
- verify, modify, tuple1[1].object.size() == 2;
- verify, modify, tuple1[1].object, hasItem( h2.object );
- verify, modify, tuple1[1].object, hasItem( h3.object );
+ verify, assert, tuple1[1].object == 15; // that is the result of the sum of h4
+ verify, modify, count, 1; // h5 causes a modify call
+ verify, modify, tuple0[0], is( h0 );
+ verify, modify, tuple0[1].object == 34;
+ verify, retract, count, 0; // checking just in case
retract:
- otnLeft1, [h0];
- col1:
+ acc, [h2];
+ sink:
+ verify, modify, count, 2; // h5 causes a modify call
+ verify, modify, tuple1[0], is( h0 );
+ verify, modify, tuple1[1].object == 24;
+ acc:
+ leftMemory, [[h0]];
leftMemory, [[h1]];
- rightMemory, [h2, h3];
- sink1:
- verify, retract, count, 1;
+ rightMemory, [h3, h5];
+ rightMemory, [h4];
+ retract:
+ acc, [[h0]];
+ acc, [[h1]];
+ sink:
+ verify, retract, count, 2;
verify, retract, tuple0[0], is( h0 );
+ verify, retract, tuple1[0], is( h1 );
+ acc:
+ leftMemory, [];
+ rightMemory, [h3, h5];
+ rightMemory, [h4];
retract:
- otnRight1, [h2];
- col1:
- leftMemory, [[h1]];
- rightMemory, [h3];
- sink1:
- verify, retract, count, 1; // still 1, so no retracts were called
- verify, modify, count, 2; // still 2, so no modifies were called
- retract:
- otnLeft1, [h1];
- sink1:
- verify, retract, count, 2;
- retract:
- otnRight1, [h3];
- col1:
+ acc, [h3, h4, h5];
+ acc:
leftMemory, [];
rightMemory, [];
-*/
+ sink:
+ // checking final totals
+ verify, assert, count, 2;
+ verify, modify, count, 2;
+ verify, retract, count, 2;
+
+
\ No newline at end of file
More information about the jboss-svn-commits
mailing list