[teiid-commits] teiid SVN: r1702 - in trunk/engine/src/test/java: org/teiid/dqp/internal/process and 1 other directory.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Wed Dec 23 12:10:18 EST 2009


Author: shawkins
Date: 2009-12-23 12:10:18 -0500 (Wed, 23 Dec 2009)
New Revision: 1702

Modified:
   trunk/engine/src/test/java/com/metamatrix/query/processor/batch/TestBatchedUpdatePlan.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
Log:
TEIID-911 consolidating fake processing plans

Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/batch/TestBatchedUpdatePlan.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/processor/batch/TestBatchedUpdatePlan.java	2009-12-23 16:52:32 UTC (rev 1701)
+++ trunk/engine/src/test/java/com/metamatrix/query/processor/batch/TestBatchedUpdatePlan.java	2009-12-23 17:10:18 UTC (rev 1702)
@@ -24,30 +24,20 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
-import java.util.Map;
 
 import junit.framework.TestCase;
 
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.common.buffer.BlockedException;
-import com.metamatrix.common.buffer.BufferManager;
 import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.common.buffer.TupleSource;
-import com.metamatrix.query.processor.ProcessorDataManager;
-import com.metamatrix.query.processor.ProcessorPlan;
-import com.metamatrix.query.util.CommandContext;
+import com.metamatrix.query.processor.FakeProcessorPlan;
 
 
 /** 
  * @since 4.2
  */
 public class TestBatchedUpdatePlan extends TestCase {
-    private int plansOpened = 0;
-    private int nextBatchesCalled = 0;
-    public TestBatchedUpdatePlan(String name) {
+
+	public TestBatchedUpdatePlan(String name) {
         super(name);
     }
     
@@ -75,7 +65,7 @@
         plan.open();
         // First plan may or may not be opened, but all subsequent plans should not be opened.
         for (int i = 1; i < plans.length; i++) {
-            assertFalse(plans[i].opened);
+            assertFalse(plans[i].isOpened());
         }
     }
 
@@ -91,38 +81,4 @@
         helpTestNextBatch(new int[] {1, 1, 1, 1});
     }
     
-    private class FakeProcessorPlan extends ProcessorPlan {
-        private int counts = 0;
-        private boolean opened = false;
-        private int updateConnectorCount = 1;
-        private FakeProcessorPlan(int commands) {
-            counts = commands;
-        }       
-        public FakeProcessorPlan clone() {return null;}
-        public void close() throws MetaMatrixComponentException {}
-        public void connectTupleSource(TupleSource source, int dataRequestID) {}
-        public List getOutputElements() {return null;}
-        public int getUpdateCount() {return updateConnectorCount;}
-        public void initialize(CommandContext context, ProcessorDataManager dataMgr, BufferManager bufferMgr) {}
-        public TupleBatch nextBatch() throws BlockedException, MetaMatrixComponentException {
-            nextBatchesCalled++;
-            assertTrue(opened);
-            assertTrue(nextBatchesCalled == plansOpened);
-            List[] rows = new List[counts];
-            for (int i = 0; i < counts; i++) {
-                rows[i] = Arrays.asList(new Object[] {new Integer(1)});
-            }
-            TupleBatch batch = new TupleBatch(1, rows);
-            batch.setTerminationFlag(true);
-            return batch;
-        }
-        public void open() throws MetaMatrixComponentException {
-            assertFalse("ProcessorPlan.open() should not be called more than once", opened); //$NON-NLS-1$
-            opened = true;
-            plansOpened++;
-        }
-        public Map getDescriptionProperties() {return null;}
-        public Collection getChildPlans() {return Collections.EMPTY_LIST;}
-        
-    }
 }

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java	2009-12-23 16:52:32 UTC (rev 1701)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java	2009-12-23 17:10:18 UTC (rev 1702)
@@ -22,11 +22,8 @@
 
 package org.teiid.dqp.internal.process;
 
-import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
-import java.util.Map;
 import java.util.Properties;
 
 import junit.framework.TestCase;
@@ -39,9 +36,6 @@
 import com.metamatrix.common.application.ApplicationEnvironment;
 import com.metamatrix.common.application.exception.ApplicationInitializationException;
 import com.metamatrix.common.application.exception.ApplicationLifecycleException;
-import com.metamatrix.common.buffer.BlockedException;
-import com.metamatrix.common.buffer.BufferManager;
-import com.metamatrix.common.buffer.TupleBatch;
 import com.metamatrix.common.comm.api.ResultsReceiver;
 import com.metamatrix.common.config.api.ConnectorBinding;
 import com.metamatrix.dqp.internal.datamgr.ConnectorID;
@@ -61,8 +55,6 @@
 import com.metamatrix.query.optimizer.capabilities.DefaultCapabilitiesFinder;
 import com.metamatrix.query.optimizer.capabilities.SourceCapabilities;
 import com.metamatrix.query.parser.QueryParser;
-import com.metamatrix.query.processor.ProcessorDataManager;
-import com.metamatrix.query.processor.ProcessorPlan;
 import com.metamatrix.query.processor.dynamic.SimpleQueryProcessorFactory;
 import com.metamatrix.query.resolver.QueryResolver;
 import com.metamatrix.query.sql.lang.Command;
@@ -316,23 +308,6 @@
         }
     }
     
-    private static class FakeProcessorPlan extends ProcessorPlan {
-        public FakeProcessorPlan clone() {return this;}
-        public void close() throws MetaMatrixComponentException {}
-        public List getOutputElements() {return Collections.EMPTY_LIST;}
-        public void initialize(CommandContext context,ProcessorDataManager dataMgr,BufferManager bufferMgr) {}
-        public TupleBatch nextBatch() throws BlockedException,MetaMatrixComponentException {
-        	ArrayList one = new ArrayList(); one.add("1");
-        	ArrayList two = new ArrayList(); two.add("2");
-        	List[] results = {one, two};
-        	return new TupleBatch(1, results);
-        }
-        public void open() throws MetaMatrixComponentException {}
-        public void reset() {}
-        public Map getDescriptionProperties() {return null;}
-        public Collection getChildPlans() { return Collections.EMPTY_LIST; }
-    }
-
     private static class FakeDataService implements DataService {
         private int failOnCall = 10000;
         private int calls = 0;



More information about the teiid-commits mailing list