[teiid-commits] teiid SVN: r1116 - trunk/engine/src/test/java/com/metamatrix/query/processor/proc.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Fri Jul 10 12:05:18 EDT 2009


Author: shawkins
Date: 2009-07-10 12:05:15 -0400 (Fri, 10 Jul 2009)
New Revision: 1116

Modified:
   trunk/engine/src/test/java/com/metamatrix/query/processor/proc/TestProcedureProcessor.java
Log:
updating reference unit tests

Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/proc/TestProcedureProcessor.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/processor/proc/TestProcedureProcessor.java	2009-07-10 16:03:48 UTC (rev 1115)
+++ trunk/engine/src/test/java/com/metamatrix/query/processor/proc/TestProcedureProcessor.java	2009-07-10 16:05:15 UTC (rev 1116)
@@ -53,10 +53,12 @@
 import com.metamatrix.query.mapping.relational.QueryNode;
 import com.metamatrix.query.metadata.TempMetadataID;
 import com.metamatrix.query.optimizer.QueryOptimizer;
-import com.metamatrix.query.optimizer.capabilities.BasicSourceCapabilities;
+import com.metamatrix.query.optimizer.TestOptimizer;
+import com.metamatrix.query.optimizer.capabilities.AllCapabilities;
 import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
 import com.metamatrix.query.optimizer.capabilities.DefaultCapabilitiesFinder;
 import com.metamatrix.query.optimizer.capabilities.FakeCapabilitiesFinder;
+import com.metamatrix.query.optimizer.capabilities.SourceCapabilities;
 import com.metamatrix.query.parser.QueryParser;
 import com.metamatrix.query.processor.FakeDataManager;
 import com.metamatrix.query.processor.ProcessorDataManager;
@@ -2711,7 +2713,7 @@
      *  
      * @throws Exception
      */
-    public void testRomvalOfNonJoinCritWithReference() throws Exception {
+    public void testRemovalOfNonJoinCritWithReference() throws Exception {
     	String proc = ""; //$NON-NLS-1$
     	
         String sql = ""; //$NON-NLS-1$
@@ -2755,7 +2757,7 @@
      *  
      * @throws Exception
      */
-    public void testRomvalOfNonJoinCritWithReference2() throws Exception {
+    public void testRemovalOfNonJoinCritWithReference2() throws Exception {
     	String proc = ""; //$NON-NLS-1$
     	
         String sql = ""; //$NON-NLS-1$
@@ -2775,80 +2777,11 @@
         		"   declare integer myVar = 5;" + //$NON-NLS-1$
         		"   " + sql + ";" + //$NON-NLS-1$ //$NON-NLS-2$
         		"END"; //$NON-NLS-1$
-        	
-        FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
-        BasicSourceCapabilities caps = new BasicSourceCapabilities() {
-            public boolean supportsCapability(String capability) {
-                return true;
-            }
-            public boolean supportsFunction(String functionName) {
-                return true;
-            }
-        };
-        capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
-        capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
-        
-        FakeMetadataFacade metadata = createProcedureMetadata(proc);
-        String userQuery = "SELECT * FROM (EXEC pm1.sq1()) as proc"; //$NON-NLS-1$
-        FakeDataManager dataMgr = exampleDataManager2(metadata);
-        ProcessorPlan plan = getProcedurePlan(userQuery, metadata, capFinder);
 
-        List[] expected = new List[] {
-                Arrays.asList( new Object[] { "First", "First", new Integer(5), new Integer(5)} ), //$NON-NLS-1$ //$NON-NLS-2$
-                Arrays.asList( new Object[] { "Second", null, new Integer(15), null} ), //$NON-NLS-1$
-                Arrays.asList( new Object[] { "Third", null, new Integer(51), null} ) //$NON-NLS-1$
-        };
-        helpTestProcess(plan, expected, dataMgr);
-    }
-    
-    /**
-     * Test the use of a procedure variable in the criteria of a LEFT OUTER
-     * JOIN which will be optimized out as non-JOIN criteria.
-     * <p>
-     * This test case verifies that the procedure variable will not be pushed 
-     * to the data manager when a JOIN of a temporary table and source are 
-     * performed and the physical source supports all capabilities. 
-     *  
-     * @throws Exception
-     */
-    public void testRomvalOfNonJoinCritWithReference3() throws Exception {
-    	String proc = ""; //$NON-NLS-1$
-    	
-        String sql = ""; //$NON-NLS-1$
-        sql += "SELECT " +  //$NON-NLS-1$
-        		"	#temp1.e1 AS pm1g1e1, " +  //$NON-NLS-1$
-        		"	pm2.g2.e1 AS pm2g2e1, " +  //$NON-NLS-1$
-        		"	#temp1.e2 AS pm1g1e2, " +  //$NON-NLS-1$
-        		"	pm2.g2.e2 AS pm2g2e2 " +  //$NON-NLS-1$
-        		"FROM " +  //$NON-NLS-1$
-        		"	#temp1	" +  //$NON-NLS-1$
-        		"LEFT OUTER JOIN pm2.g2 " +  //$NON-NLS-1$
-        		"	ON #temp1.e1 = pm2.g2.e1 " +  //$NON-NLS-1$ 
-        		"	AND pm2.g2.e2 = VARIABLES.myVar ";  //$NON-NLS-1$
-        
-        proc += "CREATE VIRTUAL PROCEDURE " + //$NON-NLS-1$
-        		"BEGIN " + //$NON-NLS-1$
-        		"   declare integer myVar = 5;" + //$NON-NLS-1$
-        		"	SELECT * INTO #temp1 FROM pm1.g1;" + //$NON-NLS-1$
-        		"   " + sql + ";" + //$NON-NLS-1$ //$NON-NLS-2$
-        		"END"; //$NON-NLS-1$
-        	
-        FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
-        BasicSourceCapabilities caps = new BasicSourceCapabilities() {
-            public boolean supportsCapability(String capability) {
-                return true;
-            }
-            public boolean supportsFunction(String functionName) {
-                return true;
-            }
-        };
-        capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
-        capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
-        
         FakeMetadataFacade metadata = createProcedureMetadata(proc);
         String userQuery = "SELECT * FROM (EXEC pm1.sq1()) as proc"; //$NON-NLS-1$
         FakeDataManager dataMgr = exampleDataManager2(metadata);
-        ProcessorPlan plan = getProcedurePlan(userQuery, metadata, capFinder);
+        ProcessorPlan plan = getProcedurePlan(userQuery, metadata, TestOptimizer.getGenericFinder());
 
         List[] expected = new List[] {
                 Arrays.asList( new Object[] { "First", "First", new Integer(5), new Integer(5)} ), //$NON-NLS-1$ //$NON-NLS-2$




More information about the teiid-commits mailing list