[teiid-commits] teiid SVN: r1652 - in trunk/test-integration/db/src/main/java/org/teiid/test: client/ctc and 1 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Fri Dec 11 17:46:22 EST 2009


Author: vhalbert at redhat.com
Date: 2009-12-11 17:46:22 -0500 (Fri, 11 Dec 2009)
New Revision: 1652

Modified:
   trunk/test-integration/db/src/main/java/org/teiid/test/client/TestClient.java
   trunk/test-integration/db/src/main/java/org/teiid/test/client/TestClientTransaction.java
   trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/XMLExpectedResults.java
   trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java
   trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionQueryTestCase.java
Log:
Teiid 781 - changes to support running from hudson

Modified: trunk/test-integration/db/src/main/java/org/teiid/test/client/TestClient.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/client/TestClient.java	2009-12-11 20:52:34 UTC (rev 1651)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/client/TestClient.java	2009-12-11 22:46:22 UTC (rev 1652)
@@ -103,89 +103,10 @@
 	
     }
  
-//    private void testScenarios() throws Exception {
-//	
-//	
-////	String teiid_home = deployProperties.getProperty("teiid.home");
-////	File f = new File(teiid_home);
-////	if (f.exists() && f.isDirectory()) {
-////	    FileUtils.removeDirectoryAndChildren(f);
-////	}
-//	
-//	this.overrides = getSubstitutedProperties(ConfigPropertyLoader.getInstance().getProperties());
-//	
-//	ConfigPropertyLoader.getInstance().setProperties(this.overrides);
-//	
-//	String scenaios_dir = ConfigPropertyLoader.getInstance().getProperty(TestProperties.PROP_SCENARIO_DIR);
-//	if (scenaios_dir == null) {
-//	    throw new TransactionRuntimeException("scenariodir property was not defined");
-//	}
-//	
-//	File files[] = FileUtils.findAllFilesInDirectoryHavingExtension(scenaios_dir,
-//		".properties");
-//	if (files == null || files.length == 0)
-//	    throw new QueryTestFailedException((new StringBuilder()).append(
-//		    "No scenario files found in directory ").append(scenaios_dir)
-//		    .toString());
-//	
-//	
-//	// List<String> queryFiles = new ArrayList<String>(files.length);
-//	for (int i = 0; i < files.length; i++) {
-//	    // overrides need to be reset because all overrides are cleared out after each query set
-//	    ConfigPropertyLoader.getInstance().setProperties(overrides);
-//	    
-//	    runTest(files[i]);
-//	}
-//	
-//
-//    }
     
-//    private void runScenariox() throws Exception {
-//	String scenario_file = ConfigPropertyLoader.getInstance().getProperty(TestProperties.PROP_SCENARIO_FILE);
-//	if (scenario_file == null) {
-//	    throw new TransactionRuntimeException(TestProperties.PROP_SCENARIO_FILE + " property was not defined");
-//	}
-//	
-//	Properties sc_props = PropertiesUtils.load(scenario_file);
-//	Properties sc_updates = getSubstitutedProperties(sc_props);
-//	if (!sc_updates.isEmpty()) {
-//	    sc_props.putAll(sc_props);
-//	}	
-//	
-//	String scenario_name = FileUtils.getBaseFileNameWithoutExtension(scenario_file);
-//	
-//	TestLogger.log("Starting scenario " + scenario_name);
-//	
-//	this.overrides = getSubstitutedProperties(ConfigPropertyLoader.getInstance().getProperties());
-//
-//	
-//	// update the URL with the vdb that is to be used
-//	String url = ConfigPropertyLoader.getInstance().getProperty(DriverConnection.DS_URL);
-//	String vdb_name = ConfigPropertyLoader.getInstance().getProperty(DataSourceConnection.DS_DATABASENAME);
-//	
-//	Assert.assertNotNull(DataSourceConnection.DS_DATABASENAME + " property not set, need it for the vdb name", vdb_name);
-//	url = StringUtil.replace(url, "${vdb}", vdb_name);
-//	
-//	this.overrides.setProperty(DriverConnection.DS_URL, url);
-//	
-//	ConfigPropertyLoader.getInstance().setProperties(this.overrides);
-//	
-//	QueryScenario set = new CTCQueryScenario(scenario_name, ConfigPropertyLoader.getInstance().getProperties());
-//	
-//	TransactionContainer tc = getTransactionContainter();
-//
-//	runTestCase(set,  tc);
-//
-//	TestLogger.log("Completed scenario " + scenario_name);
-//
-//
-//    }
-    
-    
     private void runScenario() throws Exception {
 	
 	
-	
 	String scenario_file = ConfigPropertyLoader.getInstance().getProperty(TestProperties.PROP_SCENARIO_FILE);
 	if (scenario_file == null) {
 	    throw new TransactionRuntimeException(TestProperties.PROP_SCENARIO_FILE + " property was not defined");
@@ -273,8 +194,8 @@
             	    userTxn.init(querySetID, queryidentifier, sqlObject);
             	    
         	    // run test
-            	    
             	    tc.runTransaction(userTxn);
+
             	    
             	    testResults.add(userTxn.getTestResult());
 	             

Modified: trunk/test-integration/db/src/main/java/org/teiid/test/client/TestClientTransaction.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/client/TestClientTransaction.java	2009-12-11 20:52:34 UTC (rev 1651)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/client/TestClientTransaction.java	2009-12-11 22:46:22 UTC (rev 1652)
@@ -56,8 +56,6 @@
     private TestResult rs = null;
 
     private boolean errorExpected = false;
-
-    private Throwable resultException = null;
     
     private String sql = null;
 
@@ -81,7 +79,6 @@
 	rs = null;
 
 	errorExpected = false;
-	resultException = null;
 
     }
 
@@ -125,7 +122,7 @@
 	TestLogger.logDebug("expected error: " + this.errorExpected);
 
 	try {
-	    System.out.println("QueryID: " + this.querySetID + ":"
+	    System.out.println(this.querySet.getQueryScenarioIdentifier()  + ":" + this.querySetID + ":"
 		    + this.queryIdentifier);
 	    // need to set this so the underlying query execution handles an
 	    // error properly.
@@ -134,9 +131,8 @@
 	    execute(sql);
 
 	} catch (Throwable t) {
+	    this.setApplicationException(t);
 
-	    resultException = t;
-
 	} finally {
 	    // Capture resp time
 	    endTS = System.currentTimeMillis();
@@ -156,19 +152,26 @@
 	// this.internalResultSet;
 
 	ResultsGenerator genResults = this.querySet.getResultsGenerator();
+	
+	Throwable resultException = null;
 
 	resultException = (this.getLastException() != null ? this
-		.getLastException() : resultException);
+		    .getLastException() : this.getApplicationException());
 
+	    
+
 	if (resultException != null) {
-	    if (this.exceptionExpected()) {
-		testStatus = TestResult.RESULT_STATE.TEST_EXPECTED_EXCEPTION;
-	    } else {
-		testStatus = TestResult.RESULT_STATE.TEST_EXCEPTION;
-	    }
+		    if (this.exceptionExpected()) {
+			testStatus = TestResult.RESULT_STATE.TEST_EXPECTED_EXCEPTION;
+		    } else {
+			testStatus = TestResult.RESULT_STATE.TEST_EXCEPTION;
+		    }
 
 	}
 
+
+
+
 	if (this.querySet.getResultsMode().equalsIgnoreCase(
 		TestProperties.RESULT_MODES.COMPARE)) {
 	    if (testStatus != TestResult.RESULT_STATE.TEST_EXCEPTION) {
@@ -272,4 +275,7 @@
 
     }
 
+
+    
+
 }

Modified: trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/XMLExpectedResults.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/XMLExpectedResults.java	2009-12-11 20:52:34 UTC (rev 1651)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/XMLExpectedResults.java	2009-12-11 22:46:22 UTC (rev 1652)
@@ -162,7 +162,7 @@
 
 		            if (!expectedResults.isException()) {
 		                // The actual exception was expected, but the expected results was not
-		                throw new QueryTestFailedException(eMsg + "TThe actual exception was expected, but the Expected results wasn't an exception.  Actual exception: '" //$NON-NLS-1$
+		                throw new QueryTestFailedException(eMsg + "The actual result was an exception, but the Expected results wasn't an exception.  Actual exception: '" //$NON-NLS-1$
 		                                                   + actualException.getMessage() + "'"); //$NON-NLS-1$
 		            }
 		            // We got an exception that we expected - convert actual exception to ResultsHolder
@@ -198,7 +198,11 @@
 		            
 		            compareExceptions(actualResults, expectedResults, eMsg);
 
+			} else if (expectedResults.isException()) {
 
+		                throw new QueryTestFailedException(eMsg + "The Expected result was an exception, but the Actual results wasn't an exception.  Expected exception: '" //$NON-NLS-1$
+                                        + expectedResults.getExceptionMsg() + "'"); //$NON-NLS-1$
+			    
 				
 			} else {
 				

Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java	2009-12-11 20:52:34 UTC (rev 1651)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java	2009-12-11 22:46:22 UTC (rev 1652)
@@ -64,7 +64,6 @@
     protected void runTest(TransactionQueryTestCase test) {
 	debug("Start runTest: " + test.getTestName());
 
-	try {
 
 	    debug("	before(test)");
 
@@ -74,10 +73,32 @@
 	    test.before();
 
 	    debug("	test.testcase");
+	    
+	try {
 
+
 	    // run the test
 	    test.testCase();
+	    
+	} catch (Throwable e) {
 
+	    if (!test.exceptionExpected()) {
+		e.printStackTrace();
+		debug("Error: " + e.getMessage());
+		test.setApplicationException(e);
+ 
+	    }
+	}
+	
+	if (test.exceptionExpected() && !test.exceptionOccurred()) {
+	    TransactionRuntimeException t  = new TransactionRuntimeException(
+		    "Expected exception, but one did not occur for test: "
+			    + this.getClass().getName() + "."
+			    + test.getTestName());
+	    test.setApplicationException(t);
+	}
+
+
 	    debug("	test.after");
 
 	    test.after();
@@ -87,25 +108,9 @@
 
 	    debug("End runTest: " + test.getTestName());
 
-	} catch (TransactionRuntimeException tre) {    
-	    throw tre;
-	} catch (Throwable e) {
 
-	    if (!test.exceptionExpected()) {
-		e.printStackTrace();
-		debug("Error: " + e.getMessage());
-		throw new TransactionRuntimeException(e.getMessage());
 
-	    }
-	}
 
-	if (test.exceptionExpected() && !test.exceptionOccurred()) {
-	    throw new TransactionRuntimeException(
-		    "Expected exception, but one did not occur for test: "
-			    + this.getClass().getName() + "."
-			    + test.getTestName());
-	}
-
     }
 
 

Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionQueryTestCase.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionQueryTestCase.java	2009-12-11 20:52:34 UTC (rev 1651)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionQueryTestCase.java	2009-12-11 22:46:22 UTC (rev 1652)
@@ -135,15 +135,6 @@
     void setConnection(Connection conn);
 
     /**
-     * Called to set the properties used to initialize prior to execution.
-     * 
-     * @param props
-     * 
-     * @since
-     */
-//    void setExecutionProperties(Properties props);
-
-    /**
      * Override <code>before</code> if there is behavior that needs to be
      * performed prior to {@link #testCase()} being called.
      * 
@@ -203,5 +194,9 @@
     boolean exceptionExpected();
 
     boolean exceptionOccurred();
+    
+    void setApplicationException(Throwable t);
+    
+    Throwable getApplicationException();
 
 }



More information about the teiid-commits mailing list