[jboss-svn-commits] JBL Code SVN: r13176 - labs/jbossrules/trunk/drools-eclipse/drools-eclipse-test/src/test/java/org/drools/eclipse/editors/completion.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Jul 6 13:52:32 EDT 2007


Author: KrisVerlaenen
Date: 2007-07-06 13:52:32 -0400 (Fri, 06 Jul 2007)
New Revision: 13176

Modified:
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-test/src/test/java/org/drools/eclipse/editors/completion/LocationDeterminatorTest.java
Log:
JBRULES-979: Ruleflow should terminate all running node instances when ruleflow process is completed
JBRULES-981: Milestone
 - initial start of milestone node

Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-test/src/test/java/org/drools/eclipse/editors/completion/LocationDeterminatorTest.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-test/src/test/java/org/drools/eclipse/editors/completion/LocationDeterminatorTest.java	2007-07-06 17:52:23 UTC (rev 13175)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-test/src/test/java/org/drools/eclipse/editors/completion/LocationDeterminatorTest.java	2007-07-06 17:52:32 UTC (rev 13176)
@@ -598,21 +598,21 @@
         assertEquals("Class", location.getProperty(Location.LOCATION_PROPERTY_CLASS_NAME));
 
         // TODO        
-//        input = 
-//        	"rule MyRule \n" +
-//        	"	when \n" +
-//        	"		not exists Class (";
-//        location = LocationDeterminator.getLocationInCondition(input);
-//        assertEquals(Location.LOCATION_INSIDE_CONDITION_START, location.getType());
-//        assertEquals("Class", location.getProperty(Location.LOCATION_PROPERTY_CLASS_NAME));
+        input = 
+        	"rule MyRule \n" +
+        	"	when \n" +
+        	"		not exists Class (";
+        location = LocationDeterminator.getLocation(input);
+        assertEquals(Location.LOCATION_LHS_INSIDE_CONDITION_START, location.getType());
+        assertEquals("Class", location.getProperty(Location.LOCATION_PROPERTY_CLASS_NAME));
 
-//        input = 
-//        	"rule MyRule \n" +
-//        	"	when \n" +
-//        	"		not exists name : Class (";
-//        location = LocationDeterminator.getLocationInCondition(input);
-//        assertEquals(Location.LOCATION_INSIDE_CONDITION_START, location.getType());
-//        assertEquals("Class", location.getProperty(Location.LOCATION_PROPERTY_CLASS_NAME));
+        input = 
+        	"rule MyRule \n" +
+        	"	when \n" +
+        	"		not exists name : Class (";
+        location = LocationDeterminator.getLocation(input);
+        assertEquals(Location.LOCATION_LHS_INSIDE_CONDITION_START, location.getType());
+        assertEquals("Class", location.getProperty(Location.LOCATION_PROPERTY_CLASS_NAME));
 
         input = 
         	"rule MyRule \n" +
@@ -1323,6 +1323,97 @@
         assertEquals(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT, location.getType());
         assertEquals("Cheese", location.getProperty(Location.LOCATION_PROPERTY_CLASS_NAME));
         assertEquals("type", location.getProperty(Location.LOCATION_PROPERTY_PROPERTY_NAME));
+        
+        /** NESTED FROM */
+        input = 
+        	"rule MyRule \n" +
+        	"	when \n" +
+        	"		ArrayList(size > 50) from collect( Person( disabled == \"yes\", income > 100000 ) ";
+        location = LocationDeterminator.getLocation(input);
+        assertEquals(Location.LOCATION_LHS_BEGIN_OF_CONDITION, location.getType());
+
+        input = 
+        	"rule MyRule \n" +
+        	"	when \n" +
+        	"		ArrayList(size > 50) from collect( Person( disabled == \"yes\", income > 100000 ) from ";
+        location = LocationDeterminator.getLocation(input);
+        assertEquals(Location.LOCATION_LHS_FROM, location.getType());
+
+        input = 
+        	"rule MyRule \n" +
+        	"	when \n" +
+        	"		ArrayList(size > 50) from collect( Person( disabled == \"yes\", income > 100000 ) from town.getPersons() )";
+        location = LocationDeterminator.getLocation(input);
+        assertEquals(Location.LOCATION_LHS_BEGIN_OF_CONDITION, location.getType());
+
+        input = 
+        	"rule MyRule \n" +
+        	"	when \n" +
+        	"		ArrayList(size > 50) from accumulate( Person( disabled == \"yes\", income > 100000 ) ";
+        location = LocationDeterminator.getLocation(input);
+        assertEquals(Location.LOCATION_LHS_BEGIN_OF_CONDITION, location.getType());
+
+        input = 
+        	"rule MyRule \n" +
+        	"	when \n" +
+        	"		ArrayList(size > 50) from accumulate( Person( disabled == \"yes\", income > 100000 ) from ";
+        location = LocationDeterminator.getLocation(input);
+        assertEquals(Location.LOCATION_LHS_FROM, location.getType());
+
+        input = 
+        	"rule MyRule \n" +
+        	"	when \n" +
+        	"		ArrayList(size > 50) from accumulate( Person( disabled == \"yes\", income > 100000 ) from town.getPersons() )";
+        location = LocationDeterminator.getLocation(input);
+        assertEquals(Location.LOCATION_LHS_BEGIN_OF_CONDITION, location.getType());
+
+        /** FORALL */
+        input = 
+        	"rule MyRule \n" +
+        	"	when \n" +
+        	"		forall ( ";
+        location = LocationDeterminator.getLocation(input);
+        assertEquals(Location.LOCATION_LHS_BEGIN_OF_CONDITION, location.getType());
+
+        input = 
+        	"rule MyRule \n" +
+        	"	when \n" +
+        	"		forall ( " +
+        	"           Class ( pr";
+        location = LocationDeterminator.getLocation(input);
+        assertEquals(Location.LOCATION_LHS_INSIDE_CONDITION_START, location.getType());
+        assertEquals("Class", location.getProperty(Location.LOCATION_PROPERTY_CLASS_NAME));
+        assertEquals("pr", location.getProperty(Location.LOCATION_PROPERTY_PROPERTY_NAME));
+
+        input = 
+        	"rule MyRule \n" +
+        	"	when \n" +
+        	"		forall ( " +
+        	"           Class ( property ";
+        location = LocationDeterminator.getLocation(input);
+        assertEquals(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR, location.getType());
+        assertEquals("Class", location.getProperty(Location.LOCATION_PROPERTY_CLASS_NAME));
+        assertEquals("property", location.getProperty(Location.LOCATION_PROPERTY_PROPERTY_NAME));
+
+        input = 
+        	"rule MyRule \n" +
+        	"	when \n" +
+        	"		forall ( " +
+        	"           Class ( property == ";
+        location = LocationDeterminator.getLocation(input);
+        assertEquals(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT, location.getType());
+        assertEquals("Class", location.getProperty(Location.LOCATION_PROPERTY_CLASS_NAME));
+        assertEquals("property", location.getProperty(Location.LOCATION_PROPERTY_PROPERTY_NAME));
+        assertEquals("==", location.getProperty(Location.LOCATION_PROPERTY_OPERATOR));
+
+        input = 
+        	"rule MyRule \n" +
+        	"	when \n" +
+        	"		forall ( " +
+        	"           Class ( property == \"test\")" +
+        	"           C";
+        location = LocationDeterminator.getLocation(input);
+        assertEquals(Location.LOCATION_LHS_BEGIN_OF_CONDITION, location.getType());
     }
     
     public void testCheckRHSLocationDetermination() {




More information about the jboss-svn-commits mailing list