[jboss-svn-commits] JBL Code SVN: r6732 - in labs/jbossrules/trunk/drools-compiler/src/test: java/org/drools/integrationtests resources/org/drools/integrationtests

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Oct 10 15:02:30 EDT 2006


Author: tirelli
Date: 2006-10-10 15:02:09 -0400 (Tue, 10 Oct 2006)
New Revision: 6732

Added:
   labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_Assert_Retract_Noloop.drl
Modified:
   labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java
Log:
JBRULES-506: adding integration test to trunk

Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java	2006-10-10 18:56:36 UTC (rev 6731)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java	2006-10-10 19:02:09 UTC (rev 6732)
@@ -3290,4 +3290,31 @@
         
     }
     
+    public void testAssertRetractNoloop() {
+        try {
+            //read in the source
+            final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_Assert_Retract_Noloop.drl" ) );
+            final DrlParser parser = new DrlParser();
+            final PackageDescr packageDescr = parser.parse( reader );
+
+            //pre build the package
+            final PackageBuilder builder = new PackageBuilder();
+            builder.addPackage( packageDescr );
+            final Package pkg = builder.getPackage();
+
+            //add the package to a rulebase
+            final RuleBase ruleBase = getRuleBase();
+            ruleBase.addPackage( pkg );
+            //load up the rulebase
+
+            final WorkingMemory wm = ruleBase.newWorkingMemory();
+            wm.assertObject( new Cheese("stilton", 15) );
+            
+            wm.fireAllRules();
+        } catch ( Exception e ) {
+            e.printStackTrace();
+            fail("test should not throw exception");
+        }
+    }
+    
 }

Added: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_Assert_Retract_Noloop.drl
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_Assert_Retract_Noloop.drl	2006-10-10 18:56:36 UTC (rev 6731)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_Assert_Retract_Noloop.drl	2006-10-10 19:02:09 UTC (rev 6732)
@@ -0,0 +1,25 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+rule "test1"
+	salience 10
+	no-loop true
+	when
+        cheese : Cheese();
+    then
+    	retract(cheese);
+		assert(cheese);
+end;
+
+
+rule "test2"
+	salience 0
+	no-loop true
+	when
+        cheese : Cheese();
+    then
+		retract(cheese);
+end;
+
+


Property changes on: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_Assert_Retract_Noloop.drl
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:eol-style
   + native




More information about the jboss-svn-commits mailing list