teiid SVN: r2089 - trunk/test-integration/db/src/main/java/org/teiid/test/client.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2010-04-30 11:34:00 -0400 (Fri, 30 Apr 2010)
New Revision: 2089
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/client/TestResultsSummary.java
Log:
Teiid-773 - added the creation of a summary file that summarizes the total results for each scenario (successes, failures, total executed).
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/client/TestResultsSummary.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/client/TestResultsSummary.java 2010-04-30 15:33:14 UTC (rev 2088)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/client/TestResultsSummary.java 2010-04-30 15:34:00 UTC (rev 2089)
@@ -186,7 +186,7 @@
try {
overallsummary.write("================== \n"); //$NON-NLS-1$
- overallsummary.write("Test Summary"); //$NON-NLS-1$
+ overallsummary.write("Test Summary \n"); //$NON-NLS-1$
overallsummary.write("================== \n"); //$NON-NLS-1$
overallsummary
14 years, 7 months
teiid SVN: r2088 - trunk/test-integration/db/src/main/java/org/teiid/test/client.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2010-04-30 11:33:14 -0400 (Fri, 30 Apr 2010)
New Revision: 2088
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/client/TestResultsSummary.java
Log:
Teiid-773 - added the creation of a summary file that summarizes the total results for each scenario (successes, failures, total executed).
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/client/TestResultsSummary.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/client/TestResultsSummary.java 2010-04-30 14:24:40 UTC (rev 2087)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/client/TestResultsSummary.java 2010-04-30 15:33:14 UTC (rev 2088)
@@ -23,11 +23,14 @@
package org.teiid.test.client;
import java.io.BufferedOutputStream;
+import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
+import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
+import java.io.Writer;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
@@ -42,16 +45,15 @@
import org.teiid.test.framework.TestLogger;
import org.teiid.test.util.StringUtil;
+public class TestResultsSummary {
-public class TestResultsSummary {
-
- private static final String PROP_SUMMARY_PRT_DIR="summarydir";
+ private static final String OVERALL_SUMMARY_FILE = "Summary.txt";
+ private static final String PROP_SUMMARY_PRT_DIR = "summarydir";
private static final SimpleDateFormat FILE_NAME_DATE_FORMATER = new SimpleDateFormat(
"yyyyMMdd_HHmmss"); //$NON-NLS-1$
+ private static final String NL = System.getProperty("line.separator"); //$NON-NLS-1$
- private static final String NL = System.getProperty("line.separator"); //$NON-NLS-1$
-
// totals for scenario
private String resultMode = "NotSet";
private int total_queries = 0;
@@ -61,13 +63,14 @@
private long total_seconds = 0;
private List<String> failed_queries = new ArrayList<String>();
private List<String> query_sets = new ArrayList<String>(10);
-
- private Map<String, Collection<TestResult>> testResults = Collections.synchronizedMap(new HashMap<String, Collection<TestResult>>());
-
+
+ private Map<String, Collection<TestResult>> testResults = Collections
+ .synchronizedMap(new HashMap<String, Collection<TestResult>>());
+
public TestResultsSummary(String resultMode) {
this.resultMode = resultMode;
}
-
+
public void cleanup() {
failed_queries.clear();
query_sets.clear();
@@ -83,16 +86,13 @@
this.testResults.put(querySetID, results);
}
results.add(result);
-
+
}
-
-
public Collection<TestResult> getTestResults(String querySetID) {
return this.testResults.get(querySetID);
}
-
-
+
private static PrintStream getSummaryStream(String outputDir,
String summaryName) throws IOException {
File summaryFile = createSummaryFile(outputDir, summaryName);
@@ -100,7 +100,12 @@
os = new BufferedOutputStream(os);
return new PrintStream(os);
}
-
+
+ private static Writer getOverallSummaryStream(String outputDir) throws IOException {
+ return createOverallSummaryFile(outputDir);
+
+ }
+
/**
* Overloaded to overwrite the already existing files
*/
@@ -118,13 +123,14 @@
throw new IOException(
"Summary file already exists: " + summaryFile.getName()); //$NON-NLS-1$
}
- try {
- summaryFile.createNewFile();
+ try {
+ summaryFile.createNewFile();
} catch (IOException ioe) {
- TestLogger.log("Error creating new summary file: " + summaryFile.getAbsolutePath());
+ TestLogger.log("Error creating new summary file: "
+ + summaryFile.getAbsolutePath());
throw ioe;
}
-
+
OutputStream os = new FileOutputStream(summaryFile);
os = new BufferedOutputStream(os);
return new PrintStream(os);
@@ -151,22 +157,66 @@
return summaryFile;
}
+ private static Writer createOverallSummaryFile(String outputDir)
+ throws IOException {
+ boolean exists = false;
+ File summaryFile = new File(outputDir, OVERALL_SUMMARY_FILE); //$NON-NLS-1$
+ exists = summaryFile.exists();
+ FileWriter fstream = new FileWriter(summaryFile,true);
+ BufferedWriter out = new BufferedWriter(fstream);
+
+ if (!exists) {
+
+ try {
+ summaryFile.createNewFile();
+ } catch (IOException e) {
+ System.err
+ .println("Failed to create overall summary file at: " + summaryFile.getAbsolutePath()); //$NON-NLS-1$
+ throw new IOException(
+ "Failed to create overall summary file at: " + summaryFile.getAbsolutePath() + ": " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ printOverallSummaryHeadings(out);
+ }
+
+
+ return out;
+ }
+
+ private static void printOverallSummaryHeadings(Writer overallsummary) {
+
+ try {
+ overallsummary.write("================== \n"); //$NON-NLS-1$
+ overallsummary.write("Test Summary"); //$NON-NLS-1$
+ overallsummary.write("================== \n"); //$NON-NLS-1$
+
+ overallsummary
+ .write("Scenario \t\t" + "Pass" + "\t" + "Fail" + "\t" + "Total \n"); //$NON-NLS-1$
+
+ overallsummary.flush();
+
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ }
+
+ }
+
+
private void printQueryTestResults(PrintStream outputStream,
Date testStartTS, Date endTS, Date length, int numberOfClients,
SimpleDateFormat formatter, Collection results) {
- outputStream.println("Query Test Results [" + this.resultMode + "]"); //$NON-NLS-1$
+ outputStream.println("Query Test Results [" + this.resultMode + "]"); //$NON-NLS-1$
outputStream.println("=================="); //$NON-NLS-1$
outputStream.println("Start Time: " + testStartTS); //$NON-NLS-1$
outputStream.println("End Time: " + endTS); //$NON-NLS-1$
outputStream
.println("Elapsed Time: " + (length.getTime() / 1000) + " seconds"); //$NON-NLS-1$ //$NON-NLS-2$
-
-// outputStream.println("Start Time: " + new Date(testStartTS)); //$NON-NLS-1$
-// outputStream.println("End Time: " + new Date(endTS)); //$NON-NLS-1$
-// outputStream
-// .println("Elapsed Time: " + ((endTS - testStartTS) / 1000) + " seconds"); //$NON-NLS-1$ //$NON-NLS-2$
-//
-
+
+ // outputStream.println("Start Time: " + new Date(testStartTS)); //$NON-NLS-1$
+ // outputStream.println("End Time: " + new Date(endTS)); //$NON-NLS-1$
+ // outputStream
+ // .println("Elapsed Time: " + ((endTS - testStartTS) / 1000) + " seconds"); //$NON-NLS-1$ //$NON-NLS-2$
+ //
+
outputStream.println("Number of Clients: " + numberOfClients); //$NON-NLS-1$
Map passFailGenMap = getPassFailGen(results);
@@ -176,7 +226,7 @@
.println("Number Passed : " + passFailGenMap.get("pass")); //$NON-NLS-1$ //$NON-NLS-2$
outputStream
.println("Number Failed : " + passFailGenMap.get("fail")); //$NON-NLS-1$ //$NON-NLS-2$
-// outputStream.println("Number Generated : " + passFailGenMap.get("gen")); //$NON-NLS-1$ //$NON-NLS-2$
+ // outputStream.println("Number Generated : " + passFailGenMap.get("gen")); //$NON-NLS-1$ //$NON-NLS-2$
ResponseTimes responseTimes = calcQueryResponseTimes(results);
outputStream.println("QPS : " + responseTimes.qps); //$NON-NLS-1$
@@ -221,29 +271,31 @@
// passFailGenMap.put("gen", Integer.toString(gen)); //$NON-NLS-1$
return passFailGenMap;
}
-
- private void addTotalPassFailGen(String scenario_name, Collection results, Date testStartTS, Date endTS, Date lengthTime) {
+
+ private void addTotalPassFailGen(String scenario_name, Collection results,
+ Date testStartTS, Date endTS, Date lengthTime) {
int queries = 0;
int pass = 0;
int fail = 0;
-
+
String queryset = null;
total_querysets++;
for (Iterator resultsItr = results.iterator(); resultsItr.hasNext();) {
TestResult stat = (TestResult) resultsItr.next();
-
- if (queryset == null){
+
+ if (queryset == null) {
queryset = stat.getQuerySetID();
}
-
+
++queries;
switch (stat.getStatus()) {
case TestResult.RESULT_STATE.TEST_EXCEPTION:
++fail;
-
- String msg = StringUtil.removeChars(stat.getExceptionMsg(), new char[] {'\r', '\n'});
-
+
+ String msg = StringUtil.removeChars(stat.getExceptionMsg(),
+ new char[] { '\r', '\n' });
+
this.failed_queries.add(stat.getQueryID() + "~" + msg);
break;
case TestResult.RESULT_STATE.TEST_SUCCESS:
@@ -254,28 +306,26 @@
break;
}
}
-
- this.query_sets.add("\t" + queryset + "\t\t" + pass + "\t" + fail + "\t" + queries + "\t" + (lengthTime.getTime() / 1000) );
-
+
+ this.query_sets.add("\t" + queryset + "\t\t" + pass + "\t" + fail
+ + "\t" + queries + "\t" + (lengthTime.getTime() / 1000));
+
total_fail = total_fail + fail;
total_pass = total_pass + pass;
total_queries = total_queries + queries;
}
-
+
public void printResults(QueryScenario scenario, String querySetID,
- long beginTS,
- long endTS) throws Exception {
+ long beginTS, long endTS) throws Exception {
-
- TestLogger.logDebug("Print results for Query Set [" + querySetID
- + "]");
-
- try {
- printResults(scenario, querySetID, beginTS, endTS, 1, 1);
- } catch (Exception e) {
- e.printStackTrace();
- }
+ TestLogger.logDebug("Print results for Query Set [" + querySetID + "]");
+
+ try {
+ printResults(scenario, querySetID, beginTS, endTS, 1, 1);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
/**
@@ -288,14 +338,14 @@
* @throws Exception
*/
public void printResults(QueryScenario scenario, String querySetID,
- long testStartTS,
- long endTS, int numberOfClients, int runNumber) throws Exception {
-
+ long testStartTS, long endTS, int numberOfClients, int runNumber)
+ throws Exception {
+
String testname = scenario.getQueryScenarioIdentifier();
Collection<TestResult> testResults = getTestResults(querySetID);
-// Properties props = scenario.getProperties();
+ // Properties props = scenario.getProperties();
String outputDir = scenario.getResultsGenerator().getOutputDir();
-
+
// CombinedTestClient.log("Calculating and printing result statistics"); //$NON-NLS-1$
if (testResults.size() > 0) {
// Create output file
@@ -311,29 +361,29 @@
// logError("Unable to get output stream for file: " + outputFileName); //$NON-NLS-1$
throw e;
}
-
+
Date starttest = new Date(testStartTS);
Date endtest = new Date(endTS);
long diff = endtest.getTime() - starttest.getTime();
-
+
total_seconds = total_seconds + diff;
- Date diffdate = new Date( diff);
-
-// endtest - starttest;
-//
-// outputStream.println("Start Time: " + new Date(testStartTS)); //$NON-NLS-1$
-// outputStream.println("End Time: " + new Date(endTS)); //$NON-NLS-1$
-// outputStream
-// .println("Elapsed Time: " + ((endTS - testStartTS) / 1000) + " seconds"); //$NON-NLS-1$ //$NON-NLS-2$
+ Date diffdate = new Date(diff);
-
- addTotalPassFailGen(testname, testResults, starttest, endtest, diffdate);
+ // endtest - starttest;
+ //
+ // outputStream.println("Start Time: " + new Date(testStartTS)); //$NON-NLS-1$
+ // outputStream.println("End Time: " + new Date(endTS)); //$NON-NLS-1$
+ // outputStream
+ // .println("Elapsed Time: " + ((endTS - testStartTS) / 1000) + " seconds"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ addTotalPassFailGen(testname, testResults, starttest, endtest,
+ diffdate);
// Text File output
printQueryTestResults(outputStream, starttest, endtest, diffdate,
numberOfClients, TestClient.TSFORMAT, testResults);
- printQueryTestResults(overwriteStream, starttest, endtest, diffdate,
- numberOfClients, TestClient.TSFORMAT, testResults);
+ printQueryTestResults(overwriteStream, starttest, endtest,
+ diffdate, numberOfClients, TestClient.TSFORMAT, testResults);
// HTML Vesion of output
PrintStream htmlStream = getSummaryStream(outputDir, querySetID
@@ -394,84 +444,100 @@
// logError("No results to print."); //$NON-NLS-1$
}
}
-
- public void printTotals(QueryScenario scenario ) throws Exception {
-// String outputDir = scenario.getResultsGenerator().getOutputDir();
- String scenario_name = scenario.getQueryScenarioIdentifier();
- String querysetname = scenario.getQuerySetName();
-
- String summarydir = ConfigPropertyLoader.getInstance().getProperty(PROP_SUMMARY_PRT_DIR);
-// if (summarydir != null) {
-// outputDir = summarydir;
-// }
+ public void printTotals(QueryScenario scenario) throws Exception {
+ // String outputDir = scenario.getResultsGenerator().getOutputDir();
+ String scenario_name = scenario.getQueryScenarioIdentifier();
+ String querysetname = scenario.getQuerySetName();
- PrintStream outputStream = null;
- try {
- outputStream = getSummaryStream(summarydir, "Summary_" + querysetname + "_" + scenario_name, true); //$NON-NLS-1$
- } catch (IOException e) {
- e.printStackTrace();
- // logError("Unable to get output stream for file: " + outputFileName); //$NON-NLS-1$
- throw e;
- }
+ String summarydir = ConfigPropertyLoader.getInstance().getProperty(
+ PROP_SUMMARY_PRT_DIR);
+ // if (summarydir != null) {
+ // outputDir = summarydir;
+ // }
+
+ PrintStream outputStream = null;
+ Writer overallsummary = null;
+ try {
+ outputStream = getSummaryStream(summarydir,
+ "Summary_" + querysetname + "_" + scenario_name, true); //$NON-NLS-1$
-
- outputStream.println("Scenario " + scenario_name + " Summary [" + this.resultMode + "]"); //$NON-NLS-1$
- outputStream.println("Query Set Name " + querysetname); //$NON-NLS-1$
- outputStream.println("=================="); //$NON-NLS-1$
-
- outputStream
- .println("Number of Test Query Sets: " + total_querysets); //$NON-NLS-1$ //$NON-NLS-2$
-
- outputStream.println("=================="); //$NON-NLS-1$
- outputStream.println("Test Query Set"); //$NON-NLS-1$
- outputStream.println("\t" + "Name" + "\t\t\t\t" + "Pass" + "\t" + "Fail" + "\t" + "Total" + "\t" + "Time(sec)"); //$NON-NLS-1$
+ overallsummary = getOverallSummaryStream(summarydir);
+ } catch (IOException e) {
+ e.printStackTrace();
+ // logError("Unable to get output stream for file: " + outputFileName); //$NON-NLS-1$
+ throw e;
+ }
- if (!this.query_sets.isEmpty()) {
- // sort so that like failed queries are show together
- Collections.sort(this.query_sets);
+ outputStream
+ .println("Scenario " + scenario_name + " Summary [" + this.resultMode + "]"); //$NON-NLS-1$
+ outputStream.println("Query Set Name " + querysetname); //$NON-NLS-1$
+ outputStream.println("=================="); //$NON-NLS-1$
-
- for (Iterator<String> it=this.query_sets.iterator(); it.hasNext();) {
- outputStream
- .println(it.next()); //$NON-NLS-1$ //$NON-NLS-2$
-
- }
+ outputStream.println("Number of Test Query Sets: " + total_querysets); //$NON-NLS-1$ //$NON-NLS-2$
- }
- outputStream.println("=================="); //$NON-NLS-1$
-
-
- outputStream
- .println("\t" + "Totals" + "\t\t\t\t" + total_pass + "\t" + total_fail + "\t" + total_queries+ "\t" + total_seconds / 1000 );
-
-// outputStream
-// .println("Number of Queries: " + total_queries); //$NON-NLS-1$ //$NON-NLS-2$
-// outputStream
-// .println("Number Passed : " + total_pass); //$NON-NLS-1$ //$NON-NLS-2$
-// outputStream
-// .println("Number Failed : " + total_fail); //$NON-NLS-1$ //$NON-NLS-2$
-
- if (!this.failed_queries.isEmpty()) {
- // sort so that like failed queries are show together
- Collections.sort(this.failed_queries);
-
- outputStream.println("\n\n=================="); //$NON-NLS-1$
- outputStream.println("Failed Queries"); //$NON-NLS-1$
-
- for (Iterator<String> it=this.failed_queries.iterator(); it.hasNext();) {
- outputStream
- .println("\t - " + it.next()); //$NON-NLS-1$ //$NON-NLS-2$
-
- }
-
- outputStream.println("=================="); //$NON-NLS-1$
-
- }
+ outputStream.println("=================="); //$NON-NLS-1$
+ outputStream.println("Test Query Set"); //$NON-NLS-1$
+ outputStream
+ .println("\t" + "Name" + "\t\t\t\t" + "Pass" + "\t" + "Fail" + "\t" + "Total" + "\t" + "Time(sec)"); //$NON-NLS-1$
- outputStream.close();
+ if (!this.query_sets.isEmpty()) {
+ // sort so that like failed queries are show together
+ Collections.sort(this.query_sets);
+ for (Iterator<String> it = this.query_sets.iterator(); it.hasNext();) {
+ outputStream.println(it.next()); //$NON-NLS-1$ //$NON-NLS-2$
+
+ }
+
+ }
+ outputStream.println("=================="); //$NON-NLS-1$
+
+ outputStream.println("\t" + "Totals" + "\t\t\t\t" + total_pass + "\t"
+ + total_fail + "\t" + total_queries + "\t" + total_seconds
+ / 1000);
+ overallsummary.write(scenario_name + " \t" + total_pass + "\t" + total_fail + "\t" + total_queries + "\n");
+ try {
+ overallsummary.flush();
+
+ overallsummary.close();
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ } finally { // always close the file
+ try {
+ overallsummary.close();
+ } catch (IOException ioe2) {
+ // just ignore it
+ }
+ } //
+
+ // outputStream
+ // .println("Number of Queries: " + total_queries); //$NON-NLS-1$ //$NON-NLS-2$
+ // outputStream
+ // .println("Number Passed : " + total_pass); //$NON-NLS-1$ //$NON-NLS-2$
+ // outputStream
+ // .println("Number Failed : " + total_fail); //$NON-NLS-1$ //$NON-NLS-2$
+
+ if (!this.failed_queries.isEmpty()) {
+ // sort so that like failed queries are show together
+ Collections.sort(this.failed_queries);
+
+ outputStream.println("\n\n=================="); //$NON-NLS-1$
+ outputStream.println("Failed Queries"); //$NON-NLS-1$
+
+ for (Iterator<String> it = this.failed_queries.iterator(); it
+ .hasNext();) {
+ outputStream.println("\t - " + it.next()); //$NON-NLS-1$ //$NON-NLS-2$
+
+ }
+
+ outputStream.println("=================="); //$NON-NLS-1$
+
+ }
+
+ outputStream.close();
+
}
private static String generateFileName(String configName, long timestamp,
@@ -556,10 +622,11 @@
addTableData(htmlCode, stat.getResultStatusString(),
"fail".equalsIgnoreCase(stat.getResultStatusString())); //$NON-NLS-1$
addTableData(htmlCode, new Date(stat.getBeginTS()).toString());
-
- // Long.toString(stat.getBeginTS()));
- addTableData(htmlCode, Long.toString( (stat.getEndTS() - stat.getBeginTS() / 1000 )));
- //Long.toString(stat.getEndTS()));
+
+ // Long.toString(stat.getBeginTS()));
+ addTableData(htmlCode, Long.toString((stat.getEndTS() - stat
+ .getBeginTS() / 1000)));
+ // Long.toString(stat.getEndTS()));
if (stat.getStatus() == TestResult.RESULT_STATE.TEST_EXCEPTION) {
addTableData(htmlCode, stat.getExceptionMsg());
if (stat.getErrorfile() != null
14 years, 7 months
teiid SVN: r2087 - trunk/build/kits/jboss-container/teiid-examples/simpleclient.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-04-30 10:24:40 -0400 (Fri, 30 Apr 2010)
New Revision: 2087
Modified:
trunk/build/kits/jboss-container/teiid-examples/simpleclient/JDBCClient.class
trunk/build/kits/jboss-container/teiid-examples/simpleclient/JDBCClient.java
Log:
fixing the client parameter ordering and adding an example of using showplan
Modified: trunk/build/kits/jboss-container/teiid-examples/simpleclient/JDBCClient.class
===================================================================
(Binary files differ)
Modified: trunk/build/kits/jboss-container/teiid-examples/simpleclient/JDBCClient.java
===================================================================
--- trunk/build/kits/jboss-container/teiid-examples/simpleclient/JDBCClient.java 2010-04-30 14:22:36 UTC (rev 2086)
+++ trunk/build/kits/jboss-container/teiid-examples/simpleclient/JDBCClient.java 2010-04-30 14:24:40 UTC (rev 2087)
@@ -27,6 +27,7 @@
import java.sql.Statement;
import org.teiid.jdbc.TeiidDataSource;
+import org.teiid.jdbc.TeiidStatement;
public class JDBCClient {
public static void main(String[] args) throws Exception {
@@ -44,20 +45,23 @@
execute(getDataSourceConnection(args[0], args[1], args[2]), args[3]);
}
- static Connection getDriverConnection(String vdb, String host, String port) throws Exception {
- String url = "jdbc:metamatrix:"+vdb+"@mm://"+host+":"+port;
+ static Connection getDriverConnection(String host, String port, String vdb) throws Exception {
+ String url = "jdbc:teiid:"+vdb+"@mm://"+host+":"+port+";showplan=on"; //note showplan setting
Class.forName("org.teiid.jdbc.TeiidDriver");
return DriverManager.getConnection(url,"admin", "teiid");
}
- static Connection getDataSourceConnection(String vdb, String host, String port) throws Exception {
+ static Connection getDataSourceConnection(String host, String port, String vdb) throws Exception {
TeiidDataSource ds = new TeiidDataSource();
ds.setDatabaseName(vdb);
ds.setUser("admin");
ds.setPassword("teiid");
ds.setServerName(host);
ds.setPortNumber(Integer.valueOf(port));
+
+ ds.setShowPlan("on"); //turn show plan on
+
return ds.getConnection();
}
@@ -77,6 +81,10 @@
}
System.out.println("");
}
+
+ System.out.println("Query Plan");
+ System.out.println(statement.unwrap(TeiidStatement.class).getPlanDescription());
+
results.close();
statement.close();
} catch (SQLException e) {
14 years, 7 months
teiid SVN: r2086 - in trunk/client/src: test/java/org/teiid/client/plan and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-04-30 10:22:36 -0400 (Fri, 30 Apr 2010)
New Revision: 2086
Modified:
trunk/client/src/main/java/org/teiid/client/plan/PlanNode.java
trunk/client/src/test/java/org/teiid/client/plan/TestPlanNode.java
Log:
TEIID-908 fixing issue with an empty property list and adding javadocs
Modified: trunk/client/src/main/java/org/teiid/client/plan/PlanNode.java
===================================================================
--- trunk/client/src/main/java/org/teiid/client/plan/PlanNode.java 2010-04-28 18:35:59 UTC (rev 2085)
+++ trunk/client/src/main/java/org/teiid/client/plan/PlanNode.java 2010-04-30 14:22:36 UTC (rev 2086)
@@ -28,6 +28,7 @@
import java.io.ObjectOutput;
import java.io.StringWriter;
import java.util.Arrays;
+import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
@@ -41,10 +42,20 @@
import com.metamatrix.core.util.ExternalizeUtil;
+/**
+ * A PlanNode represents part of processing plan tree. For relational plans
+ * child PlanNodes may be either subqueries or nodes that feed tuples into the
+ * parent. For procedure plans child PlanNodes will be processing instructions,
+ * which can in turn contain other relational or procedure plans.
+ */
@XmlType
@XmlRootElement(name="node")
public class PlanNode implements Externalizable {
+ /**
+ * A Property is a named value of a {@link PlanNode} that may be
+ * another {@link PlanNode} or a non-null list of values.
+ */
@XmlType(name = "property")
public static class Property implements Externalizable {
@XmlAttribute
@@ -138,6 +149,9 @@
public void addProperty(String pname, List<String> value) {
Property p = new Property(pname);
+ if (value == null) {
+ value = Collections.emptyList();
+ }
p.setValues(value);
this.properties.add(p);
}
@@ -148,6 +162,11 @@
this.properties.add(p);
}
+ /**
+ * Converts this PlanNode to XML. See the JAXB bindings for the
+ * document form.
+ * @return an XML document of this PlanNode
+ */
public String toXml() throws JAXBException {
JAXBContext jc = JAXBContext.newInstance(new Class<?>[] {PlanNode.class});
Marshaller marshaller = jc.createMarshaller();
@@ -164,9 +183,6 @@
return builder.toString();
}
- /*
- * @see com.metamatrix.jdbc.plan.PlanVisitor#visitNode(com.metamatrix.jdbc.plan.PlanNode)
- */
protected void visitNode(PlanNode node, int nodeLevel, StringBuilder text) {
for(int i=0; i<nodeLevel; i++) {
text.append(" "); //$NON-NLS-1$
@@ -203,10 +219,12 @@
text.append(p.getValues().get(i));
text.append("\n"); //$NON-NLS-1$
}
- } else {
+ } else if (p.getValues().size() == 1) {
text.append(":"); //$NON-NLS-1$
text.append(p.getValues().get(0));
text.append("\n"); //$NON-NLS-1$
+ } else {
+ text.append("\n"); //$NON-NLS-1$
}
}
Modified: trunk/client/src/test/java/org/teiid/client/plan/TestPlanNode.java
===================================================================
--- trunk/client/src/test/java/org/teiid/client/plan/TestPlanNode.java 2010-04-28 18:35:59 UTC (rev 2085)
+++ trunk/client/src/test/java/org/teiid/client/plan/TestPlanNode.java 2010-04-30 14:22:36 UTC (rev 2086)
@@ -23,6 +23,7 @@
package org.teiid.client.plan;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import junit.framework.TestCase;
@@ -55,17 +56,17 @@
List<String> crits = new ArrayList<String>();
crits.add("Item.ID = History.ID"); //$NON-NLS-1$
child.addProperty("Criteria", crits); //$NON-NLS-1$
-
+ child.addProperty("Other", new ArrayList<String>()); //$NON-NLS-1$
map.addProperty("child", child); //$NON-NLS-1$
return map;
}
public void testXml() throws Exception {
- assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<node name=\"x\">\n <property name=\"test\">\n <value></value>\n </property>\n <property name=\"string\">\n <value>string</value>\n </property>\n <property name=\"list<string>\">\n <value>item1</value>\n <value>item2</value>\n <value>item3</value>\n </property>\n <property name=\"child\">\n <node name=\"y\">\n <property name=\"outputCols\">\n <value>Name (string)</value>\n <value>Year (integer)</value>\n </property>\n <property name=\"Join Type\">\n <value>INNER JOIN</value>\n </property>\n <property name=\"Criteria\">\n <value>Item.ID = History.ID</value>\n </property>\n </node>\n </property>\n</node>\n", example1().toXml()); //$NON-NLS-1$
+ assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<node name=\"x\">\n <property name=\"test\">\n <value></value>\n </property>\n <property name=\"string\">\n <value>string</value>\n </property>\n <property name=\"list<string>\">\n <value>item1</value>\n <value>item2</value>\n <value>item3</value>\n </property>\n <property name=\"child\">\n <node name=\"y\">\n <property name=\"outputCols\">\n <value>Name (string)</value>\n <value>Year (integer)</value>\n </property>\n <property name=\"Join Type\">\n <value>INNER JOIN</value>\n </property>\n <property name=\"Criteria\">\n <value>Item.ID = History.ID</value>\n </property>\n <property name=\"Other\"/>\n </node>\n </property>\n</node>\n", example1().toXml()); //$NON-NLS-1$
}
public void testText() throws Exception {
- assertEquals("x\n + test:\n + string:string\n + list<string>:\n 0: item1\n 1: item2\n 2: item3\n + child:\n y\n + outputCols:\n 0: Name (string)\n 1: Year (integer)\n + Join Type:INNER JOIN\n + Criteria:Item.ID = History.ID\n", example1().toString()); //$NON-NLS-1$
+ assertEquals("x\n + test:\n + string:string\n + list<string>:\n 0: item1\n 1: item2\n 2: item3\n + child:\n y\n + outputCols:\n 0: Name (string)\n 1: Year (integer)\n + Join Type:INNER JOIN\n + Criteria:Item.ID = History.ID\n + Other\n", example1().toString()); //$NON-NLS-1$
}
}
14 years, 7 months
teiid SVN: r2085 - in trunk/engine/src: test/java/org/teiid/dqp/internal/process and 1 other directory.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2010-04-28 14:35:59 -0400 (Wed, 28 Apr 2010)
New Revision: 2085
Modified:
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
Log:
TEIID-1076 - Hawkins resolved the issue. The check for the final row of a batch needed to be using ">=", instead of ">", so that no rows were considered as the last batch.
TestCase - TestDataTierManager.testNoRowsException was created to validate the problem and verified the change.
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java 2010-04-27 22:25:00 UTC (rev 2084)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java 2010-04-28 18:35:59 UTC (rev 2085)
@@ -104,7 +104,7 @@
}
public boolean isDone() {
- return this.arm != null && this.arm.getFinalRow() > 0;
+ return this.arm != null && this.arm.getFinalRow() >= 0;
}
void open() throws MetaMatrixComponentException, MetaMatrixProcessingException {
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 2010-04-27 22:25:00 UTC (rev 2084)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java 2010-04-28 18:35:59 UTC (rev 2085)
@@ -130,6 +130,12 @@
}
}
+ public void testNoRowsException() throws Exception {
+ helpSetup(3);
+ this.connectorManager.setRows(0);
+ assertNull(info.nextTuple());
+ }
+
public void testCodeTableResponseDataNotAvailable() throws Exception {
helpSetup(3);
this.connectorManager.dataNotAvailable = 5;
14 years, 7 months