[teiid-commits] teiid SVN: r490 - in trunk: adminshell and 1 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue Feb 24 11:41:35 EST 2009


Author: shawkins
Date: 2009-02-24 11:41:35 -0500 (Tue, 24 Feb 2009)
New Revision: 490

Added:
   trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/Util.java
Removed:
   trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestHelper.java
Modified:
   trunk/adminshell/pom.xml
   trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestMultiFileTextSynchExecution.java
   trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestRowHeaderTextSynchExecution.java
   trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestTextSynchExecution.java
   trunk/pom.xml
Log:
TEIID-380 upgrade to junit 4.4

Modified: trunk/adminshell/pom.xml
===================================================================
--- trunk/adminshell/pom.xml	2009-02-24 16:16:49 UTC (rev 489)
+++ trunk/adminshell/pom.xml	2009-02-24 16:41:35 UTC (rev 490)
@@ -29,6 +29,7 @@
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
+      <version>3.8.1</version>
     </dependency>
   </dependencies>
 </project>
\ No newline at end of file

Deleted: trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestHelper.java
===================================================================
--- trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestHelper.java	2009-02-24 16:16:49 UTC (rev 489)
+++ trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestHelper.java	2009-02-24 16:41:35 UTC (rev 490)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.connector.text;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.List;
-import java.util.Properties;
-
-import junit.framework.Assert;
-
-import com.metamatrix.cdk.api.ConnectorHost;
-import com.metamatrix.cdk.unittest.FakeTranslationFactory;
-import com.metamatrix.core.util.UnitTestUtil;
-
-public class TestHelper {
-
-	static void helpTestExecution(String vdb, String descriptorFile, String sql, int maxBatchSize, int expectedRowCount) throws Exception {
-		descriptorFile = UnitTestUtil.getTestDataPath() + File.separator + descriptorFile;
-		Properties connProps = new Properties();
-		connProps.load(new FileInputStream(descriptorFile));
-	    connProps.put(TextPropertyNames.DESCRIPTOR_FILE, descriptorFile);
-	    connProps.put(TextPropertyNames.DATE_RESULT_FORMATS, "yyyy-MM-dd,hh:mm:ss,hh:mm,dd/mm/yyyy"); //$NON-NLS-1$
-	    connProps.put(TextPropertyNames.DATE_RESULT_FORMATS_DELIMITER, ","); //$NON-NLS-1$
-	    ConnectorHost host = new ConnectorHost(new TextConnector(), connProps, UnitTestUtil.getTestDataPath() + File.separator + vdb, false);
-	    List results = host.executeCommand(sql);
-	    Assert.assertEquals("Total row count doesn't match expected size. ", expectedRowCount, results.size()); //$NON-NLS-1$
-	}
-
-	public static ConnectorHost getConnectorHostWithFakeMetadata(String descriptorFile) throws Exception {
-		Properties connProps = new Properties();
-		connProps.load(new FileInputStream(descriptorFile));
-	    connProps.put(TextPropertyNames.DESCRIPTOR_FILE, descriptorFile);
-	    connProps.put(TextPropertyNames.COLUMN_CNT_MUST_MATCH_MODEL, "true");
-	    connProps.put(TextPropertyNames.DATE_RESULT_FORMATS, "yyyy-MM-dd,hh:mm:ss,hh:mm,dd/mm/yyyy"); //$NON-NLS-1$
-	    connProps.put(TextPropertyNames.DATE_RESULT_FORMATS_DELIMITER, ","); //$NON-NLS-1$
-	    ConnectorHost host = new ConnectorHost(new TextConnector(), connProps, FakeTranslationFactory.getInstance().getTextTranslationUtility(), false);
-	    return host;
-	}
-
-}

Modified: trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestMultiFileTextSynchExecution.java
===================================================================
--- trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestMultiFileTextSynchExecution.java	2009-02-24 16:16:49 UTC (rev 489)
+++ trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestMultiFileTextSynchExecution.java	2009-02-24 16:41:35 UTC (rev 490)
@@ -45,7 +45,7 @@
     public void testSubmitRequest() throws Exception {
         String sql = "SELECT ID FROM Library"; //$NON-NLS-1$
         try {
-        	TestHelper.getConnectorHostWithFakeMetadata(BAD_COUNT_FILE).executeCommand(sql);
+        	Util.getConnectorHostWithFakeMetadata(BAD_COUNT_FILE).executeCommand(sql);
             fail("Should have failed due to extra column defined in .csv file");//$NON-NLS-1$
         } catch (ConnectorException e) {
             assertEquals("Expected input file to have 3 columns based on model, but found 4.  This could be caused by misplaced quotes, causing multiple columns to be treated as one.", e.getMessage()); //$NON-NLS-1$
@@ -55,7 +55,7 @@
     public void testNextBatch3() throws Exception {
         String sql = "SELECT ID FROM Library WHERE Author = 'Blind'"; //$NON-NLS-1$
         try {
-        	TestHelper.getConnectorHostWithFakeMetadata(BAD_COUNT_FILE).executeCommand(sql);
+        	Util.getConnectorHostWithFakeMetadata(BAD_COUNT_FILE).executeCommand(sql);
             fail("Should have failed due to extra column defined in .csv file");//$NON-NLS-1$
         } catch (ConnectorException e) {
             assertEquals("Expected input file to have 3 columns based on model, but found 4.  This could be caused by misplaced quotes, causing multiple columns to be treated as one.", e.getMessage()); //$NON-NLS-1$
@@ -64,7 +64,7 @@
         
     public void testNextBatch2() throws Exception {
         String sql = "SELECT ID, PDate, Author FROM Library"; //$NON-NLS-1$
-        ConnectorHost host = TestHelper.getConnectorHostWithFakeMetadata(DEFAULT_DESC_FILE);
+        ConnectorHost host = Util.getConnectorHostWithFakeMetadata(DEFAULT_DESC_FILE);
         int expectedRows = 4;
         List results = host.executeCommand(sql);
         assertEquals("Get batch size doesn't match expected one. ", expectedRows, results.size()); //$NON-NLS-1$
@@ -102,7 +102,7 @@
      */
     public void testDefect13066() throws Exception {
         String sql = "SELECT TRADEID FROM SummitData.SUMMITDATA"; //$NON-NLS-1$
-        TestHelper.helpTestExecution("summitData/TextFileTest_1.vdb", "SummitData_Descriptor.txt", sql, 500, 4139); //$NON-NLS-1$ //$NON-NLS-2$
+        Util.helpTestExecution("summitData/TextFileTest_1.vdb", "SummitData_Descriptor.txt", sql, 500, 4139); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
     /**
@@ -112,7 +112,7 @@
      */
     public void testDefect13368() throws Exception {
         String sql = "SELECT RATE, DESK FROM SummitData.SUMMITDATA"; //$NON-NLS-1$
-        TestHelper.helpTestExecution("summitData/TextFileTest_1.vdb", "SummitData_Descriptor.txt", sql, 5, 4139); //$NON-NLS-1$ //$NON-NLS-2$
+        Util.helpTestExecution("summitData/TextFileTest_1.vdb", "SummitData_Descriptor.txt", sql, 5, 4139); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
     /**
@@ -122,18 +122,18 @@
      */
     public void testDefect13371() throws Exception {
         String sql = "  SELECT SUMMITEXTRACTCDM.START, SUMMITEXTRACTCDM.SUMMIT_ID, SUMMITEXTRACTCDM.CURRENCY, SUMMITEXTRACTCDM.AMOUNT, SUMMITEXTRACTCDM.MATURITY, SUMMITEXTRACTCDM.RATE, SUMMITEXTRACTCDM.DESK, SUMMITEXTRACTCDM.CDM_ID FROM SUMMITEXTRACTCDM"; //$NON-NLS-1$
-        TestHelper.helpTestExecution("summitData/TextFiles.vdb", "SummitExtractCDM_Descriptor.txt", sql, 500, 52); //$NON-NLS-1$ //$NON-NLS-2$
+        Util.helpTestExecution("summitData/TextFiles.vdb", "SummitExtractCDM_Descriptor.txt", sql, 500, 52); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
     public void testDefect11402() throws Exception {
         String sql = "SELECT Part_ID, Part_Name, Part_Color, Part_Weight from PARTS.PARTS";  //$NON-NLS-1$
-        TestHelper.helpTestExecution("TextParts/TextParts.vdb", "/TextParts/PartsDescriptor.txt", sql, 15000, 21); //$NON-NLS-1$ //$NON-NLS-2$
+        Util.helpTestExecution("TextParts/TextParts.vdb", "/TextParts/PartsDescriptor.txt", sql, 15000, 21); //$NON-NLS-1$ //$NON-NLS-2$
     }
         
     /** test case 4151 */
     public void testCase4151() throws Exception {
         String sql = "SELECT COLA, COLB, COLC FROM ThreeColString_Text.testfile"; //$NON-NLS-1$
-        TestHelper.helpTestExecution("case4151/MM_00004151.vdb", "testfile-descriptor.txt", sql, 15000, 5); //$NON-NLS-1$ //$NON-NLS-2$
+        Util.helpTestExecution("case4151/MM_00004151.vdb", "testfile-descriptor.txt", sql, 15000, 5); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
 }

Modified: trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestRowHeaderTextSynchExecution.java
===================================================================
--- trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestRowHeaderTextSynchExecution.java	2009-02-24 16:16:49 UTC (rev 489)
+++ trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestRowHeaderTextSynchExecution.java	2009-02-24 16:41:35 UTC (rev 490)
@@ -40,7 +40,7 @@
      */
     public void testRowHeader() throws Exception {
         String sql = "SELECT Part_ID, Part_Name, Part_Color, Part_Weight from PARTS.PARTS";  //$NON-NLS-1$
-        TestHelper.helpTestExecution("TextParts/TextParts.vdb", "TextParts/PartsDescriptor.txt", sql, 15000, 21); //$NON-NLS-1$ //$NON-NLS-2$
+        Util.helpTestExecution("TextParts/TextParts.vdb", "TextParts/PartsDescriptor.txt", sql, 15000, 21); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
     /**
@@ -50,7 +50,7 @@
      */
     public void testRowHeader2() throws Exception {
         String sql = "SELECT Part_ID, Part_Name, Part_Color, Part_Weight from PARTS.PARTS_NoNameInSource";  //$NON-NLS-1$
-        TestHelper.helpTestExecution("TextParts/TextParts.vdb", "TextParts/PartsDescriptor.txt", sql, 15000, 21); //$NON-NLS-1$ //$NON-NLS-2$
+        Util.helpTestExecution("TextParts/TextParts.vdb", "TextParts/PartsDescriptor.txt", sql, 15000, 21); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
     /** 
@@ -60,7 +60,7 @@
      */
     public void testRowHeader3() throws Exception {
         String sql = "SELECT Part_ID, Part_Name, Part_Color, Part_Weight from PARTS.PARTS_AlphaNameInSource";  //$NON-NLS-1$
-        TestHelper.helpTestExecution("TextParts/TextParts.vdb", "TextParts/PartsDescriptor.txt", sql, 15000, 21); //$NON-NLS-1$ //$NON-NLS-2$
+        Util.helpTestExecution("TextParts/TextParts.vdb", "TextParts/PartsDescriptor.txt", sql, 15000, 21); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
     /**
@@ -71,7 +71,7 @@
      */
     public void testRowHeader4() throws Exception {
         String sql = "SELECT Part_ID, Part_Name, Part_Color, Part_Weight from PARTS.PARTS_AlphaDiffNameInSource";  //$NON-NLS-1$
-        TestHelper.helpTestExecution("TextParts/TextParts.vdb", "TextParts/PartsDescriptor.txt", sql, 15000, 21); //$NON-NLS-1$ //$NON-NLS-2$
+        Util.helpTestExecution("TextParts/TextParts.vdb", "TextParts/PartsDescriptor.txt", sql, 15000, 21); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
     /**
@@ -81,7 +81,7 @@
      */
     public void testRowHeader5() throws Exception {
         String sql = "SELECT Part_ID, Part_Name, Part_Color, Part_Weight from PARTS.PARTS_NoNameInSource";  //$NON-NLS-1$
-        TestHelper.helpTestExecution("TextParts/TextParts.vdb", "TextParts/PartsDescriptor_HeaderRowTest.txt", sql, 15000, 21); //$NON-NLS-1$ //$NON-NLS-2$
+        Util.helpTestExecution("TextParts/TextParts.vdb", "TextParts/PartsDescriptor_HeaderRowTest.txt", sql, 15000, 21); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
     /**
@@ -91,7 +91,7 @@
      */
     public void testRowHeader6() throws Exception {
         String sql = "SELECT Part_ID, Part_Name, Part_Color, Part_Weight from PARTS.PARTS_AlphaDiffNameInSource";  //$NON-NLS-1$
-        TestHelper.helpTestExecution("TextParts/TextParts.vdb", "TextParts/PartsDescriptor_HeaderRowTest.txt", sql, 15000, 21); //$NON-NLS-1$ //$NON-NLS-2$
+        Util.helpTestExecution("TextParts/TextParts.vdb", "TextParts/PartsDescriptor_HeaderRowTest.txt", sql, 15000, 21); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
     /**
@@ -101,7 +101,7 @@
      */
     public void testRowHeader7() throws Exception {
         String sql = "SELECT Part_ID, Part_Name, Part_Color, Part_Weight from PARTS.PARTS_NoNameInSource";  //$NON-NLS-1$
-        TestHelper.helpTestExecution("TextParts/TextParts.vdb", "TextParts/PartsDescriptor3.txt", sql, 15000, 21); //$NON-NLS-1$ //$NON-NLS-2$
+        Util.helpTestExecution("TextParts/TextParts.vdb", "TextParts/PartsDescriptor3.txt", sql, 15000, 21); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
     /**
@@ -111,7 +111,7 @@
      */
     public void testRowHeader8() throws Exception {
         String sql = "SELECT Part_ID, Part_Name, Part_Color, Part_Weight from PARTS.PARTS_SpaceNameInSource";  //$NON-NLS-1$
-        TestHelper.helpTestExecution("TextParts/TextParts.vdb", "TextParts/PartsDescriptor4.txt", sql, 15000, 21); //$NON-NLS-1$ //$NON-NLS-2$
+        Util.helpTestExecution("TextParts/TextParts.vdb", "TextParts/PartsDescriptor4.txt", sql, 15000, 21); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
     /**
@@ -123,7 +123,7 @@
     public void testRowHeader_Error() throws Exception {
         String sql = "SELECT Part_ID, Part_Name, Part_Color, Part_Weight from PARTS.PARTS_AlphaNameInSource";  //$NON-NLS-1$
         try {
-            TestHelper.helpTestExecution("TextParts/TextParts.vdb", "TextParts/PartsDescriptor4.txt", sql, 15000, 21); //$NON-NLS-1$ //$NON-NLS-2$
+            Util.helpTestExecution("TextParts/TextParts.vdb", "TextParts/PartsDescriptor4.txt", sql, 15000, 21); //$NON-NLS-1$ //$NON-NLS-2$
             fail("Should have received ConnectorException due to an invalid header row being defined."); //$NON-NLS-1$
         } catch (ConnectorException ce ) {
         	assertEquals("'SELECT PARTS_AlphaNameInSource.Part_Id, PARTS_AlphaNameInSource.Part_Name, PARTS_AlphaNameInSource.Part_Color, PARTS_AlphaNameInSource.Part_Weight FROM PARTS_AlphaNameInSource' cannot be translated by the TextTranslator. Column Part_Id not found for element Parts.PARTS_AlphaNameInSource.Part_Id.  Verify column name \"Part_Id\" is defined in the header row of the text file and that the header row number is correctly defined in the descriptor file.", ce.getMessage()); //$NON-NLS-1$
@@ -140,7 +140,7 @@
      */
     public void testRowHeader_Error2() throws Exception {
         String sql = "SELECT Part_ID, Part_Name, Part_Color, Part_Weight from PARTS.PARTS_NoNameInSource";  //$NON-NLS-1$
-        TestHelper.helpTestExecution("TextParts/TextParts.vdb", "TextParts/PartsDescriptor4.txt", sql, 15000, 21); //$NON-NLS-1$ //$NON-NLS-2$
+        Util.helpTestExecution("TextParts/TextParts.vdb", "TextParts/PartsDescriptor4.txt", sql, 15000, 21); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
 }

Modified: trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestTextSynchExecution.java
===================================================================
--- trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestTextSynchExecution.java	2009-02-24 16:16:49 UTC (rev 489)
+++ trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestTextSynchExecution.java	2009-02-24 16:41:35 UTC (rev 490)
@@ -45,7 +45,7 @@
 
     public void testNextBatch2() throws Exception {
         String sql = "SELECT ID, PDate, Author FROM Library"; //$NON-NLS-1$
-        ConnectorHost host = TestHelper.getConnectorHostWithFakeMetadata(DEFAULT_DESC_FILE);
+        ConnectorHost host = Util.getConnectorHostWithFakeMetadata(DEFAULT_DESC_FILE);
         int expectedRows = 2;
         List results = host.executeCommand(sql);
         assertEquals("Get batch size doesn't match expected one. ", expectedRows, results.size()); //$NON-NLS-1$
@@ -76,7 +76,7 @@
      */
     public void testDefect13066() throws Exception {
         String sql = "SELECT TRADEID FROM SummitData.SUMMITDATA"; //$NON-NLS-1$
-        TestHelper.helpTestExecution("summitData/TextFileTest_1.vdb", "SummitData_Descriptor.txt", sql, 500, 4139); //$NON-NLS-1$
+        Util.helpTestExecution("summitData/TextFileTest_1.vdb", "SummitData_Descriptor.txt", sql, 500, 4139); //$NON-NLS-1$
     }
     
     /**
@@ -86,7 +86,7 @@
      */
     public void testDefect13368() throws Exception {
         String sql = "SELECT RATE, DESK FROM SummitData.SUMMITDATA"; //$NON-NLS-1$
-        TestHelper.helpTestExecution("summitData/TextFileTest_1.vdb", "SummitData_Descriptor.txt", sql, 5, 4139); //$NON-NLS-1$
+        Util.helpTestExecution("summitData/TextFileTest_1.vdb", "SummitData_Descriptor.txt", sql, 5, 4139); //$NON-NLS-1$
     }
     
     /**
@@ -96,18 +96,18 @@
      */
     public void testDefect13371() throws Exception {
         String sql = "  SELECT SUMMITEXTRACTCDM.START, SUMMITEXTRACTCDM.SUMMIT_ID, SUMMITEXTRACTCDM.CURRENCY, SUMMITEXTRACTCDM.AMOUNT, SUMMITEXTRACTCDM.MATURITY, SUMMITEXTRACTCDM.RATE, SUMMITEXTRACTCDM.DESK, SUMMITEXTRACTCDM.CDM_ID FROM SUMMITEXTRACTCDM"; //$NON-NLS-1$
-        TestHelper.helpTestExecution("summitData/TextFiles.vdb", "SummitExtractCDM_Descriptor.txt", sql, 500, 52); //$NON-NLS-1$
+        Util.helpTestExecution("summitData/TextFiles.vdb", "SummitExtractCDM_Descriptor.txt", sql, 500, 52); //$NON-NLS-1$
     }
 
     public void testDefect11402() throws Exception {
         String sql = "SELECT Part_ID, Part_Name, Part_Color, Part_Weight from PARTS.PARTS";  //$NON-NLS-1$
-        TestHelper.helpTestExecution("TextParts/TextParts.vdb", "/TextParts/PartsDescriptor.txt", sql, 15000, 21); //$NON-NLS-1$
+        Util.helpTestExecution("TextParts/TextParts.vdb", "/TextParts/PartsDescriptor.txt", sql, 15000, 21); //$NON-NLS-1$
     }
         
     /** test case 4151 */
     public void testCase4151() throws Exception {
         String sql = "SELECT COLA, COLB, COLC FROM ThreeColString_Text.testfile"; //$NON-NLS-1$
-        TestHelper.helpTestExecution("case4151/MM_00004151.vdb", "testfile-descriptor.txt", sql, 15000, 5); //$NON-NLS-1$
+        Util.helpTestExecution("case4151/MM_00004151.vdb", "testfile-descriptor.txt", sql, 15000, 5); //$NON-NLS-1$
     }
     
 }

Copied: trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/Util.java (from rev 486, trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestHelper.java)
===================================================================
--- trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/Util.java	                        (rev 0)
+++ trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/Util.java	2009-02-24 16:41:35 UTC (rev 490)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.connector.text;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.List;
+import java.util.Properties;
+
+import junit.framework.Assert;
+
+import com.metamatrix.cdk.api.ConnectorHost;
+import com.metamatrix.cdk.unittest.FakeTranslationFactory;
+import com.metamatrix.core.util.UnitTestUtil;
+
+public class Util {
+
+	static void helpTestExecution(String vdb, String descriptorFile, String sql, int maxBatchSize, int expectedRowCount) throws Exception {
+		descriptorFile = UnitTestUtil.getTestDataPath() + File.separator + descriptorFile;
+		Properties connProps = new Properties();
+		connProps.load(new FileInputStream(descriptorFile));
+	    connProps.put(TextPropertyNames.DESCRIPTOR_FILE, descriptorFile);
+	    connProps.put(TextPropertyNames.DATE_RESULT_FORMATS, "yyyy-MM-dd,hh:mm:ss,hh:mm,dd/mm/yyyy"); //$NON-NLS-1$
+	    connProps.put(TextPropertyNames.DATE_RESULT_FORMATS_DELIMITER, ","); //$NON-NLS-1$
+	    ConnectorHost host = new ConnectorHost(new TextConnector(), connProps, UnitTestUtil.getTestDataPath() + File.separator + vdb, false);
+	    List results = host.executeCommand(sql);
+	    Assert.assertEquals("Total row count doesn't match expected size. ", expectedRowCount, results.size()); //$NON-NLS-1$
+	}
+
+	public static ConnectorHost getConnectorHostWithFakeMetadata(String descriptorFile) throws Exception {
+		Properties connProps = new Properties();
+		connProps.load(new FileInputStream(descriptorFile));
+	    connProps.put(TextPropertyNames.DESCRIPTOR_FILE, descriptorFile);
+	    connProps.put(TextPropertyNames.COLUMN_CNT_MUST_MATCH_MODEL, "true");
+	    connProps.put(TextPropertyNames.DATE_RESULT_FORMATS, "yyyy-MM-dd,hh:mm:ss,hh:mm,dd/mm/yyyy"); //$NON-NLS-1$
+	    connProps.put(TextPropertyNames.DATE_RESULT_FORMATS_DELIMITER, ","); //$NON-NLS-1$
+	    ConnectorHost host = new ConnectorHost(new TextConnector(), connProps, FakeTranslationFactory.getInstance().getTextTranslationUtility(), false);
+	    return host;
+	}
+
+}


Property changes on: trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/Util.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml	2009-02-24 16:16:49 UTC (rev 489)
+++ trunk/pom.xml	2009-02-24 16:41:35 UTC (rev 490)
@@ -173,7 +173,7 @@
 		<dependency>
 			<groupId>junit</groupId>
 			<artifactId>junit</artifactId>
-			<version>3.8.1</version>
+			<version>4.4</version>
 			<scope>test</scope>
 		</dependency>
 		<dependency>
@@ -397,11 +397,6 @@
 				<version>3.0</version>
 			</dependency>
 			<dependency>
-				<groupId>junit</groupId>
-				<artifactId>junit</artifactId>
-				<version>3.8.1</version>
-			</dependency>
-			<dependency>
 				<groupId>org.jboss.netty</groupId>
 				<artifactId>netty</artifactId>
 				<version>3.0.2.GA</version>




More information about the teiid-commits mailing list