[jboss-svn-commits] JBL Code SVN: r31327 - in labs/jbossrules/branches/true_modify_20100104/drools-core/src/test: java/org/drools/reteoo/test/dsl and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Jan 29 16:36:18 EST 2010
Author: tirelli
Date: 2010-01-29 16:36:16 -0500 (Fri, 29 Jan 2010)
New Revision: 31327
Added:
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/JUnitNodeTestRunner.java
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/NodeTestCasesSource.java
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/NodeTestsSuite.java
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/AccumulateNodeAssertRetractTest.nodeTestCase
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/CollectNodeAssertRetractTest.nodeTestCase
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeAssertRetractTest.nodeTestCase
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeIndexTest.nodeTestCase
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeModifyTest.nodeTestCase
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ForallNodeAssertRetractTest.data
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeAssertRetractTest.nodeTestCase
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeIndexTest.nodeTestCase
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeModifyTest.nodeTestCase
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeAssertRetractTest.nodeTestCase
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeIndexTest.nodeTestCase
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeModifyTest.nodeTestCase
Removed:
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/AccumulateNodeTest.java
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/CollectNodeTest.java
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/ExistsNodeTest.java
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/JoinNodeTest.java
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/NotNodeTest.java
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/AccumulateNodeAssertRetractTest.data
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/CollectNodeAssertRetractTest.data
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeAssertRetractTest.data
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeIndexTest.data
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeModifyTest.data
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ForallNodeAssertRetractTest.data
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeAssertRetractTest.data
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeIndexTest.data
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeModifyTest.data
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeAssertRetractTest.data
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeIndexTest.data
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeModifyTest.data
Modified:
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/ReteDslTestEngine.java
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/ReteDslTestEngineHelper.java
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/ReteDslTestEngineTest.java
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/dsl/NodeTest.java
labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/dsl/NodeTestCase.java
Log:
JBRULES-2339: JBRULES-2340: adding support to junit runner
Deleted: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/AccumulateNodeTest.java
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/AccumulateNodeTest.java 2010-01-29 18:54:52 UTC (rev 31326)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/AccumulateNodeTest.java 2010-01-29 21:36:16 UTC (rev 31327)
@@ -1,21 +0,0 @@
-package org.drools.reteoo.test;
-
-
-import junit.framework.TestCase;
-
-public class AccumulateNodeTest extends TestCase {
-
- public void testAssertRetract() {
- ReteDslTestEngineHelper.executeDsl( "AccumulateNodeAssertRetractTest.data" );
- }
-
-// public void testModify() {
-// executeDsl( "JoinNodeModifyTest.data" );
-// }
-//
-// public void testindex() {
-// executeDsl( "JoinNodeIndexTest.data" );
-// }
-
-
-}
\ No newline at end of file
Deleted: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/CollectNodeTest.java
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/CollectNodeTest.java 2010-01-29 18:54:52 UTC (rev 31326)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/CollectNodeTest.java 2010-01-29 21:36:16 UTC (rev 31327)
@@ -1,53 +0,0 @@
-package org.drools.reteoo.test;
-
-
-import junit.framework.TestCase;
-
-public class CollectNodeTest extends TestCase {
-
- public void testAssertRetract() {
- ReteDslTestEngineHelper.executeDsl( "CollectNodeAssertRetractTest.data" );
- }
-
-// public void testModify() {
-// executeDsl( "JoinNodeModifyTest.data" );
-// }
-//
-// public void testindex() {
-// executeDsl( "JoinNodeIndexTest.data" );
-// }
-
- /*
- public void testIndexedAssert() {
- executeDsl( "JoinNodeIndexedAssertTest.data" );
- }
-
- public void testIndexedAssertRetract() {
- executeDsl( new String[]{"JoinNodeIndexedAssertTest.data",
- "JoinNodeIndexedAssertRetractTest.data"} );
- }
-
- public void testIndexedAssertRetractModify() {
- executeDsl( new String[]{"JoinNodeIndexedAssertTest.data",
- "JoinNodeIndexedAssertRetractTest.data",
- "JoinNodeIndexedAssertRetractModifyTest.data"} );
- }
-
- public void testNotIndexedAssert() {
- executeDsl( "JoinNodeNotIndexedAssertTest.data" );
- }
-
- public void testNotIndexedAssertRetract() {
- executeDsl( new String[]{"JoinNodeNotIndexedAssertTest.data",
- "JoinNodeNotIndexedAssertRetractTest.data"} );
- }
-
- public void testNotIndexedAssertRetractModify() {
- executeDsl( new String[]{"JoinNodeNotIndexedAssertTest.data",
- "JoinNodeNotIndexedAssertRetractTest.data",
- "JoinNodeNotIndexedAssertRetractModifyTest.data"} );
- }
-
- */
-
-}
\ No newline at end of file
Deleted: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/ExistsNodeTest.java
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/ExistsNodeTest.java 2010-01-29 18:54:52 UTC (rev 31326)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/ExistsNodeTest.java 2010-01-29 21:36:16 UTC (rev 31327)
@@ -1,52 +0,0 @@
-package org.drools.reteoo.test;
-
-
-import junit.framework.TestCase;
-
-public class ExistsNodeTest extends TestCase {
-
- public void testAssertRetract() {
- ReteDslTestEngineHelper.executeDsl( "ExistsNodeAssertRetractTest.data" );
- }
-
- public void testModify() {
- ReteDslTestEngineHelper.executeDsl( "ExistsNodeModifyTest.data" );
- }
-
- public void testindex() {
- ReteDslTestEngineHelper.executeDsl( "ExistsNodeIndexTest.data" );
- }
-
- /*
- public void testIndexedAssert() {
- executeDsl( "JoinNodeIndexedAssertTest.data" );
- }
-
- public void testIndexedAssertRetract() {
- executeDsl( new String[]{"JoinNodeIndexedAssertTest.data",
- "JoinNodeIndexedAssertRetractTest.data"} );
- }
-
- public void testIndexedAssertRetractModify() {
- executeDsl( new String[]{"JoinNodeIndexedAssertTest.data",
- "JoinNodeIndexedAssertRetractTest.data",
- "JoinNodeIndexedAssertRetractModifyTest.data"} );
- }
-
- public void testNotIndexedAssert() {
- executeDsl( "JoinNodeNotIndexedAssertTest.data" );
- }
-
- public void testNotIndexedAssertRetract() {
- executeDsl( new String[]{"JoinNodeNotIndexedAssertTest.data",
- "JoinNodeNotIndexedAssertRetractTest.data"} );
- }
-
- public void testNotIndexedAssertRetractModify() {
- executeDsl( new String[]{"JoinNodeNotIndexedAssertTest.data",
- "JoinNodeNotIndexedAssertRetractTest.data",
- "JoinNodeNotIndexedAssertRetractModifyTest.data"} );
- }
-
- */
-}
\ No newline at end of file
Added: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/JUnitNodeTestRunner.java
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/JUnitNodeTestRunner.java (rev 0)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/JUnitNodeTestRunner.java 2010-01-29 21:36:16 UTC (rev 31327)
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2008 Red Hat
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.drools.reteoo.test;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.drools.reteoo.test.dsl.NodeTest;
+import org.drools.reteoo.test.dsl.NodeTestCase;
+import org.junit.runner.Description;
+import org.junit.runner.Runner;
+import org.junit.runner.notification.RunNotifier;
+
+/**
+ * A class that runs node tests as JUnit tests
+ *
+ * @author etirelli
+ */
+public class JUnitNodeTestRunner extends Runner {
+
+ // The description of the test suite
+ private Description descr;
+ private List<NodeTestCase> testCases = new ArrayList<NodeTestCase>();
+
+ public JUnitNodeTestRunner(Class< ? > clazz) throws Exception {
+ NodeTestCasesSource ntsuite = (NodeTestCasesSource) clazz.newInstance();
+ testCases = ntsuite.getTestCases();
+ this.descr = Description.createSuiteDescription( "Node test case suite" );
+
+ for ( NodeTestCase tcase : testCases ) {
+ Description tcaseDescr = Description.createSuiteDescription( tcase.getName() );
+ tcase.setDescription( tcaseDescr );
+ this.descr.addChild( tcaseDescr );
+ for ( NodeTest ntest : tcase.getTests() ) {
+ Description ntestDescr = Description.createTestDescription( clazz,
+ ntest.getName() );
+ tcaseDescr.addChild( ntestDescr );
+ ntest.setDescription( ntestDescr );
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.junit.runner.Runner#getDescription()
+ */
+ @Override
+ public Description getDescription() {
+ return descr;
+ }
+
+ /* (non-Javadoc)
+ * @see org.junit.runner.Runner#run(org.junit.runner.notification.RunNotifier)
+ */
+ @Override
+ public void run(RunNotifier notifier) {
+ ReteDslTestEngine tester = new ReteDslTestEngine();
+ for ( NodeTestCase tcase : testCases ) {
+ tester.run( tcase,
+ notifier );
+ }
+ }
+
+}
Property changes on: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/JUnitNodeTestRunner.java
___________________________________________________________________
Name: svn:executable
+ *
Deleted: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/JoinNodeTest.java
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/JoinNodeTest.java 2010-01-29 18:54:52 UTC (rev 31326)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/JoinNodeTest.java 2010-01-29 21:36:16 UTC (rev 31327)
@@ -1,53 +0,0 @@
-package org.drools.reteoo.test;
-
-
-import junit.framework.TestCase;
-
-public class JoinNodeTest extends TestCase {
-
- public void testAssertRetract() {
- ReteDslTestEngineHelper.executeDsl( "JoinNodeAssertRetractTest.data" );
- }
-
- public void testModify() {
- ReteDslTestEngineHelper.executeDsl( "JoinNodeModifyTest.data" );
- }
-
- public void testindex() {
- ReteDslTestEngineHelper.executeDsl( "JoinNodeIndexTest.data" );
- }
-
- /*
- public void testIndexedAssert() {
- executeDsl( "JoinNodeIndexedAssertTest.data" );
- }
-
- public void testIndexedAssertRetract() {
- executeDsl( new String[]{"JoinNodeIndexedAssertTest.data",
- "JoinNodeIndexedAssertRetractTest.data"} );
- }
-
- public void testIndexedAssertRetractModify() {
- executeDsl( new String[]{"JoinNodeIndexedAssertTest.data",
- "JoinNodeIndexedAssertRetractTest.data",
- "JoinNodeIndexedAssertRetractModifyTest.data"} );
- }
-
- public void testNotIndexedAssert() {
- executeDsl( "JoinNodeNotIndexedAssertTest.data" );
- }
-
- public void testNotIndexedAssertRetract() {
- executeDsl( new String[]{"JoinNodeNotIndexedAssertTest.data",
- "JoinNodeNotIndexedAssertRetractTest.data"} );
- }
-
- public void testNotIndexedAssertRetractModify() {
- executeDsl( new String[]{"JoinNodeNotIndexedAssertTest.data",
- "JoinNodeNotIndexedAssertRetractTest.data",
- "JoinNodeNotIndexedAssertRetractModifyTest.data"} );
- }
-
- */
-
-}
\ No newline at end of file
Added: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/NodeTestCasesSource.java
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/NodeTestCasesSource.java (rev 0)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/NodeTestCasesSource.java 2010-01-29 21:36:16 UTC (rev 31327)
@@ -0,0 +1,11 @@
+package org.drools.reteoo.test;
+
+import java.util.List;
+
+import org.drools.reteoo.test.dsl.NodeTestCase;
+
+public interface NodeTestCasesSource {
+
+ public List<NodeTestCase> getTestCases() throws Exception;
+
+}
\ No newline at end of file
Property changes on: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/NodeTestCasesSource.java
___________________________________________________________________
Name: svn:executable
+ *
Added: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/NodeTestsSuite.java
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/NodeTestsSuite.java (rev 0)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/NodeTestsSuite.java 2010-01-29 21:36:16 UTC (rev 31327)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2008 Red Hat
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.drools.reteoo.test;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FilenameFilter;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.drools.reteoo.test.dsl.NodeTestCase;
+import org.junit.runner.RunWith;
+
+/**
+ * A test case suite to manage and run all node test cases
+ *
+ * @author etirelli
+ */
+ at RunWith(JUnitNodeTestRunner.class)
+public class NodeTestsSuite
+ implements
+ NodeTestCasesSource {
+
+ /* (non-Javadoc)
+ * @see org.drools.reteoo.test.NodeTestCasesSource#getTestCases()
+ */
+ public List<NodeTestCase> getTestCases() throws Exception {
+ List<NodeTestCase> result = new ArrayList<NodeTestCase>();
+ File base = new File( this.getClass().getResource( "." ).toURI() );
+ for ( File file : base.listFiles( new FilenameFilter() {
+ @Override
+ public boolean accept(File arg0,
+ String arg1) {
+ return arg1.endsWith( ".nodeTestCase" );
+ }
+ } ) ) {
+ InputStream is = new FileInputStream( file );
+ NodeTestCase tcase = ReteDslTestEngine.compile( is );
+ if ( tcase.hasErrors() ) {
+ throw new IllegalArgumentException( "Error parsing and loading testcase: " + file.getAbsolutePath() + "\n" + tcase.getErrors().toString() );
+ }
+ result.add( tcase );
+ is.close();
+ }
+
+ return result;
+ }
+
+}
Property changes on: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/NodeTestsSuite.java
___________________________________________________________________
Name: svn:executable
+ *
Deleted: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/NotNodeTest.java
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/NotNodeTest.java 2010-01-29 18:54:52 UTC (rev 31326)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/NotNodeTest.java 2010-01-29 21:36:16 UTC (rev 31327)
@@ -1,52 +0,0 @@
-package org.drools.reteoo.test;
-
-
-import junit.framework.TestCase;
-
-public class NotNodeTest extends TestCase {
-
- public void testAssertRetract() {
- ReteDslTestEngineHelper.executeDsl( "NotNodeAssertRetractTest.data" );
- }
-
- public void testModify() {
- ReteDslTestEngineHelper.executeDsl( "NotNodeModifyTest.data" );
- }
-
- public void testindex() {
- ReteDslTestEngineHelper.executeDsl( "NotNodeIndexTest.data" );
- }
-
- /*
- public void testIndexedAssert() {
- executeDsl( "JoinNodeIndexedAssertTest.data" );
- }
-
- public void testIndexedAssertRetract() {
- executeDsl( new String[]{"JoinNodeIndexedAssertTest.data",
- "JoinNodeIndexedAssertRetractTest.data"} );
- }
-
- public void testIndexedAssertRetractModify() {
- executeDsl( new String[]{"JoinNodeIndexedAssertTest.data",
- "JoinNodeIndexedAssertRetractTest.data",
- "JoinNodeIndexedAssertRetractModifyTest.data"} );
- }
-
- public void testNotIndexedAssert() {
- executeDsl( "JoinNodeNotIndexedAssertTest.data" );
- }
-
- public void testNotIndexedAssertRetract() {
- executeDsl( new String[]{"JoinNodeNotIndexedAssertTest.data",
- "JoinNodeNotIndexedAssertRetractTest.data"} );
- }
-
- public void testNotIndexedAssertRetractModify() {
- executeDsl( new String[]{"JoinNodeNotIndexedAssertTest.data",
- "JoinNodeNotIndexedAssertRetractTest.data",
- "JoinNodeNotIndexedAssertRetractModifyTest.data"} );
- }
-
- */
-}
\ No newline at end of file
Modified: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/ReteDslTestEngine.java
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/ReteDslTestEngine.java 2010-01-29 18:54:52 UTC (rev 31326)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/ReteDslTestEngine.java 2010-01-29 21:36:16 UTC (rev 31327)
@@ -71,6 +71,10 @@
import org.drools.reteoo.test.parser.NodeTestDSLTree;
import org.drools.reteoo.test.parser.NodeTestDSLParser.compilation_unit_return;
import org.drools.spi.PropagationContext;
+import org.junit.runner.Description;
+import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunNotifier;
+import org.junit.runner.notification.StoppedByUserException;
import org.mvel2.MVEL;
public class ReteDslTestEngine {
@@ -120,15 +124,28 @@
new ObjectSourceStep( this.reteTesterHelper ) );
}
- public NodeTestCaseResult run(NodeTestCase testCase) {
+ public NodeTestCaseResult run(NodeTestCase testCase, RunNotifier notifier) {
if ( testCase == null || testCase.hasErrors() ) {
throw new IllegalArgumentException( "Impossible to execute test case due to existing errors: " + testCase.getErrors() );
}
+ if( notifier == null ) {
+ notifier = EmptyNotifier.INSTANCE;
+ }
this.reteTesterHelper.addImports( testCase.getImports() );
NodeTestCaseResult result = new NodeTestCaseResult( testCase );
for ( NodeTest test : testCase.getTests() ) {
+ notifier.fireTestStarted( test.getDescription() );
NodeTestResult testResult = run( testCase,
test );
+ switch( testResult.result ) {
+ case SUCCESS:
+ notifier.fireTestFinished( test.getDescription() );
+ break;
+ case ERROR:
+ case FAILURE:
+ notifier.fireTestFailure( new Failure( test.getDescription(), new AssertionError( testResult.errorMsgs ) ));
+ break;
+ }
result.add( testResult );
}
return result;
@@ -720,139 +737,35 @@
return parser;
}
- /*
- public static List<DslStep> buildDslCommands(Reader reader) {
- try {
- int commandIndentPos = 0;
+ public static class EmptyNotifier extends RunNotifier {
+ public static final EmptyNotifier INSTANCE = new EmptyNotifier();
- DslStep dslCommand = null;
- List<DslStep> commands = new ArrayList<DslStep>();
- StringBuilder cmdContent = null;
- List<String> cmds = null;
+ @Override
+ public void fireTestAssumptionFailed(Failure failure) {
+ }
- List<String> lines = chunkReader( reader );
- int lineCount = 1;
+ @Override
+ public void fireTestFailure(Failure failure) {
+ }
- for ( String line : lines ) {
- if ( StringUtils.isEmpty( line ) ) {
- lineCount++;
- continue;
- }
+ @Override
+ public void fireTestFinished(Description description) {
+ }
- if ( line.charAt( 0 ) != ' ' ) {
- // finish of the last command
- if ( dslCommand != null ) {
- // existing dslCommand, so add arguments before starting again
- cmds.add( cmdContent.toString() );
- }
+ @Override
+ public void fireTestIgnored(Description description) {
+ }
- // start of new command
- cmds = new ArrayList<String>();
- dslCommand = new DslStep( lineCount,
- line.trim(),
- cmds );
- commands.add( dslCommand );
- commandIndentPos = 0;
- } else {
- if ( commandIndentPos == 0 ) {
- commandIndentPos = indentPos( line );
- cmdContent = new StringBuilder();
- cmdContent.append( line.trim() );
- } else {
- if ( indentPos( line ) > commandIndentPos ) {
- cmdContent.append( line.trim() );
- } else {
- cmds.add( cmdContent.toString() );
+ @Override
+ public void fireTestRunFinished(org.junit.runner.Result result) {
+ }
- cmdContent = new StringBuilder();
- cmdContent.append( line.trim() );
- commandIndentPos = indentPos( line );
- }
- }
- }
- lineCount++;
- }
+ @Override
+ public void fireTestRunStarted(Description description) {
+ }
- // finish of the last command
- if ( dslCommand != null ) {
- // existing dslCommand, so add arguments before starting again
- cmds.add( cmdContent.toString() );
- }
-
- return commands;
- } catch ( Exception e ) {
- throw new RuntimeException( e );
- }
- }
-
- public static int indentPos(String line) {
- int i;
- for ( i = 0; i < line.length() && line.charAt( i ) == ' '; i++ ) {
- // iterate to first char
- }
-
- return i;
- }
-
- /**
- * This chunks the reader into a List<String> it removes single line and block comements
- * while preserving spacing.
- *
- public static List<String> chunkReader(Reader reader) {
- List<String> lines = new ArrayList<String>();
- BufferedReader bReader = null;
- if ( !(reader instanceof BufferedReader) ) {
- bReader = new BufferedReader( reader );
- }
- String line;
- int pos;
- boolean blockComment = false;
- try {
- while ( (line = bReader.readLine()) != null ) {
- if ( !blockComment ) {
- pos = line.indexOf( "/*" );
- if ( pos != -1 ) {
- int endPos = line.indexOf( "*"+"/" );
- if ( endPos != -1 ) {
- // we end the block commend on the same time
- blockComment = false;
- } else {
- // replace line till end
- blockComment = true;
- }
-
- line = line.substring( 0,
- pos ).concat( StringUtils.repeat( " ",
- line.length() - pos ) );
- } else {
- // no block comment, so see if single line comment
- pos = line.indexOf( "//" );
- if ( pos != -1 ) {
- // we have a single line comment
- line = line.substring( 0,
- pos ).concat( StringUtils.repeat( " ",
- line.length() - pos ) );
- }
- }
- } else {
- // we are in a block comment, replace all text until end of block
- pos = line.indexOf( "*"+"/" );
- if ( pos != -1 ) {
- line = StringUtils.repeat( " ",
- pos + 2 ).concat( line.substring( pos + 2,
- line.length() ) );
- blockComment = false;
- } else {
- line = StringUtils.repeat( " ",
- line.length() );
- }
- }
- lines.add( line );
- }
- } catch ( IOException e ) {
- throw new RuntimeException( e );
- }
-
- return lines;
- } */
+ @Override
+ public void fireTestStarted(Description description) throws StoppedByUserException {
+ }
+ }
}
\ No newline at end of file
Modified: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/ReteDslTestEngineHelper.java
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/ReteDslTestEngineHelper.java 2010-01-29 18:54:52 UTC (rev 31326)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/ReteDslTestEngineHelper.java 2010-01-29 21:36:16 UTC (rev 31327)
@@ -42,7 +42,7 @@
try {
NodeTestCase testCase = ReteDslTestEngine.compile( inputStream );
ReteDslTestEngine tester = new ReteDslTestEngine();
- NodeTestCaseResult result = tester.run( testCase );
+ NodeTestCaseResult result = tester.run( testCase, null );
if( result.getTotalTests()-result.getSuccesses() > 0 ) {
TestCase.fail("Error executing "+fileName+" : \n "+ result );
}
Modified: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/ReteDslTestEngineTest.java
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/ReteDslTestEngineTest.java 2010-01-29 18:54:52 UTC (rev 31326)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/ReteDslTestEngineTest.java 2010-01-29 21:36:16 UTC (rev 31327)
@@ -2,7 +2,6 @@
import java.io.IOException;
import java.io.InputStream;
-import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -808,7 +807,7 @@
}
ReteDslTestEngine tester = new ReteDslTestEngine();
- NodeTestCaseResult testCaseResult = tester.run( testCase );
+ NodeTestCaseResult testCaseResult = tester.run( testCase, null );
NodeTestResult result = testCaseResult.getResults().get( 0 );
if( result.result != Result.SUCCESS ) {
Modified: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/dsl/NodeTest.java
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/dsl/NodeTest.java 2010-01-29 18:54:52 UTC (rev 31326)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/dsl/NodeTest.java 2010-01-29 21:36:16 UTC (rev 31327)
@@ -3,7 +3,9 @@
import java.util.ArrayList;
import java.util.List;
+import org.junit.runner.Description;
+
/**
* A class to describe a single Node test
*
@@ -13,9 +15,9 @@
private String name;
private int line;
-
private List<DslStep> steps;
-
+ private Description description;
+
public NodeTest() {
this( "", -1 );
}
@@ -52,4 +54,12 @@
this.steps.add( step );
}
+ public Description getDescription() {
+ return description;
+ }
+
+ public void setDescription(Description description) {
+ this.description = description;
+ }
+
}
Modified: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/dsl/NodeTestCase.java
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/dsl/NodeTestCase.java 2010-01-29 18:54:52 UTC (rev 31326)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/java/org/drools/reteoo/test/dsl/NodeTestCase.java 2010-01-29 21:36:16 UTC (rev 31327)
@@ -19,7 +19,9 @@
import java.util.ArrayList;
import java.util.List;
+import org.junit.runner.Description;
+
/**
* A class to describe a test case for reteoo nodes
*
@@ -33,6 +35,7 @@
private List<DslStep> teardDown;
private List<NodeTest> tests;
private List<String> errors;
+ private Description description;
public NodeTestCase() {
this("");
@@ -88,4 +91,12 @@
public boolean hasErrors() {
return this.errors != null && ! this.errors.isEmpty();
}
+
+ public Description getDescription() {
+ return description;
+ }
+
+ public void setDescription(Description description) {
+ this.description = description;
+ }
}
Deleted: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/AccumulateNodeAssertRetractTest.data
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/AccumulateNodeAssertRetractTest.data 2010-01-29 18:54:52 UTC (rev 31326)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/AccumulateNodeAssertRetractTest.data 2010-01-29 21:36:16 UTC (rev 31327)
@@ -1,172 +0,0 @@
-TestCase "Accumulate Node assert/retract test case"
-
-import org.drools.Cheese;
-import org.drools.Person;
-
-Setup
- Binding:
- $likes, 0, Person, likes;
- $price, 1, Cheese, price;
- AccumulateNode:
- acc, mock, mock, Cheese, $price;
- source, type, ==, $likes;
- result, intValue, >, 10;
- LeftTupleSink:
- sink, acc;
- Facts:
- new Person('darth', 35, "brie"), // h0
- new Person('bobba', 36, 'stilton'), // h1
- new Cheese('brie', 10), // h2
- new Cheese('brie', 12), // h3
- new Cheese('stilton', 15), // h4
- new Cheese('brie', 12); // h5
-
-/**
- * check single left assertion and retraction
- */
-Test "Simple assertion and retraction"
- assert:
- acc, [[h0]];
- acc:
- leftMemory, [[h0]];
- sink:
- verify, assert, count, 0;
- retract:
- acc, [[h0]];
- acc:
- leftMemory, [];
- sink:
- verify, retract, count, 0;
-
-/**
- * check single right assertion and retraction
- */
-Test "Single right assertion and retraction"
- assert:
- acc, [h2];
- acc:
- rightMemory, [h2];
- retract:
- acc, [h2];
- acc:
- rightMemory, [];
- sink:
- verify, assert, count, 0;
- verify, retract, count, 0;
-
-/**
- * check single left then right assertion
- */
- Test "single left then right assertion"
- assert:
- acc, [[h0]];
- sink:
- verify, assert, count, 0;
- assert:
- acc, [h3];
- acc:
- leftMemory, [[h0]];
- rightMemory, [h3];
- sink:
- verify, assert, count, 1;
- verify, assert, tuple0[1].object.intValue() == 12;
- verify, modify, count, 0;
- verify, retract, count, 0;
- retract:
- acc, [[h0]];
- acc, [h3];
- sink:
- verify, retract, count, 1;
- verify, modify, count, 0; // still 0, so calls on modify
- verify, assert, count, 1; // checking just in case
-
-/**
- * check single right then left assertion
- */
-Test "single right then left assertion"
- assert:
- acc, [h2];
- acc, [[h1]];
- acc:
- leftMemory, [[h1]];
- rightMemory, [h2];
- sink:
- verify, assert, count, 0;
- verify, modify, count, 0; // checking, just in case
- verify, retract, count, 0;
- retract:
- acc, [[h1]];
- acc, [h2];
- acc:
- leftMemory, [];
- rightMemory, [];
- sink:
- verify, retract, count, 0;
- verify, modify, count, 0;
- verify, assert, count, 0;
-
-/**
- * assert two left and two right, with incremental first removal
- */
-Test "testing modifies"
- assert:
- acc, [[h0], [h1]];
- acc, [h2, h3];
- acc:
- leftMemory, [[h0]];
- leftMemory, [[h1]];
- rightMemory, [h2, h3];
- sink:
- verify, assert, count, 1; // only h0 matches and propagates
- verify, modify, count, 0; // still no modifies
- verify, assert, tuple0[0], is( h0 );
- verify, assert, tuple0[1].object == 22; // that is the result of the sum
- assert:
- acc, [h4, h5];
- acc:
- leftMemory, [[h0]];
- leftMemory, [[h1]];
- rightMemory, [h2, h3, h5];
- rightMemory, [h4];
- sink:
- verify, assert, count, 2; // h4 also matched h1 now, so we got a new assert
- verify, assert, tuple1[0], is( h1 );
- verify, assert, tuple1[1].object == 15; // that is the result of the sum of h4
- verify, modify, count, 1; // h5 causes a modify call
- verify, modify, tuple0[0], is( h0 );
- verify, modify, tuple0[1].object == 34;
- verify, retract, count, 0; // checking just in case
- retract:
- acc, [h2];
- sink:
- verify, modify, count, 2; // h5 causes a modify call
- verify, modify, tuple1[0], is( h0 );
- verify, modify, tuple1[1].object == 24;
- acc:
- leftMemory, [[h0]];
- leftMemory, [[h1]];
- rightMemory, [h3, h5];
- rightMemory, [h4];
- retract:
- acc, [[h0]];
- acc, [[h1]];
- sink:
- verify, retract, count, 2;
- verify, retract, tuple0[0], is( h0 );
- verify, retract, tuple1[0], is( h1 );
- acc:
- leftMemory, [];
- rightMemory, [h3, h5];
- rightMemory, [h4];
- retract:
- acc, [h3, h4, h5];
- acc:
- leftMemory, [];
- rightMemory, [];
- sink:
- // checking final totals
- verify, assert, count, 2;
- verify, modify, count, 2;
- verify, retract, count, 2;
-
-
\ No newline at end of file
Copied: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/AccumulateNodeAssertRetractTest.nodeTestCase (from rev 31293, labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/AccumulateNodeAssertRetractTest.data)
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/AccumulateNodeAssertRetractTest.nodeTestCase (rev 0)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/AccumulateNodeAssertRetractTest.nodeTestCase 2010-01-29 21:36:16 UTC (rev 31327)
@@ -0,0 +1,172 @@
+TestCase "Accumulate Node assert/retract test case"
+
+import org.drools.Cheese;
+import org.drools.Person;
+
+Setup
+ Binding:
+ $likes, 0, Person, likes;
+ $price, 1, Cheese, price;
+ AccumulateNode:
+ acc, mock, mock, Cheese, $price;
+ source, type, ==, $likes;
+ result, intValue, >, 10;
+ LeftTupleSink:
+ sink, acc;
+ Facts:
+ new Person('darth', 35, "brie"), // h0
+ new Person('bobba', 36, 'stilton'), // h1
+ new Cheese('brie', 10), // h2
+ new Cheese('brie', 12), // h3
+ new Cheese('stilton', 15), // h4
+ new Cheese('brie', 12); // h5
+
+/**
+ * check single left assertion and retraction
+ */
+Test "Simple assertion and retraction"
+ assert:
+ acc, [[h0]];
+ acc:
+ leftMemory, [[h0]];
+ sink:
+ verify, assert, count, 0;
+ retract:
+ acc, [[h0]];
+ acc:
+ leftMemory, [];
+ sink:
+ verify, retract, count, 0;
+
+/**
+ * check single right assertion and retraction
+ */
+Test "Single right assertion and retraction"
+ assert:
+ acc, [h2];
+ acc:
+ rightMemory, [h2];
+ retract:
+ acc, [h2];
+ acc:
+ rightMemory, [];
+ sink:
+ verify, assert, count, 0;
+ verify, retract, count, 0;
+
+/**
+ * check single left then right assertion
+ */
+ Test "single left then right assertion"
+ assert:
+ acc, [[h0]];
+ sink:
+ verify, assert, count, 0;
+ assert:
+ acc, [h3];
+ acc:
+ leftMemory, [[h0]];
+ rightMemory, [h3];
+ sink:
+ verify, assert, count, 1;
+ verify, assert, tuple0[1].object.intValue() == 12;
+ verify, modify, count, 0;
+ verify, retract, count, 0;
+ retract:
+ acc, [[h0]];
+ acc, [h3];
+ sink:
+ verify, retract, count, 1;
+ verify, modify, count, 0; // still 0, so calls on modify
+ verify, assert, count, 1; // checking just in case
+
+/**
+ * check single right then left assertion
+ */
+Test "single right then left assertion"
+ assert:
+ acc, [h2];
+ acc, [[h1]];
+ acc:
+ leftMemory, [[h1]];
+ rightMemory, [h2];
+ sink:
+ verify, assert, count, 0;
+ verify, modify, count, 0; // checking, just in case
+ verify, retract, count, 0;
+ retract:
+ acc, [[h1]];
+ acc, [h2];
+ acc:
+ leftMemory, [];
+ rightMemory, [];
+ sink:
+ verify, retract, count, 0;
+ verify, modify, count, 0;
+ verify, assert, count, 0;
+
+/**
+ * assert two left and two right, with incremental first removal
+ */
+Test "testing modifies"
+ assert:
+ acc, [[h0], [h1]];
+ acc, [h2, h3];
+ acc:
+ leftMemory, [[h0]];
+ leftMemory, [[h1]];
+ rightMemory, [h2, h3];
+ sink:
+ verify, assert, count, 1; // only h0 matches and propagates
+ verify, modify, count, 0; // still no modifies
+ verify, assert, tuple0[0], is( h0 );
+ verify, assert, tuple0[1].object == 22; // that is the result of the sum
+ assert:
+ acc, [h4, h5];
+ acc:
+ leftMemory, [[h0]];
+ leftMemory, [[h1]];
+ rightMemory, [h2, h3, h5];
+ rightMemory, [h4];
+ sink:
+ verify, assert, count, 2; // h4 also matched h1 now, so we got a new assert
+ verify, assert, tuple1[0], is( h1 );
+ verify, assert, tuple1[1].object == 15; // that is the result of the sum of h4
+ verify, modify, count, 1; // h5 causes a modify call
+ verify, modify, tuple0[0], is( h0 );
+ verify, modify, tuple0[1].object == 34;
+ verify, retract, count, 0; // checking just in case
+ retract:
+ acc, [h2];
+ sink:
+ verify, modify, count, 2; // h5 causes a modify call
+ verify, modify, tuple1[0], is( h0 );
+ verify, modify, tuple1[1].object == 24;
+ acc:
+ leftMemory, [[h0]];
+ leftMemory, [[h1]];
+ rightMemory, [h3, h5];
+ rightMemory, [h4];
+ retract:
+ acc, [[h0]];
+ acc, [[h1]];
+ sink:
+ verify, retract, count, 2;
+ verify, retract, tuple0[0], is( h0 );
+ verify, retract, tuple1[0], is( h1 );
+ acc:
+ leftMemory, [];
+ rightMemory, [h3, h5];
+ rightMemory, [h4];
+ retract:
+ acc, [h3, h4, h5];
+ acc:
+ leftMemory, [];
+ rightMemory, [];
+ sink:
+ // checking final totals
+ verify, assert, count, 2;
+ verify, modify, count, 2;
+ verify, retract, count, 2;
+
+
\ No newline at end of file
Deleted: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/CollectNodeAssertRetractTest.data
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/CollectNodeAssertRetractTest.data 2010-01-29 18:54:52 UTC (rev 31326)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/CollectNodeAssertRetractTest.data 2010-01-29 21:36:16 UTC (rev 31327)
@@ -1,150 +0,0 @@
-TestCase "Collect Node assert/retract test case"
-
-Setup
- ObjectTypeNode:
- otnLeft1, org.drools.Person;
- LeftInputAdapterNode:
- lian0, otnLeft1;
- ObjectTypeNode:
- otnRight1, org.drools.Cheese;
- Binding:
- l1, 0, org.drools.Person, likes;
- CollectNode:
- col1, lian0, otnRight1, java.util.ArrayList;
- type, ==, l1;
- LeftTupleSink:
- sink1, col1;
- Facts:
- new org.drools.Person('darth', 35, "brie"), new org.drools.Person('bobba', 36, 'stilton'),
- new org.drools.Cheese('brie', 10), new org.drools.Cheese('brie', 12),
- new org.drools.Cheese('stilton', 15), new org.drools.Cheese('muzzarella', 12);
-
-/**
- * check single left assertion and retraction
- */
-Test "Simple assertion and retraction"
- assert:
- otnLeft1, [h0];
- col1:
- leftMemory, [[h0]];
- sink1:
- verify, assert, count, 1;
- verify, assert, tuple0[0], sameInstance(h0);
- verify, assert, tuple0[1].object, instanceOf( java.util.Collection );
- verify, assert, tuple0[1].object.isEmpty();
- retract:
- otnLeft1, [h0];
- col1:
- leftMemory, [];
- sink1:
- verify, retract, count, 1;
- verify, retract, tuple0[0], sameInstance(h0);
-
-/**
- * check single right assertion and retraction
- */
-Test "Single right assertion and retraction"
- assert:
- otnRight1, [h2];
- col1:
- rightMemory, [h2];
- retract:
- otnRight1, [h2];
- col1:
- rightMemory, [];
- sink1:
- verify, assert, count, 0;
- verify, retract, count, 0;
-
-/**
- * check single left then right assertion
- */
- Test "single left then right assertion"
- assert:
- otnLeft1, [h0];
- sink1:
- verify, assert, count, 1;
- verify, assert, tuple0[1].object.isEmpty();
- assert:
- otnRight1, [h2];
- col1:
- leftMemory, [[h0]];
- rightMemory, [h2];
- sink1:
- verify, modify, count, 1;
- verify, modify, tuple0[1].object, hasItem( h2.object );
- retract:
- otnLeft1, [h0];
- otnRight1, [h2];
- sink1:
- verify, retract, count, 1;
- verify, modify, count, 1; // still 1, so no new calls on the retract
- verify, assert, count, 1; // checking just in case
-
-/**
- * check single right then left assertion
- */
-Test "single right then left assertion"
- assert:
- otnRight1, [h2];
- otnLeft1, [h1];
- col1:
- leftMemory, [[h1]];
- rightMemory, [h2];
- sink1:
- verify, assert, count, 1;
- verify, assert, tuple0[1].object.isEmpty();
- verify, modify, count, 0; // checking, just in case
- retract:
- otnLeft1, [h1];
- otnRight1, [h2];
- sink1:
- verify, retract, count, 1;
- verify, modify, count, 0;
-
-/**
- * assert two left and two right, with incremental first removal
- */
-Test "two left and two right"
- assert:
- otnLeft1, [h0, h1];
- otnRight1, [h2, h3];
- col1:
- leftMemory, [[h0]];
- leftMemory, [[h1]];
- rightMemory, [h2, h3];
- sink1:
- verify, assert, count, 2;
- verify, modify, count, 2;
- verify, assert, tuple0[0], is( h0 );
- verify, assert, tuple1[0], is( h1 );
- verify, modify, tuple1[1].object.size() == 2;
- verify, modify, tuple1[1].object, hasItem( h2.object );
- verify, modify, tuple1[1].object, hasItem( h3.object );
- retract:
- otnLeft1, [h0];
- col1:
- leftMemory, [[h1]];
- rightMemory, [h2, h3];
- sink1:
- verify, retract, count, 1;
- verify, retract, tuple0[0], is( h0 );
- retract:
- otnRight1, [h2];
- col1:
- leftMemory, [[h1]];
- rightMemory, [h3];
- sink1:
- verify, retract, count, 1; // still 1, so no retracts were called
- verify, modify, count, 2; // still 2, so no modifies were called
- retract:
- otnLeft1, [h1];
- sink1:
- verify, retract, count, 2;
- retract:
- otnRight1, [h3];
- col1:
- leftMemory, [];
- rightMemory, [];
-
-
Copied: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/CollectNodeAssertRetractTest.nodeTestCase (from rev 31171, labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/CollectNodeAssertRetractTest.data)
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/CollectNodeAssertRetractTest.nodeTestCase (rev 0)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/CollectNodeAssertRetractTest.nodeTestCase 2010-01-29 21:36:16 UTC (rev 31327)
@@ -0,0 +1,150 @@
+TestCase "Collect Node assert/retract test case"
+
+Setup
+ ObjectTypeNode:
+ otnLeft1, org.drools.Person;
+ LeftInputAdapterNode:
+ lian0, otnLeft1;
+ ObjectTypeNode:
+ otnRight1, org.drools.Cheese;
+ Binding:
+ l1, 0, org.drools.Person, likes;
+ CollectNode:
+ col1, lian0, otnRight1, java.util.ArrayList;
+ type, ==, l1;
+ LeftTupleSink:
+ sink1, col1;
+ Facts:
+ new org.drools.Person('darth', 35, "brie"), new org.drools.Person('bobba', 36, 'stilton'),
+ new org.drools.Cheese('brie', 10), new org.drools.Cheese('brie', 12),
+ new org.drools.Cheese('stilton', 15), new org.drools.Cheese('muzzarella', 12);
+
+/**
+ * check single left assertion and retraction
+ */
+Test "Simple assertion and retraction"
+ assert:
+ otnLeft1, [h0];
+ col1:
+ leftMemory, [[h0]];
+ sink1:
+ verify, assert, count, 1;
+ verify, assert, tuple0[0], sameInstance(h0);
+ verify, assert, tuple0[1].object, instanceOf( java.util.Collection );
+ verify, assert, tuple0[1].object.isEmpty();
+ retract:
+ otnLeft1, [h0];
+ col1:
+ leftMemory, [];
+ sink1:
+ verify, retract, count, 1;
+ verify, retract, tuple0[0], sameInstance(h0);
+
+/**
+ * check single right assertion and retraction
+ */
+Test "Single right assertion and retraction"
+ assert:
+ otnRight1, [h2];
+ col1:
+ rightMemory, [h2];
+ retract:
+ otnRight1, [h2];
+ col1:
+ rightMemory, [];
+ sink1:
+ verify, assert, count, 0;
+ verify, retract, count, 0;
+
+/**
+ * check single left then right assertion
+ */
+ Test "single left then right assertion"
+ assert:
+ otnLeft1, [h0];
+ sink1:
+ verify, assert, count, 1;
+ verify, assert, tuple0[1].object.isEmpty();
+ assert:
+ otnRight1, [h2];
+ col1:
+ leftMemory, [[h0]];
+ rightMemory, [h2];
+ sink1:
+ verify, modify, count, 1;
+ verify, modify, tuple0[1].object, hasItem( h2.object );
+ retract:
+ otnLeft1, [h0];
+ otnRight1, [h2];
+ sink1:
+ verify, retract, count, 1;
+ verify, modify, count, 1; // still 1, so no new calls on the retract
+ verify, assert, count, 1; // checking just in case
+
+/**
+ * check single right then left assertion
+ */
+Test "single right then left assertion"
+ assert:
+ otnRight1, [h2];
+ otnLeft1, [h1];
+ col1:
+ leftMemory, [[h1]];
+ rightMemory, [h2];
+ sink1:
+ verify, assert, count, 1;
+ verify, assert, tuple0[1].object.isEmpty();
+ verify, modify, count, 0; // checking, just in case
+ retract:
+ otnLeft1, [h1];
+ otnRight1, [h2];
+ sink1:
+ verify, retract, count, 1;
+ verify, modify, count, 0;
+
+/**
+ * assert two left and two right, with incremental first removal
+ */
+Test "two left and two right"
+ assert:
+ otnLeft1, [h0, h1];
+ otnRight1, [h2, h3];
+ col1:
+ leftMemory, [[h0]];
+ leftMemory, [[h1]];
+ rightMemory, [h2, h3];
+ sink1:
+ verify, assert, count, 2;
+ verify, modify, count, 2;
+ verify, assert, tuple0[0], is( h0 );
+ verify, assert, tuple1[0], is( h1 );
+ verify, modify, tuple1[1].object.size() == 2;
+ verify, modify, tuple1[1].object, hasItem( h2.object );
+ verify, modify, tuple1[1].object, hasItem( h3.object );
+ retract:
+ otnLeft1, [h0];
+ col1:
+ leftMemory, [[h1]];
+ rightMemory, [h2, h3];
+ sink1:
+ verify, retract, count, 1;
+ verify, retract, tuple0[0], is( h0 );
+ retract:
+ otnRight1, [h2];
+ col1:
+ leftMemory, [[h1]];
+ rightMemory, [h3];
+ sink1:
+ verify, retract, count, 1; // still 1, so no retracts were called
+ verify, modify, count, 2; // still 2, so no modifies were called
+ retract:
+ otnLeft1, [h1];
+ sink1:
+ verify, retract, count, 2;
+ retract:
+ otnRight1, [h3];
+ col1:
+ leftMemory, [];
+ rightMemory, [];
+
+
Deleted: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeAssertRetractTest.data
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeAssertRetractTest.data 2010-01-29 18:54:52 UTC (rev 31326)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeAssertRetractTest.data 2010-01-29 21:36:16 UTC (rev 31327)
@@ -1,157 +0,0 @@
-TestCase "Exists node assert/retract test case"
-
-Setup
- ObjectTypeNode:
- otnLeft1, org.drools.Person;
- LeftInputAdapterNode:
- lian1, otnLeft1;
- ObjectTypeNode:
- otnRight1, org.drools.Person;
- ObjectTypeNode:
- otnRight2, org.drools.Person;
- Binding:
- p1, 0, org.drools.Person, age;
- ExistsNode:
- exists1, lian1, otnRight1;
- age, !=, p1;
- JoinNode:
- join2, exists1, otnRight2;
- age, !=, p1;
- Facts:
- new org.drools.Person('darth', 35), new org.drools.Person('bobba', 35),
- new org.drools.Person('yoda', 35), new org.drools.Person('luke', 35),
- new org.drools.Person('dave', 35), new org.drools.Person('bob', 36),
- new org.drools.Person('obi', 36), new org.drools.Person('han', 37);
-
-Test "Exists node assert/retract test"
- /**
- * check single left assertion and retraction
- */
- assert:
- otnLeft1, [h0];
- exists1:
- leftMemory, [[h0]];
- join2:
- leftMemory, [];
- retract:
- otnLeft1, [h0];
- exists1:
- leftMemory, [];
- join2:
- leftMemory, [];
-
- /**
- * check single right assertion and retraction
- */
- assert:
- otnRight1, [h1];
- exists1:
- rightMemory, [h1];
- join2:
- leftMemory, [];
- retract:
- otnRight1, [h1];
- exists1:
- rightMemory, [];
-
- /**
- * check single left then right assertion, where age != age (matches)
- */
- assert:
- otnLeft1, [h0];
- exists1:
- leftMemory, [[h0]];
- rightMemory, [];
- join2:
- leftMemory, [];
- assert:
- otnRight1, [h5]; // h5 is not equal, so it blocks, and thus h0 is propagated to join2
- exists1:
- leftMemory, [];
- rightMemory, [h5];
- join2:
- leftMemory, [[h0]];
- retract:
- otnRight1, [h5]; // nothing blocks h0, so it's removed from join2
- join2:
- leftMemory, [];
- retract:
- otnLeft1, [h0];
- exists1:
- leftMemory, [];
- rightMemory, [];
- join2:
- leftMemory, [];
-
-
- /**
- * check single right then left assertion, where age != age (matches)
- */
- assert:
- otnRight1, [h5];
- exists1:
- leftMemory, [];
- rightMemory, [h5];
- join2:
- leftMemory, [];
- assert:
- otnLeft1, [h0];
- exists1:
- leftMemory, []; // although it's inserted, you can't see it in the memory as h5 blocks it
- rightMemory, [h5];
- join2:
- leftMemory, [[h0]];
- retract:
- otnRight1, [h5];
- exists1:
- leftMemory, [[h0]]; // h5 no longer blocks, so put back in
- rightMemory, [];
- join2:
- leftMemory, [];
- retract:
- otnLeft1, [h0];
- exists1:
- leftMemory, [];
- rightMemory, [];
- join2:
- leftMemory, [];
-
-
- /**
- * assert two left and two right, with iterative retract and assert, age != age (not matches)
- */
- assert:
- otnLeft1, [h0, h1];
- exists1:
- leftMemory, [[h0], [h1]];
- rightMemory, [];
- join2:
- leftMemory, [];
- assert:
- otnRight1, [h5];
- exists1:
- leftMemory, []; //h0 and h1 are blocked, by h5, so removed
- rightMemory, [h5, h6];
- join2:
- leftMemory, [[h0], [h1]];
- assert:
- otnRight1, [h6];
- exists1:
- leftMemory, []; //h0 and h1 are still blocked
- rightMemory, [h5, h6];
- join2:
- leftMemory, [[h0], [h1]];
- retract:
- otnRight1, [h5]; // retract h5, the facts should still be blocked now by h6
- exists1:
- leftMemory, []; //h0 and h1 are still blocked
- rightMemory, [h6];
- join2:
- leftMemory, [[h0], [h1]];
- retract:
- otnRight1, [h6]; // now there are no blockers
- exists1:
- leftMemory, [[h0], [h1]]; // both facts go back in
- rightMemory, [];
- join2:
- leftMemory, []; // both facts propagate
\ No newline at end of file
Copied: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeAssertRetractTest.nodeTestCase (from rev 31154, labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeAssertRetractTest.data)
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeAssertRetractTest.nodeTestCase (rev 0)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeAssertRetractTest.nodeTestCase 2010-01-29 21:36:16 UTC (rev 31327)
@@ -0,0 +1,157 @@
+TestCase "Exists node assert/retract test case"
+
+Setup
+ ObjectTypeNode:
+ otnLeft1, org.drools.Person;
+ LeftInputAdapterNode:
+ lian1, otnLeft1;
+ ObjectTypeNode:
+ otnRight1, org.drools.Person;
+ ObjectTypeNode:
+ otnRight2, org.drools.Person;
+ Binding:
+ p1, 0, org.drools.Person, age;
+ ExistsNode:
+ exists1, lian1, otnRight1;
+ age, !=, p1;
+ JoinNode:
+ join2, exists1, otnRight2;
+ age, !=, p1;
+ Facts:
+ new org.drools.Person('darth', 35), new org.drools.Person('bobba', 35),
+ new org.drools.Person('yoda', 35), new org.drools.Person('luke', 35),
+ new org.drools.Person('dave', 35), new org.drools.Person('bob', 36),
+ new org.drools.Person('obi', 36), new org.drools.Person('han', 37);
+
+Test "Exists node assert/retract test"
+ /**
+ * check single left assertion and retraction
+ */
+ assert:
+ otnLeft1, [h0];
+ exists1:
+ leftMemory, [[h0]];
+ join2:
+ leftMemory, [];
+ retract:
+ otnLeft1, [h0];
+ exists1:
+ leftMemory, [];
+ join2:
+ leftMemory, [];
+
+ /**
+ * check single right assertion and retraction
+ */
+ assert:
+ otnRight1, [h1];
+ exists1:
+ rightMemory, [h1];
+ join2:
+ leftMemory, [];
+ retract:
+ otnRight1, [h1];
+ exists1:
+ rightMemory, [];
+
+ /**
+ * check single left then right assertion, where age != age (matches)
+ */
+ assert:
+ otnLeft1, [h0];
+ exists1:
+ leftMemory, [[h0]];
+ rightMemory, [];
+ join2:
+ leftMemory, [];
+ assert:
+ otnRight1, [h5]; // h5 is not equal, so it blocks, and thus h0 is propagated to join2
+ exists1:
+ leftMemory, [];
+ rightMemory, [h5];
+ join2:
+ leftMemory, [[h0]];
+ retract:
+ otnRight1, [h5]; // nothing blocks h0, so it's removed from join2
+ join2:
+ leftMemory, [];
+ retract:
+ otnLeft1, [h0];
+ exists1:
+ leftMemory, [];
+ rightMemory, [];
+ join2:
+ leftMemory, [];
+
+
+ /**
+ * check single right then left assertion, where age != age (matches)
+ */
+ assert:
+ otnRight1, [h5];
+ exists1:
+ leftMemory, [];
+ rightMemory, [h5];
+ join2:
+ leftMemory, [];
+ assert:
+ otnLeft1, [h0];
+ exists1:
+ leftMemory, []; // although it's inserted, you can't see it in the memory as h5 blocks it
+ rightMemory, [h5];
+ join2:
+ leftMemory, [[h0]];
+ retract:
+ otnRight1, [h5];
+ exists1:
+ leftMemory, [[h0]]; // h5 no longer blocks, so put back in
+ rightMemory, [];
+ join2:
+ leftMemory, [];
+ retract:
+ otnLeft1, [h0];
+ exists1:
+ leftMemory, [];
+ rightMemory, [];
+ join2:
+ leftMemory, [];
+
+
+ /**
+ * assert two left and two right, with iterative retract and assert, age != age (not matches)
+ */
+ assert:
+ otnLeft1, [h0, h1];
+ exists1:
+ leftMemory, [[h0], [h1]];
+ rightMemory, [];
+ join2:
+ leftMemory, [];
+ assert:
+ otnRight1, [h5];
+ exists1:
+ leftMemory, []; //h0 and h1 are blocked, by h5, so removed
+ rightMemory, [h5, h6];
+ join2:
+ leftMemory, [[h0], [h1]];
+ assert:
+ otnRight1, [h6];
+ exists1:
+ leftMemory, []; //h0 and h1 are still blocked
+ rightMemory, [h5, h6];
+ join2:
+ leftMemory, [[h0], [h1]];
+ retract:
+ otnRight1, [h5]; // retract h5, the facts should still be blocked now by h6
+ exists1:
+ leftMemory, []; //h0 and h1 are still blocked
+ rightMemory, [h6];
+ join2:
+ leftMemory, [[h0], [h1]];
+ retract:
+ otnRight1, [h6]; // now there are no blockers
+ exists1:
+ leftMemory, [[h0], [h1]]; // both facts go back in
+ rightMemory, [];
+ join2:
+ leftMemory, []; // both facts propagate
\ No newline at end of file
Deleted: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeIndexTest.data
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeIndexTest.data 2010-01-29 18:54:52 UTC (rev 31326)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeIndexTest.data 2010-01-29 21:36:16 UTC (rev 31327)
@@ -1,142 +0,0 @@
-TestCase "Exists node index test case"
-
-Setup
- ObjectTypeNode:
- otnLeft1, org.drools.Person;
- LeftInputAdapterNode:
- lian1, otnLeft1;
- ObjectTypeNode:
- otnRight1, org.drools.Person;
- ObjectTypeNode:
- otnRight2, org.drools.Person;
- Binding:
- p1, 0, org.drools.Person, age;
- ExistsNode:
- not1, lian1, otnRight1;
- age, ==, p1;
- JoinNode:
- join2, not1, otnRight2;
- age, ==, p1;
- Facts:
- new org.drools.Person('darth', 35), new org.drools.Person('bobba', 35),
- new org.drools.Person('yoda', 35), new org.drools.Person('luke', 35),
- new org.drools.Person('dave', 35), new org.drools.Person('bob', 36),
- new org.drools.Person('obi', 36), new org.drools.Person('han', 37);
-
-Test "Exists node index test"
- /**
- * check single left then right assertion, initially not matched, the toggle matched and unmatched
- */
- assert:
- otnLeft1, [h0];
- not1:
- leftMemory, [[h0]];
- rightMemory, [];
- join2:
- leftMemory, [];
- assert:
- otnRight1, [h6];
- not1:
- leftMemory, [[h0]];
- rightMemory, [h6];
- join2:
- leftMemory, [];
- With:
- h6, age = 35;
- modify:
- otnRight1, [h6];
- not1:
- leftMemory, []; // h0 is removed from here, as it's blocked
- rightMemory, [h6];
- join2:
- leftMemory, [[h0]];
- With:
- h6, age = 36;
- modify:
- otnRight1, [h6];
- not1:
- leftMemory, [[h0]]; // h0 is back again, as it's no longer blocked
- rightMemory, [h6];
- join2:
- leftMemory, [];
- retract:
- otnLeft1, [h0];
- otnRight1, [h6];
-
-
-
- /**
- * check two left, two right, initially not matched, toggle various matches.
- */
- assert:
- otnRight1, [h6];
- otnLeft1, [h0, h1];
- not1:
- leftMemory, [[h0], [h1]];
- rightMemory, [h6];
- join2:
- leftMemory, [];
- assert:
- otnRight1, [h7];
- With:
- h6, age = 35;
- h7, age = 35;
- modify:
- otnRight1, [h6]; // h6 now blocks h0 and h1
- not1:
- leftMemory, [];
- join2:
- leftMemory, [[h0], [h1]];
- modify:
- otnRight1, [h7]; // now h6 and h7 block, although due to lazy only h6 blocks at the moment
- not1:
- leftMemory, [];
- join2:
- leftMemory, [[h0], [h1]];
- With:
- h1, age = 34 ;
- modify:
- otnLeft1, [h1];
- not1:
- leftMemory, [[h1]];
- join2:
- leftMemory, [[h0]];
- With:
- h6, age = 34;
- h7, age = 36;
- modify:
- otnRight1, [h6, h7]; // h6 now blocks h1, h0 is no longer blocked
- not1:
- leftMemory, [[h0]];
- join2:
- leftMemory, [[h1]];
- retract:
- otnLeft1, [h1];
- With:
- h0, age = 34 ;
- modify:
- otnLeft1, [h0]; // h0 should now be blocked by h6
- not1:
- leftMemory, [];
- join2:
- leftMemory, [[h0]];
- With:
- h0, age = 35;
- h1, age = 35;
- retract:
- otnLeft1, [h0, h1];
- otnRight1, [h6, h7];
-
- /**
- * Test Blocking two, in index, with modify but no index change
- */
- assert:
- otnRight1, [h3];
- otnLeft1, [h0, h1];
- not1:
- leftMemory, [];
- rightMemory, [h3];
- join2:
- leftMemory, [[h0], [h1]];
- modify:
- otnRight1, [h3];
\ No newline at end of file
Copied: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeIndexTest.nodeTestCase (from rev 31154, labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeIndexTest.data)
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeIndexTest.nodeTestCase (rev 0)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeIndexTest.nodeTestCase 2010-01-29 21:36:16 UTC (rev 31327)
@@ -0,0 +1,142 @@
+TestCase "Exists node index test case"
+
+Setup
+ ObjectTypeNode:
+ otnLeft1, org.drools.Person;
+ LeftInputAdapterNode:
+ lian1, otnLeft1;
+ ObjectTypeNode:
+ otnRight1, org.drools.Person;
+ ObjectTypeNode:
+ otnRight2, org.drools.Person;
+ Binding:
+ p1, 0, org.drools.Person, age;
+ ExistsNode:
+ not1, lian1, otnRight1;
+ age, ==, p1;
+ JoinNode:
+ join2, not1, otnRight2;
+ age, ==, p1;
+ Facts:
+ new org.drools.Person('darth', 35), new org.drools.Person('bobba', 35),
+ new org.drools.Person('yoda', 35), new org.drools.Person('luke', 35),
+ new org.drools.Person('dave', 35), new org.drools.Person('bob', 36),
+ new org.drools.Person('obi', 36), new org.drools.Person('han', 37);
+
+Test "Exists node index test"
+ /**
+ * check single left then right assertion, initially not matched, the toggle matched and unmatched
+ */
+ assert:
+ otnLeft1, [h0];
+ not1:
+ leftMemory, [[h0]];
+ rightMemory, [];
+ join2:
+ leftMemory, [];
+ assert:
+ otnRight1, [h6];
+ not1:
+ leftMemory, [[h0]];
+ rightMemory, [h6];
+ join2:
+ leftMemory, [];
+ With:
+ h6, age = 35;
+ modify:
+ otnRight1, [h6];
+ not1:
+ leftMemory, []; // h0 is removed from here, as it's blocked
+ rightMemory, [h6];
+ join2:
+ leftMemory, [[h0]];
+ With:
+ h6, age = 36;
+ modify:
+ otnRight1, [h6];
+ not1:
+ leftMemory, [[h0]]; // h0 is back again, as it's no longer blocked
+ rightMemory, [h6];
+ join2:
+ leftMemory, [];
+ retract:
+ otnLeft1, [h0];
+ otnRight1, [h6];
+
+
+
+ /**
+ * check two left, two right, initially not matched, toggle various matches.
+ */
+ assert:
+ otnRight1, [h6];
+ otnLeft1, [h0, h1];
+ not1:
+ leftMemory, [[h0], [h1]];
+ rightMemory, [h6];
+ join2:
+ leftMemory, [];
+ assert:
+ otnRight1, [h7];
+ With:
+ h6, age = 35;
+ h7, age = 35;
+ modify:
+ otnRight1, [h6]; // h6 now blocks h0 and h1
+ not1:
+ leftMemory, [];
+ join2:
+ leftMemory, [[h0], [h1]];
+ modify:
+ otnRight1, [h7]; // now h6 and h7 block, although due to lazy only h6 blocks at the moment
+ not1:
+ leftMemory, [];
+ join2:
+ leftMemory, [[h0], [h1]];
+ With:
+ h1, age = 34 ;
+ modify:
+ otnLeft1, [h1];
+ not1:
+ leftMemory, [[h1]];
+ join2:
+ leftMemory, [[h0]];
+ With:
+ h6, age = 34;
+ h7, age = 36;
+ modify:
+ otnRight1, [h6, h7]; // h6 now blocks h1, h0 is no longer blocked
+ not1:
+ leftMemory, [[h0]];
+ join2:
+ leftMemory, [[h1]];
+ retract:
+ otnLeft1, [h1];
+ With:
+ h0, age = 34 ;
+ modify:
+ otnLeft1, [h0]; // h0 should now be blocked by h6
+ not1:
+ leftMemory, [];
+ join2:
+ leftMemory, [[h0]];
+ With:
+ h0, age = 35;
+ h1, age = 35;
+ retract:
+ otnLeft1, [h0, h1];
+ otnRight1, [h6, h7];
+
+ /**
+ * Test Blocking two, in index, with modify but no index change
+ */
+ assert:
+ otnRight1, [h3];
+ otnLeft1, [h0, h1];
+ not1:
+ leftMemory, [];
+ rightMemory, [h3];
+ join2:
+ leftMemory, [[h0], [h1]];
+ modify:
+ otnRight1, [h3];
\ No newline at end of file
Deleted: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeModifyTest.data
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeModifyTest.data 2010-01-29 18:54:52 UTC (rev 31326)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeModifyTest.data 2010-01-29 21:36:16 UTC (rev 31327)
@@ -1,120 +0,0 @@
-TestCase "Exists node modify test case"
-
-Setup
- ObjectTypeNode:
- otnLeft1, org.drools.Person;
- LeftInputAdapterNode:
- lian1, otnLeft1;
- ObjectTypeNode:
- otnRight1, org.drools.Person;
- ObjectTypeNode:
- otnRight2, org.drools.Person;
- Binding:
- p1, 0, org.drools.Person, age;
- ExistsNode:
- not1, lian1, otnRight1;
- age, !=, p1;
- JoinNode:
- join2, not1, otnRight2;
- age, !=, p1;
- Facts:
- new org.drools.Person('darth', 35), new org.drools.Person('bobba', 35),
- new org.drools.Person('yoda', 35), new org.drools.Person('luke', 35),
- new org.drools.Person('dave', 35), new org.drools.Person('bob', 36),
- new org.drools.Person('obi', 36), new org.drools.Person('han', 37);
-
-Test "Exists node modify test"
- /**
- * check single left then right assertion, initially not matched, the toggle matched and unmatched
- */
- assert:
- otnLeft1, [h0];
- not1:
- leftMemory, [[h0]];
- rightMemory, [];
- join2:
- leftMemory, [];
- assert:
- otnRight1, [h1];
- not1:
- leftMemory, [[h0]];
- rightMemory, [h1];
- join2:
- leftMemory, [];
- With:
- h1, age = 36;
- modify:
- otnRight1, [h1];
- not1:
- leftMemory, []; // h0 is removed from here, as it's blocked
- rightMemory, [h1];
- join2:
- leftMemory, [[h0]];
- With:
- h1, age = 35;
- modify:
- otnRight1, [h1];
- not1:
- leftMemory, [[h0]]; // h0 is back again, as it's no longer blocked
- rightMemory, [h1];
- join2:
- leftMemory, [];
- retract:
- otnLeft1, [h0];
- otnRight1, [h1];
-
-
- /**
- * check two left, two right
- */
- assert:
- otnRight1, [h6];
- assert:
- otnLeft1, [h0, h1];
- not1:
- leftMemory, []; // memory is empty as h0 and h1 are blocked
- join2:
- leftMemory, [[h0], [h1]];
- assert:
- otnRight1, [h7];
- With:
- h6, age = 35;
- modify:
- otnRight1, [h6]; // h7 still blocks h0 and h1
- not1:
- leftMemory, [];
- join2:
- leftMemory, [[h0], [h1]];
- With:
- h7, age = 35 ;
- modify:
- otnRight1, [h7]; // h0 and h1 should now be unblocked
- not1:
- leftMemory, [[h0], [h1]]; // h0 and h1 appear back in memory
- join2:
- leftMemory, [];
- With:
- h6, age = 36;
- modify:
- otnRight1, [h6];
- not1:
- leftMemory, []; // h6 blocks both
- join2:
- leftMemory, [[h0], [h1]];
- With:
- h0, age = 36;
- modify:
- otnLeft1, [h0]; // h0 is now blocked by h7, while h1 remains blocked by h6
- not1:
- leftMemory, []; // remains empty
- join2:
- leftMemory, [[h1], [h0]]; // the child order was reversed, because h0 was the last one modified
- With:
- h0, age = 36;
- h7, age = 36;
- modify:
- otnLeft1, [h0]; // h0 is no longer blocked
- not1:
- leftMemory, [[h0]];
- join2:
- leftMemory, [[h1]];
\ No newline at end of file
Copied: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeModifyTest.nodeTestCase (from rev 31154, labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeModifyTest.data)
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeModifyTest.nodeTestCase (rev 0)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ExistsNodeModifyTest.nodeTestCase 2010-01-29 21:36:16 UTC (rev 31327)
@@ -0,0 +1,120 @@
+TestCase "Exists node modify test case"
+
+Setup
+ ObjectTypeNode:
+ otnLeft1, org.drools.Person;
+ LeftInputAdapterNode:
+ lian1, otnLeft1;
+ ObjectTypeNode:
+ otnRight1, org.drools.Person;
+ ObjectTypeNode:
+ otnRight2, org.drools.Person;
+ Binding:
+ p1, 0, org.drools.Person, age;
+ ExistsNode:
+ not1, lian1, otnRight1;
+ age, !=, p1;
+ JoinNode:
+ join2, not1, otnRight2;
+ age, !=, p1;
+ Facts:
+ new org.drools.Person('darth', 35), new org.drools.Person('bobba', 35),
+ new org.drools.Person('yoda', 35), new org.drools.Person('luke', 35),
+ new org.drools.Person('dave', 35), new org.drools.Person('bob', 36),
+ new org.drools.Person('obi', 36), new org.drools.Person('han', 37);
+
+Test "Exists node modify test"
+ /**
+ * check single left then right assertion, initially not matched, the toggle matched and unmatched
+ */
+ assert:
+ otnLeft1, [h0];
+ not1:
+ leftMemory, [[h0]];
+ rightMemory, [];
+ join2:
+ leftMemory, [];
+ assert:
+ otnRight1, [h1];
+ not1:
+ leftMemory, [[h0]];
+ rightMemory, [h1];
+ join2:
+ leftMemory, [];
+ With:
+ h1, age = 36;
+ modify:
+ otnRight1, [h1];
+ not1:
+ leftMemory, []; // h0 is removed from here, as it's blocked
+ rightMemory, [h1];
+ join2:
+ leftMemory, [[h0]];
+ With:
+ h1, age = 35;
+ modify:
+ otnRight1, [h1];
+ not1:
+ leftMemory, [[h0]]; // h0 is back again, as it's no longer blocked
+ rightMemory, [h1];
+ join2:
+ leftMemory, [];
+ retract:
+ otnLeft1, [h0];
+ otnRight1, [h1];
+
+
+ /**
+ * check two left, two right
+ */
+ assert:
+ otnRight1, [h6];
+ assert:
+ otnLeft1, [h0, h1];
+ not1:
+ leftMemory, []; // memory is empty as h0 and h1 are blocked
+ join2:
+ leftMemory, [[h0], [h1]];
+ assert:
+ otnRight1, [h7];
+ With:
+ h6, age = 35;
+ modify:
+ otnRight1, [h6]; // h7 still blocks h0 and h1
+ not1:
+ leftMemory, [];
+ join2:
+ leftMemory, [[h0], [h1]];
+ With:
+ h7, age = 35 ;
+ modify:
+ otnRight1, [h7]; // h0 and h1 should now be unblocked
+ not1:
+ leftMemory, [[h0], [h1]]; // h0 and h1 appear back in memory
+ join2:
+ leftMemory, [];
+ With:
+ h6, age = 36;
+ modify:
+ otnRight1, [h6];
+ not1:
+ leftMemory, []; // h6 blocks both
+ join2:
+ leftMemory, [[h0], [h1]];
+ With:
+ h0, age = 36;
+ modify:
+ otnLeft1, [h0]; // h0 is now blocked by h7, while h1 remains blocked by h6
+ not1:
+ leftMemory, []; // remains empty
+ join2:
+ leftMemory, [[h1], [h0]]; // the child order was reversed, because h0 was the last one modified
+ With:
+ h0, age = 36;
+ h7, age = 36;
+ modify:
+ otnLeft1, [h0]; // h0 is no longer blocked
+ not1:
+ leftMemory, [[h0]];
+ join2:
+ leftMemory, [[h1]];
\ No newline at end of file
Deleted: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ForallNodeAssertRetractTest.data
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ForallNodeAssertRetractTest.data 2010-01-29 18:54:52 UTC (rev 31326)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ForallNodeAssertRetractTest.data 2010-01-29 21:36:16 UTC (rev 31327)
@@ -1,223 +0,0 @@
-ObjectTypeNode
- otnLeft1, org.drools.Person
-LeftInputAdapterNode
- lian1, otnLeft1
-ObjectTypeNode
- otnRight1, org.drools.Bus
-ObjectTypeNode
- otnRight2, org.drools.Person
-Binding
- p1, 0, org.drools.Person, city
-ForAllNode
- forall1, lian1,
-
- not1, , otnRight1
- age, !=, p1
-JoinNode
- join2, not1, otnRight2
- age, ==,
-Facts
- new org.drools.Person('darth', 35), new org.drools.Person('bobba', 35)
- new org.drools.Person('yoda', 35), new org.drools.Person('luke', 35)
- new org.drools.Person('dave', 35), new org.drools.Person('bob', 36)
- new org.drools.Person('obi', 36), new org.drools.Person('han', 37)
-
- // Person( $state ) forall( Bus(
-/**
- * check single left assertion and retraction
- */
-assert
- otnLeft1 [h0]
-not1
- leftMemory [[h0]]
-join2
- leftMemory [[h0]]
-retract
- otnLeft1 [h0]
-not1
- leftMemory []
-join2
- leftMemory []
-
-/**
- * check single right assertion and retraction
- */
-assert
- otnRight1 [h1]
-not1
- rightMemory [h1]
-join2
- leftMemory []
-retract
- otnRight1 [h1]
-not1
- rightMemory []
-
-/**
- * check single left then right assertion, where age == age (does not match not)
- */
-assert
- otnLeft1 [h0]
-not1
- leftMemory [[h0]]
- rightMemory []
-join2
- leftMemory [[h0]]
-assert
- otnRight1 [h1]
-not1
- leftMemory [[h0]]
- rightMemory [h1]
-join2
- leftMemory [[h0]]
-retract
- otnRight1 [h1]
- otnRight1 []
-join2
- leftMemory [[h0]]
-retract
- otnLeft1 [h0]
-not1
- leftMemory []
- rightMemory []
-join2
- leftMemory []
-
-/**
- * check single left then right assertion, where age != age (matches not)
- */
-assert
- otnLeft1 [h0]
-not1
- leftMemory [[h0]] // h0 is here, it'll disapear soon....
- rightMemory []
-join2
- leftMemory [[h0]]
-assert
- otnRight1 [h5]
-not1
- leftMemory [] // h0 disappears as h5 blocks it, and removes it from memory
- rightMemory [h5]
-join2
- leftMemory []
-retract
- otnRight1 [h5]
-not1
- leftMemory [[h0]] // h0 is put back in, as h5 no longer blocks
- rightMemory []
-join2
- leftMemory [[h0]]
-retract
- otnLeft1 [h0]
-not1
- leftMemory []
- rightMemory []
-join2
- leftMemory []
-
-
-/**
- * check single right then left assertion, where age != age (matches not)
- */
-assert
- otnRight1 [h5]
-not1
- leftMemory []
- rightMemory [h5]
-join2
- leftMemory []
-assert
- otnLeft1 [h0]
-not1
- leftMemory [] // although it's inserted, you can't see it in the memory as h5 blocks it
- rightMemory [h5]
-join2
- leftMemory []
-retract
- otnRight1 [h5]
-not1
- leftMemory [[h0]] // h5 no longer blocks, so put back in
- rightMemory []
-join2
- leftMemory [[h0]]
-retract
- otnLeft1 [h0]
-not1
- leftMemory []
- rightMemory []
-join2
- leftMemory []
-
-/**
- * check single right then left assertion, where age == age (does not match not)
- */
-assert
- otnRight1 [h1]
-not1
- leftMemory []
- rightMemory [h1]
-join2
- leftMemory []
-assert
- otnLeft1 [h0]
-not1
- leftMemory [[h0]]
- rightMemory [h1]
-join2
- leftMemory [[h0]]
-retract
- otnRight1 [h1]
-not1
- leftMemory [[h0]]
- rightMemory []
-join2
- leftMemory [[h0]]
-retract
- otnLeft1 [h0]
-not1
- leftMemory []
- rightMemory []
-join2
- leftMemory []
-
-// here
-
-
-/**
- * assert two left and two right, with iterative retract and assert, age != age (not matches)
- */
-assert
- otnLeft1 [h0, h1]
-not1
- leftMemory [[h0], [h1]]
- rightMemory []
-join2
- leftMemory [[h0], [h1]]
-assert
- otnRight1 [h5]
-not1
- leftMemory [] //h0 and h1 are blocked, by h5, so removed
- rightMemory [h5, h6]
-join2
- leftMemory []
-assert
- otnRight1 [h6]
-not1
- leftMemory [] //h0 and h1 are still blocked
- rightMemory [h5, h6]
-join2
- leftMemory []
-retract
- otnRight1 [h5] // retract h5, the facts should still be blocked now by h6
-not1
- leftMemory [] //h0 and h1 are still blocked
- rightMemory [h6]
-join2
- leftMemory []
-retract
- otnRight1 [h6] // now there are no blockers
-not1
- leftMemory [[h0], [h1]] // both facts go back in
- rightMemory []
-join2
- leftMemory [[h0], [h1]] // both facts propagate
\ No newline at end of file
Added: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ForallNodeAssertRetractTest.data
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ForallNodeAssertRetractTest.data (rev 0)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/ForallNodeAssertRetractTest.data 2010-01-29 21:36:16 UTC (rev 31327)
@@ -0,0 +1,223 @@
+ObjectTypeNode
+ otnLeft1, org.drools.Person
+LeftInputAdapterNode
+ lian1, otnLeft1
+ObjectTypeNode
+ otnRight1, org.drools.Bus
+ObjectTypeNode
+ otnRight2, org.drools.Person
+Binding
+ p1, 0, org.drools.Person, city
+ForAllNode
+ forall1, lian1,
+
+ not1, , otnRight1
+ age, !=, p1
+JoinNode
+ join2, not1, otnRight2
+ age, ==,
+Facts
+ new org.drools.Person('darth', 35), new org.drools.Person('bobba', 35)
+ new org.drools.Person('yoda', 35), new org.drools.Person('luke', 35)
+ new org.drools.Person('dave', 35), new org.drools.Person('bob', 36)
+ new org.drools.Person('obi', 36), new org.drools.Person('han', 37)
+
+ // Person( $state ) forall( Bus(
+/**
+ * check single left assertion and retraction
+ */
+assert
+ otnLeft1 [h0]
+not1
+ leftMemory [[h0]]
+join2
+ leftMemory [[h0]]
+retract
+ otnLeft1 [h0]
+not1
+ leftMemory []
+join2
+ leftMemory []
+
+/**
+ * check single right assertion and retraction
+ */
+assert
+ otnRight1 [h1]
+not1
+ rightMemory [h1]
+join2
+ leftMemory []
+retract
+ otnRight1 [h1]
+not1
+ rightMemory []
+
+/**
+ * check single left then right assertion, where age == age (does not match not)
+ */
+assert
+ otnLeft1 [h0]
+not1
+ leftMemory [[h0]]
+ rightMemory []
+join2
+ leftMemory [[h0]]
+assert
+ otnRight1 [h1]
+not1
+ leftMemory [[h0]]
+ rightMemory [h1]
+join2
+ leftMemory [[h0]]
+retract
+ otnRight1 [h1]
+ otnRight1 []
+join2
+ leftMemory [[h0]]
+retract
+ otnLeft1 [h0]
+not1
+ leftMemory []
+ rightMemory []
+join2
+ leftMemory []
+
+/**
+ * check single left then right assertion, where age != age (matches not)
+ */
+assert
+ otnLeft1 [h0]
+not1
+ leftMemory [[h0]] // h0 is here, it'll disapear soon....
+ rightMemory []
+join2
+ leftMemory [[h0]]
+assert
+ otnRight1 [h5]
+not1
+ leftMemory [] // h0 disappears as h5 blocks it, and removes it from memory
+ rightMemory [h5]
+join2
+ leftMemory []
+retract
+ otnRight1 [h5]
+not1
+ leftMemory [[h0]] // h0 is put back in, as h5 no longer blocks
+ rightMemory []
+join2
+ leftMemory [[h0]]
+retract
+ otnLeft1 [h0]
+not1
+ leftMemory []
+ rightMemory []
+join2
+ leftMemory []
+
+
+/**
+ * check single right then left assertion, where age != age (matches not)
+ */
+assert
+ otnRight1 [h5]
+not1
+ leftMemory []
+ rightMemory [h5]
+join2
+ leftMemory []
+assert
+ otnLeft1 [h0]
+not1
+ leftMemory [] // although it's inserted, you can't see it in the memory as h5 blocks it
+ rightMemory [h5]
+join2
+ leftMemory []
+retract
+ otnRight1 [h5]
+not1
+ leftMemory [[h0]] // h5 no longer blocks, so put back in
+ rightMemory []
+join2
+ leftMemory [[h0]]
+retract
+ otnLeft1 [h0]
+not1
+ leftMemory []
+ rightMemory []
+join2
+ leftMemory []
+
+/**
+ * check single right then left assertion, where age == age (does not match not)
+ */
+assert
+ otnRight1 [h1]
+not1
+ leftMemory []
+ rightMemory [h1]
+join2
+ leftMemory []
+assert
+ otnLeft1 [h0]
+not1
+ leftMemory [[h0]]
+ rightMemory [h1]
+join2
+ leftMemory [[h0]]
+retract
+ otnRight1 [h1]
+not1
+ leftMemory [[h0]]
+ rightMemory []
+join2
+ leftMemory [[h0]]
+retract
+ otnLeft1 [h0]
+not1
+ leftMemory []
+ rightMemory []
+join2
+ leftMemory []
+
+// here
+
+
+/**
+ * assert two left and two right, with iterative retract and assert, age != age (not matches)
+ */
+assert
+ otnLeft1 [h0, h1]
+not1
+ leftMemory [[h0], [h1]]
+ rightMemory []
+join2
+ leftMemory [[h0], [h1]]
+assert
+ otnRight1 [h5]
+not1
+ leftMemory [] //h0 and h1 are blocked, by h5, so removed
+ rightMemory [h5, h6]
+join2
+ leftMemory []
+assert
+ otnRight1 [h6]
+not1
+ leftMemory [] //h0 and h1 are still blocked
+ rightMemory [h5, h6]
+join2
+ leftMemory []
+retract
+ otnRight1 [h5] // retract h5, the facts should still be blocked now by h6
+not1
+ leftMemory [] //h0 and h1 are still blocked
+ rightMemory [h6]
+join2
+ leftMemory []
+retract
+ otnRight1 [h6] // now there are no blockers
+not1
+ leftMemory [[h0], [h1]] // both facts go back in
+ rightMemory []
+join2
+ leftMemory [[h0], [h1]] // both facts propagate
\ No newline at end of file
Deleted: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeAssertRetractTest.data
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeAssertRetractTest.data 2010-01-29 18:54:52 UTC (rev 31326)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeAssertRetractTest.data 2010-01-29 21:36:16 UTC (rev 31327)
@@ -1,210 +0,0 @@
-TestCase "Join Node assert/retract test case"
-
-Setup
- ObjectTypeNode:
- otnLeft1, org.drools.Person;
- LeftInputAdapterNode:
- lian0, otnLeft1;
- ObjectTypeNode:
- otnRight1, org.drools.Person;
- ObjectTypeNode:
- otnRight2, org.drools.Person;
- Binding:
- p1, 0, org.drools.Person, age;
- JoinNode:
- join1, lian0, otnRight1;
- age, !=, p1;
- JoinNode:
- join2, join1, otnRight2;
- age, !=, p1;
- Facts:
- new org.drools.Person('darth', 35), new org.drools.Person('bobba', 36),
- new org.drools.Person('yoda', 37), new org.drools.Person('luke', 38),
- new org.drools.Person('dave', 33), new org.drools.Person('bob', 32);
-
-Test "Assert/retract test"
- /**
- * check single left assertion and retraction
- */
- assert:
- otnLeft1, [h0];
- join1:
- leftMemory, [[h0]];
- join2:
- leftMemory, [];
- retract:
- otnLeft1, [h0];
- /**
- * check single right assertion and retraction
- */
- assert:
- otnRight1, [h1];
- join1:
- rightMemory, [h1];
- join2:
- leftMemory, [];
- retract:
- otnRight1, [h1];
-
- /**
- * check single left then right assertion
- */
- assert:
- otnLeft1, [h0];
- otnRight1, [h1];
- join1:
- leftMemory, [[h0]];
- rightMemory, [h1];
- join2:
- leftMemory, [[h0, h1]];
- retract:
- otnLeft1, [h0];
- otnRight1, [h1];
-
- /**
- * check single right then left assertion
- */
- assert:
- otnRight1, [h1];
- otnLeft1, [h0];
- join1:
- leftMemory, [[h0]];
- rightMemory, [h1] ;
- join2:
- leftMemory, [[h0, h1]];
- retract:
- otnLeft1, [h0];
- otnRight1, [h1];
-
- /**
- * assert: two left and two right, with incremental first removal
- */
- assert:
- otnLeft1, [h0, h1];
- otnRight1, [h2, h3];
- join1:
- leftMemory, [[h0], [h1]];
- rightMemory, [h2, h3];
- join2:
- leftMemory, [[h0, h2], [h1, h2],
- [h0, h3], [h1, h3]];
- retract:
- otnLeft1, [h0];
- join1:
- leftMemory, [[h1]];
- rightMemory, [h2, h3];
- join2:
- leftMemory, [[h1, h2],
- [h1, h3]];
- retract:
- otnRight1, [h2];
- join1:
- leftMemory, [[h1]];
- rightMemory, [h3];
- join2:
- leftMemory, [[h1, h3]];
- retract:
- otnLeft1, [h1];
- otnRight1, [h3];
- join1:
- leftMemory, [];
- rightMemory, [];
- join2:
- leftMemory, [];
-
- /**
- * assert: two right and two left, with incremental last removal
- */
- assert:
- otnRight1, [h2, h3];
- otnLeft1, [h0, h1];
- join1:
- leftMemory, [[h0], [h1]];
- rightMemory, [h2, h3];
- join2:
- leftMemory, [[h0, h2], [h0, h3],
- [h1, h2], [h1, h3]];
- retract:
- otnLeft1, [h1];
- join1:
- leftMemory, [[h0]];
- rightMemory, [h2, h3];
- join2:
- leftMemory, [[h0, h2], [h0, h3]];
- retract:
- otnRight1, [h3];
- join1:
- leftMemory, [[h0]];
- rightMemory, [h2];
- join2:
- leftMemory, [[h0, h2]];
- retract:
- otnLeft1, [h0];
- otnRight1, [h2];
- join1:
- leftMemory, [];
- rightMemory, [];
- join2:
- leftMemory, [];
-
- /**
- * assert: three left and three right, middle two are removed, and then iterated in reverse order
- */
- assert:
- otnLeft1, [h0, h5, h2];
- otnRight1, [h3, h4, h1];
- join1:
- leftMemory, [[h0], [h5], [h2]];
- rightMemory, [h3, h4, h1];
- join2:
- leftMemory, [[h0, h3], [h5, h3], [h2, h3],
- [h0, h4], [h5, h4], [h2, h4],
- [h0, h1], [h5, h1], [h2, h1]];
- rightMemory, [];
- retract:
- otnLeft1, [h5];
- join1:
- leftMemory, [[h0], [h2]];
- rightMemory, [h3, h4, h1];
- join2:
- leftMemory, [[h0, h3], [h2, h3],
- [h0, h4], [h2, h4],
- [h0, h1], [h2, h1]];
- rightMemory, [];
- retract:
- otnRight1, [h4];
- join1:
- leftMemory, [[h0], [h2]];
- rightMemory, [h3, h1];
- join2:
- leftMemory, [[h0, h3], [h2, h3],
- [h0, h1], [h2, h1]];
- rightMemory, [] ;
- assert:
- otnLeft1, [h5];
- otnRight1, [h4];
- join1:
- leftMemory, [[h0], [h2], [h5]];
- rightMemory, [h3, h1, h4] ;
- join2:
- leftMemory, [[h0, h3], [h2, h3],
- [h0, h1], [h2, h1],
- [h5, h3], [h5, h1],
- [h0, h4], [h2, h4], [h5, h4] ];
- retract:
- otnRight1, [h4];
- join1:
- leftMemory, [[h0], [h2], [h5]];
- rightMemory, [h3, h1];
- join2:
- leftMemory, [[h0, h3], [h2, h3],
- [h0, h1], [h2, h1],
- [h5, h3], [h5, h1] ];
- retract:
- otnLeft1, [h5];
- join1:
- leftMemory, [[h0], [h2]];
- rightMemory, [h3, h1];
- join2:
- leftMemory, [[h0, h3], [h2, h3],
- [h0, h1], [h2, h1]];
\ No newline at end of file
Copied: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeAssertRetractTest.nodeTestCase (from rev 31154, labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeAssertRetractTest.data)
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeAssertRetractTest.nodeTestCase (rev 0)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeAssertRetractTest.nodeTestCase 2010-01-29 21:36:16 UTC (rev 31327)
@@ -0,0 +1,210 @@
+TestCase "Join Node assert/retract test case"
+
+Setup
+ ObjectTypeNode:
+ otnLeft1, org.drools.Person;
+ LeftInputAdapterNode:
+ lian0, otnLeft1;
+ ObjectTypeNode:
+ otnRight1, org.drools.Person;
+ ObjectTypeNode:
+ otnRight2, org.drools.Person;
+ Binding:
+ p1, 0, org.drools.Person, age;
+ JoinNode:
+ join1, lian0, otnRight1;
+ age, !=, p1;
+ JoinNode:
+ join2, join1, otnRight2;
+ age, !=, p1;
+ Facts:
+ new org.drools.Person('darth', 35), new org.drools.Person('bobba', 36),
+ new org.drools.Person('yoda', 37), new org.drools.Person('luke', 38),
+ new org.drools.Person('dave', 33), new org.drools.Person('bob', 32);
+
+Test "Assert/retract test"
+ /**
+ * check single left assertion and retraction
+ */
+ assert:
+ otnLeft1, [h0];
+ join1:
+ leftMemory, [[h0]];
+ join2:
+ leftMemory, [];
+ retract:
+ otnLeft1, [h0];
+ /**
+ * check single right assertion and retraction
+ */
+ assert:
+ otnRight1, [h1];
+ join1:
+ rightMemory, [h1];
+ join2:
+ leftMemory, [];
+ retract:
+ otnRight1, [h1];
+
+ /**
+ * check single left then right assertion
+ */
+ assert:
+ otnLeft1, [h0];
+ otnRight1, [h1];
+ join1:
+ leftMemory, [[h0]];
+ rightMemory, [h1];
+ join2:
+ leftMemory, [[h0, h1]];
+ retract:
+ otnLeft1, [h0];
+ otnRight1, [h1];
+
+ /**
+ * check single right then left assertion
+ */
+ assert:
+ otnRight1, [h1];
+ otnLeft1, [h0];
+ join1:
+ leftMemory, [[h0]];
+ rightMemory, [h1] ;
+ join2:
+ leftMemory, [[h0, h1]];
+ retract:
+ otnLeft1, [h0];
+ otnRight1, [h1];
+
+ /**
+ * assert: two left and two right, with incremental first removal
+ */
+ assert:
+ otnLeft1, [h0, h1];
+ otnRight1, [h2, h3];
+ join1:
+ leftMemory, [[h0], [h1]];
+ rightMemory, [h2, h3];
+ join2:
+ leftMemory, [[h0, h2], [h1, h2],
+ [h0, h3], [h1, h3]];
+ retract:
+ otnLeft1, [h0];
+ join1:
+ leftMemory, [[h1]];
+ rightMemory, [h2, h3];
+ join2:
+ leftMemory, [[h1, h2],
+ [h1, h3]];
+ retract:
+ otnRight1, [h2];
+ join1:
+ leftMemory, [[h1]];
+ rightMemory, [h3];
+ join2:
+ leftMemory, [[h1, h3]];
+ retract:
+ otnLeft1, [h1];
+ otnRight1, [h3];
+ join1:
+ leftMemory, [];
+ rightMemory, [];
+ join2:
+ leftMemory, [];
+
+ /**
+ * assert: two right and two left, with incremental last removal
+ */
+ assert:
+ otnRight1, [h2, h3];
+ otnLeft1, [h0, h1];
+ join1:
+ leftMemory, [[h0], [h1]];
+ rightMemory, [h2, h3];
+ join2:
+ leftMemory, [[h0, h2], [h0, h3],
+ [h1, h2], [h1, h3]];
+ retract:
+ otnLeft1, [h1];
+ join1:
+ leftMemory, [[h0]];
+ rightMemory, [h2, h3];
+ join2:
+ leftMemory, [[h0, h2], [h0, h3]];
+ retract:
+ otnRight1, [h3];
+ join1:
+ leftMemory, [[h0]];
+ rightMemory, [h2];
+ join2:
+ leftMemory, [[h0, h2]];
+ retract:
+ otnLeft1, [h0];
+ otnRight1, [h2];
+ join1:
+ leftMemory, [];
+ rightMemory, [];
+ join2:
+ leftMemory, [];
+
+ /**
+ * assert: three left and three right, middle two are removed, and then iterated in reverse order
+ */
+ assert:
+ otnLeft1, [h0, h5, h2];
+ otnRight1, [h3, h4, h1];
+ join1:
+ leftMemory, [[h0], [h5], [h2]];
+ rightMemory, [h3, h4, h1];
+ join2:
+ leftMemory, [[h0, h3], [h5, h3], [h2, h3],
+ [h0, h4], [h5, h4], [h2, h4],
+ [h0, h1], [h5, h1], [h2, h1]];
+ rightMemory, [];
+ retract:
+ otnLeft1, [h5];
+ join1:
+ leftMemory, [[h0], [h2]];
+ rightMemory, [h3, h4, h1];
+ join2:
+ leftMemory, [[h0, h3], [h2, h3],
+ [h0, h4], [h2, h4],
+ [h0, h1], [h2, h1]];
+ rightMemory, [];
+ retract:
+ otnRight1, [h4];
+ join1:
+ leftMemory, [[h0], [h2]];
+ rightMemory, [h3, h1];
+ join2:
+ leftMemory, [[h0, h3], [h2, h3],
+ [h0, h1], [h2, h1]];
+ rightMemory, [] ;
+ assert:
+ otnLeft1, [h5];
+ otnRight1, [h4];
+ join1:
+ leftMemory, [[h0], [h2], [h5]];
+ rightMemory, [h3, h1, h4] ;
+ join2:
+ leftMemory, [[h0, h3], [h2, h3],
+ [h0, h1], [h2, h1],
+ [h5, h3], [h5, h1],
+ [h0, h4], [h2, h4], [h5, h4] ];
+ retract:
+ otnRight1, [h4];
+ join1:
+ leftMemory, [[h0], [h2], [h5]];
+ rightMemory, [h3, h1];
+ join2:
+ leftMemory, [[h0, h3], [h2, h3],
+ [h0, h1], [h2, h1],
+ [h5, h3], [h5, h1] ];
+ retract:
+ otnLeft1, [h5];
+ join1:
+ leftMemory, [[h0], [h2]];
+ rightMemory, [h3, h1];
+ join2:
+ leftMemory, [[h0, h3], [h2, h3],
+ [h0, h1], [h2, h1]];
\ No newline at end of file
Deleted: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeIndexTest.data
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeIndexTest.data 2010-01-29 18:54:52 UTC (rev 31326)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeIndexTest.data 2010-01-29 21:36:16 UTC (rev 31327)
@@ -1,89 +0,0 @@
-TestCase "Join Node modify test case"
-
-Setup
- ObjectTypeNode:
- otnLeft1, org.drools.Person;
- LeftInputAdapterNode:
- lian0, otnLeft1;
- ObjectTypeNode:
- otnRight1, org.drools.Person;
- ObjectTypeNode:
- otnRight2, org.drools.Person;
- Binding:
- p1, 0, org.drools.Person, age;
- JoinNode:
- join1, lian0, otnRight1;
- age, ==, p1;
- JoinNode:
- join2, join1, otnRight2;
- age, ==, p1;
- Facts:
- new org.drools.Person('darth', 34), new org.drools.Person('bobba', 34),
- new org.drools.Person('yoda', 34), new org.drools.Person('luke', 34),
- new org.drools.Person('dave', 34), new org.drools.Person('bob', 34);
-
-Test "Node Index Test"
- /**
- * insert all and the modify for variation combinations, checking the index buckets are obeyed
- */
- assert:
- otnLeft1, [h0, h1, h2];
- otnRight1, [h3, h4, h5];
- join1:
- leftMemory, [[h0], [h1], [h2]];
- rightMemory, [h3, h4, h5];
- join2:
- leftMemory, [[h0, h3], [h1, h3], [h2, h3],
- [h0, h4], [h1, h4], [h2, h4],
- [h0, h5], [h1, h5], [h2, h5]];
-
- With:
- h1, age = 35;
- modify:
- otnLeft1, [h1];
- join1:
- leftMemory, [[h0], [h2] ];
- leftMemory, [[h1]]; // h1 has now moved to it's own bucket
- rightMemory, [h3, h4, h5];
- join2:
- leftMemory, [[h0, h3], [h2, h3],
- [h0, h4], [h2, h4],
- [h0, h5], [h2, h5] ];
- With:
- h5, age = 36;
- modify:
- otnRight1, [h5];
- join1:
- leftMemory, [[h0], [h2] ];
- leftMemory, [[h1]]; // h1 has now moved to it's own bucket
- rightMemory, [h3, h4];
- rightMemory, [h5]; // h5 also now in it's own bucket
- join2:
- leftMemory, [[h0, h3], [h2, h3],
- [h0, h4], [h2, h4] ];
- With:
- h5, age = 35;
- modify:
- otnRight1, [h5];
- join1:
- leftMemory, [[h0], [h2] ];
- leftMemory, [[h1]]; // h1 still in it's own bucket
- rightMemory, [h3, h4];
- rightMemory, [h5]; // h5 still in it's own bucket
- join2:
- leftMemory, [[h0, h3], [h2, h3],
- [h0, h4], [h2, h4] ]; // index bucket for age == 34
- leftMemory, [[h1, h5] ]; // index bucket for age == 35
- With:
- h0, age = 35;
- modify:
- otnLeft1, [h0];
- join1:
- leftMemory, [[h2] ];
- leftMemory, [[h1], [h0]]; // h0 joins h1 in the 35 index bucket
- rightMemory, [h3, h4];
- rightMemory, [h5]; // h5 still in it's own bucket
- join2:
- leftMemory, [[h2, h3],
- [h2, h4] ]; // index bucket for age == 34
- leftMemory, [[h1, h5], [h0, h5]]; // index bucket for age == 35
\ No newline at end of file
Copied: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeIndexTest.nodeTestCase (from rev 31154, labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeIndexTest.data)
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeIndexTest.nodeTestCase (rev 0)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeIndexTest.nodeTestCase 2010-01-29 21:36:16 UTC (rev 31327)
@@ -0,0 +1,89 @@
+TestCase "Join Node modify test case"
+
+Setup
+ ObjectTypeNode:
+ otnLeft1, org.drools.Person;
+ LeftInputAdapterNode:
+ lian0, otnLeft1;
+ ObjectTypeNode:
+ otnRight1, org.drools.Person;
+ ObjectTypeNode:
+ otnRight2, org.drools.Person;
+ Binding:
+ p1, 0, org.drools.Person, age;
+ JoinNode:
+ join1, lian0, otnRight1;
+ age, ==, p1;
+ JoinNode:
+ join2, join1, otnRight2;
+ age, ==, p1;
+ Facts:
+ new org.drools.Person('darth', 34), new org.drools.Person('bobba', 34),
+ new org.drools.Person('yoda', 34), new org.drools.Person('luke', 34),
+ new org.drools.Person('dave', 34), new org.drools.Person('bob', 34);
+
+Test "Node Index Test"
+ /**
+ * insert all and the modify for variation combinations, checking the index buckets are obeyed
+ */
+ assert:
+ otnLeft1, [h0, h1, h2];
+ otnRight1, [h3, h4, h5];
+ join1:
+ leftMemory, [[h0], [h1], [h2]];
+ rightMemory, [h3, h4, h5];
+ join2:
+ leftMemory, [[h0, h3], [h1, h3], [h2, h3],
+ [h0, h4], [h1, h4], [h2, h4],
+ [h0, h5], [h1, h5], [h2, h5]];
+
+ With:
+ h1, age = 35;
+ modify:
+ otnLeft1, [h1];
+ join1:
+ leftMemory, [[h0], [h2] ];
+ leftMemory, [[h1]]; // h1 has now moved to it's own bucket
+ rightMemory, [h3, h4, h5];
+ join2:
+ leftMemory, [[h0, h3], [h2, h3],
+ [h0, h4], [h2, h4],
+ [h0, h5], [h2, h5] ];
+ With:
+ h5, age = 36;
+ modify:
+ otnRight1, [h5];
+ join1:
+ leftMemory, [[h0], [h2] ];
+ leftMemory, [[h1]]; // h1 has now moved to it's own bucket
+ rightMemory, [h3, h4];
+ rightMemory, [h5]; // h5 also now in it's own bucket
+ join2:
+ leftMemory, [[h0, h3], [h2, h3],
+ [h0, h4], [h2, h4] ];
+ With:
+ h5, age = 35;
+ modify:
+ otnRight1, [h5];
+ join1:
+ leftMemory, [[h0], [h2] ];
+ leftMemory, [[h1]]; // h1 still in it's own bucket
+ rightMemory, [h3, h4];
+ rightMemory, [h5]; // h5 still in it's own bucket
+ join2:
+ leftMemory, [[h0, h3], [h2, h3],
+ [h0, h4], [h2, h4] ]; // index bucket for age == 34
+ leftMemory, [[h1, h5] ]; // index bucket for age == 35
+ With:
+ h0, age = 35;
+ modify:
+ otnLeft1, [h0];
+ join1:
+ leftMemory, [[h2] ];
+ leftMemory, [[h1], [h0]]; // h0 joins h1 in the 35 index bucket
+ rightMemory, [h3, h4];
+ rightMemory, [h5]; // h5 still in it's own bucket
+ join2:
+ leftMemory, [[h2, h3],
+ [h2, h4] ]; // index bucket for age == 34
+ leftMemory, [[h1, h5], [h0, h5]]; // index bucket for age == 35
\ No newline at end of file
Deleted: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeModifyTest.data
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeModifyTest.data 2010-01-29 18:54:52 UTC (rev 31326)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeModifyTest.data 2010-01-29 21:36:16 UTC (rev 31327)
@@ -1,379 +0,0 @@
-TestCase "Join Node modify test case"
-
-Setup
- ObjectTypeNode:
- otnLeft1, org.drools.Person;
- LeftInputAdapterNode:
- lian0, otnLeft1;
- ObjectTypeNode:
- otnRight1, org.drools.Person;
- ObjectTypeNode:
- otnRight2, org.drools.Person;
- Binding:
- p1, 0, org.drools.Person, age;
- JoinNode:
- join1, lian0, otnRight1;
- age, !=, p1;
- JoinNode:
- join2, join1, otnRight2;
- age, !=, p1;
- Facts:
- new org.drools.Person('darth', 34), new org.drools.Person('bobba', 35),
- new org.drools.Person('yoda', 36), new org.drools.Person('luke', 37),
- new org.drools.Person('dave', 38), new org.drools.Person('bob', 39);
-
-Test "Modify test"
- /**
- * insert one left and try modify
- */
- assert:
- otnLeft1, [h0];
- modify:
- otnLeft1, [h0];
- join1:
- leftMemory, [[h0]];
- retract:
- otnLeft1, [h0];
-
- /**
- * insert one right and try modify:
- */
- assert:
- otnRight1, [h1];
- modify:
- otnRight1, [h1];
- join1:
- rightMemory, [h1];
- retract:
- otnRight1, [h1];
-
- /**
- * insert one left and right and try modify:, left and right, staying true
- */
- assert:
- otnLeft1, [h0];
- otnRight1, [h1];
- join1:
- leftMemory, [[h0]];
- rightMemory, [h1];
- join2:
- leftMemory, [[h0, h1]];
- modify: // modify:Left, should be no change
- otnLeft1, [h0];
- join1:
- leftMemory, [[h0]];
- rightMemory, [h1];
- join2:
- leftMemory, [[h0, h1]];
- modify: // modify:Right, should be no change
- otnRight1, [h1];
- join1:
- leftMemory, [[h0]];
- rightMemory, [h1];
- join2:
- leftMemory, [[h0, h1]];
- modify: // modify:Left, should be no change
- otnLeft1, [h0];
- join1:
- leftMemory, [[h0]];
- rightMemory, [h1];
- join2:
- leftMemory, [[h0, h1]];
- retract:
- otnLeft1, [h0];
- otnRight1, [h1];
- join1:
- leftMemory, [];
- rightMemory, [];
-
- /**
- * insert all and the modify: h0 breaking and re-creating each join, to simulate left modifies
- */
- assert:
- otnLeft1, [h0, h1, h2];
- otnRight1, [h3, h4, h5];
- join2:
- leftMemory, [[h0, h3], [h1, h3], [h2, h3],
- [h0, h4], [h1, h4], [h2, h4],
- [h0, h5], [h1, h5], [h2, h5]];
- With:
- h0, age = 37;
- modify:
- otnLeft1, [h0];
- join1:
- leftMemory, [[h1], [h2], [h0]]; // notice that h0 moves to the end
- join2:
- leftMemory, [[h1, h3], [h2, h3],
- [h1, h4], [h2, h4],
- [h1, h5], [h2, h5], [h0, h4], [h0, h5] ]; // notice that all child tuples as a result of the modify: are moved to the end
- With:
- h0, age = 38;
- modify:
- otnLeft1, [h0];
- join1:
- leftMemory, [[h1], [h2], [h0]];
- join2:
- leftMemory, [[h1, h3], [h2, h3],
- [h1, h4], [h2, h4],
- [h1, h5], [h2, h5], [h0, h3], [h0, h5] ];
- With:
- h0, age = 39;
- modify:
- otnLeft1, [h0];
- join2:
- leftMemory, [[h1, h3], [h2, h3],
- [h1, h4], [h2, h4],
- [h1, h5], [h2, h5], [h0, h3], [h0, h4] ];
- With:
- h0, age = 34;
- modify:
- otnLeft1, [h0];
- join2:
- leftMemory, [[h1, h3], [h2, h3],
- [h1, h4], [h2, h4],
- [h1, h5], [h2, h5], [h0, h3], [h0, h4], [h0, h5] ];
- retract:
- otnLeft1, [h0, h1, h2];
- otnRight1, [h3, h4, h5];
-
- /**
- * insert all and the modify: h1 breaking and re-creating each join, to simulate left modifies
- */
- assert:
- otnLeft1, [h0, h1, h2];
- otnRight1, [h3, h4, h5];
- join2:
- leftMemory, [[h0, h3], [h1, h3], [h2, h3],
- [h0, h4], [h1, h4], [h2, h4],
- [h0, h5], [h1, h5], [h2, h5]];
- With:
- h1, age = 37;
- modify:
- otnLeft1, [h1];
- join1:
- leftMemory, [[h0], [h2], [h1]]; // notice that h2 moves to the end
- join2:
- leftMemory, [[h0, h3], [h2, h3],
- [h0, h4], [h2, h4],
- [h0, h5], [h2, h5], [h1, h4], [h1, h5] ]; // notice that all child tuples as a result of the modify: are moved to the end
- With:
- h1, age = 38;
- modify:
- otnLeft1, [h1];
- join1:
- leftMemory, [[h0], [h2], [h1]];
- join2:
- leftMemory, [[h0, h3], [h2, h3],
- [h0, h4], [h2, h4],
- [h0, h5], [h2, h5], [h1, h3], [h1, h5] ];
- With:
- h1, age = 39;
- modify:
- otnLeft1, [h1];
- join2:
- leftMemory, [[h0, h3], [h2, h3],
- [h0, h4], [h2, h4],
- [h0, h5], [h2, h5], [h1, h3], [h1, h4] ] ;
- With:
- h1, age = 35;
- modify:
- otnLeft1, [h1];
- join2:
- leftMemory, [[h0, h3], [h2, h3],
- [h0, h4], [h2, h4],
- [h0, h5], [h2, h5], [h1, h3], [h1, h4], [h1, h5] ];
- retract:
- otnLeft1, [h0, h1, h2];
- otnRight1, [h3, h4, h5];
-
- /**
- * insert all and the modify: h2 breaking and re-creating each join, to simulate left modifies
- */
- assert:
- otnLeft1, [h0, h1, h2];
- otnRight1, [h3, h4, h5];
- join2:
- leftMemory, [[h0, h3], [h1, h3], [h2, h3],
- [h0, h4], [h1, h4], [h2, h4],
- [h0, h5], [h1, h5], [h2, h5]];
- With:
- h2, age = 37;
- modify:
- otnLeft1, [h2];
- join1:
- leftMemory, [[h0], [h1], [h2]]; // notice that h3 is still on the end
- join2:
- leftMemory, [[h0, h3], [h1, h3],
- [h0, h4], [h1, h4],
- [h0, h5], [h1, h5], [h2, h4], [h2, h5] ]; // notice that all child tuples as a result of the modify: are moved to the end
- With:
- h2, age = 38;
- modify:
- otnLeft1, [h2];
- join1:
- leftMemory, [[h0], [h1], [h2]];
- join2:
- leftMemory, [[h0, h3], [h1, h3],
- [h0, h4], [h1, h4],
- [h0, h5], [h1, h5], [h2, h3], [h2, h5] ];
- With:
- h2, age = 39;
- modify:
- otnLeft1, [h2];
- join2:
- leftMemory, [[h0, h3], [h1, h3],
- [h0, h4], [h1, h4],
- [h0, h5], [h1, h5], [h2, h3], [h2, h4] ];
- With:
- h2, age = 36;
- modify:
- otnLeft1, [h2];
- join2:
- leftMemory, [[h0, h3], [h1, h3],
- [h0, h4], [h1, h4],
- [h0, h5], [h1, h5], [h2, h3], [h2, h4], [h2, h5] ];
- retract:
- otnLeft1, [h0, h1, h2];
- otnRight1, [h3, h4, h5];
-
- /**
- * insert all and the modify: h3 breaking and re-creating each join, to simulate right modifies
- */
- assert:
- otnLeft1, [h0, h1, h2];
- otnRight1, [h3, h4, h5];
- join2:
- leftMemory, [[h0, h3], [h1, h3], [h2, h3],
- [h0, h4], [h1, h4], [h2, h4],
- [h0, h5], [h1, h5], [h2, h5]];
- With:
- h3, age = 34;
- modify:
- otnRight1, [h3];
- join1:
- rightMemory, [h4, h5, h3]; // notice that h3 moves to the end
- join2:
- leftMemory, [[h0, h4], [h1, h4], [h2, h4],
- [h0, h5], [h1, h5], [h2, h5], [h1, h3], [h2, h3]]; // notice that all child tuples as a result of the modify: are moved to the end
- With:
- h3, age = 35;
- modify:
- otnRight1, [h3];
- join1:
- rightMemory, [h4, h5, h3]; // notice that h3 moves to the end
- join2:
- leftMemory, [[h0, h4], [h1, h4], [h2, h4],
- [h0, h5], [h1, h5], [h2, h5], [h0, h3], [h2, h3]]; // notice that all child tuples as a result of the modify: are moved to the end
- With:
- h3, age = 36;
- modify:
- otnRight1, [h3];
- join2:
- leftMemory, [[h0, h4], [h1, h4], [h2, h4],
- [h0, h5], [h1, h5], [h2, h5], [h0, h3], [h1, h3]]; // notice that all child tuples as a result of the modify: are moved to the end
- With:
- h3, age = 37;
- modify:
- otnRight1, [h3];
- join2:
- leftMemory, [[h0, h4], [h1, h4], [h2, h4],
- [h0, h5], [h1, h5], [h2, h5], [h0, h3], [h1, h3], [h2, h3]]; // notice that all child tuples as a result of the modify: are moved to the end
- retract:
- otnLeft1, [h0, h1, h2];
- otnRight1, [h3, h4, h5];
-
- /**
- * insert all and the modify: h4 breaking and re-creating each join, to simulate right modifies
- */
- assert:
- otnLeft1, [h0, h1, h2];
- otnRight1, [h3, h4, h5];
- join2:
- leftMemory, [[h0, h3], [h1, h3], [h2, h3],
- [h0, h4], [h1, h4], [h2, h4],
- [h0, h5], [h1, h5], [h2, h5]];
- With:
- h4, age = 34;
- modify:
- otnRight1, [h4];
- join1:
- rightMemory, [h3, h5, h4]; // notice that h4 moves to the end
- join2:
- leftMemory, [[h0, h3], [h1, h3], [h2, h3],
- [h0, h5], [h1, h5], [h2, h5], [h1, h4], [h2, h4] ]; // notice that all child tuples as a result of the modify: are moved to the end
- With:
- h4, age = 35;
- modify:
- otnRight1, [h4];
- join1:
- rightMemory, [h3, h5, h4]; // notice that h4 moves to the end
- join2:
- leftMemory, [[h0, h3], [h1, h3], [h2, h3],
- [h0, h5], [h1, h5], [h2, h5], [h0, h4], [h2, h4] ]; // notice that all child tuples as a result of the modify: are moved to the end
- With:
- h4, age = 36;
- modify:
- otnRight1, [h4];
- join2:
- leftMemory, [[h0, h3], [h1, h3], [h2, h3],
- [h0, h5], [h1, h5], [h2, h5], [h0, h4], [h1, h4] ]; // notice that all child tuples as a result of the modify: are moved to the end
- With:
- h4, age = 38;
- modify:
- otnRight1, [h4];
- join2:
- leftMemory, [[h0, h3], [h1, h3], [h2, h3],
- [h0, h5], [h1, h5], [h2, h5], [h0, h4], [h1, h4], [h2, h4] ]; // notice that all child tuples as a result of the modify: are moved to the end
- retract:
- otnLeft1, [h0, h1, h2];
- otnRight1, [h3, h4, h5];
-
- /**
- * insert all and the modify: h5 breaking and re-creating each join, to simulate right modifies
- */
- assert:
- otnLeft1, [h0, h1, h2];
- otnRight1, [h3, h4, h5];
- join2:
- leftMemory, [[h0, h3], [h1, h3], [h2, h3],
- [h0, h4], [h1, h4], [h2, h4],
- [h0, h5], [h1, h5], [h2, h5]];
- With:
- h5, age = 34;
- modify:
- otnRight1, [h5];
- join1:
- rightMemory, [h3, h4, h5]; // notice that h4 is still on the end
- join2:
- leftMemory, [[h0, h3], [h1, h3], [h2, h3],
- [h0, h4], [h1, h4], [h2, h4],
- [h1, h5], [h2, h5] ]; // notice that all child tuples as a result of the modify: are moved to the end
- With:
- h5, age = 35;
- modify:
- otnRight1, [h5];
- join1:
- rightMemory, [h3, h4, h5]; // notice that h4 is still on the end
- join2:
- leftMemory, [[h0, h3], [h1, h3], [h2, h3],
- [h0, h4], [h1, h4], [h2, h4],
- [h0, h5], [h2, h5] ]; // notice that all child tuples as a result of the modify: are moved to the end
- With:
- h5, age = 36;
- modify:
- otnRight1, [h5];
- join2:
- leftMemory, [[h0, h3], [h1, h3], [h2, h3],
- [h0, h4], [h1, h4], [h2, h4],
- [h0, h5], [h1, h5] ]; // notice that all child tuples as a result of the modify: are moved to the end
- With:
- h5, age = 39;
- modify:
- otnRight1, [h5];
- join2:
- leftMemory, [[h0, h3], [h1, h3], [h2, h3],
- [h0, h4], [h1, h4], [h2, h4],
- [h0, h5], [h1, h5], [h2, h5] ]; // notice that all child tuples as a result of the modify: are moved to the end
- retract:
- otnLeft1, [h0, h1, h2];
- otnRight1, [h3, h4, h5];
\ No newline at end of file
Copied: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeModifyTest.nodeTestCase (from rev 31154, labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeModifyTest.data)
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeModifyTest.nodeTestCase (rev 0)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/JoinNodeModifyTest.nodeTestCase 2010-01-29 21:36:16 UTC (rev 31327)
@@ -0,0 +1,379 @@
+TestCase "Join Node modify test case"
+
+Setup
+ ObjectTypeNode:
+ otnLeft1, org.drools.Person;
+ LeftInputAdapterNode:
+ lian0, otnLeft1;
+ ObjectTypeNode:
+ otnRight1, org.drools.Person;
+ ObjectTypeNode:
+ otnRight2, org.drools.Person;
+ Binding:
+ p1, 0, org.drools.Person, age;
+ JoinNode:
+ join1, lian0, otnRight1;
+ age, !=, p1;
+ JoinNode:
+ join2, join1, otnRight2;
+ age, !=, p1;
+ Facts:
+ new org.drools.Person('darth', 34), new org.drools.Person('bobba', 35),
+ new org.drools.Person('yoda', 36), new org.drools.Person('luke', 37),
+ new org.drools.Person('dave', 38), new org.drools.Person('bob', 39);
+
+Test "Modify test"
+ /**
+ * insert one left and try modify
+ */
+ assert:
+ otnLeft1, [h0];
+ modify:
+ otnLeft1, [h0];
+ join1:
+ leftMemory, [[h0]];
+ retract:
+ otnLeft1, [h0];
+
+ /**
+ * insert one right and try modify:
+ */
+ assert:
+ otnRight1, [h1];
+ modify:
+ otnRight1, [h1];
+ join1:
+ rightMemory, [h1];
+ retract:
+ otnRight1, [h1];
+
+ /**
+ * insert one left and right and try modify:, left and right, staying true
+ */
+ assert:
+ otnLeft1, [h0];
+ otnRight1, [h1];
+ join1:
+ leftMemory, [[h0]];
+ rightMemory, [h1];
+ join2:
+ leftMemory, [[h0, h1]];
+ modify: // modify:Left, should be no change
+ otnLeft1, [h0];
+ join1:
+ leftMemory, [[h0]];
+ rightMemory, [h1];
+ join2:
+ leftMemory, [[h0, h1]];
+ modify: // modify:Right, should be no change
+ otnRight1, [h1];
+ join1:
+ leftMemory, [[h0]];
+ rightMemory, [h1];
+ join2:
+ leftMemory, [[h0, h1]];
+ modify: // modify:Left, should be no change
+ otnLeft1, [h0];
+ join1:
+ leftMemory, [[h0]];
+ rightMemory, [h1];
+ join2:
+ leftMemory, [[h0, h1]];
+ retract:
+ otnLeft1, [h0];
+ otnRight1, [h1];
+ join1:
+ leftMemory, [];
+ rightMemory, [];
+
+ /**
+ * insert all and the modify: h0 breaking and re-creating each join, to simulate left modifies
+ */
+ assert:
+ otnLeft1, [h0, h1, h2];
+ otnRight1, [h3, h4, h5];
+ join2:
+ leftMemory, [[h0, h3], [h1, h3], [h2, h3],
+ [h0, h4], [h1, h4], [h2, h4],
+ [h0, h5], [h1, h5], [h2, h5]];
+ With:
+ h0, age = 37;
+ modify:
+ otnLeft1, [h0];
+ join1:
+ leftMemory, [[h1], [h2], [h0]]; // notice that h0 moves to the end
+ join2:
+ leftMemory, [[h1, h3], [h2, h3],
+ [h1, h4], [h2, h4],
+ [h1, h5], [h2, h5], [h0, h4], [h0, h5] ]; // notice that all child tuples as a result of the modify: are moved to the end
+ With:
+ h0, age = 38;
+ modify:
+ otnLeft1, [h0];
+ join1:
+ leftMemory, [[h1], [h2], [h0]];
+ join2:
+ leftMemory, [[h1, h3], [h2, h3],
+ [h1, h4], [h2, h4],
+ [h1, h5], [h2, h5], [h0, h3], [h0, h5] ];
+ With:
+ h0, age = 39;
+ modify:
+ otnLeft1, [h0];
+ join2:
+ leftMemory, [[h1, h3], [h2, h3],
+ [h1, h4], [h2, h4],
+ [h1, h5], [h2, h5], [h0, h3], [h0, h4] ];
+ With:
+ h0, age = 34;
+ modify:
+ otnLeft1, [h0];
+ join2:
+ leftMemory, [[h1, h3], [h2, h3],
+ [h1, h4], [h2, h4],
+ [h1, h5], [h2, h5], [h0, h3], [h0, h4], [h0, h5] ];
+ retract:
+ otnLeft1, [h0, h1, h2];
+ otnRight1, [h3, h4, h5];
+
+ /**
+ * insert all and the modify: h1 breaking and re-creating each join, to simulate left modifies
+ */
+ assert:
+ otnLeft1, [h0, h1, h2];
+ otnRight1, [h3, h4, h5];
+ join2:
+ leftMemory, [[h0, h3], [h1, h3], [h2, h3],
+ [h0, h4], [h1, h4], [h2, h4],
+ [h0, h5], [h1, h5], [h2, h5]];
+ With:
+ h1, age = 37;
+ modify:
+ otnLeft1, [h1];
+ join1:
+ leftMemory, [[h0], [h2], [h1]]; // notice that h2 moves to the end
+ join2:
+ leftMemory, [[h0, h3], [h2, h3],
+ [h0, h4], [h2, h4],
+ [h0, h5], [h2, h5], [h1, h4], [h1, h5] ]; // notice that all child tuples as a result of the modify: are moved to the end
+ With:
+ h1, age = 38;
+ modify:
+ otnLeft1, [h1];
+ join1:
+ leftMemory, [[h0], [h2], [h1]];
+ join2:
+ leftMemory, [[h0, h3], [h2, h3],
+ [h0, h4], [h2, h4],
+ [h0, h5], [h2, h5], [h1, h3], [h1, h5] ];
+ With:
+ h1, age = 39;
+ modify:
+ otnLeft1, [h1];
+ join2:
+ leftMemory, [[h0, h3], [h2, h3],
+ [h0, h4], [h2, h4],
+ [h0, h5], [h2, h5], [h1, h3], [h1, h4] ] ;
+ With:
+ h1, age = 35;
+ modify:
+ otnLeft1, [h1];
+ join2:
+ leftMemory, [[h0, h3], [h2, h3],
+ [h0, h4], [h2, h4],
+ [h0, h5], [h2, h5], [h1, h3], [h1, h4], [h1, h5] ];
+ retract:
+ otnLeft1, [h0, h1, h2];
+ otnRight1, [h3, h4, h5];
+
+ /**
+ * insert all and the modify: h2 breaking and re-creating each join, to simulate left modifies
+ */
+ assert:
+ otnLeft1, [h0, h1, h2];
+ otnRight1, [h3, h4, h5];
+ join2:
+ leftMemory, [[h0, h3], [h1, h3], [h2, h3],
+ [h0, h4], [h1, h4], [h2, h4],
+ [h0, h5], [h1, h5], [h2, h5]];
+ With:
+ h2, age = 37;
+ modify:
+ otnLeft1, [h2];
+ join1:
+ leftMemory, [[h0], [h1], [h2]]; // notice that h3 is still on the end
+ join2:
+ leftMemory, [[h0, h3], [h1, h3],
+ [h0, h4], [h1, h4],
+ [h0, h5], [h1, h5], [h2, h4], [h2, h5] ]; // notice that all child tuples as a result of the modify: are moved to the end
+ With:
+ h2, age = 38;
+ modify:
+ otnLeft1, [h2];
+ join1:
+ leftMemory, [[h0], [h1], [h2]];
+ join2:
+ leftMemory, [[h0, h3], [h1, h3],
+ [h0, h4], [h1, h4],
+ [h0, h5], [h1, h5], [h2, h3], [h2, h5] ];
+ With:
+ h2, age = 39;
+ modify:
+ otnLeft1, [h2];
+ join2:
+ leftMemory, [[h0, h3], [h1, h3],
+ [h0, h4], [h1, h4],
+ [h0, h5], [h1, h5], [h2, h3], [h2, h4] ];
+ With:
+ h2, age = 36;
+ modify:
+ otnLeft1, [h2];
+ join2:
+ leftMemory, [[h0, h3], [h1, h3],
+ [h0, h4], [h1, h4],
+ [h0, h5], [h1, h5], [h2, h3], [h2, h4], [h2, h5] ];
+ retract:
+ otnLeft1, [h0, h1, h2];
+ otnRight1, [h3, h4, h5];
+
+ /**
+ * insert all and the modify: h3 breaking and re-creating each join, to simulate right modifies
+ */
+ assert:
+ otnLeft1, [h0, h1, h2];
+ otnRight1, [h3, h4, h5];
+ join2:
+ leftMemory, [[h0, h3], [h1, h3], [h2, h3],
+ [h0, h4], [h1, h4], [h2, h4],
+ [h0, h5], [h1, h5], [h2, h5]];
+ With:
+ h3, age = 34;
+ modify:
+ otnRight1, [h3];
+ join1:
+ rightMemory, [h4, h5, h3]; // notice that h3 moves to the end
+ join2:
+ leftMemory, [[h0, h4], [h1, h4], [h2, h4],
+ [h0, h5], [h1, h5], [h2, h5], [h1, h3], [h2, h3]]; // notice that all child tuples as a result of the modify: are moved to the end
+ With:
+ h3, age = 35;
+ modify:
+ otnRight1, [h3];
+ join1:
+ rightMemory, [h4, h5, h3]; // notice that h3 moves to the end
+ join2:
+ leftMemory, [[h0, h4], [h1, h4], [h2, h4],
+ [h0, h5], [h1, h5], [h2, h5], [h0, h3], [h2, h3]]; // notice that all child tuples as a result of the modify: are moved to the end
+ With:
+ h3, age = 36;
+ modify:
+ otnRight1, [h3];
+ join2:
+ leftMemory, [[h0, h4], [h1, h4], [h2, h4],
+ [h0, h5], [h1, h5], [h2, h5], [h0, h3], [h1, h3]]; // notice that all child tuples as a result of the modify: are moved to the end
+ With:
+ h3, age = 37;
+ modify:
+ otnRight1, [h3];
+ join2:
+ leftMemory, [[h0, h4], [h1, h4], [h2, h4],
+ [h0, h5], [h1, h5], [h2, h5], [h0, h3], [h1, h3], [h2, h3]]; // notice that all child tuples as a result of the modify: are moved to the end
+ retract:
+ otnLeft1, [h0, h1, h2];
+ otnRight1, [h3, h4, h5];
+
+ /**
+ * insert all and the modify: h4 breaking and re-creating each join, to simulate right modifies
+ */
+ assert:
+ otnLeft1, [h0, h1, h2];
+ otnRight1, [h3, h4, h5];
+ join2:
+ leftMemory, [[h0, h3], [h1, h3], [h2, h3],
+ [h0, h4], [h1, h4], [h2, h4],
+ [h0, h5], [h1, h5], [h2, h5]];
+ With:
+ h4, age = 34;
+ modify:
+ otnRight1, [h4];
+ join1:
+ rightMemory, [h3, h5, h4]; // notice that h4 moves to the end
+ join2:
+ leftMemory, [[h0, h3], [h1, h3], [h2, h3],
+ [h0, h5], [h1, h5], [h2, h5], [h1, h4], [h2, h4] ]; // notice that all child tuples as a result of the modify: are moved to the end
+ With:
+ h4, age = 35;
+ modify:
+ otnRight1, [h4];
+ join1:
+ rightMemory, [h3, h5, h4]; // notice that h4 moves to the end
+ join2:
+ leftMemory, [[h0, h3], [h1, h3], [h2, h3],
+ [h0, h5], [h1, h5], [h2, h5], [h0, h4], [h2, h4] ]; // notice that all child tuples as a result of the modify: are moved to the end
+ With:
+ h4, age = 36;
+ modify:
+ otnRight1, [h4];
+ join2:
+ leftMemory, [[h0, h3], [h1, h3], [h2, h3],
+ [h0, h5], [h1, h5], [h2, h5], [h0, h4], [h1, h4] ]; // notice that all child tuples as a result of the modify: are moved to the end
+ With:
+ h4, age = 38;
+ modify:
+ otnRight1, [h4];
+ join2:
+ leftMemory, [[h0, h3], [h1, h3], [h2, h3],
+ [h0, h5], [h1, h5], [h2, h5], [h0, h4], [h1, h4], [h2, h4] ]; // notice that all child tuples as a result of the modify: are moved to the end
+ retract:
+ otnLeft1, [h0, h1, h2];
+ otnRight1, [h3, h4, h5];
+
+ /**
+ * insert all and the modify: h5 breaking and re-creating each join, to simulate right modifies
+ */
+ assert:
+ otnLeft1, [h0, h1, h2];
+ otnRight1, [h3, h4, h5];
+ join2:
+ leftMemory, [[h0, h3], [h1, h3], [h2, h3],
+ [h0, h4], [h1, h4], [h2, h4],
+ [h0, h5], [h1, h5], [h2, h5]];
+ With:
+ h5, age = 34;
+ modify:
+ otnRight1, [h5];
+ join1:
+ rightMemory, [h3, h4, h5]; // notice that h4 is still on the end
+ join2:
+ leftMemory, [[h0, h3], [h1, h3], [h2, h3],
+ [h0, h4], [h1, h4], [h2, h4],
+ [h1, h5], [h2, h5] ]; // notice that all child tuples as a result of the modify: are moved to the end
+ With:
+ h5, age = 35;
+ modify:
+ otnRight1, [h5];
+ join1:
+ rightMemory, [h3, h4, h5]; // notice that h4 is still on the end
+ join2:
+ leftMemory, [[h0, h3], [h1, h3], [h2, h3],
+ [h0, h4], [h1, h4], [h2, h4],
+ [h0, h5], [h2, h5] ]; // notice that all child tuples as a result of the modify: are moved to the end
+ With:
+ h5, age = 36;
+ modify:
+ otnRight1, [h5];
+ join2:
+ leftMemory, [[h0, h3], [h1, h3], [h2, h3],
+ [h0, h4], [h1, h4], [h2, h4],
+ [h0, h5], [h1, h5] ]; // notice that all child tuples as a result of the modify: are moved to the end
+ With:
+ h5, age = 39;
+ modify:
+ otnRight1, [h5];
+ join2:
+ leftMemory, [[h0, h3], [h1, h3], [h2, h3],
+ [h0, h4], [h1, h4], [h2, h4],
+ [h0, h5], [h1, h5], [h2, h5] ]; // notice that all child tuples as a result of the modify: are moved to the end
+ retract:
+ otnLeft1, [h0, h1, h2];
+ otnRight1, [h3, h4, h5];
\ No newline at end of file
Deleted: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeAssertRetractTest.data
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeAssertRetractTest.data 2010-01-29 18:54:52 UTC (rev 31326)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeAssertRetractTest.data 2010-01-29 21:36:16 UTC (rev 31327)
@@ -1,224 +0,0 @@
-TestCase "Not Node assert/retract test case"
-
-Setup
- ObjectTypeNode:
- otnLeft1, org.drools.Person;
- LeftInputAdapterNode:
- lian1, otnLeft1;
- ObjectTypeNode:
- otnRight1, org.drools.Person;
- ObjectTypeNode:
- otnRight2, org.drools.Person;
- Binding:
- p1, 0, org.drools.Person, age;
- NotNode:
- not1, lian1, otnRight1;
- age, !=, p1;
- JoinNode:
- join2, not1, otnRight2;
- age, !=, p1;
- Facts:
- new org.drools.Person('darth', 35), new org.drools.Person('bobba', 35),
- new org.drools.Person('yoda', 35), new org.drools.Person('luke', 35),
- new org.drools.Person('dave', 35), new org.drools.Person('bob', 36),
- new org.drools.Person('obi', 36), new org.drools.Person('han', 37);
-
-Test "assert retract test"
- /**
- * check single left assertion and retraction
- */
- assert:
- otnLeft1, [h0];
- not1:
- leftMemory, [[h0]];
- join2:
- leftMemory, [[h0]];
- retract:
- otnLeft1, [h0];
- not1:
- leftMemory, [];
- join2:
- leftMemory, [];
-
- /**
- * check single right assertion and retraction
- */
- assert:
- otnRight1, [h1];
- not1:
- rightMemory, [h1];
- join2:
- leftMemory, [];
- retract:
- otnRight1, [h1];
- not1:
- rightMemory, [];
-
- /**
- * check single left then right assertion, where age == age (does not match not)
- */
- assert:
- otnLeft1, [h0];
- not1:
- leftMemory, [[h0]];
- rightMemory, [];
- join2:
- leftMemory, [[h0]];
- assert:
- otnRight1, [h1];
- not1:
- leftMemory, [[h0]];
- rightMemory, [h1];
- join2:
- leftMemory, [[h0]];
- retract:
- otnRight1, [h1];
- otnRight1, [];
- join2:
- leftMemory, [[h0]];
- retract:
- otnLeft1, [h0];
- not1:
- leftMemory, [];
- rightMemory, [];
- join2:
- leftMemory, [];
-
- /**
- * check single left then right assertion, where age != age (matches not)
- */
- assert:
- otnLeft1, [h0];
- not1:
- leftMemory, [[h0]]; // h0 is here, it'll disapear soon....
- rightMemory, [];
- join2:
- leftMemory, [[h0]];
- assert:
- otnRight1, [h5];
- not1:
- leftMemory, []; // h0 disappears as h5 blocks it, and removes it from memory
- rightMemory, [h5];
- join2:
- leftMemory, [];
- retract:
- otnRight1, [h5];
- not1:
- leftMemory, [[h0]]; // h0 is put back in, as h5 no longer blocks
- rightMemory, [];
- join2:
- leftMemory, [[h0]];
- retract:
- otnLeft1, [h0];
- not1:
- leftMemory, [];
- rightMemory, [];
- join2:
- leftMemory, [];
-
-
- /**
- * check single right then left assertion, where age != age (matches not)
- */
- assert:
- otnRight1, [h5];
- not1:
- leftMemory, [];
- rightMemory, [h5];
- join2:
- leftMemory, [];
- assert:
- otnLeft1, [h0];
- not1:
- leftMemory, []; // although it's inserted, you can't see it in the memory as h5 blocks it
- rightMemory, [h5];
- join2:
- leftMemory, [];
- retract:
- otnRight1, [h5];
- not1:
- leftMemory, [[h0]]; // h5 no longer blocks, so put back in
- rightMemory, [];
- join2:
- leftMemory, [[h0]];
- retract:
- otnLeft1, [h0];
- not1:
- leftMemory, [];
- rightMemory, [];
- join2:
- leftMemory, [];
-
- /**
- * check single right then left assertion, where age == age (does not match not)
- */
- assert:
- otnRight1, [h1];
- not1:
- leftMemory, [];
- rightMemory, [h1];
- join2:
- leftMemory, [];
- assert:
- otnLeft1, [h0];
- not1:
- leftMemory, [[h0]];
- rightMemory, [h1];
- join2:
- leftMemory, [[h0]];
- retract:
- otnRight1, [h1];
- not1:
- leftMemory, [[h0]];
- rightMemory, [];
- join2:
- leftMemory, [[h0]];
- retract:
- otnLeft1, [h0];
- not1:
- leftMemory, [];
- rightMemory, [];
- join2:
- leftMemory, [];
-
- // here
-
-
- /**
- * assert two left and two right, with iterative retract and assert, age != age (not matches)
- */
- assert:
- otnLeft1, [h0, h1];
- not1:
- leftMemory, [[h0], [h1]];
- rightMemory, [];
- join2:
- leftMemory, [[h0], [h1]];
- assert:
- otnRight1, [h5];
- not1:
- leftMemory, []; //h0 and h1 are blocked, by h5, so removed
- rightMemory, [h5, h6];
- join2:
- leftMemory, [];
- assert:
- otnRight1, [h6];
- not1:
- leftMemory, []; //h0 and h1 are still blocked
- rightMemory, [h5, h6];
- join2:
- leftMemory, [];
- retract:
- otnRight1, [h5]; // retract h5, the facts should still be blocked now by h6
- not1:
- leftMemory, []; //h0 and h1 are still blocked
- rightMemory, [h6];
- join2:
- leftMemory, [];
- retract:
- otnRight1, [h6]; // now there are no blockers
- not1:
- leftMemory, [[h0], [h1]]; // both facts go back in
- rightMemory, [];
- join2:
- leftMemory, [[h0], [h1]]; // both facts propagate
\ No newline at end of file
Copied: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeAssertRetractTest.nodeTestCase (from rev 31154, labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeAssertRetractTest.data)
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeAssertRetractTest.nodeTestCase (rev 0)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeAssertRetractTest.nodeTestCase 2010-01-29 21:36:16 UTC (rev 31327)
@@ -0,0 +1,224 @@
+TestCase "Not Node assert/retract test case"
+
+Setup
+ ObjectTypeNode:
+ otnLeft1, org.drools.Person;
+ LeftInputAdapterNode:
+ lian1, otnLeft1;
+ ObjectTypeNode:
+ otnRight1, org.drools.Person;
+ ObjectTypeNode:
+ otnRight2, org.drools.Person;
+ Binding:
+ p1, 0, org.drools.Person, age;
+ NotNode:
+ not1, lian1, otnRight1;
+ age, !=, p1;
+ JoinNode:
+ join2, not1, otnRight2;
+ age, !=, p1;
+ Facts:
+ new org.drools.Person('darth', 35), new org.drools.Person('bobba', 35),
+ new org.drools.Person('yoda', 35), new org.drools.Person('luke', 35),
+ new org.drools.Person('dave', 35), new org.drools.Person('bob', 36),
+ new org.drools.Person('obi', 36), new org.drools.Person('han', 37);
+
+Test "assert retract test"
+ /**
+ * check single left assertion and retraction
+ */
+ assert:
+ otnLeft1, [h0];
+ not1:
+ leftMemory, [[h0]];
+ join2:
+ leftMemory, [[h0]];
+ retract:
+ otnLeft1, [h0];
+ not1:
+ leftMemory, [];
+ join2:
+ leftMemory, [];
+
+ /**
+ * check single right assertion and retraction
+ */
+ assert:
+ otnRight1, [h1];
+ not1:
+ rightMemory, [h1];
+ join2:
+ leftMemory, [];
+ retract:
+ otnRight1, [h1];
+ not1:
+ rightMemory, [];
+
+ /**
+ * check single left then right assertion, where age == age (does not match not)
+ */
+ assert:
+ otnLeft1, [h0];
+ not1:
+ leftMemory, [[h0]];
+ rightMemory, [];
+ join2:
+ leftMemory, [[h0]];
+ assert:
+ otnRight1, [h1];
+ not1:
+ leftMemory, [[h0]];
+ rightMemory, [h1];
+ join2:
+ leftMemory, [[h0]];
+ retract:
+ otnRight1, [h1];
+ otnRight1, [];
+ join2:
+ leftMemory, [[h0]];
+ retract:
+ otnLeft1, [h0];
+ not1:
+ leftMemory, [];
+ rightMemory, [];
+ join2:
+ leftMemory, [];
+
+ /**
+ * check single left then right assertion, where age != age (matches not)
+ */
+ assert:
+ otnLeft1, [h0];
+ not1:
+ leftMemory, [[h0]]; // h0 is here, it'll disapear soon....
+ rightMemory, [];
+ join2:
+ leftMemory, [[h0]];
+ assert:
+ otnRight1, [h5];
+ not1:
+ leftMemory, []; // h0 disappears as h5 blocks it, and removes it from memory
+ rightMemory, [h5];
+ join2:
+ leftMemory, [];
+ retract:
+ otnRight1, [h5];
+ not1:
+ leftMemory, [[h0]]; // h0 is put back in, as h5 no longer blocks
+ rightMemory, [];
+ join2:
+ leftMemory, [[h0]];
+ retract:
+ otnLeft1, [h0];
+ not1:
+ leftMemory, [];
+ rightMemory, [];
+ join2:
+ leftMemory, [];
+
+
+ /**
+ * check single right then left assertion, where age != age (matches not)
+ */
+ assert:
+ otnRight1, [h5];
+ not1:
+ leftMemory, [];
+ rightMemory, [h5];
+ join2:
+ leftMemory, [];
+ assert:
+ otnLeft1, [h0];
+ not1:
+ leftMemory, []; // although it's inserted, you can't see it in the memory as h5 blocks it
+ rightMemory, [h5];
+ join2:
+ leftMemory, [];
+ retract:
+ otnRight1, [h5];
+ not1:
+ leftMemory, [[h0]]; // h5 no longer blocks, so put back in
+ rightMemory, [];
+ join2:
+ leftMemory, [[h0]];
+ retract:
+ otnLeft1, [h0];
+ not1:
+ leftMemory, [];
+ rightMemory, [];
+ join2:
+ leftMemory, [];
+
+ /**
+ * check single right then left assertion, where age == age (does not match not)
+ */
+ assert:
+ otnRight1, [h1];
+ not1:
+ leftMemory, [];
+ rightMemory, [h1];
+ join2:
+ leftMemory, [];
+ assert:
+ otnLeft1, [h0];
+ not1:
+ leftMemory, [[h0]];
+ rightMemory, [h1];
+ join2:
+ leftMemory, [[h0]];
+ retract:
+ otnRight1, [h1];
+ not1:
+ leftMemory, [[h0]];
+ rightMemory, [];
+ join2:
+ leftMemory, [[h0]];
+ retract:
+ otnLeft1, [h0];
+ not1:
+ leftMemory, [];
+ rightMemory, [];
+ join2:
+ leftMemory, [];
+
+ // here
+
+
+ /**
+ * assert two left and two right, with iterative retract and assert, age != age (not matches)
+ */
+ assert:
+ otnLeft1, [h0, h1];
+ not1:
+ leftMemory, [[h0], [h1]];
+ rightMemory, [];
+ join2:
+ leftMemory, [[h0], [h1]];
+ assert:
+ otnRight1, [h5];
+ not1:
+ leftMemory, []; //h0 and h1 are blocked, by h5, so removed
+ rightMemory, [h5, h6];
+ join2:
+ leftMemory, [];
+ assert:
+ otnRight1, [h6];
+ not1:
+ leftMemory, []; //h0 and h1 are still blocked
+ rightMemory, [h5, h6];
+ join2:
+ leftMemory, [];
+ retract:
+ otnRight1, [h5]; // retract h5, the facts should still be blocked now by h6
+ not1:
+ leftMemory, []; //h0 and h1 are still blocked
+ rightMemory, [h6];
+ join2:
+ leftMemory, [];
+ retract:
+ otnRight1, [h6]; // now there are no blockers
+ not1:
+ leftMemory, [[h0], [h1]]; // both facts go back in
+ rightMemory, [];
+ join2:
+ leftMemory, [[h0], [h1]]; // both facts propagate
\ No newline at end of file
Deleted: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeIndexTest.data
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeIndexTest.data 2010-01-29 18:54:52 UTC (rev 31326)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeIndexTest.data 2010-01-29 21:36:16 UTC (rev 31327)
@@ -1,142 +0,0 @@
-TestCase "Not Node index test case"
-
-Setup
- ObjectTypeNode:
- otnLeft1, org.drools.Person;
- LeftInputAdapterNode:
- lian1, otnLeft1;
- ObjectTypeNode:
- otnRight1, org.drools.Person;
- ObjectTypeNode:
- otnRight2, org.drools.Person;
- Binding:
- p1, 0, org.drools.Person, age;
- NotNode:
- not1, lian1, otnRight1;
- age, ==, p1;
- JoinNode:
- join2, not1, otnRight2;
- age, ==, p1;
- Facts:
- new org.drools.Person('darth', 35), new org.drools.Person('bobba', 35),
- new org.drools.Person('yoda', 35), new org.drools.Person('luke', 35),
- new org.drools.Person('dave', 35), new org.drools.Person('bob', 36),
- new org.drools.Person('obi', 36), new org.drools.Person('han', 37);
-
-Test "Not node index test"
- /**
- * check single left then right assertion, initially not matched, the toggle matched and unmatched
- */
- assert:
- otnLeft1, [h0];
- not1:
- leftMemory, [[h0]];
- rightMemory, [];
- join2:
- leftMemory, [[h0]];
- assert:
- otnRight1, [h6];
- not1:
- leftMemory, [[h0]];
- rightMemory, [h6];
- join2:
- leftMemory, [[h0]];
- With:
- h6, age = 35;
- modify:
- otnRight1, [h6];
- not1:
- leftMemory, []; // h0 is removed from here, as it's blocked
- rightMemory, [h6];
- join2:
- leftMemory, [];
- With:
- h6, age = 36;
- modify:
- otnRight1, [h6];
- not1:
- leftMemory, [[h0]]; // h0 is back again, as it's no longer blocked
- rightMemory, [h6];
- join2:
- leftMemory, [[h0]];
- retract:
- otnLeft1, [h0];
- otnRight1, [h6];
-
-
-
- /**
- * check two left, two right, initially not matched, toggle various matches.
- */
- assert:
- otnRight1, [h6];
- otnLeft1, [h0, h1];
- not1:
- leftMemory, [[h0], [h1]];
- rightMemory, [h6];
- join2:
- leftMemory, [[h0], [h1]];
- assert:
- otnRight1, [h7];
- With:
- h6, age = 35;
- h7, age = 35;
- modify:
- otnRight1, [h6]; // h6 now blocks h0 and h1
- not1:
- leftMemory, [];
- join2:
- leftMemory, [];
- modify:
- otnRight1, [h7]; // now h6 and h7 block, although due to lazy only h6 blocks at the moment
- not1:
- leftMemory, [];
- join2:
- leftMemory, [];
- With:
- h1, age = 34 ;
- modify:
- otnLeft1, [h1];
- not1:
- leftMemory, [[h1]];
- join2:
- leftMemory, [[h1]];
- With:
- h6, age = 34;
- h7, age = 36;
- modify:
- otnRight1, [h6, h7]; // h6 now blocks h1, h0 is no longer blocked
- not1:
- leftMemory, [[h0]];
- join2:
- leftMemory, [[h0]];
- retract:
- otnLeft1, [h1];
- With:
- h0, age = 34 ;
- modify:
- otnLeft1, [h0]; // h0 should now be blocked by h6
- not1:
- leftMemory, [];
- join2:
- leftMemory, [];
- With:
- h0, age = 35 ;
- h1, age = 35 ;
- retract:
- otnLeft1, [h0, h1];
- otnRight1, [h6, h7];
-
- /**
- * Test Blocking two, in index, with modify but no index change
- */
- assert:
- otnRight1, [h3];
- otnLeft1, [h0, h1];
- not1:
- leftMemory, [];
- rightMemory, [h3];
- join2:
- leftMemory, [];
- modify:
- otnRight1, [h3];
\ No newline at end of file
Copied: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeIndexTest.nodeTestCase (from rev 31154, labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeIndexTest.data)
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeIndexTest.nodeTestCase (rev 0)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeIndexTest.nodeTestCase 2010-01-29 21:36:16 UTC (rev 31327)
@@ -0,0 +1,142 @@
+TestCase "Not Node index test case"
+
+Setup
+ ObjectTypeNode:
+ otnLeft1, org.drools.Person;
+ LeftInputAdapterNode:
+ lian1, otnLeft1;
+ ObjectTypeNode:
+ otnRight1, org.drools.Person;
+ ObjectTypeNode:
+ otnRight2, org.drools.Person;
+ Binding:
+ p1, 0, org.drools.Person, age;
+ NotNode:
+ not1, lian1, otnRight1;
+ age, ==, p1;
+ JoinNode:
+ join2, not1, otnRight2;
+ age, ==, p1;
+ Facts:
+ new org.drools.Person('darth', 35), new org.drools.Person('bobba', 35),
+ new org.drools.Person('yoda', 35), new org.drools.Person('luke', 35),
+ new org.drools.Person('dave', 35), new org.drools.Person('bob', 36),
+ new org.drools.Person('obi', 36), new org.drools.Person('han', 37);
+
+Test "Not node index test"
+ /**
+ * check single left then right assertion, initially not matched, the toggle matched and unmatched
+ */
+ assert:
+ otnLeft1, [h0];
+ not1:
+ leftMemory, [[h0]];
+ rightMemory, [];
+ join2:
+ leftMemory, [[h0]];
+ assert:
+ otnRight1, [h6];
+ not1:
+ leftMemory, [[h0]];
+ rightMemory, [h6];
+ join2:
+ leftMemory, [[h0]];
+ With:
+ h6, age = 35;
+ modify:
+ otnRight1, [h6];
+ not1:
+ leftMemory, []; // h0 is removed from here, as it's blocked
+ rightMemory, [h6];
+ join2:
+ leftMemory, [];
+ With:
+ h6, age = 36;
+ modify:
+ otnRight1, [h6];
+ not1:
+ leftMemory, [[h0]]; // h0 is back again, as it's no longer blocked
+ rightMemory, [h6];
+ join2:
+ leftMemory, [[h0]];
+ retract:
+ otnLeft1, [h0];
+ otnRight1, [h6];
+
+
+
+ /**
+ * check two left, two right, initially not matched, toggle various matches.
+ */
+ assert:
+ otnRight1, [h6];
+ otnLeft1, [h0, h1];
+ not1:
+ leftMemory, [[h0], [h1]];
+ rightMemory, [h6];
+ join2:
+ leftMemory, [[h0], [h1]];
+ assert:
+ otnRight1, [h7];
+ With:
+ h6, age = 35;
+ h7, age = 35;
+ modify:
+ otnRight1, [h6]; // h6 now blocks h0 and h1
+ not1:
+ leftMemory, [];
+ join2:
+ leftMemory, [];
+ modify:
+ otnRight1, [h7]; // now h6 and h7 block, although due to lazy only h6 blocks at the moment
+ not1:
+ leftMemory, [];
+ join2:
+ leftMemory, [];
+ With:
+ h1, age = 34 ;
+ modify:
+ otnLeft1, [h1];
+ not1:
+ leftMemory, [[h1]];
+ join2:
+ leftMemory, [[h1]];
+ With:
+ h6, age = 34;
+ h7, age = 36;
+ modify:
+ otnRight1, [h6, h7]; // h6 now blocks h1, h0 is no longer blocked
+ not1:
+ leftMemory, [[h0]];
+ join2:
+ leftMemory, [[h0]];
+ retract:
+ otnLeft1, [h1];
+ With:
+ h0, age = 34 ;
+ modify:
+ otnLeft1, [h0]; // h0 should now be blocked by h6
+ not1:
+ leftMemory, [];
+ join2:
+ leftMemory, [];
+ With:
+ h0, age = 35 ;
+ h1, age = 35 ;
+ retract:
+ otnLeft1, [h0, h1];
+ otnRight1, [h6, h7];
+
+ /**
+ * Test Blocking two, in index, with modify but no index change
+ */
+ assert:
+ otnRight1, [h3];
+ otnLeft1, [h0, h1];
+ not1:
+ leftMemory, [];
+ rightMemory, [h3];
+ join2:
+ leftMemory, [];
+ modify:
+ otnRight1, [h3];
\ No newline at end of file
Deleted: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeModifyTest.data
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeModifyTest.data 2010-01-29 18:54:52 UTC (rev 31326)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeModifyTest.data 2010-01-29 21:36:16 UTC (rev 31327)
@@ -1,120 +0,0 @@
-TestCase "Not Node modify test case"
-
-Setup
- ObjectTypeNode:
- otnLeft1, org.drools.Person;
- LeftInputAdapterNode:
- lian1, otnLeft1;
- ObjectTypeNode:
- otnRight1, org.drools.Person;
- ObjectTypeNode:
- otnRight2, org.drools.Person;
- Binding:
- p1, 0, org.drools.Person, age;
- NotNode:
- not1, lian1, otnRight1;
- age, !=, p1;
- JoinNode:
- join2, not1, otnRight2;
- age, !=, p1;
- Facts:
- new org.drools.Person('darth', 35), new org.drools.Person('bobba', 35),
- new org.drools.Person('yoda', 35), new org.drools.Person('luke', 35),
- new org.drools.Person('dave', 35), new org.drools.Person('bob', 36),
- new org.drools.Person('obi', 36), new org.drools.Person('han', 37);
-
-Test "Not node modify test"
- /**
- * check single left then right assertion, initially not matched, the toggle matched and unmatched
- */
- assert:
- otnLeft1, [h0];
- not1:
- leftMemory, [[h0]];
- rightMemory, [];
- join2:
- leftMemory, [[h0]];
- assert:
- otnRight1, [h1];
- not1:
- leftMemory, [[h0]];
- rightMemory, [h1];
- join2:
- leftMemory, [[h0]];
- With:
- h1, age = 36;
- modify:
- otnRight1, [h1];
- not1:
- leftMemory, []; // h0 is removed from here, as it's blocked
- rightMemory, [h1];
- join2:
- leftMemory, [];
- With:
- h1, age = 35;
- modify:
- otnRight1, [h1];
- not1:
- leftMemory, [[h0]]; // h0 is back again, as it's no longer blocked
- rightMemory, [h1];
- join2:
- leftMemory, [[h0]];
- retract:
- otnLeft1, [h0];
- otnRight1, [h1];
-
-
- /**
- * check two left, two right
- */
- assert:
- otnRight1, [h6];
- assert:
- otnLeft1, [h0, h1];
- not1:
- leftMemory, []; // memory is empty as h0 and h1 are blocked
- join2:
- leftMemory, [];
- assert:
- otnRight1, [h7];
- With:
- h6, age = 35;
- modify:
- otnRight1, [h6]; // h7 still blocks h0 and h1
- not1:
- leftMemory, [];
- join2:
- leftMemory, [];
- With:
- h7, age = 35;
- modify:
- otnRight1, [h7]; // h0 and h1 should now be unblocked
- not1:
- leftMemory, [[h0], [h1]]; // h0 and h1 appear back in memory
- join2:
- leftMemory, [[h0], [h1]];
- With:
- h6, age = 36;
- modify:
- otnRight1, [h6];
- not1:
- leftMemory, []; // h6 blocks both
- join2:
- leftMemory, [];
- With:
- h0, age = 36;
- modify:
- otnLeft1, [h0]; // h0 is now blocked by h7, while h1 remains blocked by h6
- not1:
- leftMemory, []; // remains empty
- join2:
- leftMemory, [];
- With:
- h0, age = 36;
- h7, age = 36;
- modify:
- otnLeft1, [h0]; // h0 is no longer blocked
- not1:
- leftMemory, [[h0]];
- join2:
- leftMemory, [[h0]];
\ No newline at end of file
Copied: labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeModifyTest.nodeTestCase (from rev 31154, labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeModifyTest.data)
===================================================================
--- labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeModifyTest.nodeTestCase (rev 0)
+++ labs/jbossrules/branches/true_modify_20100104/drools-core/src/test/resources/org/drools/reteoo/test/NotNodeModifyTest.nodeTestCase 2010-01-29 21:36:16 UTC (rev 31327)
@@ -0,0 +1,120 @@
+TestCase "Not Node modify test case"
+
+Setup
+ ObjectTypeNode:
+ otnLeft1, org.drools.Person;
+ LeftInputAdapterNode:
+ lian1, otnLeft1;
+ ObjectTypeNode:
+ otnRight1, org.drools.Person;
+ ObjectTypeNode:
+ otnRight2, org.drools.Person;
+ Binding:
+ p1, 0, org.drools.Person, age;
+ NotNode:
+ not1, lian1, otnRight1;
+ age, !=, p1;
+ JoinNode:
+ join2, not1, otnRight2;
+ age, !=, p1;
+ Facts:
+ new org.drools.Person('darth', 35), new org.drools.Person('bobba', 35),
+ new org.drools.Person('yoda', 35), new org.drools.Person('luke', 35),
+ new org.drools.Person('dave', 35), new org.drools.Person('bob', 36),
+ new org.drools.Person('obi', 36), new org.drools.Person('han', 37);
+
+Test "Not node modify test"
+ /**
+ * check single left then right assertion, initially not matched, the toggle matched and unmatched
+ */
+ assert:
+ otnLeft1, [h0];
+ not1:
+ leftMemory, [[h0]];
+ rightMemory, [];
+ join2:
+ leftMemory, [[h0]];
+ assert:
+ otnRight1, [h1];
+ not1:
+ leftMemory, [[h0]];
+ rightMemory, [h1];
+ join2:
+ leftMemory, [[h0]];
+ With:
+ h1, age = 36;
+ modify:
+ otnRight1, [h1];
+ not1:
+ leftMemory, []; // h0 is removed from here, as it's blocked
+ rightMemory, [h1];
+ join2:
+ leftMemory, [];
+ With:
+ h1, age = 35;
+ modify:
+ otnRight1, [h1];
+ not1:
+ leftMemory, [[h0]]; // h0 is back again, as it's no longer blocked
+ rightMemory, [h1];
+ join2:
+ leftMemory, [[h0]];
+ retract:
+ otnLeft1, [h0];
+ otnRight1, [h1];
+
+
+ /**
+ * check two left, two right
+ */
+ assert:
+ otnRight1, [h6];
+ assert:
+ otnLeft1, [h0, h1];
+ not1:
+ leftMemory, []; // memory is empty as h0 and h1 are blocked
+ join2:
+ leftMemory, [];
+ assert:
+ otnRight1, [h7];
+ With:
+ h6, age = 35;
+ modify:
+ otnRight1, [h6]; // h7 still blocks h0 and h1
+ not1:
+ leftMemory, [];
+ join2:
+ leftMemory, [];
+ With:
+ h7, age = 35;
+ modify:
+ otnRight1, [h7]; // h0 and h1 should now be unblocked
+ not1:
+ leftMemory, [[h0], [h1]]; // h0 and h1 appear back in memory
+ join2:
+ leftMemory, [[h0], [h1]];
+ With:
+ h6, age = 36;
+ modify:
+ otnRight1, [h6];
+ not1:
+ leftMemory, []; // h6 blocks both
+ join2:
+ leftMemory, [];
+ With:
+ h0, age = 36;
+ modify:
+ otnLeft1, [h0]; // h0 is now blocked by h7, while h1 remains blocked by h6
+ not1:
+ leftMemory, []; // remains empty
+ join2:
+ leftMemory, [];
+ With:
+ h0, age = 36;
+ h7, age = 36;
+ modify:
+ otnLeft1, [h0]; // h0 is no longer blocked
+ not1:
+ leftMemory, [[h0]];
+ join2:
+ leftMemory, [[h0]];
\ No newline at end of file
More information about the jboss-svn-commits
mailing list