[jboss-svn-commits] JBL Code SVN: r31767 - in labs/jbossrules/branches/true_modify_20100215: drools-core/src/main/java/org/drools/common and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sun Feb 21 22:29:58 EST 2010


Author: tirelli
Date: 2010-02-21 22:29:58 -0500 (Sun, 21 Feb 2010)
New Revision: 31767

Modified:
   labs/jbossrules/branches/true_modify_20100215/drools-compiler/src/test/java/org/drools/integrationtests/MiscTest.java
   labs/jbossrules/branches/true_modify_20100215/drools-core/src/main/java/org/drools/common/DefaultAgenda.java
Log:
JBRULES-2339: JBRULES-2340: fixing tests

Modified: labs/jbossrules/branches/true_modify_20100215/drools-compiler/src/test/java/org/drools/integrationtests/MiscTest.java
===================================================================
--- labs/jbossrules/branches/true_modify_20100215/drools-compiler/src/test/java/org/drools/integrationtests/MiscTest.java	2010-02-22 02:42:45 UTC (rev 31766)
+++ labs/jbossrules/branches/true_modify_20100215/drools-compiler/src/test/java/org/drools/integrationtests/MiscTest.java	2010-02-22 03:29:58 UTC (rev 31767)
@@ -2506,7 +2506,6 @@
         ruleBase.addPackage( pkg );
         StatefulSession session = ruleBase.newStatefulSession();
 
-        WorkingMemoryInMemoryLogger logger = new WorkingMemoryInMemoryLogger( session );
         List list = new ArrayList();
         session.setGlobal( "list",
                            list );
@@ -2645,7 +2644,6 @@
         ruleBase.addPackage( pkg );
         ruleBase = SerializationHelper.serializeObject( ruleBase );
         WorkingMemory workingMemory = ruleBase.newStatefulSession();
-        WorkingMemoryConsoleLogger logger = new WorkingMemoryConsoleLogger(workingMemory);
 
         final List list = new ArrayList();
         workingMemory.setGlobal( "list",
@@ -3195,8 +3193,6 @@
         ruleBase.addPackage( pkg1 );
         ruleBase = SerializationHelper.serializeObject( ruleBase );
         final WorkingMemory workingMemory = ruleBase.newStatefulSession();
-        WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger( workingMemory );
-        logger.setFileName( "log_20080401" );
 
         try {
             final List orderedFacts = new ArrayList();
@@ -3221,7 +3217,6 @@
                                      n.getIndex() );
             }
         } finally {
-            logger.writeToDisk();
         }
     }
 
@@ -5960,9 +5955,6 @@
         final WorkingMemory wm = ruleBase.newStatefulSession();
 
         try {
-            final WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger( wm );
-            logger.setFileName( "testLogger" );
-
             wm.fireAllRules();
 
             wm.insert( new Cheese( "a",
@@ -5972,7 +5964,6 @@
 
             wm.fireAllRules();
 
-            //            logger.writeToDisk();
         } catch ( Exception e ) {
             e.printStackTrace();
             fail( "No exception should be raised " );

Modified: labs/jbossrules/branches/true_modify_20100215/drools-core/src/main/java/org/drools/common/DefaultAgenda.java
===================================================================
--- labs/jbossrules/branches/true_modify_20100215/drools-core/src/main/java/org/drools/common/DefaultAgenda.java	2010-02-22 02:42:45 UTC (rev 31766)
+++ labs/jbossrules/branches/true_modify_20100215/drools-core/src/main/java/org/drools/common/DefaultAgenda.java	2010-02-22 03:29:58 UTC (rev 31767)
@@ -353,33 +353,7 @@
 
             // do not add the activation if the rule is "lock-on-active" and the
             // AgendaGroup is active
-            // we must check the context to determine if its a new tuple or an
-            // exist re-activated tuple as part of the retract
-            if ( activation.getPropagationContext().getType() == PropagationContext.MODIFICATION ) {
-             // FIXME justifier stuff
-//                if ( activation.getRule().isLockOnActive() && agendaGroup.isActive() ) {
-//                    Activation justifier = activation.getPropagationContext().removeRetractedTuple( activation.getRule(),
-//                                                                                                    (LeftTuple) activation.getTuple() );
-//
-//                    if ( justifier == null ) {
-//                        // This rule is locked and active, do not allow new
-//                        // tuples to activate
-//                        return false;
-//                    } else if ( activation.getRule().hasLogicalDependency() ) {
-//                        copyLogicalDependencies( activation.getPropagationContext(),
-//                                                 workingMemory,
-//                                                 activation,
-//                                                 justifier );
-//                    }
-//                } else if ( activation.getRule().hasLogicalDependency() ) {
-//                    Activation justifier = activation.getPropagationContext().removeRetractedTuple( activation.getRule(),
-//                                                                                                    (LeftTuple) activation.getTuple() );
-//                    copyLogicalDependencies( activation.getPropagationContext(),
-//                                             workingMemory,
-//                                             activation,
-//                                             justifier );
-//                }
-            } else if ( activation.getRule().isLockOnActive() && agendaGroup.isActive() ) {
+            if ( activation.getRule().isLockOnActive() && agendaGroup.isActive() ) {
                 return false;
             }
 
@@ -390,37 +364,11 @@
 
             // do not add the activation if the rule is "lock-on-active" and the
             // RuleFlowGroup is active
-            // we must check the context to determine if its a new tuple or an
-            // exist re-activated tuple as part of the retract
-            if ( activation.getPropagationContext().getType() == PropagationContext.MODIFICATION ) {
-                // FIXME justifier stuff
-//                if ( activation.getRule().isLockOnActive() && rfg.isActive() ) {
-//                    Activation justifier = activation.getPropagationContext().removeRetractedTuple( activation.getRule(),
-//                                                                                                    (LeftTuple) activation.getTuple() );
-//                    if ( justifier == null ) {
-//                        // This rule is locked and active, do not allow new
-//                        // tuples to activate
-//                        return false;
-//                    } else if ( activation.getRule().hasLogicalDependency() ) {
-//                        copyLogicalDependencies( activation.getPropagationContext(),
-//                                                 workingMemory,
-//                                                 activation,
-//                                                 justifier );
-//                    }
-//                } else if ( activation.getRule().hasLogicalDependency() ) {
-//                    Activation justifier = activation.getPropagationContext().removeRetractedTuple( activation.getRule(),
-//                                                                                                    (LeftTuple) activation.getTuple() );
-//                    copyLogicalDependencies( activation.getPropagationContext(),
-//                                             workingMemory,
-//                                             activation,
-//                                             justifier );
-//                }
-            } else if ( activation.getRule().isLockOnActive() && rfg.isActive() ) {
+            if ( activation.getRule().isLockOnActive() && rfg.isActive() ) {
                 return false;
             }
 
             rfg.addActivation( activation );
-
         }
 
         // making sure we re-evaluate agenda in case we are waiting for activations
@@ -431,24 +379,6 @@
 
     }
 
-    private void copyLogicalDependencies(final PropagationContext context,
-                                         final InternalWorkingMemory workingMemory,
-                                         final AgendaItem item,
-                                         Activation justifier) {
-        if ( justifier != null ) {
-            final org.drools.util.LinkedList list = justifier.getLogicalDependencies();
-            if ( list != null && !list.isEmpty() ) {
-                for ( LogicalDependency node = (LogicalDependency) list.getFirst(); node != null; node = (LogicalDependency) node.getNext() ) {
-                    final InternalFactHandle handle = (InternalFactHandle) node.getFactHandle();
-                    workingMemory.getTruthMaintenanceSystem().addLogicalDependency( handle,
-                                                                                    item,
-                                                                                    context,
-                                                                                    item.getRule() );
-                }
-            }
-        }
-    }
-
     public void removeScheduleItem(final ScheduledAgendaItem item) {
         this.scheduledActivations.remove( item );
         Scheduler.removeAgendaItem( item,



More information about the jboss-svn-commits mailing list