[jboss-svn-commits] JBL Code SVN: r23499 - in labs/jbossrules/trunk/drools-compiler/src/test: resources/org/drools/integrationtests and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Oct 17 12:54:34 EDT 2008


Author: ge0ffrey
Date: 2008-10-17 12:54:34 -0400 (Fri, 17 Oct 2008)
New Revision: 23499

Added:
   labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsModifySameRuleGivesDifferentLogicalInsertion.drl
Modified:
   labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/TruthMaintenanceTest.java
Log:
JBRULES-1804 testcase (disabled as it is not yet resolved)

Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/TruthMaintenanceTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/TruthMaintenanceTest.java	2008-10-17 16:41:54 UTC (rev 23498)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/TruthMaintenanceTest.java	2008-10-17 16:54:34 UTC (rev 23499)
@@ -788,7 +788,46 @@
         //clean-up
         workingMemory.fireAllRules();
         assertEquals( 0, IteratorToList.convert( workingMemory.iterateObjects() ).size() );
-    }    
+    }
+
+    public void disabled_testLogicalInsertionsModifySameRuleGivesDifferentLogicalInsertion() throws Exception {
+        // TODO JBRULES-1804
+        final PackageBuilder builder = new PackageBuilder();
+        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalInsertionsModifySameRuleGivesDifferentLogicalInsertion.drl" ) ) );
+        final Package pkg = builder.getPackage();
+
+        RuleBase ruleBase = getRuleBase();
+        ruleBase.addPackage( pkg );
+        ruleBase    = SerializationHelper.serializeObject(ruleBase);
+        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+        Sensor sensor1 = new Sensor( 100, 0 );
+        FactHandle sensor1Handle = workingMemory.insert( sensor1 );
+        Sensor sensor2 = new Sensor( 200, 0 );
+        FactHandle sensor2Handle = workingMemory.insert( sensor2 );
+        Sensor sensor3 = new Sensor( 200, 0 );
+        FactHandle sensor3Handle = workingMemory.insert( sensor2 );
+
+        workingMemory.fireAllRules();
+
+        List temperatureList = IteratorToList.convert(workingMemory.iterateObjects(new ClassObjectFilter(Integer.class)));
+        assertTrue(temperatureList.contains(Integer.valueOf(100)));
+        assertTrue(temperatureList.contains(Integer.valueOf(200)));
+        assertEquals(2, temperatureList.size());
+
+        workingMemory.modifyRetract(sensor1Handle);
+        sensor1.setTemperature(150);
+        workingMemory.modifyInsert(sensor1Handle, sensor1);
+        workingMemory.fireAllRules();
+        
+        temperatureList = IteratorToList.convert(workingMemory.iterateObjects(new ClassObjectFilter(Integer.class)));
+        assertFalse(temperatureList.contains(Integer.valueOf(100))); // TODO currently it fails here, because 100 lingers
+        assertTrue(temperatureList.contains(Integer.valueOf(150)));
+        assertTrue(temperatureList.contains(Integer.valueOf(200)));
+        assertEquals(2, temperatureList.size());
+
+
+    }
     
 
 }

Copied: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsModifySameRuleGivesDifferentLogicalInsertion.drl (from rev 23496, labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsWithUpdate.drl)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsModifySameRuleGivesDifferentLogicalInsertion.drl	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsModifySameRuleGivesDifferentLogicalInsertion.drl	2008-10-17 16:54:34 UTC (rev 23499)
@@ -0,0 +1,10 @@
+package org.drools.test;
+
+import org.drools.Sensor;
+
+rule "assertAllTemperatures"
+	when
+		p : Sensor( t : temperature )
+	then
+		insertLogical( new Integer( t ) );
+end
\ No newline at end of file


Property changes on: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_LogicalInsertionsModifySameRuleGivesDifferentLogicalInsertion.drl
___________________________________________________________________
Name: svn:mergeinfo
   + 




More information about the jboss-svn-commits mailing list