[jboss-svn-commits] JBL Code SVN: r6630 - labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Oct 5 18:25:54 EDT 2006


Author: mark.proctor at jboss.com
Date: 2006-10-05 18:25:52 -0400 (Thu, 05 Oct 2006)
New Revision: 6630

Modified:
   labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/JoinNodeTest.java
Log:
JBRULES-498 Optimised HashMap implementations
-JoinNode and tests now work

Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/JoinNodeTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/JoinNodeTest.java	2006-10-05 21:32:04 UTC (rev 6629)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/JoinNodeTest.java	2006-10-05 22:25:52 UTC (rev 6630)
@@ -342,18 +342,19 @@
                                this.context,
                                this.workingMemory );
 
+        // Should be no assertions
         assertLength( 0,
                       this.sink.getAsserted() );
-
-        // check no matches
-        final Map map = tuple1.getTupleMatches();
-        assertLength( 0,
-                      map.keySet() );
-
-        //assertNull( ((ObjectMatches) this.memory.getRightFactHandleMemory().get( f0 )).getFirstTupleMatch() );
+        
+        this.node.retractObject( f0,
+                                 this.context,
+                                 this.workingMemory );
+        // We still propagate all joins for a retract. Later we might apply tests first.
+        assertLength( 1,
+                      this.sink.getRetracted() );                        
     }
 
-    public void testUpdateWithMemory() {
+    public void testUpdateSink() {
         final ReteooWorkingMemory workingMemory = new ReteooWorkingMemory( 1,
                                                                            (ReteooRuleBase) RuleBaseFactory.newRuleBase() );
 
@@ -389,34 +390,15 @@
         // Add the new sink, this should be updated from the re-processed
         // joinnode memory
         final MockTupleSink sink2 = new MockTupleSink( 3 );
-        joinNode.addTupleSink( sink2 );
         assertLength( 0,
                       sink2.getAsserted() );
 
-        joinNode.updateNewNode( workingMemory,
-                                this.context );
+        joinNode.updateSink( sink2,
+                             this.context,
+                             workingMemory);
 
         assertLength( 1,
                       sink2.getAsserted() );
     }
 
-    /**
-     * @param tuple1
-     * @param matches
-     * @param f3
-     * @return
-     */
-    private ObjectMatches getMatchesFor(final Tuple tuple1,
-                                        final DefaultFactHandle f3) {
-        ObjectMatches matches = null;
-        for ( final Iterator i = this.memory.rightObjectIterator( this.workingMemory,
-                                                                  tuple1 ); i.hasNext(); ) {
-            matches = (ObjectMatches) i.next();
-            if ( matches.getFactHandle().equals( f3 ) ) {
-                break;
-            }
-        }
-        return matches;
-    }
-
 }
\ No newline at end of file




More information about the jboss-svn-commits mailing list