teiid SVN: r1720 - trunk/test-integration/db.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2010-01-06 14:31:14 -0500 (Wed, 06 Jan 2010)
New Revision: 1720
Modified:
trunk/test-integration/db/pom.xml
Log:
Teiid 781 - remove datadirect jar from the path elements
Modified: trunk/test-integration/db/pom.xml
===================================================================
--- trunk/test-integration/db/pom.xml 2010-01-06 17:13:18 UTC (rev 1719)
+++ trunk/test-integration/db/pom.xml 2010-01-06 19:31:14 UTC (rev 1720)
@@ -267,7 +267,6 @@
<additionalClasspathElement>${basedir}/lib/ojdbc6.jar</additionalClasspathElement>
<additionalClasspathElement>${basedir}/lib/sqljdbc4.jar</additionalClasspathElement>
<additionalClasspathElement>${basedir}/lib/db2jcc4.jar</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/lib/jbedsp-datadirect.jar</additionalClasspathElement>
</additionalClasspathElements>
<systemProperties>
@@ -281,10 +280,10 @@
</property>
</systemProperties>
-<!--
+<!--
<forkMode>always</forkMode>
<forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
- -->
+ -->
<includes>
<!-- <include>**/*TestCase.java</include> -->
<include>**/*Test.java</include>
@@ -334,7 +333,6 @@
<additionalClasspathElement>${basedir}/lib/ojdbc6.jar</additionalClasspathElement>
<additionalClasspathElement>${basedir}/lib/sqljdbc4.jar</additionalClasspathElement>
<additionalClasspathElement>${basedir}/lib/db2jcc4.jar</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/lib/jbedsp-datadirect.jar</additionalClasspathElement>
</additionalClasspathElements>
<systemProperties>
<property>
14 years, 4 months
teiid SVN: r1719 - in trunk/test-integration/db/src/main/java/org/teiid/test/client: ctc and 1 other directory.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2010-01-06 12:13:18 -0500 (Wed, 06 Jan 2010)
New Revision: 1719
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/client/QueryScenario.java
trunk/test-integration/db/src/main/java/org/teiid/test/client/TestProperties.java
trunk/test-integration/db/src/main/java/org/teiid/test/client/TestResultsSummary.java
trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/CTCQueryScenario.java
Log:
Teiid 781 - needed to add another qualifier to the summary file name (e.g., query set name) so that duplicates wont occur
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/client/QueryScenario.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/client/QueryScenario.java 2010-01-06 16:06:56 UTC (rev 1718)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/client/QueryScenario.java 2010-01-06 17:13:18 UTC (rev 1719)
@@ -39,6 +39,13 @@
*/
public interface QueryScenario {
+
+ /**
+ * Return the name that identifies this query set.
+ * It should use the {@link TestProperties#QUERY_SET_NAME} property to obtain the name.
+ * @return String query set name;
+ */
+ String getQuerySetName();
/**
* Return the identifier for the current scenario
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/client/TestProperties.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/client/TestProperties.java 2010-01-06 16:06:56 UTC (rev 1718)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/client/TestProperties.java 2010-01-06 17:13:18 UTC (rev 1719)
@@ -33,6 +33,15 @@
public static final String PROP_SCENARIO_FILE = "scenariofile";
/**
+ * The {@link #QUERY_SET_NAME} property indicates the name of directory that contains
+ * the set of queries and expected results that will be used. This is referred
+ * to as the <b>query set</b>
+ *
+ * This property should be found in the {@link #PROP_SCENARIO_FILE}.
+ */
+ public static final String QUERY_SET_NAME = "queryset.dir"; //$NON-NLS-1$
+
+ /**
* PROP_RESULT_MODE controls what to do with the execution results.
*
* @see ExpectedResults.RESULT_MODES for the options.
@@ -70,7 +79,9 @@
* files will be written.
*/
public static final String PROP_OUTPUT_DIR = "outputdir"; //$NON-NLS-1$
+
+
}
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-01-06 16:06:56 UTC (rev 1718)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/client/TestResultsSummary.java 2010-01-06 17:13:18 UTC (rev 1719)
@@ -317,6 +317,8 @@
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) {
@@ -325,20 +327,22 @@
PrintStream outputStream = null;
try {
- outputStream = getSummaryStream(outputDir, "TotalSummary_" + scenario_name, true); //$NON-NLS-1$
+ outputStream = getSummaryStream(outputDir, "Summary_" + querysetname + "_" + scenario_name, true); //$NON-NLS-1$
} catch (IOException e) {
// logError("Unable to get output stream for file: " + outputFileName); //$NON-NLS-1$
throw e;
}
- outputStream.println("Scenario " + scenario_name + " Total Results"); //$NON-NLS-1$
+
+ outputStream.println("Scenario " + scenario_name + " Summary"); //$NON-NLS-1$
+ outputStream.println("Query Set Name " + querysetname); //$NON-NLS-1$
outputStream.println("=================="); //$NON-NLS-1$
outputStream
- .println("Number of Query Sets: " + total_querysets); //$NON-NLS-1$ //$NON-NLS-2$
+ .println("Number of Test Query Sets: " + total_querysets); //$NON-NLS-1$ //$NON-NLS-2$
outputStream.println("=================="); //$NON-NLS-1$
- outputStream.println("Query Sets"); //$NON-NLS-1$
+ outputStream.println("Test Query Set"); //$NON-NLS-1$
outputStream.println("\t" + "Name" + "\t\t" + "Pass" + "\t" + "Fail" + "\t" + "Total"); //$NON-NLS-1$
if (!this.query_sets.isEmpty()) {
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/CTCQueryScenario.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/CTCQueryScenario.java 2010-01-06 16:06:56 UTC (rev 1718)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/CTCQueryScenario.java 2010-01-06 17:13:18 UTC (rev 1719)
@@ -68,6 +68,7 @@
private Properties props;
private String outputDir = null;
+ private String querySetName = null;
private String scenario_test_name;
@@ -82,6 +83,10 @@
public String getQueryScenarioIdentifier() {
return this.scenario_test_name;
}
+
+ public String getQuerySetName() {
+ return this.querySetName;
+ }
private void setup() {
@@ -89,6 +94,8 @@
TestLogger.logDebug("Perform TestClient Setup");
Properties props = ConfigPropertyLoader.getInstance().getProperties();
+ this.querySetName = props.getProperty(TestProperties.QUERY_SET_NAME, "querysetnamenotdefined");
+
outputDir = props.getProperty(TestProperties.PROP_OUTPUT_DIR, ".");
Assert.assertNotNull("Property " + TestProperties.PROP_OUTPUT_DIR
14 years, 4 months
teiid SVN: r1718 - trunk/test-integration/db/src/main/resources/ctc_tests.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2010-01-06 11:06:56 -0500 (Wed, 06 Jan 2010)
New Revision: 1718
Modified:
trunk/test-integration/db/src/main/resources/ctc_tests/ctc.xml
Log:
Teiid 781 - updates for running the ctc client so that the process can determine if a error occurred across all scenarios and trigger the failure at the end, this fixes a line ctl character written to the error file
Modified: trunk/test-integration/db/src/main/resources/ctc_tests/ctc.xml
===================================================================
--- trunk/test-integration/db/src/main/resources/ctc_tests/ctc.xml 2010-01-06 05:35:57 UTC (rev 1717)
+++ trunk/test-integration/db/src/main/resources/ctc_tests/ctc.xml 2010-01-06 16:06:56 UTC (rev 1718)
@@ -161,7 +161,7 @@
if="error.exist">
<echo>Flag Error - Query Set: ${queryset.dir} Scenario: ${scenario.name} </echo>
- <concat destfile="${ERROR_FILE}" append="true">Query Set: ${queryset.dir} Scenario: ${scenario.name} </concat>
+ <concat destfile="${ERROR_FILE}" append="true" fixlastline="yes">Query Set: ${queryset.dir} Scenario: ${scenario.name} </concat>
</target>
14 years, 4 months
teiid SVN: r1717 - in trunk/engine/src: test/java/com/metamatrix/query/optimizer and 2 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-01-06 00:35:57 -0500 (Wed, 06 Jan 2010)
New Revision: 1717
Modified:
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/FrameUtil.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushAggregates.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushSelectCriteria.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRaiseAccess.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestAggregatePushdown.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestOptionalJoins.java
trunk/engine/src/test/java/com/metamatrix/query/processor/TestAggregateProcessing.java
trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java
trunk/engine/src/test/java/com/metamatrix/query/processor/TestQueryProcessor.java
trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestRelationalPlan.java
Log:
TEIID-919 added logic to correct the projected names of additional union branches when pushing an aggregate. also consolidated the logic to check for an ordered limit, which fixed a secondary issue.
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/FrameUtil.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/FrameUtil.java 2010-01-05 23:13:18 UTC (rev 1716)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/FrameUtil.java 2010-01-06 05:35:57 UTC (rev 1717)
@@ -486,12 +486,9 @@
* Finds the closest project columns in the current frame
*/
static List<SingleElementSymbol> findTopCols(PlanNode node) {
- List projects = NodeEditor.findAllNodes(node, NodeConstants.Types.PROJECT, NodeConstants.Types.SOURCE|NodeConstants.Types.PROJECT);
- PlanNode project = null;
- if (projects.isEmpty()) {
+ PlanNode project = NodeEditor.findNodePreOrder(node, NodeConstants.Types.PROJECT, NodeConstants.Types.SOURCE);
+ if (project == null) {
project = NodeEditor.findParent(node, NodeConstants.Types.PROJECT, NodeConstants.Types.SOURCE);
- } else {
- project = (PlanNode)projects.get(0);
}
if (project != null) {
return (List<SingleElementSymbol>)project.getProperty(NodeConstants.Info.PROJECT_COLS);
@@ -499,5 +496,9 @@
Assertion.failed("no top cols in frame"); //$NON-NLS-1$
return null;
}
+
+ public static boolean isOrderedLimit(PlanNode node) {
+ return node.getType() == NodeConstants.Types.TUPLE_LIMIT && NodeEditor.findNodePreOrder(node, NodeConstants.Types.SORT, NodeConstants.Types.PROJECT | NodeConstants.Types.SET_OP) != null;
+ }
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushAggregates.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushAggregates.java 2010-01-05 23:13:18 UTC (rev 1716)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushAggregates.java 2010-01-06 05:35:57 UTC (rev 1717)
@@ -53,6 +53,7 @@
import com.metamatrix.query.optimizer.relational.plantree.NodeEditor;
import com.metamatrix.query.optimizer.relational.plantree.NodeFactory;
import com.metamatrix.query.optimizer.relational.plantree.PlanNode;
+import com.metamatrix.query.optimizer.relational.plantree.NodeConstants.Info;
import com.metamatrix.query.resolver.util.ResolverUtil;
import com.metamatrix.query.resolver.util.ResolverVisitor;
import com.metamatrix.query.rewriter.QueryRewriter;
@@ -64,6 +65,7 @@
import com.metamatrix.query.sql.lang.Select;
import com.metamatrix.query.sql.lang.SetQuery.Operation;
import com.metamatrix.query.sql.symbol.AggregateSymbol;
+import com.metamatrix.query.sql.symbol.AliasSymbol;
import com.metamatrix.query.sql.symbol.Constant;
import com.metamatrix.query.sql.symbol.ElementSymbol;
import com.metamatrix.query.sql.symbol.Expression;
@@ -289,6 +291,26 @@
QueryMetadataInterface metadata, CapabilitiesFinder capFinder)
throws MetaMatrixComponentException, QueryPlannerException, QueryResolverException {
PlanNode originalNode = unionSource;
+ //branches other than the first need to have their projected column names updated
+ PlanNode sortNode = NodeEditor.findNodePreOrder(unionSource, NodeConstants.Types.SORT, NodeConstants.Types.SOURCE);
+ List<SingleElementSymbol> sortOrder = null;
+ if (sortNode != null) {
+ sortOrder = (List<SingleElementSymbol>)sortNode.getProperty(Info.SORT_ORDER);
+ }
+ List<SingleElementSymbol> projectCols = FrameUtil.findTopCols(unionSource);
+ for (int i = 0; i < virtualElements.size(); i++) {
+ ElementSymbol virtualElem = virtualElements.get(i);
+ SingleElementSymbol projectedSymbol = projectCols.get(i);
+ if (!projectedSymbol.getShortCanonicalName().equals(virtualElem.getShortCanonicalName())) {
+ if (sortOrder != null) {
+ int sortIndex = sortOrder.indexOf(projectedSymbol);
+ if (sortIndex > -1) {
+ updateSymbolName(sortOrder, sortIndex, virtualElem, sortOrder.get(sortIndex));
+ }
+ }
+ updateSymbolName(projectCols, i, virtualElem, projectedSymbol);
+ }
+ }
PlanNode intermediateView = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
unionSource.addAsParent(intermediateView);
unionSource = intermediateView;
@@ -357,6 +379,15 @@
}
}
+ private void updateSymbolName(List<SingleElementSymbol> projectCols, int i,
+ ElementSymbol virtualElem, SingleElementSymbol projectedSymbol) {
+ if (projectedSymbol instanceof AliasSymbol) {
+ ((AliasSymbol)projectedSymbol).setName(virtualElem.getShortCanonicalName());
+ } else {
+ projectCols.set(i, new AliasSymbol(virtualElem.getShortCanonicalName(), projectedSymbol));
+ }
+ }
+
/**
* Walk up the plan from the GROUP node. Should encounter only (optionally) a SELECT and can stop at the PROJECT node. Need to
* collect any AggregateSymbols used in the select criteria or projected columns.
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushSelectCriteria.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushSelectCriteria.java 2010-01-05 23:13:18 UTC (rev 1716)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RulePushSelectCriteria.java 2010-01-06 05:35:57 UTC (rev 1717)
@@ -315,7 +315,7 @@
}
satisfyAccessPatterns(critNode, currentNode);
- } else if (currentNode.getType() == NodeConstants.Types.TUPLE_LIMIT && currentNode.getChildCount() == 1 && currentNode.getFirstChild().getType() == NodeConstants.Types.SORT) {
+ } else if (FrameUtil.isOrderedLimit(currentNode)) {
return currentNode;
} else if (currentNode.getType() == NodeConstants.Types.GROUP && critNode.hasBooleanProperty(NodeConstants.Info.IS_HAVING)) {
return currentNode;
@@ -329,8 +329,7 @@
throws QueryPlannerException {
//ensure that the criteria can be pushed further
- if (sourceNode.getChildCount() == 1 && sourceNode.getFirstChild().getType() == NodeConstants.Types.TUPLE_LIMIT &&
- sourceNode.getFirstChild().getChildCount() == 1 && sourceNode.getFirstChild().getFirstChild().getType() == NodeConstants.Types.SORT) {
+ if (sourceNode.getChildCount() == 1 && FrameUtil.isOrderedLimit(sourceNode.getFirstChild())) {
return false;
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRaiseAccess.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRaiseAccess.java 2010-01-05 23:13:18 UTC (rev 1716)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRaiseAccess.java 2010-01-06 05:35:57 UTC (rev 1717)
@@ -327,7 +327,7 @@
//don't push criteria into an invalid location above an ordered limit - shouldn't happen
PlanNode limitNode = NodeEditor.findNodePreOrder(accessNode, NodeConstants.Types.TUPLE_LIMIT, NodeConstants.Types.SOURCE);
- if (limitNode != null && NodeEditor.findNodePreOrder(limitNode, NodeConstants.Types.SORT, NodeConstants.Types.SOURCE) != null) {
+ if (limitNode != null && FrameUtil.isOrderedLimit(limitNode)) {
return false;
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java 2010-01-05 23:13:18 UTC (rev 1716)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java 2010-01-06 05:35:57 UTC (rev 1717)
@@ -262,7 +262,7 @@
return areAggregatesCardinalityDependent(aggs);
}
case NodeConstants.Types.TUPLE_LIMIT: {
- if (parent.getFirstChild().getType() == NodeConstants.Types.SORT) {
+ if (FrameUtil.isOrderedLimit(parent)) {
return true;
}
}
Modified: trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestAggregatePushdown.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestAggregatePushdown.java 2010-01-05 23:13:18 UTC (rev 1716)
+++ trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestAggregatePushdown.java 2010-01-06 05:35:57 UTC (rev 1717)
@@ -49,6 +49,7 @@
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_COUNT_STAR, true);
caps.setCapabilitySupport(Capability.QUERY_GROUP_BY, true);
caps.setCapabilitySupport(Capability.QUERY_HAVING, true);
+ caps.setCapabilitySupport(Capability.ROW_LIMIT, true);
return caps;
}
Modified: trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestOptionalJoins.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestOptionalJoins.java 2010-01-05 23:13:18 UTC (rev 1716)
+++ trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestOptionalJoins.java 2010-01-06 05:35:57 UTC (rev 1717)
@@ -518,7 +518,7 @@
ProcessorPlan plan = TestOptimizer
.helpPlan(
"select distinct * from (SELECT pm1.g1.e3 from pm1.g1 left outer join pm1.g2 on (pm1.g1.e1 = pm1.g2.e1) order by e3 limit 10) x", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
- new String[] { "SELECT DISTINCT g_0.e3 AS c_0 FROM pm1.g1 AS g_0 LEFT OUTER JOIN pm1.g2 AS g_1 ON g_0.e1 = g_1.e1 ORDER BY c_0" }); //$NON-NLS-1$
+ new String[] { "SELECT g_0.e3 AS c_0 FROM pm1.g1 AS g_0 LEFT OUTER JOIN pm1.g2 AS g_1 ON g_0.e1 = g_1.e1 ORDER BY c_0" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
1, // Access
Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/TestAggregateProcessing.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/processor/TestAggregateProcessing.java 2010-01-05 23:13:18 UTC (rev 1716)
+++ trunk/engine/src/test/java/com/metamatrix/query/processor/TestAggregateProcessing.java 2010-01-06 05:35:57 UTC (rev 1717)
@@ -33,6 +33,7 @@
import com.metamatrix.query.optimizer.TestAggregatePushdown;
import com.metamatrix.query.optimizer.TestOptimizer;
+import com.metamatrix.query.optimizer.capabilities.BasicSourceCapabilities;
import com.metamatrix.query.optimizer.capabilities.FakeCapabilitiesFinder;
import com.metamatrix.query.sql.lang.Command;
import com.metamatrix.query.unittest.FakeMetadataFacade;
@@ -269,5 +270,35 @@
helpProcess(plan, dataManager, expected);
}
+
+ @Test public void testUnionAggregatePushdown() {
+ Command command = helpParse("select count(*), max(e3) from (select e1, e2, e3 from pm1.g1 union all (select convert(e2, string) as a, e2, e3 from pm2.g2 order by a limit 10)) x group by e1, e2"); //$NON-NLS-1$
+
+ FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+ capFinder.addCapabilities("pm1", TestAggregatePushdown.getAggregateCapabilities()); //$NON-NLS-1$
+ BasicSourceCapabilities bac = TestAggregatePushdown.getAggregateCapabilities();
+ bac.setFunctionSupport("convert", true); //$NON-NLS-1$
+ capFinder.addCapabilities("pm2", bac); //$NON-NLS-1$
+ HardcodedDataManager dataManager = new HardcodedDataManager();
+
+ dataManager.addData("SELECT v_0.c_1, v_0.c_0, COUNT(*), MAX(v_0.c_2) FROM (SELECT g_0.e2 AS c_0, g_0.e1 AS c_1, g_0.e3 AS c_2 FROM pm1.g1 AS g_0) AS v_0 GROUP BY v_0.c_0, v_0.c_1", //$NON-NLS-1$
+ new List[] {
+ Arrays.asList(Integer.valueOf(2), "2", Integer.valueOf(2), Boolean.FALSE), //$NON-NLS-1$
+ Arrays.asList(Integer.valueOf(1), "1", Integer.valueOf(3), Boolean.TRUE), //$NON-NLS-1$
+ });
+ dataManager.addData("SELECT v_0.c_1, v_0.c_0, COUNT(*), MAX(v_0.c_2) FROM (SELECT g_0.e2 AS c_0, convert(g_0.e2, string) AS c_1, g_0.e3 AS c_2 FROM pm2.g2 AS g_0 ORDER BY c_1 LIMIT 10) AS v_0 GROUP BY v_0.c_0, v_0.c_1", //$NON-NLS-1$
+ new List[] {
+ Arrays.asList(Integer.valueOf(1), "1", Integer.valueOf(4), Boolean.FALSE), //$NON-NLS-1$
+ });
+
+ ProcessorPlan plan = helpGetPlan(command, FakeMetadataFactory.example1Cached(), capFinder);
+
+ List[] expected = new List[] {
+ Arrays.asList(Integer.valueOf(7), Boolean.TRUE),
+ Arrays.asList(Integer.valueOf(2), Boolean.FALSE),
+ };
+
+ helpProcess(plan, dataManager, expected);
+ }
}
Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java 2010-01-05 23:13:18 UTC (rev 1716)
+++ trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java 2010-01-06 05:35:57 UTC (rev 1717)
@@ -156,8 +156,7 @@
if(DEBUG) System.out.println("\n" + process); //$NON-NLS-1$
//per defect 10022, clone this plan before processing, just to make sure
//a cloned plan with correlated subquery references (or any cloned plan) can be processed
- ProcessorPlan cloned = (ProcessorPlan)process.clone();
- process = cloned;
+ process = process.clone();
assertNotNull("Output elements of process plan are null", process.getOutputElements()); //$NON-NLS-1$
@@ -183,7 +182,7 @@
public static void helpProcess(ProcessorPlan plan, CommandContext context, ProcessorDataManager dataManager, List[] expectedResults) {
try {
- ProcessorPlan clonePlan = (ProcessorPlan) plan.clone();
+ ProcessorPlan clonePlan = plan.clone();
// Process twice to test reset and clone
doProcess(plan, dataManager, expectedResults, context);
Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/TestQueryProcessor.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/processor/TestQueryProcessor.java 2010-01-05 23:13:18 UTC (rev 1716)
+++ trunk/engine/src/test/java/com/metamatrix/query/processor/TestQueryProcessor.java 2010-01-06 05:35:57 UTC (rev 1717)
@@ -29,17 +29,13 @@
import junit.framework.TestCase;
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
import com.metamatrix.common.buffer.BufferManager;
import com.metamatrix.common.buffer.BufferManagerFactory;
import com.metamatrix.common.buffer.TupleBatch;
import com.metamatrix.common.buffer.TupleBuffer;
import com.metamatrix.common.buffer.TupleSource;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
import com.metamatrix.core.MetaMatrixCoreException;
-import com.metamatrix.query.processor.BatchCollector.BatchHandler;
import com.metamatrix.query.sql.symbol.ElementSymbol;
import com.metamatrix.query.util.CommandContext;
Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestRelationalPlan.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestRelationalPlan.java 2010-01-05 23:13:18 UTC (rev 1716)
+++ trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestRelationalPlan.java 2010-01-06 05:35:57 UTC (rev 1717)
@@ -22,13 +22,10 @@
package com.metamatrix.query.processor.relational;
-import java.util.ArrayList;
+import java.util.List;
-import junit.framework.*;
+import junit.framework.TestCase;
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.MetaMatrixException;
-import com.metamatrix.common.buffer.BlockedException;
import com.metamatrix.common.buffer.TupleBatch;
/**
@@ -43,54 +40,12 @@
super(arg0);
}
- public void testNoRowsFirstBatch() {
- RelationalNode node = new RelationalNode(0) {
- public TupleBatch nextBatchDirect() throws BlockedException, MetaMatrixComponentException {
- TupleBatch batch = new TupleBatch(1, new ArrayList());
- batch.setTerminationFlag(true);
- return batch;
- }
-
- public Object clone(){
- throw new UnsupportedOperationException();
- }
- };
+ public void testNoRowsFirstBatch() throws Exception {
+ RelationalNode node = new FakeRelationalNode(0, new List[0]);
- try {
- RelationalPlan plan = new RelationalPlan(node);
- TupleBatch batch = plan.nextBatch();
- assertTrue("Did not get terminator batch", batch.getTerminationFlag()); //$NON-NLS-1$
-
- } catch(MetaMatrixException e) {
- e.printStackTrace();
- fail("Got unexpected exception: " + e.getFullMessage()); //$NON-NLS-1$
- }
-
-
+ RelationalPlan plan = new RelationalPlan(node);
+ TupleBatch batch = plan.nextBatch();
+ assertTrue("Did not get terminator batch", batch.getTerminationFlag()); //$NON-NLS-1$
}
- public void testNoRowsLaterBatch() {
- RelationalNode node = new RelationalNode(0) {
- public TupleBatch nextBatchDirect() throws BlockedException, MetaMatrixComponentException {
- TupleBatch batch = new TupleBatch(3, new ArrayList());
- batch.setTerminationFlag(true);
- return batch;
- }
-
- public Object clone(){
- throw new UnsupportedOperationException();
- }
- };
-
- try {
- RelationalPlan plan = new RelationalPlan(node);
- TupleBatch batch = plan.nextBatch();
- assertTrue("Did not get terminator batch", batch.getTerminationFlag()); //$NON-NLS-1$
-
- } catch(MetaMatrixException e) {
- e.printStackTrace();
- fail("Got unexpected exception: " + e.getFullMessage()); //$NON-NLS-1$
- }
- }
-
}
14 years, 4 months
teiid SVN: r1716 - trunk/test-integration/db/src/main/java/org/teiid/test/framework.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2010-01-05 18:13:18 -0500 (Tue, 05 Jan 2010)
New Revision: 1716
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java
Log:
Teiid-897 - cleanup
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 2010-01-05 23:11:48 UTC (rev 1715)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java 2010-01-05 23:13:18 UTC (rev 1716)
@@ -85,12 +85,7 @@
// And therefore, the exception needs to be set as an application exception,
// considered outside the bounds of the normal sqlexceptions.
test.setApplicationException(e);
-// if (!test.exceptionExpected()) {
-// e.printStackTrace();
-// debug("Error: " + e.getMessage());
-
-
-// }
+
}
debug(" test.after");
14 years, 4 months
teiid SVN: r1715 - trunk/test-integration/db/src/test/java/org/teiid/test/testcases.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2010-01-05 18:11:48 -0500 (Tue, 05 Jan 2010)
New Revision: 1715
Removed:
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/PessimisticWrapTransactionTests.java
Log:
Teiid-897 - changes to remove pessistic and optimistic tests because the autowrap options are no longer valid (per the error messages)
Deleted: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/PessimisticWrapTransactionTests.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/PessimisticWrapTransactionTests.java 2010-01-05 23:11:24 UTC (rev 1714)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/PessimisticWrapTransactionTests.java 2010-01-05 23:11:48 UTC (rev 1715)
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 2000-2007 MetaMatrix, Inc.
- * All rights reserved.
- */
-package org.teiid.test.testcases;
-
-import java.util.ArrayList;
-
-import org.teiid.test.framework.ConfigPropertyNames;
-import org.teiid.test.framework.TransactionContainer;
-import org.teiid.test.framework.query.AbstractQueryTransactionTest;
-import org.teiid.test.framework.query.QueryExecution;
-import org.teiid.test.framework.transaction.TxnAutoTransaction;
-
-import com.arjuna.common.internal.util.logging.commonPropertyManager;
-import com.metamatrix.jdbc.api.AbstractQueryTest;
-
-
-public class PessimisticWrapTransactionTests extends CommonTransactionTests {
-
- public PessimisticWrapTransactionTests(String testName) {
- super(testName);
- }
-
- protected TransactionContainer getTransactionContainter() {
-
- return new TxnAutoTransaction(ConfigPropertyNames.TXN_AUTO_WRAP_OPTIONS.AUTO_WRAP_PESSIMISTIC);
- }
-
- /**
- * Sources = 1
- * Commands = multiple - Success
- * Batching = Full Processing, Single Connector Batch
- * result = rollback
- */
- public void testSingleSourceMultipleCommandsReferentialIntegrityRollback() throws Exception {
- AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
- public void testCase() throws Exception {
- for (int i = 200; i < 210; i++) {
- Integer val = new Integer(i);
- execute("insert into pm1.g1 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
- execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
- }
-
- // try to rollback, however since this pessimistic above two are already commited
- execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {new Integer(9999), "9999"});
- }
-
- public boolean exceptionExpected() {
- return true;
- }
- };
-
- // run test
- getTransactionContainter().runTransaction(userTxn);
-
- // now verify the results
- AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
- test.execute("select * from g1 where e1 >= 200 and e1 < 210");
- test.assertRowCount(10);
- test.execute("select * from g2 where e1 = 9999");
- test.assertRowCount(0);
- test.closeConnection();
- }
-
- /**
- * Sources = 1
- * Commands = multiple - Success
- * Batching = Full Processing, Single Connector Batch
- * result = rollback
- */
- public void testSingleSourceBatchCommandReferentialIntegrityRollback() throws Exception {
- AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
- public void testCase() throws Exception {
- ArrayList list = new ArrayList();
- for (int i = 200; i < 210; i++) {
- list.add("insert into pm1.g1 (e1, e2) values("+i+",'"+i+"')");
- }
-
- // try to rollback, since we are in single batch it must rollback
- list.add("insert into pm1.g2 (e1, e2) values(9999,'9999')");
- executeBatch((String[])list.toArray(new String[list.size()]));
- }
-
- public boolean exceptionExpected() {
- return true;
- }
- };
-
- // run test
- getTransactionContainter().runTransaction(userTxn);
-
- // now verify the results
- AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
- test.execute("select * from g1 where e1 >= 200 and e1 < 210");
- test.assertRowCount(0);
- test.execute("select * from g2 where e1 = 9999");
- test.assertRowCount(0);
- test.closeConnection();
- }
-
- /**
- * Sources = 2
- * Commands = 1, Update
- * Batching = Full Processing, Single Connector Batch
- * result = commit
- */
- public void testMultipleSourceBulkRowInsertRollback() throws Exception {
- AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
- ArrayList list = new ArrayList();
- public void testCase() throws Exception {
- for (int i = 100; i < 120; i++) {
- list.add("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values("+i+",'"+i+"',"+i+",'"+i+"')");
- }
- list.add("select pm1.g1.e1, pm1.g1.e2 into pm2.g2 from pm1.g1 where pm1.g1.e1 >= 100");
-
- // force the rollback by trying to insert an invalid row.
- list.add("insert into pm1.g2 (e1, e2) values(9999,'9999')");
-
- executeBatch((String[])list.toArray(new String[list.size()]));
- }
-
- public boolean exceptionExpected() {
- return true;
- }
- };
-
- // run test
- getTransactionContainter().runTransaction(userTxn);
-
- // now verify the results
- AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
- test.execute("select * from g1 where e1 >= 100 and e1 < 120");
- test.assertRowCount(0);
- test.closeConnection();
-
- test = new QueryExecution(userTxn.getSource("pm2"));
- test.execute("select * from g1 where e1 >= 100 and e1 < 120");
- test.assertRowCount(0);
- test.execute("select * from g2 where e1 >= 100 and e1 < 120");
- test.assertRowCount(0);
- test.closeConnection();
- }
-}
14 years, 4 months
teiid SVN: r1714 - in trunk/test-integration/db/src: test/java/org/teiid/test/testcases and 1 other directory.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2010-01-05 18:11:24 -0500 (Tue, 05 Jan 2010)
New Revision: 1714
Added:
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/OnWrapTransactionTests.java
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyNames.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java
Log:
Teiid-897 - changes to remove pessistic and optimistic tests because the autowrap options are no longer valid (per the error messages)
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyNames.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyNames.java 2010-01-05 22:53:32 UTC (rev 1713)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyNames.java 2010-01-05 23:11:24 UTC (rev 1714)
@@ -124,9 +124,6 @@
public static final String AUTO_WRAP_ON = ExecutionProperties.TXN_WRAP_ON; //$NON-NLS-1$
public static final String AUTO_WRAP_AUTO = ExecutionProperties.TXN_WRAP_AUTO; //$NON-NLS-1$
- public static final String AUTO_WRAP_PESSIMISTIC = "PESSIMISTIC"; //$NON-NLS-1$
- public static final String AUTO_WRAP_OPTIMISTIC = "OPTIMISTIC"; //$NON-NLS-1$
-
}
}
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 2010-01-05 22:53:32 UTC (rev 1713)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java 2010-01-05 23:11:24 UTC (rev 1714)
@@ -81,13 +81,16 @@
test.testCase();
} catch (Throwable e) {
-
- if (!test.exceptionExpected()) {
- e.printStackTrace();
- debug("Error: " + e.getMessage());
- test.setApplicationException(e);
+ // this catches the non-SQLExceptions that the AbstractQueryTest catches.
+ // And therefore, the exception needs to be set as an application exception,
+ // considered outside the bounds of the normal sqlexceptions.
+ test.setApplicationException(e);
+// if (!test.exceptionExpected()) {
+// e.printStackTrace();
+// debug("Error: " + e.getMessage());
+
- }
+// }
}
debug(" test.after");
Added: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/OnWrapTransactionTests.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/OnWrapTransactionTests.java (rev 0)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/OnWrapTransactionTests.java 2010-01-05 23:11:24 UTC (rev 1714)
@@ -0,0 +1,173 @@
+/*
+ * 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 org.teiid.test.testcases;
+
+import java.util.ArrayList;
+
+import org.teiid.test.framework.TransactionContainer;
+
+import org.teiid.test.framework.ConfigPropertyNames.TXN_AUTO_WRAP_OPTIONS;
+import org.teiid.test.framework.query.AbstractQueryTransactionTest;
+import org.teiid.test.framework.query.QueryExecution;
+import org.teiid.test.framework.transaction.TxnAutoTransaction;
+
+import com.metamatrix.jdbc.api.AbstractQueryTest;
+
+/**
+ * @author vanhalbert
+ *
+ */
+public class OnWrapTransactionTests extends CommonTransactionTests {
+
+ public OnWrapTransactionTests(String testName) {
+ super(testName);
+ }
+
+ @Override
+ protected TransactionContainer getTransactionContainter() {
+ return new TxnAutoTransaction(TXN_AUTO_WRAP_OPTIONS.AUTO_WRAP_ON);
+ }
+
+ /**
+ * Sources = 1 Commands = multiple Success Batching = Full Processing,
+ * Single Connector Batch result = rollback
+ */
+ public void testSingleSourceMultipleCommandsReferentialIntegrityRollback()
+ throws Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest(
+ "testSingleSourceMultipleCommandsReferentialIntegrityRollback") {
+ public void testCase() throws Exception {
+ for (int i = 200; i < 210; i++) {
+ Integer val = new Integer(i);
+ execute("insert into pm1.g1 (e1, e2) values(?,?)",
+ new Object[] { val, val.toString() });
+ execute("insert into pm1.g2 (e1, e2) values(?,?)",
+ new Object[] { val, val.toString() });
+ }
+
+ // try to rollback, however since this autocommit=on above two
+ // are already commited
+ execute("insert into pm1.g2 (e1, e2) values(?,?)",
+ new Object[] { new Integer(9999), "9999" });
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 200 and e1 < 210");
+ test.assertRowCount(10);
+ test.execute("select * from g2 where e1 = 9999");
+ test.assertRowCount(0);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 1 Commands = multiple Success Batching = Full Processing,
+ * Single Connector Batch result = rollback
+ */
+ public void testSingleSourceBatchCommandReferentialIntegrityRollback()
+ throws Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest(
+ "testSingleSourceBatchCommandReferentialIntegrityRollback") {
+ public void testCase() throws Exception {
+ ArrayList list = new ArrayList();
+ for (int i = 200; i < 210; i++) {
+ list.add("insert into pm1.g1 (e1, e2) values(" + i + ",'"
+ + i + "')");
+ }
+
+ // try to rollback, since we are in single batch it must
+ // rollback
+ list.add("insert into pm1.g2 (e1, e2) values(9999,'9999')");
+ executeBatch((String[]) list.toArray(new String[list.size()]));
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 200 and e1 < 210");
+ test.assertRowCount(0);
+ test.execute("select * from g2 where e1 = 9999");
+ test.assertRowCount(0);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 2 Commands = 1, Update Batching = Full Processing, Single
+ * Connector Batch result = commit
+ */
+ public void testMultipleSourceBulkRowInsertRollback() throws Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest(
+ "testMultipleSourceBulkRowInsertRollback") {
+ ArrayList list = new ArrayList();
+
+ public void testCase() throws Exception {
+ for (int i = 100; i < 110; i++) {
+ list
+ .add("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values("
+ + i + ",'" + i + "'," + i + ",'" + i + "')");
+ }
+ list
+ .add("select pm1.g1.e1, pm1.g1.e2 into pm2.g2 from pm1.g1 where pm1.g1.e1 >= 100");
+
+ // force the rollback by trying to insert an invalid row.
+ list.add("insert into pm1.g2 (e1, e2) values(9999,'9999')");
+
+ executeBatch((String[]) list.toArray(new String[list.size()]));
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 100 and e1 < 110");
+ test.assertRowCount(0);
+ test.closeConnection();
+
+ test = new QueryExecution(userTxn.getSource("pm2"));
+ test.execute("select * from g1 where e1 >= 100 and e1 < 110");
+ test.assertRowCount(0);
+ test.execute("select * from g2 where e1 >= 100 and e1 < 110");
+ test.assertRowCount(0);
+ test.closeConnection();
+ }
+}
Property changes on: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/OnWrapTransactionTests.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 4 months
teiid SVN: r1713 - trunk/test-integration/db/src/test/java/org/teiid/test/testcases.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2010-01-05 17:53:32 -0500 (Tue, 05 Jan 2010)
New Revision: 1713
Removed:
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/OnWrapTransactionTests.java
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/OptimisticTransactionTests.java
Log:
Teiid-897 - changes to remove pessistic and optimistic tests because the autowrap options are no longer valid (per the error messages)
Deleted: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/OnWrapTransactionTests.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/OnWrapTransactionTests.java 2010-01-05 22:22:10 UTC (rev 1712)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/OnWrapTransactionTests.java 2010-01-05 22:53:32 UTC (rev 1713)
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2000-2007 MetaMatrix, Inc.
- * All rights reserved.
- */
-package org.teiid.test.testcases;
-
-import java.util.ArrayList;
-
-import org.teiid.test.framework.TransactionContainer;
-import org.teiid.test.framework.ConfigPropertyNames.TXN_AUTO_WRAP_OPTIONS;
-import org.teiid.test.framework.query.AbstractQueryTransactionTest;
-import org.teiid.test.framework.query.QueryExecution;
-import org.teiid.test.framework.transaction.TxnAutoTransaction;
-
-import com.metamatrix.jdbc.api.AbstractQueryTest;
-
-
-
-
-public class OnWrapTransactionTests extends CommonTransactionTests {
-
- public OnWrapTransactionTests(String testName) {
- super(testName);
- }
-
-
- @Override
- protected TransactionContainer getTransactionContainter() {
- return new TxnAutoTransaction(TXN_AUTO_WRAP_OPTIONS.AUTO_WRAP_ON);
- }
-
- /**
- * Sources = 1
- * Commands = multiple - Success
- * Batching = Full Processing, Single Connector Batch
- * result = rollback
- */
- public void testSingleSourceMultipleCommandsReferentialIntegrityRollback() throws Exception {
- AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourceMultipleCommandsReferentialIntegrityRollback") {
- public void testCase() throws Exception {
- for (int i = 200; i < 210; i++) {
- Integer val = new Integer(i);
- execute("insert into pm1.g1 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
- execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
- }
-
- // try to rollback, however since this autocommit=on above two are already commited
- execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {new Integer(9999), "9999"});
- }
-
- public boolean exceptionExpected() {
- return true;
- }
- };
-
- // run test
- getTransactionContainter().runTransaction(userTxn);
-
- // now verify the results
- AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
- test.execute("select * from g1 where e1 >= 200 and e1 < 210");
- test.assertRowCount(10);
- test.execute("select * from g2 where e1 = 9999");
- test.assertRowCount(0);
- test.closeConnection();
- }
-
-
- /**
- * Sources = 1
- * Commands = multiple - Success
- * Batching = Full Processing, Single Connector Batch
- * result = rollback
- */
- public void testSingleSourceBatchCommandReferentialIntegrityRollback() throws Exception {
- AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourceBatchCommandReferentialIntegrityRollback") {
- public void testCase() throws Exception {
- ArrayList list = new ArrayList();
- for (int i = 200; i < 210; i++) {
- list.add("insert into pm1.g1 (e1, e2) values("+i+",'"+i+"')");
- }
-
- // try to rollback, since we are in single batch it must rollback
- list.add("insert into pm1.g2 (e1, e2) values(9999,'9999')");
- executeBatch((String[])list.toArray(new String[list.size()]));
- }
-
- public boolean exceptionExpected() {
- return true;
- }
- };
-
- // run test
- getTransactionContainter().runTransaction(userTxn);
-
- // now verify the results
- AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
- test.execute("select * from g1 where e1 >= 200 and e1 < 210");
- test.assertRowCount(0);
- test.execute("select * from g2 where e1 = 9999");
- test.assertRowCount(0);
- test.closeConnection();
- }
-
- /**
- * Sources = 2
- * Commands = 1, Update
- * Batching = Full Processing, Single Connector Batch
- * result = commit
- */
- public void testMultipleSourceBulkRowInsertRollback() throws Exception {
- AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceBulkRowInsertRollback") {
- ArrayList list = new ArrayList();
- public void testCase() throws Exception {
- for (int i = 100; i < 110; i++) {
- list.add("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values("+i+",'"+i+"',"+i+",'"+i+"')");
- }
- list.add("select pm1.g1.e1, pm1.g1.e2 into pm2.g2 from pm1.g1 where pm1.g1.e1 >= 100");
-
- // force the rollback by trying to insert an invalid row.
- list.add("insert into pm1.g2 (e1, e2) values(9999,'9999')");
-
- executeBatch((String[])list.toArray(new String[list.size()]));
- }
-
- public boolean exceptionExpected() {
- return true;
- }
- };
-
- // run test
- getTransactionContainter().runTransaction(userTxn);
-
- // now verify the results
- AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
- test.execute("select * from g1 where e1 >= 100 and e1 < 110");
- test.assertRowCount(0);
- test.closeConnection();
-
- test = new QueryExecution(userTxn.getSource("pm2"));
- test.execute("select * from g1 where e1 >= 100 and e1 < 110");
- test.assertRowCount(0);
- test.execute("select * from g2 where e1 >= 100 and e1 < 110");
- test.assertRowCount(0);
- test.closeConnection();
- }
-}
Deleted: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/OptimisticTransactionTests.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/OptimisticTransactionTests.java 2010-01-05 22:22:10 UTC (rev 1712)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/OptimisticTransactionTests.java 2010-01-05 22:53:32 UTC (rev 1713)
@@ -1,534 +0,0 @@
-/*
- * Copyright (c) 2000-2007 MetaMatrix, Inc.
- * All rights reserved.
- */
-package org.teiid.test.testcases;
-
-import java.util.ArrayList;
-
-import org.teiid.test.framework.TransactionContainer;
-import org.teiid.test.framework.ConfigPropertyNames.TXN_AUTO_WRAP_OPTIONS;
-import org.teiid.test.framework.query.AbstractQueryTransactionTest;
-import org.teiid.test.framework.query.QueryExecution;
-import org.teiid.test.framework.transaction.TxnAutoTransaction;
-
-import com.metamatrix.jdbc.api.AbstractQueryTest;
-
-
-
-/**
- * The main thing to test in this is, when the single source should is involved it should work
- * fine, when multiple sources involved it should fail.
- */
-public class OptimisticTransactionTests extends BaseAbstractTransactionTestCase {
-
- public OptimisticTransactionTests(String testName) {
- super(testName);
- }
-
- protected TransactionContainer getTransactionContainter() {
- return new TxnAutoTransaction(TXN_AUTO_WRAP_OPTIONS.AUTO_WRAP_OPTIMISTIC);
- }
-
- ///////////////////////////////////////////////////////////////////////////////////////////////
- // Single Source - Rows below 500 (for insert/update/delete)
- ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Sources = 1
- * Commands = 1, Select
- * Batching = Full Processing, Single Connector Batch
- * result = commit
- */
- public void testSingleSourceSelect() throws Exception {
- AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourceSelect") {
- public void testCase() throws Exception {
- execute("select * from pm1.g1 where pm1.g1.e1 < 100");
- assertRowCount(100);
- }
- };
-
- // run test
- getTransactionContainter().runTransaction(userTxn);
- }
-
- /**
- * Sources = 1
- * Commands = 1, Update(prepared statement)
- * Batching = Full Processing, Single Connector Batch
- * result = commit
- */
- public void testSingleSourcePreparedUpdate() throws Exception {
- AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourcePreparedUpdate") {
- public void testCase() throws Exception {
- execute("insert into pm1.g1 (e1, e2) values(?, ?)", new Object[] {new Integer(102), "102"});
- }
- };
-
- // run test
- getTransactionContainter().runTransaction(userTxn);
-
- // now verify the results
- AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
- test.execute("select * from g1 where e1 = 102");
- test.assertRowCount(1);
- test.closeConnection();
- }
-
- /**
- * Sources = 1
- * Commands = multiple - Success
- * Batching = Full Processing, Single Connector Batch
- * result = commit
- */
- public void testSingleSourceMultipleCommands() throws Exception {
- AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourceMultipleCommands") {
- public void testCase() throws Exception {
- execute("delete from pm1.g2 where pm1.g2.e1 >= ?", new Object[] {new Integer(100)});
- execute("delete from pm1.g1 where pm1.g1.e1 >= ?", new Object[] {new Integer(100)});
-
- execute("select * from pm1.g1");
- assertRowCount(100);
- for (int i = 100; i < 120; i++) {
- Integer val = new Integer(i);
- execute("insert into pm1.g1 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
- execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
- }
- }
- };
-
- // run test
- getTransactionContainter().runTransaction(userTxn);
-
- // now verify the results
- AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
- test.execute("select * from g1 where e1 >= 100 and e1 < 120");
- test.assertRowCount(20);
- test.execute("select * from g2 where e1 >= 100 and e1 < 120");
- test.assertRowCount(20);
- test.closeConnection();
- }
-
- /**
- * Sources = 1
- * Commands = multiple - Success
- * Batching = Full Processing, Single Connector Batch
- * result = commit
- */
- public void testSingleSourceBatchCommand() throws Exception {
- AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourceBatchCommand") {
- public void testCase() throws Exception {
- ArrayList list = new ArrayList();
- list.add("delete from pm1.g2 where pm1.g2.e1 >= 100");
- list.add("delete from pm1.g1 where pm1.g1.e1 >= 100");
-
- for (int i = 200; i < 205; i++) {
- list.add("insert into pm1.g1 (e1, e2) values("+i+",'"+i+"')");
- list.add("insert into pm1.g2 (e1, e2) values("+i+",'"+i+"')");
- }
- executeBatch((String[])list.toArray(new String[list.size()]));
- }
- };
-
- // run test
- getTransactionContainter().runTransaction(userTxn);
-
- // now verify the results
- AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
- test.execute("select * from g1 where e1 >= 200 and e1 < 205");
- test.assertRowCount(5);
- test.execute("select * from g2 where e1 >= 200 and e1 < 205");
- test.assertRowCount(5);
- test.closeConnection();
- }
-
- /**
- * Sources = 1
- * Commands = 1, Update(prepared statement)
- * Batching = Full Processing, Single Connector Batch
- * result = commit
- */
- public void testSingleSourcePreparedUpdateRollback() throws Exception {
- AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourcePreparedUpdateRollback") {
- public void testCase() throws Exception {
- execute("insert into pm1.g2 (e1, e2) values(?, ?)", new Object[] {new Integer(9999), "9999"});
- }
-
- public boolean exceptionExpected() {
- return true;
- }
- };
-
- // run test
- getTransactionContainter().runTransaction(userTxn);
-
- // now verify the results
- AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
- test.execute("select * from g2 where e1 = 9999");
- test.assertRowCount(0);
- test.closeConnection();
- }
-
-
- /**
- * Sources = 1
- * Commands = multiple - Success
- * Batching = Full Processing, Single Connector Batch
- * result = commit
- */
- public void testSingleSourceMultipleCommandsRollback() throws Exception {
- AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourceMultipleCommandsRollback") {
- public void testCase() throws Exception {
- execute("delete from pm1.g2 where pm1.g2.e1 >= ?", new Object[] {new Integer(100)});
- execute("delete from pm1.g1 where pm1.g1.e1 >= ?", new Object[] {new Integer(100)});
-
- execute("select * from pm1.g1");
- assertRowCount(100);
-
- for (int i = 300; i < 310; i++) {
- Integer val = new Integer(i);
- execute("insert into pm1.g1 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
- execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[] {val, val.toString()});
- }
-
- // this will make it rollback
- execute("insert into pm1.g2 (e1, e2) values(?, ?)", new Object[] {new Integer(9999), "9999"});
- }
-
- public boolean exceptionExpected() {
- return true;
- }
-
- };
-
- // run test
- getTransactionContainter().runTransaction(userTxn);
-
- // now verify the results (since they are not bundled in single command they should be treated individually)
- AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
- test.execute("select * from g1 where e1 >= 300 and e1 < 310");
- test.assertRowCount(10);
- test.execute("select * from g2 where e1 >= 300 and e1 < 310");
- test.assertRowCount(10);
- test.execute("select * from g2 where e1 = 9999");
- test.assertRowCount(0);
- test.closeConnection();
- }
-
- /**
- * Sources = 1
- * Commands = multiple - Success
- * Batching = Full Processing, Single Connector Batch
- * result = commit
- */
- public void testSingleSourceBatchCommandRollback() throws Exception {
- AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourceBatchCommandRollback") {
- public void testCase() throws Exception {
- ArrayList list = new ArrayList();
- list.add("delete from pm1.g2 where pm1.g2.e1 >= 100");
- list.add("delete from pm1.g1 where pm1.g1.e1 >= 100");
-
- for (int i = 400; i < 410; i++) {
- list.add("insert into pm1.g1 (e1, e2) values("+i+",'"+i+"')");
- list.add("insert into pm1.g2 (e1, e2) values("+i+",'"+i+"')");
- }
-
- // this will make it rollback
- list.add("insert into pm1.g2 (e1, e2) values(9999, '9999')");
-
- executeBatch((String[])list.toArray(new String[list.size()]));
- }
-
- public boolean exceptionExpected() {
- return true;
- }
-
- };
-
- // run test
- getTransactionContainter().runTransaction(userTxn);
-
- // now verify the results (all commands will trated as single under single transaction)
- AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
- test.execute("select * from g1 where e1 >= 400 and e1 < 410");
- test.assertRowCount(0);
- test.execute("select * from g2 where e1 >= 400 and e1 < 410");
- test.assertRowCount(0);
- test.execute("select * from g2 where e1 = 9999");
- test.assertRowCount(0);
- test.closeConnection();
- }
-
- ///////////////////////////////////////////////////////////////////////////////////////////////
- // Multiple Sources - Rows from 500
- ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Sources = 2
- * Commands = 1, Select
- * Batching = Full Processing, Single Connector Batch
- * result = commit
- */
- public void testMultipleSourceSelect() throws Exception {
- AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceSelect") {
- public void testCase() throws Exception {
- execute("select * from pm1.g1 join pm2.g1 on pm1.g1.e1 = pm2.g1.e1 where pm1.g1.e1 < 100");
- assertRowCount(100);
- }
-
- public void after() {
- // selects are special case as they will not fail to use multiple sources. The transaction
- // source count only starts when there are updates to db, so this is OK
- if (exceptionOccurred()) {
- fail("should not have failed to involve multiple sources under optimistic txn");
- }
- }
- };
-
- // run test
- getTransactionContainter().runTransaction(userTxn);
- }
-
- /**
- * Sources = 2
- * Commands = 1, Select
- * Batching = Full Processing, Single Connector Batch
- * result = commit
- */
- public void testMultipleSourceUpdate() throws Exception {
- AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceUpdate") {
- public void testCase() throws Exception {
- Integer value = new Integer(500);
- execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values(?,?,?,?)", new Object[] {value, value.toString(), value, value.toString()});
- }
-
- public boolean exceptionExpected() {
- return true;
- }
-
- public void after() {
- if (!exceptionOccurred()) {
- fail("should have failed to involve multiple sources under optimistic txn");
- }
- else {
- if (getLastException() != null) {
- this.getLastException().printStackTrace();
-// String msg = getLastException().getMessage();
-// boolean isfound = (msg.indexOf("txnAutoWrap=OPTIMISTIC") != -1 ? true : false);
-// assertTrue(isfound);
- } else {
- fail("Program Error: it indicates exception occured, but no exception is found" );
- }
-
- // assertTrue(getLastException().getMessage(), getLastException().getMessage().indexOf("txnAutoWrap=OPTIMISTIC") != -1);
- }
- }
- };
-
- // run test
- getTransactionContainter().runTransaction(userTxn);
- }
-
- /**
- * Sources = 2
- * Commands = multiple - Success
- * Batching = Full Processing, Single Connector Batch
- * result = commit
- */
- public void testMultipleSourcesBatchCommand() throws Exception {
- AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourcesBatchCommand") {
- public void testCase() throws Exception {
- ArrayList list = new ArrayList();
- list.add("delete from pm1.g2 where pm1.g2.e1 >= 100");
- list.add("delete from pm1.g1 where pm1.g1.e1 >= 100");
-
- list.add("delete from pm2.g2 where pm2.g2.e1 >= 100");
- list.add("delete from pm2.g1 where pm2.g1.e1 >= 100");
-
- for (int i = 200; i < 210; i++) {
- list.add("insert into pm1.g1 (e1, e2) values("+i+",'"+i+"')");
- list.add("insert into pm1.g2 (e1, e2) values("+i+",'"+i+"')");
-
- list.add("insert into pm1.g1 (e1, e2) values("+i+",'"+i+"')");
- list.add("insert into pm1.g2 (e1, e2) values("+i+",'"+i+"')");
- }
- executeBatch((String[])list.toArray(new String[list.size()]));
- }
-
- public void after() {
- if (!exceptionOccurred()) {
- fail("should have failed to involve multiple sources under optimistic txn");
- }
- else {
- if (getLastException() != null) {
- this.getLastException().printStackTrace();
-// String msg = getLastException().getMessage();
-// boolean isfound = (msg.indexOf("txnAutoWrap=OPTIMISTIC") != -1 ? true : false);
-// assertTrue(isfound);
- } else {
- fail("Program Error: it indicates exception occured, but no exception is found" );
- }
- // assertTrue(getLastException().getMessage(), getLastException().getMessage().indexOf("txnAutoWrap=OPTIMISTIC") != -1);
- }
- }
-
- public boolean exceptionExpected() {
- return true;
- }
-
- };
-
- getTransactionContainter().runTransaction(userTxn);
- }
-
- /**
- * Sources = 2
- * Commands = 1, Select
- * Batching = Full Processing, Single Connector Batch
- * result = commit
- */
- public void testMultipleSourceVirtualSelect() throws Exception {
- AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceVirtualSelect") {
- public void testCase() throws Exception {
- execute("select * from vm.g1");
- }
-
- public void after() {
- if (exceptionOccurred()) {
- fail("should not have failed to involve multiple sources under optimistic txn");
- }
- }
- };
-
- getTransactionContainter().runTransaction(userTxn);
- }
-
- /**
- * Sources = 2
- * Commands = 1, Select
- * Batching = Full Processing, Single Connector Batch
- * result = commit
- */
- public void testMultipleSourceVirtualProceduralSelect() throws Exception {
- AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceVirtualProceduralSelect") {
- public void testCase() throws Exception {
- execute("select * from vm.p1");
- }
- // if vm.p1 needs a transaction, depends on transformation
- //
- public void after() {
- if (exceptionOccurred()) {
- fail("should have failed to involve multiple sources under optimistic txn");
- }
- }
- };
-
- getTransactionContainter().runTransaction(userTxn);
- }
-
- /**
- * Sources = 2
- * Commands = 1, Select
- * Batching = Full Processing, Single Connector Batch
- * result = commit
- */
- public void testMultipleSourceVirtualProcedure() throws Exception {
- AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceVirtualProcedure") {
- public void testCase() throws Exception {
- execute("select * from vm.p2 where vm.p2.e1 = ? and vm.p2.e2 = ?", new Object[] {new Integer(200), "200"});
- }
-
- public boolean exceptionExpected() {
- return true;
- }
-
- public void after() {
- if (!exceptionOccurred()) {
- fail("should have failed to involve multiple sources under optimistic txn");
- }
- else {
- if (getLastException() != null) {
- this.getLastException().printStackTrace();
-// String msg = getLastException().getMessage();
-// boolean isfound = (msg.indexOf("txnAutoWrap=OPTIMISTIC") != -1 ? true : false);
-// assertTrue(isfound);
- } else {
- fail("Program Error: it indicates exception occured, but no exception is found" );
- }
- // assertTrue(getLastException().getMessage(), getLastException().getMessage().indexOf("txnAutoWrap=OPTIMISTIC") != -1);
- }
- }
- };
-
- getTransactionContainter().runTransaction(userTxn);
- }
-
- public void testMultipleSourceVirtualProceduralSelectWithUpdate() throws Exception {
- AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceVirtualProceduralSelectWithUpdate") {
- public void testCase() throws Exception {
- execute("exec vm.p2(?, ?)", new Object[] {new Integer(200), "200"});
- }
-
- public boolean exceptionExpected() {
- return true;
- }
-
- public void after() {
- if (!exceptionOccurred()) {
- fail("should have failed to involve multiple sources under optimistic txn");
- }
- else {
- if (getLastException() != null) {
- this.getLastException().printStackTrace();
-// String msg = getLastException().getMessage();
-// boolean isfound = (msg.indexOf("txnAutoWrap=OPTIMISTIC") != -1 ? true : false);
-// assertTrue(isfound);
- } else {
- fail("Program Error: it indicates exception occured, but no exception is found" );
- }
- // assertTrue(getLastException().getMessage(), getLastException().getMessage().indexOf("txnAutoWrap=OPTIMISTIC") != -1);
- }
- }
- };
-
- getTransactionContainter().runTransaction(userTxn);
- }
-
- /**
- * Sources = 2
- * Commands = 1, Select
- * Batching = Full Processing, Single Connector Batch
- * result = commit
- */
- public void testMultipleSourceVirtualUpdate() throws Exception {
- AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceVirtualUpdate") {
- public void testCase() throws Exception {
- execute("delete from vm.g1 where vm.g1.pm1e1 > 100");
- }
-
- public void after() {
- if (!exceptionOccurred()) {
- fail("should have failed to involve multiple sources under optimistic txn");
- }
- else {
- if (getLastException() != null) {
- this.getLastException().printStackTrace();
-// String msg = getLastException().getMessage();
-// boolean isfound = (msg.indexOf("txnAutoWrap=OPTIMISTIC") != -1 ? true : false);
-// assertTrue(isfound);
- } else {
- fail("Program Error: it indicates exception occured, but no exception is found" );
- }
- // assertTrue(getLastException().getMessage(), getLastException().getMessage().indexOf("txnAutoWrap=OPTIMISTIC") != -1);
- }
- }
-
- public boolean exceptionExpected() {
- return true;
- }
-
- };
-
- getTransactionContainter().runTransaction(userTxn);
- }
-}
14 years, 4 months
teiid SVN: r1712 - in trunk/test-integration/db/src: test/java/org/teiid/test/testcases and 1 other directory.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2010-01-05 17:22:10 -0500 (Tue, 05 Jan 2010)
New Revision: 1712
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/query/AbstractQueryTransactionTest.java
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/CommonTransactionTests.java
Log:
Teiid 781 - fixed the Timeout test, changed to look at the cause exception in order to match the expected results.
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/query/AbstractQueryTransactionTest.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/query/AbstractQueryTransactionTest.java 2010-01-05 20:32:42 UTC (rev 1711)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/query/AbstractQueryTransactionTest.java 2010-01-05 22:22:10 UTC (rev 1712)
@@ -56,6 +56,9 @@
protected ConnectionStrategy connStrategy;
+ // because only a SQLException is accounted for in AbstractQueryTest,
+ // the applicationException is used to when unaccounted for exceptions occur. This could
+ // unintentional errors from the driver or ctc client test code.
private Throwable applicationException=null;
public AbstractQueryTransactionTest() {
@@ -102,9 +105,6 @@
statement.setExecutionProperty(
CONNECTION_STRATEGY_PROPS.TXN_AUTO_WRAP,
txnautowrap);
-
-
-// this.print("TransactionAutoWrap = " + txnautowrap);
}
String fetchSizeStr = executionProperties
@@ -298,7 +298,13 @@
return super.getLastException();
}
if (this.applicationException != null) {
- return new SQLException(this.applicationException.getClass().getName() + ":" + this.applicationException.getMessage());
+ if (this.applicationException instanceof SQLException) {
+ return (SQLException) this.applicationException;
+ }
+
+ com.metamatrix.jdbc.MMSQLException mm = new com.metamatrix.jdbc.MMSQLException(this.applicationException.getMessage());
+ return mm;
+
}
return null;
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/CommonTransactionTests.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/CommonTransactionTests.java 2010-01-05 20:32:42 UTC (rev 1711)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/CommonTransactionTests.java 2010-01-05 22:22:10 UTC (rev 1712)
@@ -6,6 +6,7 @@
import java.sql.SQLException;
import java.util.ArrayList;
+import java.util.concurrent.TimeoutException;
import org.teiid.test.framework.TransactionContainer;
import org.teiid.test.framework.query.AbstractQueryTransactionTest;
@@ -516,9 +517,28 @@
}
else {
if (getLastException() != null) {
- String msg = getLastException().getMessage();
- boolean isfound = (msg.indexOf("Operation timed out before completion") != -1 ? true : false);
- assertTrue("Exception Message didnt match 'Operation timed out before completion' found: " + msg, isfound );
+
+ String msg = "NA";
+ SQLException s = getLastException();
+
+ Throwable t = s.getCause();
+ if (t instanceof TimeoutException) {
+ msg = t.getMessage();
+ } else if (s instanceof com.metamatrix.jdbc.MMSQLException) {
+ com.metamatrix.jdbc.MMSQLException mm = (com.metamatrix.jdbc.MMSQLException) t;
+ if (mm.getNextException() != null) {
+ SQLException next = mm.getNextException();
+ msg = next.getMessage();
+ } else {
+ msg = mm.getMessage();
+ }
+ } else {
+
+ msg = s.getMessage();
+ }
+ boolean isfound = (msg.indexOf("Operation timed out before completion") != -1 ? true : false);
+
+ assertTrue("Exception Message didnt match 'Operation timed out before completion' found: " + msg, isfound );
} else {
fail("Program Error: it indicates exception occured, but no exception is found" );
}
14 years, 4 months