teiid SVN: r3188 - branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/events/jboss.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-05-23 15:32:30 -0400 (Mon, 23 May 2011)
New Revision: 3188
Modified:
branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/events/jboss/JGroupsEventDistributor.java
Log:
TEIID-1591 changing to depend upon ChannelFactory
Modified: branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/events/jboss/JGroupsEventDistributor.java
===================================================================
--- branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/events/jboss/JGroupsEventDistributor.java 2011-05-23 19:15:59 UTC (rev 3187)
+++ branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/events/jboss/JGroupsEventDistributor.java 2011-05-23 19:32:30 UTC (rev 3188)
@@ -35,7 +35,7 @@
import org.jboss.util.naming.Util;
import org.jgroups.Address;
import org.jgroups.Channel;
-import org.jgroups.JChannelFactory;
+import org.jgroups.ChannelFactory;
import org.jgroups.ReceiverAdapter;
import org.jgroups.View;
import org.jgroups.blocks.GroupRequest;
@@ -58,7 +58,7 @@
private static final long serialVersionUID = -1140683411842561358L;
- private transient JChannelFactory channelFactory;
+ private transient ChannelFactory channelFactory;
private String multiplexerStack;
private String clusterName;
private String jndiName;
@@ -71,7 +71,7 @@
private transient RpcDispatcher rpcDispatcher;
private transient Vector<Address> members;
- public JChannelFactory getChannelFactory() {
+ public ChannelFactory getChannelFactory() {
return channelFactory;
}
@@ -99,7 +99,7 @@
return clusterName;
}
- public void setChannelFactory(JChannelFactory channelFactory) {
+ public void setChannelFactory(ChannelFactory channelFactory) {
this.channelFactory = channelFactory;
}
@@ -115,7 +115,7 @@
if (this.channelFactory == null) {
return; //no need to distribute events
}
- channel = this.channelFactory.createMultiplexerChannel(this.multiplexerStack, null);
+ channel = this.channelFactory.createMultiplexerChannel(this.multiplexerStack, "teiid-events"); //$NON-NLS-1$
channel.connect(this.clusterName);
proxyEventDistributor = (EventDistributor) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {EventDistributor.class}, new ProxyHandler());
13 years, 7 months
teiid SVN: r3187 - branches.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2011-05-23 15:15:59 -0400 (Mon, 23 May 2011)
New Revision: 3187
Added:
branches/as7/
Log:
JBoss AS7 migration branch
13 years, 7 months
teiid SVN: r3186 - branches.
by teiid-commits@lists.jboss.org
Author: mdrillin
Date: 2011-05-23 15:14:01 -0400 (Mon, 23 May 2011)
New Revision: 3186
Added:
branches/7.1.1.CP2/
Log:
Branching 7.1.x for 7.1.1.CP2
13 years, 7 months
teiid SVN: r3185 - in branches/7.4.x/connectors/translator-jdbc/src: test/java/org/teiid/translator/jdbc/teradata and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2011-05-20 17:17:40 -0400 (Fri, 20 May 2011)
New Revision: 3185
Modified:
branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/teradata/TeradataExecutionFactory.java
branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/teradata/TestTeradataTranslator.java
Log:
TEIID-1495: more teradata changes based on errors from BQT
Modified: branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/teradata/TeradataExecutionFactory.java
===================================================================
--- branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/teradata/TeradataExecutionFactory.java 2011-05-20 14:54:26 UTC (rev 3184)
+++ branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/teradata/TeradataExecutionFactory.java 2011-05-20 21:17:40 UTC (rev 3185)
@@ -82,20 +82,45 @@
convert.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.DATE, new TimeModifier("DATE")); //$NON-NLS-1$
convert.addConvert(FunctionModifier.TIME, FunctionModifier.TIMESTAMP, new TimeModifier("TIMESTAMP")); //$NON-NLS-1$
convert.addConvert(FunctionModifier.DATE, FunctionModifier.TIMESTAMP, new TimeModifier("TIMESTAMP")); //$NON-NLS-1$
- convert.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.STRING, new TimeModifier("varchar(100)")); //$NON-NLS-1$
- convert.addConvert(FunctionModifier.TIME, FunctionModifier.STRING, new TimeModifier("varchar(100)")); //$NON-NLS-1$
- convert.addConvert(FunctionModifier.DATE, FunctionModifier.STRING, new TimeModifier("varchar(100)")); //$NON-NLS-1$
+ convert.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.STRING, new FunctionModifier() {
+ @Override
+ public List<?> translate(Function function) {
+ return Arrays.asList("cast(cast(", function.getParameters().get(0), " AS FORMAT 'Y4-MM-DDBHH:MI:SSDS(6)') AS VARCHAR(26))"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ });
+ convert.addConvert(FunctionModifier.TIME, FunctionModifier.STRING, new FunctionModifier() {
+ @Override
+ public List<?> translate(Function function) {
+ return Arrays.asList("cast(cast(", function.getParameters().get(0), " AS FORMAT 'HH:MI:SS') AS VARCHAR(9))"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ });
+ convert.addConvert(FunctionModifier.DATE, FunctionModifier.STRING, new FunctionModifier() {
+ @Override
+ public List<?> translate(Function function) {
+ return Arrays.asList("cast(cast(", function.getParameters().get(0), " AS FORMAT 'YYYY-MM-DD') AS VARCHAR(11))"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ });
+
convert.addTypeMapping("varchar(4000)", FunctionModifier.STRING); //$NON-NLS-1$
convert.addNumericBooleanConversions();
registerFunctionModifier(SourceSystemFunctions.CONVERT, convert);
-
+ registerFunctionModifier(SourceSystemFunctions.SUBSTRING, new SubstrModifier(this.convert));
registerFunctionModifier(SourceSystemFunctions.RAND, new AliasModifier("random")); //$NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.LOG, new AliasModifier("LN")); //$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.LCASE, new UpperOrLowerModifier("LOWER", this.convert)); //$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.UCASE, new UpperOrLowerModifier("UPPER", this.convert)); //$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.LENGTH, new AliasModifier("CHARACTER_LENGTH")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.LCASE, new StringOnlyModifier("LOWER", this.convert)); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.UCASE, new StringOnlyModifier("UPPER", this.convert)); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.LENGTH, new FunctionModifier() {
+ @Override
+ public List<?> translate(Function function) {
+ ArrayList target = new ArrayList();
+ target.add("character_length("); //$NON-NLS-1$
+ target.addAll(expressionToString(function.getParameters().get(0), convert));
+ target.add(")"); //$NON-NLS-1$
+ return target;
+ }
+ });
registerFunctionModifier(SourceSystemFunctions.CURDATE, new AliasModifier("CURRENT_DATE")); //$NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.CURTIME, new AliasModifier("CURRENT_TIME")); //$NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.YEAR, new ExtractModifier("YEAR")); //$NON-NLS-1$
@@ -117,13 +142,21 @@
registerFunctionModifier(SourceSystemFunctions.LTRIM, new FunctionModifier() {
@Override
public List<?> translate(Function function) {
- return Arrays.asList("TRIM(LEADING FROM ", expressionToString(function.getParameters().get(0), convert), ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ ArrayList target = new ArrayList();
+ target.add("TRIM(LEADING FROM ");//$NON-NLS-1$
+ target.addAll(expressionToString(function.getParameters().get(0), convert));
+ target.add(")"); //$NON-NLS-1$
+ return target;
}
});
registerFunctionModifier(SourceSystemFunctions.RTRIM, new FunctionModifier() {
@Override
public List<?> translate(Function function) {
- return Arrays.asList("TRIM(TRAILING FROM ", expressionToString(function.getParameters().get(0), convert), ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ ArrayList target = new ArrayList();
+ target.add("TRIM(TRAILING FROM ");//$NON-NLS-1$
+ target.addAll(expressionToString(function.getParameters().get(0), convert));
+ target.add(")"); //$NON-NLS-1$
+ return target;
}
});
registerFunctionModifier(SourceSystemFunctions.MOD, new FunctionModifier() {
@@ -163,7 +196,6 @@
supportedFunctions.add(SourceSystemFunctions.LOCATE);
supportedFunctions.add(SourceSystemFunctions.LOG);
supportedFunctions.add(SourceSystemFunctions.LCASE);
- supportedFunctions.add("lower");//$NON-NLS-1$
supportedFunctions.add(SourceSystemFunctions.LTRIM);
supportedFunctions.add(SourceSystemFunctions.LENGTH);
supportedFunctions.add(SourceSystemFunctions.MINUTE);
@@ -349,41 +381,67 @@
@Override
public List<?> translate(Function function) {
+ ArrayList target = new ArrayList();
Expression expr1 = function.getParameters().get(0);
Expression expr2 = function.getParameters().get(1);
- ArrayList target = new ArrayList();
- target.add("position("); //$NON-NLS-1$
- target.addAll(expressionToString(expr1, this.convertModifier));
- target.add( " in "); //$NON-NLS-1$
- target.addAll(expressionToString(expr2, this.convertModifier));
- target.add(")"); //$NON-NLS-1$
+ if (function.getParameters().size() > 2) {
+ Expression expr3 = function.getParameters().get(2);
+ target.add("(");//$NON-NLS-1$
+ target.add(expr3);
+ target.add("+");//$NON-NLS-1$
+ target.add("position("); //$NON-NLS-1$
+ target.addAll(expressionToString(expr1, this.convertModifier));
+ target.add( " in "); //$NON-NLS-1$
+ target.add("substr("); //$NON-NLS-1$
+ target.addAll(expressionToString(expr2, this.convertModifier));
+ target.add(","); //$NON-NLS-1$
+ target.add(expr3);
+ target.add(")"); //$NON-NLS-1$
+ target.add("))"); //$NON-NLS-1$
+ }
+ else {
+ target.add("position("); //$NON-NLS-1$
+ target.addAll(expressionToString(expr1, this.convertModifier));
+ target.add( " in "); //$NON-NLS-1$
+ target.addAll(expressionToString(expr2, this.convertModifier));
+ target.add(")"); //$NON-NLS-1$
+ }
return target;
}
}
private static List<?> expressionToString(Expression expr, ConvertModifier modifier) {
Class tgtType = expr.getType();
- if (tgtType.equals(String.class) && (expr instanceof Literal)) {
+ if (tgtType.equals(String.class) && ((expr instanceof Literal) || expr instanceof ColumnReference)) {
return Arrays.asList(expr);
}
else if (tgtType.equals(String.class) && (expr instanceof Function)) {
Function func = (Function)expr;
- if (func.getParameters().get(0) instanceof ColumnReference) {
+ while(true) {
+ Expression arg1 = func.getParameters().get(0);
+ if ((arg1 instanceof Function) && ((Function)arg1).getName().equals("convert")) { //$NON-NLS-1$
+ func = (Function)arg1;
+ }
+ else {
+ break;
+ }
+ }
+ Expression arg1 = func.getParameters().get(0);
+ if (arg1 instanceof ColumnReference) {
ColumnReference ref = (ColumnReference)func.getParameters().get(0);
if(Number.class.isAssignableFrom(ref.getType())) {
ArrayList target = new ArrayList();
target.add("cast("); //$NON-NLS-1$
target.add(func.getParameters().get(0));
target.add(" AS varchar(100))"); //$NON-NLS-1$
+ return target;
}
- else {
- return modifier.translate(func);
+ else if (String.class.isAssignableFrom(ref.getType())) {
+ return Arrays.asList(ref);
}
}
- else {
- return modifier.translate(func);
- }
+ return modifier.translate(func);
}
return Arrays.asList("cast(" , expr, " AS varchar(100))"); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -418,10 +476,10 @@
}
}
- public static class UpperOrLowerModifier extends FunctionModifier {
+ public static class StringOnlyModifier extends FunctionModifier {
String funcName;
ConvertModifier convertModifier;
- public UpperOrLowerModifier(String name, ConvertModifier converModifier) {
+ public StringOnlyModifier(String name, ConvertModifier converModifier) {
this.funcName = name;
this.convertModifier = converModifier;
}
@@ -437,6 +495,28 @@
}
}
+ public static class SubstrModifier extends FunctionModifier {
+ ConvertModifier convertModifier;
+ public SubstrModifier(ConvertModifier converModifier) {
+ this.convertModifier = converModifier;
+ }
+ @Override
+ public List<?> translate(Function function) {
+ Expression expr = function.getParameters().get(0);
+ ArrayList target = new ArrayList();
+ target.add("substr("); //$NON-NLS-1$
+ target.addAll(expressionToString(expr, this.convertModifier));
+ target.add(","); //$NON-NLS-1$
+ target.add(function.getParameters().get(1));
+ if (function.getParameters().size() > 2 ) {
+ target.add(","); //$NON-NLS-1$
+ target.add(function.getParameters().get(2));
+ }
+ target.add(")"); //$NON-NLS-1$
+ return target;
+ }
+ }
+
public static class LeftOrRightFunctionModifier extends FunctionModifier {
private LanguageFactory langFactory;
ConvertModifier convertModifier;
@@ -454,7 +534,9 @@
//substr(string, 1, length)
target.add("substr("); //$NON-NLS-1$
target.addAll(expressionToString(args.get(0), this.convertModifier));
+ target.add(","); //$NON-NLS-1$
target.add(langFactory.createLiteral(Integer.valueOf(1), TypeFacility.RUNTIME_TYPES.INTEGER));
+ target.add(","); //$NON-NLS-1$
target.add(args.get(1));
target.add(")"); //$NON-NLS-1$
} else if (function.getName().equalsIgnoreCase("right")) { //$NON-NLS-1$
@@ -466,7 +548,7 @@
target.addAll(expressionToString(args.get(0), this.convertModifier));
target.add(")-"); //$NON-NLS-1$
target.add(args.get(1));
- target.add("))"); //$NON-NLS-1$
+ target.add("+1))"); //$NON-NLS-1$ // offset for 1 based index
}
return target;
}
Modified: branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/teradata/TestTeradataTranslator.java
===================================================================
--- branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/teradata/TestTeradataTranslator.java 2011-05-20 14:54:26 UTC (rev 3184)
+++ branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/teradata/TestTeradataTranslator.java 2011-05-20 21:17:40 UTC (rev 3185)
@@ -86,9 +86,21 @@
TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, input, output, TRANSLATOR);
}
+ @Test public void testSubString() throws Exception {
+ String input = "SELECT intkey FROM BQT1.SmallA WHERE SUBSTRING(BQT1.SmallA.IntKey, 1) = '1' ORDER BY intkey";
+ String output = "SELECT SmallA.IntKey FROM SmallA WHERE substr(cast(SmallA.IntKey AS varchar(100)),1) = '1' ORDER BY SmallA.IntKey";
+ TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, input, output, TRANSLATOR);
+ }
+
+ @Test public void testSubString2() throws Exception {
+ String input = "SELECT intkey FROM BQT1.SmallA WHERE SUBSTRING(BQT1.SmallA.IntKey, 1, 2) = '1' ORDER BY intkey";
+ String output = "SELECT SmallA.IntKey FROM SmallA WHERE substr(cast(SmallA.IntKey AS varchar(100)),1,2) = '1' ORDER BY SmallA.IntKey";
+ TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, input, output, TRANSLATOR);
+ }
+
@Test public void testDateToString() throws Exception {
String input = "SELECT intkey, UPPER(timevalue) AS UPPER FROM BQT1.SmallA ORDER BY intkey";
- String output = "SELECT SmallA.IntKey, UPPER(cast(SmallA.TimeValue AS varchar(100))) AS UPPER FROM SmallA ORDER BY SmallA.IntKey";
+ String output = "SELECT SmallA.IntKey, UPPER(cast(cast(SmallA.TimeValue AS FORMAT 'HH:MI:SS') AS VARCHAR(9))) AS UPPER FROM SmallA ORDER BY SmallA.IntKey";
TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, input, output, TRANSLATOR);
}
@@ -178,7 +190,13 @@
@Test public void testRightFunction() throws Exception {
String input = "SELECT INTKEY, FLOATNUM FROM BQT1.SmallA WHERE right(FLOATNUM, 2) <> 0 ORDER BY INTKEY";
- String out = "SELECT SmallA.IntKey, SmallA.FloatNum FROM SmallA WHERE substr(cast(SmallA.FloatNum AS varchar(100)),(character_length(cast(SmallA.FloatNum AS varchar(100)))-2)) <> '0' ORDER BY SmallA.IntKey";
+ String out = "SELECT SmallA.IntKey, SmallA.FloatNum FROM SmallA WHERE substr(cast(SmallA.FloatNum AS varchar(100)),(character_length(cast(SmallA.FloatNum AS varchar(100)))-2+1)) <> '0' ORDER BY SmallA.IntKey";
TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, null, input, out, TRANSLATOR);
}
+
+ @Test public void testLocateFunction() throws Exception {
+ String input = "SELECT INTKEY, STRINGKEY, SHORTVALUE FROM BQT1.SmallA WHERE (LOCATE(0, STRINGKEY) = 2) OR (LOCATE(2, SHORTVALUE, 4) = 6) ORDER BY intkey";
+ String out = "SELECT SmallA.IntKey, SmallA.StringKey, SmallA.ShortValue FROM SmallA WHERE position('0' in SmallA.StringKey) = 2 OR (4+position('2' in substr(cast(SmallA.ShortValue AS varchar(100)),4))) = 6 ORDER BY SmallA.IntKey";
+ TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, null, input, out, TRANSLATOR);
+ }
}
13 years, 7 months
teiid SVN: r3184 - in branches/7.4.x: connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/sqlserver and 25 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-05-20 10:54:26 -0400 (Fri, 20 May 2011)
New Revision: 3184
Removed:
branches/7.4.x/engine/src/test/java/org/teiid/query/unittest/FakeMetadataFacade.java
branches/7.4.x/engine/src/test/java/org/teiid/query/unittest/FakeMetadataFactory.java
branches/7.4.x/engine/src/test/java/org/teiid/query/unittest/FakeMetadataObject.java
branches/7.4.x/engine/src/test/java/org/teiid/query/unittest/FakeMetadataStore.java
Modified:
branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java
branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/sqlserver/TestSqlServerConversionVisitor.java
branches/7.4.x/connectors/translator-ldap/src/test/java/org/teiid/translator/ldap/TestIQueryToLdapSearchParser.java
branches/7.4.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java
branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestConnectorWorkItem.java
branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestElementImpl.java
branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestGroupImpl.java
branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestInsertImpl.java
branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestMetadataFactory.java
branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TstLanguageBridgeFactory.java
branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestAuthorizationValidationVisitor.java
branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestCallableStatement.java
branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java
branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java
branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java
branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java
branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceElementReplacementVisitor.java
branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceMetadataWrapper.java
branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java
branches/7.4.x/engine/src/test/java/org/teiid/query/function/TestFunctionLibrary.java
branches/7.4.x/engine/src/test/java/org/teiid/query/function/TestFunctionTree.java
branches/7.4.x/engine/src/test/java/org/teiid/query/function/TestResolvedFunctions.java
branches/7.4.x/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestAccessPatterns.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestAnsiJoinPushdown.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestBatchedUpdatePlanner.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestExpressionsInGroupBy.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestInlineView.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestJoinOptimization.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestJoinPushdownRestrictions.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestOptionalJoins.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestPartitionedJoinPlanning.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestRuleMergeVirtual.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestRuleRaiseNull.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestRuleRemoveSorts.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestSortOptimization.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestStoredProcedurePlanning.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/proc/TestProcedurePlanner.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/TestAliasGenerator.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCalculateCostUtil.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCapabilitiesUtil.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCriteriaCapabilityValidatorVisitor.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleChooseDependent.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePlaceAccess.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePushSelectCriteria.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleValidateWhereAll.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/xml/TestMarkExcludeVisitor.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/xml/TestNameInSourceResolverVisitor.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLNodeMappingVisitor.java
branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLPlanner.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/FakeDataStore.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestJoinWithFunction.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestOptionalJoins.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestOrderByProcessing.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestSecurityFunctions.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestSetProcessing.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestTempTables.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestTextTable.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestVirtualDepJoin.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestWithClauseProcessing.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestAccessNode.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestGroupingNode.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestJoinNode.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestProjectNode.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestSelectNode.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/xml/TestInstructions.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/xml/TestXMLPlanningEnhancements.java
branches/7.4.x/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java
branches/7.4.x/engine/src/test/java/org/teiid/query/resolver/TestFunctionResolving.java
branches/7.4.x/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java
branches/7.4.x/engine/src/test/java/org/teiid/query/resolver/TestResolver.java
branches/7.4.x/engine/src/test/java/org/teiid/query/resolver/TestXMLResolver.java
branches/7.4.x/engine/src/test/java/org/teiid/query/rewriter/TestOrderByRewrite.java
branches/7.4.x/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java
branches/7.4.x/engine/src/test/java/org/teiid/query/sql/util/TestElementSymbolOptimizer.java
branches/7.4.x/engine/src/test/java/org/teiid/query/sql/visitor/TestEvaluatableVisitor.java
branches/7.4.x/engine/src/test/java/org/teiid/query/sql/visitor/TestSQLStringVisitor.java
branches/7.4.x/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
branches/7.4.x/engine/src/test/java/org/teiid/query/validator/TestUpdateValidator.java
branches/7.4.x/engine/src/test/java/org/teiid/query/validator/TestValidator.java
branches/7.4.x/metadata/src/test/java/org/teiid/cdk/unittest/FakeTranslationFactory.java
branches/7.4.x/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java
Log:
TEIID-903 complete removal of fake metadata logic
Modified: branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java
===================================================================
--- branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -42,7 +42,6 @@
import org.teiid.query.metadata.CompositeMetadataStore;
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.metadata.TransformationMetadata;
-import org.teiid.query.unittest.FakeMetadataFactory;
import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.translator.TranslatorException;
import org.teiid.translator.ExecutionContext;
@@ -536,7 +535,7 @@
String input = "SELECT ((CASE WHEN month(datevalue) < 10 THEN ('0' || convert(month(datevalue), string)) ELSE convert(month(datevalue), string) END || CASE WHEN dayofmonth(datevalue) < 10 THEN ('0' || convert(dayofmonth(datevalue), string)) ELSE convert(dayofmonth(datevalue), string) END) || convert(year(datevalue), string)), SUM(intkey) FROM bqt1.SMALLA GROUP BY datevalue"; //$NON-NLS-1$
String output = "SELECT CASE WHEN CASE WHEN CASE WHEN EXTRACT(MONTH FROM SmallA.DateValue) < 10 THEN CASE WHEN to_char(EXTRACT(MONTH FROM SmallA.DateValue)) IS NULL THEN NULL ELSE concat('0', to_char(EXTRACT(MONTH FROM SmallA.DateValue))) END ELSE to_char(EXTRACT(MONTH FROM SmallA.DateValue)) END IS NULL OR CASE WHEN EXTRACT(DAY FROM SmallA.DateValue) < 10 THEN CASE WHEN to_char(EXTRACT(DAY FROM SmallA.DateValue)) IS NULL THEN NULL ELSE concat('0', to_char(EXTRACT(DAY FROM SmallA.DateValue))) END ELSE to_char(EXTRACT(DAY FROM SmallA.DateValue)) END IS NULL THEN NULL ELSE concat(CASE WHEN EXTRACT(MONTH FROM SmallA.DateValue) < 10 THEN CASE WHEN to_char(EXTRACT(MONTH FROM SmallA.DateValue)) IS NULL THEN NULL ELSE concat('0', to_char(EXTRACT(MONTH FROM SmallA.DateValue))) END ELSE to_char(EXTRACT(MONTH FROM SmallA.DateValue)) END, CASE WHEN EXTRACT(DAY FROM SmallA.DateValue) < 10 THEN CASE WHEN to_char(EXTRACT(DAY FROM SmallA.DateValue)) IS NULL THEN NULL ELSE concat('!
0', to_char(EXTRACT(DAY FROM SmallA.DateValue))) END ELSE to_char(EXTRACT(DAY FROM SmallA.DateValue)) END) END IS NULL OR to_char(EXTRACT(YEAR FROM SmallA.DateValue)) IS NULL THEN NULL ELSE concat(CASE WHEN CASE WHEN EXTRACT(MONTH FROM SmallA.DateValue) < 10 THEN CASE WHEN to_char(EXTRACT(MONTH FROM SmallA.DateValue)) IS NULL THEN NULL ELSE concat('0', to_char(EXTRACT(MONTH FROM SmallA.DateValue))) END ELSE to_char(EXTRACT(MONTH FROM SmallA.DateValue)) END IS NULL OR CASE WHEN EXTRACT(DAY FROM SmallA.DateValue) < 10 THEN CASE WHEN to_char(EXTRACT(DAY FROM SmallA.DateValue)) IS NULL THEN NULL ELSE concat('0', to_char(EXTRACT(DAY FROM SmallA.DateValue))) END ELSE to_char(EXTRACT(DAY FROM SmallA.DateValue)) END IS NULL THEN NULL ELSE concat(CASE WHEN EXTRACT(MONTH FROM SmallA.DateValue) < 10 THEN CASE WHEN to_char(EXTRACT(MONTH FROM SmallA.DateValue)) IS NULL THEN NULL ELSE concat('0', to_char(EXTRACT(MONTH FROM SmallA.DateValue))) END ELSE to_char(EXTRACT(MONTH FROM SmallA.Da!
teValue)) END, CASE WHEN EXTRACT(DAY FROM SmallA.DateValue) < !
10 THEN
CASE WHEN to_char(EXTRACT(DAY FROM SmallA.DateValue)) IS NULL THEN NULL ELSE concat('0', to_char(EXTRACT(DAY FROM SmallA.DateValue))) END ELSE to_char(EXTRACT(DAY FROM SmallA.DateValue)) END) END, to_char(EXTRACT(YEAR FROM SmallA.DateValue))) END, SUM(SmallA.IntKey) FROM SmallA GROUP BY SmallA.DateValue"; //$NON-NLS-1$
- helpTestVisitor(FakeMetadataFactory.exampleBQTCached(),
+ helpTestVisitor(RealMetadataFactory.exampleBQTCached(),
input,
EMPTY_CONTEXT, null, output);
}
@@ -603,7 +602,7 @@
String input = "UPDATE bqt1.smalla SET intkey = intkey + 1"; //$NON-NLS-1$
String output = "UPDATE SmallA SET IntKey = (SmallA.IntKey + 1)"; //$NON-NLS-1$
- helpTestVisitor(FakeMetadataFactory.exampleBQTCached(),
+ helpTestVisitor(RealMetadataFactory.exampleBQTCached(),
input,
EMPTY_CONTEXT, null, output);
}
@@ -722,7 +721,7 @@
RealMetadataFactory.createElements(dual, new String[] {"something"}, new String[] {DataTypeManager.DefaultDataTypes.STRING}); //$NON-NLS-1$
CompositeMetadataStore store = new CompositeMetadataStore(metadataStore);
- return new TransformationMetadata(null, store, null, FakeMetadataFactory.SFM.getSystemFunctions(), null);
+ return new TransformationMetadata(null, store, null, RealMetadataFactory.SFM.getSystemFunctions(), null);
}
public void helpTestVisitor(String vdb, String input, String expectedOutput) throws TranslatorException {
@@ -733,7 +732,7 @@
String input = "select max(intkey), stringkey from (select intkey, stringkey from bqt1.smalla order by intkey limit 100) x group by stringkey"; //$NON-NLS-1$
String output = "SELECT MAX(x.intkey), x.stringkey FROM (SELECT * FROM (SELECT SmallA.IntKey, SmallA.StringKey FROM SmallA ORDER BY SmallA.IntKey) WHERE ROWNUM <= 100) x GROUP BY x.stringkey"; //$NON-NLS-1$
- helpTestVisitor(FakeMetadataFactory.exampleBQTCached(),
+ helpTestVisitor(RealMetadataFactory.exampleBQTCached(),
input,
EMPTY_CONTEXT, null, output);
}
@@ -742,7 +741,7 @@
String input = "select intkey, intnum from bqt1.smalla except select intnum, intkey from bqt1.smallb"; //$NON-NLS-1$
String output = "SELECT SmallA.IntKey, SmallA.IntNum FROM SmallA MINUS SELECT SmallB.IntNum, SmallB.IntKey FROM SmallB"; //$NON-NLS-1$
- helpTestVisitor(FakeMetadataFactory.exampleBQTCached(),
+ helpTestVisitor(RealMetadataFactory.exampleBQTCached(),
input,
EMPTY_CONTEXT, null, output);
}
@@ -750,20 +749,20 @@
@Test public void testConcat() throws Exception {
String sql = "select concat(stringnum, stringkey) from BQT1.Smalla"; //$NON-NLS-1$
String expected = "SELECT CASE WHEN SmallA.StringNum IS NULL OR SmallA.StringKey IS NULL THEN NULL ELSE concat(SmallA.StringNum, SmallA.StringKey) END FROM SmallA"; //$NON-NLS-1$
- helpTestVisitor(FakeMetadataFactory.exampleBQTCached(), sql, EMPTY_CONTEXT, null, expected);
+ helpTestVisitor(RealMetadataFactory.exampleBQTCached(), sql, EMPTY_CONTEXT, null, expected);
}
@Test public void testConcat_withLiteral() throws Exception {
String sql = "select stringnum || '1' from BQT1.Smalla"; //$NON-NLS-1$
String expected = "SELECT CASE WHEN SmallA.StringNum IS NULL THEN NULL ELSE concat(SmallA.StringNum, '1') END FROM SmallA"; //$NON-NLS-1$
- helpTestVisitor(FakeMetadataFactory.exampleBQTCached(), sql, EMPTY_CONTEXT, null, expected);
+ helpTestVisitor(RealMetadataFactory.exampleBQTCached(), sql, EMPTY_CONTEXT, null, expected);
}
@Test public void testRowLimitWithUnionOrderBy() throws Exception {
String input = "(select intkey from bqt1.smalla limit 50, 100) union select intnum from bqt1.smalla order by intkey"; //$NON-NLS-1$
String output = "SELECT c_0 FROM (SELECT VIEW_FOR_LIMIT.*, ROWNUM ROWNUM_ FROM (SELECT g_1.IntKey AS c_0 FROM SmallA g_1) VIEW_FOR_LIMIT WHERE ROWNUM <= 150) WHERE ROWNUM_ > 50 UNION SELECT g_0.IntNum AS c_0 FROM SmallA g_0 ORDER BY c_0"; //$NON-NLS-1$
- CommandBuilder commandBuilder = new CommandBuilder(FakeMetadataFactory.exampleBQTCached());
+ CommandBuilder commandBuilder = new CommandBuilder(RealMetadataFactory.exampleBQTCached());
Command obj = commandBuilder.getCommand(input, true, true);
this.helpTestVisitor(obj, EMPTY_CONTEXT, null, output);
}
@@ -771,7 +770,7 @@
@Test public void testCot() throws Exception {
String sql = "select cot(doublenum) from BQT1.Smalla"; //$NON-NLS-1$
String expected = "SELECT (1 / tan(SmallA.DoubleNum)) FROM SmallA"; //$NON-NLS-1$
- helpTestVisitor(FakeMetadataFactory.exampleBQTCached(), sql, EMPTY_CONTEXT, null, expected);
+ helpTestVisitor(RealMetadataFactory.exampleBQTCached(), sql, EMPTY_CONTEXT, null, expected);
}
}
Modified: branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/sqlserver/TestSqlServerConversionVisitor.java
===================================================================
--- branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/sqlserver/TestSqlServerConversionVisitor.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/sqlserver/TestSqlServerConversionVisitor.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -37,7 +37,6 @@
import org.teiid.query.metadata.CompositeMetadataStore;
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.metadata.TransformationMetadata;
-import org.teiid.query.unittest.FakeMetadataFactory;
import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.translator.TranslatorException;
import org.teiid.translator.jdbc.TranslationHelper;
@@ -160,7 +159,7 @@
obj.setNativeType("uniqueidentifier"); //$NON-NLS-1$
CompositeMetadataStore store = new CompositeMetadataStore(metadataStore);
- QueryMetadataInterface metadata = new TransformationMetadata(null, store, null, FakeMetadataFactory.SFM.getSystemFunctions(), null);
+ QueryMetadataInterface metadata = new TransformationMetadata(null, store, null, RealMetadataFactory.SFM.getSystemFunctions(), null);
TranslationUtility tu = new TranslationUtility(metadata);
Command command = tu.parseCommand("select max(x) from bar"); //$NON-NLS-1$
@@ -174,7 +173,7 @@
String input = "select intkey from (select intkey from bqt1.smalla) as x order by intkey limit 100"; //$NON-NLS-1$
String output = "SELECT TOP 100 v_0.c_0 FROM (SELECT g_0.IntKey AS c_0 FROM SmallA g_0) v_0 ORDER BY v_0.c_0"; //$NON-NLS-1$
- CommandBuilder commandBuilder = new CommandBuilder(FakeMetadataFactory.exampleBQTCached());
+ CommandBuilder commandBuilder = new CommandBuilder(RealMetadataFactory.exampleBQTCached());
Command obj = commandBuilder.getCommand(input, true, true);
TranslationHelper.helpTestVisitor(output, trans, obj);
}
Modified: branches/7.4.x/connectors/translator-ldap/src/test/java/org/teiid/translator/ldap/TestIQueryToLdapSearchParser.java
===================================================================
--- branches/7.4.x/connectors/translator-ldap/src/test/java/org/teiid/translator/ldap/TestIQueryToLdapSearchParser.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/connectors/translator-ldap/src/test/java/org/teiid/translator/ldap/TestIQueryToLdapSearchParser.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -47,7 +47,6 @@
import org.teiid.query.metadata.CompositeMetadataStore;
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.metadata.TransformationMetadata;
-import org.teiid.query.unittest.FakeMetadataFactory;
import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.translator.TranslatorException;
import org.teiid.translator.ldap.IQueryToLdapSearchParser;
@@ -304,7 +303,7 @@
}
// Create the facade from the store
- return new TransformationMetadata(null, new CompositeMetadataStore(metadataStore), null, FakeMetadataFactory.SFM.getSystemFunctions(), null);
+ return new TransformationMetadata(null, new CompositeMetadataStore(metadataStore), null, RealMetadataFactory.SFM.getSystemFunctions(), null);
}
}
Modified: branches/7.4.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java
===================================================================
--- branches/7.4.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -44,7 +44,6 @@
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.sql.lang.SPParameter;
-import org.teiid.query.unittest.FakeMetadataFactory;
import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.translator.ExecutionContext;
import org.teiid.translator.TypeFacility;
@@ -113,10 +112,10 @@
params.add(RealMetadataFactory.createParameter("start", SPParameter.IN, TypeFacility.RUNTIME_NAMES.TIMESTAMP));
params.add(RealMetadataFactory.createParameter("end", SPParameter.IN, TypeFacility.RUNTIME_NAMES.TIMESTAMP));
- Procedure getUpdated = RealMetadataFactory.createStoredProcedure("GetUpdated", salesforceModel, params, "GetUpdated");
+ Procedure getUpdated = RealMetadataFactory.createStoredProcedure("GetUpdated", salesforceModel, params);
getUpdated.setResultSet(RealMetadataFactory.createResultSet("rs", new String[] {"updated"}, new String[] {TypeFacility.RUNTIME_NAMES.STRING}));
- return new TransformationMetadata(null, new CompositeMetadataStore(store), null, FakeMetadataFactory.SFM.getSystemFunctions(), null);
+ return new TransformationMetadata(null, new CompositeMetadataStore(store), null, RealMetadataFactory.SFM.getSystemFunctions(), null);
}
private static TranslationUtility translationUtility = new TranslationUtility(exampleSalesforce());
Modified: branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestConnectorWorkItem.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestConnectorWorkItem.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestConnectorWorkItem.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -49,14 +49,14 @@
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.lang.StoredProcedure;
import org.teiid.query.sql.symbol.Constant;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.translator.ProcedureExecution;
import org.teiid.translator.TranslatorException;
public class TestConnectorWorkItem {
- private static final QueryMetadataInterface EXAMPLE_BQT = FakeMetadataFactory.exampleBQTCached();
+ private static final QueryMetadataInterface EXAMPLE_BQT = RealMetadataFactory.exampleBQTCached();
private static Command helpGetCommand(String sql,
QueryMetadataInterface metadata) throws Exception {
@@ -68,7 +68,7 @@
static AtomicRequestMessage createNewAtomicRequestMessage(int requestid, int nodeid) throws Exception {
RequestMessage rm = new RequestMessage();
- DQPWorkContext workContext = FakeMetadataFactory.buildWorkContext(EXAMPLE_BQT, FakeMetadataFactory.exampleBQTVDB());
+ DQPWorkContext workContext = RealMetadataFactory.buildWorkContext(EXAMPLE_BQT, RealMetadataFactory.exampleBQTVDB());
workContext.getSession().setSessionId(String.valueOf(1));
workContext.getSession().setUserName("foo"); //$NON-NLS-1$
Modified: branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestElementImpl.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestElementImpl.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestElementImpl.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -27,7 +27,6 @@
import org.teiid.language.ColumnReference;
import org.teiid.language.NamedTable;
import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.unittest.FakeMetadataObject;
public class TestElementImpl extends TestCase {
@@ -44,10 +43,6 @@
ElementSymbol symbol = new ElementSymbol(elementName);
symbol.setType(String.class);
symbol.setGroupSymbol(TestGroupImpl.helpExample(groupName));
- FakeMetadataObject obj = new FakeMetadataObject(groupName + "." + elementName, FakeMetadataObject.ELEMENT); //$NON-NLS-1$
- obj.putProperty(FakeMetadataObject.Props.GROUP, new FakeMetadataObject(groupName, FakeMetadataObject.GROUP));
- obj.putProperty(FakeMetadataObject.Props.LENGTH, "3"); //$NON-NLS-1$
- symbol.setMetadataID(obj);
return symbol;
}
@@ -56,12 +51,7 @@
ElementSymbol symbol = new ElementSymbol(elementName);
symbol.setType(Integer.class);
symbol.setGroupSymbol(TestGroupImpl.helpExample(groupName));
- FakeMetadataObject obj = new FakeMetadataObject(groupName + "." + elementName, FakeMetadataObject.ELEMENT); //$NON-NLS-1$
- obj.putProperty(FakeMetadataObject.Props.GROUP, new FakeMetadataObject(groupName, FakeMetadataObject.GROUP));
- obj.putProperty(FakeMetadataObject.Props.LENGTH, "3"); //$NON-NLS-1$
- symbol.setMetadataID(obj);
return symbol;
-
}
public static ElementSymbol helpExample(String groupName, String elementName, Object metadataID) {
Modified: branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestGroupImpl.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestGroupImpl.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestGroupImpl.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -23,13 +23,12 @@
package org.teiid.dqp.internal.datamgr;
+import junit.framework.TestCase;
+
import org.teiid.language.NamedTable;
import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.unittest.FakeMetadataObject;
-import junit.framework.TestCase;
-
public class TestGroupImpl extends TestCase {
/**
@@ -45,17 +44,14 @@
}
public static GroupSymbol helpExample(String groupName, String definition) {
- String name = groupName;
- if (definition != null) {
- name = definition;
- }
- Object obj = new FakeMetadataObject(name, FakeMetadataObject.GROUP);
- return helpExample(groupName, definition, obj);
+ return helpExample(groupName, definition, null);
}
public static GroupSymbol helpExample(String groupName, String definition, Object metadataID) {
GroupSymbol symbol = new GroupSymbol(groupName, definition);
- symbol.setMetadataID(metadataID);
+ if (metadataID != null) {
+ symbol.setMetadataID(metadataID);
+ }
return symbol;
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestInsertImpl.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestInsertImpl.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestInsertImpl.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -67,10 +67,10 @@
public static org.teiid.query.sql.lang.Insert helpExample2(String groupName) {
GroupSymbol group = TestGroupImpl.helpExample(groupName);
- ArrayList elements = new ArrayList();
+ ArrayList<ElementSymbol> elements = new ArrayList<ElementSymbol>();
elements.add(TestElementImpl.helpExample(groupName, "e1")); //$NON-NLS-1$
- ArrayList values = new ArrayList();
+ ArrayList<org.teiid.query.sql.symbol.Expression> values = new ArrayList<org.teiid.query.sql.symbol.Expression>();
values.add(TestSearchedCaseExpressionImpl.helpExample());
return new org.teiid.query.sql.lang.Insert(group,
@@ -94,9 +94,6 @@
Insert insert = example("a.b"); //$NON-NLS-1$
assertNotNull(insert.getColumns());
assertEquals(4, insert.getColumns().size());
- for (Iterator i = insert.getColumns().iterator(); i.hasNext();) {
- assertTrue(i.next() instanceof ColumnReference);
- }
// verify that elements are not qualified by group
String sInsertSQL = insert.toString();
Modified: branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestMetadataFactory.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestMetadataFactory.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestMetadataFactory.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -24,39 +24,43 @@
*/
package org.teiid.dqp.internal.datamgr;
-import java.util.List;
+import static org.junit.Assert.*;
-import org.teiid.core.types.DataTypeManager;
-import org.teiid.dqp.internal.datamgr.RuntimeMetadataImpl;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
-import org.teiid.query.unittest.FakeMetadataStore;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.LinkedHashMap;
+import java.util.Map;
-import junit.framework.TestCase;
+import org.jboss.virtual.VirtualFile;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.query.metadata.CompositeMetadataStore;
+import org.teiid.query.metadata.TransformationMetadata;
+import org.teiid.query.metadata.TransformationMetadata.Resource;
-
-public class TestMetadataFactory extends TestCase {
- private RuntimeMetadataImpl metadataFactory;
- private FakeMetadataObject pm1g1;
+@SuppressWarnings("nls")
+public class TestMetadataFactory {
+ private static final String MY_RESOURCE_PATH = "my/resource/path";
+ private RuntimeMetadataImpl metadataFactory;
- public TestMetadataFactory(String name) {
- super(name);
+ @Before public void setUp() throws IOException{
+ MetadataStore metadataStore = new MetadataStore();
+ CompositeMetadataStore store = new CompositeMetadataStore(metadataStore);
+ VDBMetaData vdbMetaData = new VDBMetaData();
+ vdbMetaData.setName("foo"); //$NON-NLS-1$
+ vdbMetaData.setVersion(1);
+ Map<String, Resource> vdbEntries = new LinkedHashMap<String, Resource>();
+ VirtualFile vf = Mockito.mock(VirtualFile.class);
+ Mockito.stub(vf.openStream()).toReturn(new ByteArrayInputStream("ResourceContents".getBytes()));
+ vdbEntries.put(MY_RESOURCE_PATH, new Resource(vf, true));
+ metadataFactory = new RuntimeMetadataImpl(new TransformationMetadata(vdbMetaData, store, vdbEntries, null, null));
}
- public void setUp(){
- FakeMetadataStore store = new FakeMetadataStore();
- pm1g1 = FakeMetadataFactory.createPhysicalGroup("pm1.g1", FakeMetadataFactory.createPhysicalModel("pm1.g1")); //$NON-NLS-1$ //$NON-NLS-2$
- List pm1g1e = FakeMetadataFactory.createElements(pm1g1,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- store.addObject(pm1g1);
- store.addObjects(pm1g1e);
- metadataFactory = new RuntimeMetadataImpl(new FakeMetadataFacade(store));
- }
-
- public void testGetVDBResourcePaths() throws Exception {
- String[] expectedPaths = new String[] {"my/resource/path"}; //$NON-NLS-1$
+ @Test public void testGetVDBResourcePaths() throws Exception {
+ String[] expectedPaths = new String[] {MY_RESOURCE_PATH}; //$NON-NLS-1$
String[] mfPaths = metadataFactory.getVDBResourcePaths();
assertEquals(expectedPaths.length, mfPaths.length);
for (int i = 0; i < expectedPaths.length; i++) {
@@ -64,17 +68,17 @@
}
}
- public void testGetBinaryVDBResource() throws Exception {
+ @Test public void testGetBinaryVDBResource() throws Exception {
byte[] expectedBytes = "ResourceContents".getBytes(); //$NON-NLS-1$
- byte[] mfBytes = metadataFactory.getBinaryVDBResource(null);
+ byte[] mfBytes = metadataFactory.getBinaryVDBResource(MY_RESOURCE_PATH);
assertEquals(expectedBytes.length, mfBytes.length);
for (int i = 0; i < expectedBytes.length; i++) {
assertEquals("Byte at index " + i + " differs from expected content", expectedBytes[i], mfBytes[i]); //$NON-NLS-1$ //$NON-NLS-2$
}
}
- public void testGetCharacterVDBResource() throws Exception {
- assertEquals("ResourceContents", metadataFactory.getCharacterVDBResource(null)); //$NON-NLS-1$
+ @Test public void testGetCharacterVDBResource() throws Exception {
+ assertEquals("ResourceContents", metadataFactory.getCharacterVDBResource(MY_RESOURCE_PATH)); //$NON-NLS-1$
}
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TstLanguageBridgeFactory.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TstLanguageBridgeFactory.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TstLanguageBridgeFactory.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -25,12 +25,12 @@
import org.teiid.dqp.internal.datamgr.LanguageBridgeFactory;
import org.teiid.dqp.internal.datamgr.RuntimeMetadataImpl;
import org.teiid.query.metadata.QueryMetadataInterface;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
public class TstLanguageBridgeFactory {
- public static final QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+ public static final QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
public static final RuntimeMetadataImpl metadataFactory = new RuntimeMetadataImpl(metadata);
public static final LanguageBridgeFactory factory = new LanguageBridgeFactory(metadata);
Modified: branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestAuthorizationValidationVisitor.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestAuthorizationValidationVisitor.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestAuthorizationValidationVisitor.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -40,17 +40,12 @@
import org.teiid.api.exception.query.QueryResolverException;
import org.teiid.api.exception.query.QueryValidatorException;
import org.teiid.core.TeiidComponentException;
-import org.teiid.query.function.FunctionLibrary;
-import org.teiid.query.function.FunctionTree;
import org.teiid.query.metadata.QueryMetadataInterface;
-import org.teiid.query.optimizer.FakeFunctionMetadataSource;
import org.teiid.query.parser.QueryParser;
import org.teiid.query.resolver.QueryResolver;
import org.teiid.query.sql.LanguageObject;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.validator.Validator;
import org.teiid.query.validator.ValidatorFailure;
@@ -133,7 +128,7 @@
svc.addPermission(addResource(DataPolicy.PermissionType.DELETE, "pm1.g4.e2")); //$NON-NLS-1$
svc.addPermission(addResource(DataPolicy.PermissionType.READ, "pm1.sq1")); //$NON-NLS-1$
- svc.addPermission(addResource(DataPolicy.PermissionType.READ, "foo.xyz")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.READ, "pm1.xyz")); //$NON-NLS-1$
return svc;
}
@@ -153,6 +148,9 @@
// pm3.g2
svc.addPermission(addResource(DataPolicy.PermissionType.CREATE, "pm3.g2.e1")); //$NON-NLS-1$
svc.addPermission(addResource(DataPolicy.PermissionType.CREATE, "pm3.g2.e2")); //$NON-NLS-1$
+
+ svc.addPermission(addResource(DataPolicy.PermissionType.READ, "xmltest.doc1")); //$NON-NLS-1$
+
svc.setAllowCreateTemporaryTables(false);
return svc;
}
@@ -199,133 +197,134 @@
@Test public void testTemp() throws Exception {
//allowed by default
- helpTest(exampleAuthSvc1(), "create local temporary table x (y string)", FakeMetadataFactory.example1Cached(), new String[] {}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$
+ helpTest(exampleAuthSvc1(), "create local temporary table x (y string)", RealMetadataFactory.example1Cached(), new String[] {}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$
//explicitly denied
- helpTest(exampleAuthSvc2(), "create local temporary table x (y string)", FakeMetadataFactory.example1Cached(), new String[] {"x"}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$
+ helpTest(exampleAuthSvc2(), "create local temporary table x (y string)", RealMetadataFactory.example1Cached(), new String[] {"x"}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$
}
@Test public void testFunction() throws Exception {
- FunctionLibrary funcLibrary = new FunctionLibrary(FakeMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new FakeFunctionMetadataSource()));
- FakeMetadataFacade metadata = new FakeMetadataFacade(FakeMetadataFactory.example1Cached().getStore(), funcLibrary);
- helpTest(exampleAuthSvc1(), "SELECT e1 FROM pm1.g1 where xyz() > 0", metadata, new String[] {}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$
- helpTest(exampleAuthSvc2(), "SELECT e1, curdate() FROM pm1.g2 where xyz() > 0", metadata, new String[] {"xyz()"}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
+ helpTest(exampleAuthSvc1(), "SELECT e1 FROM pm1.g1 where xyz() > 0", metadata, new String[] {}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$
+ helpTest(exampleAuthSvc2(), "SELECT e1, curdate() FROM pm1.g2 where xyz() > 0", metadata, new String[] {"xyz()"}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$
}
@Test public void testEverythingAccessible() throws Exception {
- helpTest(exampleAuthSvc1(), "SELECT e1 FROM pm1.g1", FakeMetadataFactory.example1Cached(), new String[] {}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$
+ helpTest(exampleAuthSvc1(), "SELECT e1 FROM pm1.g1", RealMetadataFactory.example1Cached(), new String[] {}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$
}
@Test public void testEverythingAccessible1() throws Exception {
- helpTest(exampleAuthSvc1(), "SELECT e1 FROM (select e1 from pm1.g1) x", FakeMetadataFactory.example1Cached(), new String[] {}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$
+ helpTest(exampleAuthSvc1(), "SELECT e1 FROM (select e1 from pm1.g1) x", RealMetadataFactory.example1Cached(), new String[] {}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$
}
@Test public void testEverythingAccessible2() throws Exception {
- helpTest(exampleAuthSvc1(), "SELECT lookup('pm1.g1', 'e1', 'e1', '1'), e1 FROM (select e1 from pm1.g1) x", FakeMetadataFactory.example1Cached(), new String[] {}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$
+ helpTest(exampleAuthSvc1(), "SELECT lookup('pm1.g1', 'e1', 'e1', '1'), e1 FROM (select e1 from pm1.g1) x", RealMetadataFactory.example1Cached(), new String[] {}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$
}
@Test public void testInaccesibleElement() throws Exception {
- helpTest(exampleAuthSvc1(), "SELECT e2 FROM pm1.g1", FakeMetadataFactory.example1Cached(), new String[] {"pm1.g1.e2"}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTest(exampleAuthSvc1(), "SELECT e2 FROM pm1.g1", RealMetadataFactory.example1Cached(), new String[] {"pm1.g1.e2"}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testInaccesibleElement2() throws Exception {
- helpTest(exampleAuthSvc1(), "SELECT lookup('pm1.g1', 'e1', 'e2', '1')", FakeMetadataFactory.example1Cached(), new String[] {"pm1.g1.e2"}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTest(exampleAuthSvc1(), "SELECT lookup('pm1.g1', 'e1', 'e2', '1')", RealMetadataFactory.example1Cached(), new String[] {"pm1.g1.e2"}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testInaccesibleGroup() throws Exception {
- helpTest(exampleAuthSvc1(), "SELECT e1 FROM pm1.g2", FakeMetadataFactory.example1Cached(), new String[] {"pm1.g2", "pm1.g2.e1"}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ helpTest(exampleAuthSvc1(), "SELECT e1 FROM pm1.g2", RealMetadataFactory.example1Cached(), new String[] {"pm1.g2", "pm1.g2.e1"}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
@Test public void testInsert() throws Exception {
- helpTest(exampleAuthSvc1(), "INSERT INTO pm1.g1 (e1, e2, e3, e4) VALUES ('x', 5, {b'true'}, 1.0)", FakeMetadataFactory.example1Cached(), new String[] {}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$
+ helpTest(exampleAuthSvc1(), "INSERT INTO pm1.g1 (e1, e2, e3, e4) VALUES ('x', 5, {b'true'}, 1.0)", RealMetadataFactory.example1Cached(), new String[] {}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$
}
@Test public void testInsertInaccessible() throws Exception {
- helpTest(exampleAuthSvc1(), "INSERT INTO pm1.g2 (e1, e2, e3, e4) VALUES ('x', 5, {b'true'}, 1.0)", FakeMetadataFactory.example1Cached(), new String[] {"pm1.g2.e1"}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTest(exampleAuthSvc1(), "INSERT INTO pm1.g2 (e1, e2, e3, e4) VALUES ('x', 5, {b'true'}, 1.0)", RealMetadataFactory.example1Cached(), new String[] {"pm1.g2.e1"}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testUpdate() throws Exception {
- helpTest(exampleAuthSvc1(), "UPDATE pm1.g1 SET e2 = 5", FakeMetadataFactory.example1Cached(), new String[] {}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$
+ helpTest(exampleAuthSvc1(), "UPDATE pm1.g1 SET e2 = 5", RealMetadataFactory.example1Cached(), new String[] {}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$
}
@Test public void testUpdateCriteriaInaccessibleForRead() throws Exception {
- helpTest(exampleAuthSvc1(), "UPDATE pm1.g2 SET e2 = 5 WHERE e1 = 'x'", FakeMetadataFactory.example1Cached(), new String[] {"pm1.g2.e1"}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTest(exampleAuthSvc1(), "UPDATE pm1.g2 SET e2 = 5 WHERE e1 = 'x'", RealMetadataFactory.example1Cached(), new String[] {"pm1.g2.e1"}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testUpdateCriteriaInaccessibleForRead1() throws Exception {
- helpTest(exampleAuthSvc1(), "UPDATE pm1.g2 SET e2 = cast(e1 as integer)", FakeMetadataFactory.example1Cached(), new String[] {"pm1.g2.e1"}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTest(exampleAuthSvc1(), "UPDATE pm1.g2 SET e2 = cast(e1 as integer)", RealMetadataFactory.example1Cached(), new String[] {"pm1.g2.e1"}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testUpdateElementInaccessibleForUpdate() throws Exception {
- helpTest(exampleAuthSvc1(), "UPDATE pm1.g1 SET e1 = 5 WHERE e1 = 'x'", FakeMetadataFactory.example1Cached(), new String[] {"pm1.g1.e1"}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTest(exampleAuthSvc1(), "UPDATE pm1.g1 SET e1 = 5 WHERE e1 = 'x'", RealMetadataFactory.example1Cached(), new String[] {"pm1.g1.e1"}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testDelete() throws Exception {
- helpTest(exampleAuthSvc1(), "DELETE FROM pm1.g1", FakeMetadataFactory.example1Cached(), new String[] {}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$
+ helpTest(exampleAuthSvc1(), "DELETE FROM pm1.g1", RealMetadataFactory.example1Cached(), new String[] {}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$
}
@Test public void testDeleteCriteriaInaccesibleForRead() throws Exception {
- helpTest(exampleAuthSvc1(), "DELETE FROM pm1.g2 WHERE e1 = 'x'", FakeMetadataFactory.example1Cached(), new String[] {"pm1.g2.e1"}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTest(exampleAuthSvc1(), "DELETE FROM pm1.g2 WHERE e1 = 'x'", RealMetadataFactory.example1Cached(), new String[] {"pm1.g2.e1"}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testDeleteInaccesibleGroup() throws Exception {
- helpTest(exampleAuthSvc1(), "DELETE FROM pm1.g3", FakeMetadataFactory.example1Cached(), new String[] {"pm1.g3"}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTest(exampleAuthSvc1(), "DELETE FROM pm1.g3", RealMetadataFactory.example1Cached(), new String[] {"pm1.g3"}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testProc() throws Exception {
- helpTest(exampleAuthSvc1(), "EXEC pm1.sq1()", FakeMetadataFactory.example1Cached(), new String[] {}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$
+ helpTest(exampleAuthSvc1(), "EXEC pm1.sq1()", RealMetadataFactory.example1Cached(), new String[] {}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$
}
@Test public void testProcInaccesible() throws Exception {
- helpTest(exampleAuthSvc1(), "EXEC pm1.sq2('xyz')", FakeMetadataFactory.example1Cached(), new String[] {"pm1.sq2"}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTest(exampleAuthSvc1(), "EXEC pm1.sq2('xyz')", RealMetadataFactory.example1Cached(), new String[] {"pm1.sq2"}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testSelectIntoEverythingAccessible() throws Exception {
- helpTest(exampleAuthSvc2(), "SELECT e1, e2, e3, e4 INTO pm1.g2 FROM pm2.g1", FakeMetadataFactory.example1Cached(), new String[] {}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$
+ helpTest(exampleAuthSvc2(), "SELECT e1, e2, e3, e4 INTO pm1.g2 FROM pm2.g1", RealMetadataFactory.example1Cached(), new String[] {}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$
}
@Test public void testSelectIntoTarget_e1_NotAccessible() throws Exception {
- helpTest(exampleAuthSvc2(), "SELECT e1, e2, e3, e4 INTO pm2.g2 FROM pm2.g1", FakeMetadataFactory.example1Cached(), new String[] {"pm2.g2.e2","pm2.g2.e4","pm2.g2.e3"}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ helpTest(exampleAuthSvc2(), "SELECT e1, e2, e3, e4 INTO pm2.g2 FROM pm2.g1", RealMetadataFactory.example1Cached(), new String[] {"pm2.g2.e2","pm2.g2.e4","pm2.g2.e3"}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
@Test public void testSelectIntoTarget_e1e2_NotAccessible() throws Exception {
- helpTest(exampleAuthSvc2(), "SELECT e1, e2, e3, e4 INTO pm3.g2 FROM pm2.g1", FakeMetadataFactory.example1Cached(), new String[] {"pm3.g2.e4", "pm3.g2.e3"},FakeMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ helpTest(exampleAuthSvc2(), "SELECT e1, e2, e3, e4 INTO pm3.g2 FROM pm2.g1", RealMetadataFactory.example1Cached(), new String[] {"pm3.g2.e4", "pm3.g2.e3"},RealMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
@Test public void testTempTableSelectInto() throws Exception {
- helpTest(exampleAuthSvc1(), "SELECT e1 INTO #temp FROM pm1.g1", FakeMetadataFactory.example1Cached(), new String[] {}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$
+ helpTest(exampleAuthSvc1(), "SELECT e1 INTO #temp FROM pm1.g1", RealMetadataFactory.example1Cached(), new String[] {}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$
+ helpTest(exampleAuthSvc2(), "SELECT e1 INTO #temp FROM pm1.g1", RealMetadataFactory.example1Cached(), new String[] {"#temp"}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$
}
@Test public void testTempTableSelectInto1() throws Exception {
- helpTest(exampleAuthSvc1(), "SELECT e1, e2 INTO #temp FROM pm1.g1", FakeMetadataFactory.example1Cached(), new String[] {"pm1.g1.e2"}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTest(exampleAuthSvc1(), "SELECT e1, e2 INTO #temp FROM pm1.g1", RealMetadataFactory.example1Cached(), new String[] {"pm1.g1.e2"}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testTempTableInsert() throws Exception {
- helpTest(exampleAuthSvc2(), "insert into #temp (e1, e2, e3, e4) values ('1', '2', '3', '4')", FakeMetadataFactory.example1Cached(), new String[] {}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$
+ helpTest(exampleAuthSvc1(), "insert into #temp (e1, e2, e3, e4) values ('1', '2', '3', '4')", RealMetadataFactory.example1Cached(), new String[] {}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$
+ helpTest(exampleAuthSvc2(), "insert into #temp (e1, e2, e3, e4) values ('1', '2', '3', '4')", RealMetadataFactory.example1Cached(), new String[] {"#temp"}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$
}
-
+
@Test public void testXMLAccessible() throws Exception {
- helpTest(exampleAuthSvc2(), "select * from xmltest.doc1", FakeMetadataFactory.example1Cached(), new String[] {"xmltest.doc1"}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTest(exampleAuthSvc2(), "select * from xmltest.doc1", RealMetadataFactory.example1Cached(), new String[] {}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testXMLInAccessible() throws Exception {
- helpTest(exampleAuthSvc1(), "select * from xmltest.doc1", FakeMetadataFactory.example1Cached(), new String[] {"xmltest.doc1"}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTest(exampleAuthSvc1(), "select * from xmltest.doc1", RealMetadataFactory.example1Cached(), new String[] {"xmltest.doc1"}, RealMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testAlter() throws Exception {
- helpTest(exampleAuthSvc1(), "alter view SmallA_2589 as select * from bqt1.smalla", RealMetadataFactory.exampleBQTCached(), new String[] {"SmallA_2589"}, FakeMetadataFactory.exampleBQTVDB()); //$NON-NLS-1$ //$NON-NLS-2$
- helpTest(examplePolicyBQT(), "alter view SmallA_2589 as select * from bqt1.smalla", RealMetadataFactory.exampleBQTCached(), new String[] {}, FakeMetadataFactory.exampleBQTVDB()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTest(exampleAuthSvc1(), "alter view SmallA_2589 as select * from bqt1.smalla", RealMetadataFactory.exampleBQTCached(), new String[] {"SmallA_2589"}, RealMetadataFactory.exampleBQTVDB()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTest(examplePolicyBQT(), "alter view SmallA_2589 as select * from bqt1.smalla", RealMetadataFactory.exampleBQTCached(), new String[] {}, RealMetadataFactory.exampleBQTVDB()); //$NON-NLS-1$ //$NON-NLS-2$
- helpTest(exampleAuthSvc1(), "alter trigger on SmallA_2589 INSTEAD OF UPDATE enabled", RealMetadataFactory.exampleBQTCached(), new String[] {"SmallA_2589"}, FakeMetadataFactory.exampleBQTVDB()); //$NON-NLS-1$ //$NON-NLS-2$
- helpTest(examplePolicyBQT(), "alter trigger on SmallA_2589 INSTEAD OF UPDATE enabled", RealMetadataFactory.exampleBQTCached(), new String[] {}, FakeMetadataFactory.exampleBQTVDB()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTest(exampleAuthSvc1(), "alter trigger on SmallA_2589 INSTEAD OF UPDATE enabled", RealMetadataFactory.exampleBQTCached(), new String[] {"SmallA_2589"}, RealMetadataFactory.exampleBQTVDB()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTest(examplePolicyBQT(), "alter trigger on SmallA_2589 INSTEAD OF UPDATE enabled", RealMetadataFactory.exampleBQTCached(), new String[] {}, RealMetadataFactory.exampleBQTVDB()); //$NON-NLS-1$ //$NON-NLS-2$
}
private void helpTestLookupVisibility(boolean visible) throws QueryParserException, QueryValidatorException, TeiidComponentException {
- VDBMetaData vdb = FakeMetadataFactory.example1VDB();
+ VDBMetaData vdb = RealMetadataFactory.example1VDB();
vdb.getModel("pm1").setVisible(visible); //$NON-NLS-1$
AuthorizationValidationVisitor mvvv = new AuthorizationValidationVisitor(new HashMap<String, DataPolicy>(), "test"); //$NON-NLS-1$
String sql = "select lookup('pm1.g1', 'e1', 'e2', 1)"; //$NON-NLS-1$
Command command = QueryParser.getQueryParser().parseCommand(sql);
- Request.validateWithVisitor(mvvv, FakeMetadataFactory.example1Cached(), command);
+ Request.validateWithVisitor(mvvv, RealMetadataFactory.example1Cached(), command);
}
@Ignore("visibility no longer ristricts access")
Modified: branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -40,7 +40,6 @@
import org.teiid.query.processor.ProcessorPlan;
import org.teiid.query.sql.lang.Query;
import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.unittest.FakeMetadataFactory;
import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
@@ -91,7 +90,7 @@
CachedResults cachedResults = UnitTestUtil.helpSerialize(results);
- FakeMetadataFactory.buildWorkContext(RealMetadataFactory.exampleBQT());
+ RealMetadataFactory.buildWorkContext(RealMetadataFactory.exampleBQT());
cachedResults.restore(cache, bm);
Modified: branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestCallableStatement.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestCallableStatement.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestCallableStatement.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -32,7 +32,7 @@
import org.junit.Test;
import org.teiid.api.exception.query.QueryResolverException;
import org.teiid.query.processor.HardcodedDataManager;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
@SuppressWarnings("nls")
public class TestCallableStatement {
@@ -41,7 +41,7 @@
String sql = "{? = call pm4.spTest9()}"; //$NON-NLS-1$
try {
- TestPreparedStatement.helpTestProcessing(sql, Collections.EMPTY_LIST, null, new HardcodedDataManager(), FakeMetadataFactory.exampleBQTCached(), true, FakeMetadataFactory.exampleBQTVDB());
+ TestPreparedStatement.helpTestProcessing(sql, Collections.EMPTY_LIST, null, new HardcodedDataManager(), RealMetadataFactory.exampleBQTCached(), true, RealMetadataFactory.exampleBQTVDB());
fail();
} catch (QueryResolverException e) {
assertEquals("Required parameter 'pm4.spTest9.inkey' has no value was set or is an invalid parameter.", e.getMessage()); //$NON-NLS-1$
@@ -60,7 +60,7 @@
HardcodedDataManager dataManager = new HardcodedDataManager();
dataManager.addData("? = EXEC pm4.spTest9(1)", expected);
- TestPreparedStatement.helpTestProcessing(sql, values, expected, dataManager, FakeMetadataFactory.exampleBQTCached(), true, FakeMetadataFactory.exampleBQTVDB());
+ TestPreparedStatement.helpTestProcessing(sql, values, expected, dataManager, RealMetadataFactory.exampleBQTCached(), true, RealMetadataFactory.exampleBQTVDB());
}
/**
@@ -79,7 +79,7 @@
HardcodedDataManager dataManager = new HardcodedDataManager();
dataManager.addData("EXEC pm4.spTest9(1)", expected);
- TestPreparedStatement.helpTestProcessing(sql, values, expected, dataManager, FakeMetadataFactory.exampleBQTCached(), true, FakeMetadataFactory.exampleBQTVDB());
+ TestPreparedStatement.helpTestProcessing(sql, values, expected, dataManager, RealMetadataFactory.exampleBQTCached(), true, RealMetadataFactory.exampleBQTVDB());
}
@Test public void testOutParameter() throws Exception {
@@ -94,7 +94,7 @@
HardcodedDataManager dataManager = new HardcodedDataManager();
dataManager.addData("EXEC pm2.spTest8(2)", expected);
- TestPreparedStatement.helpTestProcessing(sql, values, expected, dataManager, FakeMetadataFactory.exampleBQTCached(), true, FakeMetadataFactory.exampleBQTVDB());
+ TestPreparedStatement.helpTestProcessing(sql, values, expected, dataManager, RealMetadataFactory.exampleBQTCached(), true, RealMetadataFactory.exampleBQTVDB());
}
@Test(expected=QueryResolverException.class) public void testInvalidReturn() throws Exception {
@@ -105,7 +105,7 @@
List[] expected = new List[0];
HardcodedDataManager dataManager = new HardcodedDataManager();
- TestPreparedStatement.helpTestProcessing(sql, values, expected, dataManager, FakeMetadataFactory.exampleBQTCached(), true, FakeMetadataFactory.exampleBQTVDB());
+ TestPreparedStatement.helpTestProcessing(sql, values, expected, dataManager, RealMetadataFactory.exampleBQTCached(), true, RealMetadataFactory.exampleBQTVDB());
}
@Test public void testInputExpression() throws Exception {
@@ -117,7 +117,7 @@
HardcodedDataManager dataManager = new HardcodedDataManager();
dataManager.addData("EXEC pm2.spTest8(1)", expected);
- TestPreparedStatement.helpTestProcessing(sql, null, expected, dataManager, FakeMetadataFactory.exampleBQTCached(), true, FakeMetadataFactory.exampleBQTVDB());
+ TestPreparedStatement.helpTestProcessing(sql, null, expected, dataManager, RealMetadataFactory.exampleBQTCached(), true, RealMetadataFactory.exampleBQTVDB());
}
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -52,7 +52,6 @@
import org.teiid.query.optimizer.TestOptimizer;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
-import org.teiid.query.unittest.FakeMetadataFactory;
import org.teiid.query.unittest.RealMetadataFactory;
@SuppressWarnings("nls")
@@ -64,7 +63,7 @@
@Before public void setUp() throws Exception {
agds = new AutoGenDataService();
- DQPWorkContext context = FakeMetadataFactory.buildWorkContext(RealMetadataFactory.createTransformationMetadata(RealMetadataFactory.exampleBQTCached().getMetadataStore(), "bqt"));
+ DQPWorkContext context = RealMetadataFactory.buildWorkContext(RealMetadataFactory.createTransformationMetadata(RealMetadataFactory.exampleBQTCached().getMetadataStore(), "bqt"));
context.getVDB().getModel("BQT3").setVisible(false); //$NON-NLS-1$
context.getVDB().getModel("VQT").setVisible(false); //$NON-NLS-1$
Modified: branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -41,7 +41,7 @@
import org.teiid.query.parser.QueryParser;
import org.teiid.query.resolver.QueryResolver;
import org.teiid.query.sql.lang.Command;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
public class TestDataTierManager {
@@ -72,8 +72,8 @@
}
private void helpSetup(String sql, int nodeId) throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
- DQPWorkContext workContext = FakeMetadataFactory.buildWorkContext(metadata, FakeMetadataFactory.exampleBQTVDB());
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
+ DQPWorkContext workContext = RealMetadataFactory.buildWorkContext(metadata, RealMetadataFactory.exampleBQTVDB());
rm = new DQPCore();
rm.setTransactionService(new FakeTransactionService());
Modified: branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -24,10 +24,12 @@
import static org.junit.Assert.*;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import org.junit.Test;
+import org.teiid.adminapi.impl.ModelMetaData;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.client.RequestMessage;
import org.teiid.client.metadata.MetadataResult;
@@ -35,11 +37,17 @@
import org.teiid.core.types.DataTypeManager;
import org.teiid.dqp.internal.datamgr.FakeTransactionService;
import org.teiid.dqp.message.RequestID;
+import org.teiid.metadata.Column;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Schema;
+import org.teiid.metadata.Table;
+import org.teiid.query.mapping.relational.QueryNode;
import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.parser.QueryParser;
import org.teiid.query.resolver.QueryResolver;
import org.teiid.query.sql.lang.Command;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
/**
@@ -57,7 +65,7 @@
DQPCore requestMgr = new DQPCore();
requestMgr.setTransactionService(new FakeTransactionService());
- DQPWorkContext workContext = FakeMetadataFactory.buildWorkContext(metadata, vdb);
+ DQPWorkContext workContext = RealMetadataFactory.buildWorkContext(metadata, vdb);
// Initialize components
RequestID requestID = workContext.getRequestID(1);
@@ -70,27 +78,27 @@
}
@Test public void testSimpleQuery() throws Exception {
- Map[] metadata = helpGetMetadata("SELECT e1 FROM pm1.g1", FakeMetadataFactory.example1Cached(), FakeMetadataFactory.example1VDB()); //$NON-NLS-1$
+ Map[] metadata = helpGetMetadata("SELECT e1 FROM pm1.g1", RealMetadataFactory.example1Cached(), RealMetadataFactory.example1VDB()); //$NON-NLS-1$
assertNotNull(metadata);
assertEquals(1, metadata.length);
}
@Test public void testSimpleUpdate() throws Exception {
- Map[] metadata = helpGetMetadata("INSERT INTO pm1.g1 (e1) VALUES ('x')", FakeMetadataFactory.example1Cached(), FakeMetadataFactory.example1VDB()); //$NON-NLS-1$
+ Map[] metadata = helpGetMetadata("INSERT INTO pm1.g1 (e1) VALUES ('x')", RealMetadataFactory.example1Cached(), RealMetadataFactory.example1VDB()); //$NON-NLS-1$
assertNull(metadata);
- metadata = helpGetMetadata("DELETE FROM pm1.g1 WHERE e1 = 'x'", FakeMetadataFactory.example1Cached(), FakeMetadataFactory.example1VDB()); //$NON-NLS-1$
+ metadata = helpGetMetadata("DELETE FROM pm1.g1 WHERE e1 = 'x'", RealMetadataFactory.example1Cached(), RealMetadataFactory.example1VDB()); //$NON-NLS-1$
assertNull(metadata);
- metadata = helpGetMetadata("UPDATE pm1.g1 SET e1='y' WHERE e1 = 'x'", FakeMetadataFactory.example1Cached(), FakeMetadataFactory.example1VDB()); //$NON-NLS-1$
+ metadata = helpGetMetadata("UPDATE pm1.g1 SET e1='y' WHERE e1 = 'x'", RealMetadataFactory.example1Cached(), RealMetadataFactory.example1VDB()); //$NON-NLS-1$
assertNull(metadata);
- metadata = helpGetMetadata("SELECT e1, e2, e3, e4 INTO pm1.g2 FROM pm1.g1", FakeMetadataFactory.example1Cached(),FakeMetadataFactory.example1VDB()); //$NON-NLS-1$
+ metadata = helpGetMetadata("SELECT e1, e2, e3, e4 INTO pm1.g2 FROM pm1.g1", RealMetadataFactory.example1Cached(),RealMetadataFactory.example1VDB()); //$NON-NLS-1$
assertNull(metadata);
}
@Test public void testElementLabel() throws Exception {
- Map[] metadata = helpGetMetadata("SELECT E2 FROM pm1.g1", FakeMetadataFactory.example1Cached(), FakeMetadataFactory.example1VDB()); //$NON-NLS-1$
+ Map[] metadata = helpGetMetadata("SELECT E2 FROM pm1.g1", RealMetadataFactory.example1Cached(), RealMetadataFactory.example1VDB()); //$NON-NLS-1$
assertNotNull(metadata);
assertEquals(1, metadata.length);
assertEquals("e2", metadata[0].get(ResultsMetadataConstants.ELEMENT_NAME)); //$NON-NLS-1$
@@ -98,13 +106,13 @@
}
@Test public void testSimpleExec() throws Exception {
- Map[] metadata = helpGetMetadata("EXEC pm1.sq1()", FakeMetadataFactory.example1Cached(), FakeMetadataFactory.example1VDB()); //$NON-NLS-1$
+ Map[] metadata = helpGetMetadata("EXEC pm1.sq1()", RealMetadataFactory.example1Cached(), RealMetadataFactory.example1VDB()); //$NON-NLS-1$
assertNotNull(metadata);
assertEquals(2, metadata.length);
}
@Test public void testExecNoResultColumns() throws Exception {
- Map[] metadata = helpGetMetadata("EXEC pm1.sp5()", FakeMetadataFactory.example1Cached(), FakeMetadataFactory.example1VDB()); //$NON-NLS-1$
+ Map[] metadata = helpGetMetadata("EXEC pm1.sp5()", RealMetadataFactory.example1Cached(), RealMetadataFactory.example1VDB()); //$NON-NLS-1$
assertNotNull(metadata);
assertEquals(0, metadata.length);
}
@@ -116,7 +124,7 @@
// Initialize components
MetaDataProcessor mdProc = new MetaDataProcessor(new DQPCore(), prepPlanCache, "MyVDB", 1);
- DQPWorkContext workContext = FakeMetadataFactory.buildWorkContext(metadata, vdb);
+ DQPWorkContext workContext = RealMetadataFactory.buildWorkContext(metadata, vdb);
return mdProc.processMessage(workContext.getRequestID(1), workContext, sql, true);
}
@@ -129,19 +137,19 @@
}
@Test public void testDefect16629_moneyType() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.examplePrivatePhysicalModel();
+ QueryMetadataInterface metadata = TestMetaDataProcessor.examplePrivatePhysicalModel();
String sql = "SELECT e1 FROM pm1.g2"; //$NON-NLS-1$
- MetadataResult response = helpTestQuery(metadata, sql, FakeMetadataFactory.examplePrivatePhysicalModelVDB());
+ MetadataResult response = helpTestQuery(metadata, sql, TestMetaDataProcessor.examplePrivatePhysicalModelVDB());
helpCheckNumericAttributes(response, 0, 21, 19, 4);
}
@Test public void testDefect16629_aggregatesOnMoneyType() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.examplePrivatePhysicalModel();
+ QueryMetadataInterface metadata = TestMetaDataProcessor.examplePrivatePhysicalModel();
String sql = "SELECT min(e1), max(e1), sum(e1), avg(e1) FROM pm1.g2"; //$NON-NLS-1$
- MetadataResult response = helpTestQuery(metadata, sql, FakeMetadataFactory.examplePrivatePhysicalModelVDB());
+ MetadataResult response = helpTestQuery(metadata, sql, TestMetaDataProcessor.examplePrivatePhysicalModelVDB());
helpCheckNumericAttributes(response, 0, 21, 19, 4);
helpCheckNumericAttributes(response, 1, 21, 19, 4);
helpCheckNumericAttributes(response, 2, 22, 20, 0);
@@ -222,4 +230,52 @@
fail("Invalid searchable constant value: " + searchable); //$NON-NLS-1$
}
}
+
+ public static TransformationMetadata examplePrivatePhysicalModel() {
+ MetadataStore metadataStore = new MetadataStore();
+ // Create models
+ Schema pm1 = RealMetadataFactory.createPhysicalModel("pm1", metadataStore); //$NON-NLS-1$
+ Schema vm1 = RealMetadataFactory.createVirtualModel("vm1", metadataStore); //$NON-NLS-1$
+
+ // Create physical groups
+ Table pm1g1 = RealMetadataFactory.createPhysicalGroup("g1", pm1); //$NON-NLS-1$
+
+ QueryNode vm1g1n1 = new QueryNode("SELECT * FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g1 = RealMetadataFactory.createVirtualGroup("g1", vm1, vm1g1n1); //$NON-NLS-1$
+
+ Table pm1g2 = RealMetadataFactory.createPhysicalGroup("g2", pm1); //$NON-NLS-1$
+
+ // Create physical elements
+ List<Column> pm1g1e = RealMetadataFactory.createElements(pm1g1,
+ new String[] { "e1"}, //$NON-NLS-1$
+ new String[] { DataTypeManager.DefaultDataTypes.SHORT});
+
+ // Create physical elements
+ List<Column> pm1g2e = RealMetadataFactory.createElements(pm1g2,
+ new String[] { "e1"}, //$NON-NLS-1$
+ new String[] { DataTypeManager.DefaultDataTypes.BIG_DECIMAL});
+
+ Column e1 = pm1g2e.get(0);
+ e1.setPrecision(19);
+ e1.setLength(21);
+ e1.setScale(4);
+
+ RealMetadataFactory.createElements(vm1g1,
+ new String[] { "e1" }, //$NON-NLS-1$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING });
+ // Create the facade from the store
+ return RealMetadataFactory.createTransformationMetadata(metadataStore, "example");
+ }
+
+ public static VDBMetaData examplePrivatePhysicalModelVDB() {
+ VDBMetaData vdb = new VDBMetaData();
+ vdb.setName("example1");
+ vdb.setVersion(1);
+ ModelMetaData m = RealMetadataFactory.createModel("pm1", true);
+ m.setVisible(false);
+ vdb.addModel(m);
+ vdb.addModel(RealMetadataFactory.createModel("vm1", false));
+
+ return vdb;
+ }
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -52,8 +52,7 @@
import org.teiid.query.processor.HardcodedDataManager;
import org.teiid.query.processor.ProcessorDataManager;
import org.teiid.query.processor.TestProcessor;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
@SuppressWarnings({"nls", "unchecked"})
public class TestPreparedStatement {
@@ -151,7 +150,7 @@
List<?> values = Arrays.asList((short)0);
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
- helpTestProcessing(preparedSql, values, expected, dataManager, FakeMetadataFactory.example1Cached(), false, FakeMetadataFactory.example1VDB());
+ helpTestProcessing(preparedSql, values, expected, dataManager, RealMetadataFactory.example1Cached(), false, RealMetadataFactory.example1VDB());
}
@Test public void testSessionSpecificFunction() throws Exception {
@@ -168,7 +167,7 @@
List<?> values = Arrays.asList((short)0);
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
- helpTestProcessing(preparedSql, values, expected, dataManager, FakeMetadataFactory.example1Cached(), false, true, FakeMetadataFactory.example1VDB());
+ helpTestProcessing(preparedSql, values, expected, dataManager, RealMetadataFactory.example1Cached(), false, true, RealMetadataFactory.example1VDB());
}
@Test public void testFunctionWithReferencePushDown() throws Exception {
@@ -192,26 +191,26 @@
caps.setFunctionSupport("convert", true); //$NON-NLS-1$
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
List values = Arrays.asList(0);
- PreparedStatementRequest plan = helpGetProcessorPlan(preparedSql, values, capFinder, metadata, new SessionAwareCache<PreparedPlan>(), SESSION_ID, false, false,FakeMetadataFactory.example1VDB());
+ PreparedStatementRequest plan = helpGetProcessorPlan(preparedSql, values, capFinder, metadata, new SessionAwareCache<PreparedPlan>(), SESSION_ID, false, false,RealMetadataFactory.example1VDB());
TestOptimizer.checkNodeTypes(plan.processPlan, TestOptimizer.FULL_PUSHDOWN);
}
static public PreparedStatementRequest helpGetProcessorPlan(String preparedSql, List values, SessionAwareCache<PreparedPlan> prepPlanCache)
throws TeiidComponentException, TeiidProcessingException {
- return helpGetProcessorPlan(preparedSql, values, new DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(), prepPlanCache, SESSION_ID, false, false, FakeMetadataFactory.example1VDB());
+ return helpGetProcessorPlan(preparedSql, values, new DefaultCapabilitiesFinder(), RealMetadataFactory.example1Cached(), prepPlanCache, SESSION_ID, false, false, RealMetadataFactory.example1VDB());
}
static public PreparedStatementRequest helpGetProcessorPlan(String preparedSql, List values,
SessionAwareCache<PreparedPlan> prepPlanCache, int conn)
throws TeiidComponentException, TeiidProcessingException {
return helpGetProcessorPlan(preparedSql, values,
- new DefaultCapabilitiesFinder(), FakeMetadataFactory
- .example1Cached(), prepPlanCache, conn, false, false, FakeMetadataFactory.example1VDB());
+ new DefaultCapabilitiesFinder(), RealMetadataFactory
+ .example1Cached(), prepPlanCache, conn, false, false, RealMetadataFactory.example1VDB());
}
static PreparedStatementRequest helpGetProcessorPlan(String preparedSql, List values,
@@ -233,7 +232,7 @@
request.setRowLimit(1);
}
- DQPWorkContext workContext = FakeMetadataFactory.buildWorkContext(metadata, vdb);
+ DQPWorkContext workContext = RealMetadataFactory.buildWorkContext(metadata, vdb);
workContext.getSession().setSessionId(String.valueOf(conn));
PreparedStatementRequest serverRequest = new PreparedStatementRequest(prepPlanCache);
@@ -357,9 +356,9 @@
SessionAwareCache<PreparedPlan> planCache = new SessionAwareCache<PreparedPlan>();
- helpGetProcessorPlan(preparedSql, values, new DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(), planCache, SESSION_ID, false, true, FakeMetadataFactory.example1VDB());
+ helpGetProcessorPlan(preparedSql, values, new DefaultCapabilitiesFinder(), RealMetadataFactory.example1Cached(), planCache, SESSION_ID, false, true, RealMetadataFactory.example1VDB());
- helpGetProcessorPlan(preparedSql, values, new DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(), planCache, SESSION_ID, false, true, FakeMetadataFactory.example1VDB());
+ helpGetProcessorPlan(preparedSql, values, new DefaultCapabilitiesFinder(), RealMetadataFactory.example1Cached(), planCache, SESSION_ID, false, true, RealMetadataFactory.example1VDB());
//make sure the plan wasn't reused
assertEquals(0, planCache.getCacheHitCount());
}
@@ -373,8 +372,8 @@
List<String> values = Arrays.asList("aa "); //$NON-NLS-1$
FakeDataManager dataManager = new FakeDataManager();
- TestProcessor.sampleData2b(dataManager);
- helpTestProcessing(preparedSql, values, expected, dataManager, TestOptimizer.getGenericFinder(), FakeMetadataFactory.example1Cached(), null, false, false, false, FakeMetadataFactory.example1VDB());
+ TestProcessor.sampleData2b(dataManager, RealMetadataFactory.example1Cached());
+ helpTestProcessing(preparedSql, values, expected, dataManager, TestOptimizer.getGenericFinder(), RealMetadataFactory.example1Cached(), null, false, false, false, RealMetadataFactory.example1VDB());
}
@Test(expected=QueryValidatorException.class) public void testLimitValidation() throws Exception {
@@ -382,7 +381,7 @@
List values = Arrays.asList(-1);
FakeDataManager dataManager = new FakeDataManager();
- helpTestProcessing(preparedSql, values, null, dataManager, FakeMetadataFactory.example1Cached(), false, false, FakeMetadataFactory.example1VDB());
+ helpTestProcessing(preparedSql, values, null, dataManager, RealMetadataFactory.example1Cached(), false, false, RealMetadataFactory.example1VDB());
}
@Test public void testExecParam() throws Exception {
@@ -395,7 +394,7 @@
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
- helpTestProcessing(preparedSql, values, expected, dataManager, FakeMetadataFactory.example1Cached(), false, false, FakeMetadataFactory.example1VDB());
+ helpTestProcessing(preparedSql, values, expected, dataManager, RealMetadataFactory.example1Cached(), false, false, RealMetadataFactory.example1VDB());
}
@Test public void testLimitParam() throws Exception {
@@ -408,7 +407,7 @@
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
- helpTestProcessing(preparedSql, values, expected, dataManager, FakeMetadataFactory.example1Cached(), false, false,FakeMetadataFactory.example1VDB());
+ helpTestProcessing(preparedSql, values, expected, dataManager, RealMetadataFactory.example1Cached(), false, false,RealMetadataFactory.example1VDB());
}
@Test public void testWithSubqueryPushdown() throws Exception {
@@ -420,14 +419,14 @@
List values = Arrays.asList("a"); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
HardcodedDataManager dataManager = new HardcodedDataManager(metadata);
dataManager.addData("SELECT g_0.e1 FROM g1 AS g_0 WHERE g_0.e2 IN (SELECT g_1.e2 FROM g2 AS g_1 WHERE g_1.e1 = 'a')", new List[] {Arrays.asList("a")});
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
caps.setCapabilitySupport(Capability.CRITERIA_IN_SUBQUERY, true);
- helpTestProcessing(preparedSql, values, expected, dataManager, new DefaultCapabilitiesFinder(caps), metadata, null, false, false, false, FakeMetadataFactory.example1VDB());
+ helpTestProcessing(preparedSql, values, expected, dataManager, new DefaultCapabilitiesFinder(caps), metadata, null, false, false, false, RealMetadataFactory.example1VDB());
}
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -38,7 +38,7 @@
import org.teiid.query.processor.TestProcessor;
import org.teiid.query.sql.lang.Update;
import org.teiid.query.sql.symbol.Constant;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
/**
@@ -74,7 +74,7 @@
};
// Create the plan and process the query
- TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, FakeMetadataFactory.example1Cached(), prepPlanCache, false, false, false,FakeMetadataFactory.example1VDB());
+ TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, RealMetadataFactory.example1Cached(), prepPlanCache, false, false, false,RealMetadataFactory.example1VDB());
Update update = (Update)dataManager.getCommandHistory().iterator().next();
assertTrue(((Constant)update.getChangeList().getClauses().get(0).getValue()).isMultiValued());
}
@@ -148,7 +148,7 @@
finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = null, e3 = FALSE WHERE pm1.g1.e2 = 1")); //$NON-NLS-1$
// Create the plan and process the query
- TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, FakeMetadataFactory.example1Cached(), prepPlanCache, false, false, false,FakeMetadataFactory.example1VDB());
+ TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, RealMetadataFactory.example1Cached(), prepPlanCache, false, false, false,RealMetadataFactory.example1VDB());
// Repeat with different number of commands in batch
// Create expected results
@@ -168,7 +168,7 @@
finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'b', e3 = TRUE WHERE pm1.g1.e2 = 5")); //$NON-NLS-1$
// Use the cached plan and process the query
- TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, FakeMetadataFactory.example1Cached(), prepPlanCache, false, false, true,FakeMetadataFactory.example1VDB());
+ TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, RealMetadataFactory.example1Cached(), prepPlanCache, false, false, true,RealMetadataFactory.example1VDB());
// Verify all the queries that were run
assertEquals("Unexpected queries executed -", finalQueryList, dataManager.getQueries()); //$NON-NLS-1$
@@ -242,7 +242,7 @@
finalQueryList.add(new String("UPDATE pm1.g1 SET e2 = 1 WHERE pm1.g1.e1 = 'b'")); //$NON-NLS-1$
// Create the plan and process the query
- TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, FakeMetadataFactory.example1Cached(), prepPlanCache, false, false, false, FakeMetadataFactory.example1VDB());
+ TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, RealMetadataFactory.example1Cached(), prepPlanCache, false, false, false, RealMetadataFactory.example1VDB());
// Repeat
expected = new List[] {
@@ -260,7 +260,7 @@
finalQueryList.add(new String("UPDATE pm1.g1 SET e2 = 3 WHERE pm1.g1.e1 = 'd'")); //$NON-NLS-1$
// Use the cached plan and process the query
- TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, FakeMetadataFactory.example1Cached(), prepPlanCache, false, false, true,FakeMetadataFactory.example1VDB());
+ TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, RealMetadataFactory.example1Cached(), prepPlanCache, false, false, true,RealMetadataFactory.example1VDB());
// Verify all the queries that were run
assertEquals("Unexpected queries executed -", finalQueryList, dataManager.getQueries()); //$NON-NLS-1$
@@ -337,7 +337,7 @@
finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = null, e3 = FALSE WHERE pm1.g1.e2 = 1")); //$NON-NLS-1$
// Create the plan and process the query
- TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, FakeMetadataFactory.example1Cached(), prepPlanCache, false, false, false, FakeMetadataFactory.example1VDB());
+ TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, RealMetadataFactory.example1Cached(), prepPlanCache, false, false, false, RealMetadataFactory.example1VDB());
// Repeat with different number of commands in batch
// Create expected results
@@ -354,7 +354,7 @@
finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'a', e3 = FALSE WHERE pm1.g1.e2 = 0")); //$NON-NLS-1$
// Use the cached plan and process the query
- TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, FakeMetadataFactory.example1Cached(), prepPlanCache, false, false, true, FakeMetadataFactory.example1VDB());
+ TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, RealMetadataFactory.example1Cached(), prepPlanCache, false, false, true, RealMetadataFactory.example1VDB());
// Repeat with different number of commands in batch
// Create expected results
@@ -382,7 +382,7 @@
finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'c', e3 = TRUE WHERE pm1.g1.e2 = 4")); //$NON-NLS-1$
finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'b', e3 = TRUE WHERE pm1.g1.e2 = 5")); //$NON-NLS-1$
- TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, FakeMetadataFactory.example1Cached(), prepPlanCache, false, false, true, FakeMetadataFactory.example1VDB());
+ TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, RealMetadataFactory.example1Cached(), prepPlanCache, false, false, true, RealMetadataFactory.example1VDB());
// Verify all the queries that were run
assertEquals("Unexpected queries executed -", finalQueryList, dataManager.getQueries()); //$NON-NLS-1$
@@ -458,7 +458,7 @@
finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'b', e3 = TRUE WHERE pm1.g1.e2 = 1")); //$NON-NLS-1$
// Create the plan and process the query
- TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, FakeMetadataFactory.example1Cached(), prepPlanCache, false, false, false, FakeMetadataFactory.example1VDB());
+ TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, RealMetadataFactory.example1Cached(), prepPlanCache, false, false, false, RealMetadataFactory.example1VDB());
// Repeat with different number of commands in batch
expected = new List[] {
@@ -473,7 +473,7 @@
finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'c', e3 = FALSE WHERE pm1.g1.e2 = 1")); //$NON-NLS-1$
// Use the cached plan and process the query
- TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, FakeMetadataFactory.example1Cached(), prepPlanCache, false, false, true, FakeMetadataFactory.example1VDB());
+ TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, RealMetadataFactory.example1Cached(), prepPlanCache, false, false, true, RealMetadataFactory.example1VDB());
// Repeat with different number of commands in batch
expected = new List[] {
@@ -496,7 +496,7 @@
finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'f', e3 = TRUE WHERE pm1.g1.e2 = 2")); //$NON-NLS-1$
finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'g', e3 = TRUE WHERE pm1.g1.e2 = 3")); //$NON-NLS-1$
- TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, FakeMetadataFactory.example1Cached(), prepPlanCache, false, false, true,FakeMetadataFactory.example1VDB());
+ TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, RealMetadataFactory.example1Cached(), prepPlanCache, false, false, true,RealMetadataFactory.example1VDB());
// Verify all the queries that were run
assertEquals("Unexpected queries executed -", finalQueryList, dataManager.getQueries()); //$NON-NLS-1$
Modified: branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -41,7 +41,7 @@
import org.teiid.query.resolver.QueryResolver;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.tempdata.TempTableStore;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.ContextProperties;
@@ -70,14 +70,14 @@
* @since 4.2
*/
public void testValidateEntitlement() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
Request request = new Request();
Command command = QueryParser.getQueryParser().parseCommand(QUERY);
QueryResolver.resolveCommand(command, metadata);
RequestMessage message = new RequestMessage();
- DQPWorkContext workContext = FakeMetadataFactory.buildWorkContext(metadata, FakeMetadataFactory.example1VDB());
+ DQPWorkContext workContext = RealMetadataFactory.buildWorkContext(metadata, RealMetadataFactory.example1VDB());
request.initialize(message, null, null,new FakeTransactionService(), TEMP_TABLE_STORE, workContext, null);
request.initMetadata();
@@ -94,12 +94,12 @@
* @since 4.2
*/
public void testProcessRequest() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
//Try before plan is cached.
//If this doesn't throw an exception, assume it was successful.
RequestMessage message = new RequestMessage(QUERY);
- DQPWorkContext workContext = FakeMetadataFactory.buildWorkContext(metadata, FakeMetadataFactory.example1VDB());
+ DQPWorkContext workContext = RealMetadataFactory.buildWorkContext(metadata, RealMetadataFactory.example1VDB());
helpProcessMessage(message, null, workContext);
@@ -110,12 +110,12 @@
}
public void testCommandContext() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
//Try before plan is cached.
//If this doesn't throw an exception, assume it was successful.
RequestMessage message = new RequestMessage(QUERY);
- DQPWorkContext workContext = FakeMetadataFactory.buildWorkContext(metadata, FakeMetadataFactory.example1VDB());
+ DQPWorkContext workContext = RealMetadataFactory.buildWorkContext(metadata, RealMetadataFactory.example1VDB());
Request request = helpProcessMessage(message, null, workContext);
assertEquals("1", request.context.getEnvironmentProperties().get(ContextProperties.SESSION_ID)); //$NON-NLS-1$
@@ -147,14 +147,14 @@
* @since 4.2
*/
public void testProcessRequestPreparedStatement() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
SessionAwareCache<PreparedPlan> cache = new SessionAwareCache<PreparedPlan>();
//Try before plan is cached.
//If this doesn't throw an exception, assume it was successful.
RequestMessage message = new RequestMessage(QUERY);
- DQPWorkContext workContext = FakeMetadataFactory.buildWorkContext(metadata, FakeMetadataFactory.example1VDB());
+ DQPWorkContext workContext = RealMetadataFactory.buildWorkContext(metadata, RealMetadataFactory.example1VDB());
message.setStatementType(StatementType.PREPARED);
message.setParameterValues(new ArrayList());
Modified: branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceElementReplacementVisitor.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceElementReplacementVisitor.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceElementReplacementVisitor.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -32,7 +32,7 @@
import org.teiid.query.resolver.QueryResolver;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.navigator.DeepPostOrderNavigator;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
@@ -43,7 +43,7 @@
public QueryMetadataInterface getMetadata() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleMultiBinding();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
Set<String> multiSourceModels = new HashSet<String>();
multiSourceModels.add("MultiModel"); //$NON-NLS-1$
MultiSourceMetadataWrapper wrapper = new MultiSourceMetadataWrapper(metadata, multiSourceModels);
Modified: branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceMetadataWrapper.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceMetadataWrapper.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceMetadataWrapper.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -30,7 +30,7 @@
import org.teiid.core.types.DataTypeManager;
import org.teiid.query.sql.symbol.SingleElementSymbol;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
@@ -42,7 +42,7 @@
public void testMultiSourcePseudoElement() throws Exception {
HashSet<String> multiSourceModels = new HashSet<String>();
multiSourceModels.add("BQT1");
- MultiSourceMetadataWrapper wrapper = new MultiSourceMetadataWrapper(FakeMetadataFactory.exampleBQTCached(), multiSourceModels);
+ MultiSourceMetadataWrapper wrapper = new MultiSourceMetadataWrapper(RealMetadataFactory.exampleBQTCached(), multiSourceModels);
Object groupID = wrapper.getGroupID("BQT1.SmallA"); //$NON-NLS-1$
List elements = wrapper.getElementIDsInGroupID(groupID);
Modified: branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -52,8 +52,7 @@
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.visitor.ElementCollectorVisitor;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
/**
@@ -88,7 +87,7 @@
public void helpTestMultiSourcePlan(QueryMetadataInterface metadata, String userSql, String multiModel, int sourceCount, ProcessorDataManager dataMgr, List[] expectedResults, VDBMetaData vdb) throws Exception {
- DQPWorkContext dqpContext = FakeMetadataFactory.buildWorkContext(metadata, vdb);
+ DQPWorkContext dqpContext = RealMetadataFactory.buildWorkContext(metadata, vdb);
Set<String> multiSourceModels = vdb.getMultiSourceModelNames();
for (String model:multiSourceModels) {
@@ -131,18 +130,18 @@
}
@Test public void testNoReplacement() throws Exception {
- final QueryMetadataInterface metadata = FakeMetadataFactory.exampleMultiBinding();
+ final QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
final String userSql = "SELECT * FROM MultiModel.Phys WHERE SOURCE_NAME = 'bogus'"; //$NON-NLS-1$
final String multiModel = "MultiModel"; //$NON-NLS-1$
final int sources = 2;
final List[] expected =
new List[0];
final ProcessorDataManager dataMgr = new MultiSourceDataManager();
- helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, FakeMetadataFactory.exampleMultiBindingVDB());
+ helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
}
@Test public void testSingleReplacement() throws Exception {
- final QueryMetadataInterface metadata = FakeMetadataFactory.exampleMultiBinding();
+ final QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
final String userSql = "SELECT * FROM MultiModel.Phys WHERE SOURCE_NAME = 'a'"; //$NON-NLS-1$
final String multiModel = "MultiModel"; //$NON-NLS-1$
final int sources = 2;
@@ -150,11 +149,11 @@
new List[] { Arrays.asList(new Object[] { null, null, null}) };
final HardcodedDataManager dataMgr = new MultiSourceDataManager();
dataMgr.setMustRegisterCommands(false);
- helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, FakeMetadataFactory.exampleMultiBindingVDB());
+ helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
}
@Test public void testMultiReplacement() throws Exception {
- final QueryMetadataInterface metadata = FakeMetadataFactory.exampleMultiBinding();
+ final QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
final String userSql = "SELECT * FROM MultiModel.Phys"; //$NON-NLS-1$
final String multiModel = "MultiModel"; //$NON-NLS-1$
final int sources = 3;
@@ -163,11 +162,11 @@
Arrays.asList(new Object[] { null, null, null}),
Arrays.asList(new Object[] { null, null, null})};
final ProcessorDataManager dataMgr = new MultiSourceDataManager();
- helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, FakeMetadataFactory.exampleMultiBindingVDB());
+ helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
}
@Test public void testMultiReplacementWithOrderBy() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleMultiBinding();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
final String userSql = "SELECT * FROM MultiModel.Phys order by a"; //$NON-NLS-1$
final String multiModel = "MultiModel"; //$NON-NLS-1$
@@ -187,11 +186,11 @@
new List[] {
Arrays.asList("e", "z", "b"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Arrays.asList("f", "z", "b")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, FakeMetadataFactory.exampleMultiBindingVDB());
+ helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
}
@Test public void testMultiReplacementWithLimit() throws Exception {
- final QueryMetadataInterface metadata = FakeMetadataFactory.exampleMultiBinding();
+ final QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
final String userSql = "SELECT distinct * FROM MultiModel.Phys order by a limit 1"; //$NON-NLS-1$
final String multiModel = "MultiModel"; //$NON-NLS-1$
final int sources = 2;
@@ -207,11 +206,11 @@
new List[] {
Arrays.asList("e", "z", "b"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Arrays.asList("f", "z", "b")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, FakeMetadataFactory.exampleMultiBindingVDB());
+ helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
}
@Test public void testMultiDependentJoin() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleMultiBinding();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
final String userSql = "SELECT a.a FROM MultiModel.Phys a inner join MultiModel.Phys b makedep on (a.a = b.a) order by a"; //$NON-NLS-1$
final String multiModel = "MultiModel"; //$NON-NLS-1$
@@ -233,31 +232,31 @@
dataMgr.addData("SELECT g_0.a FROM MultiModel.Phys AS g_0 WHERE g_0.a IN ('x', 'y')", //$NON-NLS-1$
new List[] { Arrays.asList(new Object[] { "x" }), //$NON-NLS-1$
Arrays.asList(new Object[] { "y" })}); //$NON-NLS-1$
- helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, FakeMetadataFactory.exampleMultiBindingVDB());
+ helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
}
@Test public void testSingleReplacementInDynamicCommand() throws Exception {
- final QueryMetadataInterface metadata = FakeMetadataFactory.exampleMultiBinding();
+ final QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
final String userSql = "exec Virt.sq1('a')"; //$NON-NLS-1$
final String multiModel = "MultiModel"; //$NON-NLS-1$
final int sources = 3;
final List[] expected = new List[] { Arrays.asList(new Object[] { null, null}), };
final ProcessorDataManager dataMgr = new MultiSourceDataManager();
- helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, FakeMetadataFactory.exampleMultiBindingVDB());
+ helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
}
@Test public void testSingleReplacementInDynamicCommandNullValue() throws Exception {
- final QueryMetadataInterface metadata = FakeMetadataFactory.exampleMultiBinding();
+ final QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
final String userSql = "exec Virt.sq1(null)"; //$NON-NLS-1$
final String multiModel = "MultiModel"; //$NON-NLS-1$
final int sources = 3;
final List[] expected = new List[0];
final ProcessorDataManager dataMgr = new MultiSourceDataManager();
- helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, FakeMetadataFactory.exampleMultiBindingVDB());
+ helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
}
@Test public void testMultiUpdateAll() throws Exception {
- final QueryMetadataInterface metadata = FakeMetadataFactory.exampleMultiBinding();
+ final QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
final String userSql = "update MultiModel.Phys set a = '1' where b = 'z'"; //$NON-NLS-1$
final String multiModel = "MultiModel"; //$NON-NLS-1$
final int sources = 3;
@@ -265,11 +264,11 @@
final MultiSourceDataManager dataMgr = new MultiSourceDataManager();
dataMgr.setMustRegisterCommands(true);
dataMgr.addData("UPDATE MultiModel.Phys SET a = '1' WHERE b = 'z'", new List[] {Arrays.asList(1)}); //$NON-NLS-1$
- helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, FakeMetadataFactory.exampleMultiBindingVDB());
+ helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
}
@Test public void testInsertMatching() throws Exception {
- final QueryMetadataInterface metadata = FakeMetadataFactory.exampleMultiBinding();
+ final QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
final String userSql = "INSERT INTO MultiModel.Phys(a, SOURCE_NAME) VALUES ('a', 'a')"; //$NON-NLS-1$
final String multiModel = "MultiModel"; //$NON-NLS-1$
final int sources = 3;
@@ -277,22 +276,22 @@
final MultiSourceDataManager dataMgr = new MultiSourceDataManager();
dataMgr.setMustRegisterCommands(true);
dataMgr.addData("INSERT INTO MultiModel.Phys (a) VALUES ('a')", new List[] {Arrays.asList(1)}); //$NON-NLS-1$
- helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, FakeMetadataFactory.exampleMultiBindingVDB());
+ helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
}
@Test public void testInsertNotMatching() throws Exception {
- final QueryMetadataInterface metadata = FakeMetadataFactory.exampleMultiBinding();
+ final QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
final String userSql = "INSERT INTO MultiModel.Phys(a, SOURCE_NAME) VALUES ('a', 'x')"; //$NON-NLS-1$
final String multiModel = "MultiModel"; //$NON-NLS-1$
final int sources = 3;
final List[] expected = new List[] { Arrays.asList(0)};
final MultiSourceDataManager dataMgr = new MultiSourceDataManager();
dataMgr.setMustRegisterCommands(true);
- helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, FakeMetadataFactory.exampleMultiBindingVDB());
+ helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
}
@Test public void testInsertAll() throws Exception {
- final QueryMetadataInterface metadata = FakeMetadataFactory.exampleMultiBinding();
+ final QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
final String userSql = "INSERT INTO MultiModel.Phys(a) VALUES ('a')"; //$NON-NLS-1$
final String multiModel = "MultiModel"; //$NON-NLS-1$
final int sources = 3;
@@ -300,11 +299,11 @@
final MultiSourceDataManager dataMgr = new MultiSourceDataManager();
dataMgr.setMustRegisterCommands(true);
dataMgr.addData("INSERT INTO MultiModel.Phys (a) VALUES ('a')", new List[] {Arrays.asList(1)}); //$NON-NLS-1$
- helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, FakeMetadataFactory.exampleMultiBindingVDB());
+ helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
}
@Test public void testProcedure() throws Exception {
- final QueryMetadataInterface metadata = FakeMetadataFactory.exampleMultiBinding();
+ final QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
final String userSql = "exec MultiModel.proc('b', 'a')"; //$NON-NLS-1$
final String multiModel = "MultiModel"; //$NON-NLS-1$
final int sources = 3;
@@ -312,11 +311,11 @@
final MultiSourceDataManager dataMgr = new MultiSourceDataManager();
dataMgr.setMustRegisterCommands(true);
dataMgr.addData("EXEC MultiModel.proc('b')", new List[] {Arrays.asList(1)}); //$NON-NLS-1$
- helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, FakeMetadataFactory.exampleMultiBindingVDB());
+ helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
}
@Test public void testProcedureAll() throws Exception {
- final QueryMetadataInterface metadata = FakeMetadataFactory.exampleMultiBinding();
+ final QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
final String userSql = "exec MultiModel.proc(\"in\"=>'b')"; //$NON-NLS-1$
final String multiModel = "MultiModel"; //$NON-NLS-1$
final int sources = 3;
@@ -324,7 +323,7 @@
final MultiSourceDataManager dataMgr = new MultiSourceDataManager();
dataMgr.setMustRegisterCommands(true);
dataMgr.addData("EXEC MultiModel.proc('b')", new List[] {Arrays.asList(1)}); //$NON-NLS-1$
- helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, FakeMetadataFactory.exampleMultiBindingVDB());
+ helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
}
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/function/TestFunctionLibrary.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/function/TestFunctionLibrary.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/function/TestFunctionLibrary.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -55,7 +55,7 @@
import org.teiid.core.util.TimestampWithTimezone;
import org.teiid.language.SQLConstants.NonReserved;
import org.teiid.metadata.FunctionMethod.PushDown;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.unittest.TimestampUtil;
import org.teiid.query.util.CommandContext;
import org.teiid.translator.SourceSystemFunctions;
@@ -77,7 +77,7 @@
private static final Class<Date> T_DATE = DataTypeManager.DefaultDataClasses.DATE;
private static final Class<Timestamp> T_TIMESTAMP = DataTypeManager.DefaultDataClasses.TIMESTAMP;
- private FunctionLibrary library = new FunctionLibrary(FakeMetadataFactory.SFM.getSystemFunctions());
+ private FunctionLibrary library = new FunctionLibrary(RealMetadataFactory.SFM.getSystemFunctions());
@Before public void setUp() {
TimestampWithTimezone.resetCalendar(TimeZone.getTimeZone("GMT-06:00")); //$NON-NLS-1$
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/function/TestFunctionTree.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/function/TestFunctionTree.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/function/TestFunctionTree.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -39,7 +39,7 @@
import org.teiid.metadata.FunctionMethod.Determinism;
import org.teiid.query.function.metadata.FunctionCategoryConstants;
import org.teiid.query.function.source.SystemSource;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
@SuppressWarnings("nls")
public class TestFunctionTree {
@@ -78,11 +78,11 @@
new FunctionParameter("output", DataTypeManager.DefaultDataTypes.STRING), false, Determinism.DETERMINISTIC); //$NON-NLS-1$
//allowed, since we're not validating the class
- new FunctionLibrary(FakeMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new UDFSource(Arrays.asList(method))));
+ new FunctionLibrary(RealMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new UDFSource(Arrays.asList(method))));
//should fail, no class
try {
- new FunctionLibrary(FakeMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new UDFSource(Arrays.asList(method)), true));
+ new FunctionLibrary(RealMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new UDFSource(Arrays.asList(method)), true));
fail();
} catch (TeiidRuntimeException e) {
@@ -92,7 +92,7 @@
//should fail, no method
try {
- new FunctionLibrary(FakeMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new UDFSource(Arrays.asList(method)), true));
+ new FunctionLibrary(RealMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new UDFSource(Arrays.asList(method)), true));
fail();
} catch (TeiidRuntimeException e) {
@@ -102,7 +102,7 @@
//should fail, not void
try {
- new FunctionLibrary(FakeMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new UDFSource(Arrays.asList(method)), true));
+ new FunctionLibrary(RealMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new UDFSource(Arrays.asList(method)), true));
fail();
} catch (TeiidRuntimeException e) {
@@ -112,7 +112,7 @@
//should fail, not public
try {
- new FunctionLibrary(FakeMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new UDFSource(Arrays.asList(method)), true));
+ new FunctionLibrary(RealMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new UDFSource(Arrays.asList(method)), true));
fail();
} catch (TeiidRuntimeException e) {
@@ -122,7 +122,7 @@
//should fail, not static
try {
- new FunctionLibrary(FakeMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new UDFSource(Arrays.asList(method)), true));
+ new FunctionLibrary(RealMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new UDFSource(Arrays.asList(method)), true));
fail();
} catch (TeiidRuntimeException e) {
@@ -131,7 +131,7 @@
method.setInvocationMethod("y");
//valid!
- new FunctionLibrary(FakeMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new UDFSource(Arrays.asList(method)), true));
+ new FunctionLibrary(RealMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new UDFSource(Arrays.asList(method)), true));
}
@Test public void testNullCategory() {
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/function/TestResolvedFunctions.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/function/TestResolvedFunctions.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/function/TestResolvedFunctions.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -32,7 +32,7 @@
import org.teiid.query.parser.QueryParser;
import org.teiid.query.resolver.util.ResolverVisitor;
import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import junit.framework.TestCase;
@@ -90,7 +90,7 @@
BlockedException,
TeiidComponentException, QueryResolverException {
Expression expr = QueryParser.getQueryParser().parseExpression(sql);
- ResolverVisitor.resolveLanguageObject(expr, FakeMetadataFactory.example1Cached());
+ ResolverVisitor.resolveLanguageObject(expr, RealMetadataFactory.example1Cached());
return Evaluator.evaluate(expr);
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -45,7 +45,7 @@
import org.teiid.query.metadata.CompositeMetadataStore;
import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.metadata.TransformationMetadata.Resource;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.translator.TranslatorException;
@SuppressWarnings("nls")
@@ -102,7 +102,7 @@
vdb.addModel(buildModel("x1"));
vdb.addModel(buildModel("y"));
- return new TransformationMetadata(vdb, cms, resources, FakeMetadataFactory.SFM.getSystemFunctions(), null);
+ return new TransformationMetadata(vdb, cms, resources, RealMetadataFactory.SFM.getSystemFunctions(), null);
}
ModelMetaData buildModel(String name) {
@@ -135,15 +135,15 @@
model2.setVisible(true);
vdb.addModel(model2);
- TransformationMetadata tm = new TransformationMetadata(vdb, cms, null, FakeMetadataFactory.SFM.getSystemFunctions(), null);
+ TransformationMetadata tm = new TransformationMetadata(vdb, cms, null, RealMetadataFactory.SFM.getSystemFunctions(), null);
Collection result = tm.getGroupsForPartialName("y"); //$NON-NLS-1$
assertEquals(2, result.size());
- FakeMetadataFactory.buildWorkContext(tm, vdb);
+ RealMetadataFactory.buildWorkContext(tm, vdb);
model.setVisible(false);
- tm = new TransformationMetadata(vdb, cms, null, FakeMetadataFactory.SFM.getSystemFunctions(), null);
+ tm = new TransformationMetadata(vdb, cms, null, RealMetadataFactory.SFM.getSystemFunctions(), null);
result = tm.getGroupsForPartialName("y"); //$NON-NLS-1$
assertEquals(1, result.size());
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestAccessPatterns.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestAccessPatterns.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestAccessPatterns.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -23,10 +23,10 @@
package org.teiid.query.optimizer;
import org.junit.Test;
+import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.optimizer.TestOptimizer.ComparisonMode;
import org.teiid.query.processor.ProcessorPlan;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.validator.TestValidator;
@@ -43,7 +43,7 @@
@Test public void testVirtualAccessPatternPassing1() {
String sql = "delete from vm1.g37 where e1 = 1"; //$NON-NLS-1$
- TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), new String[] {});
+ TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), new String[] {});
}
@Test public void testVirtualAccessPatternFailing() {
@@ -53,7 +53,7 @@
@Test public void testVirtualAccessPatternFailing1() {
String sql = "delete from vm1.g37"; //$NON-NLS-1$
- TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null, null, null, TestOptimizer.SHOULD_FAIL);
+ TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), null, null, null, TestOptimizer.SHOULD_FAIL);
}
@Test public void testAccessPattern1() throws Exception {
@@ -103,7 +103,7 @@
* satisfied by user criteria - the other should be made dependent
*/
@Test public void testNodesBothHaveAccessPatterns1() throws Exception {
- ProcessorPlan plan = TestOptimizer.helpPlan("select pm4.g1.e1 from pm4.g1, pm4.g2 where pm4.g2.e5 = 'abc' and pm4.g1.e1 = pm4.g2.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select pm4.g1.e1 from pm4.g1, pm4.g2 where pm4.g2.e5 = 'abc' and pm4.g1.e1 = pm4.g2.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT g_0.e1 FROM pm4.g1 AS g_0 WHERE g_0.e1 IN (<dependent values>)", "SELECT g_0.e1 FROM pm4.g2 AS g_0 WHERE g_0.e5 = 'abc'"}, TestOptimizer.getGenericFinder(false), TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
TestDependentJoins.checkDependentGroups(plan, new String[] {"pm4.g1"}); //$NON-NLS-1$
}
@@ -114,7 +114,7 @@
* (same query written slightly different).
*/
@Test public void testNodesBothHaveAccessPatterns1a() throws Exception {
- ProcessorPlan plan = TestOptimizer.helpPlan("select pm4.g1.e1 from pm4.g2, pm4.g1 where pm4.g2.e1 = pm4.g1.e1 and pm4.g2.e5 = 'abc'", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select pm4.g1.e1 from pm4.g2, pm4.g1 where pm4.g2.e1 = pm4.g1.e1 and pm4.g2.e5 = 'abc'", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT g_0.e1 FROM pm4.g1 AS g_0 WHERE g_0.e1 IN (<dependent values>)", "SELECT g_0.e1 FROM pm4.g2 AS g_0 WHERE g_0.e5 = 'abc'"}, TestOptimizer.getGenericFinder(false), TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
TestDependentJoins.checkDependentGroups(plan, new String[] {"pm4.g1"}); //$NON-NLS-1$
}
@@ -124,7 +124,7 @@
* criteria (therefore merge join should be used)
*/
@Test public void testSelfJoinAccessPatterns() throws Exception {
- ProcessorPlan plan = TestOptimizer.helpPlan("select pm4.g1.e1 from pm4.g1, pm4.g1 as g1A where pm4.g1.e1 = 'abc' and g1A.e1 = 'abc' and pm4.g1.e2 = g1A.e2", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select pm4.g1.e1 from pm4.g1, pm4.g1 as g1A where pm4.g1.e1 = 'abc' and g1A.e1 = 'abc' and pm4.g1.e2 = g1A.e2", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT g1A.e2 FROM pm4.g1 AS g1A WHERE g1A.e1 = 'abc'", "SELECT pm4.g1.e2, pm4.g1.e1 FROM pm4.g1 WHERE pm4.g1.e1 = 'abc'" }, TestOptimizer.getGenericFinder(false), ComparisonMode.CORRECTED_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -146,42 +146,42 @@
}
@Test public void testAccessPatternsFails() {
- TestOptimizer.helpPlan("select pm4.g2.e1 from pm4.g2, pm4.g2 as g2A where pm4.g2.e2 = 123 and pm4.g2.e1 = g2A.e5", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ TestOptimizer.helpPlan("select pm4.g2.e1 from pm4.g2, pm4.g2 as g2A where pm4.g2.e2 = 123 and pm4.g2.e1 = g2A.e5", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
null, null, null,
TestOptimizer.SHOULD_FAIL);
}
@Test public void testAccessPatternsFails2() {
- TestOptimizer.helpPlan("select pm4.g2.e1 from pm4.g2", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ TestOptimizer.helpPlan("select pm4.g2.e1 from pm4.g2", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
null, null, null,
TestOptimizer.SHOULD_FAIL);
}
@Test public void testUnionWithAccessPatternFails() {
TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1 UNION select pm4.g1.e1 from pm4.g1 where pm4.g1.e2 = 1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, null, null, TestOptimizer.SHOULD_FAIL);
}
@Test public void testUnionWithAccessPatternFails2() {
TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1 UNION select pm4.g1.e1 from pm4.g1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, null, null, TestOptimizer.SHOULD_FAIL);
}
@Test public void testUnionWithAccessPattern() {
- TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1 UNION ALL select pm4.g1.e1 from pm4.g1 where pm4.g1.e1 = 'abc'", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1 UNION ALL select pm4.g1.e1 from pm4.g1 where pm4.g1.e1 = 'abc'", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT pm1.g1.e1 FROM pm1.g1", "SELECT pm4.g1.e1 FROM pm4.g1 WHERE pm4.g1.e1 = 'abc'" }); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testUnionWithAccessPattern2() {
- TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1 UNION ALL select pm4.g1.e1 from pm4.g1 where pm4.g1.e1 = 'abc' and pm4.g1.e2 = 1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1 UNION ALL select pm4.g1.e1 from pm4.g1 where pm4.g1.e1 = 'abc' and pm4.g1.e2 = 1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT pm1.g1.e1 FROM pm1.g1", "SELECT pm4.g1.e1 FROM pm4.g1 WHERE (pm4.g1.e1 = 'abc') AND (pm4.g1.e2 = 1)" }); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testAccessPatternPartialMatch() throws Exception {
TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1, pm4.g2 where pm1.g1.e1 = pm4.g2.e1 and pm4.g2.e2 = 123", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
new String[] { "SELECT g_0.e1 FROM pm4.g2 AS g_0 WHERE (g_0.e2 = 123) AND (g_0.e1 IN (<dependent values>))", "SELECT g_0.e1 FROM pm1.g1 AS g_0" }, TestOptimizer.getGenericFinder(false), TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -192,7 +192,7 @@
*/
@Test public void testAccessPatternFails3() {
TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1, pm4.g2 where pm1.g1.e1 = pm4.g2.e1 or pm4.g2.e2 = 123", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, null, null,
TestOptimizer.SHOULD_FAIL);
}
@@ -203,7 +203,7 @@
*/
@Test public void testAccessPatternsGroupsInSameModelFails() {
TestOptimizer.helpPlan("select pm5.g1.e1 from pm5.g1, pm5.g2 where pm5.g1.e1 = pm5.g2.e1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, null, null, TestOptimizer.SHOULD_FAIL);
}
@@ -212,7 +212,7 @@
// ==================================================================================
@Test public void testPushingCriteriaThroughFrameAccessPattern0() {
- TestOptimizer.helpPlan("select * from vm1.g9 where vm1.g9.e1='abc'", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ TestOptimizer.helpPlan("select * from vm1.g9 where vm1.g9.e1='abc'", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT 1 FROM pm4.g1 WHERE pm4.g1.e1 = 'abc'", //$NON-NLS-1$
"SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1 WHERE pm1.g1.e1 = 'abc'" } ); //$NON-NLS-1$
}
@@ -221,17 +221,17 @@
* pm4.g2.e5 or pm4.g2.e2 also need to be in criteria
*/
@Test public void testPushingCriteriaThroughFrameAccessPattern1() {
- TestOptimizer.helpPlan("select * from vm1.g1, vm1.g10 where vm1.g1.e1='abc' and vm1.g1.e1=vm1.g10.e1", FakeMetadataFactory.example1Cached(), null, TestOptimizer.getGenericFinder(), //$NON-NLS-1$
+ TestOptimizer.helpPlan("select * from vm1.g1, vm1.g10 where vm1.g1.e1='abc' and vm1.g1.e1=vm1.g10.e1", RealMetadataFactory.example1Cached(), null, TestOptimizer.getGenericFinder(), //$NON-NLS-1$
null, TestOptimizer.SHOULD_FAIL );
}
@Test public void testPushingCriteriaThroughFrameAccessPattern2() {
- TestOptimizer.helpPlan("select e1 from vm1.g11 where vm1.g11.e1='abc' and vm1.g11.e2=123", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ TestOptimizer.helpPlan("select e1 from vm1.g11 where vm1.g11.e1='abc' and vm1.g11.e2=123", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT pm4.g2.e1 FROM pm4.g2 WHERE (pm4.g2.e1 = 'abc') AND (pm4.g2.e2 = 123)" }); //$NON-NLS-1$
}
@Test public void testPushingCriteriaThroughFrameAccessPattern3() {
- TestOptimizer.helpPlan("select * from vm1.g1, vm1.g9 where vm1.g1.e1='abc' and vm1.g1.e1=vm1.g9.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ TestOptimizer.helpPlan("select * from vm1.g1, vm1.g9 where vm1.g1.e1='abc' and vm1.g1.e1=vm1.g9.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT 1 FROM pm4.g1 WHERE pm4.g1.e1 = 'abc'", //$NON-NLS-1$
"SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1 WHERE pm1.g1.e1 = 'abc'", //$NON-NLS-1$
"SELECT g1__1.e1, g1__1.e2, g1__1.e3, g1__1.e4 FROM pm1.g1 AS g1__1 WHERE g1__1.e1 = 'abc'"} ); //$NON-NLS-1$
@@ -241,7 +241,7 @@
* pm4.g2.e5 or pm4.g2.e2 also need to be in criteria
*/
@Test public void testPushingCriteriaThroughFrameAccessPattern4() {
- TestOptimizer.helpPlan("select * from vm1.g10 where vm1.g10.e1='abc'", FakeMetadataFactory.example1Cached(), null, TestOptimizer.getGenericFinder(), //$NON-NLS-1$
+ TestOptimizer.helpPlan("select * from vm1.g10 where vm1.g10.e1='abc'", RealMetadataFactory.example1Cached(), null, TestOptimizer.getGenericFinder(), //$NON-NLS-1$
null, TestOptimizer.SHOULD_FAIL );
}
@@ -251,7 +251,7 @@
@Test public void testCase6425() {
String sql = "SELECT e1 FROM pm4.g1 WHERE e1 = '1' OR e1 = '2'"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = TestOptimizer.helpPlan(sql, metadata, new String[] {"SELECT e1 FROM pm4.g1 WHERE (e1 = '1') OR (e1 = '2')"}); //$NON-NLS-1$
@@ -261,7 +261,7 @@
@Test public void testCase6425_2() {
String sql = "SELECT e1 FROM pm4.g1 WHERE e1 = '1' OR (e1 = '2' AND e2 = 3)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = TestOptimizer.helpPlan(sql, metadata, new String[] {"SELECT e1 FROM pm4.g1 WHERE (e1 = '1') OR ((e1 = '2') AND (e2 = 3))"}); //$NON-NLS-1$
@@ -271,7 +271,7 @@
@Test public void testCase6425_4() throws Exception {
String sql = "SELECT e1 FROM pm4.g1 WHERE e1 = '1' OR e2 = '2'"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
TestOptimizer.helpPlan(sql, metadata, null, TestOptimizer.ComparisonMode.FAILED_PLANNING);
}
@@ -282,7 +282,7 @@
@Test public void testMultiAccessPatternWithCriteria() throws Exception {
String sql = "SELECT pm1.g1.* FROM pm4.g1, pm5.g1, pm1.g1 where pm4.g1.e1 = pm1.g1.e1 and pm5.g1.e1 = pm1.g1.e1 and pm5.g1.e2 like '%x' "; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
TestOptimizer.helpPlan(sql, metadata,
new String[] {
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -33,8 +33,7 @@
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
import org.teiid.query.processor.ProcessorPlan;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.translator.SourceSystemFunctions;
@SuppressWarnings("nls")
@@ -69,7 +68,7 @@
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
String sql = "SELECT a12.intkey AS REGION_NBR, SUM(a11.intnum) AS WJXBFS1 FROM bqt1.smalla AS a11 INNER JOIN bqt2.smalla AS a12 ON a11.stringkey = a12.stringkey WHERE a11.stringkey = 0 GROUP BY a12.intkey"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), null, capFinder,
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder,
new String[] {"SELECT SUM(a11.intnum) FROM bqt1.smalla AS a11 WHERE a11.stringkey = '0' HAVING COUNT(*) > 0", "SELECT a12.intkey FROM bqt2.smalla AS a12 WHERE a12.stringkey = '0' group by a12.intkey"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -105,7 +104,7 @@
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
String sql = "SELECT a12.intkey, MAX(a12.stringkey), MIN(a11.intnum+a12.intnum) FROM bqt1.smalla AS a11 INNER JOIN bqt2.smalla AS a12 ON a11.stringkey = a12.stringkey GROUP BY a12.intkey"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), null, capFinder,
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder,
new String[] {"SELECT g_0.stringkey, g_0.intkey, g_0.intnum FROM bqt2.smalla AS g_0 GROUP BY g_0.stringkey, g_0.intkey, g_0.intnum", "SELECT g_0.stringkey, g_0.intnum FROM bqt1.smalla AS g_0"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -136,7 +135,7 @@
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
String sql = "SELECT a12.intkey, MAX(a12.stringkey), SUM(a11.intnum+a12.intnum) FROM bqt1.smalla AS a11 INNER JOIN bqt2.smalla AS a12 ON a11.stringkey = a12.stringkey GROUP BY a12.intkey"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), null, capFinder,
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder,
new String[] {"SELECT g_0.stringkey, g_0.intkey, g_0.intnum FROM bqt2.smalla AS g_0", "SELECT g_0.stringkey, g_0.intnum FROM bqt1.smalla AS g_0"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -169,7 +168,7 @@
capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
String sql = "SELECT max(y.e2) from pm1.g1 x, pm2.g1 y where x.e3 = y.e3 group by y.e3"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null, capFinder,
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), null, capFinder,
new String[] {"SELECT g_0.e3 FROM pm1.g1 AS g_0", "SELECT g_0.e3, MAX(g_0.e2) FROM pm2.g1 AS g_0 GROUP BY g_0.e3"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -203,7 +202,7 @@
String sql = "select sum(a11.intnum) Profit, (sum(a11.intnum) / sum(a11.floatnum)) WJXBFS2 from bqt1.smalla a11 join bqt2.smallb a12 on a11.intkey=a12.intkey group by a12.intkey"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), null, capFinder,
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder,
new String[] {"SELECT g_0.intkey, SUM(g_0.intnum), SUM(g_0.floatnum) FROM bqt1.smalla AS g_0 GROUP BY g_0.intkey", "SELECT g_0.intkey FROM bqt2.smallb AS g_0 GROUP BY g_0.intkey"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -228,7 +227,7 @@
* Note that until we can test the other side cardinality, we cannot fully push the group node
*/
@Test public void testAggregatePushdown1() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleAggregatesCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleAggregatesCached();
String sql = "SELECT o_dealerid, o_productid, sum(o_amount) FROM m1.order, m1.dealer, m2.product " + //$NON-NLS-1$
"WHERE o_dealerid=d_dealerid AND o_productid=p_productid AND d_state = 'CA' AND p_divid = 100 " + //$NON-NLS-1$
"GROUP BY o_dealerid, o_productid"; //$NON-NLS-1$
@@ -258,7 +257,7 @@
}
@Test public void testAggregatePushdown2() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleAggregatesCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleAggregatesCached();
String sql = "SELECT o_dealerid, o_productid, sum(o_amount) FROM m1.order, m1.dealer, m2.product " + //$NON-NLS-1$
"WHERE o_dealerid=d_dealerid AND o_productid=p_productid AND d_state = 'CA' AND p_divid = 100 " + //$NON-NLS-1$
"GROUP BY o_dealerid, o_productid having max(o_amount) < 100"; //$NON-NLS-1$
@@ -298,7 +297,7 @@
capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
String sql = "SELECT avg(y.e2) from pm1.g1 x, pm2.g1 y where x.e3 = y.e3 group by x.e2, y.e1"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null, capFinder,
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), null, capFinder,
new String[] {"SELECT g_0.e3, g_0.e2 FROM pm1.g1 AS g_0 GROUP BY g_0.e3, g_0.e2", "SELECT g_0.e3, g_0.e1, SUM(g_0.e2), COUNT(g_0.e2) FROM pm2.g1 AS g_0 GROUP BY g_0.e3, g_0.e1"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -328,7 +327,7 @@
capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
String sql = "SELECT stddev_pop(y.e2) from pm1.g1 x, pm2.g1 y where x.e3 = y.e3 group by x.e2, y.e1"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null, capFinder,
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), null, capFinder,
new String[] {"SELECT g_0.e3 AS c_0, g_0.e1 AS c_1, COUNT(g_0.e2) AS c_2, SUM(power(g_0.e2, 2)) AS c_3, SUM(g_0.e2) AS c_4 FROM pm2.g1 AS g_0 GROUP BY g_0.e3, g_0.e1 ORDER BY c_0", "SELECT g_0.e3 AS c_0, g_0.e2 AS c_1 FROM pm1.g1 AS g_0 GROUP BY g_0.e3, g_0.e2 ORDER BY c_0"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -357,7 +356,7 @@
capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
String sql = "SELECT count(y.e2) from pm1.g1 x, pm2.g1 y where x.e3 = y.e3 group by x.e2, y.e1"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null, capFinder,
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), null, capFinder,
new String[] {"SELECT g_0.e3, g_0.e2 FROM pm1.g1 AS g_0 GROUP BY g_0.e3, g_0.e2", "SELECT g_0.e3, g_0.e1, COUNT(g_0.e2) FROM pm2.g1 AS g_0 GROUP BY g_0.e3, g_0.e1"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -386,7 +385,7 @@
capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
String sql = "SELECT count(y.e2) from pm1.g1 x left outer join pm2.g1 y on x.e3 = y.e3 group by x.e2, y.e1"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null, capFinder,
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), null, capFinder,
new String[] {"SELECT g_0.e3, g_0.e2 FROM pm1.g1 AS g_0", "SELECT g_0.e3, g_0.e1, g_0.e2 FROM pm2.g1 AS g_0"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -416,7 +415,7 @@
caps.setCapabilitySupport(Capability.QUERY_ORDERBY, false);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = TestOptimizer.helpPlan(
"select count(*), a.intnum from bqt1.smalla as a, bqt2.smallb as b where a.intkey = b.intkey group by a.intnum", //$NON-NLS-1$
@@ -456,7 +455,7 @@
String sql = "select a11.intkey ITEM_ID, sum(a11.intnum) WJXBFS1 from bqt1.smalla a11 join bqt2.smalla a12 on (a11.stringkey = a12.stringkey) join bqt2.smallb a13 on (a11.intkey = a13.intkey) where a13.intnum in (10) group by a11.intkey"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), null, capFinder,
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder,
new String[] {"SELECT g_0.stringkey FROM bqt2.smalla AS g_0", "SELECT g_0.stringkey, g_0.intkey, SUM(g_0.intnum) FROM bqt1.smalla AS g_0 GROUP BY g_0.stringkey, g_0.intkey", "SELECT g_0.intkey FROM bqt2.smallb AS g_0 WHERE g_0.intnum = 10"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -485,7 +484,7 @@
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_COUNT, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_COUNT_STAR, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = TestOptimizer.helpPlan(
"select count(*) from bqt1.smalla", //$NON-NLS-1$
@@ -504,7 +503,7 @@
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_COUNT, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = TestOptimizer.helpPlan(
"select stringkey, max(intkey) from bqt1.smalla group by stringkey having count(intkey) = 1", //$NON-NLS-1$
@@ -537,7 +536,7 @@
caps.setCapabilitySupport(Capability.QUERY_GROUP_BY, false);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan("select X.e1 FROM vm1.g1 X group by X.e1 having X.e1 = 1 and sum(X.e2) = 2", FakeMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select X.e1 FROM vm1.g1 X group by X.e1 having X.e1 = 1 and sum(X.e2) = 2", RealMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
new String[]{"SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1 WHERE pm1.g1.e1 = '1'"}, true); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
1, // Access
@@ -571,7 +570,7 @@
capFinder.addCapabilities("oraclemodel", caps); //$NON-NLS-1$
capFinder.addCapabilities("msmodel", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleBusObj();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBusObj();
String sql = "SELECT Q1.S, Q2.C, Q1.PRODUCT, Q1.REGION AS Q1R, Q2.REGION AS Q2R FROM " + //$NON-NLS-1$
"(SELECT SUM(SALES) AS S, REGION, PRODUCT FROM DB2_TABLE WHERE PRODUCT IN ('GUNS', 'TOYS', 'VIDEOTAPES') GROUP BY REGION, PRODUCT) Q1 " + //$NON-NLS-1$
@@ -618,7 +617,7 @@
capFinder.addCapabilities("oraclemodel", caps); //$NON-NLS-1$
capFinder.addCapabilities("msmodel", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleBusObj();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBusObj();
String sql = "SELECT SUM(F.SALES), G.REGION, T.YEAR " + //$NON-NLS-1$
"FROM SALES F, GEOGRAPHY G, msModel.TIME T " + //$NON-NLS-1$
@@ -666,7 +665,7 @@
capFinder.addCapabilities("oraclemodel", caps); //$NON-NLS-1$
capFinder.addCapabilities("msmodel", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleBusObj();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBusObj();
String sql = "SELECT SUM(F.SALES), G.REGION, T.YEAR " + //$NON-NLS-1$
"FROM SALES F MAKEDEP, GEOGRAPHY G, msModel.TIME T " + //$NON-NLS-1$
@@ -714,7 +713,7 @@
capFinder.addCapabilities("oraclemodel", caps); //$NON-NLS-1$
capFinder.addCapabilities("msmodel", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleBusObj();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBusObj();
String sql = "SELECT SUM(F.SALES), G.REGION, T.YEAR " + //$NON-NLS-1$
"FROM SALES F MAKEDEP, GEOGRAPHY2 G, msModel.TIME T " + //$NON-NLS-1$
@@ -761,7 +760,7 @@
capFinder.addCapabilities("oraclemodel", caps); //$NON-NLS-1$
capFinder.addCapabilities("msmodel", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleBusObj();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBusObj();
String sql = "select sum(c0), sum(b0), c1, b2 FROM db2Table, OraTable where c2=b2 group by c1, b2"; //$NON-NLS-1$
@@ -795,7 +794,7 @@
BasicSourceCapabilities caps = getAggregateCapabilities();
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan("select e1, max(e2) from (select e1, e2 from pm1.g1 union all select e1, e2 from pm1.g2) y group by e1", FakeMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select e1, max(e2) from (select e1, e2 from pm1.g1 union all select e1, e2 from pm1.g2) y group by e1", RealMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
new String[]{"SELECT v_0.c_0, MAX(v_0.c_1) FROM (SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM pm1.g1 AS g_0) AS v_0 GROUP BY v_0.c_0", //$NON-NLS-1$
"SELECT v_0.c_0, MAX(v_0.c_1) FROM (SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM pm1.g2 AS g_0) AS v_0 GROUP BY v_0.c_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -821,7 +820,7 @@
BasicSourceCapabilities caps = getAggregateCapabilities();
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan("select max(e2) from (select e1, e2 from pm1.g1 union all select e1, e2 from pm1.g2) z", FakeMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select max(e2) from (select e1, e2 from pm1.g1 union all select e1, e2 from pm1.g2) z", RealMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
new String[]{"SELECT MAX(v_0.c_0) FROM (SELECT g_0.e2 AS c_0 FROM pm1.g2 AS g_0) AS v_0 HAVING COUNT(*) > 0", //$NON-NLS-1$
"SELECT MAX(v_0.c_0) FROM (SELECT g_0.e2 AS c_0 FROM pm1.g1 AS g_0) AS v_0 HAVING COUNT(*) > 0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -850,7 +849,7 @@
BasicSourceCapabilities caps = getAggregateCapabilities();
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan("select count(e2) from (select e1, e2 from pm1.g1 union select e1, e2 from pm1.g2) z", FakeMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select count(e2) from (select e1, e2 from pm1.g1 union select e1, e2 from pm1.g2) z", RealMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
new String[]{"SELECT g_0.e1, g_0.e2 FROM pm1.g2 AS g_0", //$NON-NLS-1$
"SELECT g_0.e1, g_0.e2 FROM pm1.g1 AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -877,7 +876,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
capFinder.addCapabilities("pm2", TestOptimizer.getTypicalCapabilities()); //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan("select max(e2), count(*) from (select e1, e2 from pm1.g1 union all select e1, e2 from pm2.g2) z", FakeMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select max(e2), count(*) from (select e1, e2 from pm1.g1 union all select e1, e2 from pm2.g2) z", RealMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
new String[]{"SELECT MAX(v_0.c_0), COUNT(*) FROM (SELECT g_0.e2 AS c_0 FROM pm1.g1 AS g_0) AS v_0 HAVING COUNT(*) > 0", //$NON-NLS-1$
"SELECT g_0.e2 FROM pm2.g2 AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -907,7 +906,7 @@
// Plan query
ProcessorPlan plan = TestOptimizer.helpPlan(sql,
- FakeMetadataFactory.exampleBQTCached(),
+ RealMetadataFactory.exampleBQTCached(),
null, getAggregatesFinder(),
new String[] {"SELECT g_0.DateValue FROM bqt1.smallb AS g_0"},
TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING );
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestAnsiJoinPushdown.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestAnsiJoinPushdown.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestAnsiJoinPushdown.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -28,7 +28,7 @@
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
import org.teiid.query.processor.ProcessorPlan;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
public class TestAnsiJoinPushdown {
@@ -46,7 +46,7 @@
ProcessorPlan plan = TestOptimizer.helpPlan(
"select pm2.g1.e1 from pm2.g1, pm2.g2 where pm2.g1.e1 = pm2.g2.e1 and (pm2.g1.e2 = 1 OR pm2.g2.e2 = 2) and pm2.g2.e3 = 1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null,
capFinder,
new String[] { "SELECT g_0.e1 FROM pm2.g1 AS g_0 INNER JOIN pm2.g2 AS g_1 ON g_0.e1 = g_1.e1 AND ((g_0.e2 = 1) OR (g_1.e2 = 2)) WHERE g_1.e3 = TRUE" }, //$NON-NLS-1$
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestBatchedUpdatePlanner.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestBatchedUpdatePlanner.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestBatchedUpdatePlanner.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -49,7 +49,7 @@
import org.teiid.query.rewriter.QueryRewriter;
import org.teiid.query.sql.lang.BatchedUpdateCommand;
import org.teiid.query.sql.lang.Command;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.validator.Validator;
import org.teiid.query.validator.ValidatorReport;
@@ -156,7 +156,7 @@
}
private void helpTestPlanner(String[] sql, boolean[] expectedBatching) throws QueryMetadataException, TeiidComponentException, TeiidProcessingException {
- BatchedUpdatePlan plan = helpPlan(sql, FakeMetadataFactory.example1Cached());
+ BatchedUpdatePlan plan = helpPlan(sql, RealMetadataFactory.example1Cached());
List plans = plan.getUpdatePlans();
assertEquals("Number of child plans did not match expected", expectedBatching.length, plans.size()); //$NON-NLS-1$
for (int i = 0; i < expectedBatching.length; i++) {
@@ -165,7 +165,7 @@
}
private void helpTestPlanner(String[] sql, boolean[] expectedBatching, CapabilitiesFinder capFinder) throws QueryMetadataException, TeiidComponentException, TeiidProcessingException {
- BatchedUpdatePlan plan = helpPlan(sql, FakeMetadataFactory.example1Cached(), capFinder, true);
+ BatchedUpdatePlan plan = helpPlan(sql, RealMetadataFactory.example1Cached(), capFinder, true);
List plans = plan.getUpdatePlans();
assertEquals("Number of child plans did not match expected", expectedBatching.length, plans.size()); //$NON-NLS-1$
for (int i = 0; i < expectedBatching.length; i++) {
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -45,9 +45,7 @@
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.symbol.GroupSymbol;
import org.teiid.query.sql.visitor.GroupCollectorVisitor;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
+import org.teiid.query.unittest.RealMetadataFactory;
@SuppressWarnings("nls")
public class TestDependentJoins {
@@ -122,7 +120,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1, pm2.g1 where pm1.g1.e1 = pm2.g1.e1 option makedep pm2.g1", FakeMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1, pm2.g1 where pm1.g1.e1 = pm2.g1.e1 option makedep pm2.g1", RealMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
new String[] { "SELECT g_0.e1 FROM pm2.g1 AS g_0 WHERE g_0.e1 IN (<dependent values>)", "SELECT g_0.e1 FROM pm1.g1 AS g_0" }, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
checkDependentGroups(plan, new String[] {"pm2.g1"}); //$NON-NLS-1$
@@ -152,7 +150,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1, pm2.g1.e1 from pm1.g1 MAKEDEP INNER JOIN pm2.g1 MAKENOTDEP ON pm1.g1.e1 = pm2.g1.e1", FakeMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1, pm2.g1.e1 from pm1.g1 MAKEDEP INNER JOIN pm2.g1 MAKENOTDEP ON pm1.g1.e1 = pm2.g1.e1", RealMetadataFactory.example1Cached(), null, capFinder, //$NON-NLS-1$
new String[] { "SELECT g_0.e1 FROM pm1.g1 AS g_0 WHERE g_0.e1 IN (<dependent values>)", "SELECT g_0.e1 FROM pm2.g1 AS g_0" }, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
checkDependentGroups(plan, new String[] {"pm1.g1"}); //$NON-NLS-1$
@@ -339,7 +337,7 @@
* Test that access node with unsatisfied access pattern is made dependent
*/
@Test public void testMakeDependentAccessPattern1() throws Exception {
- ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1, pm4.g1 where pm1.g1.e1 = pm4.g1.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1, pm4.g1 where pm1.g1.e1 = pm4.g1.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT g_0.e1 FROM pm4.g1 AS g_0 WHERE g_0.e1 IN (<dependent values>)", "SELECT g_0.e1 FROM pm1.g1 AS g_0" }, TestOptimizer.getGenericFinder(false), TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
checkDependentGroups(plan, new String[] {"pm4.g1"}); //$NON-NLS-1$
}
@@ -349,7 +347,7 @@
* (Same query written slightly different way)
*/
@Test public void testMakeDependentAccessPattern1a() throws Exception {
- ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm4.g1, pm1.g1 where pm4.g1.e1 = pm1.g1.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm4.g1, pm1.g1 where pm4.g1.e1 = pm1.g1.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT g_0.e1 FROM pm4.g1 AS g_0 WHERE g_0.e1 IN (<dependent values>)", "SELECT g_0.e1 FROM pm1.g1 AS g_0" }, TestOptimizer.getGenericFinder(false), TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
checkDependentGroups(plan, new String[] {"pm4.g1"}); //$NON-NLS-1$
}
@@ -358,7 +356,7 @@
* Test that access node with unsatisfied access pattern is made dependent
*/
@Test public void testMakeDependentAccessPattern2() throws Exception {
- ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1, pm4.g1 where pm4.g1.e2 = 1 and pm1.g1.e1 = pm4.g1.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1, pm4.g1 where pm4.g1.e2 = 1 and pm1.g1.e1 = pm4.g1.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT g_0.e1 FROM pm4.g1 AS g_0 WHERE (g_0.e2 = 1) AND (g_0.e1 IN (<dependent values>))", "SELECT g_0.e1 FROM pm1.g1 AS g_0" }, TestOptimizer.getGenericFinder(false), TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
checkDependentGroups(plan, new String[] {"pm4.g1"}); //$NON-NLS-1$
}
@@ -368,7 +366,7 @@
* dependent with
*/
@Test public void testMakeDependentAccessPattern3() throws Exception {
- ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1, pm4.g2 where pm1.g1.e1 = pm4.g2.e5", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1, pm4.g2 where pm1.g1.e1 = pm4.g2.e5", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT g_0.e5 FROM pm4.g2 AS g_0 WHERE g_0.e5 IN (<dependent values>)", "SELECT g_0.e1 FROM pm1.g1 AS g_0" }, TestOptimizer.getGenericFinder(false), TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
checkDependentGroups(plan, new String[] {"pm4.g2"}); //$NON-NLS-1$
}
@@ -379,7 +377,7 @@
* needs to be fulfilled and there is no cost info available for either source
*/
@Test public void testPushSelectAndMakeDependentAccessPattern1() throws Exception {
- ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1, pm4.g1 where pm4.g1.e1 = 'abc' and pm1.g1.e1 = 'abc' and pm1.g1.e2 = pm4.g1.e2", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1, pm4.g1 where pm4.g1.e1 = 'abc' and pm1.g1.e1 = 'abc' and pm1.g1.e2 = pm4.g1.e2", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT pm1.g1.e2, pm1.g1.e1 FROM pm1.g1 WHERE pm1.g1.e1 = 'abc'", "SELECT pm4.g1.e2 FROM pm4.g1 WHERE pm4.g1.e1 = 'abc'" }, TestOptimizer.getGenericFinder(false), ComparisonMode.CORRECTED_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
checkDependentGroups(plan, new String[0]);
@@ -408,7 +406,7 @@
* (Same query written slightly different)
*/
@Test public void testPushSelectAndMakeDependentAccessPattern1a() throws Exception {
- ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm4.g1, pm1.g1 where pm4.g1.e2 = pm1.g1.e2 and pm4.g1.e1 = 'abc' and pm1.g1.e1 = 'abc'", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm4.g1, pm1.g1 where pm4.g1.e2 = pm1.g1.e2 and pm4.g1.e1 = 'abc' and pm1.g1.e1 = 'abc'", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT pm1.g1.e2, pm1.g1.e1 FROM pm1.g1 WHERE pm1.g1.e1 = 'abc'", "SELECT pm4.g1.e2 FROM pm4.g1 WHERE pm4.g1.e1 = 'abc'" }, TestOptimizer.getGenericFinder(false), ComparisonMode.CORRECTED_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
checkDependentGroups(plan, new String[0]);
@@ -435,7 +433,7 @@
* because of it's (already-satisfied) access pattern - merge join is used
*/
@Test public void testPushSelectAndMakeDependentAccessPattern2() throws Exception {
- ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1, pm4.g1 where pm4.g1.e1 = 'abc' and pm1.g1.e2 = pm4.g1.e2", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g1.e1 from pm1.g1, pm4.g1 where pm4.g1.e1 = 'abc' and pm1.g1.e2 = pm4.g1.e2", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT pm1.g1.e2, pm1.g1.e1 FROM pm1.g1", "SELECT pm4.g1.e2 FROM pm4.g1 WHERE pm4.g1.e1 = 'abc'" }, TestOptimizer.getGenericFinder(false), ComparisonMode.CORRECTED_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
checkDependentGroups(plan, new String[0] );
@@ -471,10 +469,9 @@
caps.setSourceProperty(Capability.MAX_IN_CRITERIA_SIZE, new Integer(10));
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- FakeMetadataObject obj = metadata.getStore().findObject("pm1.g1", FakeMetadataObject.GROUP); //$NON-NLS-1$
- obj.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1));
-
+ QueryMetadataInterface metadata = RealMetadataFactory.example1();
+ RealMetadataFactory.setCardinality("pm1.g1", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1, metadata);
+
ProcessorPlan plan = TestOptimizer.helpPlan(sql, metadata,
null, capFinder,
new String[] { "SELECT g_0.e1 FROM pm1.g2 AS g_0 WHERE g_0.e1 IN (<dependent values>)", "SELECT g_0.e1 FROM pm1.g1 AS g_0" }, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
@@ -507,9 +504,8 @@
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- FakeMetadataObject obj = metadata.getStore().findObject("pm1.g1", FakeMetadataObject.GROUP); //$NON-NLS-1$
- obj.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1));
+ QueryMetadataInterface metadata = RealMetadataFactory.example1();
+ RealMetadataFactory.setCardinality("pm1.g1", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1, metadata);
ProcessorPlan plan = TestOptimizer.helpPlan(sql, metadata,
null, capFinder,
@@ -546,13 +542,10 @@
caps.setSourceProperty(Capability.MAX_IN_CRITERIA_SIZE, new Integer(1000));
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- FakeMetadataObject g1 = metadata.getStore().findObject("pm1.g1", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g1.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1));
- FakeMetadataObject g2 = metadata.getStore().findObject("pm1.g2", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g2.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1 ));
- FakeMetadataObject g3 = metadata.getStore().findObject("pm1.g3", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g3.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000));
+ QueryMetadataInterface metadata = RealMetadataFactory.example1();
+ RealMetadataFactory.setCardinality("pm1.g1", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1, metadata);
+ RealMetadataFactory.setCardinality("pm1.g2", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1, metadata);
+ RealMetadataFactory.setCardinality("pm1.g3", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata);
ProcessorPlan plan = TestOptimizer.helpPlan(sql, metadata,
null, capFinder,
@@ -587,13 +580,10 @@
caps.setSourceProperty(Capability.MAX_IN_CRITERIA_SIZE, new Integer(1000));
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- FakeMetadataObject g1 = metadata.getStore().findObject("pm1.g1", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g1.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1));
- FakeMetadataObject g2 = metadata.getStore().findObject("pm1.g2", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g2.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000));
- FakeMetadataObject g3 = metadata.getStore().findObject("pm1.g3", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g3.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000));
+ QueryMetadataInterface metadata = RealMetadataFactory.example1();
+ RealMetadataFactory.setCardinality("pm1.g1", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1, metadata);
+ RealMetadataFactory.setCardinality("pm1.g2", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata);
+ RealMetadataFactory.setCardinality("pm1.g3", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata);
ProcessorPlan plan = TestOptimizer.helpPlan(sql, metadata,
null, capFinder,
@@ -636,14 +626,11 @@
caps.setSourceProperty(Capability.MAX_IN_CRITERIA_SIZE, new Integer(1000));
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- FakeMetadataObject g1 = metadata.getStore().findObject("pm1.g1", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g1.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1));
- FakeMetadataObject g2 = metadata.getStore().findObject("pm1.g2", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g2.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000));
- FakeMetadataObject g3 = metadata.getStore().findObject("pm1.g3", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g3.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000));
-
+ QueryMetadataInterface metadata = RealMetadataFactory.example1();
+ RealMetadataFactory.setCardinality("pm1.g1", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1, metadata);
+ RealMetadataFactory.setCardinality("pm1.g2", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata);
+ RealMetadataFactory.setCardinality("pm1.g3", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata);
+
ProcessorPlan plan = TestOptimizer.helpPlan(sql, metadata,
null, capFinder,
new String[] { "SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 ORDER BY c_0", "SELECT g_0.e1 AS c_0 FROM pm1.g3 AS g_0 ORDER BY c_0", "SELECT g_0.e1 AS c_0 FROM pm1.g2 AS g_0 WHERE g_0.e1 IN (<dependent values>) ORDER BY c_0" }, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -679,11 +666,9 @@
caps.setSourceProperty(Capability.MAX_IN_CRITERIA_SIZE, new Integer(1000));
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- FakeMetadataObject g1 = metadata.getStore().findObject("pm1.g1", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g1.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1));
- FakeMetadataObject g2 = metadata.getStore().findObject("pm1.g2", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g2.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000));
+ QueryMetadataInterface metadata = RealMetadataFactory.example1();
+ RealMetadataFactory.setCardinality("pm1.g1", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1, metadata);
+ RealMetadataFactory.setCardinality("pm1.g2", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata);
ProcessorPlan plan = TestOptimizer.helpPlan(sql, metadata,
null, capFinder,
@@ -720,9 +705,9 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQT();
- FakeMetadataFactory.setCardinality("bqt1.smalla", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata); //$NON-NLS-1$
- FakeMetadataFactory.setCardinality("bqt2.smalla", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1, metadata); //$NON-NLS-1$
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQT();
+ RealMetadataFactory.setCardinality("bqt1.smalla", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata); //$NON-NLS-1$
+ RealMetadataFactory.setCardinality("bqt2.smalla", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1, metadata); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan(
"SELECT table1comp.IntKey, table1comp.key1, BQT1.SmallA.StringKey FROM (SELECT t1.*, (STRINGKEY || STRINGNUM) AS key1 FROM BQT2.SmallA AS t1) AS table1comp, BQT1.SmallA WHERE table1comp.key1 = BQT1.SmallA.StringKey", //$NON-NLS-1$
@@ -764,9 +749,9 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
- TransformationMetadata metadata = FakeMetadataFactory.exampleBQT();
- FakeMetadataFactory.setCardinality("bqt1.smalla", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata); //$NON-NLS-1$
- FakeMetadataFactory.setCardinality("bqt2.smalla", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1, metadata); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.exampleBQT();
+ RealMetadataFactory.setCardinality("bqt1.smalla", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata); //$NON-NLS-1$
+ RealMetadataFactory.setCardinality("bqt2.smalla", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1, metadata); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan(
"SELECT table1comp.IntKey, table1comp.key1, BQT1.SmallA.StringKey FROM (SELECT t1.*, (STRINGKEY || STRINGNUM) AS key1 FROM BQT2.SmallA AS t1) AS table1comp, BQT1.SmallA WHERE table1comp.key1 = BQT1.SmallA.StringKey AND table1comp.key1 = BQT1.SmallA.StringNum", //$NON-NLS-1$
@@ -805,9 +790,9 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
- TransformationMetadata metadata = FakeMetadataFactory.exampleBQT();
- FakeMetadataFactory.setCardinality("bqt1.smalla", 1000, metadata); //$NON-NLS-1$
- FakeMetadataFactory.setCardinality("bqt2.smalla", 10000, metadata); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.exampleBQT();
+ RealMetadataFactory.setCardinality("bqt1.smalla", 1000, metadata); //$NON-NLS-1$
+ RealMetadataFactory.setCardinality("bqt2.smalla", 10000, metadata); //$NON-NLS-1$
Column fmo = (Column)metadata.getElementID("bqt1.smalla.intnum");
fmo.setDistinctValues(1000);
Column floatnum = (Column)metadata.getElementID("bqt1.smalla.floatnum");
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestExpressionsInGroupBy.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestExpressionsInGroupBy.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestExpressionsInGroupBy.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -28,7 +28,7 @@
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
import org.teiid.query.processor.ProcessorPlan;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
/**
@@ -55,7 +55,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] { "SELECT convert(TimestampValue, date), COUNT(*) FROM bqt1.smalla GROUP BY convert(TimestampValue, date)" }, //$NON-NLS-1$
true);
@@ -79,7 +79,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] { "SELECT convert(TimestampValue, date), COUNT(*) FROM bqt1.smalla GROUP BY convert(TimestampValue, date)" }, //$NON-NLS-1$
true);
@@ -90,7 +90,7 @@
@Test public void testCase1565_3() throws Exception {
String sql = "SELECT x, COUNT(*) FROM (SELECT convert(TimestampValue, date) AS x FROM (SELECT TimestampValue from bqt1.smalla) as z) as y GROUP BY x"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
null, TestOptimizer.getGenericFinder(),
new String[] { "SELECT TimestampValue FROM bqt1.smalla" }, //$NON-NLS-1$
true);
@@ -128,7 +128,7 @@
caps.setFunctionSupport("convert", true); //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] { "SELECT TimestampValue, stringkey FROM bqt1.smalla" }, //$NON-NLS-1$
true);
@@ -166,7 +166,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] { "SELECT intkey FROM bqt1.smalla" }, //$NON-NLS-1$
true);
@@ -191,7 +191,7 @@
// SELECT SUM(x) FROM (SELECT IntKey+1 AS x FROM BQT1.SmallA) AS g
@Test public void testAggregateNoGroupByWithNestedFunction() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT SUM(x) FROM (SELECT IntKey+1 AS x FROM BQT1.SmallA) AS g", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT SUM(x) FROM (SELECT IntKey+1 AS x FROM BQT1.SmallA) AS g", RealMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
new String[] { "SELECT IntKey FROM BQT1.SmallA" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -231,7 +231,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan(sql,
- FakeMetadataFactory.exampleBQTCached(),
+ RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] {"SELECT CASE WHEN BQT1.SmallA.IntKey >= 5000 THEN '5000 +' ELSE '0-999' END, BQT1.SmallA.IntKey FROM BQT1.SmallA"}, //$NON-NLS-1$
TestOptimizer.SHOULD_SUCCEED );
@@ -275,7 +275,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan(sql,
- FakeMetadataFactory.exampleBQTCached(),
+ RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] {"SELECT IntKey FROM BQT1.SmallA"}, //$NON-NLS-1$
TestOptimizer.SHOULD_SUCCEED );
@@ -320,7 +320,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan(sql,
- FakeMetadataFactory.exampleBQTCached(),
+ RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] {"SELECT IntKey FROM BQT1.SmallA"}, //$NON-NLS-1$
TestOptimizer.SHOULD_SUCCEED );
@@ -362,7 +362,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan(sql,
- FakeMetadataFactory.exampleBQTCached(),
+ RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] {"SELECT IntKey FROM BQT1.SmallA"}, //$NON-NLS-1$
TestOptimizer.SHOULD_SUCCEED );
@@ -394,7 +394,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan(sql,
- FakeMetadataFactory.exampleBQTCached(),
+ RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] {"SELECT StringKey FROM BQT1.SmallA"}, //$NON-NLS-1$
TestOptimizer.SHOULD_SUCCEED );
@@ -426,7 +426,7 @@
ProcessorPlan plan = TestOptimizer.helpPlan(
"SELECT e2 as x FROM pm1.g1 GROUP BY upper(e1), e2", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, capFinder,
new String[] {"SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1"}, //$NON-NLS-1$
ComparisonMode.EXACT_COMMAND_STRING );
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestInlineView.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestInlineView.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestInlineView.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -36,7 +36,7 @@
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
import org.teiid.query.processor.ProcessorPlan;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
public class TestInlineView {
@@ -244,7 +244,7 @@
protected void runTest(InlineViewCase testCase) throws Exception {
FakeCapabilitiesFinder capFinder = getInliveViewCapabilitiesFinder();
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = TestOptimizer.helpPlan(testCase.userQuery, metadata, null, capFinder, new String[] {testCase.optimizedQuery}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);
@@ -253,7 +253,7 @@
@Test public void testAliasCreationWithInlineView() {
FakeCapabilitiesFinder capFinder = getInliveViewCapabilitiesFinder();
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = helpPlan("select a, b from (select distinct count(intNum) a, count(stringKey), bqt1.smalla.intkey as b from bqt1.smalla group by bqt1.smalla.intkey) q1 order by q1.a", //$NON-NLS-1$
metadata, null, capFinder, new String[] {"SELECT COUNT(g_0.intNum) AS c_0, g_0.intkey AS c_1 FROM bqt1.smalla AS g_0 GROUP BY g_0.intkey ORDER BY c_0"}, true); //$NON-NLS-1$
@@ -263,7 +263,7 @@
@Test public void testAliasPreservationWithInlineView() {
FakeCapabilitiesFinder capFinder = getInliveViewCapabilitiesFinder();
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = helpPlan("select q1.a + 1, q1.b from (select count(bqt1.smalla.intNum) as a, bqt1.smalla.intkey as b from bqt1.smalla group by bqt1.smalla.intNum, bqt1.smalla.intkey order by b) q1 where q1.a = 1", //$NON-NLS-1$
metadata, null, capFinder, new String[] {"SELECT (q1.a + 1), q1.b FROM (SELECT COUNT(bqt1.smalla.intNum) AS a, bqt1.smalla.intkey AS b FROM bqt1.smalla GROUP BY bqt1.smalla.intNum, bqt1.smalla.intkey HAVING COUNT(bqt1.smalla.intNum) = 1) AS q1"}, true); //$NON-NLS-1$
@@ -276,7 +276,7 @@
*/
@Test public void testCrossSourceInlineView() throws Exception {
FakeCapabilitiesFinder capFinder = getInliveViewCapabilitiesFinder();
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = helpPlan("select * from (select count(bqt1.smalla.intkey) as a, bqt1.smalla.intkey from bqt1.smalla group by bqt1.smalla.intkey) q1 inner join (select count(bqt2.smallb.intkey) as a, bqt2.smallb.intkey from bqt2.smallb group by bqt2.smallb.intkey) as q2 on q1.intkey = q2.intkey where q1.a = 1", //$NON-NLS-1$
metadata, null, capFinder, new String[] {"SELECT v_0.c_0, v_0.c_1 FROM (SELECT g_0.intkey AS c_0, COUNT(g_0.intkey) AS c_1 FROM bqt2.smallb AS g_0 GROUP BY g_0.intkey) AS v_0 ORDER BY c_0", //$NON-NLS-1$
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestJoinOptimization.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestJoinOptimization.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestJoinOptimization.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -32,7 +32,11 @@
import org.teiid.api.exception.query.QueryParserException;
import org.teiid.api.exception.query.QueryResolverException;
import org.teiid.core.TeiidComponentException;
+import org.teiid.metadata.Column;
+import org.teiid.metadata.Table;
+import org.teiid.metadata.KeyRecord.Type;
import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.optimizer.TestOptimizer.ComparisonMode;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
@@ -45,10 +49,7 @@
import org.teiid.query.sql.lang.Criteria;
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
-import org.teiid.query.unittest.FakeMetadataStore;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.translator.SourceSystemFunctions;
@SuppressWarnings("nls")
@@ -61,7 +62,7 @@
String sql = "select bqt1.smalla.intkey, bqt2.smalla.intkey from bqt1.smalla inner join bqt2.smalla on (bqt1.smalla.intkey = bqt2.smalla.intkey and bqt2.smalla.intkey = 1)"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), new String[] {"SELECT bqt1.smalla.intkey FROM bqt1.smalla WHERE bqt1.smalla.intkey = 1", "SELECT bqt2.smalla.intkey FROM bqt2.smalla WHERE bqt2.smalla.intkey = 1"}); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), new String[] {"SELECT bqt1.smalla.intkey FROM bqt1.smalla WHERE bqt1.smalla.intkey = 1", "SELECT bqt2.smalla.intkey FROM bqt2.smalla WHERE bqt2.smalla.intkey = 1"}); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
@@ -88,7 +89,7 @@
String sql = "select bqt1.smalla.intkey from bqt1.smalla left outer join bqt2.smalla on (bqt1.smalla.intkey = bqt2.smalla.intkey and bqt2.smalla.stringkey = 1)"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), new String[] {"SELECT g_0.intkey AS c_0 FROM bqt1.smalla AS g_0 ORDER BY c_0", "SELECT g_0.intkey AS c_0 FROM bqt2.smalla AS g_0 WHERE g_0.stringkey = '1' ORDER BY c_0"}); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), new String[] {"SELECT g_0.intkey AS c_0 FROM bqt1.smalla AS g_0 ORDER BY c_0", "SELECT g_0.intkey AS c_0 FROM bqt2.smalla AS g_0 WHERE g_0.stringkey = '1' ORDER BY c_0"}); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
@@ -115,7 +116,7 @@
String sql = "select bqt1.smalla.intkey from bqt1.smalla left outer join bqt2.smalla on (bqt1.smalla.intkey = bqt2.smalla.intkey and bqt1.smalla.stringkey = 1)"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), new String[] {"SELECT g_0.intkey AS c_0 FROM bqt2.smalla AS g_0 ORDER BY c_0", "SELECT g_0.intkey AS c_0, g_0.stringkey AS c_1 FROM bqt1.smalla AS g_0 ORDER BY c_0"}); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), new String[] {"SELECT g_0.intkey AS c_0 FROM bqt2.smalla AS g_0 ORDER BY c_0", "SELECT g_0.intkey AS c_0, g_0.stringkey AS c_1 FROM bqt1.smalla AS g_0 ORDER BY c_0"}); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
@@ -147,7 +148,7 @@
capFinder.addCapabilities(BQT1, caps);
capFinder.addCapabilities(BQT2, caps);
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
// Plan query
ProcessorPlan plan = TestOptimizer.helpPlan(sql,
@@ -184,7 +185,7 @@
String sql = "select bqt1.smalla.intkey, bqt2.smalla.intkey from bqt1.smalla full outer join bqt2.smalla on (bqt1.smalla.intkey = bqt2.smalla.intkey and bqt1.smalla.stringkey = 1 and bqt2.smalla.stringkey = 1)"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), new String[] {"SELECT g_0.intkey AS c_0, g_0.stringkey AS c_1 FROM bqt2.smalla AS g_0 ORDER BY c_0", "SELECT g_0.intkey AS c_0, g_0.stringkey AS c_1 FROM bqt1.smalla AS g_0 ORDER BY c_0"}); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), new String[] {"SELECT g_0.intkey AS c_0, g_0.stringkey AS c_1 FROM bqt2.smalla AS g_0 ORDER BY c_0", "SELECT g_0.intkey AS c_0, g_0.stringkey AS c_1 FROM bqt1.smalla AS g_0 ORDER BY c_0"}); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
@@ -212,7 +213,7 @@
String sql = "select bqt1.smalla.intkey, bqt2.smalla.intkey from bqt1.smalla, bqt2.smalla where bqt1.smalla.stringkey = bqt2.smalla.intkey and bqt2.smalla.intkey = 1"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), new String[] {"SELECT bqt1.smalla.intkey FROM bqt1.smalla WHERE bqt1.smalla.stringkey = '1'", "SELECT bqt2.smalla.intkey FROM bqt2.smalla WHERE bqt2.smalla.intkey = 1"}); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), new String[] {"SELECT bqt1.smalla.intkey FROM bqt1.smalla WHERE bqt1.smalla.stringkey = '1'", "SELECT bqt2.smalla.intkey FROM bqt2.smalla WHERE bqt2.smalla.intkey = 1"}); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
@@ -239,7 +240,7 @@
String sql = "select bqt1.smalla.intkey, bqt2.smalla.intkey from bqt1.smalla, bqt2.smalla where bqt1.smalla.stringkey = bqt2.smalla.intkey and bqt2.smalla.intkey <> 1"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), new String[] {"SELECT g_0.intkey FROM bqt2.smalla AS g_0 WHERE g_0.intkey <> 1", "SELECT g_0.stringkey AS c_0, g_0.intkey AS c_1 FROM bqt1.smalla AS g_0 ORDER BY c_0"}); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), new String[] {"SELECT g_0.intkey FROM bqt2.smalla AS g_0 WHERE g_0.intkey <> 1", "SELECT g_0.stringkey AS c_0, g_0.intkey AS c_1 FROM bqt1.smalla AS g_0 ORDER BY c_0"}); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
@@ -266,7 +267,7 @@
String sql = "select bqt1.smalla.intkey from bqt1.smalla inner join (select bqt3.smalla.intkey from bqt2.smalla left outer join bqt3.smalla on bqt2.smalla.intkey = bqt3.smalla.intkey and bqt3.smalla.intkey = 1) foo on bqt1.smalla.intkey = foo.intkey"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), new String[] {"SELECT g_0.intkey FROM bqt3.smalla AS g_0 WHERE g_0.intkey = 1", "SELECT 1 FROM bqt2.smalla AS g_0", "SELECT g_0.intkey AS c_0 FROM bqt1.smalla AS g_0 ORDER BY c_0"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), new String[] {"SELECT g_0.intkey FROM bqt3.smalla AS g_0 WHERE g_0.intkey = 1", "SELECT 1 FROM bqt2.smalla AS g_0", "SELECT g_0.intkey AS c_0 FROM bqt1.smalla AS g_0 ORDER BY c_0"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
TestOptimizer.checkNodeTypes(plan, new int[] {
3, // Access
@@ -293,7 +294,7 @@
String sql = "select bqt1.smalla.intkey from bqt1.smalla left outer join (select bqt3.smalla.intkey from bqt3.smalla where bqt3.smalla.intkey = 1) foo on bqt1.smalla.intkey = foo.intkey"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), new String[] {"SELECT 1 FROM bqt3.smalla AS g_0 WHERE g_0.intkey = 1", "SELECT g_0.intkey FROM bqt1.smalla AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), new String[] {"SELECT 1 FROM bqt3.smalla AS g_0 WHERE g_0.intkey = 1", "SELECT g_0.intkey FROM bqt1.smalla AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
@@ -320,7 +321,7 @@
String sql = "select bqt2.mediumb.intkey from bqt2.mediumb full outer join (select bqt2.smallb.intkey from bqt2.smalla left outer join bqt2.smallb on bqt2.smalla.intkey = bqt2.smallb.intkey where bqt2.smalla.stringkey = 1) foo on bqt2.mediumb.intkey = foo.intkey"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
new String[] {"SELECT g_1.intkey FROM bqt2.smalla AS g_0 LEFT OUTER JOIN bqt2.smallb AS g_1 ON g_0.intkey = g_1.intkey WHERE g_0.stringkey = '1'", "SELECT g_0.intkey AS c_0 FROM bqt2.mediumb AS g_0 ORDER BY c_0"}); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -348,7 +349,7 @@
String sql = "select bqt2.mediumb.intkey from bqt2.mediumb full outer join (select bqt2.smallb.intkey from bqt2.smalla inner join bqt2.smallb on bqt2.smalla.intkey = bqt2.smallb.intkey where ? = 1) foo on bqt2.mediumb.intkey = foo.intkey"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), new String[] {"SELECT g_0.intkey AS c_0 FROM bqt2.mediumb AS g_0 ORDER BY c_0", "SELECT g_1.intkey FROM bqt2.smalla AS g_0, bqt2.smallb AS g_1 WHERE (g_0.intkey = g_1.intkey) AND (? = 1)"}); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), new String[] {"SELECT g_0.intkey AS c_0 FROM bqt2.mediumb AS g_0 ORDER BY c_0", "SELECT g_1.intkey FROM bqt2.smalla AS g_0, bqt2.smallb AS g_1 WHERE (g_0.intkey = g_1.intkey) AND (? = 1)"}); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
@@ -375,7 +376,7 @@
String sql = "select bqt2.mediumb.intkey from bqt2.mediumb left outer join (select bqt2.smallb.intkey from bqt2.smalla inner join bqt2.smallb on bqt2.smalla.intkey = bqt2.smallb.intkey where ? = 1) foo on bqt2.mediumb.intkey = foo.intkey"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), new String[] {"SELECT g_0.intkey AS c_0 FROM bqt2.mediumb AS g_0 ORDER BY c_0", "SELECT g_1.intkey FROM bqt2.smalla AS g_0, bqt2.smallb AS g_1 WHERE (g_0.intkey = g_1.intkey) AND (? = 1)"}); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), new String[] {"SELECT g_0.intkey AS c_0 FROM bqt2.mediumb AS g_0 ORDER BY c_0", "SELECT g_1.intkey FROM bqt2.smalla AS g_0, bqt2.smallb AS g_1 WHERE (g_0.intkey = g_1.intkey) AND (? = 1)"}); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
@@ -399,7 +400,7 @@
String sql = "select bqt1.smalla.intkey, bqt2.smalla.intkey from bqt1.smalla, bqt2.smalla where bqt1.smalla.stringkey = bqt2.smalla.intkey and bqt2.smalla.intkey = 1 and bqt1.smalla.stringkey = '2'"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), new String[] {});
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), new String[] {});
TestOptimizer.checkNodeTypes(plan, TestRuleRaiseNull.FULLY_NULL);
}
@@ -408,7 +409,7 @@
String sql = "select bqt1.smalla.intkey, bqt2.smalla.intkey from bqt1.smalla left outer join bqt2.smalla on (bqt1.smalla.stringkey = bqt2.smalla.intkey and bqt2.smalla.intkey = null)"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), new String[] {"SELECT bqt1.smalla.intkey FROM bqt1.smalla"}); //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), new String[] {"SELECT bqt1.smalla.intkey FROM bqt1.smalla"}); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@@ -423,7 +424,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), null, capFinder,
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder,
new String[] {"SELECT g_3.intkey, g_0.intkey FROM ((bqt1.smallb AS g_0 CROSS JOIN bqt1.mediuma AS g_1) INNER JOIN bqt1.mediumb AS g_2 ON ((g_0.intkey + g_1.intkey) + g_2.intkey) = 1) LEFT OUTER JOIN bqt1.smalla AS g_3 ON g_3.stringkey = g_0.stringkey"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
@@ -442,7 +443,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), null, capFinder,
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder,
new String[] {"SELECT g_3.intkey, g_0.intkey FROM ((bqt1.smallb AS g_0 CROSS JOIN bqt1.mediuma AS g_1) CROSS JOIN bqt1.mediumb AS g_2) LEFT OUTER JOIN bqt1.smalla AS g_3 ON g_3.stringkey = g_0.stringkey WHERE ((g_3.intkey + g_1.intkey) + g_2.intkey) IS NULL"}, true); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
@@ -461,7 +462,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), null, capFinder,
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder,
new String[] {"SELECT g_3.intkey, g_2.intkey FROM bqt1.mediuma AS g_0, bqt1.mediumb AS g_1, bqt1.smallb AS g_2, bqt1.smalla AS g_3 WHERE (g_3.stringkey = g_2.stringkey) AND (((g_3.intkey + g_0.intkey) + g_1.intkey) = 1)"}, true); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
@@ -482,7 +483,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), null, capFinder,
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder,
new String[] {"SELECT bqt1.smalla.intkey, MAX(bqt1.smallb.intkey) FROM bqt1.smalla, bqt1.smallb WHERE bqt1.smalla.intkey = bqt1.smallb.intnum GROUP BY bqt1.smallb.intkey, bqt1.smalla.intkey HAVING MAX(bqt1.smallb.intkey) = bqt1.smalla.intkey"}, true); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
@@ -503,7 +504,7 @@
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = TestOptimizer.helpPlan("select Y.e1, Y.e2 FROM vm1.g1 X left outer join vm1.g1 Y on Y.e1 = X.e1 where Y.e3 in (select e3 FROM vm1.g1) or Y.e3 IS NULL", metadata, null, capFinder, //$NON-NLS-1$
new String[]{"SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1 AS g1__1 LEFT OUTER JOIN pm1.g1 ON pm1.g1.e1 = g1__1.e1 WHERE (pm1.g1.e3 IN (SELECT pm1.g1.e3 FROM pm1.g1)) OR (pm1.g1.e3 IS NULL)"}, true); //$NON-NLS-1$
@@ -511,7 +512,7 @@
}
@Test public void testRulePushNonJoinCriteriaPreservesOuterJoin() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
String sql = "select b.intkey from (select intkey from bqt1.smalla) a left outer join (select intkey from bqt1.smallb) b on (1 = 1)"; //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan(sql, metadata,
@@ -521,7 +522,7 @@
}
@Test public void testOuterToInnerJoinConversion() {
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
String sql = "select bqt1.smalla.intkey from bqt1.smalla left outer join bqt1.smallb on (bqt1.smalla.intkey = bqt1.smallb.intkey) where bqt1.smallb.intnum = 1"; //$NON-NLS-1$
TestOptimizer.helpPlan(sql, metadata, new String[]{"SELECT bqt1.smalla.intkey FROM bqt1.smalla, bqt1.smallb WHERE (bqt1.smalla.intkey = bqt1.smallb.intkey) AND (bqt1.smallb.intnum = 1)"}); //$NON-NLS-1$
@@ -529,21 +530,21 @@
//same as above, but with a right outer join
@Test public void testOuterToInnerJoinConversion1() {
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
String sql = "select bqt1.smalla.intkey from bqt1.smalla right outer join bqt1.smallb on (bqt1.smalla.intkey = bqt1.smallb.intkey) where bqt1.smalla.intnum = 1"; //$NON-NLS-1$
TestOptimizer.helpPlan(sql, metadata, new String[]{"SELECT bqt1.smalla.intkey FROM bqt1.smallb, bqt1.smalla WHERE (bqt1.smalla.intkey = bqt1.smallb.intkey) AND (bqt1.smalla.intnum = 1)"}); //$NON-NLS-1$
}
@Test public void testOuterToInnerJoinConversion2() {
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
String sql = "select bqt1.smalla.intkey from bqt1.smalla full outer join bqt1.smallb on (bqt1.smalla.intkey = bqt1.smallb.intkey) where bqt1.smallb.intnum = 1"; //$NON-NLS-1$
TestOptimizer.helpPlan(sql, metadata, new String[]{"SELECT bqt1.smalla.intkey FROM bqt1.smallb LEFT OUTER JOIN bqt1.smalla ON bqt1.smalla.intkey = bqt1.smallb.intkey WHERE bqt1.smallb.intnum = 1"}); //$NON-NLS-1$
}
@Test public void testOuterToInnerJoinConversion3() {
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
String sql = "select bqt1.smalla.intkey from bqt1.smalla full outer join bqt1.smallb on (bqt1.smalla.intkey = bqt1.smallb.intkey) where bqt1.smalla.intnum = 1"; //$NON-NLS-1$
TestOptimizer.helpPlan(sql, metadata, new String[]{"SELECT bqt1.smalla.intkey FROM bqt1.smalla LEFT OUTER JOIN bqt1.smallb ON bqt1.smalla.intkey = bqt1.smallb.intkey WHERE bqt1.smalla.intnum = 1"}); //$NON-NLS-1$
@@ -553,7 +554,7 @@
* non-dependent criteria on each side of a full outer creates an inner join
*/
@Test public void testOuterToInnerJoinConversion4() {
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
String sql = "select bqt1.smalla.intkey from bqt1.smalla full outer join bqt1.smallb on (bqt1.smalla.intkey = bqt1.smallb.intkey) where bqt1.smalla.intnum = bqt1.smallb.intnum"; //$NON-NLS-1$
TestOptimizer.helpPlan(sql, metadata, new String[]{"SELECT bqt1.smalla.intkey FROM bqt1.smalla, bqt1.smallb WHERE (bqt1.smalla.intkey = bqt1.smallb.intkey) AND (bqt1.smalla.intnum = bqt1.smallb.intnum)"}); //$NON-NLS-1$
@@ -572,7 +573,7 @@
caps.setFunctionSupport("concat2", true); //$NON-NLS-1$
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
String sql = "select bqt1.smalla.intkey from bqt1.smalla left outer join bqt1.smallb on (bqt1.smalla.intkey = bqt1.smallb.intkey) where concat2(bqt1.smallb.intnum, '1') = 1"; //$NON-NLS-1$
TestOptimizer.helpPlan(sql, metadata, null, capFinder, new String[]{"SELECT bqt1.smallb.intnum, bqt1.smalla.intkey FROM bqt1.smalla LEFT OUTER JOIN bqt1.smallb ON bqt1.smalla.intkey = bqt1.smallb.intkey"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
@@ -588,7 +589,7 @@
String sql = "select x.y, x.intkey from (select max(intnum) y, intkey from bqt1.smalla group by intkey) x where x.y = 1"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), null, capFinder,
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder,
new String[]{"SELECT MAX(intnum), intkey FROM bqt1.smalla GROUP BY intkey HAVING MAX(intnum) = 1"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
@@ -620,15 +621,13 @@
* This tests now passes with RulePlanJoins
*/
@Test public void testPathologicalAccessPatternCaseCase2976Defect19018() throws Exception{
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+ TransformationMetadata metadata = RealMetadataFactory.example1();
// add single access pattern to pm1.g4 containing elements e1, e2, and e3
- FakeMetadataStore store = metadata.getStore();
- FakeMetadataObject pm4g1 = store.findObject("pm4.g1", FakeMetadataObject.GROUP);//$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(pm4g1);
- elementIDs.remove(2);
- FakeMetadataObject pm4g1ap1 = FakeMetadataFactory.createAccessPattern("pm4.g1.ap1", pm4g1, elementIDs); //e1,e2,e4 //$NON-NLS-1$
- store.addObject(pm4g1ap1);
+ Table pm4g1 = metadata.getGroupID("pm4.g1");
+ List<Column> cols = new ArrayList<Column>(pm4g1.getColumns());
+ cols.remove(2);
+ RealMetadataFactory.createKey(Type.AccessPattern, "pm4.g1.ap1", pm4g1, cols);
String sql = "SELECT pm1.g1.e1, pm2.g1.e1, pm4.g1.e1 " +//$NON-NLS-1$
"FROM pm1.g1, pm2.g1, pm4.g1 WHERE " +//$NON-NLS-1$
@@ -680,7 +679,7 @@
caps.setFunctionSupport("+", true); //$NON-NLS-1$
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] {
"SELECT m.intkey, m.intnum, s.intkey, s.intnum FROM BQT2.mediuma AS m, BQT2.smalla AS s WHERE (m.intkey = s.intkey) AND (NOT ((m.intkey + s.intnum) = 26))" }, //$NON-NLS-1$
@@ -703,9 +702,9 @@
Criteria crit = QueryParser.getQueryParser().parseCriteria(critSQL);
- QueryResolver.resolveCriteria(crit, FakeMetadataFactory.example1Cached());
+ QueryResolver.resolveCriteria(crit, RealMetadataFactory.example1Cached());
- assertEquals(dependent, JoinUtil.isNullDependent(FakeMetadataFactory.example1Cached(), innerGroups, crit));
+ assertEquals(dependent, JoinUtil.isNullDependent(RealMetadataFactory.example1Cached(), innerGroups, crit));
}
private void helpTestNullDependent(String expressionSQL,
@@ -718,9 +717,9 @@
Expression expr = QueryParser.getQueryParser().parseExpression(expressionSQL);
- ResolverVisitor.resolveLanguageObject(expr, FakeMetadataFactory.example1Cached());
+ ResolverVisitor.resolveLanguageObject(expr, RealMetadataFactory.example1Cached());
- assertEquals(dependent, JoinUtil.isNullDependent(FakeMetadataFactory.example1Cached(), innerGroups, expr));
+ assertEquals(dependent, JoinUtil.isNullDependent(RealMetadataFactory.example1Cached(), innerGroups, expr));
}
@Test public void testNullDependentVisitor() throws Exception {
@@ -794,7 +793,7 @@
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder,
new String[] {
"SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1 WHERE pm1.g1.e1 = '1'" }, //$NON-NLS-1$
@@ -835,7 +834,7 @@
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = TestOptimizer.helpPlan(sql, metadata,
null, capFinder,
@@ -881,7 +880,7 @@
caps.setFunctionSupport(SourceSystemFunctions.IFNULL, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = TestOptimizer.helpPlan(sql, metadata,
null, capFinder,
@@ -900,7 +899,7 @@
@Test public void testCopyCriteriaJoinPushed() throws Exception {
String sql = "select pm1.g1.e1 from pm1.g1, pm1.g2 where pm1.g1.e1 = pm1.g2.e1 and pm1.g1.e1 = 5 and pm1.g1.e2 * 5 = pm1.g2.e2"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = TestOptimizer.helpPlan(sql,metadata,
new String[] { "SELECT g_0.e2, g_1.e2, g_0.e1 FROM pm1.g1 AS g_0, pm1.g2 AS g_1 WHERE (g_0.e1 = g_1.e1) AND (g_0.e1 = '5') AND (g_1.e1 = '5')" }, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
@@ -931,7 +930,7 @@
String sql = "select bqt1.smalla.intkey, bqt1.smallb.intkey from bqt1.smalla, bqt1.smallb WHERE formatdate(bqt1.smalla.DateValue,'yyyyMM') = '200309' AND bqt1.smalla.intkey = bqt1.smallb.intkey"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), new String[] {"SELECT bqt1.smalla.DateValue, bqt1.smalla.intkey, bqt1.smallb.intkey FROM bqt1.smalla, bqt1.smallb WHERE bqt1.smalla.intkey = bqt1.smallb.intkey"}); //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), new String[] {"SELECT bqt1.smalla.DateValue, bqt1.smalla.intkey, bqt1.smallb.intkey FROM bqt1.smalla, bqt1.smallb WHERE bqt1.smalla.intkey = bqt1.smallb.intkey"}); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
1, // Access
@@ -955,7 +954,7 @@
String sql = "select bqt1.smalla.intkey, bqt1.smallb.intkey from bqt1.smalla left outer join bqt1.smallb on bqt1.smalla.intkey = bqt1.smallb.intkey WHERE formatdate(bqt1.smalla.DateValue,'yyyyMM') = '200309'"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), new String[] {"SELECT bqt1.smalla.DateValue, bqt1.smalla.intkey, bqt1.smallb.intkey FROM bqt1.smalla LEFT OUTER JOIN bqt1.smallb ON bqt1.smalla.intkey = bqt1.smallb.intkey"}); //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), new String[] {"SELECT bqt1.smalla.DateValue, bqt1.smalla.intkey, bqt1.smallb.intkey FROM bqt1.smalla LEFT OUTER JOIN bqt1.smallb ON bqt1.smalla.intkey = bqt1.smallb.intkey"}); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
1, // Access
@@ -982,7 +981,7 @@
String sql = "select bqt1.smalla.intkey, b.intkey from bqt1.smalla left outer join (select * from bqt1.smallb where formatdate(bqt1.smallb.DateValue,'yyyyMM') = '200309') b on bqt1.smalla.intkey = b.intkey"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), new String[] {"SELECT g_0.intkey AS c_0 FROM bqt1.smalla AS g_0 ORDER BY c_0", "SELECT g_0.DateValue AS c_0, g_0.IntKey AS c_1 FROM bqt1.smallb AS g_0 ORDER BY c_1"}); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), new String[] {"SELECT g_0.intkey AS c_0 FROM bqt1.smalla AS g_0 ORDER BY c_0", "SELECT g_0.DateValue AS c_0, g_0.IntKey AS c_1 FROM bqt1.smallb AS g_0 ORDER BY c_1"}); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
@@ -1006,7 +1005,7 @@
String sql = "select b.intkey from bqt1.smalla a, bqt2.smallb b, bqt2.smalla b1 where a.intkey = b.intkey and a.intkey = b1.intkey"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), new String[] {
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), new String[] {
"SELECT g_1.intkey AS c_0, g_0.intkey AS c_1 FROM bqt2.smallb AS g_0, bqt2.smalla AS g_1 WHERE g_1.intkey = g_0.intkey ORDER BY c_0, c_1",
"SELECT g_0.intkey AS c_0 FROM bqt1.smalla AS g_0 ORDER BY c_0"});
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestJoinPushdownRestrictions.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestJoinPushdownRestrictions.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestJoinPushdownRestrictions.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -26,7 +26,7 @@
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.translator.ExecutionFactory.SupportedJoinCriteria;
@@ -42,12 +42,12 @@
caps.setFunctionSupport("+", true); //$NON-NLS-1$
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
new String[] {"SELECT g_0.e2 FROM pm1.g2 AS g_0", "SELECT g_0.e2 FROM pm1.g1 AS g_0"}, capFinder, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
caps.setSourceProperty(Capability.JOIN_CRITERIA_ALLOWED, SupportedJoinCriteria.ANY);
- TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
new String[] {"SELECT g_0.e2, g_1.e2 FROM pm1.g1 AS g_0, pm1.g2 AS g_1 WHERE (g_0.e2 + g_1.e2) = 5"}, capFinder, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
}
@@ -60,12 +60,12 @@
caps.setSourceProperty(Capability.JOIN_CRITERIA_ALLOWED, SupportedJoinCriteria.EQUI);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
new String[] {"SELECT g_0.e2 FROM pm1.g2 AS g_0", "SELECT g_0.e2 FROM pm1.g1 AS g_0"}, capFinder, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
caps.setSourceProperty(Capability.JOIN_CRITERIA_ALLOWED, SupportedJoinCriteria.THETA);
- TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
new String[] {"SELECT g_0.e2, g_1.e2 FROM pm1.g1 AS g_0, pm1.g2 AS g_1 WHERE g_0.e2 < g_1.e2"}, capFinder, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
}
@@ -78,12 +78,12 @@
caps.setSourceProperty(Capability.JOIN_CRITERIA_ALLOWED, SupportedJoinCriteria.KEY);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
new String[] {"SELECT g_0.e2 AS c_0 FROM pm1.g1 AS g_0 ORDER BY c_0", "SELECT g_0.e2 AS c_0 FROM pm1.g2 AS g_0 ORDER BY c_0"}, capFinder, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
caps.setSourceProperty(Capability.JOIN_CRITERIA_ALLOWED, SupportedJoinCriteria.EQUI);
- TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
new String[] {"SELECT g_0.e2, g_1.e2 FROM pm1.g1 AS g_0, pm1.g2 AS g_1 WHERE g_0.e2 = g_1.e2"}, capFinder, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
}
@@ -96,7 +96,7 @@
caps.setSourceProperty(Capability.JOIN_CRITERIA_ALLOWED, SupportedJoinCriteria.KEY);
capFinder.addCapabilities("pm4", caps); //$NON-NLS-1$
- TestOptimizer.helpPlan(sql, FakeMetadataFactory.example4(),
+ TestOptimizer.helpPlan(sql, RealMetadataFactory.example4(),
new String[] {"SELECT g_1.e1 AS c_0, g_1.e2 AS c_1, g_0.e1 AS c_2 FROM pm4.g1 AS g_0, pm4.g2 AS g_1 WHERE (g_0.e1 = g_1.e1) AND (g_0.e2 = g_1.e2) ORDER BY c_0, c_1", "SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM pm4.g1 AS g_0 ORDER BY c_0, c_1"}, capFinder, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -109,7 +109,7 @@
caps.setSourceProperty(Capability.JOIN_CRITERIA_ALLOWED, SupportedJoinCriteria.KEY);
capFinder.addCapabilities("pm4", caps); //$NON-NLS-1$
- TestOptimizer.helpPlan(sql, FakeMetadataFactory.example4(),
+ TestOptimizer.helpPlan(sql, RealMetadataFactory.example4(),
new String[] {"SELECT g_0.e1, g_1.e1 FROM pm4.g1 AS g_0, pm4.g2 AS g_1 WHERE (g_0.e1 = g_1.e1) AND (g_0.e2 = g_1.e2)"}, capFinder, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
}
@@ -122,7 +122,7 @@
caps.setSourceProperty(Capability.JOIN_CRITERIA_ALLOWED, SupportedJoinCriteria.THETA);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
new String[] {"SELECT g_0.e2 FROM pm1.g2 AS g_0", "SELECT g_0.e2 FROM pm1.g1 AS g_0"}, capFinder, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -136,7 +136,7 @@
caps.setFunctionSupport("+", true); //$NON-NLS-1$
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
new String[] {"SELECT g_0.e2 FROM pm1.g2 AS g_0", "SELECT g_0.e2 FROM pm1.g1 AS g_0"}, capFinder, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -149,7 +149,7 @@
caps.setSourceProperty(Capability.JOIN_CRITERIA_ALLOWED, SupportedJoinCriteria.THETA);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
new String[] {"SELECT g_0.e2 AS c_0 FROM pm1.g1 AS g_0 ORDER BY c_0", "SELECT g_0.e2 AS c_0 FROM pm1.g2 AS g_0 WHERE g_0.e1 = 'hello' ORDER BY c_0"}, capFinder, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -25,8 +25,15 @@
import java.util.Arrays;
import java.util.List;
+import junit.framework.TestCase;
+
import org.teiid.core.types.DataTypeManager;
+import org.teiid.metadata.Column;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Schema;
+import org.teiid.metadata.Table;
import org.teiid.query.mapping.relational.QueryNode;
+import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.optimizer.TestOptimizer.DependentProjectNode;
import org.teiid.query.optimizer.TestOptimizer.DependentSelectNode;
import org.teiid.query.optimizer.TestOptimizer.DupRemoveNode;
@@ -49,13 +56,8 @@
import org.teiid.query.processor.relational.SelectNode;
import org.teiid.query.processor.relational.SortNode;
import org.teiid.query.processor.relational.UnionAllNode;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
-import org.teiid.query.unittest.FakeMetadataStore;
+import org.teiid.query.unittest.RealMetadataFactory;
-import junit.framework.TestCase;
-
@SuppressWarnings("nls")
public class TestLimit extends TestCase {
@@ -99,83 +101,61 @@
super(name);
}
- private static FakeMetadataFacade exampleMetadata() {
+ private static TransformationMetadata exampleMetadata() {
+ MetadataStore metadataStore = new MetadataStore();
// Create models
- FakeMetadataObject pm1 = FakeMetadataFactory.createPhysicalModel("pm1"); //$NON-NLS-1$
- FakeMetadataObject vm1 = FakeMetadataFactory.createVirtualModel("vm1"); //$NON-NLS-1$
+ Schema pm1 = RealMetadataFactory.createPhysicalModel("pm1", metadataStore); //$NON-NLS-1$
+ Schema vm1 = RealMetadataFactory.createVirtualModel("vm1", metadataStore); //$NON-NLS-1$
// Create physical groups
- FakeMetadataObject pm1g1 = FakeMetadataFactory.createPhysicalGroup("pm1.g1", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g2 = FakeMetadataFactory.createPhysicalGroup("pm1.g2", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g3 = FakeMetadataFactory.createPhysicalGroup("pm1.g3", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g4 = FakeMetadataFactory.createPhysicalGroup("pm1.g4", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g5 = FakeMetadataFactory.createPhysicalGroup("pm1.g5", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g6 = FakeMetadataFactory.createPhysicalGroup("pm1.g6", pm1); //$NON-NLS-1$
+ Table pm1g1 = RealMetadataFactory.createPhysicalGroup("g1", pm1); //$NON-NLS-1$
+ Table pm1g2 = RealMetadataFactory.createPhysicalGroup("g2", pm1); //$NON-NLS-1$
+ Table pm1g3 = RealMetadataFactory.createPhysicalGroup("g3", pm1); //$NON-NLS-1$
+ Table pm1g4 = RealMetadataFactory.createPhysicalGroup("g4", pm1); //$NON-NLS-1$
+ Table pm1g5 = RealMetadataFactory.createPhysicalGroup("g5", pm1); //$NON-NLS-1$
+ Table pm1g6 = RealMetadataFactory.createPhysicalGroup("g6", pm1); //$NON-NLS-1$
// Create physical elements
- List pm1g1e = FakeMetadataFactory.createElements(pm1g1,
+ RealMetadataFactory.createElements(pm1g1,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm1g2e = FakeMetadataFactory.createElements(pm1g2,
+ RealMetadataFactory.createElements(pm1g2,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm1g3e = FakeMetadataFactory.createElements(pm1g3,
+ RealMetadataFactory.createElements(pm1g3,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm1g4e = FakeMetadataFactory.createElements(pm1g4,
+ List<Column> pm1g4e = RealMetadataFactory.createElements(pm1g4,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- ((FakeMetadataObject)pm1g4e.get(1)).putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- ((FakeMetadataObject)pm1g4e.get(3)).putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- List pm1g5e = FakeMetadataFactory.createElements(pm1g5,
+ pm1g4e.get(1).setSelectable(false);
+ pm1g4e.get(3).setSelectable(false);
+ List<Column> pm1g5e = RealMetadataFactory.createElements(pm1g5,
new String[] { "e1" }, //$NON-NLS-1$
new String[] { DataTypeManager.DefaultDataTypes.STRING });
- ((FakeMetadataObject)pm1g5e.get(0)).putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- List pm1g6e = FakeMetadataFactory.createElements(pm1g6,
+ pm1g5e.get(0).setSelectable(false);
+ RealMetadataFactory.createElements(pm1g6,
new String[] { "in", "in3" }, //$NON-NLS-1$ //$NON-NLS-2$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
// Create virtual groups
QueryNode vm1g1n1 = new QueryNode("SELECT * FROM pm1.g1 LIMIT 100"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g1 = FakeMetadataFactory.createVirtualGroup("vm1.g1", vm1, vm1g1n1); //$NON-NLS-1$
+ Table vm1g1 = RealMetadataFactory.createVirtualGroup("g1", vm1, vm1g1n1); //$NON-NLS-1$
// Create virtual elements
- List vm1g1e = FakeMetadataFactory.createElements(vm1g1,
+ RealMetadataFactory.createElements(vm1g1,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
QueryNode vm1g2n1 = new QueryNode("SELECT * FROM vm1.g1 ORDER BY e1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g2 = FakeMetadataFactory.createVirtualGroup("vm1.g2", vm1, vm1g2n1); //$NON-NLS-1$
+ Table vm1g2 = RealMetadataFactory.createVirtualGroup("g2", vm1, vm1g2n1); //$NON-NLS-1$
// Create virtual elements
- List vm1g2e = FakeMetadataFactory.createElements(vm1g2,
+ RealMetadataFactory.createElements(vm1g2,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- // Add all objects to the store
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(pm1);
- store.addObject(pm1g1);
- store.addObjects(pm1g1e);
- store.addObject(pm1g2);
- store.addObjects(pm1g2e);
- store.addObject(pm1g3);
- store.addObjects(pm1g3e);
- store.addObject(pm1g4);
- store.addObjects(pm1g4e);
- store.addObject(pm1g5);
- store.addObjects(pm1g5e);
- store.addObject(pm1g6);
- store.addObjects(pm1g6e);
-
- store.addObject(vm1);
- store.addObject(vm1g1);
- store.addObjects(vm1g1e);
- store.addObject(vm1g2);
- store.addObjects(vm1g2e);
-
- // Create the facade from the store
- return new FakeMetadataFacade(store);
+ return RealMetadataFactory.createTransformationMetadata(metadataStore, "example");
}
public void testLimit() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
@@ -186,7 +166,7 @@
String[] expectedSql = new String[] {
"SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1" //$NON-NLS-1$
};
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder, expectedSql, true);
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -219,7 +199,7 @@
String[] expectedSql = new String[] {
"SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1 LIMIT 100" //$NON-NLS-1$
};
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder, expectedSql, true);
TestOptimizer.checkNodeTypes(plan, FULL_PUSHDOWN, NODE_TYPES);
@@ -234,7 +214,7 @@
String[] expectedSql = new String[] {
"SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1" //$NON-NLS-1$
};
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder, expectedSql, true);
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -266,7 +246,7 @@
String[] expectedSql = new String[] {
"SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1 LIMIT 150" //$NON-NLS-1$
};
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder, expectedSql, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -299,7 +279,7 @@
String[] expectedSql = new String[] {
"SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1 LIMIT 50, 100" //$NON-NLS-1$
};
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder, expectedSql, true);
TestOptimizer.checkNodeTypes(plan, FULL_PUSHDOWN, NODE_TYPES);
@@ -314,7 +294,7 @@
String[] expectedSql = new String[] {
"SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1" //$NON-NLS-1$
};
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder, expectedSql, true);
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -347,7 +327,7 @@
String[] expectedSql = new String[] {
"SELECT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1 ORDER BY pm3.g1.e1" //$NON-NLS-1$
};
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder, expectedSql, true);
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -381,7 +361,7 @@
String[] expectedSql = new String[] {
"SELECT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1 ORDER BY pm3.g1.e1 LIMIT 100" //$NON-NLS-1$
};
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder, expectedSql, true);
TestOptimizer.checkNodeTypes(plan, FULL_PUSHDOWN, NODE_TYPES);
@@ -397,7 +377,7 @@
String[] expectedSql = new String[] {
"SELECT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1" //$NON-NLS-1$
};
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder, expectedSql, true);
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -464,7 +444,7 @@
String[] expectedSql = new String[] {
"SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1", "SELECT pm1.g2.e1, pm1.g2.e2, pm1.g2.e3, pm1.g2.e4 FROM PM1.g2" //$NON-NLS-1$
};
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder, expectedSql, true);
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -497,7 +477,7 @@
String[] expectedSql = new String[] {
"SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1" //$NON-NLS-1$
};
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder, expectedSql, true);
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -530,7 +510,7 @@
String[] expectedSql = new String[] {
"SELECT pm1.g2.e1, pm1.g2.e2, pm1.g2.e3, pm1.g2.e4 FROM PM1.g2 LIMIT 100", "SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1 LIMIT 100" //$NON-NLS-1$ //$NON-NLS-2$
};
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder, expectedSql, true);
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -565,7 +545,7 @@
String[] expectedSql = new String[] {
"SELECT PM1.g2.e1 AS c_0, PM1.g2.e2 AS c_1, PM1.g2.e3 AS c_2, PM1.g2.e4 AS c_3 FROM PM1.g2 LIMIT 150", "SELECT pm1.g1.e1 AS c_0, pm1.g1.e2 AS c_1, pm1.g1.e3 AS c_2, pm1.g1.e4 AS c_3 FROM pm1.g1 LIMIT 150" //$NON-NLS-1$ //$NON-NLS-2$
};
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder, expectedSql, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -598,7 +578,7 @@
String[] expectedSql = new String[] {
"SELECT pm1.g2.e1, pm1.g2.e2, pm1.g2.e3, pm1.g2.e4 FROM PM1.g2", "SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1" //$NON-NLS-1$ //$NON-NLS-2$
};
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder, expectedSql, true);
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -633,7 +613,7 @@
String[] expectedSql = new String[] {
"SELECT pm1.g1.e1 AS c_0 FROM pm1.g1 LIMIT 105" //$NON-NLS-1$
};
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder, expectedSql, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -668,7 +648,7 @@
String[] expectedSql = new String[] {
"SELECT pm1.g1.e1 AS c_0 FROM pm1.g1 LIMIT 10, 60" //$NON-NLS-1$
};
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder, expectedSql, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);
TestOptimizer.checkNodeTypes(plan, FULL_PUSHDOWN, NODE_TYPES);
@@ -687,7 +667,7 @@
String[] expectedSql = new String[] {
"SELECT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1 LIMIT 100" //$NON-NLS-1$
};
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder, expectedSql, true);
TestOptimizer.checkNodeTypes(plan, FULL_PUSHDOWN, NODE_TYPES);
@@ -716,7 +696,7 @@
String[] expectedSql = new String[] {
"SELECT v_0.c_0, v_0.c_1, v_0.c_2, v_0.c_3 FROM (SELECT pm3.g1.e1 AS c_0, pm3.g1.e2 AS c_1, pm3.g1.e3 AS c_2, pm3.g1.e4 AS c_3 FROM pm3.g1 LIMIT 100) AS v_0 ORDER BY c_0" //$NON-NLS-1$
};
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder, expectedSql, true);
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
@@ -738,7 +718,7 @@
String[] expectedSql = new String[] {
"SELECT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1 WHERE pm3.g1.e1 = '1' LIMIT 100" //$NON-NLS-1$
};
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder, expectedSql, true);
TestOptimizer.checkNodeTypes(plan, FULL_PUSHDOWN, NODE_TYPES);
@@ -755,7 +735,7 @@
String sql = "SELECT x FROM ((SELECT e1 as x FROM pm1.g1 LIMIT 700) c INNER JOIN (SELECT e1 FROM pm1.g2) d ON d.e1 = c.x) order by x LIMIT 5";//$NON-NLS-1$
String[] expectedSql = new String[] {"SELECT e1 FROM pm1.g1 LIMIT 700", "SELECT e1 FROM pm1.g2"};//$NON-NLS-1$ //$NON-NLS-2$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder, expectedSql, true);
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -796,7 +776,7 @@
String sql = "select * from (SELECT e1 as x FROM pm1.g1 order by x LIMIT 700) y where x = 1";//$NON-NLS-1$
String[] expectedSql = new String[] {"SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 ORDER BY c_0"};//$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder, expectedSql, true);
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -826,7 +806,7 @@
String sql = "select * from (SELECT e1 as x FROM pm1.g1 order by x LIMIT 10, 700) y where x = 1";//$NON-NLS-1$
String[] expectedSql = new String[] {"SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 ORDER BY c_0"};//$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder, expectedSql, true);
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -852,7 +832,7 @@
String sql = "select 1 limit 1";//$NON-NLS-1$
String[] expectedSql = new String[] {};
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), expectedSql);
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), expectedSql);
TestOptimizer.checkNodeTypes(plan, new int[] {
0, // Access
@@ -889,7 +869,7 @@
String[] expectedSql = new String[] {"SELECT MAX(e2) FROM pm1.g1 GROUP BY e2 HAVING MAX(e2) = 0 LIMIT 1"};//$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null, capFinder, expectedSql, true);
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), null, capFinder, expectedSql, true);
TestOptimizer.checkNodeTypes(plan, FULL_PUSHDOWN, NODE_TYPES);
}
@@ -897,7 +877,7 @@
public void testSortWithLimitInlineView() {
String sql = "select e1 from (select pm1.g1.e1, pm1.g1.e2 from pm1.g1 order by pm1.g1.e1, pm1.g1.e2 limit 1) x"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), new String[] {"SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 ORDER BY c_0, g_0.e2"}); //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), new String[] {"SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 ORDER BY c_0, g_0.e2"}); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
1, // Access
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -39,11 +39,13 @@
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.types.DataTypeManager;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Schema;
+import org.teiid.metadata.Table;
import org.teiid.query.analysis.AnalysisRecord;
-import org.teiid.query.function.FunctionLibrary;
-import org.teiid.query.function.FunctionTree;
import org.teiid.query.mapping.relational.QueryNode;
import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.CapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder;
@@ -81,10 +83,7 @@
import org.teiid.query.sql.symbol.GroupSymbol;
import org.teiid.query.sql.visitor.GroupCollectorVisitor;
import org.teiid.query.sql.visitor.ValueIteratorProviderCollectorVisitor;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
-import org.teiid.query.unittest.FakeMetadataStore;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
import org.teiid.query.validator.Validator;
import org.teiid.query.validator.ValidatorReport;
@@ -457,284 +456,205 @@
checkNodeTypes(plan, new int[] {expectedCount}, new Class[] {DependentJoin.class});
}
- public static FakeMetadataFacade example1() {
+ public static TransformationMetadata example1() {
+ MetadataStore metadataStore = new MetadataStore();
// Create models
- FakeMetadataObject pm1 = FakeMetadataFactory.createPhysicalModel("pm1"); //$NON-NLS-1$
- FakeMetadataObject pm2 = FakeMetadataFactory.createPhysicalModel("pm2"); //$NON-NLS-1$
- FakeMetadataObject vm1 = FakeMetadataFactory.createVirtualModel("vm1"); //$NON-NLS-1$
+ Schema pm1 = RealMetadataFactory.createPhysicalModel("pm1", metadataStore); //$NON-NLS-1$
+ Schema pm2 = RealMetadataFactory.createPhysicalModel("pm2", metadataStore); //$NON-NLS-1$
+ Schema vm1 = RealMetadataFactory.createVirtualModel("vm1", metadataStore); //$NON-NLS-1$
// Create physical groups
- FakeMetadataObject pm1g1 = FakeMetadataFactory.createPhysicalGroup("pm1.g1", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g2 = FakeMetadataFactory.createPhysicalGroup("pm1.g2", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g3 = FakeMetadataFactory.createPhysicalGroup("pm1.g3", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g4 = FakeMetadataFactory.createPhysicalGroup("pm1.g4", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g5 = FakeMetadataFactory.createPhysicalGroup("pm1.g5", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g6 = FakeMetadataFactory.createPhysicalGroup("pm1.g6", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g7 = FakeMetadataFactory.createPhysicalGroup("pm1.g7", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g8 = FakeMetadataFactory.createPhysicalGroup("pm1.g8", pm1); //$NON-NLS-1$
- FakeMetadataObject pm2g1 = FakeMetadataFactory.createPhysicalGroup("pm2.g1", pm2); //$NON-NLS-1$
- FakeMetadataObject pm2g2 = FakeMetadataFactory.createPhysicalGroup("pm2.g2", pm2); //$NON-NLS-1$
- FakeMetadataObject pm2g3 = FakeMetadataFactory.createPhysicalGroup("pm2.g3", pm2); //$NON-NLS-1$
+ Table pm1g1 = RealMetadataFactory.createPhysicalGroup("g1", pm1); //$NON-NLS-1$
+ Table pm1g2 = RealMetadataFactory.createPhysicalGroup("g2", pm1); //$NON-NLS-1$
+ Table pm1g3 = RealMetadataFactory.createPhysicalGroup("g3", pm1); //$NON-NLS-1$
+ Table pm1g4 = RealMetadataFactory.createPhysicalGroup("g4", pm1); //$NON-NLS-1$
+ Table pm1g5 = RealMetadataFactory.createPhysicalGroup("g5", pm1); //$NON-NLS-1$
+ Table pm1g6 = RealMetadataFactory.createPhysicalGroup("g6", pm1); //$NON-NLS-1$
+ Table pm1g7 = RealMetadataFactory.createPhysicalGroup("g7", pm1); //$NON-NLS-1$
+ Table pm1g8 = RealMetadataFactory.createPhysicalGroup("g8", pm1); //$NON-NLS-1$
+ Table pm2g1 = RealMetadataFactory.createPhysicalGroup("g1", pm2); //$NON-NLS-1$
+ Table pm2g2 = RealMetadataFactory.createPhysicalGroup("g2", pm2); //$NON-NLS-1$
+ Table pm2g3 = RealMetadataFactory.createPhysicalGroup("g3", pm2); //$NON-NLS-1$
// Create physical elements
- List pm1g1e = FakeMetadataFactory.createElements(pm1g1,
+ RealMetadataFactory.createElements(pm1g1,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm1g2e = FakeMetadataFactory.createElements(pm1g2,
+ RealMetadataFactory.createElements(pm1g2,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm1g3e = FakeMetadataFactory.createElements(pm1g3,
+ RealMetadataFactory.createElements(pm1g3,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm1g4e = FakeMetadataFactory.createElements(pm1g4,
+ RealMetadataFactory.createElements(pm1g4,
new String[] { "e1" }, //$NON-NLS-1$
new String[] { DataTypeManager.DefaultDataTypes.STRING });
- List pm1g5e = FakeMetadataFactory.createElements(pm1g5,
+ RealMetadataFactory.createElements(pm1g5,
new String[] { "e1" }, //$NON-NLS-1$
new String[] { DataTypeManager.DefaultDataTypes.STRING });
- List pm1g6e = FakeMetadataFactory.createElements(pm1g6,
+ RealMetadataFactory.createElements(pm1g6,
new String[] { "e1" }, //$NON-NLS-1$
new String[] { DataTypeManager.DefaultDataTypes.STRING });
- List pm1g7e = FakeMetadataFactory.createElements(pm1g7,
+ RealMetadataFactory.createElements(pm1g7,
new String[] { "e1" }, //$NON-NLS-1$
new String[] { DataTypeManager.DefaultDataTypes.STRING });
- List pm1g8e = FakeMetadataFactory.createElements(pm1g8,
+ RealMetadataFactory.createElements(pm1g8,
new String[] { "e1" }, //$NON-NLS-1$
new String[] { DataTypeManager.DefaultDataTypes.STRING });
- List pm2g1e = FakeMetadataFactory.createElements(pm2g1,
+ RealMetadataFactory.createElements(pm2g1,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm2g2e = FakeMetadataFactory.createElements(pm2g2,
+ RealMetadataFactory.createElements(pm2g2,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm2g3e = FakeMetadataFactory.createElements(pm2g3,
+ RealMetadataFactory.createElements(pm2g3,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
// Create virtual groups
QueryNode vm1g1n1 = new QueryNode("SELECT * FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g1 = FakeMetadataFactory.createUpdatableVirtualGroup("vm1.g1", vm1, vm1g1n1); //$NON-NLS-1$
+ Table vm1g1 = RealMetadataFactory.createUpdatableVirtualGroup("g1", vm1, vm1g1n1); //$NON-NLS-1$
QueryNode vm1g2n1 = new QueryNode("SELECT * FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g2 = FakeMetadataFactory.createUpdatableVirtualGroup("vm1.g2", vm1, vm1g2n1); //$NON-NLS-1$
+ Table vm1g2 = RealMetadataFactory.createUpdatableVirtualGroup("g2", vm1, vm1g2n1); //$NON-NLS-1$
//defect 8096
QueryNode vm1sub1n1 = new QueryNode("SELECT * FROM vm1.g1 WHERE e1 IN (SELECT e1 FROM vm1.g3)"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1sub1 = FakeMetadataFactory.createVirtualGroup("vm1.sub1", vm1, vm1sub1n1); //$NON-NLS-1$
+ Table vm1sub1 = RealMetadataFactory.createVirtualGroup("sub1", vm1, vm1sub1n1); //$NON-NLS-1$
QueryNode vm1g3n1 = new QueryNode("SELECT * FROM pm1.g2"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g3 = FakeMetadataFactory.createUpdatableVirtualGroup("vm1.g3", vm1, vm1g3n1); //$NON-NLS-1$
+ Table vm1g3 = RealMetadataFactory.createUpdatableVirtualGroup("g3", vm1, vm1g3n1); //$NON-NLS-1$
QueryNode vm1g4n1 = new QueryNode("SELECT pm1.g1.e1, pm1.g2.e1 FROM pm1.g1, pm1.g2 WHERE pm1.g1.e1=pm1.g2.e1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g4 = FakeMetadataFactory.createUpdatableVirtualGroup("vm1.g4", vm1, vm1g4n1); //$NON-NLS-1$
+ Table vm1g4 = RealMetadataFactory.createUpdatableVirtualGroup("g4", vm1, vm1g4n1); //$NON-NLS-1$
QueryNode vm1g5n1 = new QueryNode("SELECT DISTINCT pm1.g1.e1 FROM pm1.g1 ORDER BY pm1.g1.e1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g5 = FakeMetadataFactory.createUpdatableVirtualGroup("vm1.g5", vm1, vm1g5n1); //$NON-NLS-1$
+ Table vm1g5 = RealMetadataFactory.createUpdatableVirtualGroup("g5", vm1, vm1g5n1); //$NON-NLS-1$
QueryNode vm1g6n1 = new QueryNode("SELECT e1, convert(e2, string), 3 as e3, ((e2+e4)/3) as e4 FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g6 = FakeMetadataFactory.createUpdatableVirtualGroup("vm1.g6", vm1, vm1g6n1); //$NON-NLS-1$
+ Table vm1g6 = RealMetadataFactory.createUpdatableVirtualGroup("g6", vm1, vm1g6n1); //$NON-NLS-1$
QueryNode vm1u1n1 = new QueryNode("SELECT * FROM pm1.g1 UNION SELECT * FROM pm1.g2 UNION ALL SELECT * FROM pm1.g3"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1u1 = FakeMetadataFactory.createUpdatableVirtualGroup("vm1.u1", vm1, vm1u1n1); //$NON-NLS-1$
+ Table vm1u1 = RealMetadataFactory.createUpdatableVirtualGroup("u1", vm1, vm1u1n1); //$NON-NLS-1$
QueryNode vm1u2n1 = new QueryNode("SELECT * FROM pm1.g1 UNION SELECT * FROM pm1.g2"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1u2 = FakeMetadataFactory.createUpdatableVirtualGroup("vm1.u2", vm1, vm1u2n1); //$NON-NLS-1$
+ Table vm1u2 = RealMetadataFactory.createUpdatableVirtualGroup("u2", vm1, vm1u2n1); //$NON-NLS-1$
QueryNode vm1u3n1 = new QueryNode("SELECT e1 FROM pm1.g1 UNION SELECT convert(e2, string) as x FROM pm1.g2"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1u3 = FakeMetadataFactory.createUpdatableVirtualGroup("vm1.u3", vm1, vm1u3n1); //$NON-NLS-1$
+ Table vm1u3 = RealMetadataFactory.createUpdatableVirtualGroup("u3", vm1, vm1u3n1); //$NON-NLS-1$
QueryNode vm1u4n1 = new QueryNode("SELECT concat(e1, 'x') as v1 FROM pm1.g1 UNION ALL SELECT e1 FROM pm1.g2"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1u4 = FakeMetadataFactory.createUpdatableVirtualGroup("vm1.u4", vm1, vm1u4n1); //$NON-NLS-1$
+ Table vm1u4 = RealMetadataFactory.createUpdatableVirtualGroup("u4", vm1, vm1u4n1); //$NON-NLS-1$
QueryNode vm1u5n1 = new QueryNode("SELECT concat(e1, 'x') as v1 FROM pm1.g1 UNION ALL SELECT concat('a', e1) FROM pm1.g2"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1u5 = FakeMetadataFactory.createUpdatableVirtualGroup("vm1.u5", vm1, vm1u5n1); //$NON-NLS-1$
+ Table vm1u5 = RealMetadataFactory.createUpdatableVirtualGroup("u5", vm1, vm1u5n1); //$NON-NLS-1$
QueryNode vm1u6n1 = new QueryNode("SELECT x1.e1 AS elem, 'xyz' AS const FROM pm1.g1 AS x1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1u6 = FakeMetadataFactory.createUpdatableVirtualGroup("vm1.u6", vm1, vm1u6n1); //$NON-NLS-1$
+ Table vm1u6 = RealMetadataFactory.createUpdatableVirtualGroup("u6", vm1, vm1u6n1); //$NON-NLS-1$
QueryNode vm1u7n1 = new QueryNode("SELECT 's1' AS const, e1 FROM pm1.g1 UNION ALL SELECT 's2', e1 FROM pm1.g2"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1u7 = FakeMetadataFactory.createUpdatableVirtualGroup("vm1.u7", vm1, vm1u7n1); //$NON-NLS-1$
+ Table vm1u7 = RealMetadataFactory.createUpdatableVirtualGroup("u7", vm1, vm1u7n1); //$NON-NLS-1$
QueryNode vm1u8n1 = new QueryNode("SELECT const, e1 FROM vm1.u7 UNION ALL SELECT 's3', e1 FROM pm1.g3"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1u8 = FakeMetadataFactory.createUpdatableVirtualGroup("vm1.u8", vm1, vm1u8n1); //$NON-NLS-1$
+ Table vm1u8 = RealMetadataFactory.createUpdatableVirtualGroup("u8", vm1, vm1u8n1); //$NON-NLS-1$
QueryNode vm1u9n1 = new QueryNode("SELECT e1 as a, e1 as b FROM pm1.g1 UNION ALL SELECT e1, e1 FROM pm1.g2"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1u9 = FakeMetadataFactory.createUpdatableVirtualGroup("vm1.u9", vm1, vm1u9n1); //$NON-NLS-1$
+ Table vm1u9 = RealMetadataFactory.createUpdatableVirtualGroup("u9", vm1, vm1u9n1); //$NON-NLS-1$
QueryNode vm1a1n1 = new QueryNode("SELECT e1, SUM(e2) AS sum_e2 FROM pm1.g1 GROUP BY e1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1a1 = FakeMetadataFactory.createUpdatableVirtualGroup("vm1.a1", vm1, vm1a1n1); //$NON-NLS-1$
+ Table vm1a1 = RealMetadataFactory.createUpdatableVirtualGroup("a1", vm1, vm1a1n1); //$NON-NLS-1$
QueryNode vm1a2n1 = new QueryNode("SELECT e1, SUM(e2) AS sum_e2 FROM pm1.g1 GROUP BY e1 HAVING SUM(e2) > 5"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1a2 = FakeMetadataFactory.createUpdatableVirtualGroup("vm1.a2", vm1, vm1a2n1); //$NON-NLS-1$
+ Table vm1a2 = RealMetadataFactory.createUpdatableVirtualGroup("a2", vm1, vm1a2n1); //$NON-NLS-1$
QueryNode vm1a3n1 = new QueryNode("SELECT SUM(e2) AS sum_e2 FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1a3 = FakeMetadataFactory.createUpdatableVirtualGroup("vm1.a3", vm1, vm1a3n1); //$NON-NLS-1$
+ Table vm1a3 = RealMetadataFactory.createUpdatableVirtualGroup("a3", vm1, vm1a3n1); //$NON-NLS-1$
QueryNode vm1a4n1 = new QueryNode("SELECT COUNT(*) FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1a4 = FakeMetadataFactory.createUpdatableVirtualGroup("vm1.a4", vm1, vm1a4n1); //$NON-NLS-1$
+ Table vm1a4 = RealMetadataFactory.createUpdatableVirtualGroup("a4", vm1, vm1a4n1); //$NON-NLS-1$
QueryNode vm1a5n1 = new QueryNode("SELECT vm1.a4.count FROM vm1.a4 UNION ALL SELECT COUNT(*) FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1a5 = FakeMetadataFactory.createUpdatableVirtualGroup("vm1.a5", vm1, vm1a5n1); //$NON-NLS-1$
+ Table vm1a5 = RealMetadataFactory.createUpdatableVirtualGroup("a5", vm1, vm1a5n1); //$NON-NLS-1$
QueryNode vm1a6n1 = new QueryNode("SELECT COUNT(*) FROM vm1.u2"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1a6 = FakeMetadataFactory.createUpdatableVirtualGroup("vm1.a6", vm1, vm1a6n1); //$NON-NLS-1$
+ Table vm1a6 = RealMetadataFactory.createUpdatableVirtualGroup("a6", vm1, vm1a6n1); //$NON-NLS-1$
QueryNode vm1g7n1 = new QueryNode("select DECODESTRING(e1, 'S,Pay,P,Rec') as e1, e2 FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g7 = FakeMetadataFactory.createVirtualGroup("vm1.g7", vm1, vm1g7n1); //$NON-NLS-1$
+ Table vm1g7 = RealMetadataFactory.createVirtualGroup("g7", vm1, vm1g7n1); //$NON-NLS-1$
// Create virtual elements
- List vm1g1e = FakeMetadataFactory.createElements(vm1g1,
+ RealMetadataFactory.createElements(vm1g1,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g2e = FakeMetadataFactory.createElements(vm1g2,
+ RealMetadataFactory.createElements(vm1g2,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g3e = FakeMetadataFactory.createElements(vm1g3,
+ RealMetadataFactory.createElements(vm1g3,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
//for defect 8096
- List vm1sub1e = FakeMetadataFactory.createElements(vm1sub1,
+ RealMetadataFactory.createElements(vm1sub1,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g4e = FakeMetadataFactory.createElements(vm1g4,
+ RealMetadataFactory.createElements(vm1g4,
new String[] { "e1", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- List vm1g5e = FakeMetadataFactory.createElements(vm1g5,
+ RealMetadataFactory.createElements(vm1g5,
new String[] { "e1" }, //$NON-NLS-1$
new String[] { DataTypeManager.DefaultDataTypes.STRING});
- List vm1g6e = FakeMetadataFactory.createElements(vm1g6,
+ RealMetadataFactory.createElements(vm1g6,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g7e = FakeMetadataFactory.createElements(vm1g7,
+ RealMetadataFactory.createElements(vm1g7,
new String[] { "e1", "e2"}, //$NON-NLS-1$ //$NON-NLS-2$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER});
- List vm1u1e = FakeMetadataFactory.createElements(vm1u1,
+ RealMetadataFactory.createElements(vm1u1,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1u2e = FakeMetadataFactory.createElements(vm1u2,
+ RealMetadataFactory.createElements(vm1u2,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1u3e = FakeMetadataFactory.createElements(vm1u3,
+ RealMetadataFactory.createElements(vm1u3,
new String[] { "e1" }, //$NON-NLS-1$
new String[] { DataTypeManager.DefaultDataTypes.STRING });
- List vm1u4e = FakeMetadataFactory.createElements(vm1u4,
+ RealMetadataFactory.createElements(vm1u4,
new String[] { "v1" }, //$NON-NLS-1$
new String[] { DataTypeManager.DefaultDataTypes.STRING });
- List vm1u5e = FakeMetadataFactory.createElements(vm1u5,
+ RealMetadataFactory.createElements(vm1u5,
new String[] { "v1" }, //$NON-NLS-1$
new String[] { DataTypeManager.DefaultDataTypes.STRING });
- List vm1u6e = FakeMetadataFactory.createElements(vm1u6,
+ RealMetadataFactory.createElements(vm1u6,
new String[] { "elem", "const" }, //$NON-NLS-1$ //$NON-NLS-2$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- List vm1u7e = FakeMetadataFactory.createElements(vm1u7,
+ RealMetadataFactory.createElements(vm1u7,
new String[] { "const", "e1" }, //$NON-NLS-1$ //$NON-NLS-2$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- List vm1u8e = FakeMetadataFactory.createElements(vm1u8,
+ RealMetadataFactory.createElements(vm1u8,
new String[] { "const", "e1" }, //$NON-NLS-1$ //$NON-NLS-2$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- List vm1u9e = FakeMetadataFactory.createElements(vm1u9,
+ RealMetadataFactory.createElements(vm1u9,
new String[] { "a", "b" }, //$NON-NLS-1$ //$NON-NLS-2$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- List vm1a1e = FakeMetadataFactory.createElements(vm1a1,
+ RealMetadataFactory.createElements(vm1a1,
new String[] { "e1", "sum_e2" }, //$NON-NLS-1$ //$NON-NLS-2$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.LONG });
- List vm1a2e = FakeMetadataFactory.createElements(vm1a2,
+ RealMetadataFactory.createElements(vm1a2,
new String[] { "e1", "sum_e2" }, //$NON-NLS-1$ //$NON-NLS-2$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.LONG });
- List vm1a3e = FakeMetadataFactory.createElements(vm1a3,
+ RealMetadataFactory.createElements(vm1a3,
new String[] { "sum_e2" }, //$NON-NLS-1$
new String[] { DataTypeManager.DefaultDataTypes.LONG });
- List vm1a4e = FakeMetadataFactory.createElements(vm1a4,
+ RealMetadataFactory.createElements(vm1a4,
new String[] { "count" }, //$NON-NLS-1$
new String[] { DataTypeManager.DefaultDataTypes.INTEGER });
- List vm1a5e = FakeMetadataFactory.createElements(vm1a5,
+ RealMetadataFactory.createElements(vm1a5,
new String[] { "count" }, //$NON-NLS-1$
new String[] { DataTypeManager.DefaultDataTypes.INTEGER });
- List vm1a6e = FakeMetadataFactory.createElements(vm1a6,
+ RealMetadataFactory.createElements(vm1a6,
new String[] { "count" }, //$NON-NLS-1$
new String[] { DataTypeManager.DefaultDataTypes.INTEGER });
- // Add all objects to the store
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(pm1);
- store.addObject(pm1g1);
- store.addObjects(pm1g1e);
- store.addObject(pm1g2);
- store.addObjects(pm1g2e);
- store.addObject(pm1g3);
- store.addObjects(pm1g3e);
- store.addObject(pm1g4);
- store.addObjects(pm1g4e);
- store.addObject(pm1g5);
- store.addObjects(pm1g5e);
- store.addObject(pm1g6);
- store.addObjects(pm1g6e);
- store.addObject(vm1g7);
- store.addObjects(vm1g7e);
- store.addObject(pm1g7);
- store.addObjects(pm1g7e);
- store.addObject(pm1g8);
- store.addObjects(pm1g8e);
-
- store.addObject(pm2);
- store.addObject(pm2g1);
- store.addObjects(pm2g1e);
- store.addObject(pm2g2);
- store.addObjects(pm2g2e);
- store.addObject(pm2g3);
- store.addObjects(pm2g3e);
-
- store.addObject(vm1);
- store.addObject(vm1g1);
- store.addObjects(vm1g1e);
- store.addObject(vm1g2);
- store.addObjects(vm1g2e);
- store.addObject(vm1g3);
- store.addObjects(vm1g3e);
-
- //for defect 8096
- store.addObject(vm1sub1);
- store.addObjects(vm1sub1e);
-
- store.addObject(vm1g4);
- store.addObjects(vm1g4e);
- store.addObject(vm1g5);
- store.addObjects(vm1g5e);
- store.addObject(vm1g6);
- store.addObjects(vm1g6e);
- store.addObject(vm1u1);
- store.addObjects(vm1u1e);
- store.addObject(vm1u2);
- store.addObjects(vm1u2e);
- store.addObject(vm1u3);
- store.addObjects(vm1u3e);
- store.addObject(vm1u4);
- store.addObjects(vm1u4e);
- store.addObject(vm1u5);
- store.addObjects(vm1u5e);
- store.addObject(vm1u6);
- store.addObjects(vm1u6e);
- store.addObject(vm1u7);
- store.addObjects(vm1u7e);
- store.addObject(vm1u8);
- store.addObjects(vm1u8e);
- store.addObject(vm1u9);
- store.addObjects(vm1u9e);
- store.addObject(vm1a1);
- store.addObjects(vm1a1e);
- store.addObject(vm1a2);
- store.addObjects(vm1a2e);
- store.addObject(vm1a3);
- store.addObjects(vm1a3e);
- store.addObject(vm1a4);
- store.addObjects(vm1a4e);
- store.addObject(vm1a5);
- store.addObjects(vm1a5e);
- store.addObject(vm1a6);
- store.addObjects(vm1a6e);
-
- // Create the facade from the store
- return new FakeMetadataFacade(store);
+ return RealMetadataFactory.createTransformationMetadata(metadataStore, "example1");
}
// ################################## ACTUAL TESTS ################################
@@ -748,48 +668,48 @@
}
@Test public void testQueryPhysical() {
- ProcessorPlan plan = helpPlan("SELECT pm1.g1.e1, e2, pm1.g1.e3 as a, e4 as b FROM pm1.g1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT pm1.g1.e1, e2, pm1.g1.e3 as a, e4 as b FROM pm1.g1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT pm1.g1.e1, e2, pm1.g1.e3, e4 FROM pm1.g1"} ); //$NON-NLS-1$
assertTrue(!plan.requiresTransaction(true));
checkNodeTypes(plan, FULL_PUSHDOWN);
}
@Test public void testSelectStarPhysical() {
- ProcessorPlan plan = helpPlan("SELECT * FROM pm1.g1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT * FROM pm1.g1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1"} ); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
}
@Test public void testQuerySingleSourceVirtual() {
- ProcessorPlan plan = helpPlan("SELECT * FROM vm1.g1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT * FROM vm1.g1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1"} ); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
}
@Test public void testQueryMultiSourceVirtual() {
- ProcessorPlan plan = helpPlan("SELECT * FROM vm1.g2", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT * FROM vm1.g2", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT g_0.e1, g_0.e2, g_1.e3, g_1.e4 FROM pm1.g1 AS g_0, pm1.g2 AS g_1 WHERE g_0.e1 = g_1.e1"} ); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
}
@Test public void testPhysicalVirtualJoinWithCriteria() throws Exception {
- ProcessorPlan plan = helpPlan("SELECT vm1.g2.e1 from vm1.g2, pm1.g3 where vm1.g2.e1=pm1.g3.e1 and vm1.g2.e2 > 0", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT vm1.g2.e1 from vm1.g2, pm1.g3 where vm1.g2.e1=pm1.g3.e1 and vm1.g2.e2 > 0", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT g_0.e1 FROM pm1.g1 AS g_0, pm1.g2 AS g_1, pm1.g3 AS g_2 WHERE (g_0.e1 = g_1.e1) AND (g_0.e1 = g_2.e1) AND (g_0.e2 > 0)" }, ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
}
@Test public void testQueryWithExpression() {
- helpPlan("SELECT e4 FROM pm3.g1 WHERE e4 < convert('2001-11-01 10:30:40.42', timestamp)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ helpPlan("SELECT e4 FROM pm3.g1 WHERE e4 < convert('2001-11-01 10:30:40.42', timestamp)", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT e4 FROM pm3.g1 WHERE e4 < {ts'2001-11-01 10:30:40.42'}"} ); //$NON-NLS-1$
}
@Test public void testInsert() {
- helpPlan("Insert into pm1.g1 (pm1.g1.e1, pm1.g1.e2) values ('MyString', 1)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ helpPlan("Insert into pm1.g1 (pm1.g1.e1, pm1.g1.e2) values ('MyString', 1)", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "INSERT INTO pm1.g1 (pm1.g1.e1, pm1.g1.e2) VALUES ('MyString', 1)"} ); //$NON-NLS-1$
}
@Test public void testUpdate1() {
- helpPlan("Update pm1.g1 Set pm1.g1.e1= LTRIM('MyString'), pm1.g1.e2= 1 where pm1.g1.e3= 'true'", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ helpPlan("Update pm1.g1 Set pm1.g1.e1= LTRIM('MyString'), pm1.g1.e2= 1 where pm1.g1.e3= 'true'", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "UPDATE pm1.g1 SET pm1.g1.e1 = 'MyString', pm1.g1.e2 = 1 WHERE pm1.g1.e3 = TRUE"} ); //$NON-NLS-1$
}
@@ -797,7 +717,7 @@
BasicSourceCapabilities bsc = TestOptimizer.getTypicalCapabilities();
bsc.setFunctionSupport(SourceSystemFunctions.CONVERT, true);
DefaultCapabilitiesFinder dcf = new DefaultCapabilitiesFinder(bsc);
- helpPlan("Update pm1.g1 Set pm1.g1.e1= LTRIM('MyString'), pm1.g1.e2= 1 where pm1.g1.e2= convert(pm1.g1.e4, integer)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ helpPlan("Update pm1.g1 Set pm1.g1.e1= LTRIM('MyString'), pm1.g1.e2= 1 where pm1.g1.e2= convert(pm1.g1.e4, integer)", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "UPDATE pm1.g1 SET e1 = 'MyString', e2 = 1 WHERE pm1.g1.e2 = convert(pm1.g1.e4, integer)"}, dcf, ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$
}
@@ -805,7 +725,7 @@
BasicSourceCapabilities bsc = TestOptimizer.getTypicalCapabilities();
bsc.setFunctionSupport(SourceSystemFunctions.CONVERT, true);
DefaultCapabilitiesFinder dcf = new DefaultCapabilitiesFinder(bsc);
- helpPlan("Delete from pm1.g1 where pm1.g1.e1 = cast(pm1.g1.e2 AS string)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ helpPlan("Delete from pm1.g1 where pm1.g1.e1 = cast(pm1.g1.e2 AS string)", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "DELETE FROM pm1.g1 WHERE pm1.g1.e1 = convert(pm1.g1.e2, string)"}, dcf, ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$
}
@@ -1358,29 +1278,8 @@
});
}
- @Test public void testTempGroup() {
- ProcessorPlan plan = helpPlan("select e1 from tm1.g1 where e1 = 'x'", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
- new String[] { "SELECT e1 FROM tm1.g1" }); //$NON-NLS-1$
- checkNodeTypes(plan, new int[] {
- 1, // Access
- 0, // DependentAccess
- 0, // DependentSelect
- 0, // DependentProject
- 0, // DupRemove
- 0, // Grouping
- 0, // NestedLoopJoinStrategy
- 0, // MergeJoinStrategy
- 0, // Null
- 0, // PlanExecution
- 1, // Project
- 1, // Select
- 0, // Sort
- 0 // UnionAll
- });
- }
-
@Test public void testNotPushDistinct() throws Exception {
- ProcessorPlan plan = helpPlan("select distinct e1 from pm1.g1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("select distinct e1 from pm1.g1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT pm1.g1.e1 FROM pm1.g1" }, new DefaultCapabilitiesFinder(), ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
1, // Access
@@ -1401,73 +1300,73 @@
}
@Test public void testPushDistinct() {
- ProcessorPlan plan = helpPlan("select distinct e1 from pm3.g1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("select distinct e1 from pm3.g1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT DISTINCT e1 FROM pm3.g1" }); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
}
@Test public void testPushDistinctSort() {
- ProcessorPlan plan = helpPlan("select distinct e1 from pm3.g1 order by e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("select distinct e1 from pm3.g1 order by e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT DISTINCT e1 FROM pm3.g1 ORDER BY e1" }); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
}
@Test public void testPushDistinctWithCriteria() {
- ProcessorPlan plan = helpPlan("select distinct e1 from pm3.g1 where e1 = 'x'", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("select distinct e1 from pm3.g1 where e1 = 'x'", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT DISTINCT e1 FROM pm3.g1 WHERE e1 = 'x'" }); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
}
@Test public void testPushDistinctVirtual1() {
- ProcessorPlan plan = helpPlan("select * from vm1.g12", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("select * from vm1.g12", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT DISTINCT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1" }); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
}
@Test public void testPushDistinctVirtual2() {
- ProcessorPlan plan = helpPlan("select DISTINCT * from vm1.g12", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("select DISTINCT * from vm1.g12", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT DISTINCT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1" }); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
}
@Test public void testPushDistinctVirtual3() {
- ProcessorPlan plan = helpPlan("select DISTINCT * from vm1.g12 ORDER BY e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("select DISTINCT * from vm1.g12 ORDER BY e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT DISTINCT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1 ORDER BY pm3.g1.e1" }); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
}
@Test public void testPushDistinctVirtual4() {
- ProcessorPlan plan = helpPlan("select * from vm1.g13", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("select * from vm1.g13", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT DISTINCT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1" }); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
}
@Test public void testPushDistinctVirtual5() {
- ProcessorPlan plan = helpPlan("select DISTINCT * from vm1.g13", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("select DISTINCT * from vm1.g13", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT DISTINCT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1" }); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
}
@Test public void testPushDistinctVirtual6() {
- ProcessorPlan plan = helpPlan("select DISTINCT * from vm1.g13 ORDER BY e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("select DISTINCT * from vm1.g13 ORDER BY e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT DISTINCT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1 ORDER BY pm3.g1.e1" }); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
}
@Test public void testPushDistinctVirtual7() {
- ProcessorPlan plan = helpPlan("select * from vm1.g14", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("select * from vm1.g14", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1" }); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
}
@Test public void testPushDistinctVirtual8() {
- ProcessorPlan plan = helpPlan("select DISTINCT * from vm1.g14", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("select DISTINCT * from vm1.g14", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT DISTINCT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1" }); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
}
@Test public void testPushDistinctVirtual9() {
- ProcessorPlan plan = helpPlan("select DISTINCT * from vm1.g14 ORDER BY e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("select DISTINCT * from vm1.g14 ORDER BY e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT DISTINCT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1 ORDER BY pm3.g1.e1" }); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
}
@@ -1476,7 +1375,7 @@
* Defect #7819
*/
@Test public void testPushDistinctWithExpressions() {
- ProcessorPlan plan = helpPlan("SELECT DISTINCT * FROM vm1.g15", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT DISTINCT * FROM vm1.g15", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT e1, e2 FROM pm3.g1" }); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
1, // Access
@@ -1497,7 +1396,7 @@
}
@Test public void testNestedSubquery() {
- ProcessorPlan plan = helpPlan("SELECT IntKey, LongNum FROM (SELECT IntKey, LongNum FROM (SELECT IntKey, LongNum, DoubleNum FROM BQT2.SmallA ) AS x ) AS y ORDER BY IntKey", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT IntKey, LongNum FROM (SELECT IntKey, LongNum FROM (SELECT IntKey, LongNum, DoubleNum FROM BQT2.SmallA ) AS x ) AS y ORDER BY IntKey", RealMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
new String[] { "SELECT IntKey, LongNum FROM BQT2.SmallA order by intkey" }); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
@@ -1505,7 +1404,7 @@
/** Tests a user's order by is pushed to the source */
@Test public void testPushOrderBy() {
- ProcessorPlan plan = helpPlan("SELECT pm3.g1.e1 FROM pm3.g1 ORDER BY e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT pm3.g1.e1 FROM pm3.g1 ORDER BY e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT pm3.g1.e1 FROM pm3.g1 ORDER BY pm3.g1.e1"}); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
@@ -1513,7 +1412,7 @@
/** Tests an order by is not pushed to source due to join */
@Test public void testDontPushOrderByWithJoin() {
- ProcessorPlan plan = helpPlan("SELECT pm3.g1.e1, pm3.g1.e2 FROM pm3.g1 INNER JOIN pm2.g2 ON pm3.g1.e1 = pm2.g2.e1 ORDER BY pm3.g1.e2", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT pm3.g1.e1, pm3.g1.e2 FROM pm3.g1 INNER JOIN pm2.g2 ON pm3.g1.e1 = pm2.g2.e1 ORDER BY pm3.g1.e2", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT pm3.g1.e1, pm3.g1.e2 FROM pm3.g1 ORDER BY pm3.g1.e1", //$NON-NLS-1$
"SELECT pm2.g2.e1 FROM pm2.g2 ORDER BY pm2.g2.e1"}); //$NON-NLS-1$
@@ -1540,7 +1439,7 @@
* transformation order by is discarded
*/
@Test public void testPushOrderByThroughFrame() {
- ProcessorPlan plan = helpPlan("SELECT e1, e2 FROM vm1.g14 ORDER BY e2", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT e1, e2 FROM vm1.g14 ORDER BY e2", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT pm3.g1.e1, pm3.g1.e2 FROM pm3.g1 ORDER BY pm3.g1.e2"}); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
@@ -1550,7 +1449,7 @@
* Tests that query transformation order by is discarded by
*/
@Test public void testPushOrderByThroughFrame2() {
- ProcessorPlan plan = helpPlan("SELECT e1, e2 FROM vm1.g1 ORDER BY e2", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT e1, e2 FROM vm1.g1 ORDER BY e2", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1 order by e2"}); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
@@ -1561,7 +1460,7 @@
* if there is a UNION in the query transformation
*/
@Test public void testPushOrderByThroughFrame4_Union() {
- ProcessorPlan plan = helpPlan("SELECT e1, e2 FROM vm1.g17 ORDER BY e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT e1, e2 FROM vm1.g17 ORDER BY e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT pm3.g1.e1, pm3.g1.e2 FROM pm3.g1", //$NON-NLS-1$
"SELECT pm3.g2.e1, pm3.g2.e2 FROM pm3.g2"}); //$NON-NLS-1$
@@ -1590,7 +1489,7 @@
"FROM (BQT1.SmallA RIGHT OUTER JOIN BQT2.MediumB ON BQT1.SmallA.IntKey = BQT2.MediumB.IntKey) " + //$NON-NLS-1$
"RIGHT OUTER JOIN BQT3.MediumB ON BQT2.MediumB.IntKey = BQT3.MediumB.IntKey " + //$NON-NLS-1$
"WHERE BQT3.MediumB.IntKey < 1500", //$NON-NLS-1$
- FakeMetadataFactory.exampleBQTCached(),
+ RealMetadataFactory.exampleBQTCached(),
new String[] {
"SELECT BQT3.MediumB.IntKey FROM BQT3.MediumB WHERE BQT3.MediumB.IntKey < 1500 order by intkey", //$NON-NLS-1$
"SELECT BQT1.SmallA.IntKey FROM BQT1.SmallA WHERE BQT1.SmallA.IntKey < 1500 order by intkey", //$NON-NLS-1$
@@ -1618,7 +1517,7 @@
@Test public void testFunctionSimplification1() {
ProcessorPlan plan = helpPlan(
"SELECT x FROM vm1.g18 WHERE x = 92.0", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
new String[] {
"SELECT e4 FROM pm1.g1 WHERE e4 = 0.92" }); //$NON-NLS-1$
@@ -1643,7 +1542,7 @@
@Test public void testCantPushJoin1() {
ProcessorPlan plan = helpPlan(
"SELECT a.e1, b.e2 FROM pm1.g1 a, pm1.g2 b WHERE a.e1 = b.e1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, TestOptimizer.getGenericFinder(false),
new String[] {"SELECT a.e1 FROM pm1.g1 AS a", "SELECT b.e1, b.e2 FROM pm1.g2 AS b"}, //$NON-NLS-1$ //$NON-NLS-2$
SHOULD_SUCCEED );
@@ -1669,7 +1568,7 @@
@Test public void testCantPushJoin2() {
ProcessorPlan plan = helpPlan(
"SELECT a.e1, b.e2 FROM pm1.g1 a, pm1.g2 b, pm2.g1 c WHERE a.e1 = b.e1 AND b.e1 = c.e1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, TestOptimizer.getGenericFinder(false),
new String[] {"SELECT a.e1 FROM pm1.g1 AS a", //$NON-NLS-1$
"SELECT b.e1, b.e2 FROM pm1.g2 AS b", //$NON-NLS-1$
@@ -1703,7 +1602,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(
"SELECT a.e1, b.e2 FROM pm1.g1 a, pm1.g1 b WHERE a.e1 = b.e1", //$NON-NLS-1$
@@ -1724,7 +1623,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(
"SELECT a.e1 AS x, concat(a.e2, b.e2) AS y FROM pm1.g1 a, pm1.g1 b WHERE a.e1 = b.e1", //$NON-NLS-1$
@@ -1759,7 +1658,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(
"SELECT pm1.g1.e1 FROM pm1.g1 RIGHT OUTER JOIN pm1.g2 ON pm1.g1.e1 = pm1.g2.e1", //$NON-NLS-1$
@@ -1778,7 +1677,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(
"SELECT pm1.g1.e1 FROM pm1.g1 RIGHT OUTER JOIN pm1.g2 ON pm1.g1.e1 = pm1.g2.e1", //$NON-NLS-1$
@@ -1815,7 +1714,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(
"SELECT pm1.g1.e1 FROM pm1.g1 RIGHT OUTER JOIN pm1.g2 ON pm1.g1.e1 = pm1.g2.e1 || 'x'", //$NON-NLS-1$
@@ -1851,7 +1750,7 @@
ProcessorPlan plan = helpPlan(
"SELECT e1, e2 as x FROM pm1.g1 GROUP BY e1, e2", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, capFinder,
new String[] {"SELECT e1, e2 FROM pm1.g1 GROUP BY e1, e2"}, //$NON-NLS-1$
SHOULD_SUCCEED );
@@ -1869,7 +1768,7 @@
ProcessorPlan plan = helpPlan(
"SELECT e1, max(e2) as x FROM pm1.g1 GROUP BY e1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, capFinder,
new String[] {"SELECT e1, MAX(e2) FROM pm1.g1 GROUP BY e1"}, //$NON-NLS-1$
SHOULD_SUCCEED );
@@ -1886,7 +1785,7 @@
ProcessorPlan plan = helpPlan(
"SELECT e1, e2 as x FROM pm1.g1 GROUP BY e1, e2", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, capFinder,
new String[] {"SELECT e1, e2 FROM pm1.g1"}, //$NON-NLS-1$
SHOULD_SUCCEED );
@@ -1919,7 +1818,7 @@
ProcessorPlan plan = helpPlan(
"SELECT x+2 AS y FROM (SELECT e1, max(e2) as x FROM pm1.g1 GROUP BY e1) AS z", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, capFinder,
new String[] {"SELECT MAX(e2) FROM pm1.g1 GROUP BY e1"}, //$NON-NLS-1$
SHOULD_SUCCEED );
@@ -1953,7 +1852,7 @@
ProcessorPlan plan = helpPlan(
"SELECT e1 FROM pm1.g1 GROUP BY e1 HAVING MAX(e1) = 'zzz'", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, capFinder,
new String[] {"SELECT e1 FROM pm1.g1 GROUP BY e1 HAVING MAX(e1) = 'zzz'"}, //$NON-NLS-1$
SHOULD_SUCCEED );
@@ -1969,7 +1868,7 @@
ProcessorPlan plan = helpPlan(
"SELECT e1 FROM pm1.g1 GROUP BY e1 HAVING MAX(e1) = 'zzz'", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, capFinder,
new String[] {"SELECT e1 FROM pm1.g1"}, //$NON-NLS-1$
SHOULD_SUCCEED );
@@ -2001,7 +1900,7 @@
ProcessorPlan plan = helpPlan(
"SELECT e1 FROM pm1.g1 GROUP BY e1 HAVING MAX(e1) = 'zzz'", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, capFinder,
new String[] {"SELECT e1 FROM pm1.g1"}, //$NON-NLS-1$
SHOULD_SUCCEED );
@@ -2033,7 +1932,7 @@
ProcessorPlan plan = helpPlan(
"SELECT MAX(e1) FROM pm1.g1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, capFinder,
new String[] {"SELECT MAX(e1) FROM pm1.g1"}, //$NON-NLS-1$
SHOULD_SUCCEED );
@@ -2050,7 +1949,7 @@
ProcessorPlan plan = helpPlan(
"SELECT MAX(e1) FROM pm1.g1 GROUP BY e1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, capFinder,
new String[] {"SELECT MAX(e1) FROM pm1.g1 GROUP BY e1"}, //$NON-NLS-1$
SHOULD_SUCCEED );
@@ -2067,7 +1966,7 @@
ProcessorPlan plan = helpPlan(
"SELECT e2, MAX(e1) FROM pm1.g1 GROUP BY e2", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, capFinder,
new String[] {"SELECT e2, MAX(e1) FROM pm1.g1 GROUP BY e2"}, //$NON-NLS-1$
SHOULD_SUCCEED );
@@ -2086,7 +1985,7 @@
ProcessorPlan plan = helpPlan(
"SELECT e2, MAX(e1) FROM pm1.g1 GROUP BY e2 HAVING COUNT(e1) > 0", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, capFinder,
new String[] {"SELECT e2, MAX(e1) FROM pm1.g1 GROUP BY e2 HAVING COUNT(e1) > 0"}, //$NON-NLS-1$
SHOULD_SUCCEED );
@@ -2108,7 +2007,7 @@
ProcessorPlan plan = helpPlan(
"SELECT e2, MAX(e1) FROM pm1.g1 GROUP BY e2 HAVING COUNT(e1) > 0", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, capFinder,
new String[] {"SELECT e2, e1 FROM pm1.g1"}, //$NON-NLS-1$
SHOULD_SUCCEED );
@@ -2143,7 +2042,7 @@
ProcessorPlan plan = helpPlan(
"SELECT COUNT(length(e1)) FROM pm1.g1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, capFinder,
new String[] {"SELECT e1 FROM pm1.g1"}, //$NON-NLS-1$
SHOULD_SUCCEED );
@@ -2178,7 +2077,7 @@
ProcessorPlan plan = helpPlan(
"SELECT COUNT(*) FROM pm1.g1 GROUP BY e1 HAVING length(e1) > 0", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, capFinder,
new String[] {"SELECT e1 FROM pm1.g1"}, //$NON-NLS-1$
SHOULD_SUCCEED );
@@ -2226,7 +2125,7 @@
String sqlOut = "SELECT g_0.intkey FROM bqt1.smalla AS g_0 WHERE (g_0.intkey = 46) AND (g_0.stringkey = '46') AND (g_0.datevalue = (SELECT g_0.datevalue FROM bqt1.smalla AS g_1 WHERE (g_1.intkey = g_0.intkey) AND (g_1.stringkey = g_0.stringkey)))"; //$NON-NLS-1$
ProcessorPlan plan = helpPlan(sqlIn,
- FakeMetadataFactory.exampleBQTCached(),
+ RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] {sqlOut},
ComparisonMode.EXACT_COMMAND_STRING );
@@ -2235,7 +2134,7 @@
}
@Test public void testQueryManyJoin() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan("SELECT pm1.g1.e1 FROM pm1.g1 JOIN ((pm1.g2 JOIN pm1.g3 ON pm1.g2.e1=pm1.g3.e1) JOIN pm1.g4 ON pm1.g3.e1=pm1.g4.e1) ON pm1.g1.e1=pm1.g4.e1", //$NON-NLS-1$
metadata,
new String[] { "SELECT g_0.e1 FROM pm1.g1 AS g_0, pm1.g2 AS g_1, pm1.g3 AS g_2, pm1.g4 AS g_3 WHERE (g_1.e1 = g_2.e1) AND (g_2.e1 = g_3.e1) AND (g_0.e1 = g_3.e1)"}, ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$
@@ -2243,7 +2142,7 @@
}
@Test public void testPushSelectDistinct() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan("SELECT DISTINCT e1 FROM pm3.g1", //$NON-NLS-1$
metadata,
new String[] { "SELECT DISTINCT e1 FROM pm3.g1"} ); //$NON-NLS-1$
@@ -2258,7 +2157,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(
"SELECT e1 FROM pm1.g1 WHERE upper(e1) = 'X'", //$NON-NLS-1$
@@ -2280,7 +2179,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(
"SELECT lower(e1) FROM pm1.g1 WHERE upper(e1) = 'X'", //$NON-NLS-1$
@@ -2302,7 +2201,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(
"SELECT lower(e1), upper(e1), e2 FROM pm1.g1 WHERE upper(e1) = 'X'", //$NON-NLS-1$
@@ -2323,7 +2222,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(
"SELECT lower(e1), upper(e1) FROM pm1.g1 WHERE upper(e1) = 'X'", //$NON-NLS-1$
@@ -2360,7 +2259,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(
"SELECT x FROM (SELECT lower(e1) AS x, upper(e1) AS y FROM pm1.g1 WHERE upper(e1) = 'X') AS z", //$NON-NLS-1$
@@ -2382,7 +2281,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(
"SELECT y, e, x FROM (SELECT lower(e1) AS x, upper(e1) AS y, 5 as z, e1 AS e FROM pm1.g1 WHERE upper(e1) = 'X') AS w", //$NON-NLS-1$
@@ -2402,7 +2301,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(
"SELECT upper(lower(e1)) FROM pm1.g1", //$NON-NLS-1$
@@ -2440,7 +2339,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(
"SELECT e1, lower(e1) FROM pm1.g1 WHERE upper(e1) = 'X' ORDER BY e1", //$NON-NLS-1$
@@ -2464,7 +2363,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(
"SELECT e1, lower(e1) AS x FROM pm1.g1 WHERE upper(e1) = 'X' ORDER BY x", //$NON-NLS-1$
@@ -2488,7 +2387,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(
"SELECT e1, x FROM (SELECT e1, lower(e1) AS x FROM pm1.g1 WHERE upper(e1) = 'X') AS z ORDER BY x", //$NON-NLS-1$
@@ -2510,7 +2409,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(
"SELECT pm1.g1.e1, pm1.g2.e3 FROM pm1.g1, pm1.g2 WHERE pm1.g1.e1 = convert(pm1.g2.e2, string) AND upper(pm1.g1.e1) = 'X'", //$NON-NLS-1$
@@ -2532,7 +2431,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(
"SELECT pm1.g1.e1, pm1.g2.e3 FROM pm1.g1, pm1.g2, pm1.g3 WHERE pm1.g1.e1 = convert(pm1.g2.e2, string) AND pm1.g1.e1 = concat(pm1.g3.e1, 'a') AND upper(pm1.g1.e1) = 'X'", //$NON-NLS-1$
@@ -2570,7 +2469,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
// Add join capability to pm1
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(
"SELECT pm1.g1.e1, pm1.g2.e3 FROM pm1.g1, pm1.g2, (SELECT e1 AS x FROM pm1.g3) AS g WHERE pm1.g1.e1 = convert(pm1.g2.e2, string) AND pm1.g1.e1 = concat(g.x, 'a') AND upper(pm1.g1.e1) = 'X'", //$NON-NLS-1$
@@ -2607,7 +2506,7 @@
caps.setFunctionSupport("convert", true); //$NON-NLS-1$
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = helpPlan(
"SELECT StringCol AS E " + //$NON-NLS-1$
@@ -2638,7 +2537,7 @@
}
@Test public void testDefect9827() {
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = helpPlan("SELECT intkey, c FROM (SELECT DISTINCT b.intkey, b.intnum, a.stringkey AS c FROM bqt1.smalla AS a, bqt1.smallb AS b WHERE a.INTKEY = b.INTKEY) AS x ORDER BY x.intkey", metadata, //$NON-NLS-1$
new String[] {"SELECT DISTINCT b.intkey, b.intnum, a.stringkey FROM bqt1.smalla AS a, bqt1.smallb AS b WHERE a.INTKEY = b.INTKEY"} ); //$NON-NLS-1$
@@ -2853,7 +2752,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
capFinder.addCapabilities("pm2", new BasicSourceCapabilities()); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT ltrim(e1) FROM pm1.g2)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT ltrim(e1) FROM pm1.g2)", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
null, capFinder,
new String[] { "SELECT e1 FROM pm1.g1 WHERE e1 IN (SELECT ltrim(e1) FROM pm1.g2)" }, SHOULD_SUCCEED); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
@@ -2872,7 +2771,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
capFinder.addCapabilities("pm2", new BasicSourceCapabilities()); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT ltrim(e1) as m FROM pm1.g2)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT ltrim(e1) as m FROM pm1.g2)", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
null, capFinder,
new String[] { "SELECT e1 FROM pm1.g1 WHERE e1 IN (SELECT ltrim(e1) FROM pm1.g2)" }, SHOULD_SUCCEED); //$NON-NLS-1$
@@ -2896,7 +2795,7 @@
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder,
new String[] { "SELECT g1__1.e1 FROM pm1.g1 AS g1__1 WHERE g1__1.e2 = (SELECT MAX(pm1.g1.e2) FROM pm1.g1 WHERE pm1.g1.e1 = g1__1.e1)" }, SHOULD_SUCCEED); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
@@ -2919,7 +2818,7 @@
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(sql, metadata,
null, capFinder,
@@ -2945,7 +2844,7 @@
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(sql, metadata,
null, capFinder,
@@ -2954,7 +2853,7 @@
}
/** Should use merge join since neither access node is "strong" - order by's pushed to source */
- @Test public void testUseMergeJoin3(){
+ @Test public void testUseMergeJoin3() throws Exception{
// Create query
String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm1.g2 WHERE pm1.g1.e1 = pm1.g2.e1";//$NON-NLS-1$
@@ -2965,9 +2864,8 @@
caps.setCapabilitySupport(Capability.QUERY_ORDERBY, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- FakeMetadataObject g1 = metadata.getStore().findObject("pm1.g1", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g1.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1));
+ QueryMetadataInterface metadata = RealMetadataFactory.example1();
+ RealMetadataFactory.setCardinality("pm1.g1", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1, metadata);
ProcessorPlan plan = helpPlan(sql, metadata,
null, capFinder,
@@ -2991,7 +2889,7 @@
}
/** Model supports order by, should be pushed to the source */
- @Test public void testUseMergeJoin4(){
+ @Test public void testUseMergeJoin4() throws Exception {
// Create query
String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm1.g2 WHERE pm1.g1.e1 = pm1.g2.e1";//$NON-NLS-1$
@@ -3002,11 +2900,9 @@
caps.setCapabilitySupport(Capability.QUERY_ORDERBY, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- FakeMetadataObject g1 = metadata.getStore().findObject("pm1.g1", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g1.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 500));
- FakeMetadataObject g2 = metadata.getStore().findObject("pm1.g2", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g2.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000));
+ QueryMetadataInterface metadata = RealMetadataFactory.example1();
+ RealMetadataFactory.setCardinality("pm1.g1", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 500, metadata);
+ RealMetadataFactory.setCardinality("pm1.g2", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata);
ProcessorPlan plan = helpPlan(sql, metadata,
null, capFinder,
@@ -3040,7 +2936,7 @@
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(sql, metadata,
null, capFinder,
@@ -3064,7 +2960,7 @@
}
/** one side of join supports order by, the other doesn't*/
- @Test public void testUseMergeJoin7(){
+ @Test public void testUseMergeJoin7() throws Exception {
// Create query
String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm2.g2 WHERE pm1.g1.e1 = pm2.g2.e1";//$NON-NLS-1$
@@ -3077,11 +2973,9 @@
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- FakeMetadataObject g1 = metadata.getStore().findObject("pm1.g1", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g1.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 500));
- FakeMetadataObject g2 = metadata.getStore().findObject("pm2.g2", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g2.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000));
+ QueryMetadataInterface metadata = RealMetadataFactory.example1();
+ RealMetadataFactory.setCardinality("pm1.g1", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 500, metadata);
+ RealMetadataFactory.setCardinality("pm1.g2", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata);
ProcessorPlan plan = helpPlan(sql, metadata,
null, capFinder,
@@ -3105,7 +2999,7 @@
}
/** reverse of testUseMergeJoin7 */
- @Test public void testUseMergeJoin7a(){
+ @Test public void testUseMergeJoin7a() throws Exception {
// Create query
String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm2.g2 WHERE pm1.g1.e1 = pm2.g2.e1";//$NON-NLS-1$
@@ -3118,11 +3012,9 @@
caps.setCapabilitySupport(Capability.QUERY_ORDERBY, true);
capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- FakeMetadataObject g1 = metadata.getStore().findObject("pm1.g1", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g1.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 500));
- FakeMetadataObject g2 = metadata.getStore().findObject("pm2.g2", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g2.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000));
+ QueryMetadataInterface metadata = RealMetadataFactory.example1();
+ RealMetadataFactory.setCardinality("pm1.g1", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 500, metadata);
+ RealMetadataFactory.setCardinality("pm1.g2", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata);
ProcessorPlan plan = helpPlan(sql, metadata,
null, capFinder,
@@ -3146,7 +3038,7 @@
}
/** function on one side of join should prevent order by from being pushed down*/
- @Test public void testUseMergeJoin8(){
+ @Test public void testUseMergeJoin8() throws Exception {
// Create query
String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm2.g2 WHERE concat(pm1.g1.e1, 'x') = pm2.g2.e1";//$NON-NLS-1$
@@ -3160,11 +3052,9 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- FakeMetadataObject g1 = metadata.getStore().findObject("pm1.g1", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g1.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 500));
- FakeMetadataObject g2 = metadata.getStore().findObject("pm2.g2", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g2.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000));
+ QueryMetadataInterface metadata = RealMetadataFactory.example1();
+ RealMetadataFactory.setCardinality("pm1.g1", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 500, metadata);
+ RealMetadataFactory.setCardinality("pm1.g2", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata);
ProcessorPlan plan = helpPlan(sql, metadata,
null, capFinder,
@@ -3188,7 +3078,7 @@
}
/** Model supports order by, functions in join criteria */
- @Test public void testUseMergeJoin9(){
+ @Test public void testUseMergeJoin9() throws Exception {
// Create query
String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm1.g2 WHERE concat(pm1.g1.e1, 'x') = concat(pm1.g2.e1, 'x')";//$NON-NLS-1$
@@ -3201,11 +3091,9 @@
caps.setCapabilitySupport(Capability.QUERY_ORDERBY, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- FakeMetadataObject g1 = metadata.getStore().findObject("pm1.g1", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g1.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 500));
- FakeMetadataObject g2 = metadata.getStore().findObject("pm1.g2", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g2.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000));
+ QueryMetadataInterface metadata = RealMetadataFactory.example1();
+ RealMetadataFactory.setCardinality("pm1.g1", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 500, metadata);
+ RealMetadataFactory.setCardinality("pm1.g2", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata);
ProcessorPlan plan = helpPlan(sql, metadata,
null, capFinder,
@@ -3229,7 +3117,7 @@
}
/** should be one dependent join */
- @Test public void testMultiMergeJoin1(){
+ @Test public void testMultiMergeJoin1() throws Exception {
// Create query
String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm1.g2, pm1.g3 WHERE pm1.g1.e1 = pm1.g2.e1 AND pm1.g2.e1 = pm1.g3.e1";//$NON-NLS-1$
@@ -3241,13 +3129,10 @@
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_COUNT, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- FakeMetadataObject g1 = metadata.getStore().findObject("pm1.g1", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g1.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + BufferManager.DEFAULT_PROCESSOR_BATCH_SIZE / 4));
- FakeMetadataObject g2 = metadata.getStore().findObject("pm1.g2", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g2.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + BufferManager.DEFAULT_PROCESSOR_BATCH_SIZE));
- FakeMetadataObject g3 = metadata.getStore().findObject("pm1.g3", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g3.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + BufferManager.DEFAULT_PROCESSOR_BATCH_SIZE));
+ QueryMetadataInterface metadata = RealMetadataFactory.example1();
+ RealMetadataFactory.setCardinality("pm1.g1", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + BufferManager.DEFAULT_PROCESSOR_BATCH_SIZE / 4, metadata);
+ RealMetadataFactory.setCardinality("pm1.g2", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + BufferManager.DEFAULT_PROCESSOR_BATCH_SIZE, metadata);
+ RealMetadataFactory.setCardinality("pm1.g3", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + BufferManager.DEFAULT_PROCESSOR_BATCH_SIZE, metadata);
ProcessorPlan plan = helpPlan(sql, metadata,
null, capFinder,
@@ -3282,7 +3167,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] { "SELECT BQT1.SmallA.IntKey FROM BQT1.SmallA ORDER BY BQT1.SmallA.IntKey", //$NON-NLS-1$
"SELECT BQT2.SmallB.IntKey FROM BQT2.SmallB ORDER BY BQT2.SmallB.IntKey" }, SHOULD_SUCCEED); //$NON-NLS-1$
@@ -3317,7 +3202,7 @@
caps.setSourceProperty(Capability.MAX_IN_CRITERIA_SIZE, new Integer(1000));
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = helpPlan(sql, metadata,
null, capFinder,
@@ -3342,7 +3227,7 @@
}
@Test public void testNoFrom() {
- ProcessorPlan plan = helpPlan("SELECT 1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT 1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {} );
checkNodeTypes(plan, new int[] {
@@ -3363,7 +3248,7 @@
});
}
- @Test public void testINCriteria_defect10718(){
+ @Test public void testINCriteria_defect10718() throws Exception {
// Create query
String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm1.g2 WHERE pm1.g1.e1 = pm1.g2.e1";//$NON-NLS-1$
@@ -3378,11 +3263,9 @@
caps.setSourceProperty(Capability.MAX_IN_CRITERIA_SIZE, new Integer(1000));
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- FakeMetadataObject g1 = metadata.getStore().findObject("pm1.g1", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g1.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1));
- FakeMetadataObject g2 = metadata.getStore().findObject("pm1.g2", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g2.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000));
+ QueryMetadataInterface metadata = RealMetadataFactory.example1();
+ RealMetadataFactory.setCardinality("pm1.g1", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY -1, metadata);
+ RealMetadataFactory.setCardinality("pm1.g2", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata);
ProcessorPlan plan = helpPlan(sql, metadata,
null, capFinder,
@@ -3406,7 +3289,7 @@
}
@Test public void testDefect10711(){
- ProcessorPlan plan = helpPlan("SELECT * from vm1.g1a as X", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT * from vm1.g1a as X", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1"} ); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
@@ -3415,7 +3298,7 @@
// SELECT 5, SUM(IntKey) FROM BQT1.SmallA
@Test public void testAggregateNoGroupByWithExpression() {
- ProcessorPlan plan = helpPlan("SELECT 5, SUM(IntKey) FROM BQT1.SmallA", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT 5, SUM(IntKey) FROM BQT1.SmallA", RealMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
new String[] { "SELECT IntKey FROM BQT1.SmallA" }); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
@@ -3439,7 +3322,7 @@
/** defect 11630 - note that the lookup function is not pushed down, it will actually be evaluated before being sent to the connector */
@Test public void testLookupFunction() {
- ProcessorPlan plan = helpPlan("SELECT e1 FROM pm1.g2 WHERE LOOKUP('pm1.g1','e1', 'e2', 1) IS NULL", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT e1 FROM pm1.g2 WHERE LOOKUP('pm1.g1','e1', 'e2', 1) IS NULL", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT e1 FROM pm1.g2 WHERE LOOKUP('pm1.g1', 'e1', 'e2', 1) IS NULL" }); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
@@ -3449,7 +3332,7 @@
/** case 5213 - note here that the lookup cannot be pushed down since it is dependent upon an element symbol*/
@Test public void testLookupFunction2() throws Exception {
- ProcessorPlan plan = helpPlan("SELECT e1 FROM pm1.g2 WHERE LOOKUP('pm1.g1','e1', 'e2', e2) IS NULL", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT e1 FROM pm1.g2 WHERE LOOKUP('pm1.g1','e1', 'e2', e2) IS NULL", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT g_0.e2, g_0.e1 FROM pm1.g2 AS g_0" }, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
@@ -3473,7 +3356,7 @@
/** defect 21965 */
@Test public void testLookupFunctionInSelect() {
- ProcessorPlan plan = helpPlan("SELECT e1, LOOKUP('pm1.g1','e1', 'e2', 1) FROM pm1.g2", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT e1, LOOKUP('pm1.g1','e1', 'e2', 1) FROM pm1.g2", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT e1, LOOKUP('pm1.g1','e1', 'e2', 1) FROM pm1.g2" }); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
@@ -3481,7 +3364,7 @@
// SELECT * FROM (SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT DISTINCT IntNum FROM BQT1.SmallA) AS x WHERE IntKey = 0
@Test public void testCase1649() {
- ProcessorPlan plan = helpPlan("SELECT * FROM (SELECT DISTINCT IntKey FROM BQT1.SmallA UNION ALL SELECT IntNum FROM BQT1.SmallA) AS x WHERE IntKey = 0", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT * FROM (SELECT DISTINCT IntKey FROM BQT1.SmallA UNION ALL SELECT IntNum FROM BQT1.SmallA) AS x WHERE IntKey = 0", RealMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
new String[] { "SELECT DISTINCT IntKey FROM BQT1.SmallA WHERE IntKey = 0", "SELECT IntNum FROM BQT1.SmallA WHERE IntNum = 0" }); //$NON-NLS-1$ //$NON-NLS-2$
checkNodeTypes(plan, new int[] {
@@ -3504,7 +3387,7 @@
// SELECT * FROM (SELECT IntKey a, IntNum b FROM BQT1.SmallA UNION ALL SELECT Intkey, Intkey FROM BQT1.SmallA) as x WHERE b = 0
@Test public void testCase1727_1() {
- ProcessorPlan plan = helpPlan("SELECT * FROM (SELECT IntKey a, IntNum b FROM BQT1.SmallA UNION ALL SELECT Intkey, Intkey FROM BQT1.SmallA) as x WHERE b = 0", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT * FROM (SELECT IntKey a, IntNum b FROM BQT1.SmallA UNION ALL SELECT Intkey, Intkey FROM BQT1.SmallA) as x WHERE b = 0", RealMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
new String[] {
"SELECT IntKey, IntNum FROM BQT1.SmallA WHERE IntNum = 0", //$NON-NLS-1$
"SELECT IntKey FROM BQT1.SmallA WHERE IntKey = 0" }); //$NON-NLS-1$
@@ -3529,7 +3412,7 @@
// SELECT * FROM (SELECT IntKey a, IntNum b FROM BQT1.SmallA UNION ALL SELECT Intkey, Intkey FROM BQT1.SmallA) as x WHERE b = 0
@Test public void testCase1727_2() {
- ProcessorPlan plan = helpPlan("SELECT * FROM (SELECT IntKey a, IntKey b FROM BQT1.SmallA UNION ALL SELECT IntKey, IntNum FROM BQT1.SmallA) as x WHERE b = 0", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT * FROM (SELECT IntKey a, IntKey b FROM BQT1.SmallA UNION ALL SELECT IntKey, IntNum FROM BQT1.SmallA) as x WHERE b = 0", RealMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
new String[] {
"SELECT IntKey, IntNum FROM BQT1.SmallA WHERE IntNum = 0", //$NON-NLS-1$
"SELECT IntKey FROM BQT1.SmallA WHERE IntKey = 0" }); //$NON-NLS-1$
@@ -3553,7 +3436,7 @@
}
@Test public void testCountStarOverSelectDistinct() {
- ProcessorPlan plan = helpPlan("SELECT COUNT(*) FROM (SELECT DISTINCT IntNum, Intkey FROM bqt1.smalla) AS x", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT COUNT(*) FROM (SELECT DISTINCT IntNum, Intkey FROM bqt1.smalla) AS x", RealMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
new String[] {
"SELECT DISTINCT IntNum, Intkey FROM bqt1.smalla" }); //$NON-NLS-1$
@@ -3577,7 +3460,7 @@
//virtual group with two elements. One selectable, one not
@Test public void testVirtualGroup1() {
- ProcessorPlan plan = helpPlan("select e2 from vm1.g35", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("select e2 from vm1.g35", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT e2 FROM pm1.g1" } ); //$NON-NLS-1$
checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
@@ -3585,7 +3468,7 @@
@Test public void testBQT9500_126() throws Exception {
String sql = "SELECT IntKey, LongNum, expr FROM (SELECT IntKey, LongNum, concat(LongNum, 'abc') FROM BQT2.SmallA ) AS x ORDER BY IntKey"; //$NON-NLS-1$
- ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
new String[] {
"SELECT g_0.IntKey AS c_0, g_0.LongNum AS c_1 FROM BQT2.SmallA AS g_0 ORDER BY c_0" }, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
@@ -3638,7 +3521,7 @@
expectedSql = new String[] { "SELECT IntKey FROM BQT1.SmallA", "SELECT IntKey FROM BQT1.SmallB" }; //$NON-NLS-1$//$NON-NLS-2$
}
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = helpPlan(sql, metadata,
null, capFinder, expectedSql, SHOULD_SUCCEED);
@@ -3715,7 +3598,7 @@
caps.setCapabilitySupport(Capability.QUERY_SET_ORDER_BY, false);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("SELECT 1 UNION ALL SELECT 2", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT 1 UNION ALL SELECT 2", RealMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
null, capFinder, new String[] {}, SHOULD_SUCCEED);
checkNodeTypes(plan, new int[] {
@@ -3745,7 +3628,7 @@
caps.setCapabilitySupport(Capability.QUERY_SET_ORDER_BY, false);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("SELECT 1 UNION ALL SELECT IntKey FROM BQT1.SmallA", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT 1 UNION ALL SELECT IntKey FROM BQT1.SmallA", RealMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
null, capFinder, new String[] {"SELECT IntKey FROM BQT1.SmallA"}, SHOULD_SUCCEED); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
@@ -3775,7 +3658,7 @@
caps.setCapabilitySupport(Capability.QUERY_SET_ORDER_BY, false);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT 1", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT 1", RealMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
null, capFinder, new String[] {"SELECT IntKey FROM BQT1.SmallA"}, SHOULD_SUCCEED); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
@@ -3805,7 +3688,7 @@
caps.setCapabilitySupport(Capability.QUERY_SET_ORDER_BY, false);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT IntKey FROM BQT1.SmallB UNION ALL SELECT IntKey FROM BQT1.SmallA", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT IntKey FROM BQT1.SmallB UNION ALL SELECT IntKey FROM BQT1.SmallA", RealMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
null, capFinder,
new String[] {"SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT IntKey FROM BQT1.SmallB UNION ALL SELECT IntKey FROM BQT1.SmallA"}, //$NON-NLS-1$
SHOULD_SUCCEED);
@@ -3823,7 +3706,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT IntKey FROM BQT1.SmallB UNION ALL SELECT IntKey FROM BQT2.SmallA", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT IntKey FROM BQT1.SmallB UNION ALL SELECT IntKey FROM BQT2.SmallA", RealMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
null, capFinder,
new String[] {"SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT IntKey FROM BQT1.SmallB", "SELECT IntKey FROM BQT2.SmallA"}, //$NON-NLS-1$ //$NON-NLS-2$
SHOULD_SUCCEED);
@@ -3855,7 +3738,7 @@
caps.setCapabilitySupport(Capability.QUERY_SET_ORDER_BY, false);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("SELECT IntKey FROM BQT1.SmallA UNION SELECT IntKey FROM BQT1.SmallB UNION SELECT IntKey FROM BQT1.SmallA", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT IntKey FROM BQT1.SmallA UNION SELECT IntKey FROM BQT1.SmallB UNION SELECT IntKey FROM BQT1.SmallA", RealMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
null, capFinder,
new String[] {"SELECT IntKey FROM BQT1.SmallA UNION SELECT IntKey FROM BQT1.SmallB UNION SELECT IntKey FROM BQT1.SmallA"}, //$NON-NLS-1$
SHOULD_SUCCEED);
@@ -3872,7 +3755,7 @@
caps.setCapabilitySupport(Capability.QUERY_SET_ORDER_BY, false);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("SELECT COUNT(*) FROM (SELECT IntKey FROM BQT1.SmallA UNION SELECT IntKey FROM BQT1.SmallB) AS x", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT COUNT(*) FROM (SELECT IntKey FROM BQT1.SmallA UNION SELECT IntKey FROM BQT1.SmallB) AS x", RealMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
null, capFinder,
new String[] {"SELECT IntKey FROM BQT1.SmallA UNION SELECT IntKey FROM BQT1.SmallB"}, //$NON-NLS-1$
SHOULD_SUCCEED);
@@ -3906,7 +3789,7 @@
caps.setFunctionSupport("+", true); //$NON-NLS-1$
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("SELECT IntKey+2, StringKey AS x FROM BQT1.SmallA UNION SELECT IntKey, StringKey FROM BQT1.SmallB", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT IntKey+2, StringKey AS x FROM BQT1.SmallA UNION SELECT IntKey, StringKey FROM BQT1.SmallB", RealMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
null, capFinder,
new String[] {"SELECT (IntKey + 2), StringKey AS x FROM BQT1.SmallA UNION SELECT IntKey, StringKey FROM BQT1.SmallB"}, //$NON-NLS-1$
SHOULD_SUCCEED);
@@ -3925,7 +3808,7 @@
caps.setFunctionSupport("+", true); //$NON-NLS-1$
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("(SELECT IntKey FROM BQT1.SmallA ORDER BY IntKey) UNION ALL SELECT IntKey FROM BQT1.SmallB", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("(SELECT IntKey FROM BQT1.SmallA ORDER BY IntKey) UNION ALL SELECT IntKey FROM BQT1.SmallB", RealMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
null, capFinder,
new String[] {"SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT IntKey FROM BQT1.SmallB"}, //$NON-NLS-1$
SHOULD_SUCCEED);
@@ -3944,7 +3827,7 @@
caps.setCapabilitySupport(Capability.QUERY_SET_ORDER_BY, false);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = helpPlan("SELECT DISTINCT IntKey FROM BQT1.SmallA UNION ALL SELECT IntKey FROM BQT1.SmallB", metadata, //$NON-NLS-1$
null, capFinder,
@@ -3965,7 +3848,7 @@
caps.setFunctionSupport("+", true); //$NON-NLS-1$
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("SELECT x FROM (SELECT IntKey+2, StringKey AS x FROM BQT1.SmallA UNION SELECT IntKey, StringKey FROM BQT1.SmallB) AS g", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT x FROM (SELECT IntKey+2, StringKey AS x FROM BQT1.SmallA UNION SELECT IntKey, StringKey FROM BQT1.SmallB) AS g", RealMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
null, capFinder,
new String[] {"SELECT (IntKey + 2), StringKey AS x FROM BQT1.SmallA UNION SELECT IntKey, StringKey FROM BQT1.SmallB"}, //$NON-NLS-1$
SHOULD_SUCCEED);
@@ -3998,7 +3881,7 @@
caps.setFunctionSupport("+", true); //$NON-NLS-1$
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("SELECT x FROM (SELECT IntKey+2, StringKey AS x FROM BQT1.SmallA UNION ALL SELECT IntKey, StringKey FROM BQT1.SmallB) AS g", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT x FROM (SELECT IntKey+2, StringKey AS x FROM BQT1.SmallA UNION ALL SELECT IntKey, StringKey FROM BQT1.SmallB) AS g", RealMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
null, capFinder,
new String[] {"SELECT StringKey AS x FROM BQT1.SmallA UNION ALL SELECT StringKey FROM BQT1.SmallB"}, //$NON-NLS-1$
SHOULD_SUCCEED);
@@ -4017,7 +3900,7 @@
caps.setFunctionSupport("convert", true); //$NON-NLS-1$
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("SELECT * FROM vm1.g4", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT * FROM vm1.g4", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
null, capFinder,
new String[] {"SELECT e1 FROM pm1.g1 UNION ALL SELECT convert(e2, string) FROM pm1.g2"}, //$NON-NLS-1$
SHOULD_SUCCEED);
@@ -4034,7 +3917,7 @@
caps.setCapabilitySupport(Capability.QUERY_SET_ORDER_BY, true);
capFinder.addCapabilities("pm3", caps); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("SELECT e2 FROM vm1.g17", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT e2 FROM vm1.g17", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
null, capFinder,
new String[] {"SELECT pm3.g1.e2 FROM pm3.g1 UNION ALL SELECT pm3.g2.e2 FROM pm3.g2"}, //$NON-NLS-1$
SHOULD_SUCCEED);
@@ -4052,7 +3935,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
ProcessorPlan plan = helpPlan("SELECT * FROM (SELECT intkey, 5 FROM BQT1.SmallA UNION ALL SELECT intnum, 10 FROM bqt1.smalla) AS x", //$NON-NLS-1$
- FakeMetadataFactory.exampleBQTCached(),
+ RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] {"SELECT intkey FROM BQT1.SmallA", "SELECT IntNum FROM bqt1.smalla"}, //$NON-NLS-1$ //$NON-NLS-2$
SHOULD_SUCCEED);
@@ -4087,7 +3970,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
ProcessorPlan plan = helpPlan("SELECT * FROM (SELECT intkey, 5 FROM BQT1.SmallA UNION ALL SELECT intnum, 10 FROM bqt1.smalla) AS x", //$NON-NLS-1$
- FakeMetadataFactory.exampleBQTCached(),
+ RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] {"SELECT intkey, 5 FROM BQT1.SmallA UNION ALL SELECT IntNum, 10 FROM bqt1.smalla"}, //$NON-NLS-1$
SHOULD_SUCCEED);
@@ -4104,7 +3987,7 @@
caps.setCapabilitySupport(Capability.QUERY_SEARCHED_CASE, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(
"SELECT CASE WHEN e1 = 'a' THEN 10 ELSE 0 END FROM pm1.g1", //$NON-NLS-1$
@@ -4123,7 +4006,7 @@
caps.setCapabilitySupport(Capability.QUERY_CASE, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(
"SELECT CASE e1 WHEN 'a' THEN 10 ELSE (e2+0) END FROM pm1.g1", //$NON-NLS-1$
@@ -4158,7 +4041,7 @@
caps.setCapabilitySupport(Capability.QUERY_SEARCHED_CASE, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(
"SELECT CASE WHEN e1 = 'a' THEN 10 ELSE 0 END FROM pm1.g1", //$NON-NLS-1$
@@ -4177,7 +4060,7 @@
caps.setCapabilitySupport(Capability.QUERY_SEARCHED_CASE, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(
"SELECT CASE WHEN e1 = 'a' THEN 10 ELSE (e2+0) END FROM pm1.g1", //$NON-NLS-1$
@@ -4214,9 +4097,7 @@
caps.setFunctionSupport("xyz", true); //$NON-NLS-1$
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FunctionLibrary funcLibrary = new FunctionLibrary(FakeMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new FakeFunctionMetadataSource()));
- FakeMetadataFacade metadata = new FakeMetadataFacade(FakeMetadataFactory.example1Cached().getStore(), funcLibrary);
-
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(
"SELECT e1 FROM pm1.g1 WHERE xyz() > 0", //$NON-NLS-1$
@@ -4230,7 +4111,7 @@
@Test public void testNoSourceQuery() {
ProcessorPlan plan = helpPlan("SELECT * FROM (select parsetimestamp(x,'yyyy-MM-dd') as c1 from (select '2004-10-20' as x) as y) as z " +//$NON-NLS-1$
- "WHERE c1= '2004-10-20 00:00:00.0'", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ "WHERE c1= '2004-10-20 00:00:00.0'", RealMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
new String[] { });
checkNodeTypes(plan, new int[] {
@@ -4263,9 +4144,9 @@
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQT();
- FakeMetadataFactory.setCardinality("bqt1.smallb", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata); //$NON-NLS-1$
- FakeMetadataFactory.setCardinality("bqt1.smalla", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1, metadata); //$NON-NLS-1$
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQT();
+ RealMetadataFactory.setCardinality("bqt1.smallb", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata); //$NON-NLS-1$
+ RealMetadataFactory.setCardinality("bqt1.smalla", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1, metadata); //$NON-NLS-1$
ProcessorPlan plan = helpPlan(
"SELECT BQT1.SmallA.IntKey FROM BQT1.SmallA, BQT1.SmallB WHERE (BQT1.SmallA.IntKey = lookup('BQT1.SmallB', 'IntKey', 'StringKey', BQT1.SmallB.StringKey)) AND (BQT1.SmallA.IntKey = 1)", //$NON-NLS-1$
@@ -4305,9 +4186,9 @@
caps.setSourceProperty(Capability.MAX_IN_CRITERIA_SIZE, new Integer(1000));
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQT();
- FakeMetadataFactory.setCardinality("bqt1.mediumb", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata); //$NON-NLS-1$
- FakeMetadataFactory.setCardinality("bqt1.smalla", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1, metadata); //$NON-NLS-1$
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQT();
+ RealMetadataFactory.setCardinality("bqt1.mediumb", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata); //$NON-NLS-1$
+ RealMetadataFactory.setCardinality("bqt1.smalla", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1, metadata); //$NON-NLS-1$
ProcessorPlan plan = helpPlan(
"SELECT BQT1.SmallA.IntKey, BQT1.MediumB.IntKey FROM BQT1.SmallA LEFT OUTER JOIN BQT1.MediumB ON BQT1.SmallA.IntKey = lookup('BQT1.MediumB', 'IntKey', 'StringKey', BQT1.MediumB.StringKey)", //$NON-NLS-1$
@@ -4347,9 +4228,9 @@
caps.setSourceProperty(Capability.MAX_IN_CRITERIA_SIZE, new Integer(1000));
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQT();
- FakeMetadataFactory.setCardinality("bqt1.mediumb", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata); //$NON-NLS-1$
- FakeMetadataFactory.setCardinality("bqt1.smalla", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1, metadata); //$NON-NLS-1$
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQT();
+ RealMetadataFactory.setCardinality("bqt1.mediumb", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata); //$NON-NLS-1$
+ RealMetadataFactory.setCardinality("bqt1.smalla", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1, metadata); //$NON-NLS-1$
ProcessorPlan plan = helpPlan(
"SELECT BQT1.SmallA.IntKey, BQT1.MediumB.IntKey FROM BQT1.MediumB RIGHT OUTER JOIN BQT1.SmallA ON BQT1.SmallA.IntKey = lookup('BQT1.MediumB', 'IntKey', 'StringKey',BQT1.MediumB.StringKey)", //$NON-NLS-1$
@@ -4401,7 +4282,7 @@
"(P.longnum > (SELECT AVG(LongNum) FROM bqt1.smallb WHERE bqt1.smallb.datevalue = O.datevalue))"; //$NON-NLS-1$
ProcessorPlan plan = helpPlan(sql,
- FakeMetadataFactory.exampleBQTCached(),
+ RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] {"SELECT g_1.longnum, g_2.datevalue, g_0.IntKEy, g_1.IntKEy, g_2.IntKey FROM bqt1.smalla AS g_0, bqt1.smallb AS g_1, bqt1.mediuma AS g_2 WHERE (g_0.StringKey = g_1.StringKey) AND (g_2.IntKey = g_0.IntKey) AND (g_0.IntNum > (SELECT SUM(g_3.IntNum) FROM bqt1.smalla AS g_3))"}, //$NON-NLS-1$
ComparisonMode.EXACT_COMMAND_STRING );
@@ -4440,7 +4321,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
ProcessorPlan plan = helpPlan(sql,
- FakeMetadataFactory.exampleBQTCached(),
+ RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] {"SELECT 1 AS c_0 FROM BQT1.SmallA AS a UNION ALL SELECT 1 AS c_0 FROM bqt1.smallb AS b"}, //$NON-NLS-1$
SHOULD_SUCCEED );
@@ -4479,7 +4360,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
ProcessorPlan plan = helpPlan(sql,
- FakeMetadataFactory.exampleBQTCached(),
+ RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] {"SELECT a.IntKey AS z FROM BQT1.SmallA AS a UNION ALL SELECT 0 FROM bqt1.smallb AS b"}, //$NON-NLS-1$
SHOULD_SUCCEED );
@@ -4518,7 +4399,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
ProcessorPlan plan = helpPlan(sql,
- FakeMetadataFactory.exampleBQTCached(),
+ RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] {"SELECT '' AS Code, IntKey AS ID FROM BQT1.SmallA UNION ALL SELECT stringkey, intkey FROM bqt1.smallb AS b"}, //$NON-NLS-1$
SHOULD_SUCCEED );
@@ -4556,7 +4437,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
ProcessorPlan plan = helpPlan(sql,
- FakeMetadataFactory.exampleBQTCached(),
+ RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] {"SELECT 1, 'ab' AS X FROM BQT1.SmallA WHERE intkey = 0 UNION ALL SELECT 2, 'Hello2' FROM BQT1.SmallA WHERE IntKey = 1 ORDER BY X DESC"}, //$NON-NLS-1$
SHOULD_SUCCEED );
@@ -4573,7 +4454,7 @@
String sql = "UPDATE BQT1.SmallA SET IntKey = IntKey + 1"; //$NON-NLS-1$
ProcessorPlan plan = helpPlan(sql,
- FakeMetadataFactory.exampleBQTCached(),
+ RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] {"UPDATE BQT1.SmallA SET IntKey = (IntKey + 1)"}, //$NON-NLS-1$
ComparisonMode.EXACT_COMMAND_STRING );
@@ -4595,7 +4476,7 @@
caps.setCapabilitySupport(Capability.QUERY_ORDERBY, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
String sql = "SELECT t.intkey FROM (SELECT a.IntKey FROM bqt1.smalla a left outer join bqt1.smallb b on a.intkey=b.intkey, bqt1.smalla x) as t full outer JOIN bqt1.smallb c on t.intkey = c.intkey"; //$NON-NLS-1$
@@ -4625,7 +4506,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
ProcessorPlan plan = helpPlan(sql,
- FakeMetadataFactory.exampleBQTCached(),
+ RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] {"SELECT g_2.intkey AS c_0, 'a' AS c_1 FROM BQT1.SmallA AS g_2 UNION ALL SELECT g_1.IntKey AS c_0, 'b' AS c_1 FROM BQT1.SmallA AS g_1 UNION ALL SELECT g_0.IntKey AS c_0, 'c' AS c_1 FROM BQT1.SmallA AS g_0"}, //$NON-NLS-1$
ComparisonMode.EXACT_COMMAND_STRING );
@@ -4645,7 +4526,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
RelationalPlan plan = (RelationalPlan)helpPlan(sql,
- FakeMetadataFactory.exampleBQTCached(),
+ RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] {"SELECT bqt1.smalla.datevalue, bqt1.smalla.intkey, bqt1.smalla.stringkey, bqt1.smalla.objectvalue FROM bqt1.smalla WHERE (bqt1.smalla.intkey = 46) AND (bqt1.smalla.stringkey = '46')"}, //$NON-NLS-1$
SHOULD_SUCCEED );
@@ -4708,7 +4589,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
ProcessorPlan plan = helpPlan(sql,
- FakeMetadataFactory.exampleBQTCached(),
+ RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] {"SELECT (SUM(IntKey) + 1) FROM BQT1.SmallA GROUP BY IntKey"}, //$NON-NLS-1$
SHOULD_SUCCEED );
@@ -4725,7 +4606,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
ProcessorPlan plan = helpPlan(sql,
- FakeMetadataFactory.exampleBQTCached(),
+ RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] {"SELECT IntKey FROM BQT1.SmallA"}, //$NON-NLS-1$
SHOULD_SUCCEED );
@@ -4757,7 +4638,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
ProcessorPlan plan = helpPlan(sql,
- FakeMetadataFactory.exampleBQTCached(),
+ RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] {"SELECT intkey FROM BQT1.SmallA"}, //$NON-NLS-1$
SHOULD_SUCCEED );
@@ -4794,7 +4675,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = helpPlan(sql,
metadata,
@@ -4837,7 +4718,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = helpPlan(sql,
metadata,
@@ -5120,7 +5001,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = helpPlan(sql,
metadata,
@@ -5171,7 +5052,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = helpPlan(sql,
metadata,
@@ -5231,7 +5112,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = helpPlan(sql,
metadata,
@@ -5344,7 +5225,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = helpPlan(sql,
metadata,
@@ -5404,7 +5285,7 @@
caps.setCapabilitySupport(Capability.QUERY_ORDERBY, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
String sql = "SELECT intkey, x FROM (select intkey, intkey x from bqt1.smalla) z ORDER BY x, intkey"; //$NON-NLS-1$
@@ -5435,7 +5316,7 @@
caps.setFunctionSupport("concat", true); //$NON-NLS-1$
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
String sql = "SELECT vqt.smallb.a12345 FROM vqt.smallb ORDER BY vqt.smallb.a12345"; //$NON-NLS-1$
@@ -5464,7 +5345,7 @@
caps.setFunctionSupport("concat", true); //$NON-NLS-1$
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
String sql = "SELECT CONCAT(bqt1.smalla.stringKey, bqt1.smalla.stringNum) as EXPR, bqt1.smalla.stringKey as EXPR_1 FROM bqt1.smalla ORDER BY EXPR, EXPR_1"; //$NON-NLS-1$
@@ -5493,7 +5374,7 @@
caps.setFunctionSupport("concat", true); //$NON-NLS-1$
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
String sql = "SELECT CONCAT(bqt1.smalla.stringKey, bqt1.smalla.stringNum), bqt1.smalla.stringKey as EXPR_1 FROM bqt1.smalla ORDER BY EXPR_1"; //$NON-NLS-1$
@@ -5523,7 +5404,7 @@
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
String sql = "SELECT b1.intkey from (bqt1.SmallA a1 cross join bqt1.smalla a2 cross join bqt1.mediuma b1) " + //$NON-NLS-1$
" left outer join bqt1.mediumb b2 on b1.intkey = b2.intkey"; //$NON-NLS-1$
@@ -5552,7 +5433,7 @@
caps.setFunctionSupport("concat", true); //$NON-NLS-1$
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
String sql = "SELECT bqt1.SmallA.intkey from (bqt1.SmallA inner join (" //$NON-NLS-1$
+ "SELECT BAD.intkey from bqt1.SmallB as BAD left outer join bqt1.MediumB on BAD.intkey = bqt1.MediumB.intkey) as X on bqt1.SmallA.intkey = X.intkey) inner join bqt1.MediumA on X.intkey = bqt1.MediumA.intkey"; //$NON-NLS-1$
@@ -5566,7 +5447,7 @@
@Test public void testCase3367() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- FakeMetadataFacade metadata = example1();
+ QueryMetadataInterface metadata = example1();
BasicSourceCapabilities caps = getTypicalCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_IN, true);
@@ -5588,7 +5469,7 @@
*/
@Test public void testCase3778() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
BasicSourceCapabilities caps = getTypicalCapabilities();
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
@@ -5618,7 +5499,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
String sql = "select bqt1.smalla.intkey from bqt1.smalla, bqt2.smalla, bqt2.smallb where bqt1.smalla.intkey = bqt2.smalla.intkey and bqt1.smalla.intkey = bqt2.smallb.intkey and bqt2.smalla.stringkey = bqt2.smallb.stringkey"; //$NON-NLS-1$
@@ -5647,7 +5528,7 @@
String sql = "select pm1.g1.e1, pm1.g1.e2 from pm1.g1 where e1 = convert((exec pm1.sq11(e2, 2)), integer)"; //$NON-NLS-1$
helpPlan(sql,
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null,
capFinder,
new String[] {
@@ -5666,7 +5547,7 @@
caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
String sql = "SELECT * from (select '1' as test, intkey from bqt2.smalla) foo, (select '2' as test, intkey from bqt2.smalla) foo2 where foo.intkey = foo2.intkey"; //$NON-NLS-1$
@@ -5688,7 +5569,7 @@
String sql = "select convert(e2+1,string) from pm1.g1 union all select e1 from pm1.g2";//$NON-NLS-1$
String[] expectedSql = new String[] {"SELECT e2 FROM pm1.g1", "SELECT e1 FROM pm1.g2"};//$NON-NLS-1$ //$NON-NLS-2$
- ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = helpPlan(sql, RealMetadataFactory.example1Cached(),
null, capFinder, expectedSql, SHOULD_SUCCEED);
checkNodeTypes(plan, new int[] {
@@ -5711,7 +5592,7 @@
}
@Test public void testCase3966() {
- ProcessorPlan plan = helpPlan("insert into vm1.g37 (e1, e2, e3, e4) values('test', 1, convert('true', boolean) , convert('12', double) )", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("insert into vm1.g37 (e1, e2, e3, e4) values('test', 1, convert('true', boolean) , convert('12', double) )", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {} );
checkNodeTypes(plan, new int[] {
@@ -5739,7 +5620,7 @@
String sql = "SELECT env('soap_host') AS HOST, intkey from bqt2.smalla"; //$NON-NLS-1$
- helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), null, new DefaultCapabilitiesFinder(),
+ helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, new DefaultCapabilitiesFinder(),
new String[] {"SELECT bqt2.smalla.intkey FROM bqt2.smalla"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
}
@@ -5750,7 +5631,7 @@
@Test public void testCase4265() throws Exception {
String sql = "SELECT X.intkey, Y.intkey FROM BQT1.SmallA X, BQT1.SmallA Y WHERE X.IntKey <> Y.IntKey and Y.IntKey = 1"; //$NON-NLS-1$
- ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
new String[] {
"SELECT g_0.intkey FROM BQT1.SmallA AS g_0 WHERE g_0.IntKey <> 1", //$NON-NLS-1$
"SELECT g_0.intkey FROM BQT1.SmallA AS g_0 WHERE g_0.IntKey = 1" }, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
@@ -5781,7 +5662,7 @@
@Test public void testCase4265ControlTest() throws Exception {
String sql = "SELECT X.intkey, Y.intkey FROM BQT1.SmallA X, BQT1.SmallA Y WHERE X.IntKey = Y.IntKey and Y.IntKey = 1"; //$NON-NLS-1$
- ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
new String[] {
"SELECT g_0.intkey FROM BQT1.SmallA AS g_0 WHERE g_0.IntKey = 1" }, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
@@ -5810,7 +5691,7 @@
@Test public void testExistsCriteriaInSelect() {
String sql = "select intkey, case when exists (select stringkey from bqt1.smallb) then 'nuge' end as a from vqt.smalla"; //$NON-NLS-1$
- ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
new String[] {
"SELECT BQT1.SmallA.IntKey FROM BQT1.SmallA" }); //$NON-NLS-1$
@@ -5839,7 +5720,7 @@
@Test public void testScalarSubQueryInSelect() {
String sql = "select intkey, case when (select stringkey from bqt1.smallb) is not null then 'nuge' end as a from vqt.smalla"; //$NON-NLS-1$
- ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
new String[] {
"SELECT BQT1.SmallA.IntKey FROM BQT1.SmallA" }); //$NON-NLS-1$
@@ -5864,7 +5745,7 @@
@Test public void testCase4263() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- FakeMetadataFacade metadata = example1();
+ QueryMetadataInterface metadata = example1();
BasicSourceCapabilities caps = getTypicalCapabilities();
caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
@@ -5883,7 +5764,7 @@
@Test public void testCase4263b() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- FakeMetadataFacade metadata = example1();
+ QueryMetadataInterface metadata = example1();
BasicSourceCapabilities caps = getTypicalCapabilities();
caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
@@ -5917,7 +5798,7 @@
@Test public void testCase4279() throws Exception {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- FakeMetadataFacade metadata = example1();
+ QueryMetadataInterface metadata = example1();
BasicSourceCapabilities caps = getTypicalCapabilities();
caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
@@ -5968,7 +5849,7 @@
caps.setFunctionSupport("concat", true); //$NON-NLS-1$
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = TestOptimizer.helpPlan(sql,
metadata,
@@ -5999,7 +5880,7 @@
caps.setFunctionSupport("+", true); //$NON-NLS-1$
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = TestOptimizer.helpPlan(sql,
metadata,
@@ -6054,7 +5935,7 @@
caps.setFunctionSupport("concat", true); //$NON-NLS-1$
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = TestOptimizer.helpPlan(sql,
metadata,
@@ -6084,7 +5965,7 @@
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("SELECT intkey FROM bqt1.smalla AS n WHERE intkey = (SELECT MAX(intkey) FROM bqt1.smallb AS s WHERE s.stringkey = concat(n.stringkey, 'a') )", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT intkey FROM bqt1.smalla AS n WHERE intkey = (SELECT MAX(intkey) FROM bqt1.smallb AS s WHERE s.stringkey = concat(n.stringkey, 'a') )", RealMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
null, capFinder,
new String[] { "SELECT intkey, n.stringkey FROM bqt1.smalla AS n" }, SHOULD_SUCCEED); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
@@ -6121,7 +6002,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = helpPlan(
"SELECT A.IntKey, B.IntKey FROM BQT1.SmallA A LEFT OUTER JOIN BQT2.MediumB B ON A.IntKey = B.IntKey", //$NON-NLS-1$
@@ -6152,7 +6033,7 @@
caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = helpPlan(
"SELECT 'a' as A FROM BQT1.SmallA A UNION select 'b' as B from BQT1.MediumB B", //$NON-NLS-1$
@@ -6170,7 +6051,7 @@
caps.setCapabilitySupport(Capability.QUERY_SELECT_DISTINCT, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
String sql = "select b from (select distinct booleanvalue b, intkey from bqt1.smalla) as x"; //$NON-NLS-1$
@@ -6206,7 +6087,7 @@
caps.setCapabilitySupport(Capability.QUERY_ORDERBY, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
String sql = "SELECT a.intkey as stringkey, b.stringkey as key2 from bqt1.smalla a, bqt1.smallb b where a.intkey = b.intkey order by stringkey"; //$NON-NLS-1$
@@ -6224,7 +6105,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
// Add join capability to pm1
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = helpPlan(
"SELECT intkey from bqt1.smalla WHERE stringkey = convert(objectvalue, string)", //$NON-NLS-1$
@@ -6259,7 +6140,7 @@
capFinder.addCapabilities("LOB", caps); //$NON-NLS-1$
// Add join capability to pm1
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = helpPlan(
"SELECT ClobValue from LOB.LobTbl WHERE convert(ClobValue, string) = ?", //$NON-NLS-1$
@@ -6289,7 +6170,7 @@
@Test public void testSelectIntoWithDistinct() throws Exception {
String sql = "select distinct e1 into #temp from pm1.g1"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(sql, metadata, new String[] {"SELECT DISTINCT g_0.e1 FROM pm1.g1 AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
//no txn required, since an interated insert is used
@@ -6303,7 +6184,7 @@
@Test public void testInsertQueryExpression() throws Exception {
String sql = "insert into pm1.g1 (e1) select e1 from pm1.g2"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(sql, metadata, new String[] {"SELECT g_0.e1 FROM pm1.g2 AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
//requires a txn, since an non pushdown/iterated insert is used
@@ -6319,7 +6200,7 @@
@Test public void testInsertQueryExpression1() throws Exception {
String sql = "insert into pm1.g1 (e1) select e1 || 1 from pm1.g2"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(sql, metadata, new String[] {"SELECT g_0.e1 FROM pm1.g2 AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
//requires a txn, since an non pushdown/iterated insert is used
@@ -6340,7 +6221,7 @@
caps.setCapabilitySupport(Capability.CRITERIA_EXISTS, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
String sql = "select pm1.g1.e1 from pm1.g1, (select * from pm1.g2) y where (pm1.g1.e1 = y.e1) and exists (select e2 from pm1.g2 where e1 = y.e1) and exists (select e3 from pm1.g2 where e1 = y.e1)"; //$NON-NLS-1$
@@ -6380,14 +6261,14 @@
String sql = "select count(*) from (select intkey from bqt1.smalla union all select intkey from bqt1.smallb) as a"; //$NON-NLS-1$
- ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), null, capFinder,
+ ProcessorPlan plan = helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder,
new String[] {"SELECT COUNT(*) FROM (SELECT 1 FROM bqt1.smalla UNION ALL SELECT 1 FROM bqt1.smallb) AS a"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
}
@Test public void testCase6181() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
@@ -6428,7 +6309,7 @@
@Test public void testCase6325() {
String sql = "select e1 into #temp from pm4.g1 where e1='1'"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(sql, metadata, new String[] {"SELECT e1 FROM pm4.g1 WHERE e1 = '1'"}); //$NON-NLS-1$
@@ -6446,7 +6327,7 @@
String sql = "select * from (SELECT 1+ SUM(intnum) AS s FROM bqt1.smalla) a WHERE a.s>10"; //$NON-NLS-1$
- ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), null, capFinder,
+ ProcessorPlan plan = helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder,
new String[] {"SELECT (1 + SUM(intnum)) FROM bqt1.smalla HAVING SUM(intnum) > 9"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
@@ -6460,7 +6341,7 @@
String sql = "select e1 from pm1.g1 except select e1 from pm1.g2"; //$NON-NLS-1$
- ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.example1Cached(), null, capFinder,
+ ProcessorPlan plan = helpPlan(sql, RealMetadataFactory.example1Cached(), null, capFinder,
new String[] {"SELECT g_1.e1 AS c_0 FROM pm1.g1 AS g_1 EXCEPT SELECT g_0.e1 AS c_0 FROM pm1.g2 AS g_0"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
@@ -6476,7 +6357,7 @@
// Create query
String sql = "select IntKey from bqt1.smalla where stringkey not like '2%'"; //$NON-NLS-1$
- ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), null, capFinder,
+ ProcessorPlan plan = helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder,
new String[] {"SELECT stringkey, IntKey FROM bqt1.smalla"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
@@ -6500,7 +6381,7 @@
@Test public void testCopyCriteriaWithIsNull() {
String sql = "select * from (select a.intnum, a.intkey y, b.intkey from bqt1.smalla a, bqt2.smalla b where a.intkey = b.intkey) x where intkey is null"; //$NON-NLS-1$
- helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), new String[] {});
+ helpPlan(sql, RealMetadataFactory.exampleBQTCached(), new String[] {});
}
/**
@@ -6513,7 +6394,7 @@
* SELECT * FROM pm1.g1 WHERE e2 BETWEEN 1 AND 2
*/
@Test public void testBetween() {
- helpPlan("select * from pm1.g1 where e2 between 1 and 2", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ helpPlan("select * from pm1.g1 where e2 between 1 and 2", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1 WHERE (e2 >= 1) AND (e2 <= 2)"} ); //$NON-NLS-1$
}
@@ -6534,7 +6415,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
helpPlan("select case when e2 between 3 and 5 then e2 else -1 end from pm1.g1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null, capFinder,
+ RealMetadataFactory.example1Cached(), null, capFinder,
new String[] { "SELECT CASE WHEN (e2 >= 3) AND (e2 <= 5) THEN e2 ELSE -1 END FROM pm1.g1"}, //$NON-NLS-1$
TestOptimizer.SHOULD_SUCCEED);
}
@@ -6558,7 +6439,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
helpPlan("select sum(case when e2 between 3 and 5 then e2 else -1 end) from pm1.g1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null, capFinder,
+ RealMetadataFactory.example1Cached(), null, capFinder,
new String[] { "SELECT SUM(CASE WHEN (e2 >= 3) AND (e2 <= 5) THEN e2 ELSE -1 END) FROM pm1.g1"}, //$NON-NLS-1$
TestOptimizer.SHOULD_SUCCEED);
}
@@ -6583,7 +6464,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
helpPlan("select sum(case when e2 between 3 and 5 then e2 else -1 end) from pm1.g1 group by e1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null, capFinder,
+ RealMetadataFactory.example1Cached(), null, capFinder,
new String[] { "SELECT SUM(CASE WHEN (e2 >= 3) AND (e2 <= 5) THEN e2 ELSE -1 END) FROM pm1.g1 GROUP BY e1"}, //$NON-NLS-1$
TestOptimizer.SHOULD_SUCCEED);
}
@@ -6608,7 +6489,7 @@
" ) AS A" + //$NON-NLS-1$
") AS A"; //$NON-NLS-1$
- helpPlan(sql, FakeMetadataFactory.example1Cached(), new String[] {});
+ helpPlan(sql, RealMetadataFactory.example1Cached(), new String[] {});
}
/**
@@ -6633,7 +6514,7 @@
" ) AS A" + //$NON-NLS-1$
") AS A"; //$NON-NLS-1$
- helpPlan(sql, FakeMetadataFactory.example1Cached(), new String[] {});
+ helpPlan(sql, RealMetadataFactory.example1Cached(), new String[] {});
}
/**
@@ -6653,7 +6534,7 @@
" SELECT e2 AS e2 FROM pm1.g1 AS A" + //$NON-NLS-1$
") AS A"; //$NON-NLS-1$
- helpPlan(sql, FakeMetadataFactory.example1Cached(), new String[] {"SELECT e2 FROM pm1.g1 AS A"}); //$NON-NLS-1$
+ helpPlan(sql, RealMetadataFactory.example1Cached(), new String[] {"SELECT e2 FROM pm1.g1 AS A"}); //$NON-NLS-1$
}
/**
@@ -6675,7 +6556,7 @@
" SELECT CONVERT(e2, long) AS e2 FROM pm1.g1 AS A" + //$NON-NLS-1$
") AS A"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
helpPlan(sql, metadata, new String[] {"SELECT e2 FROM pm1.g1 AS A"}); //$NON-NLS-1$
@@ -6702,7 +6583,7 @@
}
@Test public void testUpdatePushdownFails() {
- helpPlan("update pm1.g1 set e1 = 1 where exists (select 1 from pm1.g2)", FakeMetadataFactory.example1Cached(), null, //$NON-NLS-1$
+ helpPlan("update pm1.g1 set e1 = 1 where exists (select 1 from pm1.g2)", RealMetadataFactory.example1Cached(), null, //$NON-NLS-1$
null, null, false); //$NON-NLS-1$
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestOptionalJoins.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestOptionalJoins.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestOptionalJoins.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -25,34 +25,34 @@
import org.junit.Test;
import org.teiid.query.optimizer.TestOptimizer.ComparisonMode;
import org.teiid.query.processor.ProcessorPlan;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
@SuppressWarnings("nls")
public class TestOptionalJoins {
@Test public void testOptionalJoinNode1() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1 FROM pm1.g1, /* optional */ pm1.g2", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1 FROM pm1.g1, /* optional */ pm1.g2", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT pm1.g1.e1 FROM pm1.g1"} ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Test public void testOptionalJoinNode1WithPredicate() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1 FROM pm1.g1, /* optional */ pm1.g2 WHERE pm1.g1.e1 = pm1.g2.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1 FROM pm1.g1, /* optional */ pm1.g2 WHERE pm1.g1.e1 = pm1.g2.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT pm1.g1.e1 FROM pm1.g1"} ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Test public void testOptionalJoinNode1WithJoinCriteria() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g3.e1 FROM (pm1.g1 CROSS JOIN /* optional */ pm1.g2) INNER JOIN pm1.g3 ON pm1.g1.e1 = pm1.g3.e1 AND pm1.g2.e1 = pm1.g3.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g3.e1 FROM (pm1.g1 CROSS JOIN /* optional */ pm1.g2) INNER JOIN pm1.g3 ON pm1.g1.e1 = pm1.g3.e1 AND pm1.g2.e1 = pm1.g3.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT g_1.e1 FROM pm1.g1 AS g_0, pm1.g3 AS g_1 WHERE g_0.e1 = g_1.e1"} ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Test public void testOptionalJoinNodeNonAnsiWithHaving() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT e1 FROM (SELECT pm1.g1.e1, max(pm1.g2.e2) FROM pm1.g1, /* optional */ pm1.g2 WHERE pm1.g1.e1 = pm1.g2.e1 GROUP BY pm1.g1.e1) x", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT e1 FROM (SELECT pm1.g1.e1, max(pm1.g2.e2) FROM pm1.g1, /* optional */ pm1.g2 WHERE pm1.g1.e1 = pm1.g2.e1 GROUP BY pm1.g1.e1) x", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT pm1.g1.e1 FROM pm1.g1"} ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -74,7 +74,7 @@
}
@Test public void testOptionalJoinNode1_1() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1,pm2.g2.e1 FROM pm1.g1, /* optional */ pm2.g2", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1,pm2.g2.e1 FROM pm1.g1, /* optional */ pm2.g2", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT pm1.g1.e1 FROM pm1.g1", "SELECT pm2.g2.e1 FROM pm2.g2"} ); //$NON-NLS-1$//$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -96,21 +96,21 @@
}
@Test public void testOptionalJoinNode2() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1 FROM pm1.g1, /* optional */ pm1.g2, pm1.g3", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1 FROM pm1.g1, /* optional */ pm1.g2, pm1.g3", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT g_0.e1 FROM pm1.g1 AS g_0, pm1.g3 AS g_1"} ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Test public void testOptionalJoinNode3() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1 FROM pm1.g1 LEFT OUTER JOIN /* optional */ pm1.g2 on pm1.g1.e1 = pm1.g2.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1 FROM pm1.g1 LEFT OUTER JOIN /* optional */ pm1.g2 on pm1.g1.e1 = pm1.g2.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT pm1.g1.e1 FROM pm1.g1"} ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Test public void testOptionalJoinNode3_1() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1, pm2.g2.e1 FROM pm1.g1 LEFT OUTER JOIN /* optional */ pm2.g2 on pm1.g1.e1 = pm2.g2.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1, pm2.g2.e1 FROM pm1.g1 LEFT OUTER JOIN /* optional */ pm2.g2 on pm1.g1.e1 = pm2.g2.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT g_0.e1 AS c_0 FROM pm2.g2 AS g_0 ORDER BY c_0", "SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 ORDER BY c_0"} ); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -132,70 +132,70 @@
}
@Test public void testOptionalJoinNode4() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1 FROM (pm1.g1 LEFT OUTER JOIN /* optional */ pm1.g2 on pm1.g1.e1 = pm1.g2.e1) LEFT OUTER JOIN /* optional */ pm1.g3 on pm1.g1.e1 = pm1.g3.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1 FROM (pm1.g1 LEFT OUTER JOIN /* optional */ pm1.g2 on pm1.g1.e1 = pm1.g2.e1) LEFT OUTER JOIN /* optional */ pm1.g3 on pm1.g1.e1 = pm1.g3.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT pm1.g1.e1 FROM pm1.g1"} ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Test public void testOptionalJoinNode5() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1 FROM (pm1.g1 LEFT OUTER JOIN pm1.g2 on pm1.g1.e1 = pm1.g2.e1) LEFT OUTER JOIN /* optional */ pm1.g3 on pm1.g1.e1 = pm1.g3.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1 FROM (pm1.g1 LEFT OUTER JOIN pm1.g2 on pm1.g1.e1 = pm1.g2.e1) LEFT OUTER JOIN /* optional */ pm1.g3 on pm1.g1.e1 = pm1.g3.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT g_0.e1 FROM pm1.g1 AS g_0 LEFT OUTER JOIN pm1.g2 AS g_1 ON g_0.e1 = g_1.e1"} ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Test public void testOptionalJoinNode6() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1 FROM (pm1.g1 LEFT OUTER JOIN /* optional */ pm1.g2 on pm1.g1.e1 = pm1.g2.e1) LEFT OUTER JOIN pm1.g3 on pm1.g1.e1 = pm1.g3.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1 FROM (pm1.g1 LEFT OUTER JOIN /* optional */ pm1.g2 on pm1.g1.e1 = pm1.g2.e1) LEFT OUTER JOIN pm1.g3 on pm1.g1.e1 = pm1.g3.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT g_0.e1 FROM pm1.g1 AS g_0 LEFT OUTER JOIN pm1.g3 AS g_1 ON g_0.e1 = g_1.e1"} ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Test public void testOptionalJoinNode7() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g3.e1 FROM /* optional */ (pm1.g1 LEFT OUTER JOIN pm1.g2 on pm1.g1.e1 = pm1.g2.e1) LEFT OUTER JOIN pm1.g3 on pm1.g1.e1 = pm1.g3.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g3.e1 FROM /* optional */ (pm1.g1 LEFT OUTER JOIN pm1.g2 on pm1.g1.e1 = pm1.g2.e1) LEFT OUTER JOIN pm1.g3 on pm1.g1.e1 = pm1.g3.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT pm1.g3.e1 FROM pm1.g3"} ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Test public void testOptionalJoinNode8() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1 FROM pm1.g1 LEFT OUTER JOIN /* optional */ (select * from pm1.g2) as X on pm1.g1.e1 = x.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1 FROM pm1.g1 LEFT OUTER JOIN /* optional */ (select * from pm1.g2) as X on pm1.g1.e1 = x.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT pm1.g1.e1 FROM pm1.g1"} ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Test public void testOptionalJoinNode9() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g2.e1 FROM pm1.g2, /* optional */ vm1.g1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g2.e1 FROM pm1.g2, /* optional */ vm1.g1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT pm1.g2.e1 FROM pm1.g2"} ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Test public void testOptionalJoinNode10() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1 FROM /* optional */ vm1.g1, pm1.g1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1 FROM /* optional */ vm1.g1, pm1.g1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT pm1.g1.e1 FROM pm1.g1"} ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Test public void testOptionalJoinNode11() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1 FROM pm1.g1 LEFT OUTER JOIN /* optional */ vm1.g2 on pm1.g1.e1 = vm1.g2.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g1.e1 FROM pm1.g1 LEFT OUTER JOIN /* optional */ vm1.g2 on pm1.g1.e1 = vm1.g2.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT pm1.g1.e1 FROM pm1.g1"} ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Test public void testOptionalJoinNode12() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g3.e1 FROM /* optional */ (pm1.g1 LEFT OUTER JOIN vm1.g1 on pm1.g1.e1 = vm1.g1.e1) LEFT OUTER JOIN pm1.g3 on pm1.g1.e1 = pm1.g3.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g3.e1 FROM /* optional */ (pm1.g1 LEFT OUTER JOIN vm1.g1 on pm1.g1.e1 = vm1.g1.e1) LEFT OUTER JOIN pm1.g3 on pm1.g1.e1 = pm1.g3.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT pm1.g3.e1 FROM pm1.g3"} ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Test public void testOptionalJoinNode13() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT count(pm1.g1.e1) FROM pm1.g1 LEFT OUTER JOIN /* optional */ pm1.g2 on pm1.g1.e1 = pm1.g2.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT count(pm1.g1.e1) FROM pm1.g1 LEFT OUTER JOIN /* optional */ pm1.g2 on pm1.g1.e1 = pm1.g2.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT pm1.g1.e1 FROM pm1.g1"} ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -220,7 +220,7 @@
* The distinct prevents the removal of the optional join
*/
@Test public void testOptionalJoinNode14() throws Exception {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT ve1 FROM vm1.g4", FakeMetadataFactory.example4(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT ve1 FROM vm1.g4", RealMetadataFactory.example4(), //$NON-NLS-1$
new String[] {"SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 WHERE g_0.e1 IN (<dependent values>) ORDER BY c_0", "SELECT DISTINCT g_0.e1 AS c_0 FROM pm1.g2 AS g_0 ORDER BY c_0"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -242,14 +242,14 @@
}
@Test public void testOptionalJoinNode15() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT x.e1 FROM (select vm1.g1.e1, vm1.g2.e2 from vm1.g1 LEFT OUTER JOIN /* optional */vm1.g2 on vm1.g1.e2 = vm1.g2.e2) AS x", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT x.e1 FROM (select vm1.g1.e1, vm1.g2.e2 from vm1.g1 LEFT OUTER JOIN /* optional */vm1.g2 on vm1.g1.e2 = vm1.g2.e2) AS x", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT pm1.g1.e1 FROM pm1.g1"} ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Test public void testOptionalJoinNode16() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT length(z) FROM /* optional */ pm1.g1, (select distinct e2 as y, e3 || 'x' as z from pm1.g1 ORDER BY y, z) AS x", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT length(z) FROM /* optional */ pm1.g1, (select distinct e2 as y, e3 || 'x' as z from pm1.g1 ORDER BY y, z) AS x", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT e2, e3 FROM pm1.g1"} ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -271,7 +271,7 @@
}
@Test public void testOptionalJoinNode17() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT length(z) FROM /* optional */ pm1.g1 inner join (select e2 as y, e3 || 'x' as z from pm1.g1 ORDER BY z) AS x on pm1.g1.e2=x.y", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT length(z) FROM /* optional */ pm1.g1 inner join (select e2 as y, e3 || 'x' as z from pm1.g1 ORDER BY z) AS x on pm1.g1.e2=x.y", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT e3 FROM pm1.g1"} ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -293,14 +293,14 @@
}
@Test public void testOptionalJoinWithIntersection() throws Exception {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g3.e1 FROM pm1.g3 inner join (select pm1.g1.e2 as y from /* optional */ pm1.g1 inner join pm1.g2 on pm1.g1.e1 = pm1.g2.e1) AS x on pm1.g3.e2=x.y", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g3.e1 FROM pm1.g3 inner join (select pm1.g1.e2 as y from /* optional */ pm1.g1 inner join pm1.g2 on pm1.g1.e1 = pm1.g2.e1) AS x on pm1.g3.e2=x.y", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT g_0.e1 FROM pm1.g3 AS g_0, pm1.g1 AS g_1, pm1.g2 AS g_2 WHERE (g_1.e1 = g_2.e1) AND (g_0.e2 = g_1.e2)"}, ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Test public void testOptionalJoinWithNestedOrderBy() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g3.e1 FROM pm1.g3 inner join (select pm1.g2.e1, pm1.g1.e2 as y from /* optional */ pm1.g1 inner join pm1.g2 on pm1.g1.e1 = pm1.g2.e1 order by pm1.g2.e1 limit 10000) AS x on pm1.g3.e2=x.y", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g3.e1 FROM pm1.g3 inner join (select pm1.g2.e1, pm1.g1.e2 as y from /* optional */ pm1.g1 inner join pm1.g2 on pm1.g1.e1 = pm1.g2.e1 order by pm1.g2.e1 limit 10000) AS x on pm1.g3.e2=x.y", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT g_0.e2 AS c_0, g_0.e1 AS c_1 FROM pm1.g3 AS g_0 ORDER BY c_0", "SELECT g_0.e2 AS c_0 FROM pm1.g1 AS g_0, pm1.g2 AS g_1 WHERE g_0.e1 = g_1.e1 ORDER BY g_1.e1"} ); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -325,7 +325,7 @@
* Grouping will prevent the removal from happening
*/
@Test public void testOptionalJoinWithGroupingOverAllColumns() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g3.e1 FROM pm1.g3, (select max(pm1.g1.e4) y from /* optional */ pm1.g1, pm1.g2 where pm1.g1.e1 = pm1.g2.e1) AS x where pm1.g3.e2=x.y", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT pm1.g3.e1 FROM pm1.g3, (select max(pm1.g1.e4) y from /* optional */ pm1.g1, pm1.g2 where pm1.g1.e1 = pm1.g2.e1) AS x where pm1.g3.e2=x.y", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT g_0.e2, g_0.e1 FROM pm1.g3 AS g_0", "SELECT g_0.e4 FROM pm1.g1 AS g_0, pm1.g2 AS g_1 WHERE g_0.e1 = g_1.e1"} ); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -350,7 +350,7 @@
* Union should prevent the removal from happening
*/
@Test public void testOptionalJoinWithUnion() {
- ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g2.e4 from /* optional */ pm1.g1 inner join pm1.g2 on pm1.g1.e1 = pm1.g2.e1 union all select convert(pm1.g2.e2, double) from /* optional */ pm1.g1 inner join pm1.g2 on pm1.g1.e1 = pm1.g2.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select pm1.g2.e4 from /* optional */ pm1.g1 inner join pm1.g2 on pm1.g1.e1 = pm1.g2.e1 union all select convert(pm1.g2.e2, double) from /* optional */ pm1.g1 inner join pm1.g2 on pm1.g1.e1 = pm1.g2.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT pm1.g2.e4 FROM pm1.g2", "SELECT pm1.g2.e2 FROM pm1.g2"} ); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -372,7 +372,7 @@
}
@Test public void testOptionalJoinWithCompoundCriteria() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT length(z) FROM /* optional */ pm1.g1 inner join (select e2 as y, e3 || 'x' as z from pm1.g1 ORDER BY z) AS x on pm1.g1.e2=x.y and concat(x.y, x.z) = '1'", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT length(z) FROM /* optional */ pm1.g1 inner join (select e2 as y, e3 || 'x' as z from pm1.g1 ORDER BY z) AS x on pm1.g1.e2=x.y and concat(x.y, x.z) = '1'", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT e3 FROM pm1.g1"} ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -394,7 +394,7 @@
}
@Test public void testOptionalJoinWithDupRemoval() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT a.e1 from (SELECT distinct pm1.g1.e1, x.y FROM pm1.g1, /* optional */ (select e2 as y, e3 || 'x' as z from pm1.g1 ORDER BY z) AS x where pm1.g1.e2=x.y) as a", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT a.e1 from (SELECT distinct pm1.g1.e1, x.y FROM pm1.g1, /* optional */ (select e2 as y, e3 || 'x' as z from pm1.g1 ORDER BY z) AS x where pm1.g1.e2=x.y) as a", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT DISTINCT g_0.e2 AS c_0 FROM pm1.g1 AS g_0 ORDER BY c_0", "SELECT DISTINCT g_0.e2 AS c_0, g_0.e1 AS c_1 FROM pm1.g1 AS g_0 ORDER BY c_0"} ); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -422,7 +422,7 @@
@Test public void testOptionalJoinWithoutHint_crossJoin() {
ProcessorPlan plan = TestOptimizer
.helpPlan(
- "SELECT distinct pm1.g1.e1 from pm1.g1, pm1.g2", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ "SELECT distinct pm1.g1.e1 from pm1.g1, pm1.g2", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT DISTINCT g_0.e1 FROM pm1.g1 AS g_0, pm1.g2 AS g_1" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
@@ -431,7 +431,7 @@
@Test public void testOptionalJoinWithoutHint_outerJoin() {
ProcessorPlan plan = TestOptimizer
.helpPlan(
- "SELECT distinct pm1.g1.e2 from pm1.g1 left outer join pm1.g2 on (pm1.g1.e1 = pm1.g2.e1)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ "SELECT distinct pm1.g1.e2 from pm1.g1 left outer join pm1.g2 on (pm1.g1.e1 = pm1.g2.e1)", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT DISTINCT g_0.e2 FROM pm1.g1 AS g_0" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
@@ -440,7 +440,7 @@
@Test public void testOptionalJoinWithoutHint_aggregate() {
ProcessorPlan plan = TestOptimizer
.helpPlan(
- "SELECT pm1.g1.e3, max(pm1.g1.e2) from pm1.g1 left outer join pm1.g2 on (pm1.g1.e1 = pm1.g2.e1) group by pm1.g1.e3", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ "SELECT pm1.g1.e3, max(pm1.g1.e2) from pm1.g1 left outer join pm1.g2 on (pm1.g1.e1 = pm1.g2.e1) group by pm1.g1.e3", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT g_0.e3, g_0.e2 FROM pm1.g1 AS g_0" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -467,7 +467,7 @@
@Test public void testOptionalJoinWithoutHint_aggregate1() {
ProcessorPlan plan = TestOptimizer
.helpPlan(
- "SELECT pm1.g1.e3, avg(pm1.g1.e2) from pm1.g1 left outer join pm1.g2 on (pm1.g1.e1 = pm1.g2.e1) group by pm1.g1.e3", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ "SELECT pm1.g1.e3, avg(pm1.g1.e2) from pm1.g1 left outer join pm1.g2 on (pm1.g1.e1 = pm1.g2.e1) group by pm1.g1.e3", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT g_0.e3, g_0.e2 FROM pm1.g1 AS g_0 LEFT OUTER JOIN pm1.g2 AS g_1 ON g_0.e1 = g_1.e1" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -491,7 +491,7 @@
@Test public void testOptionalJoinWithoutHint_union() {
ProcessorPlan plan = TestOptimizer
.helpPlan(
- "SELECT pm1.g1.e3 from pm1.g1 left outer join pm1.g2 on (pm1.g1.e1 = pm1.g2.e1) union select 1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ "SELECT pm1.g1.e3 from pm1.g1 left outer join pm1.g2 on (pm1.g1.e1 = pm1.g2.e1) union select 1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT g_0.e3 FROM pm1.g1 AS g_0" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -515,7 +515,7 @@
@Test public void testOptionalJoinWithOrderedLimit() {
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$
+ "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", RealMetadataFactory.example1Cached(), //$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[] {
@@ -537,28 +537,28 @@
}
@Test public void testOptionalJoinNodeStar() throws Exception {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT g2.e1 FROM /* optional */ ( /* optional */ pm1.g1 as g1 makedep INNER JOIN /* optional */ pm2.g2 ON g1.e1 = pm2.g2.e1) makedep INNER JOIN /* optional */ pm2.g3 ON g1.e1 = pm2.g3.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT g2.e1 FROM /* optional */ ( /* optional */ pm1.g1 as g1 makedep INNER JOIN /* optional */ pm2.g2 ON g1.e1 = pm2.g2.e1) makedep INNER JOIN /* optional */ pm2.g3 ON g1.e1 = pm2.g3.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT g_0.e1 FROM pm2.g2 AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Test public void testOptionalJoinNodeStarTransitiveAnsi() throws Exception {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT g3.e1 FROM ( /* optional */ pm1.g1 as g1 makedep INNER JOIN /* optional */ pm2.g2 ON g1.e1 = pm2.g2.e1) makedep INNER JOIN /* optional */ pm2.g3 ON g1.e1 = pm2.g3.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT g3.e1 FROM ( /* optional */ pm1.g1 as g1 makedep INNER JOIN /* optional */ pm2.g2 ON g1.e1 = pm2.g2.e1) makedep INNER JOIN /* optional */ pm2.g3 ON g1.e1 = pm2.g3.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT g_0.e1 FROM pm2.g3 AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Test public void testOptionalJoinNodeStarNonAnsi() throws Exception {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT g3.e1 FROM /* optional */ pm1.g1 as g1, /* optional */ pm2.g2, /* optional */ pm2.g3 WHERE g1.e1 = pm2.g2.e1 AND g1.e1 = pm2.g3.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT g3.e1 FROM /* optional */ pm1.g1 as g1, /* optional */ pm2.g2, /* optional */ pm2.g3 WHERE g1.e1 = pm2.g2.e1 AND g1.e1 = pm2.g3.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT g_0.e1 FROM pm2.g3 AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Test public void testOptionalJoinNodeBridgeNonAnsi() throws Exception {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT g3.e1 FROM /* optional */ pm1.g1 as g1 makedep, pm2.g2, /* optional */ pm2.g3 WHERE g1.e1 = pm2.g2.e1 AND g1.e1 = pm2.g3.e1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT g3.e1 FROM /* optional */ pm1.g1 as g1 makedep, pm2.g2, /* optional */ pm2.g3 WHERE g1.e1 = pm2.g2.e1 AND g1.e1 = pm2.g3.e1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] {"SELECT g_1.e1 AS c_0, g_0.e1 AS c_1 FROM pm2.g2 AS g_0, pm2.g3 AS g_1 WHERE g_1.e1 = g_0.e1 ORDER BY c_0, c_1", "SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 WHERE (g_0.e1 IN (<dependent values>)) AND (g_0.e1 IN (<dependent values>)) ORDER BY c_0"}, ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestPartitionedJoinPlanning.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestPartitionedJoinPlanning.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestPartitionedJoinPlanning.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -27,19 +27,18 @@
import org.junit.Test;
import org.teiid.common.buffer.BufferManager;
+import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
import org.teiid.query.processor.ProcessorPlan;
import org.teiid.query.processor.relational.EnhancedSortMergeJoinStrategy;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
+import org.teiid.query.unittest.RealMetadataFactory;
-
+@SuppressWarnings("nls")
public class TestPartitionedJoinPlanning {
- @Test public void testUsePartitionedMergeJoin(){
+ @Test public void testUsePartitionedMergeJoin() throws Exception {
// Create query
String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm1.g2 WHERE pm1.g1.e1 = pm1.g2.e1";//$NON-NLS-1$
@@ -51,11 +50,9 @@
caps.setSourceProperty(Capability.MAX_IN_CRITERIA_SIZE, 100);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- FakeMetadataObject g1 = metadata.getStore().findObject("pm1.g1", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g1.putProperty(FakeMetadataObject.Props.CARDINALITY, BufferManager.DEFAULT_PROCESSOR_BATCH_SIZE * 2);
- FakeMetadataObject g2 = metadata.getStore().findObject("pm1.g2", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g2.putProperty(FakeMetadataObject.Props.CARDINALITY, BufferManager.DEFAULT_PROCESSOR_BATCH_SIZE * 16);
+ QueryMetadataInterface metadata = RealMetadataFactory.example1();
+ RealMetadataFactory.setCardinality("pm1.g1", BufferManager.DEFAULT_PROCESSOR_BATCH_SIZE * 2, metadata);
+ RealMetadataFactory.setCardinality("pm1.g2", BufferManager.DEFAULT_PROCESSOR_BATCH_SIZE * 16, metadata);
ProcessorPlan plan = helpPlan(sql, metadata,
null, capFinder,
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestRuleMergeVirtual.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestRuleMergeVirtual.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestRuleMergeVirtual.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -34,15 +34,14 @@
import org.teiid.query.processor.ProcessorPlan;
import org.teiid.query.processor.relational.RelationalPlan;
import org.teiid.query.processor.relational.SortNode;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
@SuppressWarnings("nls")
public class TestRuleMergeVirtual {
@Test public void testSimpleMergeGroupBy() {
ProcessorPlan plan = TestOptimizer.helpPlan("SELECT x FROM (SELECT e1, max(e2) as x FROM pm1.g1 GROUP BY e1) AS z", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null, TestAggregatePushdown.getAggregatesFinder(),
+ RealMetadataFactory.example1Cached(), null, TestAggregatePushdown.getAggregatesFinder(),
new String[] {
"SELECT MAX(e2) AS x FROM pm1.g1 GROUP BY e1"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
@@ -51,7 +50,7 @@
@Test public void testSimpleMergeGroupBy1() {
ProcessorPlan plan = TestOptimizer.helpPlan("SELECT x FROM (SELECT distinct min(e1), max(e2) as x FROM pm1.g1 GROUP BY e1) AS z", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null, TestAggregatePushdown.getAggregatesFinder(),
+ RealMetadataFactory.example1Cached(), null, TestAggregatePushdown.getAggregatesFinder(),
new String[] {
"SELECT v_0.c_1 FROM (SELECT DISTINCT MIN(g_0.e1) AS c_0, MAX(g_0.e2) AS c_1 FROM pm1.g1 AS g_0 GROUP BY g_0.e1) AS v_0"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
@@ -62,7 +61,7 @@
* Same as above but all required symbols are selected
*/
@Test public void testSimpleMergeGroupBy2() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = TestOptimizer.helpPlan("SELECT x, e1 FROM (SELECT distinct e1, max(e2) as x FROM pm1.g1 GROUP BY e1) AS z", //$NON-NLS-1$
metadata, null, TestAggregatePushdown.getAggregatesFinder(),
@@ -73,7 +72,7 @@
}
@Test public void testSimpleMergeGroupBy3() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = TestOptimizer.helpPlan("SELECT distinct x, e1 FROM (SELECT min(e1) as e1, max(e2) as x FROM pm1.g1 GROUP BY e1) AS z", //$NON-NLS-1$
metadata, null, TestAggregatePushdown.getAggregatesFinder(),
@@ -85,7 +84,7 @@
@Test public void testSimpleMergeGroupBy4() {
ProcessorPlan plan = TestOptimizer.helpPlan("SELECT x, x FROM (SELECT e1, max(e2) as x FROM pm1.g1 GROUP BY e1) AS z", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null, TestAggregatePushdown.getAggregatesFinder(),
+ RealMetadataFactory.example1Cached(), null, TestAggregatePushdown.getAggregatesFinder(),
new String[] {
"SELECT v_0.c_0 FROM (SELECT MAX(g_0.e2) AS c_0 FROM pm1.g1 AS g_0 GROUP BY g_0.e1) AS v_0"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
@@ -94,7 +93,7 @@
@Test public void testSimpleMergeGroupBy5() {
ProcessorPlan plan = TestOptimizer.helpPlan("SELECT x FROM (SELECT e1, max(e2) as x FROM pm1.g1 GROUP BY e1) AS z where z.x = 1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null, TestAggregatePushdown.getAggregatesFinder(),
+ RealMetadataFactory.example1Cached(), null, TestAggregatePushdown.getAggregatesFinder(),
new String[] {
"SELECT MAX(e2) AS x FROM pm1.g1 GROUP BY e1 HAVING MAX(e2) = 1"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
@@ -103,7 +102,7 @@
@Test public void testSimpleMergeGroupBy6() {
ProcessorPlan plan = TestOptimizer.helpPlan("SELECT x FROM (SELECT e1, max(e2) as x FROM pm1.g1 GROUP BY e1) AS z where z.x = 1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null, TestAggregatePushdown.getAggregatesFinder(),
+ RealMetadataFactory.example1Cached(), null, TestAggregatePushdown.getAggregatesFinder(),
new String[] {
"SELECT MAX(e2) AS x FROM pm1.g1 GROUP BY e1 HAVING MAX(e2) = 1"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
@@ -111,7 +110,7 @@
}
@Test public void testSimpleMergeGroupBy7() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = TestOptimizer.helpPlan("SELECT distinct x, e1 FROM (SELECT distinct min(e1) as e1, max(e2) as x FROM pm1.g1 GROUP BY e1) AS z", //$NON-NLS-1$
metadata, null, TestAggregatePushdown.getAggregatesFinder(),
@@ -129,7 +128,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan("SELECT x FROM (select '1' as x, e2 from pm1.g1 union all select e1, 1 from pm1.g2) x", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null, capFinder,
+ RealMetadataFactory.example1Cached(), null, capFinder,
new String[] {
"SELECT '1' AS x FROM pm1.g1 UNION ALL SELECT e1 FROM pm1.g2"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
@@ -144,7 +143,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan("SELECT distinct x FROM (select '1' as x, e2 from pm1.g1 union all select e1, 1 from pm1.g2) x", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null, capFinder,
+ RealMetadataFactory.example1Cached(), null, capFinder,
new String[] {
"SELECT '1' AS x FROM pm1.g1 UNION SELECT e1 FROM pm1.g2"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
@@ -162,7 +161,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan("SELECT distinct x || 'b' FROM (select '1' as x, e2 from pm1.g1 union all select e1, 1 from pm1.g2) x", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null, capFinder,
+ RealMetadataFactory.example1Cached(), null, capFinder,
new String[] {
"SELECT '1' AS x FROM pm1.g1 UNION ALL SELECT e1 FROM pm1.g2"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
@@ -193,7 +192,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
TestOptimizer.helpPlan("select * from (SELECT x.x, x.e2 FROM (select '1' as x, pm1.g1.e2 from pm1.g1, pm1.g2 where pm1.g1.e1 = pm1.g2.e1 group by pm1.g1.e2, pm1.g1.e3 || '1') x union all select e1, 1 from pm1.g2) as y where x = '1'", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null, capFinder,
+ RealMetadataFactory.example1Cached(), null, capFinder,
new String[] {
"SELECT pm1.g2.e1 FROM pm1.g2", "SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3 FROM pm1.g1"}, TestOptimizer.SHOULD_SUCCEED);
}
@@ -206,7 +205,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan("select * from (SELECT distinct x FROM (select '1' as x, e2 from pm1.g1 union all select e1, 1 from pm1.g2) x) y, pm1.g2", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null, capFinder,
+ RealMetadataFactory.example1Cached(), null, capFinder,
new String[] {
"SELECT '1' AS x FROM pm1.g1 UNION SELECT e1 FROM pm1.g2", "SELECT pm1.g2.e1, pm1.g2.e2, pm1.g2.e3, pm1.g2.e4 FROM pm1.g2"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$ //$NON-NLS-2$
@@ -235,7 +234,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan("select * from (select e1 from pm1.g1 limit 1) x", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null, capFinder,
+ RealMetadataFactory.example1Cached(), null, capFinder,
new String[] {
"SELECT e1 FROM pm1.g1 LIMIT 1"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
@@ -249,7 +248,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan("select * from (select e1 from pm1.g1 limit 1) x order by e1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null, capFinder,
+ RealMetadataFactory.example1Cached(), null, capFinder,
new String[] {
"SELECT e1 FROM pm1.g1 LIMIT 1"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
@@ -283,7 +282,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan("select '1' as x, e2 from pm1.g1 union all select e1, e2 from (select e1, 1 as e2 from pm1.g2 limit 1) as x order by x", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null, capFinder,
+ RealMetadataFactory.example1Cached(), null, capFinder,
new String[] {"SELECT '1' AS c_0, pm1.g1.e2 AS c_1 FROM pm1.g1 UNION ALL (SELECT pm1.g2.e1 AS c_0, 1 AS c_1 FROM pm1.g2 LIMIT 1) ORDER BY c_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
@@ -301,7 +300,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan("select '1' as x, e2 from pm1.g1 union all (select e1, e2 from (select distinct e1, 1 as e2 from pm1.g2) as x order by e1 limit 1) order by x", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null, capFinder,
+ RealMetadataFactory.example1Cached(), null, capFinder,
new String[] {"SELECT '1' AS c_0, pm1.g1.e2 AS c_1 FROM pm1.g1 UNION ALL (SELECT DISTINCT pm1.g2.e1 AS c_0, 1 AS c_1 FROM pm1.g2 ORDER BY c_0 LIMIT 1) ORDER BY c_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
@@ -330,7 +329,7 @@
caps.setFunctionSupport("convert", true); //$NON-NLS-1$
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
// Plan query
ProcessorPlan plan = TestOptimizer.helpPlan(sql, metadata,
@@ -348,7 +347,7 @@
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- RelationalPlan plan = (RelationalPlan)TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ RelationalPlan plan = (RelationalPlan)TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
new String[] {"SELECT g_0.e1 FROM pm1.g1 AS g_0"}, capFinder, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
SortNode node = (SortNode)plan.getRootNode();
@@ -363,7 +362,7 @@
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- RelationalPlan plan = (RelationalPlan)TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ RelationalPlan plan = (RelationalPlan)TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
new String[] {"SELECT g_0.e1 FROM pm1.g1 AS g_0", "SELECT g_0.e1 FROM pm1.g2 AS g_0"}, capFinder, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
SortNode node = (SortNode)plan.getRootNode();
@@ -374,7 +373,7 @@
BasicSourceCapabilities caps = TestAggregatePushdown.getAggregateCapabilities();
caps.setFunctionSupport("+", true); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan("SELECT x FROM (SELECT min(y), max(x) as x FROM (select e1 x, e2 + 1 y from pm1.g1) a) AS b", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null, new DefaultCapabilitiesFinder(caps),
+ RealMetadataFactory.example1Cached(), null, new DefaultCapabilitiesFinder(caps),
new String[] {
"SELECT MAX(g_0.e1) FROM pm1.g1 AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
@@ -385,7 +384,7 @@
BasicSourceCapabilities caps = TestAggregatePushdown.getAggregateCapabilities();
caps.setFunctionSupport("+", true); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan("SELECT x FROM (select c.e1 as x from (select e1 from pm1.g1) as c, pm1.g2 as d) as a group by x", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null, new DefaultCapabilitiesFinder(caps),
+ RealMetadataFactory.example1Cached(), null, new DefaultCapabilitiesFinder(caps),
new String[] {
"SELECT g_0.e1 FROM pm1.g1 AS g_0, pm1.g2 AS g_1 GROUP BY g_0.e1"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestRuleRaiseNull.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestRuleRaiseNull.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestRuleRaiseNull.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -34,7 +34,7 @@
import org.teiid.query.processor.ProcessorPlan;
import org.teiid.query.processor.relational.RelationalPlan;
import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
public class TestRuleRaiseNull {
@@ -67,7 +67,7 @@
String sql = "select * from ( select intkey as cola, null as colb, intnum as colc from bqt1.smalla union all select null, intkey, intnum from bqt2.smalla) as X where X.cola = 1"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
new String[] {"SELECT intkey, intnum FROM bqt1.smalla WHERE intkey = 1"} ); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
@@ -77,7 +77,7 @@
@Test public void testRaiseNullWithInnerJoin() {
String sql = "select b.intkey from (select intkey from bqt1.smalla where 1 = 0) a inner join (select intkey from bqt1.smallb) b on (a.intkey = b.intkey)"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
new String[]{});
TestOptimizer.checkNodeTypes(plan, FULLY_NULL);
}
@@ -85,7 +85,7 @@
@Test public void testRaiseNullWithFullOuterJoin() {
String sql = "select b.intkey from (select intkey from bqt1.smalla) a full outer join (select intkey from bqt1.smallb where 1 = 0) b on (a.intkey = b.intkey)"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
new String[]{"SELECT null FROM bqt1.smalla"}); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@@ -93,7 +93,7 @@
@Test public void testRaiseNullWithOuterJoin() {
String sql = "select b.intkey from (select intkey from bqt1.smalla) a left outer join (select intkey from bqt1.smallb where 1 = 0) b on (a.intkey = b.intkey)"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
new String[]{"SELECT null FROM bqt1.smalla"}); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@@ -106,7 +106,7 @@
String sql = "select smallb.intkey, smalla.intkey from bqt1.smalla left outer join bqt1.smallb on (1 = 2)"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), null, capFinder,
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder,
new String[]{"SELECT bqt1.smalla.intkey FROM bqt1.smalla"}, true); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@@ -114,7 +114,7 @@
@Test public void testRaiseNullWithUnion() {
String sql = "select b.x from (select intkey as x from bqt1.smalla where 1 = 0 union all select intnum as y from bqt1.smalla) b"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
new String[]{"SELECT IntNum FROM bqt1.smalla"}); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
@@ -124,7 +124,7 @@
@Test public void testRaiseNullWithUnion1() {
String sql = "select b.intkey from (select intkey from bqt1.smalla union all select intnum from bqt1.smalla where 1 = 0) b"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
new String[]{"SELECT intkey FROM bqt1.smalla"}); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@@ -132,7 +132,7 @@
@Test public void testRaiseNullWithUnion2() {
String sql = "select b.intkey, b.x from (select intkey, intnum as x from bqt1.smalla where 1 = 0 union all select intnum as a, null from bqt1.smalla union all select 1 as z, intkey as b from bqt1.smallb) b"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
new String[]{"SELECT intkey FROM bqt1.smallb", "SELECT IntNum FROM bqt1.smalla"}); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
@@ -155,7 +155,7 @@
@Test public void testRaiseNullWithUnion3() {
String sql = "select intkey, intnum as x from bqt1.smalla where 1 = 0 union all select intnum, intkey as z from bqt1.smalla where 1 = 0"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
new String[]{});
TestOptimizer.checkNodeTypes(plan, FULLY_NULL);
}
@@ -163,7 +163,7 @@
@Test public void testRaiseNullWithUnion4() throws Exception {
String sql = "select b.intkey, b.x from (select intkey, intnum as x from bqt1.smalla where 1 = 0 union all select 1 as z, intkey as b from bqt1.smallb) b inner join bqt1.smalla on b.intkey = bqt1.smalla.intkey"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
new String[]{"SELECT g_0.intkey FROM bqt1.smallb AS g_0, bqt1.smalla AS g_1 WHERE g_1.IntKey = 1"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@@ -171,7 +171,7 @@
@Test public void testRaiseNullWithUnion5() {
String sql = "select intkey from bqt1.smalla union all select intkey from bqt2.smalla where 1 = 0"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
new String[]{"SELECT intkey FROM bqt1.smalla"}); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@@ -179,7 +179,7 @@
@Test public void testRaiseNullWithUnion6() {
String sql = "select intkey from bqt1.smalla union all select intkey from bqt2.smalla union all select intkey from bqt2.smalla where 1 = 0"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
new String[]{"SELECT intkey FROM bqt1.smalla", "SELECT intkey FROM bqt2.smalla"}); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
@@ -217,7 +217,7 @@
String sql = "select smallb.intkey, smalla.intkey from bqt1.smalla left outer join bqt1.smallb on (1 = 2) group by smalla.intkey, smallb.intkey having max(smallb.intkey) = 1"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), null, capFinder,
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder,
new String[]{"SELECT bqt1.smalla.intkey FROM bqt1.smalla"}, true); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
1, // Access
@@ -254,7 +254,7 @@
String sql = "select max(intkey), intnum from (select intkey, intnum from bqt2.smalla where 1 = 0 union all select intnum, intnum from bqt2.smalla union all select intkey, stringkey from bqt2.smalla) x group by intnum"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), null, capFinder,
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder,
new String[]{"SELECT MAX(v_0.c_1), v_0.c_0 FROM (SELECT g_1.IntNum AS c_0, g_1.IntNum AS c_1 FROM bqt2.smalla AS g_1 UNION ALL SELECT g_0.StringKey AS c_0, g_0.IntKey AS c_1 FROM bqt2.smalla AS g_0) AS v_0 GROUP BY v_0.c_0"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@@ -263,7 +263,7 @@
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.QUERY_ORDERBY, true);
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
@@ -278,7 +278,7 @@
@Test public void testRaiseNullWithGroupBy() {
String sql = "select max(e2), e1 from pm1.g1 where 1 = 0 group by e1"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), new String[]{});
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), new String[]{});
TestOptimizer.checkNodeTypes(plan, FULLY_NULL);
}
@@ -286,7 +286,7 @@
@Test public void testRaiseNullWithGroupBy1() {
String sql = "select max(e2) from pm1.g1 where 1 = 0"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), new String[]{});
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), new String[]{});
TestOptimizer.checkNodeTypes(plan, new int[] {
0, // Access
@@ -309,7 +309,7 @@
@Test public void testRaiseNullWithExcept() {
String sql = "select e1 from pm1.g1 except select e2 from pm1.g2 where 1 = 0"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), new String[]{"SELECT DISTINCT g_0.e1 FROM pm1.g1 AS g_0"}); //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), new String[]{"SELECT DISTINCT g_0.e1 FROM pm1.g1 AS g_0"}); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@@ -317,7 +317,7 @@
@Test public void testRaiseNullWithIntersect() {
String sql = "select max(e2) from pm1.g1 intersect select e2 from pm1.g2 where 1 = 0"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), new String[]{});
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), new String[]{});
TestOptimizer.checkNodeTypes(plan, FULLY_NULL);
}
@@ -342,7 +342,7 @@
@Test public void testRaiseNullWithUnionNotAll() {
String sql = "select intkey from bqt2.smalla union select intkey from bqt2.smalla where 1 = 0"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
new String[]{"SELECT DISTINCT intkey FROM bqt2.smalla"}); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@@ -350,7 +350,7 @@
@Test public void testRaiseNullWithUnionAndAliases() {
String sql = "select pm1.g1.e1 from pm1.g1, (select e1 from pm1.g1 where (1 = 0) union all select e1 as x from pm1.g2) x where pm1.g1.e1 <> x.e1"; //$NON-NLS-1$
- RelationalPlan plan = (RelationalPlan)TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ RelationalPlan plan = (RelationalPlan)TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
new String[]{"SELECT g_0.e1 FROM pm1.g1 AS g_0, pm1.g2 AS g_1 WHERE g_0.e1 <> g_1.e1"}); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestRuleRemoveSorts.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestRuleRemoveSorts.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestRuleRemoveSorts.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -24,7 +24,7 @@
import org.teiid.query.optimizer.TestOptimizer.ComparisonMode;
import org.teiid.query.processor.ProcessorPlan;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import junit.framework.TestCase;
@@ -33,7 +33,7 @@
/** Tests an order by in a query transformation */
public void testRemovedOrderByFromQueryTransform() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT e1, e2 FROM vm1.g14", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT e1, e2 FROM vm1.g14", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT pm3.g1.e1, pm3.g1.e2 FROM pm3.g1"}); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
@@ -44,7 +44,7 @@
* physical model does not support pushing order bys
*/
public void testRemovedOrderByFromQueryTransform2() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT e, e2 FROM vm1.g8", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT e, e2 FROM vm1.g8", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT e1, e2 FROM pm1.g1"}); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -70,7 +70,7 @@
* query transformation contains a function
*/
public void testRemovedOrderByFromQueryTransform3() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT e, e2 FROM vm1.g16", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT e, e2 FROM vm1.g16", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT e1, e2 FROM pm3.g1"}); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -93,7 +93,7 @@
/** Tests an order by in a query transformation */
public void testRemovedOrderByFromQueryTransform4() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT e1, e2 FROM vm1.g13", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT e1, e2 FROM vm1.g13", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT DISTINCT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1"}); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -116,7 +116,7 @@
/** Order by is not removed */
public void testOrderByWithLimit() throws Exception {
- ProcessorPlan plan = TestOptimizer.helpPlan("select * from (SELECT e1, e2 FROM pm1.g1 order by e1 limit 10) x", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select * from (SELECT e1, e2 FROM pm1.g1 order by e1 limit 10) x", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM pm1.g1 AS g_0 ORDER BY c_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestSortOptimization.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestSortOptimization.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestSortOptimization.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -36,7 +36,7 @@
import org.teiid.query.processor.relational.LimitNode;
import org.teiid.query.processor.relational.ProjectNode;
import org.teiid.query.processor.relational.RelationalPlan;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
public class TestSortOptimization {
@@ -49,7 +49,7 @@
// Create query
String sql = "select distinct e1, e2 from pm1.g1 order by e2"; //$NON-NLS-1$
- ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.example1Cached(), null, capFinder,
+ ProcessorPlan plan = helpPlan(sql, RealMetadataFactory.example1Cached(), null, capFinder,
new String[] {"SELECT e1, e2 FROM pm1.g1"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
@@ -64,7 +64,7 @@
// Create query
String sql = "select e1, e2 from pm1.g1 union select e1, e2 from pm1.g2 order by e2"; //$NON-NLS-1$
- ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.example1Cached(), null, capFinder,
+ ProcessorPlan plan = helpPlan(sql, RealMetadataFactory.example1Cached(), null, capFinder,
new String[] {"SELECT e1, e2 FROM pm1.g1", "SELECT e1, e2 FROM pm1.g2"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$ //$NON-NLS-2$
checkNodeTypes(plan, new int[] {
@@ -94,7 +94,7 @@
// Create query
String sql = "select x.*, y.* from (select distinct e1, e2 from pm1.g1) x, (select distinct e1, e2 from pm1.g2) y where x.e1 = y.e1"; //$NON-NLS-1$
- ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.example1Cached(), null, capFinder,
+ ProcessorPlan plan = helpPlan(sql, RealMetadataFactory.example1Cached(), null, capFinder,
new String[] {"SELECT e1, e2 FROM pm1.g1", "SELECT e1, e2 FROM pm1.g2"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$ //$NON-NLS-2$
checkNodeTypes(plan, new int[] {
@@ -124,7 +124,7 @@
// Create query
String sql = "select max(e1), e2 from (select distinct e1, e2 from pm1.g1) x group by e2"; //$NON-NLS-1$
- ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.example1Cached(), null, capFinder,
+ ProcessorPlan plan = helpPlan(sql, RealMetadataFactory.example1Cached(), null, capFinder,
new String[] {"SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
@@ -154,7 +154,7 @@
// Create query
String sql = "select max(e1), e2 from pm1.g1 x group by e2 order by e2"; //$NON-NLS-1$
- ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.example1Cached(), null, capFinder,
+ ProcessorPlan plan = helpPlan(sql, RealMetadataFactory.example1Cached(), null, capFinder,
new String[] {"SELECT pm1.g1.e2, pm1.g1.e1 FROM pm1.g1"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
@@ -180,7 +180,7 @@
// Create query
String sql = "select e1, (select e1 from pm2.g1 where e2 = x.e2) from pm1.g1 as x order by e1 limit 2"; //$NON-NLS-1$
- RelationalPlan plan = (RelationalPlan)helpPlan(sql, FakeMetadataFactory.example1Cached(), null, new DefaultCapabilitiesFinder(),
+ RelationalPlan plan = (RelationalPlan)helpPlan(sql, RealMetadataFactory.example1Cached(), null, new DefaultCapabilitiesFinder(),
new String[] {"SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
assertTrue(plan.getRootNode() instanceof ProjectNode);
@@ -190,7 +190,7 @@
// Create query
String sql = "select (select e1 from pm2.g1 where e2 = x.e2) as z from pm1.g1 as x order by z limit 2"; //$NON-NLS-1$
- RelationalPlan plan = (RelationalPlan)helpPlan(sql, FakeMetadataFactory.example1Cached(), null, new DefaultCapabilitiesFinder(),
+ RelationalPlan plan = (RelationalPlan)helpPlan(sql, RealMetadataFactory.example1Cached(), null, new DefaultCapabilitiesFinder(),
new String[] {"SELECT pm1.g1.e2 FROM pm1.g1"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
assertTrue(plan.getRootNode() instanceof LimitNode);
@@ -200,7 +200,7 @@
// Create query
String sql = "select e1, (select e1 from pm2.g1 where e2 = x.e2) as z from pm1.g1 as x order by e1"; //$NON-NLS-1$
- helpPlan(sql, FakeMetadataFactory.example1Cached(), null, TestOptimizer.getGenericFinder(),
+ helpPlan(sql, RealMetadataFactory.example1Cached(), null, TestOptimizer.getGenericFinder(),
new String[] {"SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM pm1.g1 AS g_0 ORDER BY c_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
}
@@ -208,7 +208,7 @@
// Create query
String sql = "select e1, (select e1 from pm2.g1 where e2 = x.e2) as z from pm1.g1 as x order by e1 limit 1"; //$NON-NLS-1$
- helpPlan(sql, FakeMetadataFactory.example1Cached(), null, TestOptimizer.getGenericFinder(),
+ helpPlan(sql, RealMetadataFactory.example1Cached(), null, TestOptimizer.getGenericFinder(),
new String[] {"SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM pm1.g1 AS g_0 ORDER BY c_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
}
@@ -222,7 +222,7 @@
String sql = "select (select e1 from pm2.g1 where e2 = x.e2) as z from pm1.g1 as x order by e1 limit 1"; //$NON-NLS-1$
- helpPlan(sql, FakeMetadataFactory.example1Cached(), null, capFinder,
+ helpPlan(sql, RealMetadataFactory.example1Cached(), null, capFinder,
new String[] {"SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1 ORDER BY pm1.g1.e1 LIMIT 1"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
}
@@ -236,7 +236,7 @@
String sql = "select e2 from pm1.g1 as x order by e1"; //$NON-NLS-1$
- helpPlan(sql, FakeMetadataFactory.example1Cached(), null, capFinder,
+ helpPlan(sql, RealMetadataFactory.example1Cached(), null, capFinder,
new String[] {"SELECT pm1.g1.e2, pm1.g1.e1 FROM pm1.g1 ORDER BY pm1.g1.e1"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
}
@@ -250,7 +250,7 @@
String sql = "select (select e1 from pm2.g1 where e2 = x.e2) as z, x.e1 as foo from pm1.g1 as x order by foo limit 1"; //$NON-NLS-1$
- helpPlan(sql, FakeMetadataFactory.example1Cached(), null, capFinder,
+ helpPlan(sql, RealMetadataFactory.example1Cached(), null, capFinder,
new String[] {"SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM pm1.g1 AS g_0 ORDER BY c_0 LIMIT 1"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestStoredProcedurePlanning.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestStoredProcedurePlanning.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestStoredProcedurePlanning.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -27,7 +27,7 @@
import org.teiid.query.metadata.TempMetadataAdapter;
import org.teiid.query.metadata.TempMetadataStore;
import org.teiid.query.processor.ProcessorPlan;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
public class TestStoredProcedurePlanning {
@@ -37,7 +37,7 @@
*/
@Ignore("stored procedure wrapper removal logic has been removed")
@Test public void testStoredQuery1() {
- ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq1()", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq1()", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "SELECT e1, e2 FROM pm1.g1" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@@ -47,7 +47,7 @@
*/
@Ignore("stored procedure wrapper removal logic has been removed")
@Test public void testStoredQuery2() {
- ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq1()", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq1()", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "SELECT e1, e2 FROM pm1.g1" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@@ -57,19 +57,19 @@
*/
@Ignore("stored procedure wrapper removal logic has been removed")
@Test public void testStoredQuery3() {
- ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq2('1')", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq2('1')", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "SELECT e1, e2 FROM pm1.g1 WHERE e1 = '1'" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Ignore("stored procedure wrapper removal logic has been removed")
@Test public void testStoredQuery4() {
- ProcessorPlan plan = TestOptimizer.helpPlan("select x.e1 from (EXEC pm1.sq1()) as x", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select x.e1 from (EXEC pm1.sq1()) as x", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "SELECT e1 FROM pm1.g1" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Test public void testStoredQuery5() {
- ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sp1()", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sp1()", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "EXEC pm1.sp1()" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
1, // Access
@@ -90,7 +90,7 @@
}
@Test public void testStoredQuery6() {
- ProcessorPlan plan = TestOptimizer.helpPlan("select x.e1 from (EXEC pm1.sp1()) as x", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select x.e1 from (EXEC pm1.sp1()) as x", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "EXEC pm1.sp1()" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
1, // Access
@@ -112,7 +112,7 @@
@Ignore("stored procedure wrapper removal logic has been removed")
@Test public void testStoredQuery7() {
- ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sqsp1()", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sqsp1()", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "EXEC pm1.sp1()" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
1, // Access
@@ -137,7 +137,7 @@
*/
@Ignore("stored procedure wrapper removal logic has been removed")
@Test public void testStoredQuery8() {
- ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq3('1', 1)", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq3('1', 1)", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "SELECT e1, e2 FROM pm1.g1 WHERE e1 = '1'", "SELECT e1, e2 FROM pm1.g1 WHERE e2 = 1" }); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
@@ -162,7 +162,7 @@
*/
@Ignore("stored procedure wrapper removal logic has been removed")
@Test public void testStoredQuery9() {
- ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq4()", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq4()", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] {"SELECT e1, e2 FROM pm1.g1" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@@ -172,7 +172,7 @@
*/
@Ignore("stored procedure wrapper removal logic has been removed")
@Test public void testStoredQuery10() {
- ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq5('1')", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq5('1')", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "SELECT e1, e2 FROM pm1.g1 WHERE e1 = '1'"}); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@@ -182,7 +182,7 @@
*/
@Ignore("stored procedure wrapper removal logic has been removed")
@Test public void testStoredQuery11() {
- ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq6()", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq6()", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] {"SELECT e1, e2 FROM pm1.g1 WHERE e1 = '1'" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@@ -192,7 +192,7 @@
*/
@Ignore("stored procedure wrapper removal logic has been removed")
@Test public void testStoredQuery12() {
- ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq7()", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq7()", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "SELECT e1 FROM pm1.g1" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@@ -202,7 +202,7 @@
*/
@Ignore("stored procedure wrapper removal logic has been removed")
@Test public void testStoredQuery13() {
- ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq8('1')", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq8('1')", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "SELECT e1 FROM pm1.g1 WHERE e1 = '1'" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@@ -212,7 +212,7 @@
*/
@Ignore("stored procedure wrapper removal logic has been removed")
@Test public void testStoredQuery14() {
- ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq9('1')", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq9('1')", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "SELECT e1 FROM pm1.g1 WHERE e1 = '1'" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@@ -222,7 +222,7 @@
*/
@Ignore("stored procedure wrapper removal logic has been removed")
@Test public void testStoredQuery15() {
- ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq10('1', 2)", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq10('1', 2)", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "SELECT e1 FROM pm1.g1 WHERE (e1 = '1') AND (e2 = 2)" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@@ -231,7 +231,7 @@
* Test planning stored queries.
*/
@Test public void testStoredQuery16() {
- ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sp2(1)", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sp2(1)", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "EXEC pm1.sp2(1)" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
1, // Access
@@ -256,7 +256,7 @@
*/
@Ignore("stored procedure wrapper removal logic has been removed")
@Test public void testStoredQuery17() {
- ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq11(1, 2)", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq11(1, 2)", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "EXEC pm1.sp2(?)" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -280,7 +280,7 @@
//GeminiStoredQueryTestPlan - 2a, 2b
@Ignore("stored procedure wrapper removal logic has been removed")
@Test public void testStoredQuery18() {
- ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq12('1', 1)", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq12('1', 1)", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "INSERT INTO pm1.g1 (e1, e2) VALUES ('1', 1)" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
@@ -289,7 +289,7 @@
//GeminiStoredQueryTestPlan - 2c
@Ignore("stored procedure wrapper removal logic has been removed")
@Test public void testStoredQuery19() {
- ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq13('1')", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq13('1')", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "INSERT INTO pm1.g1 (e1, e2) VALUES ('1', 2)" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
@@ -298,7 +298,7 @@
//GeminiStoredQueryTestPlan - 3c
@Ignore("stored procedure wrapper removal logic has been removed")
@Test public void testStoredQuery20() {
- ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq14('1', 2)", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq14('1', 2)", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "UPDATE pm1.g1 SET e1 = '1' WHERE e2 = 2" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
@@ -307,7 +307,7 @@
//GeminiStoredQueryTestPlan - 4b
@Ignore("stored procedure wrapper removal logic has been removed")
@Test public void testStoredQuery21() {
- ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq15('1', 2)", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq15('1', 2)", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "DELETE FROM pm1.g1 WHERE (e1 = '1') AND (e2 = 2)" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
@@ -315,7 +315,7 @@
@Ignore("stored procedure wrapper removal logic has been removed")
@Test public void testStoredQuery22() {
- ProcessorPlan plan = TestOptimizer.helpPlan("select e1 from (EXEC pm1.sq1()) as x where e1='a' union (select e1 from vm1.g2 where e1='b')", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select e1 from (EXEC pm1.sq1()) as x where e1='a' union (select e1 from vm1.g2 where e1='b')", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "SELECT g_0.e1 FROM pm1.g1 AS g_0 WHERE g_0.e1 = 'a'", "SELECT g_0.e1 FROM pm1.g1 AS g_0, pm1.g2 AS g_1 WHERE (g_0.e1 = g_1.e1) AND (g_0.e1 = 'b') AND (g_1.e1 = 'b')" }); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -338,14 +338,14 @@
@Ignore("stored procedure wrapper removal logic has been removed")
@Test public void testStoredQuery23() {
- ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq16()", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq16()", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "INSERT INTO pm1.g1 (e1, e2) VALUES ('1', 2)" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Test public void testStoredQuery24() {
- ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sp3()", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sp3()", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "EXEC pm1.sp3()" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -369,21 +369,21 @@
// test implicit type conversion of argument
@Ignore("stored procedure wrapper removal logic has been removed")
@Test public void testStoredQuery25() {
- ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq15(1, 2)", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("EXEC pm1.sq15(1, 2)", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "DELETE FROM pm1.g1 WHERE (e1 = '1') AND (e2 = 2)" }); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
@Test public void testStoredQueryXML1() {
- TestOptimizer.helpPlan("EXEC pm1.sq18()", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), new String[] { }); //$NON-NLS-1$
+ TestOptimizer.helpPlan("EXEC pm1.sq18()", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), new String[] { }); //$NON-NLS-1$
}
/**
* union of two stored procs - case #1466
*/
@Test public void testStoredProc1() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT * FROM (EXEC pm1.sp2(1)) AS x UNION ALL SELECT * FROM (EXEC pm1.sp2(2)) AS y", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT * FROM (EXEC pm1.sp2(1)) AS x UNION ALL SELECT * FROM (EXEC pm1.sp2(2)) AS y", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "EXEC pm1.sp2(1)", "EXEC pm1.sp2(2)" }); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
@@ -407,7 +407,7 @@
* union of stored proc and query - case #1466
*/
@Test public void testStoredProc2() {
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT * FROM (EXEC pm1.sp2(1)) AS x UNION ALL SELECT e1, e2 FROM pm1.g1", new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT * FROM (EXEC pm1.sp2(1)) AS x UNION ALL SELECT e1, e2 FROM pm1.g1", new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore()), //$NON-NLS-1$
new String[] { "EXEC pm1.sp2(1)", "SELECT e1, e2 FROM pm1.g1" }); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -28,6 +28,7 @@
import org.junit.Test;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.optimizer.TestOptimizer.AntiSemiJoin;
import org.teiid.query.optimizer.TestOptimizer.ComparisonMode;
import org.teiid.query.optimizer.TestOptimizer.SemiJoin;
@@ -38,8 +39,6 @@
import org.teiid.query.optimizer.relational.rules.RuleMergeCriteria;
import org.teiid.query.processor.ProcessorPlan;
import org.teiid.query.rewriter.TestQueryRewriter;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.translator.SourceSystemFunctions;
@@ -56,7 +55,7 @@
caps.setCapabilitySupport(Capability.CRITERIA_EXISTS, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// Plan query
ProcessorPlan plan = TestOptimizer.helpPlan(sql, metadata,
@@ -96,7 +95,7 @@
caps.setCapabilitySupport(Capability.CRITERIA_EXISTS, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// Plan query
ProcessorPlan plan = TestOptimizer.helpPlan(sql, metadata,
@@ -138,7 +137,7 @@
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("SELECT intkey FROM bqt1.smalla AS n WHERE intkey = (SELECT MAX(intkey) FROM bqt1.smallb AS s WHERE s.stringkey = n.stringkey )", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT intkey FROM bqt1.smalla AS n WHERE intkey = (SELECT MAX(intkey) FROM bqt1.smallb AS s WHERE s.stringkey = n.stringkey )", RealMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
null, capFinder,
new String[] { "SELECT intkey FROM bqt1.smalla AS n WHERE intkey = (SELECT MAX(intkey) FROM bqt1.smallb AS s WHERE s.stringkey = n.stringkey)" }, SHOULD_SUCCEED); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
@@ -179,7 +178,7 @@
String sqlOut = "SELECT g_0.intkey FROM bqt1.mediuma AS g_0, bqt1.smallb AS g_1 WHERE (g_0.stringkey = concat('1', concat(g_1.intkey, '0'))) AND (g_0.datevalue = (SELECT MAX(g_2.datevalue) FROM bqt1.mediuma AS g_2, bqt1.smallb AS g_3 WHERE (g_2.stringkey = concat('1', concat(g_3.intkey, '0'))) AND (g_3.stringkey LIKE '%0') AND (g_3.stringkey = g_1.stringkey))) AND (g_1.stringkey LIKE '%0')"; //$NON-NLS-1$
- ProcessorPlan plan = helpPlan(sqlIn, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = helpPlan(sqlIn, RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] { sqlOut }, SHOULD_SUCCEED);
checkNodeTypes(plan, FULL_PUSHDOWN);
@@ -218,7 +217,7 @@
String sqlOut =
"SELECT SmallA__1.IntKey FROM BQT1.SmallA AS SmallA__1 WHERE (SmallA__1.StringKey = 'VOD.L') AND (SmallA__1.DateValue = (SELECT MAX(BQT1.SmallA.DateValue) FROM BQT1.SmallA WHERE BQT1.SmallA.StringKey = SmallA__1.StringKey))"; //$NON-NLS-1$
- ProcessorPlan plan = helpPlan(sqlIn, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = helpPlan(sqlIn, RealMetadataFactory.exampleBQTCached(),
null, capFinder,
new String[] { sqlOut }, SHOULD_SUCCEED);
checkNodeTypes(plan, FULL_PUSHDOWN);
@@ -236,7 +235,7 @@
caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_SCALAR, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("SELECT stringkey, (SELECT intkey FROM BQT1.SmallA AS b WHERE Intnum = 22) FROM BQT1.SmallA", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT stringkey, (SELECT intkey FROM BQT1.SmallA AS b WHERE Intnum = 22) FROM BQT1.SmallA", RealMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
null, capFinder,
new String[] { "SELECT stringkey, (SELECT intkey FROM BQT1.SmallA AS b WHERE Intnum = 22) FROM BQT1.SmallA" }, SHOULD_SUCCEED); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
@@ -258,7 +257,7 @@
}
@Test public void testCorrelatedSubquery1() {
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (select e1 FROM pm2.g1 WHERE pm1.g1.e2 = pm2.g1.e2)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (select e1 FROM pm2.g1 WHERE pm1.g1.e2 = pm2.g1.e2)", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT e1, pm1.g1.e2 FROM pm1.g1" }); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
1, // Access
@@ -279,7 +278,7 @@
}
@Test public void testCorrelatedSubquery2() {
- ProcessorPlan plan = helpPlan("Select e1, (select e1 FROM pm2.g1 WHERE pm1.g1.e2 = pm2.g1.e2) from pm1.g1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("Select e1, (select e1 FROM pm2.g1 WHERE pm1.g1.e2 = pm2.g1.e2) from pm1.g1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT e1, pm1.g1.e2 FROM pm1.g1" }); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
1, // Access
@@ -364,7 +363,7 @@
@Test public void testCorrelatedSubqueryInTransformation2() {
String sql = "Select * from vm1.g20"; //$NON-NLS-1$
- ProcessorPlan plan = helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = helpPlan(sql, RealMetadataFactory.example1Cached(),
new String[] { "SELECT pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 FROM pm1.g1" }); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
1, // Access
@@ -394,7 +393,7 @@
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, false);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (select max(e1) FROM pm1.g2)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (select max(e1) FROM pm1.g2)", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
null, capFinder,
new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
@@ -426,7 +425,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
capFinder.addCapabilities("pm2", getTypicalCapabilities()); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (select e1 FROM pm2.g1)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (select e1 FROM pm2.g1)", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
null, capFinder,
new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
@@ -459,7 +458,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
capFinder.addCapabilities("pm2", new BasicSourceCapabilities()); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (select * from xmltest.doc1)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (select * from xmltest.doc1)", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
null, capFinder,
new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
@@ -492,7 +491,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
capFinder.addCapabilities("pm2", new BasicSourceCapabilities()); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT ltrim(e1) FROM pm1.g2)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT ltrim(e1) FROM pm1.g2)", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
null, capFinder,
new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
@@ -524,7 +523,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
capFinder.addCapabilities("pm2", new BasicSourceCapabilities()); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT 'xyz' FROM pm1.g2)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT 'xyz' FROM pm1.g2)", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
null, capFinder,
new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
@@ -556,7 +555,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
capFinder.addCapabilities("pm2", new BasicSourceCapabilities()); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT e1 FROM pm1.g2 ORDER BY e1 limit 2)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT e1 FROM pm1.g2 ORDER BY e1 limit 2)", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
null, capFinder,
new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
@@ -590,7 +589,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
capFinder.addCapabilities("pm2", new BasicSourceCapabilities()); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT rtrim(ltrim(e1)) FROM pm1.g2)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT rtrim(ltrim(e1)) FROM pm1.g2)", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
null, capFinder,
new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
@@ -622,7 +621,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
capFinder.addCapabilities("pm2", new BasicSourceCapabilities()); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (EXEC pm1.sqsp1())", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (EXEC pm1.sqsp1())", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
null, capFinder,
new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
@@ -654,7 +653,7 @@
caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, false);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT pm1.g2.e1 FROM pm1.g2 WHERE pm1.g2.e1 = pm1.g1.e1)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in (SELECT pm1.g2.e1 FROM pm1.g2 WHERE pm1.g2.e1 = pm1.g1.e1)", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
null, capFinder,
new String[] { "SELECT e1 FROM pm1.g1" }, SHOULD_SUCCEED); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
@@ -693,7 +692,7 @@
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- ProcessorPlan plan = helpPlan("SELECT intkey FROM bqt1.smalla AS n WHERE intkey = (SELECT MAX(intkey) FROM bqt1.smallb AS s WHERE s.stringkey = n.stringkey ) or intkey = (SELECT MIN(intkey) FROM bqt1.smallb AS s WHERE s.stringkey = n.stringkey )", FakeMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("SELECT intkey FROM bqt1.smalla AS n WHERE intkey = (SELECT MAX(intkey) FROM bqt1.smallb AS s WHERE s.stringkey = n.stringkey ) or intkey = (SELECT MIN(intkey) FROM bqt1.smallb AS s WHERE s.stringkey = n.stringkey )", RealMetadataFactory.exampleBQTCached(), //$NON-NLS-1$
null, capFinder,
new String[] { "SELECT g_0.intkey FROM bqt1.smalla AS g_0 WHERE (g_0.intkey = (SELECT MAX(g_1.intkey) FROM bqt1.smallb AS g_1 WHERE g_1.stringkey = g_0.stringkey)) OR (g_0.intkey = (SELECT MIN(g_2.IntKey) FROM bqt1.smallb AS g_2 WHERE g_2.StringKey = g_0.stringkey))" }, SHOULD_SUCCEED); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
@@ -704,7 +703,7 @@
*/
@Test public void testProjectSubqueryPushdown() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
BasicSourceCapabilities caps = getTypicalCapabilities();
caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
@@ -722,7 +721,7 @@
}
@Test public void testScalarSubquery2() {
- ProcessorPlan plan = helpPlan("Select e1, (select e1 FROM pm2.g1 where pm1.g1.e1 = 'x') as X from pm1.g1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("Select e1, (select e1 FROM pm2.g1 where pm1.g1.e1 = 'x') as X from pm1.g1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT e1 FROM pm1.g1" }); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
1, // Access
@@ -746,66 +745,66 @@
* Technically this is not a full push-down, but the subquery will be evaluated prior to pushdown
*/
@Test public void testCompareSubquery4() throws TeiidComponentException, TeiidProcessingException {
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 > (select e1 FROM pm2.g1 where e2 = 13)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 > (select e1 FROM pm2.g1 where e2 = 13)", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT g_0.e1 FROM pm1.g1 AS g_0 WHERE g_0.e1 > (SELECT g_0.e1 FROM pm2.g1 AS g_0 WHERE g_0.e2 = 13)" }, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
}
@Test public void testScalarSubquery1() throws TeiidComponentException, TeiidProcessingException {
- ProcessorPlan plan = helpPlan("Select e1, (select e1 FROM pm2.g1 where e1 = 'x') from pm1.g1", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("Select e1, (select e1 FROM pm2.g1 where e1 = 'x') from pm1.g1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT g_0.e1, (SELECT g_0.e1 FROM pm2.g1 AS g_0 WHERE g_0.e1 = 'x') FROM pm1.g1 AS g_0" }, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
}
@Test public void testSubqueryRewriteToJoinDistinct() throws Exception {
- TestQueryRewriter.helpTestRewriteCommand("Select distinct e1 from pm1.g1 as x where exists (select pm1.g1.e1 FROM pm1.g1 where e1 = x.e1)", "SELECT DISTINCT e1 FROM pm1.g1 AS x, (SELECT pm1.g1.e1 FROM pm1.g1) AS X__1 WHERE x.e1 = X__1.e1", FakeMetadataFactory.example1Cached());
+ TestQueryRewriter.helpTestRewriteCommand("Select distinct e1 from pm1.g1 as x where exists (select pm1.g1.e1 FROM pm1.g1 where e1 = x.e1)", "SELECT DISTINCT e1 FROM pm1.g1 AS x, (SELECT pm1.g1.e1 FROM pm1.g1) AS X__1 WHERE x.e1 = X__1.e1", RealMetadataFactory.example1Cached());
}
/**
* Agg does not depend on cardinality
*/
@Test public void testSubqueryRewriteToJoinGroupBy() throws Exception {
- TestQueryRewriter.helpTestRewriteCommand("Select max(e1) from pm1.g1 as x where exists (select pm1.g1.e1 FROM pm1.g1 where e1 = x.e1) group by e2", "SELECT MAX(e1) FROM pm1.g1 AS x, (SELECT pm1.g1.e1 FROM pm1.g1) AS X__1 WHERE x.e1 = X__1.e1 GROUP BY e2", FakeMetadataFactory.example1Cached());
+ TestQueryRewriter.helpTestRewriteCommand("Select max(e1) from pm1.g1 as x where exists (select pm1.g1.e1 FROM pm1.g1 where e1 = x.e1) group by e2", "SELECT MAX(e1) FROM pm1.g1 AS x, (SELECT pm1.g1.e1 FROM pm1.g1) AS X__1 WHERE x.e1 = X__1.e1 GROUP BY e2", RealMetadataFactory.example1Cached());
}
/**
* Agg does depend on cardinality
*/
@Test public void testSubqueryRewriteToJoinGroupBy1() throws Exception {
- TestQueryRewriter.helpTestRewriteCommand("Select avg(e1) from pm1.g1 as x where exists (select pm1.g1.e1 FROM pm1.g1 where e1 = x.e1) group by e2", "SELECT AVG(e1) FROM pm1.g1 AS x WHERE EXISTS (SELECT pm1.g1.e1 FROM pm1.g1 WHERE e1 = x.e1 LIMIT 1) GROUP BY e2", FakeMetadataFactory.example1Cached());
+ TestQueryRewriter.helpTestRewriteCommand("Select avg(e1) from pm1.g1 as x where exists (select pm1.g1.e1 FROM pm1.g1 where e1 = x.e1) group by e2", "SELECT AVG(e1) FROM pm1.g1 AS x WHERE EXISTS (SELECT pm1.g1.e1 FROM pm1.g1 WHERE e1 = x.e1 LIMIT 1) GROUP BY e2", RealMetadataFactory.example1Cached());
}
@Test public void testSubqueryRewriteToJoin() throws Exception {
- TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where exists (select pm1.g1.e1 FROM pm1.g1 where e1 = pm3.g1.e1)", "SELECT e1 FROM pm3.g1, (SELECT pm1.g1.e1 FROM pm1.g1) AS X__1 WHERE pm3.g1.e1 = X__1.e1", FakeMetadataFactory.example4());
+ TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where exists (select pm1.g1.e1 FROM pm1.g1 where e1 = pm3.g1.e1)", "SELECT e1 FROM pm3.g1, (SELECT pm1.g1.e1 FROM pm1.g1) AS X__1 WHERE pm3.g1.e1 = X__1.e1", RealMetadataFactory.example4());
}
@Test public void testSubqueryRewriteToJoin1() throws Exception {
- TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e1 in /*+ mj */ (select pm1.g1.e1 as x FROM pm1.g1)", "SELECT e1 FROM pm3.g1, (SELECT pm1.g1.e1 AS x FROM pm1.g1) AS X__1 WHERE pm3.g1.e1 = X__1.x", FakeMetadataFactory.example4());
+ TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e1 in /*+ mj */ (select pm1.g1.e1 as x FROM pm1.g1)", "SELECT e1 FROM pm3.g1, (SELECT pm1.g1.e1 AS x FROM pm1.g1) AS X__1 WHERE pm3.g1.e1 = X__1.x", RealMetadataFactory.example4());
}
@Test public void testSubqueryRewriteToJoin2() throws Exception {
- TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e1 in /*+ mj */ (select pm1.g1.e1 || 1 FROM pm1.g1)", "SELECT e1 FROM pm3.g1, (SELECT concat(pm1.g1.e1, '1') AS EXPR FROM pm1.g1) AS X__1 WHERE pm3.g1.e1 = X__1.EXPR", FakeMetadataFactory.example4());
+ TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e1 in /*+ mj */ (select pm1.g1.e1 || 1 FROM pm1.g1)", "SELECT e1 FROM pm3.g1, (SELECT concat(pm1.g1.e1, '1') AS EXPR FROM pm1.g1) AS X__1 WHERE pm3.g1.e1 = X__1.EXPR", RealMetadataFactory.example4());
}
/**
* Even though this situation is essentially the same as above, we don't yet handle it
*/
@Test public void testSubqueryRewriteToJoin3() throws Exception {
- TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where exists (select pm1.g1.e2 FROM pm1.g1 WHERE pm3.g1.e1 = pm1.g1.e1 || 1)", "SELECT e1 FROM pm3.g1 WHERE EXISTS (SELECT pm1.g1.e2 FROM pm1.g1 WHERE concat(pm1.g1.e1, '1') = pm3.g1.e1 LIMIT 1)", FakeMetadataFactory.example4());
+ TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where exists (select pm1.g1.e2 FROM pm1.g1 WHERE pm3.g1.e1 = pm1.g1.e1 || 1)", "SELECT e1 FROM pm3.g1 WHERE EXISTS (SELECT pm1.g1.e2 FROM pm1.g1 WHERE concat(pm1.g1.e1, '1') = pm3.g1.e1 LIMIT 1)", RealMetadataFactory.example4());
}
@Test public void testSubqueryRewriteToJoinWithOtherCriteria() throws Exception {
- TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e1 in /*+ mj */ (select pm1.g1.e1 FROM pm1.g1 where e2 < pm3.g1.e2)", "SELECT e1 FROM pm3.g1, (SELECT pm1.g1.e1, e2 FROM pm1.g1) AS X__1 WHERE (X__1.e2 < pm3.g1.e2) AND (pm3.g1.e1 = X__1.e1)", FakeMetadataFactory.example4());
+ TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e1 in /*+ mj */ (select pm1.g1.e1 FROM pm1.g1 where e2 < pm3.g1.e2)", "SELECT e1 FROM pm3.g1, (SELECT pm1.g1.e1, e2 FROM pm1.g1) AS X__1 WHERE (X__1.e2 < pm3.g1.e2) AND (pm3.g1.e1 = X__1.e1)", RealMetadataFactory.example4());
}
@Test public void testDontRewriteToJoinWithOtherCriteria() throws Exception {
System.setProperty(RuleMergeCriteria.UNNEST_DEFAULT, Boolean.TRUE.toString());
- TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e1 in /*+ NO_UNNEST */ (select pm1.g1.e1 FROM pm1.g1 where e2 < pm3.g1.e2)", "SELECT e1 FROM pm3.g1 WHERE pm3.g1.e1 IN /*+ NO_UNNEST */ (SELECT pm1.g1.e1 FROM pm1.g1 WHERE e2 < pm3.g1.e2)", FakeMetadataFactory.example4());
+ TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e1 in /*+ NO_UNNEST */ (select pm1.g1.e1 FROM pm1.g1 where e2 < pm3.g1.e2)", "SELECT e1 FROM pm3.g1 WHERE pm3.g1.e1 IN /*+ NO_UNNEST */ (SELECT pm1.g1.e1 FROM pm1.g1 WHERE e2 < pm3.g1.e2)", RealMetadataFactory.example4());
}
@Test public void testSubqueryRewriteToJoinWithAggregate() throws Exception {
System.setProperty(RuleMergeCriteria.UNNEST_DEFAULT, Boolean.TRUE.toString());
- TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e2 < (select max(e2) FROM pm1.g1 where pm3.g1.e1 = e1)", "SELECT e1 FROM pm3.g1, (SELECT MAX(e2) AS MAX, e1 FROM pm1.g1 GROUP BY e1) AS X__1 WHERE (pm3.g1.e2 < X__1.MAX) AND (pm3.g1.e1 = X__1.e1)", FakeMetadataFactory.example4());
+ TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e2 < (select max(e2) FROM pm1.g1 where pm3.g1.e1 = e1)", "SELECT e1 FROM pm3.g1, (SELECT MAX(e2) AS MAX, e1 FROM pm1.g1 GROUP BY e1) AS X__1 WHERE (pm3.g1.e2 < X__1.MAX) AND (pm3.g1.e1 = X__1.e1)", RealMetadataFactory.example4());
}
/**
@@ -813,12 +812,12 @@
* @throws Exception
*/
@Test public void testSubqueryRewriteToJoinWithAggregate1() throws Exception {
- TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e2 < (select max(e2) FROM pm1.g1 where pm3.g1.e1 = e1 and pm3.g1.e3 > e3)", "SELECT e1 FROM pm3.g1 WHERE pm3.g1.e2 < (SELECT MAX(e2) FROM pm1.g1 WHERE (e1 = pm3.g1.e1) AND (e3 < pm3.g1.e3))", FakeMetadataFactory.example4());
+ TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e2 < (select max(e2) FROM pm1.g1 where pm3.g1.e1 = e1 and pm3.g1.e3 > e3)", "SELECT e1 FROM pm3.g1 WHERE pm3.g1.e2 < (SELECT MAX(e2) FROM pm1.g1 WHERE (e1 = pm3.g1.e1) AND (e3 < pm3.g1.e3))", RealMetadataFactory.example4());
}
@Test public void testSubqueryRewriteToJoinWithAggregate2() throws Exception {
System.setProperty(RuleMergeCriteria.UNNEST_DEFAULT, Boolean.TRUE.toString());
- TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e2 < (select max(e2) FROM pm1.g1 WHERE pm3.g1.e1 = e1 HAVING min(e3) < pm3.g1.e3)", "SELECT e1 FROM pm3.g1, (SELECT MAX(e2) AS MAX, e1, MIN(e3) AS MIN FROM pm1.g1 GROUP BY e1) AS X__1 WHERE (X__1.MIN < pm3.g1.e3) AND (pm3.g1.e2 < X__1.MAX) AND (pm3.g1.e1 = X__1.e1)", FakeMetadataFactory.example4());
+ TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e2 < (select max(e2) FROM pm1.g1 WHERE pm3.g1.e1 = e1 HAVING min(e3) < pm3.g1.e3)", "SELECT e1 FROM pm3.g1, (SELECT MAX(e2) AS MAX, e1, MIN(e3) AS MIN FROM pm1.g1 GROUP BY e1) AS X__1 WHERE (X__1.MIN < pm3.g1.e3) AND (pm3.g1.e2 < X__1.MAX) AND (pm3.g1.e1 = X__1.e1)", RealMetadataFactory.example4());
}
/**
@@ -826,7 +825,7 @@
* @throws Exception
*/
@Test public void testSubqueryRewriteNot() throws Exception {
- TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e2 not in (select e2 FROM pm1.g1 where pm3.g1.e1 = e1)", "SELECT e1 FROM pm3.g1 WHERE pm3.g1.e2 NOT IN (SELECT e2 FROM pm1.g1 WHERE e1 = pm3.g1.e1)", FakeMetadataFactory.example4());
+ TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e2 not in (select e2 FROM pm1.g1 where pm3.g1.e1 = e1)", "SELECT e1 FROM pm3.g1 WHERE pm3.g1.e2 NOT IN (SELECT e2 FROM pm1.g1 WHERE e1 = pm3.g1.e1)", RealMetadataFactory.example4());
}
/**
@@ -834,19 +833,19 @@
* @throws Exception
*/
@Test public void testSubqueryRewriteAll() throws Exception {
- TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e2 = all (select e2 FROM pm1.g1 where pm3.g1.e1 = e1)", "SELECT e1 FROM pm3.g1 WHERE pm3.g1.e2 = ALL (SELECT e2 FROM pm1.g1 WHERE e1 = pm3.g1.e1)", FakeMetadataFactory.example4());
+ TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e2 = all (select e2 FROM pm1.g1 where pm3.g1.e1 = e1)", "SELECT e1 FROM pm3.g1 WHERE pm3.g1.e2 = ALL (SELECT e2 FROM pm1.g1 WHERE e1 = pm3.g1.e1)", RealMetadataFactory.example4());
}
@Test public void testSubqueryExpressionJoin() throws Exception {
System.setProperty(RuleMergeCriteria.UNNEST_DEFAULT, Boolean.TRUE.toString());
- TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e2 < (Select max(e2) from pm2.g2 where e1 = pm3.g1.e1 having convert(min(e2), string) > pm3.g1.e1)", "SELECT e1 FROM pm3.g1, (SELECT MAX(e2) AS MAX, e1, MIN(e2) AS MIN FROM pm2.g2 GROUP BY e1) AS X__1 WHERE (convert(X__1.MIN, string) > pm3.g1.e1) AND (pm3.g1.e2 < X__1.MAX) AND (pm3.g1.e1 = X__1.e1)", FakeMetadataFactory.example4());
+ TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e2 < (Select max(e2) from pm2.g2 where e1 = pm3.g1.e1 having convert(min(e2), string) > pm3.g1.e1)", "SELECT e1 FROM pm3.g1, (SELECT MAX(e2) AS MAX, e1, MIN(e2) AS MIN FROM pm2.g2 GROUP BY e1) AS X__1 WHERE (convert(X__1.MIN, string) > pm3.g1.e1) AND (pm3.g1.e2 < X__1.MAX) AND (pm3.g1.e1 = X__1.e1)", RealMetadataFactory.example4());
}
/**
* Must be handled as a semi-join, rather than a regular join
*/
@Test public void testSemiJoin() {
- ProcessorPlan plan = helpPlan("Select e1 from pm2.g2 where e2 in /*+ mj */ (select count(e2) FROM pm1.g2 group by e1 having e1 < pm2.g2.e3)", FakeMetadataFactory.example4(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("Select e1 from pm2.g2 where e2 in /*+ mj */ (select count(e2) FROM pm1.g2 group by e1 having e1 < pm2.g2.e3)", RealMetadataFactory.example4(), //$NON-NLS-1$
new String[] { "SELECT g_0.e2 AS c_0, g_0.e3 AS c_1, g_0.e1 AS c_2 FROM pm2.g2 AS g_0 ORDER BY c_0" }); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
1, // Access
@@ -871,7 +870,7 @@
* This will not plan as a anti semi-join since the cost seems too high
*/
@Test public void testNoAntiSemiJoinExistsCosting() {
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g2 as o where not exists (select 1 from pm3.g1 where e1 = o.e1 having o.e2 = count(e2))", FakeMetadataFactory.example4(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g2 as o where not exists (select 1 from pm3.g1 where e1 = o.e1 having o.e2 = count(e2))", RealMetadataFactory.example4(), //$NON-NLS-1$
new String[] { "SELECT g_0.e1, g_0.e2 FROM pm1.g2 AS g_0" }); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
1, // Access
@@ -895,7 +894,7 @@
* Same as above, but the source is much larger, so a semi-join is favorable
*/
@Test public void testSemiJoinExistsCosting() {
- ProcessorPlan plan = helpPlan("Select e1 from pm2.g2 as o where not exists (select 1 from pm3.g1 where e1 = o.e1 having o.e2 = count(e2))", FakeMetadataFactory.example4(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("Select e1 from pm2.g2 as o where not exists (select 1 from pm3.g1 where e1 = o.e1 having o.e2 = count(e2))", RealMetadataFactory.example4(), //$NON-NLS-1$
new String[] { "SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM pm2.g2 AS g_0 ORDER BY c_0, c_1" }); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
1, // Access
@@ -917,7 +916,7 @@
}
@Test public void testAntiSemiJoinExistsHint() {
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g2 as o where not exists /*+ MJ */ (select 1 from pm3.g1 where e1 = o.e1 having o.e2 = count(e2))", FakeMetadataFactory.example4(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g2 as o where not exists /*+ MJ */ (select 1 from pm3.g1 where e1 = o.e1 having o.e2 = count(e2))", RealMetadataFactory.example4(), //$NON-NLS-1$
new String[] { "SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM pm1.g2 AS g_0 ORDER BY c_0, c_1" }); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
1, // Access
@@ -943,7 +942,7 @@
}
@Test public void testAntiSemiJoinInHint() {
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g2 as o where e2 NOT IN /*+ MJ */ (select count(e2) from pm3.g1 where e1 = o.e1)", FakeMetadataFactory.example4(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g2 as o where e2 NOT IN /*+ MJ */ (select count(e2) from pm3.g1 where e1 = o.e1)", RealMetadataFactory.example4(), //$NON-NLS-1$
new String[] { "SELECT g_0.e2 AS c_0, g_0.e1 AS c_1 FROM pm1.g2 AS g_0 ORDER BY c_1, c_0" }); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
1, // Access
@@ -969,7 +968,7 @@
}
@Test public void testNonSemiJoin() throws Exception {
- ProcessorPlan plan = helpPlan("Select x from xmltable('/a/b' passing convert('<a/>', xml) columns x integer path '@x') as t where x = (select count(e2) FROM pm1.g2)", FakeMetadataFactory.example4(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("Select x from xmltable('/a/b' passing convert('<a/>', xml) columns x integer path '@x') as t where x = (select count(e2) FROM pm1.g2)", RealMetadataFactory.example4(), //$NON-NLS-1$
new String[] {}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
0, // Access
@@ -1001,7 +1000,7 @@
}
@Test public void testInvalidGeneratedSemijoinQuery1() throws Exception {
- TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e2 IN /*+ mj */ (Select max(e2) from pm2.g2 where e1 = pm3.g1.e1)", "SELECT e1 FROM pm3.g1, (SELECT MAX(e2) AS MAX, e1 FROM pm2.g2 GROUP BY e1) AS X__1 WHERE (pm3.g1.e1 = X__1.e1) AND (pm3.g1.e2 = X__1.MAX)", FakeMetadataFactory.example4());
+ TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e2 IN /*+ mj */ (Select max(e2) from pm2.g2 where e1 = pm3.g1.e1)", "SELECT e1 FROM pm3.g1, (SELECT MAX(e2) AS MAX, e1 FROM pm2.g2 GROUP BY e1) AS X__1 WHERE (pm3.g1.e1 = X__1.e1) AND (pm3.g1.e2 = X__1.MAX)", RealMetadataFactory.example4());
}
@Test public void testCompareSubquery2() throws Exception {
@@ -1011,7 +1010,7 @@
}
@Test public void testUncorrelatedSet() {
- ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in /*+ mj */ (select e1 FROM pm2.g1)", FakeMetadataFactory.example1Cached(), //$NON-NLS-1$
+ ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 in /*+ mj */ (select e1 FROM pm2.g1)", RealMetadataFactory.example1Cached(), //$NON-NLS-1$
new String[] { "SELECT DISTINCT g_0.e1 FROM pm2.g1 AS g_0", "SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 ORDER BY c_0" }); //$NON-NLS-1$
checkNodeTypes(plan, new int[] {
2, // Access
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -28,7 +28,7 @@
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
import org.teiid.query.processor.ProcessorPlan;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
@SuppressWarnings("nls")
public class TestUnionPlanning {
@@ -41,7 +41,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT IntNum FROM BQT2.SmallA UNION ALL SELECT IntNum FROM BQT1.SmallA", FakeMetadataFactory.exampleBQTCached(), null, capFinder,//$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT IntNum FROM BQT2.SmallA UNION ALL SELECT IntNum FROM BQT1.SmallA", RealMetadataFactory.exampleBQTCached(), null, capFinder,//$NON-NLS-1$
new String[] { "SELECT IntNum FROM BQT2.SmallA", "SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT IntNum FROM BQT1.SmallA" }, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -73,7 +73,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT IntKey FROM BQT1.SmallA UNION SELECT IntNum FROM BQT2.SmallA UNION ALL SELECT IntNum FROM BQT1.SmallA", FakeMetadataFactory.exampleBQTCached(), null, capFinder,//$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT IntKey FROM BQT1.SmallA UNION SELECT IntNum FROM BQT2.SmallA UNION ALL SELECT IntNum FROM BQT1.SmallA", RealMetadataFactory.exampleBQTCached(), null, capFinder,//$NON-NLS-1$
new String[] { "SELECT IntNum FROM BQT2.SmallA", "SELECT IntKey FROM BQT1.SmallA", "SELECT IntNum FROM BQT1.SmallA" }, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -104,7 +104,7 @@
BasicSourceCapabilities caps1 = TestOptimizer.getTypicalCapabilities();
capFinder.addCapabilities("BQT3", caps1); //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT IntNum FROM BQT2.SmallA UNION ALL SELECT IntNum FROM BQT1.SmallA UNION ALL SELECT IntNum FROM BQT3.SmallA UNION ALL SELECT IntNum FROM BQT2.SmallA", FakeMetadataFactory.exampleBQTCached(), null, capFinder,//$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT IntNum FROM BQT2.SmallA UNION ALL SELECT IntNum FROM BQT1.SmallA UNION ALL SELECT IntNum FROM BQT3.SmallA UNION ALL SELECT IntNum FROM BQT2.SmallA", RealMetadataFactory.exampleBQTCached(), null, capFinder,//$NON-NLS-1$
new String[] { "SELECT IntNum FROM BQT2.SmallA UNION ALL SELECT IntNum FROM BQT2.SmallA", "SELECT IntNum FROM BQT3.SmallA", "SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT IntNum FROM BQT1.SmallA" }, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -135,7 +135,7 @@
BasicSourceCapabilities caps1 = TestOptimizer.getTypicalCapabilities();
capFinder.addCapabilities("BQT3", caps1); //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan("SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT IntNum FROM BQT2.SmallA UNION ALL SELECT IntNum FROM BQT1.SmallA UNION ALL SELECT IntNum FROM BQT3.SmallA UNION ALL (SELECT IntNum FROM BQT2.SmallA UNION ALL SELECT IntNum FROM BQT2.SmallA)", FakeMetadataFactory.exampleBQTCached(), null, capFinder,//$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT IntNum FROM BQT2.SmallA UNION ALL SELECT IntNum FROM BQT1.SmallA UNION ALL SELECT IntNum FROM BQT3.SmallA UNION ALL (SELECT IntNum FROM BQT2.SmallA UNION ALL SELECT IntNum FROM BQT2.SmallA)", RealMetadataFactory.exampleBQTCached(), null, capFinder,//$NON-NLS-1$
new String[] { "SELECT IntNum FROM BQT3.SmallA", "SELECT IntNum FROM BQT2.SmallA UNION ALL (SELECT IntNum FROM BQT2.SmallA UNION ALL SELECT IntNum FROM BQT2.SmallA)", "SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT IntNum FROM BQT1.SmallA" }, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -157,7 +157,7 @@
}
@Test public void testUnionPushDownWithJoin() {
- ProcessorPlan plan = TestOptimizer.helpPlan("select * from (SELECT IntKey FROM BQT1.SmallA where intkey in (1, 2) UNION ALL SELECT intkey FROM BQT2.SmallA where intkey in (3, 4)) A inner join (SELECT intkey FROM BQT1.SmallB where intkey in (1, 2) UNION ALL SELECT intkey FROM BQT2.SmallB where intkey in (3, 4)) B on a.intkey = b.intkey", FakeMetadataFactory.exampleBQTCached(), null, TestOptimizer.getGenericFinder(),//$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select * from (SELECT IntKey FROM BQT1.SmallA where intkey in (1, 2) UNION ALL SELECT intkey FROM BQT2.SmallA where intkey in (3, 4)) A inner join (SELECT intkey FROM BQT1.SmallB where intkey in (1, 2) UNION ALL SELECT intkey FROM BQT2.SmallB where intkey in (3, 4)) B on a.intkey = b.intkey", RealMetadataFactory.exampleBQTCached(), null, TestOptimizer.getGenericFinder(),//$NON-NLS-1$
new String[] { "SELECT g_1.intkey, g_0.intkey FROM BQT2.SmallA AS g_0, BQT2.SmallB AS g_1 WHERE (g_0.intkey = g_1.intkey) AND (g_0.intkey IN (3, 4)) AND (g_1.intkey IN (3, 4))",
"SELECT g_1.intkey, g_0.IntKey FROM BQT1.SmallA AS g_0, BQT1.SmallB AS g_1 WHERE (g_0.IntKey = g_1.intkey) AND (g_0.intkey IN (1, 2)) AND (g_1.intkey IN (1, 2))" }, TestOptimizer.SHOULD_SUCCEED);
@@ -180,12 +180,12 @@
}
@Test public void testUnionPushDownWithJoinNoMatches() {
- TestOptimizer.helpPlan("select * from (SELECT IntKey FROM BQT1.SmallA where intkey in (1, 2) UNION ALL SELECT intkey FROM BQT2.SmallA where intkey in (3, 4)) A inner join (SELECT intkey FROM BQT1.SmallB where intkey in (5, 6) UNION ALL SELECT intkey FROM BQT2.SmallB where intkey in (7, 8)) B on a.intkey = b.intkey", FakeMetadataFactory.exampleBQTCached(), null, TestOptimizer.getGenericFinder(),//$NON-NLS-1$
+ TestOptimizer.helpPlan("select * from (SELECT IntKey FROM BQT1.SmallA where intkey in (1, 2) UNION ALL SELECT intkey FROM BQT2.SmallA where intkey in (3, 4)) A inner join (SELECT intkey FROM BQT1.SmallB where intkey in (5, 6) UNION ALL SELECT intkey FROM BQT2.SmallB where intkey in (7, 8)) B on a.intkey = b.intkey", RealMetadataFactory.exampleBQTCached(), null, TestOptimizer.getGenericFinder(),//$NON-NLS-1$
new String[] {}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$
}
@Test public void testUnionPushDownWithJoin1() throws Exception {
- ProcessorPlan plan = TestOptimizer.helpPlan("select * from (SELECT IntKey FROM BQT1.SmallA where intkey in (1, 2) UNION ALL SELECT intkey FROM BQT2.SmallA where intkey in (3, 4)) A inner join (SELECT intkey FROM BQT1.SmallB where intkey in (1, 2) UNION ALL SELECT intkey FROM BQT2.SmallB where intkey in (3, 4)) B on a.intkey = b.intkey where a.intkey in (1, 4)", FakeMetadataFactory.exampleBQTCached(), null, TestOptimizer.getGenericFinder(),//$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select * from (SELECT IntKey FROM BQT1.SmallA where intkey in (1, 2) UNION ALL SELECT intkey FROM BQT2.SmallA where intkey in (3, 4)) A inner join (SELECT intkey FROM BQT1.SmallB where intkey in (1, 2) UNION ALL SELECT intkey FROM BQT2.SmallB where intkey in (3, 4)) B on a.intkey = b.intkey where a.intkey in (1, 4)", RealMetadataFactory.exampleBQTCached(), null, TestOptimizer.getGenericFinder(),//$NON-NLS-1$
new String[] { "SELECT g_1.intkey, g_0.IntKey FROM BQT1.SmallA AS g_0, BQT1.SmallB AS g_1 WHERE (g_0.IntKey = g_1.intkey) AND (g_0.intkey IN (1)) AND (g_0.IntKey = 1) AND (g_1.intkey = 1)",
"SELECT g_1.intkey, g_0.intkey FROM BQT2.SmallA AS g_0, BQT2.SmallB AS g_1 WHERE (g_0.intkey = g_1.intkey) AND (g_0.intkey IN (4)) AND (g_0.intkey = 4) AND (g_1.intkey = 4)" }, ComparisonMode.EXACT_COMMAND_STRING);
@@ -208,7 +208,7 @@
}
@Test public void testUnionWithPartitionedAggregate() throws Exception {
- ProcessorPlan plan = TestOptimizer.helpPlan("select max(intnum) from (SELECT IntKey, intnum FROM BQT1.SmallA where intkey in (1, 2) UNION ALL SELECT intkey, intnum FROM BQT2.SmallA where intkey in (3, 4)) A group by intkey", FakeMetadataFactory.exampleBQTCached(), null, TestInlineView.getInliveViewCapabilitiesFinder(),//$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select max(intnum) from (SELECT IntKey, intnum FROM BQT1.SmallA where intkey in (1, 2) UNION ALL SELECT intkey, intnum FROM BQT2.SmallA where intkey in (3, 4)) A group by intkey", RealMetadataFactory.exampleBQTCached(), null, TestInlineView.getInliveViewCapabilitiesFinder(),//$NON-NLS-1$
new String[] { "SELECT MAX(v_0.c_1) FROM (SELECT g_0.IntKey AS c_0, g_0.intnum AS c_1 FROM BQT1.SmallA AS g_0 WHERE g_0.intkey IN (1, 2)) AS v_0 GROUP BY v_0.c_0",
"SELECT MAX(v_0.c_1) FROM (SELECT g_0.intkey AS c_0, g_0.intnum AS c_1 FROM BQT2.SmallA AS g_0 WHERE g_0.intkey IN (3, 4)) AS v_0 GROUP BY v_0.c_0" }, ComparisonMode.EXACT_COMMAND_STRING);
@@ -232,7 +232,7 @@
@Test public void testUnionPartitionedWithMerge() throws Exception {
//"select max(intnum) from (select * from (SELECT IntKey, intnum FROM BQT1.SmallA where intkey in (1, 2) UNION ALL SELECT intkey, intnum FROM BQT2.SmallA where intkey in (3, 4)) A where intkey in (1, 2, 3, 4) UNION ALL select intkey, intnum from bqt2.smallb where intkey in 6) B group by intkey"
- ProcessorPlan plan = TestOptimizer.helpPlan("select * from (select * from (SELECT IntKey, intnum FROM BQT1.SmallA UNION ALL SELECT intkey, intnum FROM BQT2.SmallA) A where intkey in (1, 2, 3, 4) UNION ALL select intkey, intnum from bqt2.smallb where intkey in (6)) B inner join (SELECT IntKey, intnum FROM BQT1.SmallA where intkey in (1, 2) UNION ALL SELECT intkey, intnum FROM BQT2.SmallA where intkey in (5, 6)) C on b.intkey = c.intkey", FakeMetadataFactory.exampleBQTCached(), null, TestInlineView.getInliveViewCapabilitiesFinder(),//$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan("select * from (select * from (SELECT IntKey, intnum FROM BQT1.SmallA UNION ALL SELECT intkey, intnum FROM BQT2.SmallA) A where intkey in (1, 2, 3, 4) UNION ALL select intkey, intnum from bqt2.smallb where intkey in (6)) B inner join (SELECT IntKey, intnum FROM BQT1.SmallA where intkey in (1, 2) UNION ALL SELECT intkey, intnum FROM BQT2.SmallA where intkey in (5, 6)) C on b.intkey = c.intkey", RealMetadataFactory.exampleBQTCached(), null, TestInlineView.getInliveViewCapabilitiesFinder(),//$NON-NLS-1$
new String[] { "SELECT g_0.intkey, g_0.intnum FROM BQT2.SmallA AS g_0 WHERE g_0.intkey IN (1, 2)",
"SELECT g_0.IntKey, g_0.intnum FROM BQT1.SmallA AS g_0 WHERE g_0.IntKey IN (1, 2)",
"SELECT g_1.IntKey, g_1.IntNum, g_0.intkey, g_0.intnum FROM bqt2.smallb AS g_0, BQT2.SmallA AS g_1 WHERE (g_0.intkey = g_1.IntKey) AND (g_0.intkey = 6) AND (g_1.IntKey = 6)",
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/proc/TestProcedurePlanner.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/proc/TestProcedurePlanner.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/proc/TestProcedurePlanner.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -29,6 +29,7 @@
import org.teiid.api.exception.query.QueryValidatorException;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.metadata.Table.TriggerEvent;
import org.teiid.query.analysis.AnalysisRecord;
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.metadata.TempMetadataID;
@@ -41,8 +42,7 @@
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.proc.CreateUpdateProcedureCommand;
import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.validator.Validator;
import org.teiid.query.validator.ValidatorFailure;
import org.teiid.query.validator.ValidatorReport;
@@ -54,9 +54,9 @@
private ProcessorPlan helpPlanProcedure(String userQuery,
String procedure,
- String procedureType) throws TeiidComponentException,
+ TriggerEvent procedureType) throws TeiidComponentException,
QueryMetadataException, TeiidProcessingException {
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleUpdateProc(procedureType, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(procedureType, procedure);
QueryParser parser = QueryParser.getQueryParser();
Command userCommand = userQuery != null ? parser.parseCommand(userQuery) : parser.parseCommand(procedure);
@@ -105,7 +105,7 @@
String userUpdateStr = "INSERT into vm1.g1 (e1) values('x')"; //$NON-NLS-1$
helpPlanProcedure(userUpdateStr, procedure,
- FakeMetadataObject.Props.INSERT_PROCEDURE);
+ TriggerEvent.INSERT);
}
// special variable CHANGING used with declared variable
@@ -124,7 +124,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpPlanProcedure(userUpdateStr, procedure,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ TriggerEvent.UPDATE);
}
// special variable CHANGING and INPUT used in conpound criteria
@@ -143,7 +143,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpPlanProcedure(userUpdateStr, procedure,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ TriggerEvent.UPDATE);
}
// special variable CHANGING and INPUT used in conpound criteria, with declared variables
@@ -162,7 +162,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpPlanProcedure(userUpdateStr, procedure,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ TriggerEvent.UPDATE);
}
// virtual group elements used in procedure(HAS CRITERIA)
@@ -177,7 +177,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpPlanProcedure(userUpdateStr, procedure,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ TriggerEvent.UPDATE);
}
// virtual group elements used in procedure in if statement(HAS CRITERIA)
@@ -195,7 +195,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpPlanProcedure(userUpdateStr, procedure,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ TriggerEvent.UPDATE);
}
// testing rows updated incremented, Input and assignment statements
@@ -210,7 +210,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e2=40"; //$NON-NLS-1$
helpPlanProcedure(userUpdateStr, procedure,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ TriggerEvent.UPDATE);
}
// testing select into with virtual group in from clause
@@ -222,7 +222,7 @@
procedure = procedure + "END\n"; //$NON-NLS-1$
helpPlanProcedure(null, procedure,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ TriggerEvent.UPDATE);
}
// testing select into with function in select clause
@@ -234,7 +234,7 @@
procedure = procedure + "END\n"; //$NON-NLS-1$
helpPlanProcedure(null, procedure,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ TriggerEvent.UPDATE);
}
// testing select into with function in select clause
@@ -246,7 +246,7 @@
procedure = procedure + "END\n"; //$NON-NLS-1$
helpPlanProcedure(null, procedure,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ TriggerEvent.UPDATE);
}
@Test public void testCase4504() throws Exception {
@@ -260,7 +260,7 @@
procedure = procedure + "END\n"; //$NON-NLS-1$
helpPlanProcedure(null, procedure,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ TriggerEvent.UPDATE);
}
// =============================================================================
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/TestAliasGenerator.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/TestAliasGenerator.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/TestAliasGenerator.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -36,7 +36,7 @@
import org.teiid.query.sql.lang.Query;
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
@SuppressWarnings("nls")
public class TestAliasGenerator {
@@ -66,13 +66,13 @@
@Test public void testLongOrderByAlias() throws Exception {
String sql = "select pm1.g1.e1 || pm1.g1.e2 as asfasdfadfasdfasdfadfasdfadsfasdfasdfasdfasdfasdfadfa, pm1.g1.e2 from pm1.g1 order by asfasdfadfasdfasdfadfasdfadsfasdfasdfasdfasdfasdfadfa"; //$NON-NLS-1$
String expected = "SELECT concat(g_0.e1, g_0.e2) AS c_0, g_0.e2 AS c_1 FROM pm1.g1 AS g_0 ORDER BY c_0"; //$NON-NLS-1$
- helpTest(sql, expected, true, false, FakeMetadataFactory.example1Cached());
+ helpTest(sql, expected, true, false, RealMetadataFactory.example1Cached());
}
@Test public void testOrderBySymbolName() throws Exception {
String sql = "select e1 from pm1.g1 order by e1"; //$NON-NLS-1$
String expected = "SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 ORDER BY c_0"; //$NON-NLS-1$
- Query command = (Query)helpTest(sql, expected, true, false, FakeMetadataFactory.example1Cached());
+ Query command = (Query)helpTest(sql, expected, true, false, RealMetadataFactory.example1Cached());
assertEquals(command.getOrderBy().getSortKeys().get(0).getName(), "e1"); //$NON-NLS-1$
assertEquals(command.getProjectedSymbols().get(0).getShortName(), "e1"); //$NON-NLS-1$
}
@@ -80,14 +80,14 @@
@Test public void testInlineViewWithSubQuery() throws Exception {
String sql = "select intnum from (select intnum from bqt1.smallb where intnum in (select intnum a from bqt1.smalla)) b"; //$NON-NLS-1$
String expected = "SELECT v_0.c_0 FROM (SELECT g_0.intnum AS c_0 FROM bqt1.smallb AS g_0 WHERE g_0.intnum IN (SELECT g_1.intnum FROM bqt1.smalla AS g_1)) AS v_0"; //$NON-NLS-1$
- helpTest(sql, expected, true, false, FakeMetadataFactory.exampleBQTCached());
+ helpTest(sql, expected, true, false, RealMetadataFactory.exampleBQTCached());
}
@Test public void testInlineViewOrderBy() throws Exception {
String sql = "select intnum from (select intnum from bqt1.smallb) b order by b.intnum"; //$NON-NLS-1$
String expected = "SELECT v_0.c_0 FROM (SELECT g_0.intnum AS c_0 FROM bqt1.smallb AS g_0) AS v_0 ORDER BY c_0"; //$NON-NLS-1$
- Command command = helpTest(sql, expected, true, false, FakeMetadataFactory.exampleBQTCached());
- LanguageBridgeFactory lbf = new LanguageBridgeFactory(FakeMetadataFactory.exampleBQTCached());
+ Command command = helpTest(sql, expected, true, false, RealMetadataFactory.exampleBQTCached());
+ LanguageBridgeFactory lbf = new LanguageBridgeFactory(RealMetadataFactory.exampleBQTCached());
org.teiid.language.Command c = lbf.translate(command);
assertEquals("SELECT v_0.c_0 FROM (SELECT g_0.IntNum AS c_0 FROM SmallB AS g_0) AS v_0 ORDER BY v_0.c_0", c.toString());
}
@@ -95,74 +95,74 @@
@Test public void testNestedInlineViewOrderBy() throws Exception {
String sql = "select x from (select intnum x from (select intnum from bqt1.smallb) b order by x) y order by x"; //$NON-NLS-1$
String expected = "SELECT v_1.c_0 FROM (SELECT v_0.c_0 FROM (SELECT g_0.intnum AS c_0 FROM bqt1.smallb AS g_0) AS v_0) AS v_1 ORDER BY c_0"; //$NON-NLS-1$
- helpTest(sql, expected, true, false, FakeMetadataFactory.exampleBQTCached());
+ helpTest(sql, expected, true, false, RealMetadataFactory.exampleBQTCached());
}
@Test public void testInlineViewWithOnClause() throws Exception {
String sql = "select abcd.efg from (select intkey as efg from bqt1.smalla) abcd inner join (select intnum from bqt1.smallb) b on (b.intnum = abcd.efg)"; //$NON-NLS-1$
String expected = "SELECT v_0.c_0 FROM (SELECT g_0.intkey AS c_0 FROM bqt1.smalla AS g_0) AS v_0 INNER JOIN (SELECT g_1.intnum AS c_0 FROM bqt1.smallb AS g_1) AS v_1 ON v_1.c_0 = v_0.c_0"; //$NON-NLS-1$
- helpTest(sql, expected, true, false, FakeMetadataFactory.exampleBQTCached());
+ helpTest(sql, expected, true, false, RealMetadataFactory.exampleBQTCached());
}
@Test public void testUnionOrderBy() throws Exception {
String sql = "select e1, e2 as c_0 from pm1.g1 union all select 1, e1 from pm1.g2 order by e1"; //$NON-NLS-1$
String expected = "SELECT g_1.e1 AS c_0, g_1.e2 AS c_1 FROM pm1.g1 AS g_1 UNION ALL SELECT '1' AS c_0, g_0.e1 AS c_1 FROM pm1.g2 AS g_0 ORDER BY c_0"; //$NON-NLS-1$
- helpTest(sql, expected, true, false, FakeMetadataFactory.example1Cached());
+ helpTest(sql, expected, true, false, RealMetadataFactory.example1Cached());
}
@Test public void testDuplicateShortElementName() throws Exception {
String sql = "select pm1.g1.e1, pm1.g2.e1 from pm1.g1, pm1.g2 order by pm1.g1.e1, pm1.g2.e1"; //$NON-NLS-1$
String expected = "SELECT g_0.e1 AS c_0, g_1.e1 AS c_1 FROM pm1.g1 AS g_0, pm1.g2 AS g_1 ORDER BY c_0, c_1"; //$NON-NLS-1$
- helpTest(sql, expected, true, false, FakeMetadataFactory.example1Cached());
+ helpTest(sql, expected, true, false, RealMetadataFactory.example1Cached());
}
@Test public void testCorrelatedRefernce() throws Exception {
String sql = "select intnum, stringnum from (select intnum, stringnum from bqt1.smallb) b where intnum in (select b.stringnum || b.intnum from (select intnum from bqt1.smalla) b) "; //$NON-NLS-1$
String expected = "SELECT v_0.c_0, v_0.c_1 FROM (SELECT g_0.intnum AS c_0, g_0.stringnum AS c_1 FROM bqt1.smallb AS g_0) AS v_0 WHERE v_0.c_0 IN (SELECT concat(v_0.c_1, v_1.c_0) FROM (SELECT g_1.intnum AS c_0 FROM bqt1.smalla AS g_1) AS v_1)"; //$NON-NLS-1$
- helpTest(sql, expected, true, false, FakeMetadataFactory.exampleBQTCached());
+ helpTest(sql, expected, true, false, RealMetadataFactory.exampleBQTCached());
}
@Test public void testCorrelatedRefernce1() throws Exception {
String sql = "select intnum, stringnum from bqt1.smallb where intnum in (select stringnum || b.intnum from (select intnum from bqt1.smalla) b) "; //$NON-NLS-1$
String expected = "SELECT g_0.intnum, g_0.stringnum FROM bqt1.smallb AS g_0 WHERE g_0.intnum IN (SELECT concat(g_0.stringnum, v_0.c_0) FROM (SELECT g_1.intnum AS c_0 FROM bqt1.smalla AS g_1) AS v_0)"; //$NON-NLS-1$
- helpTest(sql, expected, true, false, FakeMetadataFactory.exampleBQTCached());
+ helpTest(sql, expected, true, false, RealMetadataFactory.exampleBQTCached());
}
@Test public void testGroupAliasNotSupported() throws Exception {
String sql = "select b.intkey from bqt1.smalla b"; //$NON-NLS-1$
String expected = "SELECT bqt1.smalla.intkey FROM bqt1.smalla"; //$NON-NLS-1$
- helpTest(sql, expected, false, false, FakeMetadataFactory.exampleBQTCached());
+ helpTest(sql, expected, false, false, RealMetadataFactory.exampleBQTCached());
}
@Test public void testUnionAliasing() throws Exception {
String sql = "SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT IntNum FROM BQT1.SmallA"; //$NON-NLS-1$
String expected = "SELECT BQT1.SmallA.IntKey AS c_0 FROM BQT1.SmallA UNION ALL SELECT BQT1.SmallA.IntNum AS c_0 FROM BQT1.SmallA"; //$NON-NLS-1$
- helpTest(sql, expected, false, false, FakeMetadataFactory.exampleBQTCached());
+ helpTest(sql, expected, false, false, RealMetadataFactory.exampleBQTCached());
}
@Test public void testUnrelatedOrderBy() throws Exception {
String sql = "SELECT b.IntKey FROM BQT1.SmallA a, BQT1.SmallA b ORDER BY a.StringKey"; //$NON-NLS-1$
String expected = "SELECT g_1.IntKey AS c_0 FROM BQT1.SmallA AS g_0, BQT1.SmallA AS g_1 ORDER BY g_0.StringKey"; //$NON-NLS-1$
- helpTest(sql, expected, true, false, FakeMetadataFactory.exampleBQTCached());
+ helpTest(sql, expected, true, false, RealMetadataFactory.exampleBQTCached());
}
@Test public void testUnrelatedOrderBy1() throws Exception {
String sql = "SELECT b.IntKey FROM (select intkey, stringkey from BQT1.SmallA) a, (select intkey, stringkey from BQT1.SmallA) b ORDER BY a.StringKey"; //$NON-NLS-1$
String expected = "SELECT v_1.c_0 FROM (SELECT g_0.intkey AS c_0, g_0.stringkey AS c_1 FROM BQT1.SmallA AS g_0) AS v_0, (SELECT g_1.intkey AS c_0, g_1.stringkey AS c_1 FROM BQT1.SmallA AS g_1) AS v_1 ORDER BY v_0.c_1"; //$NON-NLS-1$
- helpTest(sql, expected, true, false, FakeMetadataFactory.exampleBQTCached());
+ helpTest(sql, expected, true, false, RealMetadataFactory.exampleBQTCached());
}
@Test public void testStripAliases() throws Exception {
String sql = "select intkey as a, stringkey as b from BQT1.SmallA ORDER BY a, b"; //$NON-NLS-1$
String expected = "SELECT g_0.intkey, g_0.stringkey FROM BQT1.SmallA AS g_0 ORDER BY g_0.intkey, g_0.stringkey"; //$NON-NLS-1$
- helpTest(sql, expected, true, true, FakeMetadataFactory.exampleBQTCached());
+ helpTest(sql, expected, true, true, RealMetadataFactory.exampleBQTCached());
}
@Test public void testStripAliases1() throws Exception {
String sql = "select intkey as a, stringkey as b from BQT1.SmallA ORDER BY a, b"; //$NON-NLS-1$
String expected = "SELECT BQT1.SmallA.intkey, BQT1.SmallA.stringkey FROM BQT1.SmallA ORDER BY BQT1.SmallA.intkey, BQT1.SmallA.stringkey"; //$NON-NLS-1$
- Command command = helpTest(sql, expected, false, true, FakeMetadataFactory.exampleBQTCached());
- LanguageBridgeFactory lbf = new LanguageBridgeFactory(FakeMetadataFactory.exampleBQTCached());
+ Command command = helpTest(sql, expected, false, true, RealMetadataFactory.exampleBQTCached());
+ LanguageBridgeFactory lbf = new LanguageBridgeFactory(RealMetadataFactory.exampleBQTCached());
org.teiid.language.Command c = lbf.translate(command);
assertEquals("SELECT SmallA.IntKey, SmallA.StringKey FROM SmallA ORDER BY SmallA.IntKey, SmallA.StringKey", c.toString());
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCalculateCostUtil.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCalculateCostUtil.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCalculateCostUtil.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -31,7 +31,9 @@
import org.teiid.api.exception.query.QueryMetadataException;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.metadata.Column;
import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.optimizer.TestOptimizer;
import org.teiid.query.optimizer.TestOptimizer.ComparisonMode;
import org.teiid.query.optimizer.relational.RelationalPlanner;
@@ -45,8 +47,7 @@
import org.teiid.query.rewriter.QueryRewriter;
import org.teiid.query.sql.lang.Criteria;
import org.teiid.query.sql.lang.JoinType;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
@SuppressWarnings("nls")
@@ -94,21 +95,21 @@
// =====================================================================
@Test public void testEstimateCostOfCriteria() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm2.g3.e1 = '3' or pm2.g3.e2 = 2"; //$NON-NLS-1$
helpTestEstimateCost(critString, NewCalculateCostUtil.UNKNOWN_VALUE, NewCalculateCostUtil.UNKNOWN_VALUE, metadata);
}
@Test public void testEstimateCostOfCompareCriteria() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm1.g1.e1 = '3'"; //$NON-NLS-1$
helpTestEstimateCost(critString, NewCalculateCostUtil.UNKNOWN_VALUE, 1, metadata);
}
@Test public void testEstimateCostOfCompareCriteria1() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm1.g1.e1 < '3'"; //$NON-NLS-1$
helpTestEstimateCost(critString, NewCalculateCostUtil.UNKNOWN_VALUE, NewCalculateCostUtil.UNKNOWN_VALUE, metadata);
@@ -119,7 +120,7 @@
* NOT = false
*/
@Test public void testEstimateCostOfMatchCriteria1() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm2.g3.e1 LIKE '#%'"; //$NON-NLS-1$
helpTestEstimateCost(critString, 300, 100, metadata);
@@ -130,7 +131,7 @@
* NOT = true
*/
@Test public void testEstimateCostOfMatchCriteria2() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm2.g3.e1 NOT LIKE '#_'"; //$NON-NLS-1$
helpTestEstimateCost(critString, 300, 233, metadata);
@@ -141,7 +142,7 @@
* NOT = false
*/
@Test public void testEstimateCostOfMatchCriteria3() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm1.g1.e1 LIKE '#_'"; //$NON-NLS-1$
helpTestEstimateCost(critString, 300, 50, metadata);
@@ -152,7 +153,7 @@
* NOT = true
*/
@Test public void testEstimateCostOfMatchCriteria4() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm1.g1.e1 NOT LIKE '#_'"; //$NON-NLS-1$
helpTestEstimateCost(critString, 300, 249, metadata);
@@ -163,7 +164,7 @@
* NOT = false
*/
@Test public void testEstimateCostOfIsNullCriteria1() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm2.g3.e1 IS NULL"; //$NON-NLS-1$
helpTestEstimateCost(critString, 300, 33, metadata);
@@ -174,7 +175,7 @@
* NOT = true
*/
@Test public void testEstimateCostOfIsNullCriteria2() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm2.g3.e1 IS NOT NULL"; //$NON-NLS-1$
helpTestEstimateCost(critString, 300, 266, metadata);
@@ -185,7 +186,7 @@
* NOT = false
*/
@Test public void testEstimateCostOfIsNullCriteria3() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm1.g1.e1 IS NULL"; //$NON-NLS-1$
helpTestEstimateCost(critString, 300, 1, metadata);
@@ -196,7 +197,7 @@
* NOT = true
*/
@Test public void testEstimateCostOfIsNullCriteria4() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm1.g1.e1 IS NOT NULL"; //$NON-NLS-1$
helpTestEstimateCost(critString, 300, 299, metadata);
@@ -208,7 +209,7 @@
* NOT = false
*/
@Test public void testEstimateCostOfSetCriteria1() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm2.g3.e1 IN ('2', '3')"; //$NON-NLS-1$
helpTestEstimateCost(critString, NewCalculateCostUtil.UNKNOWN_VALUE, NewCalculateCostUtil.UNKNOWN_VALUE, metadata);
@@ -220,7 +221,7 @@
* NOT = true
*/
@Test public void testEstimateCostOfSetCriteria2() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm2.g3.e1 NOT IN ('2', '3')"; //$NON-NLS-1$
helpTestEstimateCost(critString, NewCalculateCostUtil.UNKNOWN_VALUE, NewCalculateCostUtil.UNKNOWN_VALUE, metadata);
@@ -232,7 +233,7 @@
* NOT = false
*/
@Test public void testEstimateCostOfSetCriteria3() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm2.g3.e1 IN ('2', '3')"; //$NON-NLS-1$
helpTestEstimateCost(critString, 300, 66, metadata);
@@ -244,7 +245,7 @@
* NOT = true
*/
@Test public void testEstimateCostOfSetCriteria4() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm2.g3.e1 NOT IN ('2', '3')"; //$NON-NLS-1$
helpTestEstimateCost(critString, 300, 233, metadata);
@@ -256,7 +257,7 @@
* NOT = false
*/
@Test public void testEstimateCostOfSetCriteria5() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm1.g1.e1 IN ('2', '3')"; //$NON-NLS-1$
helpTestEstimateCost(critString, NewCalculateCostUtil.UNKNOWN_VALUE, NewCalculateCostUtil.UNKNOWN_VALUE, metadata);
@@ -268,7 +269,7 @@
* NOT = true
*/
@Test public void testEstimateCostOfSetCriteria6() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm1.g1.e1 NOT IN ('2', '3')"; //$NON-NLS-1$
helpTestEstimateCost(critString, NewCalculateCostUtil.UNKNOWN_VALUE, NewCalculateCostUtil.UNKNOWN_VALUE, metadata);
@@ -280,7 +281,7 @@
* NOT = false
*/
@Test public void testEstimateCostOfSetCriteria7() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm1.g1.e1 IN ('2', '3')"; //$NON-NLS-1$
helpTestEstimateCost(critString, 200, 2, metadata);
@@ -292,14 +293,14 @@
* NOT = true
*/
@Test public void testEstimateCostOfSetCriteria8() throws Exception{
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm1.g1.e1 NOT IN ('2', '3')"; //$NON-NLS-1$
helpTestEstimateCost(critString, 200, 198, metadata);
}
@Test public void testEstimateJoinNodeCost() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
PlanNode joinNode = helpGetJoinNode(NewCalculateCostUtil.UNKNOWN_VALUE, NewCalculateCostUtil.UNKNOWN_VALUE, JoinType.JOIN_CROSS);
float cost = NewCalculateCostUtil.computeCostForTree(joinNode, metadata);
@@ -308,7 +309,7 @@
@Ignore("this logic needs to be refined to work better")
@Test public void testEstimateJoinNodeCostOneUnknown() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
PlanNode joinNode = helpGetJoinNode(NewCalculateCostUtil.UNKNOWN_VALUE, 500, JoinType.JOIN_INNER);
joinNode.setProperty(NodeConstants.Info.JOIN_CRITERIA, Arrays.asList(helpGetCriteria("pm1.g1.e1 = pm1.g2.e1", metadata)));
float cost = NewCalculateCostUtil.computeCostForTree(joinNode, metadata);
@@ -327,7 +328,7 @@
* e1 and e2 make up a single compound key
*/
@Test public void testEstimateCostOfCriteriaCompoundKey() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm4.g1.e1 = '3' and pm4.g1.e2 = 2"; //$NON-NLS-1$
helpTestEstimateCost(critString, NewCalculateCostUtil.UNKNOWN_VALUE, 1, metadata);
@@ -340,7 +341,7 @@
* predicted to reduce the cost of the join
*/
@Test public void testEstimateCostOfCriteriaCompoundKey2() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm4.g1.e1 = '3' or pm4.g1.e2 = 2"; //$NON-NLS-1$
helpTestEstimateCost(critString, NewCalculateCostUtil.UNKNOWN_VALUE, NewCalculateCostUtil.UNKNOWN_VALUE, metadata);
@@ -353,7 +354,7 @@
* lower the cost due to the NOT
*/
@Test public void testEstimateCostOfCriteriaCompoundKey3() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm4.g1.e1 = '3' and not pm4.g1.e2 = 2"; //$NON-NLS-1$
helpTestEstimateCost(critString, NewCalculateCostUtil.UNKNOWN_VALUE, NewCalculateCostUtil.UNKNOWN_VALUE, metadata);
@@ -366,7 +367,7 @@
* lower the cost due to the 0R
*/
@Test public void testEstimateCostOfCriteriaCompoundKey4() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "(pm4.g1.e1 = '3' or pm4.g1.e4 = 2.0) and not pm4.g1.e2 = 2"; //$NON-NLS-1$
helpTestEstimateCost(critString, NewCalculateCostUtil.UNKNOWN_VALUE, NewCalculateCostUtil.UNKNOWN_VALUE, metadata);
@@ -379,7 +380,7 @@
* lower the cost due to the OR
*/
@Test public void testEstimateCostOfCriteriaCompoundKey5() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "(pm4.g1.e1 = '3' or pm4.g1.e4 = 2.0) and pm4.g1.e2 = 2"; //$NON-NLS-1$
helpTestEstimateCost(critString, NewCalculateCostUtil.UNKNOWN_VALUE, NewCalculateCostUtil.UNKNOWN_VALUE, metadata);
@@ -392,7 +393,7 @@
* lower the cost due to the OR
*/
@Test public void testEstimateCostOfCriteriaCompoundKey6() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "(pm4.g1.e1 = '3' and pm4.g1.e2 = 2) or pm4.g1.e4 = 2.0"; //$NON-NLS-1$
helpTestEstimateCost(critString, NewCalculateCostUtil.UNKNOWN_VALUE, NewCalculateCostUtil.UNKNOWN_VALUE, metadata);
@@ -405,7 +406,7 @@
* key so the cost should be low
*/
@Test public void testEstimateCostOfCriteriaCompoundKey8() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm4.g1.e1 LIKE '3%' and pm4.g1.e2 = 2"; //$NON-NLS-1$
helpTestEstimateCost(critString, NewCalculateCostUtil.UNKNOWN_VALUE, 1, metadata);
@@ -418,7 +419,7 @@
* lower the cost due to the NOT
*/
@Test public void testEstimateCostOfCriteriaCompoundKey9() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm4.g1.e1 NOT LIKE '3%' and pm4.g1.e2 = 2"; //$NON-NLS-1$
helpTestEstimateCost(critString, NewCalculateCostUtil.UNKNOWN_VALUE, NewCalculateCostUtil.UNKNOWN_VALUE, metadata);
@@ -431,7 +432,7 @@
* key so the cost should be low
*/
@Test public void testEstimateCostOfCriteriaCompoundKey10() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "'3' LIKE pm4.g1.e1 and pm4.g1.e2 = 2"; //$NON-NLS-1$
helpTestEstimateCost(critString, NewCalculateCostUtil.UNKNOWN_VALUE, 1, metadata);
@@ -444,7 +445,7 @@
* key so the cost should be low
*/
@Test public void testEstimateCostOfCriteriaCompoundKey11() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm4.g1.e1 IS NULL and pm4.g1.e2 = 2"; //$NON-NLS-1$
helpTestEstimateCost(critString, NewCalculateCostUtil.UNKNOWN_VALUE, 1, metadata);
@@ -457,7 +458,7 @@
* lower the cost due to the NOT
*/
@Test public void testEstimateCostOfCriteriaCompoundKey12() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm4.g1.e1 IS NOT NULL and pm4.g1.e2 = 2"; //$NON-NLS-1$
helpTestEstimateCost(critString, NewCalculateCostUtil.UNKNOWN_VALUE, NewCalculateCostUtil.UNKNOWN_VALUE, metadata);
@@ -470,7 +471,7 @@
* key so the cost should be low
*/
@Test public void testEstimateCostOfCriteriaCompoundKey13() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm4.g1.e1 IN ('3', '4') and pm4.g1.e2 = 2"; //$NON-NLS-1$
helpTestEstimateCost(critString, NewCalculateCostUtil.UNKNOWN_VALUE, 1, metadata);
@@ -483,14 +484,14 @@
* lower the cost due to the NOT
*/
@Test public void testEstimateCostOfCriteriaCompoundKey14() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm4.g1.e1 NOT IN ('3', '4') and pm4.g1.e2 = 2"; //$NON-NLS-1$
helpTestEstimateCost(critString, NewCalculateCostUtil.UNKNOWN_VALUE, NewCalculateCostUtil.UNKNOWN_VALUE, metadata);
}
@Test public void testEstimateCostOfCriteriaCompoundKey15() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "(pm4.g1.e1 = '3' or pm4.g1.e1 = '2') and (pm4.g1.e2 = 2 or pm4.g1.e2 = 1)"; //$NON-NLS-1$
helpTestEstimateCost(critString, NewCalculateCostUtil.UNKNOWN_VALUE, 1, metadata);
@@ -500,7 +501,7 @@
* usesKey true
*/
@Test public void testEstimateCostOfCriteriaMultiGroup() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm4.g1.e1 = pm1.g1.e1"; //$NON-NLS-1$
helpTestEstimateCost(critString, NewCalculateCostUtil.UNKNOWN_VALUE, NewCalculateCostUtil.UNKNOWN_VALUE, metadata);
@@ -510,7 +511,7 @@
* usesKey false
*/
@Test public void testEstimateCostOfCriteriaMultiGroup1() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm2.g3.e1 = pm4.g1.e1"; //$NON-NLS-1$
helpTestEstimateCost(critString, NewCalculateCostUtil.UNKNOWN_VALUE, NewCalculateCostUtil.UNKNOWN_VALUE, metadata);
@@ -520,7 +521,7 @@
* usesKey true
*/
@Test public void testEstimateCostOfCriteriaMultiGroup2() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm4.g1.e1 = pm1.g1.e1"; //$NON-NLS-1$
helpTestEstimateCost(critString, 100, 10, metadata);
@@ -530,7 +531,7 @@
* usesKey false
*/
@Test public void testEstimateCostOfCriteriaMultiGroup3() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example4();
+ QueryMetadataInterface metadata = RealMetadataFactory.example4();
String critString = "pm2.g3.e1 = pm4.g1.e1"; //$NON-NLS-1$
helpTestEstimateCost(critString, 100, 33, metadata);
@@ -541,10 +542,10 @@
* the valid strings are timestamp format - since that is what our costing sets them as.
*/
@Test public void testEstimateCostOfCriteriaDate1() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example1();
- FakeMetadataObject e2 = (FakeMetadataObject)metadata.getElementID("pm3.g1.e2"); //$NON-NLS-1$
- e2.putProperty(FakeMetadataObject.Props.MIN_VALUE,"2007-04-03 12:12:12.10"); //$NON-NLS-1$
- e2.putProperty(FakeMetadataObject.Props.MAX_VALUE,"2007-06-03 12:12:12.10"); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.example1();
+ Column e2 = metadata.getElementID("pm3.g1.e2"); //$NON-NLS-1$
+ e2.setMinimumValue("2007-04-03 12:12:12.10"); //$NON-NLS-1$
+ e2.setMaximumValue("2007-06-03 12:12:12.10"); //$NON-NLS-1$
String critString = "pm3.g1.e2 <= {d'2008-04-03'}"; //$NON-NLS-1$
helpTestEstimateCost(critString, 100, 100, metadata);
@@ -555,10 +556,10 @@
* one example of invalid strings is date format - since our costing sets them to timestamp.
*/
@Test public void testEstimateCostOfCriteriaDate2() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example1();
- FakeMetadataObject e2 = (FakeMetadataObject)metadata.getElementID("pm3.g1.e2"); //$NON-NLS-1$
- e2.putProperty(FakeMetadataObject.Props.MIN_VALUE,"2007-04-03"); //$NON-NLS-1$
- e2.putProperty(FakeMetadataObject.Props.MAX_VALUE,"2007-06-03"); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.example1();
+ Column e2 = metadata.getElementID("pm3.g1.e2"); //$NON-NLS-1$
+ e2.setMinimumValue("2007-04-03"); //$NON-NLS-1$
+ e2.setMaximumValue("2007-06-03"); //$NON-NLS-1$
String critString = "pm3.g1.e2 <= {d'2008-04-03'}"; //$NON-NLS-1$
helpTestEstimateCost(critString, 100, 33, metadata);
@@ -568,10 +569,10 @@
* Time Criteria - case using valid max and min time strings.
*/
@Test public void testEstimateCostOfCriteriaTime1() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example1();
- FakeMetadataObject e3 = (FakeMetadataObject)metadata.getElementID("pm3.g1.e3"); //$NON-NLS-1$
- e3.putProperty(FakeMetadataObject.Props.MIN_VALUE,"12:12:12"); //$NON-NLS-1$
- e3.putProperty(FakeMetadataObject.Props.MAX_VALUE,"12:13:14"); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.example1();
+ Column e3 = metadata.getElementID("pm3.g1.e3"); //$NON-NLS-1$
+ e3.setMinimumValue("12:12:12"); //$NON-NLS-1$
+ e3.setMaximumValue("12:13:14"); //$NON-NLS-1$
String critString = "pm3.g1.e3 <= {t'11:11:11'}"; //$NON-NLS-1$
helpTestEstimateCost(critString, 100, 1, metadata);
@@ -581,10 +582,10 @@
* Time Criteria - case using invalid max and min time strings
*/
@Test public void testEstimateCostOfCriteriaTime2() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example1();
- FakeMetadataObject e3 = (FakeMetadataObject)metadata.getElementID("pm3.g1.e3"); //$NON-NLS-1$
- e3.putProperty(FakeMetadataObject.Props.MIN_VALUE,"2007-04-03 12:12:12.10"); //$NON-NLS-1$
- e3.putProperty(FakeMetadataObject.Props.MAX_VALUE,"2007-06-03 12:12:12.10"); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.example1();
+ Column e3 = metadata.getElementID("pm3.g1.e3"); //$NON-NLS-1$
+ e3.setMinimumValue("2007-04-03 12:12:12.10"); //$NON-NLS-1$
+ e3.setMaximumValue("2007-06-03 12:12:12.10"); //$NON-NLS-1$
String critString = "pm3.g1.e3 <= {t'11:11:11'}"; //$NON-NLS-1$
helpTestEstimateCost(critString, 100, 33, metadata);
@@ -594,10 +595,10 @@
* Timestamp Criteria - case using valid max and min timestamp strings
*/
@Test public void testEstimateCostOfCriteriaTimestamp1() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example1();
- FakeMetadataObject e4 = (FakeMetadataObject)metadata.getElementID("pm3.g1.e4"); //$NON-NLS-1$
- e4.putProperty(FakeMetadataObject.Props.MIN_VALUE,"2007-04-03 12:12:12.10"); //$NON-NLS-1$
- e4.putProperty(FakeMetadataObject.Props.MAX_VALUE,"2007-04-03 12:12:12.10"); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.example1();
+ Column e4 = metadata.getElementID("pm3.g1.e4"); //$NON-NLS-1$
+ e4.setMinimumValue("2007-04-03 12:12:12.10"); //$NON-NLS-1$
+ e4.setMaximumValue("2007-04-03 12:12:12.10"); //$NON-NLS-1$
String critString = "pm3.g1.e4 <= {ts'2007-04-03 12:12:12.10'}"; //$NON-NLS-1$
helpTestEstimateCost(critString, 100, 1, metadata);
@@ -607,10 +608,10 @@
* Timestamp Criteria - case using invalid max and min timestamp strings
*/
@Test public void testEstimateCostOfCriteriaTimestamp2() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example1();
- FakeMetadataObject e4 = (FakeMetadataObject)metadata.getElementID("pm3.g1.e4"); //$NON-NLS-1$
- e4.putProperty(FakeMetadataObject.Props.MIN_VALUE,"2007-04-03"); //$NON-NLS-1$
- e4.putProperty(FakeMetadataObject.Props.MAX_VALUE,"2007-06-03"); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.example1();
+ Column e4 = metadata.getElementID("pm3.g1.e4"); //$NON-NLS-1$
+ e4.setMinimumValue("2007-04-03"); //$NON-NLS-1$
+ e4.setMaximumValue("2007-06-03"); //$NON-NLS-1$
String critString = "pm3.g1.e4 <= {ts'2007-04-03 12:12:12.10'}"; //$NON-NLS-1$
helpTestEstimateCost(critString, 100, 33, metadata);
@@ -739,7 +740,7 @@
@Test public void testLimitWithUnknownChildCardinality() throws Exception {
String query = "select e1 from pm1.g1 limit 2"; //$NON-NLS-1$
- RelationalPlan plan = (RelationalPlan)TestOptimizer.helpPlan(query, FakeMetadataFactory.example1Cached(), new String[] {"SELECT e1 FROM pm1.g1"}); //$NON-NLS-1$
+ RelationalPlan plan = (RelationalPlan)TestOptimizer.helpPlan(query, RealMetadataFactory.example1Cached(), new String[] {"SELECT e1 FROM pm1.g1"}); //$NON-NLS-1$
assertEquals(new Float(2), plan.getRootNode().getEstimateNodeCardinality());
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCapabilitiesUtil.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCapabilitiesUtil.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCapabilitiesUtil.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -22,15 +22,18 @@
package org.teiid.query.optimizer.relational.rules;
+import static org.junit.Assert.*;
+
import java.util.ArrayList;
import java.util.List;
-import junit.framework.TestCase;
-
+import org.junit.Test;
import org.teiid.api.exception.query.QueryMetadataException;
import org.teiid.api.exception.query.QueryResolverException;
import org.teiid.core.TeiidComponentException;
import org.teiid.language.SQLConstants.NonReserved;
+import org.teiid.metadata.Schema;
+import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
@@ -45,27 +48,18 @@
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.symbol.ExpressionSymbol;
import org.teiid.query.sql.symbol.Function;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
+import org.teiid.query.unittest.RealMetadataFactory;
/**
*/
-public class TestCapabilitiesUtil extends TestCase {
+@SuppressWarnings("nls")
+public class TestCapabilitiesUtil {
- /**
- * Constructor for TestCapabilitiesUtil.
- * @param name
- */
- public TestCapabilitiesUtil(String name) {
- super(name);
- }
-
public void helpTestSupportsSelfJoin(boolean supportsSelfJoin, boolean supportsGroupAlias, boolean expectedValue) throws QueryMetadataException, TeiidComponentException {
// Set up metadata
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- FakeMetadataObject modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Schema modelID = metadata.getMetadataStore().getSchema("PM1");
// Set up capabilities
FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
@@ -79,22 +73,22 @@
assertEquals("Got wrong answer for supports", expectedValue, actual); //$NON-NLS-1$
}
- public void testSupportsSelfJoin1() throws Exception {
+ @Test public void testSupportsSelfJoin1() throws Exception {
helpTestSupportsSelfJoin(false, true, false);
}
- public void testSupportsSelfJoin2() throws Exception {
+ @Test public void testSupportsSelfJoin2() throws Exception {
helpTestSupportsSelfJoin(true, false, false);
}
- public void testSupportsSelfJoin3() throws Exception {
+ @Test public void testSupportsSelfJoin3() throws Exception {
helpTestSupportsSelfJoin(true, true, true);
}
- public void testSupportsSelfJoin4() throws Exception {
+ @Test public void testSupportsSelfJoin4() throws Exception {
// Set up metadata
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- FakeMetadataObject modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Schema modelID = metadata.getMetadataStore().getSchema("PM1");
// Test capabilities util
boolean actual = CapabilitiesUtil.supportsSelfJoins(modelID, metadata, new DefaultCapabilitiesFinder());
@@ -104,8 +98,8 @@
public void helpTestSupportsOuterJoin(boolean capsSupportsOuterJoin, boolean capsSupportsFullOuterJoin, JoinType joinType, boolean expectedValue) throws QueryMetadataException, TeiidComponentException {
// Set up metadata
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- FakeMetadataObject modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Schema modelID = metadata.getMetadataStore().getSchema("PM1");
// Set up capabilities
FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
@@ -120,29 +114,29 @@
}
// Test where capabilities don't support outer joins
- public void testSupportsOuterJoinFail1() throws Exception {
+ @Test public void testSupportsOuterJoinFail1() throws Exception {
helpTestSupportsOuterJoin(false, false, JoinType.JOIN_RIGHT_OUTER, false);
}
// Test where capabilities don't support full outer joins
- public void testSupportsOuterJoinFail3() throws Exception {
+ @Test public void testSupportsOuterJoinFail3() throws Exception {
helpTestSupportsOuterJoin(true, false, JoinType.JOIN_FULL_OUTER, false);
}
// Test where capabilities support outer joins
- public void testSupportsOuterJoin1() throws Exception {
+ @Test public void testSupportsOuterJoin1() throws Exception {
helpTestSupportsOuterJoin(true, false, JoinType.JOIN_RIGHT_OUTER, true);
}
// Test where capabilities support full outer joins
- public void testSupportsOuterJoin2() throws Exception {
+ @Test public void testSupportsOuterJoin2() throws Exception {
helpTestSupportsOuterJoin(true, true, JoinType.JOIN_FULL_OUTER, true);
}
public void helpTestSupportsAggregates(boolean capsSupportsAggregates, boolean supportsFunctionInGroupBy, List groupCols) throws QueryMetadataException, TeiidComponentException {
// Set up metadata
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- FakeMetadataObject modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Schema modelID = metadata.getMetadataStore().getSchema("PM1");
// Set up capabilities
FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
@@ -157,7 +151,7 @@
}
// Test where capabilities supports aggregates
- public void testSupportsAggregates1() throws Exception {
+ @Test public void testSupportsAggregates1() throws Exception {
helpTestSupportsAggregates(true, true, null);
}
@@ -166,7 +160,7 @@
* be called supports expression in group by. Thus the example below
* is not supported.
*/
- public void testSupportsFunctionInGroupBy() throws Exception {
+ @Test public void testSupportsFunctionInGroupBy() throws Exception {
Function f = new Function("concat", new Expression[] { new Constant("a"), new Constant("b") }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ExpressionSymbol expr = new ExpressionSymbol("e", f); //$NON-NLS-1$
List cols = new ArrayList();
@@ -176,8 +170,8 @@
public void helpTestSupportsAggregateFunction(SourceCapabilities caps, AggregateSymbol aggregate, boolean expectedValue) throws QueryMetadataException, TeiidComponentException {
// Set up metadata
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- FakeMetadataObject modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Schema modelID = metadata.getMetadataStore().getSchema("PM1");
// Set up capabilities
FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
@@ -189,7 +183,7 @@
}
// Test where capabilities don't support aggregate functions
- public void testSupportsAggregate1() throws Exception {
+ @Test public void testSupportsAggregate1() throws Exception {
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, false);
@@ -199,7 +193,7 @@
}
// Test where capabilities don't support COUNT
- public void testSupportsAggregate2() throws Exception {
+ @Test public void testSupportsAggregate2() throws Exception {
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_COUNT, false);
@@ -211,7 +205,7 @@
}
// Test where capabilities support only COUNT(*)
- public void testSupportsAggregate3() throws Exception {
+ @Test public void testSupportsAggregate3() throws Exception {
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_COUNT, false);
@@ -223,7 +217,7 @@
}
// Test where capabilities support only COUNT(*)
- public void testSupportsAggregate4() throws Exception {
+ @Test public void testSupportsAggregate4() throws Exception {
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_COUNT, false);
@@ -235,7 +229,7 @@
}
// Test where capabilities support only COUNT
- public void testSupportsAggregate5() throws Exception {
+ @Test public void testSupportsAggregate5() throws Exception {
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_COUNT, true);
@@ -247,7 +241,7 @@
}
// Test where capabilities support only COUNT
- public void testSupportsAggregate6() throws Exception {
+ @Test public void testSupportsAggregate6() throws Exception {
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_COUNT, true);
@@ -259,7 +253,7 @@
}
// Test where capabilities don't support SUM
- public void testSupportsAggregate7() throws Exception {
+ @Test public void testSupportsAggregate7() throws Exception {
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_SUM, false);
@@ -270,7 +264,7 @@
}
// Test where capabilities support SUM
- public void testSupportsAggregate8() throws Exception {
+ @Test public void testSupportsAggregate8() throws Exception {
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_SUM, true);
@@ -281,7 +275,7 @@
}
// Test where capabilities don't support AVG
- public void testSupportsAggregate9() throws Exception {
+ @Test public void testSupportsAggregate9() throws Exception {
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_AVG, false);
@@ -292,7 +286,7 @@
}
// Test where capabilities support AVG
- public void testSupportsAggregate10() throws Exception {
+ @Test public void testSupportsAggregate10() throws Exception {
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_AVG, true);
@@ -303,7 +297,7 @@
}
// Test where capabilities don't support MIN
- public void testSupportsAggregate11() throws Exception {
+ @Test public void testSupportsAggregate11() throws Exception {
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MIN, false);
@@ -314,7 +308,7 @@
}
// Test where capabilities support MIN
- public void testSupportsAggregate12() throws Exception {
+ @Test public void testSupportsAggregate12() throws Exception {
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MIN, true);
@@ -325,7 +319,7 @@
}
// Test where capabilities don't support MAX
- public void testSupportsAggregate13() throws Exception {
+ @Test public void testSupportsAggregate13() throws Exception {
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, false);
@@ -336,7 +330,7 @@
}
// Test where capabilities support MAX
- public void testSupportsAggregate14() throws Exception {
+ @Test public void testSupportsAggregate14() throws Exception {
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
@@ -347,7 +341,7 @@
}
// Test where capabilities don't support DISTINCT
- public void testSupportsAggregate15() throws Exception {
+ @Test public void testSupportsAggregate15() throws Exception {
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
@@ -359,7 +353,7 @@
}
// Test where capabilities support DISTINCT
- public void testSupportsAggregate16() throws Exception {
+ @Test public void testSupportsAggregate16() throws Exception {
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
@@ -372,8 +366,8 @@
public void helpTestSupportsScalar(SourceCapabilities caps, Function function, boolean expectedValue) throws QueryMetadataException, TeiidComponentException, QueryResolverException {
// Set up metadata
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- FakeMetadataObject modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Schema modelID = metadata.getMetadataStore().getSchema("PM1");
// Set up capabilities
FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
@@ -385,7 +379,7 @@
}
// Test where capabilities don't support scalar functions
- public void testSupportsScalar1() throws Exception {
+ @Test public void testSupportsScalar1() throws Exception {
BasicSourceCapabilities caps = new BasicSourceCapabilities();
Function func = new Function("+", new Expression[] { new Constant(1), new Constant(2) }); //$NON-NLS-1$
@@ -393,7 +387,7 @@
}
// Test where capabilities doesn't support function
- public void testSupportsScalar3() throws Exception {
+ @Test public void testSupportsScalar3() throws Exception {
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setFunctionSupport("now", false); //$NON-NLS-1$
@@ -402,7 +396,7 @@
}
// Test where capabilities do support function
- public void testSupportsScalar4() throws Exception {
+ @Test public void testSupportsScalar4() throws Exception {
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setFunctionSupport("now", true); //$NON-NLS-1$
@@ -410,10 +404,10 @@
helpTestSupportsScalar(caps, func, true);
}
- public void testSupportsDistinct1() throws Exception {
+ @Test public void testSupportsDistinct1() throws Exception {
// Set up metadata
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- FakeMetadataObject modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Schema modelID = metadata.getMetadataStore().getSchema("PM1");
// Set up capabilities
FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
@@ -424,10 +418,10 @@
assertTrue(CapabilitiesUtil.supportsSelectDistinct(modelID, metadata, finder));
}
- public void testSupportsDistinct2() throws Exception {
+ @Test public void testSupportsDistinct2() throws Exception {
// Set up metadata
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- FakeMetadataObject modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Schema modelID = metadata.getMetadataStore().getSchema("PM1");
// Set up capabilities
FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
@@ -440,10 +434,10 @@
assertEquals("Got wrong answer for supports", false, actual); //$NON-NLS-1$
}
- public void testSupportsOrderBy1() throws Exception {
+ @Test public void testSupportsOrderBy1() throws Exception {
// Set up metadata
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- FakeMetadataObject modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Schema modelID = metadata.getMetadataStore().getSchema("PM1");
// Set up capabilities
FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
@@ -456,10 +450,10 @@
assertEquals("Got wrong answer for supports", true, actual); //$NON-NLS-1$
}
- public void testSupportsOrderBy2() throws Exception {
+ @Test public void testSupportsOrderBy2() throws Exception {
// Set up metadata
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- FakeMetadataObject modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Schema modelID = metadata.getMetadataStore().getSchema("PM1");
// Set up capabilities
FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
@@ -474,8 +468,8 @@
public void helpTestSupportsUnion(boolean supports) throws QueryMetadataException, TeiidComponentException {
// Set up metadata
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- FakeMetadataObject modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Schema modelID = metadata.getMetadataStore().getSchema("PM1");
// Set up capabilities
FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
@@ -488,18 +482,18 @@
assertEquals("Got wrong answer for supports", supports, actual); //$NON-NLS-1$
}
- public void testSupportsUnionTrue() throws Exception {
+ @Test public void testSupportsUnionTrue() throws Exception {
helpTestSupportsUnion(true);
}
- public void testSupportsUnionFalse() throws Exception {
+ @Test public void testSupportsUnionFalse() throws Exception {
helpTestSupportsUnion(false);
}
public void helpTestSupportsLiterals(boolean supports) throws QueryMetadataException, TeiidComponentException {
// Set up metadata
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- FakeMetadataObject modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Schema modelID = metadata.getMetadataStore().getSchema("PM1");
// Set up capabilities
FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
@@ -512,18 +506,18 @@
assertEquals("Got wrong answer for supports", supports, actual); //$NON-NLS-1$
}
- public void testSupportsLiteralsTrue() throws Exception {
+ @Test public void testSupportsLiteralsTrue() throws Exception {
helpTestSupportsLiterals(true);
}
- public void testSupportsLiteralsFalse() throws Exception {
+ @Test public void testSupportsLiteralsFalse() throws Exception {
helpTestSupportsLiterals(false);
}
public void helpTtestSupportsCaseExpression(boolean supports, boolean searched) throws QueryMetadataException, TeiidComponentException {
// Set up metadata
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- FakeMetadataObject modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Schema modelID = metadata.getMetadataStore().getSchema("PM1");
// Set up capabilities
FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
@@ -545,19 +539,19 @@
assertEquals("Got wrong answer for supports", supports, actual); //$NON-NLS-1$
}
- public void testSupportsCaseTrue() throws Exception {
+ @Test public void testSupportsCaseTrue() throws Exception {
helpTtestSupportsCaseExpression(true, false);
}
- public void testSupportsCaseFalse() throws Exception {
+ @Test public void testSupportsCaseFalse() throws Exception {
helpTtestSupportsCaseExpression(false, false);
}
- public void testSupportsSearchedCaseTrue() throws Exception {
+ @Test public void testSupportsSearchedCaseTrue() throws Exception {
helpTtestSupportsCaseExpression(true, true);
}
- public void testSupportsSearchedCaseFalse() throws Exception {
+ @Test public void testSupportsSearchedCaseFalse() throws Exception {
helpTtestSupportsCaseExpression(false, true);
}
@@ -570,10 +564,10 @@
return finder;
}
- public void testSupportRowLimit() throws Exception {
+ @Test public void testSupportRowLimit() throws Exception {
// Set up metadata
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- FakeMetadataObject modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Schema modelID = metadata.getMetadataStore().getSchema("PM1");
// Set up capabilities
FakeCapabilitiesFinder finder = getFinder(Capability.ROW_LIMIT, false);
// Test capabilities util
@@ -584,10 +578,10 @@
assertEquals(true, CapabilitiesUtil.supportsRowLimit(modelID, metadata, finder));
}
- public void testSupportRowOffset() throws Exception {
+ @Test public void testSupportRowOffset() throws Exception {
// Set up metadata
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- FakeMetadataObject modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Schema modelID = metadata.getMetadataStore().getSchema("PM1");
// Set up capabilities
FakeCapabilitiesFinder finder = getFinder(Capability.ROW_OFFSET, false);
// Test capabilities util
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCriteriaCapabilityValidatorVisitor.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCriteriaCapabilityValidatorVisitor.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCriteriaCapabilityValidatorVisitor.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -22,30 +22,32 @@
package org.teiid.query.optimizer.relational.rules;
+import static org.junit.Assert.*;
+
import org.junit.Test;
import org.teiid.api.exception.query.QueryMetadataException;
import org.teiid.core.TeiidException;
+import org.teiid.metadata.Column;
+import org.teiid.metadata.Schema;
+import org.teiid.metadata.Column.SearchType;
+import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.CapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
-import org.teiid.query.optimizer.relational.rules.CriteriaCapabilityValidatorVisitor;
import org.teiid.query.parser.QueryParser;
import org.teiid.query.resolver.QueryResolver;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.lang.Criteria;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
+import org.teiid.query.unittest.RealMetadataFactory;
-import static org.junit.Assert.*;
-
/**
*/
+@SuppressWarnings("nls")
public class TestCriteriaCapabilityValidatorVisitor {
- public void helpTestVisitor(String sql, Object modelID, FakeMetadataFacade metadata, CapabilitiesFinder capFinder, boolean isValid, boolean expectException) {
+ public void helpTestVisitor(String sql, Object modelID, TransformationMetadata metadata, CapabilitiesFinder capFinder, boolean isValid, boolean expectException) throws Exception {
try {
Criteria criteria = QueryParser.getQueryParser().parseCriteria(sql);
@@ -56,13 +58,11 @@
if (!expectException) {
throw new RuntimeException(e);
}
- } catch(TeiidException e) {
- throw new RuntimeException(e);
}
}
// Assume there is a wrapped command - this will allow subqueries to be properly resolved
- public void helpTestVisitorWithCommand(String sql, Object modelID, FakeMetadataFacade metadata, CapabilitiesFinder capFinder, boolean isValid, boolean expectException) {
+ public void helpTestVisitorWithCommand(String sql, Object modelID, TransformationMetadata metadata, CapabilitiesFinder capFinder, boolean isValid, boolean expectException) {
try {
Command command = QueryParser.getQueryParser().parseCommand(sql);
@@ -79,9 +79,9 @@
}
// has all capabilities
- @Test public void testCompareCriteriaSuccess() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testCompareCriteriaSuccess() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -92,145 +92,145 @@
}
// does not have where capability
- @Test public void testCompareCriteriaCapFail1() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testCompareCriteriaCapFail1() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, false);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- helpTestVisitor("pm1.g1.e1 = 'x'", modelID, metadata, capFinder, false, false); //$NON-NLS-1$
+ helpTestVisitor("pm1.g1.e1 = 'x'", modelID, metadata, capFinder, false, false);
}
// does not have = capability
- @Test public void testCompareCriteriaOpCapFail1() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testCompareCriteriaOpCapFail1() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, false);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- helpTestVisitor("pm1.g1.e1 = 'x'", modelID, metadata, capFinder, false, false); //$NON-NLS-1$
+ helpTestVisitor("pm1.g1.e1 = 'x'", modelID, metadata, capFinder, false, false);
}
// does not have <> capability
- @Test public void testCompareCriteriaOpCapFail2() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testCompareCriteriaOpCapFail2() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, false);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- helpTestVisitor("pm1.g1.e1 <> 'x'", modelID, metadata, capFinder, false, false); //$NON-NLS-1$
+ helpTestVisitor("pm1.g1.e1 <> 'x'", modelID, metadata, capFinder, false, false);
}
// does not have < capability
- @Test public void testCompareCriteriaOpCapFail3() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testCompareCriteriaOpCapFail3() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_ORDERED, false);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- helpTestVisitor("pm1.g1.e1 < 'x'", modelID, metadata, capFinder, false, false); //$NON-NLS-1$
+ helpTestVisitor("pm1.g1.e1 < 'x'", modelID, metadata, capFinder, false, false);
}
// does not have <= capability
- @Test public void testCompareCriteriaOpCapFail4() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testCompareCriteriaOpCapFail4() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_ORDERED, false);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- helpTestVisitor("pm1.g1.e1 <= 'x'", modelID, metadata, capFinder, false, false); //$NON-NLS-1$
+ helpTestVisitor("pm1.g1.e1 <= 'x'", modelID, metadata, capFinder, false, false);
}
// does not have > capability
- @Test public void testCompareCriteriaOpCapFail5() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testCompareCriteriaOpCapFail5() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_ORDERED, false);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- helpTestVisitor("pm1.g1.e1 > 'x'", modelID, metadata, capFinder, false, false); //$NON-NLS-1$
+ helpTestVisitor("pm1.g1.e1 > 'x'", modelID, metadata, capFinder, false, false);
}
// does not have >= capability
- @Test public void testCompareCriteriaOpCapFail6() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testCompareCriteriaOpCapFail6() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_ORDERED, false);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- helpTestVisitor("pm1.g1.e1 >= 'x'", modelID, metadata, capFinder, false, false); //$NON-NLS-1$
+ helpTestVisitor("pm1.g1.e1 >= 'x'", modelID, metadata, capFinder, false, false);
}
// element not searchable
- @Test public void testCompareCriteriaSearchableFail() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
- FakeMetadataObject e1 = metadata.getStore().findObject("pm1.g1.e1", FakeMetadataObject.ELEMENT); //$NON-NLS-1$
- e1.putProperty(FakeMetadataObject.Props.SEARCHABLE_COMPARE, Boolean.FALSE);
+ @Test public void testCompareCriteriaSearchableFail() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
+ Column e1 = metadata.getElementID("pm1.g1.e1");
+ e1.setSearchType(SearchType.Like_Only);
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- helpTestVisitor("pm1.g1.e1 = 'x'", modelID, metadata, capFinder, false, false); //$NON-NLS-1$
+ helpTestVisitor("pm1.g1.e1 = 'x'", modelID, metadata, capFinder, false, false);
}
// no caps
- @Test public void testCompareCriteriaNoCaps() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testCompareCriteriaNoCaps() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- helpTestVisitor("pm1.g1.e1 = 'x'", modelID, metadata, capFinder, true, false); //$NON-NLS-1$
+ helpTestVisitor("pm1.g1.e1 = 'x'", modelID, metadata, capFinder, true, false);
}
- @Test public void testCompoundCriteriaAnd1() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testCompoundCriteriaAnd1() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- helpTestVisitor("pm1.g1.e1 = 'x' AND 0 = 1", modelID, metadata, capFinder, true, false); //$NON-NLS-1$
+ helpTestVisitor("pm1.g1.e1 = 'x' AND 0 = 1", modelID, metadata, capFinder, true, false);
}
- @Test public void testCompoundCriteriaAnd4() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testCompoundCriteriaAnd4() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- helpTestVisitor("pm1.g1.e1 = 'x' AND 0 = 1", modelID, metadata, capFinder, true, false); //$NON-NLS-1$
+ helpTestVisitor("pm1.g1.e1 = 'x' AND 0 = 1", modelID, metadata, capFinder, true, false);
}
- @Test public void testCompoundCriteriaOr1() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testCompoundCriteriaOr1() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -238,12 +238,12 @@
caps.setCapabilitySupport(Capability.CRITERIA_OR, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- helpTestVisitor("pm1.g1.e1 = 'x' OR 0 = 1", modelID, metadata, capFinder, true, false); //$NON-NLS-1$
+ helpTestVisitor("pm1.g1.e1 = 'x' OR 0 = 1", modelID, metadata, capFinder, true, false);
}
- @Test public void testCompoundCriteriaOr2() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testCompoundCriteriaOr2() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -251,134 +251,134 @@
caps.setCapabilitySupport(Capability.CRITERIA_OR, false);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- helpTestVisitor("pm1.g1.e1 = 'x' OR 0 = 1", modelID, metadata, capFinder, false, false); //$NON-NLS-1$
+ helpTestVisitor("pm1.g1.e1 = 'x' OR 0 = 1", modelID, metadata, capFinder, false, false);
}
- @Test public void testCompoundCriteriaOr4() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- FakeMetadataObject modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testCompoundCriteriaOr4() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- helpTestVisitor("pm1.g1.e1 = 'x' OR 0 = 1", modelID, metadata, capFinder, true, false); //$NON-NLS-1$
+ helpTestVisitor("pm1.g1.e1 = 'x' OR 0 = 1", modelID, metadata, capFinder, true, false);
}
- @Test public void testScalarFunction1() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testScalarFunction1() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setFunctionSupport("curtime", true); //$NON-NLS-1$
- capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+ capFinder.addCapabilities("pm1", caps);
- helpTestVisitor("curtime() = {t'10:00:00'}", modelID, metadata, capFinder, true, false); //$NON-NLS-1$
+ helpTestVisitor("curtime() = {t'10:00:00'}", modelID, metadata, capFinder, true, false);
}
/**
* Since this will always get pre-evaluated, this should also be true
*
*/
- @Test public void testScalarFunction2() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testScalarFunction2() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setFunctionSupport("+", false); //$NON-NLS-1$
- capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+ capFinder.addCapabilities("pm1", caps);
- helpTestVisitor("1 + 1 = 2", modelID, metadata, capFinder, true, false); //$NON-NLS-1$
+ helpTestVisitor("1 + 1 = 2", modelID, metadata, capFinder, true, false);
}
/**
* since curtime is command deterministic and not supported, it will be evaluated
*/
- @Test public void testScalarFunction2a() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testScalarFunction2a() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setFunctionSupport("curtime", false); //$NON-NLS-1$
- capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+ capFinder.addCapabilities("pm1", caps);
- helpTestVisitor("curtime() = '{t'10:00:00'}", modelID, metadata, capFinder, true, false); //$NON-NLS-1$
+ helpTestVisitor("curtime() = '{t'10:00:00'}", modelID, metadata, capFinder, true, false);
}
/**
* since rand is non-deterministic and not supported, it will be evaluated for every row
*/
- @Test public void testScalarFunction2b() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testScalarFunction2b() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setFunctionSupport("rand", false); //$NON-NLS-1$
- capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+ capFinder.addCapabilities("pm1", caps);
- helpTestVisitor("rand() = '1.0'", modelID, metadata, capFinder, false, false); //$NON-NLS-1$
+ helpTestVisitor("rand() = '1.0'", modelID, metadata, capFinder, false, false);
}
- @Test public void testIsNull1() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testIsNull1() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_ISNULL, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- helpTestVisitor("pm1.g1.e1 IS NULL", modelID, metadata, capFinder, true, false); //$NON-NLS-1$
+ helpTestVisitor("pm1.g1.e1 IS NULL", modelID, metadata, capFinder, true, false);
}
- @Test public void testIsNull2() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testIsNull2() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_ISNULL, false);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- helpTestVisitor("pm1.g1.e1 IS NULL", modelID, metadata, capFinder, false, false); //$NON-NLS-1$
+ helpTestVisitor("pm1.g1.e1 IS NULL", modelID, metadata, capFinder, false, false);
}
- @Test public void testIsNull3() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testIsNull3() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- helpTestVisitor("pm1.g1.e1 IS NULL", modelID, metadata, capFinder, true, false); //$NON-NLS-1$
+ helpTestVisitor("pm1.g1.e1 IS NULL", modelID, metadata, capFinder, true, false);
}
/**
* Is null is not a comparison operation
*/
- @Test public void testIsNull4() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
- FakeMetadataObject e1 = metadata.getStore().findObject("pm1.g1.e1", FakeMetadataObject.ELEMENT); //$NON-NLS-1$
- e1.putProperty(FakeMetadataObject.Props.SEARCHABLE_COMPARE, Boolean.FALSE);
+ @Test public void testIsNull4() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
+ Column e1 = metadata.getElementID("pm1.g1.e1");
+ e1.setSearchType(SearchType.Like_Only);
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_ISNULL, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- helpTestVisitor("pm1.g1.e1 IS NULL", modelID, metadata, capFinder, true, false); //$NON-NLS-1$
+ helpTestVisitor("pm1.g1.e1 IS NULL", modelID, metadata, capFinder, true, false);
}
- @Test public void testIsNull6() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testIsNull6() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -386,37 +386,37 @@
caps.setCapabilitySupport(Capability.CRITERIA_NOT, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- helpTestVisitor("pm1.g1.e1 IS NOT NULL", modelID, metadata, capFinder, true, false); //$NON-NLS-1$
+ helpTestVisitor("pm1.g1.e1 IS NOT NULL", modelID, metadata, capFinder, true, false);
}
- @Test public void testIsNull6fails() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testIsNull6fails() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_ISNULL, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- helpTestVisitor("pm1.g1.e1 IS NOT NULL", modelID, metadata, capFinder, false, false); //$NON-NLS-1$
+ helpTestVisitor("pm1.g1.e1 IS NOT NULL", modelID, metadata, capFinder, false, false);
}
// has all capabilities
- @Test public void testMatchCriteriaSuccess() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testMatchCriteriaSuccess() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_LIKE, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- helpTestVisitor("pm1.g1.e1 LIKE 'x'", modelID, metadata, capFinder, true, false); //$NON-NLS-1$
+ helpTestVisitor("pm1.g1.e1 LIKE 'x'", modelID, metadata, capFinder, true, false);
}
- @Test public void testMatchCriteriaSuccess2() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testMatchCriteriaSuccess2() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -424,13 +424,13 @@
caps.setCapabilitySupport(Capability.CRITERIA_LIKE_ESCAPE, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- helpTestVisitor("pm1.g1.e1 LIKE 'x' ESCAPE '#'", modelID, metadata, capFinder, true, false); //$NON-NLS-1$
+ helpTestVisitor("pm1.g1.e1 LIKE 'x' ESCAPE '#'", modelID, metadata, capFinder, true, false);
}
// Test for NOT LIKE
- @Test public void testMatchCriteriaSuccess3() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testMatchCriteriaSuccess3() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -438,12 +438,12 @@
caps.setCapabilitySupport(Capability.CRITERIA_NOT, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- helpTestVisitor("pm1.g1.e1 NOT LIKE 'x'", modelID, metadata, capFinder, true, false); //$NON-NLS-1$
+ helpTestVisitor("pm1.g1.e1 NOT LIKE 'x'", modelID, metadata, capFinder, true, false);
}
- @Test public void testMatchCriteriaSuccess3fails() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testMatchCriteriaSuccess3fails() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -454,9 +454,9 @@
}
// does not have compare capability
- @Test public void testMatchCriteriaCapFail1() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testMatchCriteriaCapFail1() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -468,9 +468,9 @@
}
// does not have escape char capability
- @Test public void testMatchCriteriaCapFail2() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testMatchCriteriaCapFail2() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -482,11 +482,11 @@
}
// element not searchable
- @Test public void testMatchCriteriaMatchableFail() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
- FakeMetadataObject e1 = metadata.getStore().findObject("pm1.g1.e1", FakeMetadataObject.ELEMENT); //$NON-NLS-1$
- e1.putProperty(FakeMetadataObject.Props.SEARCHABLE_LIKE, Boolean.FALSE);
+ @Test public void testMatchCriteriaMatchableFail() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
+ Column e1 = metadata.getElementID("pm1.g1.e1");
+ e1.setSearchType(SearchType.All_Except_Like);
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -498,18 +498,18 @@
}
// no caps
- @Test public void testMatchCriteriaNoCaps() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testMatchCriteriaNoCaps() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
helpTestVisitor("pm1.g1.e1 LIKE 'x'", modelID, metadata, capFinder, true, false); //$NON-NLS-1$
}
- @Test public void testNotCriteria1() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testNotCriteria1() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -520,9 +520,9 @@
helpTestVisitor("NOT pm1.g1.e1 = 'x'", modelID, metadata, capFinder, true, false); //$NON-NLS-1$
}
- @Test public void testNotCriteria2() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testNotCriteria2() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -533,9 +533,9 @@
helpTestVisitor("NOT pm1.g1.e1 = 'x'", modelID, metadata, capFinder, false, false); //$NON-NLS-1$
}
- @Test public void testSetCriteria1() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testSetCriteria1() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -545,9 +545,9 @@
helpTestVisitor("pm1.g1.e1 IN ('x')", modelID, metadata, capFinder, true, false); //$NON-NLS-1$
}
- @Test public void testSetCriteria2() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testSetCriteria2() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -557,20 +557,20 @@
helpTestVisitor("pm1.g1.e1 IN ('x')", modelID, metadata, capFinder, false, false); //$NON-NLS-1$
}
- @Test public void testSetCriteria3() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testSetCriteria3() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
helpTestVisitor("pm1.g1.e1 IN ('x')", modelID, metadata, capFinder, true, false); //$NON-NLS-1$
}
- @Test public void testSetCriteria5() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- FakeMetadataObject modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
- FakeMetadataObject elementID = metadata.getStore().findObject("pm1.g1.e1" , FakeMetadataObject.ELEMENT); //$NON-NLS-1$
- elementID.putProperty(FakeMetadataObject.Props.SEARCHABLE_COMPARE, Boolean.FALSE);
+ @Test public void testSetCriteria5() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
+ Column elementID = metadata.getElementID("pm1.g1.e1");
+ elementID.setSearchType(SearchType.Like_Only);
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -581,9 +581,9 @@
}
//Test for success NOT IN
- @Test public void testSetCriteria7() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testSetCriteria7() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -594,9 +594,9 @@
helpTestVisitor("pm1.g1.e1 NOT IN ('x')", modelID, metadata, capFinder, true, false); //$NON-NLS-1$
}
- @Test public void testSetCriteria7fails() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testSetCriteria7fails() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -606,9 +606,9 @@
helpTestVisitor("pm1.g1.e1 NOT IN ('x')", modelID, metadata, capFinder, false, false); //$NON-NLS-1$
}
- @Test public void testSetCriteria8() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testSetCriteria8() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -619,9 +619,9 @@
helpTestVisitor("pm1.g1.e1 IN ('x', 'y', 'z')", modelID, metadata, capFinder, false, false); //$NON-NLS-1$
}
- @Test public void testSetCriteria9() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testSetCriteria9() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -632,9 +632,9 @@
helpTestVisitor("pm1.g1.e1 IN ('x', 'y')", modelID, metadata, capFinder, true, false); //$NON-NLS-1$
}
- @Test public void testSubquerySetCriteria() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testSubquerySetCriteria() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -644,9 +644,9 @@
helpTestVisitor("pm1.g1.e1 IN (SELECT 'xyz' FROM pm1.g1)", modelID, metadata, capFinder, false, false); //$NON-NLS-1$
}
- @Test public void testSearchCase() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testSearchCase() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -658,9 +658,9 @@
}
// has all capabilities
- @Test public void testSubqueryCompareCriteriaSuccess() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testSubqueryCompareCriteriaSuccess() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -672,9 +672,9 @@
}
// does not have where capability
- @Test public void testSubqueryCompareCriteriaCapFail1() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testSubqueryCompareCriteriaCapFail1() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -685,9 +685,9 @@
}
// does not have compare capability
- @Test public void testSubqueryCompareCriteriaCapFail2() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testSubqueryCompareCriteriaCapFail2() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -698,9 +698,9 @@
}
// does not have subquery capability
- @Test public void testSubqueryCompareCriteriaFail3() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testSubqueryCompareCriteriaFail3() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -711,9 +711,9 @@
}
// does not have quantified subquery comparison capability
- @Test public void testSubqueryCompareCriteriaFail4() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testSubqueryCompareCriteriaFail4() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -726,9 +726,9 @@
}
// does not have quantified subquery comparison capability for ANY
- @Test public void testSubqueryCompareCriteriaFail5() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testSubqueryCompareCriteriaFail5() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -742,9 +742,9 @@
}
// does not have quantified subquery comparison capability for ALL
- @Test public void testSubqueryCompareCriteriaFail6() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testSubqueryCompareCriteriaFail6() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -758,9 +758,9 @@
}
// does not have = capability
- @Test public void testSubqueryCompareCriteriaOpCapFail1() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testSubqueryCompareCriteriaOpCapFail1() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -771,9 +771,9 @@
}
// does not have <> capability
- @Test public void testSubqueryCompareCriteriaOpCapFail2() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testSubqueryCompareCriteriaOpCapFail2() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -784,9 +784,9 @@
}
// does not have < capability
- @Test public void testSubqueryCompareCriteriaOpCapFail3() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testSubqueryCompareCriteriaOpCapFail3() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -797,9 +797,9 @@
}
// does not have <= capability
- @Test public void testSubqueryCompareCriteriaOpCapFail4() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testSubqueryCompareCriteriaOpCapFail4() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -810,9 +810,9 @@
}
// does not have > capability
- @Test public void testSubqueryCompareCriteriaOpCapFail5() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testSubqueryCompareCriteriaOpCapFail5() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -823,9 +823,9 @@
}
// does not have >= capability
- @Test public void testSubqueryCompareCriteriaOpCapFail6() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testSubqueryCompareCriteriaOpCapFail6() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -836,11 +836,11 @@
}
// element not searchable
- @Test public void testSubqueryCompareCriteriaSearchableFail() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
- FakeMetadataObject e1 = metadata.getStore().findObject("pm1.g1.e1", FakeMetadataObject.ELEMENT); //$NON-NLS-1$
- e1.putProperty(FakeMetadataObject.Props.SEARCHABLE_COMPARE, Boolean.FALSE);
+ @Test public void testSubqueryCompareCriteriaSearchableFail() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1();
+ Schema modelID = metadata.getMetadataStore().getSchema("PM1");
+ Column e1 = metadata.getElementID("pm1.g1.e1");
+ e1.setSearchType(SearchType.Like_Only);
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -850,9 +850,9 @@
helpTestVisitorWithCommand("SELECT e1 FROM pm1.g1 WHERE pm1.g1.e1 = ANY (SELECT e1 FROM pm1.g2)", modelID, metadata, capFinder, false, false); //$NON-NLS-1$
}
- @Test public void testExistsCriteria1() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testExistsCriteria1() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -862,9 +862,9 @@
helpTestVisitorWithCommand("SELECT e1 FROM pm1.g1 WHERE EXISTS(SELECT e1 FROM pm1.g2)", modelID, metadata, capFinder, true, false); //$NON-NLS-1$
}
- @Test public void testExistsCriteria2() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testExistsCriteria2() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -874,9 +874,9 @@
helpTestVisitorWithCommand("SELECT e1 FROM pm1.g1 WHERE EXISTS(SELECT e1 FROM pm1.g2)", modelID, metadata, capFinder, false, false); //$NON-NLS-1$
}
- @Test public void testExistsCriteria5() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
- Object modelID = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
+ @Test public void testExistsCriteria5() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
+ Object modelID = metadata.getMetadataStore().getSchema("PM1");
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -40,8 +40,7 @@
import org.teiid.query.parser.QueryParser;
import org.teiid.query.resolver.QueryResolver;
import org.teiid.query.sql.lang.Command;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
@@ -50,7 +49,7 @@
*/
public class TestRuleAccessPatternValidation {
- private static final FakeMetadataFacade METADATA = FakeMetadataFactory.example1Cached();
+ private static final QueryMetadataInterface METADATA = RealMetadataFactory.example1Cached();
private static final boolean DEBUG = false;
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleChooseDependent.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleChooseDependent.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleChooseDependent.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -37,6 +37,7 @@
import org.teiid.api.exception.query.QueryPlannerException;
import org.teiid.core.TeiidComponentException;
import org.teiid.query.analysis.AnalysisRecord;
+import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.optimizer.TestOptimizer;
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
import org.teiid.query.optimizer.relational.RuleStack;
@@ -44,6 +45,7 @@
import org.teiid.query.optimizer.relational.plantree.NodeFactory;
import org.teiid.query.optimizer.relational.plantree.PlanNode;
import org.teiid.query.processor.relational.JoinNode.JoinStrategyType;
+import org.teiid.query.resolver.util.ResolverUtil;
import org.teiid.query.rewriter.QueryRewriter;
import org.teiid.query.sql.lang.CompareCriteria;
import org.teiid.query.sql.lang.CompoundCriteria;
@@ -59,9 +61,7 @@
import org.teiid.query.sql.symbol.Constant;
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
@SuppressWarnings("unchecked")
@@ -74,11 +74,11 @@
/* Make Neither Side Dependent */
private static final int NEITHER_SIDE = 3;
- private FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ private QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// ################################## TEST HELPERS ################################
- public PlanNode createAccessNode(Collection groupSymbols) {
+ public PlanNode createAccessNode(Collection groupSymbols) throws Exception {
PlanNode accessNode = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
PlanNode joinNode = NodeFactory.getNewNode(NodeConstants.Types.JOIN);
PlanNode sourceNode = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
@@ -97,58 +97,58 @@
return accessNode;
}
- public GroupSymbol getVirtualGroup() {
+ public GroupSymbol getVirtualGroup() throws Exception {
GroupSymbol gs = new GroupSymbol("vm1.g1"); //$NON-NLS-1$
- gs.setMetadataID(this.metadata.getStore().findObject("vm1.g1", FakeMetadataObject.GROUP)); //$NON-NLS-1$
+ ResolverUtil.resolveGroup(gs, metadata);
return gs;
}
- public GroupSymbol getPhysicalGroup(int num) {
+ public GroupSymbol getPhysicalGroup(int num) throws Exception {
String id = "pm1.g" + num; //$NON-NLS-1$
GroupSymbol gs = new GroupSymbol(id);
- gs.setMetadataID(this.metadata.getStore().findObject(id, FakeMetadataObject.GROUP));
+ ResolverUtil.resolveGroup(gs, metadata);
return gs;
}
- public GroupSymbol getPhysicalGroup(int modelNum, int num) {
+ public GroupSymbol getPhysicalGroup(int modelNum, int num) throws Exception {
String id = "pm" + modelNum + ".g" + num; //$NON-NLS-1$ //$NON-NLS-2$
GroupSymbol gs = new GroupSymbol(id);
- gs.setMetadataID(this.metadata.getStore().findObject(id, FakeMetadataObject.GROUP));
+ ResolverUtil.resolveGroup(gs, metadata);
return gs;
}
- public GroupSymbol getPhysicalGroupWithAlias(int num, String alias) {
+ public GroupSymbol getPhysicalGroupWithAlias(int num, String alias) throws Exception {
String id = "pm1.g" + num; //$NON-NLS-1$
GroupSymbol gs = new GroupSymbol(alias, id);
- gs.setMetadataID(this.metadata.getStore().findObject(id, FakeMetadataObject.GROUP));
+ ResolverUtil.resolveGroup(gs, metadata);
return gs;
}
- public ElementSymbol getElementSymbol(int groupNum, int elementNum) {
+ public ElementSymbol getElementSymbol(int groupNum, int elementNum) throws Exception {
String id = "pm1.g" + groupNum + ".e" + elementNum; //$NON-NLS-1$ //$NON-NLS-2$
ElementSymbol es = new ElementSymbol(id);
- es.setMetadataID(this.metadata.getStore().findObject(id, FakeMetadataObject.ELEMENT));
+ es.setMetadataID(this.metadata.getElementID(id));
es.setGroupSymbol(getPhysicalGroup(groupNum));
return es;
}
- public ElementSymbol getElementSymbol(int modelNum, int groupNum, int elementNum) {
+ public ElementSymbol getElementSymbol(int modelNum, int groupNum, int elementNum) throws Exception {
String id = "pm" + modelNum + ".g" + groupNum + ".e" + elementNum; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ElementSymbol es = new ElementSymbol(id);
- es.setMetadataID(this.metadata.getStore().findObject(id, FakeMetadataObject.ELEMENT));
+ es.setMetadataID(this.metadata.getElementID(id));
es.setGroupSymbol(getPhysicalGroup(modelNum, groupNum));
return es;
}
- public ElementSymbol getElementSymbolWithGroupAlias(int groupNum, int elementNum, String alias) {
+ public ElementSymbol getElementSymbolWithGroupAlias(int groupNum, int elementNum, String alias) throws Exception {
String id = "pm1.g" + groupNum + ".e" + elementNum; //$NON-NLS-1$ //$NON-NLS-2$
ElementSymbol es = new ElementSymbol(id);
- es.setMetadataID(this.metadata.getStore().findObject(id, FakeMetadataObject.ELEMENT));
+ es.setMetadataID(this.metadata.getElementID(id));
es.setGroupSymbol(getPhysicalGroupWithAlias(groupNum, alias));
return es;
}
- public Query createBaseQuery() {
+ public Query createBaseQuery() throws Exception {
Query query = new Query();
Select select = new Select();
@@ -404,7 +404,7 @@
// ################################## ACTUAL TESTS ################################
- @Test public void testValidJoin1() {
+ @Test public void testValidJoin1() throws Exception {
PlanNode accessNode = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
accessNode.addGroup(getPhysicalGroup(1));
@@ -415,7 +415,7 @@
helpTestValidJoin(joinNode, accessNode, false);
}
- @Test public void testValidJoin2() {
+ @Test public void testValidJoin2() throws Exception {
PlanNode accessNode = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
accessNode.addGroup(getPhysicalGroup(1));
@@ -427,7 +427,7 @@
helpTestValidJoin(joinNode, accessNode, false);
}
- @Test public void testValidJoin3() {
+ @Test public void testValidJoin3() throws Exception {
PlanNode accessNode1 = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
PlanNode accessNode2 = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
accessNode1.addGroup(getPhysicalGroup(1));
@@ -444,7 +444,7 @@
helpTestValidJoin(joinNode, accessNode1, true);
}
- @Test public void testValidJoin4() {
+ @Test public void testValidJoin4() throws Exception {
PlanNode accessNode1 = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
PlanNode accessNode2 = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
@@ -459,7 +459,7 @@
helpTestValidJoin(joinNode, accessNode2, false);
}
- @Test public void testValidJoin5() {
+ @Test public void testValidJoin5() throws Exception {
PlanNode accessNode1 = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
PlanNode accessNode2 = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
@@ -474,7 +474,7 @@
helpTestValidJoin(joinNode, accessNode1, false);
}
- @Test public void testValidJoin6() {
+ @Test public void testValidJoin6() throws Exception {
PlanNode accessNode1 = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
PlanNode accessNode2 = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
accessNode1.addGroup(getPhysicalGroup(1));
@@ -497,7 +497,7 @@
*/
@Test public void testChooseKey() throws Exception {
//override default metadata
- this.metadata = FakeMetadataFactory.example4();
+ this.metadata = RealMetadataFactory.example4();
GroupSymbol group1 = getPhysicalGroup(2,3);
GroupSymbol group2 = getPhysicalGroup(3,3);
@@ -522,7 +522,7 @@
*/
@Test public void testChooseKey2() throws Exception {
//override default metadata
- this.metadata = FakeMetadataFactory.example4();
+ this.metadata = RealMetadataFactory.example4();
GroupSymbol group1 = getPhysicalGroup(2,3); //no key
GroupSymbol group1a = null;
@@ -576,7 +576,7 @@
*/
@Test public void testCardinality() throws Exception {
//override default metadata
- this.metadata = FakeMetadataFactory.example4();
+ this.metadata = RealMetadataFactory.example4();
GroupSymbol group1 = getPhysicalGroup(1,2);
GroupSymbol group2 = getPhysicalGroup(2,2);
@@ -607,7 +607,7 @@
*/
@Test public void testCardinalityAndKey() throws Exception {
//override default metadata
- this.metadata = FakeMetadataFactory.example4();
+ this.metadata = RealMetadataFactory.example4();
GroupSymbol group1 = getPhysicalGroup(1,2);
GroupSymbol group2 = getPhysicalGroup(2,2);
@@ -633,7 +633,7 @@
@Test public void testCardinalityAndKeyNestedLoop() throws Exception {
//override default metadata
- this.metadata = FakeMetadataFactory.example4();
+ this.metadata = RealMetadataFactory.example4();
GroupSymbol group1 = getPhysicalGroup(1,2);
GroupSymbol group2 = getPhysicalGroup(2,2);
@@ -659,7 +659,7 @@
@Test public void testRejectDependentJoin() throws Exception {
//override default metadata
- this.metadata = FakeMetadataFactory.example4();
+ this.metadata = RealMetadataFactory.example4();
GroupSymbol group1 = getPhysicalGroup(3,1);
GroupSymbol group2 = getPhysicalGroup(3,2);
@@ -685,7 +685,7 @@
*/
@Test public void testCardinalityWithKeyCrit() throws Exception {
//override default metadata
- this.metadata = FakeMetadataFactory.example4();
+ this.metadata = RealMetadataFactory.example4();
GroupSymbol group1 = getPhysicalGroup(1,2);
ElementSymbol g1e2 = getElementSymbol(1,2,2);
@@ -713,7 +713,7 @@
*/
@Test public void testCardinalityWithKeyCompoundCritAND() throws Exception {
//override default metadata
- this.metadata = FakeMetadataFactory.example4();
+ this.metadata = RealMetadataFactory.example4();
GroupSymbol group1 = getPhysicalGroup(1,2);
ElementSymbol g1e2 = getElementSymbol(1,2,2);
@@ -745,7 +745,7 @@
*/
@Test public void testCardinalityWithKeyCompoundCritOR() throws Exception {
//override default metadata
- this.metadata = FakeMetadataFactory.example4();
+ this.metadata = RealMetadataFactory.example4();
GroupSymbol group1 = getPhysicalGroup(1,2);
ElementSymbol g1e2 = getElementSymbol(1,2,2);
@@ -775,7 +775,7 @@
*/
@Test public void testCardinalityWithKeySetCrit() throws Exception {
//override default metadata
- this.metadata = FakeMetadataFactory.example4();
+ this.metadata = RealMetadataFactory.example4();
GroupSymbol group1 = getPhysicalGroup(1,2);
ElementSymbol g1e2 = getElementSymbol(1,2,2);
@@ -806,7 +806,7 @@
*/
@Test public void testCardinalityWithKeyMatchCrit() throws Exception {
//override default metadata
- this.metadata = FakeMetadataFactory.example4();
+ this.metadata = RealMetadataFactory.example4();
GroupSymbol group1 = getPhysicalGroup(1,2);
ElementSymbol g1e2 = getElementSymbol(1,2,2);
@@ -833,7 +833,7 @@
*/
@Test public void testCardinalityWithKeyIsNullCrit() throws Exception {
//override default metadata
- this.metadata = FakeMetadataFactory.example4();
+ this.metadata = RealMetadataFactory.example4();
GroupSymbol group1 = getPhysicalGroup(1,2);
ElementSymbol g1e2 = getElementSymbol(1,2,2);
@@ -860,7 +860,7 @@
*/
@Test public void testCardinalityWithKeyNotCrit() throws Exception {
//override default metadata
- this.metadata = FakeMetadataFactory.example4();
+ this.metadata = RealMetadataFactory.example4();
GroupSymbol group1 = getPhysicalGroup(1,2);
ElementSymbol g1e2 = getElementSymbol(1,2,2);
@@ -889,7 +889,7 @@
*/
@Test public void testCardinalityWithKeyComplexCrit() throws Exception {
//override default metadata
- this.metadata = FakeMetadataFactory.example4();
+ this.metadata = RealMetadataFactory.example4();
GroupSymbol group1 = getPhysicalGroup(1,2);
ElementSymbol g1e2 = getElementSymbol(1,2,2);
@@ -918,7 +918,7 @@
@Test public void testCardinalityWithKeyComplexCrit2() throws Exception {
//override default metadata
- this.metadata = FakeMetadataFactory.example4();
+ this.metadata = RealMetadataFactory.example4();
GroupSymbol group1 = getPhysicalGroup(1,2);
ElementSymbol g1e2 = getElementSymbol(1,2,2);
@@ -948,7 +948,7 @@
@Test public void testCardinalityWithKeyComplexCrit3() throws Exception {
//override default metadata
- this.metadata = FakeMetadataFactory.example4();
+ this.metadata = RealMetadataFactory.example4();
GroupSymbol group1 = getPhysicalGroup(1,2);
ElementSymbol g1e2 = getElementSymbol(1,2,2);
@@ -982,7 +982,7 @@
*/
@Test public void testCardinalityWithNonKeyCrit() throws Exception {
//override default metadata
- this.metadata = FakeMetadataFactory.example4();
+ this.metadata = RealMetadataFactory.example4();
GroupSymbol group1 = getPhysicalGroup(1,2);
ElementSymbol g1e1 = getElementSymbol(1,2,1);
@@ -1011,7 +1011,7 @@
*/
@Test public void testCardinalityWithCriteriaAndJoin() throws Exception {
//override default metadata
- this.metadata = FakeMetadataFactory.example4();
+ this.metadata = RealMetadataFactory.example4();
GroupSymbol group1 = getPhysicalGroup(2,2); //no key
GroupSymbol group1a = null;
@@ -1062,7 +1062,7 @@
@Test public void testCardinalityWithAtomicCrossJoin() throws Exception {
//override default metadata
- this.metadata = FakeMetadataFactory.example4();
+ this.metadata = RealMetadataFactory.example4();
GroupSymbol group1 = getPhysicalGroup(2,2); //no key
GroupSymbol group1a = null;
@@ -1108,7 +1108,7 @@
@Test public void testCardinalityWithAtomicCrossJoin2() throws Exception {
//override default metadata
- this.metadata = FakeMetadataFactory.example4();
+ this.metadata = RealMetadataFactory.example4();
GroupSymbol group1 = getPhysicalGroup(2,2); //no key
GroupSymbol group1a = null;
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePlaceAccess.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePlaceAccess.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePlaceAccess.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -34,14 +34,14 @@
import org.teiid.query.sql.lang.Select;
import org.teiid.query.sql.symbol.AllSymbol;
import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import junit.framework.TestCase;
public class TestRulePlaceAccess extends TestCase {
- private static final QueryMetadataInterface METADATA = FakeMetadataFactory.example1Cached();
+ private static final QueryMetadataInterface METADATA = RealMetadataFactory.example1Cached();
// ################################## FRAMEWORK ################################
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePushSelectCriteria.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePushSelectCriteria.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePushSelectCriteria.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -48,7 +48,7 @@
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.SingleElementSymbol;
import org.teiid.query.sql.util.SymbolMap;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
@@ -67,7 +67,7 @@
}
@Test public void testPushAcrossFrameWithAccessNode() throws Exception {
- QueryMetadataInterface metadata = new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore());
+ QueryMetadataInterface metadata = new TempMetadataAdapter(RealMetadataFactory.example1Cached(), new TempMetadataStore());
Command command = TestOptimizer.helpGetCommand("select * from (select * from pm1.g1 union select * from pm1.g2) x where e1 = 1", metadata, null); //$NON-NLS-1$
Command subCommand = TestOptimizer.helpGetCommand("select * from pm1.g1 union select * from pm1.g2", metadata, null); //$NON-NLS-1$
RelationalPlanner p = new RelationalPlanner();
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleValidateWhereAll.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleValidateWhereAll.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleValidateWhereAll.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -32,7 +32,7 @@
import org.teiid.query.sql.lang.Insert;
import org.teiid.query.sql.lang.Query;
import org.teiid.query.sql.symbol.Constant;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import junit.framework.TestCase;
@@ -70,7 +70,7 @@
public void testDefect21982_3() {
TestOptimizer.helpPlan(
"SELECT * FROM vm1.g38", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, getWhereAllCapabilities(),
new String[0],
false);
@@ -79,7 +79,7 @@
public void testWhereAll1() {
TestOptimizer.helpPlan(
"SELECT * FROM pm6.g1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, getWhereAllCapabilities(),
new String[0],
false);
@@ -88,7 +88,7 @@
public void testWhereAll2() throws Exception {
TestOptimizer.helpPlan(
"SELECT pm1.g1.e1 FROM pm1.g1, pm6.g1 WHERE pm1.g1.e1=pm6.g1.e1 OPTION MAKEDEP pm6.g1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
null, getWhereAllCapabilities(),
new String[] {
"SELECT g_0.e1 AS c_0 FROM pm6.g1 AS g_0 WHERE g_0.e1 IN (<dependent values>) ORDER BY c_0", "SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 ORDER BY c_0" //$NON-NLS-1$ //$NON-NLS-2$
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/xml/TestMarkExcludeVisitor.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/xml/TestMarkExcludeVisitor.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/xml/TestMarkExcludeVisitor.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -26,26 +26,25 @@
import java.io.StringWriter;
import java.util.Collection;
+import junit.framework.TestCase;
+
import org.teiid.query.mapping.xml.MappingDocument;
import org.teiid.query.mapping.xml.MappingOutputter;
-import org.teiid.query.optimizer.xml.XMLPlanner;
+import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.processor.xml.TestXMLProcessor;
import org.teiid.query.sql.lang.Query;
import org.teiid.query.sql.symbol.GroupSymbol;
import org.teiid.query.sql.visitor.GroupCollectorVisitor;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import junit.framework.TestCase;
-
/**
*
*/
public class TestMarkExcludeVisitor extends TestCase {
void helpTest(String sql, String expected) throws Exception{
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadataCached();
+ QueryMetadataInterface metadata = TestXMLProcessor.exampleMetadataCached();
Query query = (Query)TestXMLProcessor.helpGetCommand(sql, metadata);
Collection groups = GroupCollectorVisitor.getGroups(query, true);
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/xml/TestNameInSourceResolverVisitor.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/xml/TestNameInSourceResolverVisitor.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/xml/TestNameInSourceResolverVisitor.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -29,7 +29,8 @@
import java.util.List;
import java.util.Map;
-import org.teiid.core.TeiidComponentException;
+import junit.framework.TestCase;
+
import org.teiid.query.mapping.xml.MappingAttribute;
import org.teiid.query.mapping.xml.MappingDocument;
import org.teiid.query.mapping.xml.MappingElement;
@@ -38,9 +39,6 @@
import org.teiid.query.mapping.xml.Navigator;
import org.teiid.query.mapping.xml.ResultSetInfo;
import org.teiid.query.metadata.QueryMetadataInterface;
-import org.teiid.query.optimizer.xml.NameInSourceResolverVisitor;
-import org.teiid.query.optimizer.xml.SourceNodeGenaratorVisitor;
-import org.teiid.query.optimizer.xml.XMLPlannerEnvironment;
import org.teiid.query.processor.xml.TestXMLProcessor;
import org.teiid.query.sql.LanguageVisitor;
import org.teiid.query.sql.lang.Command;
@@ -48,12 +46,9 @@
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.GroupSymbol;
import org.teiid.query.sql.visitor.GroupCollectorVisitor;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import junit.framework.TestCase;
-
/**
*
*/
@@ -61,11 +56,11 @@
static HashMap infos = new HashMap();
XMLPlannerEnvironment getEnv(String sql) throws Exception{
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadataCached();
+ QueryMetadataInterface metadata = TestXMLProcessor.exampleMetadataCached();
Query query = (Query)TestXMLProcessor.helpGetCommand(sql, metadata);
- Collection groups = GroupCollectorVisitor.getGroups(query, true);
- GroupSymbol group = (GroupSymbol) groups.iterator().next();
+ Collection<GroupSymbol> groups = GroupCollectorVisitor.getGroups(query, true);
+ GroupSymbol group = groups.iterator().next();
MappingDocument docOrig = (MappingDocument)metadata.getMappingNode(metadata.getGroupID(group.getName()));
MappingDocument doc = (MappingDocument)docOrig.clone();
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLNodeMappingVisitor.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLNodeMappingVisitor.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLNodeMappingVisitor.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -22,23 +22,21 @@
package org.teiid.query.optimizer.xml;
+import junit.framework.TestCase;
+
import org.teiid.api.exception.query.QueryPlannerException;
import org.teiid.core.TeiidComponentException;
import org.teiid.query.mapping.xml.MappingDocument;
import org.teiid.query.metadata.QueryMetadataInterface;
-import org.teiid.query.optimizer.xml.SourceNodeGenaratorVisitor;
-import org.teiid.query.optimizer.xml.XMLNodeMappingVisitor;
import org.teiid.query.processor.xml.TestXMLProcessor;
+import org.teiid.query.resolver.util.ResolverVisitor;
import org.teiid.query.sql.lang.CompareCriteria;
import org.teiid.query.sql.lang.Criteria;
import org.teiid.query.sql.symbol.Constant;
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import junit.framework.TestCase;
-
/**
*/
public class TestXMLNodeMappingVisitor extends TestCase {
@@ -59,19 +57,17 @@
}
public void testMappingCriteria() throws Exception {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadata();
+ QueryMetadataInterface metadata = TestXMLProcessor.exampleMetadata();
GroupSymbol doc = new GroupSymbol("xmltest.doc1"); //$NON-NLS-1$
doc.setMetadataID(metadata.getGroupID(doc.getName()));
-
MappingDocument mappingDoc = (MappingDocument)metadata.getMappingNode(doc.getMetadataID());
mappingDoc = SourceNodeGenaratorVisitor.extractSourceNodes(mappingDoc);
// Create criteria
- ElementSymbol es = new ElementSymbol("Catalogs.Catalog.Items.Item.Name"); //$NON-NLS-1$
- es.setGroupSymbol(doc);
- es.setMetadataID(metadata.getElementID("xmltest.doc1.Catalogs.Catalog.Items.Item.Name")); //$NON-NLS-1$
+ ElementSymbol es = new ElementSymbol("Catalogs.Catalog.Items.Item.Name", null, doc); //$NON-NLS-1$
+ ResolverVisitor.resolveLanguageObject(es, metadata);
CompareCriteria crit = new CompareCriteria(es, CompareCriteria.EQ, new Constant("abc")); //$NON-NLS-1$
helpTestMapping(crit, "xmltest.\"group\".items.itemName = 'abc'", mappingDoc, metadata); //$NON-NLS-1$
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLPlanner.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLPlanner.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLPlanner.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -22,9 +22,9 @@
package org.teiid.query.optimizer.xml;
-import java.util.ArrayList;
-import java.util.List;
+import static org.junit.Assert.*;
+import org.junit.Test;
import org.teiid.api.exception.query.QueryMetadataException;
import org.teiid.api.exception.query.QueryPlannerException;
import org.teiid.core.TeiidComponentException;
@@ -32,6 +32,9 @@
import org.teiid.core.id.IDGenerator;
import org.teiid.core.id.IntegerIDFactory;
import org.teiid.core.types.DataTypeManager;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Schema;
+import org.teiid.metadata.Table;
import org.teiid.query.analysis.AnalysisRecord;
import org.teiid.query.mapping.relational.QueryNode;
import org.teiid.query.mapping.xml.MappingAttribute;
@@ -40,11 +43,9 @@
import org.teiid.query.mapping.xml.MappingSequenceNode;
import org.teiid.query.mapping.xml.Namespace;
import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.optimizer.TestOptimizer;
import org.teiid.query.optimizer.capabilities.CapabilitiesFinder;
-import org.teiid.query.optimizer.xml.CriteriaPlanner;
-import org.teiid.query.optimizer.xml.XMLPlanner;
-import org.teiid.query.optimizer.xml.XMLPlannerEnvironment;
import org.teiid.query.parser.QueryParser;
import org.teiid.query.processor.xml.BlockInstruction;
import org.teiid.query.processor.xml.EndBlockInstruction;
@@ -58,23 +59,12 @@
import org.teiid.query.resolver.QueryResolver;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.lang.Query;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
-import org.teiid.query.unittest.FakeMetadataStore;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
-import junit.framework.TestCase;
+@SuppressWarnings("nls")
+public class TestXMLPlanner {
-
-public class TestXMLPlanner extends TestCase {
-
- // ################################## FRAMEWORK ################################
-
- public TestXMLPlanner(String name) {
- super(name);
- }
-
// ################################## TEST HELPERS ################################
public static XMLPlan helpPlan(String sql, QueryMetadataInterface md) throws Exception {
@@ -93,26 +83,21 @@
}
}
- public static FakeMetadataFacade example1() {
+ public static TransformationMetadata example1() {
+ MetadataStore metadataStore = new MetadataStore();
// Create models
- FakeMetadataObject pm1 = FakeMetadataFactory.createPhysicalModel("pm1"); //$NON-NLS-1$
- FakeMetadataObject vm1 = FakeMetadataFactory.createVirtualModel("vm1"); //$NON-NLS-1$
+ Schema pm1 = RealMetadataFactory.createPhysicalModel("pm1", metadataStore); //$NON-NLS-1$
+ Schema vm1 = RealMetadataFactory.createVirtualModel("vm1", metadataStore); //$NON-NLS-1$
// Create physical groups
- FakeMetadataObject pm1g1 =
- FakeMetadataFactory.createPhysicalGroup("pm1.g1", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g2 =
- FakeMetadataFactory.createPhysicalGroup("pm1.g2", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g3 =
- FakeMetadataFactory.createPhysicalGroup("pm1.g3", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g4 =
- FakeMetadataFactory.createPhysicalGroup("pm1.g4", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g5 =
- FakeMetadataFactory.createPhysicalGroup("pm1.g5", pm1); //$NON-NLS-1$
+ Table pm1g1 = RealMetadataFactory.createPhysicalGroup("g1", pm1); //$NON-NLS-1$
+ Table pm1g2 = RealMetadataFactory.createPhysicalGroup("g2", pm1); //$NON-NLS-1$
+ Table pm1g3 = RealMetadataFactory.createPhysicalGroup("g3", pm1); //$NON-NLS-1$
+ Table pm1g4 = RealMetadataFactory.createPhysicalGroup("g4", pm1); //$NON-NLS-1$
+ Table pm1g5 = RealMetadataFactory.createPhysicalGroup("g5", pm1); //$NON-NLS-1$
// Create physical elements
- List pm1g1e =
- FakeMetadataFactory.createElements(
+ RealMetadataFactory.createElements(
pm1g1,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] {
@@ -120,8 +105,7 @@
DataTypeManager.DefaultDataTypes.INTEGER,
DataTypeManager.DefaultDataTypes.BOOLEAN,
DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm1g2e =
- FakeMetadataFactory.createElements(
+ RealMetadataFactory.createElements(
pm1g2,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] {
@@ -129,8 +113,7 @@
DataTypeManager.DefaultDataTypes.INTEGER,
DataTypeManager.DefaultDataTypes.BOOLEAN,
DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm1g3e =
- FakeMetadataFactory.createElements(
+ RealMetadataFactory.createElements(
pm1g3,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] {
@@ -138,8 +121,7 @@
DataTypeManager.DefaultDataTypes.INTEGER,
DataTypeManager.DefaultDataTypes.BOOLEAN,
DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm1g4e =
- FakeMetadataFactory.createElements(
+ RealMetadataFactory.createElements(
pm1g4,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] {
@@ -147,8 +129,7 @@
DataTypeManager.DefaultDataTypes.INTEGER,
DataTypeManager.DefaultDataTypes.BOOLEAN,
DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm1g5e =
- FakeMetadataFactory.createElements(
+ RealMetadataFactory.createElements(
pm1g5,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] {
@@ -158,43 +139,36 @@
DataTypeManager.DefaultDataTypes.DOUBLE });
// Create virtual groups
- QueryNode vm1g1n1 = new QueryNode("SELECT * FROM tm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ QueryNode vm1g1n1 = new QueryNode("SELECT * FROM tm1.g1"); //$NON-NLS-1$
//selects from temp group
- FakeMetadataObject vm1g1 =
- FakeMetadataFactory.createVirtualGroup("vm1.g1", vm1, vm1g1n1); //$NON-NLS-1$
+ Table vm1g1 = RealMetadataFactory.createVirtualGroup("g1", vm1, vm1g1n1); //$NON-NLS-1$
QueryNode vm1g2n1 =
- new QueryNode("SELECT * FROM pm1.g2 where pm1.g2.e1=?"); //$NON-NLS-1$ //$NON-NLS-2$
+ new QueryNode("SELECT * FROM pm1.g2 where pm1.g2.e1=?"); //$NON-NLS-1$
vm1g2n1.addBinding("vm1.g1.e1"); //$NON-NLS-1$
- FakeMetadataObject vm1g2 =
- FakeMetadataFactory.createVirtualGroup("vm1.g2", vm1, vm1g2n1); //$NON-NLS-1$
+ Table vm1g2 = RealMetadataFactory.createVirtualGroup("g2", vm1, vm1g2n1); //$NON-NLS-1$
QueryNode vm1g3n1 =
- new QueryNode("SELECT * FROM pm1.g3 where pm1.g3.e1=?"); //$NON-NLS-1$ //$NON-NLS-2$
+ new QueryNode("SELECT * FROM pm1.g3 where pm1.g3.e1=?"); //$NON-NLS-1$
vm1g3n1.addBinding("vm1.g2.e1"); //$NON-NLS-1$
- FakeMetadataObject vm1g3 =
- FakeMetadataFactory.createVirtualGroup("vm1.g3", vm1, vm1g3n1); //$NON-NLS-1$
+ Table vm1g3 = RealMetadataFactory.createVirtualGroup("g3", vm1, vm1g3n1); //$NON-NLS-1$
- QueryNode vm1g4n1 = new QueryNode("SELECT * FROM pm1.g4"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g4 =
- FakeMetadataFactory.createVirtualGroup("vm1.g4", vm1, vm1g4n1); //$NON-NLS-1$
+ QueryNode vm1g4n1 = new QueryNode("SELECT * FROM pm1.g4"); //$NON-NLS-1$
+ Table vm1g4 = RealMetadataFactory.createVirtualGroup("g4", vm1, vm1g4n1); //$NON-NLS-1$
QueryNode vm1g5n1 =
new QueryNode(
"SELECT * FROM pm1.g5 where pm1.g5.e1=? AND pm1.g5.e2=?"); //$NON-NLS-1$
vm1g5n1.addBinding("vm1.g4.e1"); //$NON-NLS-1$
vm1g5n1.addBinding("vm1.g1.e1"); //$NON-NLS-1$
- FakeMetadataObject vm1g5 =
- FakeMetadataFactory.createVirtualGroup("vm1.g5", vm1, vm1g5n1); //$NON-NLS-1$
+ Table vm1g5 = RealMetadataFactory.createVirtualGroup("g5", vm1, vm1g5n1); //$NON-NLS-1$
QueryNode tempGroup1 =
- new QueryNode("SELECT * FROM pm1.g1 where e2 < '5'"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject tm1g1 =
- FakeMetadataFactory.createVirtualGroup("tm1.g1", vm1, tempGroup1); //$NON-NLS-1$
+ new QueryNode("SELECT * FROM pm1.g1 where e2 < '5'"); //$NON-NLS-1$
+ Table tm1g1 = RealMetadataFactory.createVirtualGroup("tm1.g1", vm1, tempGroup1); //$NON-NLS-1$
// Create virtual elements
- List vm1g1e =
- FakeMetadataFactory.createElements(
+ RealMetadataFactory.createElements(
vm1g1,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] {
@@ -202,8 +176,7 @@
DataTypeManager.DefaultDataTypes.INTEGER,
DataTypeManager.DefaultDataTypes.BOOLEAN,
DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g2e =
- FakeMetadataFactory.createElements(
+ RealMetadataFactory.createElements(
vm1g2,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] {
@@ -211,8 +184,7 @@
DataTypeManager.DefaultDataTypes.INTEGER,
DataTypeManager.DefaultDataTypes.BOOLEAN,
DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g3e =
- FakeMetadataFactory.createElements(
+ RealMetadataFactory.createElements(
vm1g3,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] {
@@ -220,8 +192,7 @@
DataTypeManager.DefaultDataTypes.INTEGER,
DataTypeManager.DefaultDataTypes.BOOLEAN,
DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g4e =
- FakeMetadataFactory.createElements(
+ RealMetadataFactory.createElements(
vm1g4,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] {
@@ -229,8 +200,7 @@
DataTypeManager.DefaultDataTypes.INTEGER,
DataTypeManager.DefaultDataTypes.BOOLEAN,
DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g5e =
- FakeMetadataFactory.createElements(
+ RealMetadataFactory.createElements(
vm1g5,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] {
@@ -238,8 +208,7 @@
DataTypeManager.DefaultDataTypes.INTEGER,
DataTypeManager.DefaultDataTypes.BOOLEAN,
DataTypeManager.DefaultDataTypes.DOUBLE });
- List tm1g1e =
- FakeMetadataFactory.createElements(
+ RealMetadataFactory.createElements(
tm1g1,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] {
@@ -250,10 +219,8 @@
// Create virtual documents
// DOC 1
- FakeMetadataObject doc1 =
- FakeMetadataFactory.createVirtualGroup("vm1.doc1", vm1, doc1()); //$NON-NLS-1$
- List docE1 =
- FakeMetadataFactory.createElements(
+ Table doc1 = RealMetadataFactory.createXmlDocument("doc1", vm1, doc1()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(
doc1,
new String[] {
"a0", //$NON-NLS-1$
@@ -269,19 +236,15 @@
DataTypeManager.DefaultDataTypes.STRING });
// DOC 2
- FakeMetadataObject doc2 =
- FakeMetadataFactory.createVirtualGroup("vm1.doc2", vm1, doc2()); //$NON-NLS-1$
- List docE2 =
- FakeMetadataFactory.createElements(
+ Table doc2 = RealMetadataFactory.createXmlDocument("doc2", vm1, doc2()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(
doc2,
new String[] { "a1" }, //$NON-NLS-1$
new String[] { DataTypeManager.DefaultDataTypes.STRING });
// DOC 3
- FakeMetadataObject doc3 =
- FakeMetadataFactory.createVirtualGroup("vm1.doc3", vm1, doc3()); //$NON-NLS-1$
- List docE3 =
- FakeMetadataFactory.createElements(
+ Table doc3 = RealMetadataFactory.createXmlDocument("doc3", vm1, doc3()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(
doc3,
new String[] {
"root", //$NON-NLS-1$
@@ -297,10 +260,8 @@
DataTypeManager.DefaultDataTypes.STRING });
// DOC 4
- FakeMetadataObject doc4 =
- FakeMetadataFactory.createVirtualGroup("vm1.doc4", vm1, doc4()); //$NON-NLS-1$
- List docE4 =
- FakeMetadataFactory.createElements(
+ Table doc4 = RealMetadataFactory.createXmlDocument("doc4", vm1, doc4()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(
doc4,
new String[] {
"root", //$NON-NLS-1$
@@ -322,10 +283,8 @@
DataTypeManager.DefaultDataTypes.STRING });
// DOC 5
- FakeMetadataObject doc5 =
- FakeMetadataFactory.createVirtualGroup("vm1.doc5", vm1, doc5()); //$NON-NLS-1$
- List docE5 =
- FakeMetadataFactory.createElements(
+ Table doc5 = RealMetadataFactory.createXmlDocument("doc5", vm1, doc5()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(
doc5,
new String[] {
"root", //$NON-NLS-1$
@@ -353,22 +312,18 @@
DataTypeManager.DefaultDataTypes.STRING });
// DOC 6
- FakeMetadataObject doc6 =
- FakeMetadataFactory.createVirtualGroup("vm1.doc6", vm1, doc6()); //$NON-NLS-1$
- List docE6 =
- FakeMetadataFactory.createElements(
+ Table doc6 = RealMetadataFactory.createXmlDocument("doc6", vm1, doc6()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(
doc6,
new String[] { "tempGroupTest" }, //$NON-NLS-1$
new String[] { DataTypeManager.DefaultDataTypes.STRING });
// DOC with excluded fragment
- FakeMetadataObject docWithExcluded =
- FakeMetadataFactory.createVirtualGroup(
+ Table docWithExcluded = RealMetadataFactory.createXmlDocument(
"vm1.docWithExcluded", //$NON-NLS-1$
vm1,
docWithExcluded());
- List docWithExcludedElements =
- FakeMetadataFactory.createElements(
+ RealMetadataFactory.createElements(
docWithExcluded,
new String[] {
"root", //$NON-NLS-1$
@@ -384,13 +339,11 @@
DataTypeManager.DefaultDataTypes.STRING });
// DOC 2 with excluded fragment
- FakeMetadataObject doc2WithExcluded =
- FakeMetadataFactory.createVirtualGroup(
+ Table doc2WithExcluded = RealMetadataFactory.createXmlDocument(
"vm1.docWithExcluded2", //$NON-NLS-1$
vm1,
docWithExcluded2());
- List doc2WithExcludedElements =
- FakeMetadataFactory.createElements(
+ RealMetadataFactory.createElements(
doc2WithExcluded,
new String[] {
"root", //$NON-NLS-1$
@@ -407,18 +360,15 @@
// DOC with attribute
- FakeMetadataObject docWithAttribute =
- FakeMetadataFactory.createVirtualGroup(
+ Table docWithAttribute = RealMetadataFactory.createXmlDocument(
"vm1.docWithAttribute", //$NON-NLS-1$
vm1,
docTestConvertCriteriaWithAttribute());
- FakeMetadataObject docWithAttribute3 =
- FakeMetadataFactory.createVirtualGroup(
+ Table docWithAttribute3 = RealMetadataFactory.createXmlDocument(
"vm1.docWithAttribute3", //$NON-NLS-1$
vm1,
docTestCriteriaWithAttribute());
- List docWithAttributeElements =
- FakeMetadataFactory.createElements(
+ RealMetadataFactory.createElements(
docWithAttribute,
new String[] {
"root", //$NON-NLS-1$
@@ -429,13 +379,11 @@
DataTypeManager.DefaultDataTypes.STRING,
DataTypeManager.DefaultDataTypes.STRING });
// DOC with attribute2
- FakeMetadataObject docWithAttribute2 =
- FakeMetadataFactory.createVirtualGroup(
+ Table docWithAttribute2 = RealMetadataFactory.createXmlDocument(
"vm1.docWithAttribute2", //$NON-NLS-1$
vm1,
docTestConvertCriteriaWithAttribute2());
- List docWithAttributeElements2 =
- FakeMetadataFactory.createElements(
+ RealMetadataFactory.createElements(
docWithAttribute2,
new String[] {
"root", //$NON-NLS-1$
@@ -446,8 +394,7 @@
DataTypeManager.DefaultDataTypes.STRING,
DataTypeManager.DefaultDataTypes.STRING });
- List docWithAttributeElements3 =
- FakeMetadataFactory.createElements(
+ RealMetadataFactory.createElements(
docWithAttribute3,
new String[] {
"root", //$NON-NLS-1$
@@ -458,58 +405,8 @@
DataTypeManager.DefaultDataTypes.STRING,
DataTypeManager.DefaultDataTypes.STRING });
- // Add all objects to the store
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(pm1);
- store.addObject(pm1g1);
- store.addObjects(pm1g1e);
- store.addObject(pm1g2);
- store.addObjects(pm1g2e);
- store.addObject(pm1g3);
- store.addObjects(pm1g3e);
- store.addObject(pm1g4);
- store.addObjects(pm1g4e);
- store.addObject(pm1g5);
- store.addObjects(pm1g5e);
-
- store.addObject(vm1);
- store.addObject(vm1g1);
- store.addObjects(vm1g1e);
- store.addObject(vm1g2);
- store.addObjects(vm1g2e);
- store.addObject(vm1g3);
- store.addObjects(vm1g3e);
- store.addObject(vm1g4);
- store.addObjects(vm1g4e);
- store.addObject(vm1g5);
- store.addObjects(vm1g5e);
- store.addObject(tm1g1);
- store.addObjects(tm1g1e);
- store.addObject(doc1);
- store.addObject(doc2);
- store.addObject(doc3);
- store.addObject(doc4);
- store.addObject(doc5);
- store.addObject(doc6);
- store.addObject(docWithExcluded);
- store.addObject(doc2WithExcluded);
- store.addObject(docWithAttribute);
- store.addObject(docWithAttribute2);
- store.addObject(docWithAttribute3);
- store.addObjects(docE1);
- store.addObjects(docE2);
- store.addObjects(docE3);
- store.addObjects(docE4);
- store.addObjects(docE5);
- store.addObjects(docE6);
- store.addObjects(docWithExcludedElements);
- store.addObjects(doc2WithExcludedElements);
- store.addObjects(docWithAttributeElements);
- store.addObjects(docWithAttributeElements2);
- store.addObjects(docWithAttributeElements3);
-
// Create the facade from the store
- return new FakeMetadataFacade(store);
+ return RealMetadataFactory.createTransformationMetadata(metadataStore, "example1");
}
private static MappingDocument doc1() {
@@ -709,7 +606,7 @@
}
- public void test1() throws Exception {
+ @Test public void test1() throws Exception {
helpPlan("SELECT * FROM vm1.doc1", example1()); //$NON-NLS-1$
}
@@ -718,7 +615,7 @@
* (a node that is not mapped to data)
* (Also duplicate defect 8130)
*/
- public void test1_defect7341() throws Exception {
+ @Test public void test1_defect7341() throws Exception {
helpPlanException("SELECT * FROM vm1.doc1 WHERE a0 = '3'", example1()); //$NON-NLS-1$
}
@@ -727,17 +624,17 @@
* (a node that is not mapped to data)
* (Also duplicate defect 8130)
*/
- public void test1_defect7341_a() throws Exception {
+ @Test public void test1_defect7341_a() throws Exception {
helpPlanException(
"SELECT * FROM vm1.doc3 WHERE context(m1, m1) = '3'", //$NON-NLS-1$
example1());
}
- public void test2() throws Exception {
+ @Test public void test2() throws Exception {
helpPlan("SELECT * FROM vm1.doc2", example1()); //$NON-NLS-1$
}
- public void test3() throws Exception {
+ @Test public void test3() throws Exception {
helpPlan("SELECT * FROM vm1.doc1 where a0.a1.a1='x'", example1()); //$NON-NLS-1$
}
@@ -746,11 +643,11 @@
* be executed before the temp group tm1.g1 is, since it selects from that
* group but is not in it's scope
*/
- public void test4() throws Exception {
+ @Test public void test4() throws Exception {
helpPlan("SELECT * FROM vm1.doc3", example1()); //$NON-NLS-1$
}
- public void testTempGroupPlan() throws Exception {
+ @Test public void testTempGroupPlan() throws Exception {
QueryMetadataInterface qmi = example1();
XMLPlan plan = helpPlan("SELECT * FROM vm1.doc6", qmi); //$NON-NLS-1$
@@ -767,13 +664,13 @@
assertTrue(program.getInstructionAt(i++) instanceof ExecStagingTableInstruction);
}
- public void testPreparePlan() throws Exception {
+ @Test public void testPreparePlan() throws Exception {
helpPlan(
"SELECT * FROM vm1.doc1 ORDER BY vm1.doc1.a0.a1.c1", //$NON-NLS-1$
example1());
}
- public void testPreparePlan2() throws Exception {
+ @Test public void testPreparePlan2() throws Exception {
helpPlan(
"SELECT root.@myAttribute FROM vm1.docWithAttribute", //$NON-NLS-1$
example1());
@@ -806,7 +703,7 @@
}
}
- public void testDefect18227() throws Exception {
+ @Test public void testDefect18227() throws Exception {
QueryMetadataInterface metadata = example1();
String sql = "select * from vm1.docWithAttribute3 where root.@type = '3'"; //$NON-NLS-1$
@@ -820,7 +717,7 @@
}
}
- public void testDefect21983() throws Exception {
+ @Test public void testDefect21983() throws Exception {
QueryMetadataInterface metadata = example1();
String sql = "select root.@type from vm1.docWithAttribute3"; //$NON-NLS-1$
@@ -835,7 +732,7 @@
* name is returned by XMLPlanner
* @throws Exception
*/
- public void testRootStagingTableCase4308() throws Exception{
+ @Test public void testRootStagingTableCase4308() throws Exception{
String sql = "select * from vm1.doc1 where stagingTable2.e1 IN ('a', 'b', 'c')"; //$NON-NLS-1$
@@ -844,26 +741,25 @@
Query query = (Query)new QueryParser().parseCommand(sql);
QueryResolver.resolveCommand(query, metadata);
- String expectedStagingTableResultSet = "tm1.stagingTable2"; //$NON-NLS-1$
+ String expectedStagingTableResultSet = "vm1.doc1.stagingTable2"; //$NON-NLS-1$
String actualStagingTableResultSet = CriteriaPlanner.getStagingTableForConjunct(query.getCriteria(), metadata);
assertEquals(expectedStagingTableResultSet, actualStagingTableResultSet);
}
- private FakeMetadataFacade exampleCase4308(){
+ private TransformationMetadata exampleCase4308(){
+ MetadataStore metadataStore = new MetadataStore();
// Create models
- FakeMetadataObject pm1 = FakeMetadataFactory.createPhysicalModel("pm1"); //$NON-NLS-1$
- FakeMetadataObject vm1 = FakeMetadataFactory.createVirtualModel("vm1"); //$NON-NLS-1$
+ Schema pm1 = RealMetadataFactory.createPhysicalModel("pm1", metadataStore); //$NON-NLS-1$
+ Schema vm1 = RealMetadataFactory.createVirtualModel("vm1", metadataStore); //$NON-NLS-1$
// Create physical groups
- FakeMetadataObject pm1g1 =
- FakeMetadataFactory.createPhysicalGroup("pm1.g1", pm1); //$NON-NLS-1$
+ Table pm1g1 = RealMetadataFactory.createPhysicalGroup("g1", pm1); //$NON-NLS-1$
// Create physical elements
- List pm1g1e =
- FakeMetadataFactory.createElements(
+ RealMetadataFactory.createElements(
pm1g1,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] {
@@ -874,13 +770,10 @@
QueryNode stagingTableNode =
- new QueryNode("SELECT * FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject stagingTable =
- FakeMetadataFactory.createVirtualGroup("tm1.stagingTable2", vm1, stagingTableNode); //$NON-NLS-1$
+ new QueryNode("SELECT * FROM pm1.g1"); //$NON-NLS-1$
+ Table stagingTable = RealMetadataFactory.createXmlStagingTable("doc1.stagingTable2", vm1, stagingTableNode); //$NON-NLS-1$
-
- List stagingTableElements =
- FakeMetadataFactory.createElements(
+ RealMetadataFactory.createElements(
stagingTable,
new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] {
@@ -893,30 +786,16 @@
MappingElement root = doc.addChildElement(new MappingElement("root")); //$NON-NLS-1$
- List stagingTables = new ArrayList(1);
- stagingTables.add("tm1.stagingTable2"); //$NON-NLS-1$
- root.setStagingTables(stagingTables);
+ root.addStagingTable("vm1.doc1.stagingTable2");
-
// Create virtual documents
// DOC 1
- FakeMetadataObject doc1 =
- FakeMetadataFactory.createVirtualGroup(
- "vm1.doc1", //$NON-NLS-1$
+ RealMetadataFactory.createXmlDocument(
+ "doc1", //$NON-NLS-1$
vm1,
doc);
- // Add all objects to the store
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(pm1);
- store.addObject(pm1g1);
- store.addObjects(pm1g1e);
- store.addObject(stagingTable);
- store.addObjects(stagingTableElements);
- store.addObject(doc1);
-
- // Create the facade from the store
- return new FakeMetadataFacade(store);
+ return RealMetadataFactory.createTransformationMetadata(metadataStore, "case4308");
}
private static final boolean DEBUG = false;
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -49,6 +49,7 @@
import org.teiid.query.sql.lang.ProcedureContainer;
import org.teiid.query.sql.lang.Query;
import org.teiid.query.sql.lang.SetQuery;
+import org.teiid.query.sql.lang.StoredProcedure;
import org.teiid.query.sql.lang.TranslatableProcedureContainer;
import org.teiid.query.sql.lang.Update;
import org.teiid.query.sql.symbol.AliasSymbol;
@@ -61,7 +62,9 @@
public class FakeDataManager implements ProcessorDataManager {
- private Map tuples = new HashMap();
+ private Map<String, Object[]> tuples = new HashMap<String, Object[]>();
+ private Map<String, List<List<?>>[]> procTuples = new HashMap<String, List<List<?>>[]>();
+
private static final String LOG_CONTEXT = "FAKE_DATA_MANAGER"; //$NON-NLS-1$
//used to test blocked exception. If true,
@@ -72,13 +75,13 @@
// ---- Cached code table stuff ----
// upper table name + upper key col name + upper ret col name -> map of values
- private Map codeTableValues = new HashMap();
+ private Map<String, Map> codeTableValues = new HashMap<String, Map>();
// throw Blocked on first request
private boolean throwBlocked = false;
// upper table name + upper key col name + upper ret col name -> flag of whether this table has blocked yet
- private Map blockedState = new HashMap();
+ private Map<String, Boolean> blockedState = new HashMap<String, Boolean>();
// Track history to verify it later
private List<String> queries = new ArrayList<String>();
@@ -101,11 +104,11 @@
this.queries.clear();
return rc;
}
+
+ public void registerProcTuples(String proc, List[] data) {
+ procTuples.put(proc, data);
+ }
- public void registerTuples(Object groupID, List elements, List[] data) {
- tuples.put(groupID, new Object[] { elements, data });
- }
-
public TupleSource registerRequest(CommandContext context, Command command, String modelName, String connectorBindingId, int nodeID, int limit)
throws TeiidComponentException {
@@ -127,6 +130,17 @@
}else if(command instanceof SetQuery) {
SetQuery union = (SetQuery) command;
group = getQueryGroup(union.getProjectedQuery());
+ } else if (command instanceof StoredProcedure) {
+ Object id = ((StoredProcedure) command).getProcedureID();
+ List<List<?>>[] data = procTuples.get(id);
+ if (data == null) {
+ throw new AssertionError("Undefined results for " + command); //$NON-NLS-1$
+ }
+ FakeTupleSource ts= new FakeTupleSource(command.getProjectedSymbols(), data);
+ if(this.blockOnce){
+ ts.setBlockOnce();
+ }
+ return ts;
} else if (command instanceof ProcedureContainer) {
group = ((ProcedureContainer) command).getGroup();
} else if ( command instanceof BatchedUpdateCommand ) {
@@ -141,13 +155,11 @@
}
}
- Object groupID = group.getMetadataID();
-
- Object[] tupleInfo = (Object[]) tuples.get(groupID);
- List elements = (List) tupleInfo[0];
+ Object[] tupleInfo = tuples.get(group.getNonCorrelationName().toUpperCase());
+ List<SingleElementSymbol> elements = (List) tupleInfo[0];
List[] tuples = (List[]) tupleInfo[1];
- List projectedSymbols = command.getProjectedSymbols();
+ List<SingleElementSymbol> projectedSymbols = command.getProjectedSymbols();
int[] columnMap = getColumnMap(elements, projectedSymbols);
/*
@@ -164,12 +176,12 @@
// Build lookupMap from BOTH all the elements and the projected symbols - both may be needed here
Map lookupMap = new HashMap();
for(int i=0; i<elements.size(); i++) {
- Object element = elements.get(i);
- mapElementToIndex(lookupMap, element, new Integer(i), group);
+ SingleElementSymbol element = elements.get(i);
+ mapElementToIndex(lookupMap, element, i, group);
}
for(int i=0; i<projectedSymbols.size(); i++) {
- Object element = projectedSymbols.get(i);
- mapElementToIndex(lookupMap, element, new Integer(columnMap[i]), group);
+ SingleElementSymbol element = projectedSymbols.get(i);
+ mapElementToIndex(lookupMap, element, columnMap[i], group);
}
List filteredTuples = new ArrayList();
@@ -205,11 +217,11 @@
// Build lookupMap from BOTH all the elements and the projected symbols - both may be needed here
Map<Object, Integer> lookupMap = new HashMap<Object, Integer>();
for(int i=0; i<elements.size(); i++) {
- Object element = elements.get(i);
+ SingleElementSymbol element = elements.get(i);
mapElementToIndex(lookupMap, element, new Integer(i), group);
}
for(int i=0; i<projectedSymbols.size(); i++) {
- Object element = projectedSymbols.get(i);
+ SingleElementSymbol element = projectedSymbols.get(i);
mapElementToIndex(lookupMap, element, new Integer(columnMap[i]), group);
}
@@ -233,7 +245,7 @@
}
tuples = new List[filteredTuples.size()];
filteredTuples.toArray(tuples);
- elements = new ArrayList<Object>(projectedSymbols);
+ elements = new ArrayList<SingleElementSymbol>(projectedSymbols);
columnMap[0] = 0;
}
@@ -277,16 +289,14 @@
* @param integer
* @param group
*/
- private void mapElementToIndex(Map lookupMap, Object element, Integer index, GroupSymbol group) {
+ private void mapElementToIndex(Map lookupMap, SingleElementSymbol element, Integer index, GroupSymbol group) {
+ ElementSymbol elementSymbol = (ElementSymbol)SymbolMap.getExpression(element);
if (group.getDefinition() != null){
String groupAlias = group.getCanonicalName();
- ElementSymbol elementSymbol = (ElementSymbol)SymbolMap.getExpression((SingleElementSymbol)element);
- ElementSymbol aliasedElement = (ElementSymbol)elementSymbol.clone();
- aliasedElement.getGroupSymbol().setName(groupAlias);
- lookupMap.put(aliasedElement, index);
- } else {
- lookupMap.put(element, index);
+ elementSymbol = elementSymbol.clone();
+ elementSymbol.getGroupSymbol().setName(groupAlias);
}
+ lookupMap.put(elementSymbol, index);
}
// columnMap[expectedElementIndex] = allElementIndex
@@ -352,7 +362,7 @@
}
}
- Map values = (Map) codeTableValues.get(tableKey);
+ Map values = codeTableValues.get(tableKey);
return values.get(keyValue);
}
@@ -384,11 +394,11 @@
this.recordingCommands = shouldRecord;
}
- public void registerTuples(QueryMetadataInterface metadata, String groupName, List[] tuples) throws QueryResolverException, TeiidComponentException {
+ public void registerTuples(QueryMetadataInterface metadata, String groupName, List[] data) throws QueryResolverException, TeiidComponentException {
GroupSymbol group = new GroupSymbol(groupName);
ResolverUtil.resolveGroup(group, metadata);
List<ElementSymbol> elementSymbols = ResolverUtil.resolveElementsInGroup(group, metadata);
- this.registerTuples(group.getMetadataID(), elementSymbols, tuples);
+ tuples.put(group.getName().toUpperCase(), new Object[] { elementSymbols, data });
}
@Override
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/FakeDataStore.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/FakeDataStore.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/FakeDataStore.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -22,92 +22,34 @@
package org.teiid.query.processor;
-import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Iterator;
import java.util.List;
-import org.teiid.api.exception.query.QueryMetadataException;
-import org.teiid.client.metadata.ParameterInfo;
-import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidException;
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.metadata.StoredProcedureInfo;
-import org.teiid.query.metadata.TempMetadataStore;
-import org.teiid.query.sql.lang.SPParameter;
-import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
+import org.teiid.query.metadata.TransformationMetadata;
+import org.teiid.query.unittest.RealMetadataFactory;
-
-
/**
* This is sample data go along with FakeMetaDataFactory and FakeDataManager
*/
@SuppressWarnings("nls")
public class FakeDataStore {
- // Helper to create a list of elements - used in creating sample data
- public static List createElements(List elementIDs) {
- List elements = new ArrayList();
- for(int i=0; i<elementIDs.size(); i++) {
- FakeMetadataObject elementID = (FakeMetadataObject) elementIDs.get(i);
- ElementSymbol element = new ElementSymbol(elementID.getName());
- elements.add(element);
- }
-
- return elements;
- }
-
- public static List createElements(List elementIDs, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException {
- List elements = new ArrayList();
- for(int i=0; i<elementIDs.size(); i++) {
- Object elementID = elementIDs.get(i);
- ElementSymbol element = new ElementSymbol(metadata.getFullName(elementID));
- elements.add(element);
- }
-
- return elements;
- }
-
- private static List getProcResultSetSymbols(List params){
- List result = new ArrayList();
- Iterator iter = params.iterator();
- while(iter.hasNext()){
- SPParameter param = (SPParameter)iter.next();
- if(param.getResultSetColumns() != null){
- result.addAll(param.getResultSetColumns());
- }
- }
- iter = params.iterator();
- while(iter.hasNext()){
- SPParameter param = (SPParameter)iter.next();
- if(param.getParameterType() == ParameterInfo.INOUT || param.getParameterType() == ParameterInfo.RETURN_VALUE) {
- result.add(param.getParameterSymbol());
- }
- }
- return result;
- }
-
- public static void sampleData1(FakeDataManager dataMgr, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException {
+ public static void sampleData1(FakeDataManager dataMgr, QueryMetadataInterface metadata) throws TeiidException {
addTable("pm1.g1", dataMgr, metadata);
addTable("pm1.g2", dataMgr, metadata);
addTable("pm1.g3", dataMgr, metadata);
addTable("pm2.g1", dataMgr, metadata);
addTable("pm2.g2", dataMgr, metadata);
addTable("pm2.g3", dataMgr, metadata);
- addTable("tm1.g1", dataMgr, metadata);
+ //addTable("tm1.g1", dataMgr, metadata);
//stored procedure pm1.sp1
- TempMetadataStore tempStore = new TempMetadataStore();
StoredProcedureInfo procInfo = metadata.getStoredProcedureInfoForProcedure("pm1.sp1"); //$NON-NLS-1$
- List elementSymbols = getProcResultSetSymbols(procInfo.getParameters());
- tempStore.addTempGroup("pm1.sp1", elementSymbols); //$NON-NLS-1$
- Object procID = tempStore.getTempGroupID("pm1.sp1"); //$NON-NLS-1$
- dataMgr.registerTuples(
- procID,
- elementSymbols,
-
+ dataMgr.registerProcTuples(
+ procInfo.getProcedureCallableName().toUpperCase(),
new List[] {
Arrays.asList(new Object[] { "a", new Integer(0) }), //$NON-NLS-1$
Arrays.asList(new Object[] { null, new Integer(1)}),
@@ -119,38 +61,23 @@
}
public static void addTable(String name, FakeDataManager dataMgr,
- QueryMetadataInterface metadata) throws TeiidComponentException,
- QueryMetadataException {
- Object groupID = metadata.getGroupID(name);
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs, metadata);
-
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
+ QueryMetadataInterface metadata) throws TeiidException {
+ List[] tuples = new List[] {
Arrays.asList(new Object[] { "a", new Integer(0), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
Arrays.asList(new Object[] { null, new Integer(1), Boolean.FALSE, new Double(1.0) }),
Arrays.asList(new Object[] { "a", new Integer(3), Boolean.TRUE, new Double(7.0) }), //$NON-NLS-1$
Arrays.asList(new Object[] { "c", new Integer(1), Boolean.TRUE, null }), //$NON-NLS-1$
Arrays.asList(new Object[] { "b", new Integer(2), Boolean.FALSE, new Double(0.0) }), //$NON-NLS-1$
Arrays.asList(new Object[] { "a", new Integer(0), Boolean.FALSE, new Double(2.0) }) //$NON-NLS-1$
- } );
+ };
+
+ dataMgr.registerTuples(metadata, name, tuples);
}
- public static void sampleData2(FakeDataManager dataMgr) throws QueryMetadataException, TeiidComponentException {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ public static void sampleData2(FakeDataManager dataMgr) throws TeiidException {
+ TransformationMetadata metadata = RealMetadataFactory.example1Cached();
- // Group pm1.g1
- FakeMetadataObject groupID = (FakeMetadataObject) metadata
- .getGroupID("pm1.g1"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs, metadata);
-
- dataMgr.registerTuples(groupID, elementSymbols,
-
- new List[] {
+ dataMgr.registerTuples(metadata, "pm1.g1", new List[] {
Arrays.asList(new Object[] {
"a", new Integer(0), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
Arrays.asList(new Object[] {
@@ -160,13 +87,7 @@
});
// Group pm1.g2
- groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g2"); //$NON-NLS-1$
- elementIDs = metadata.getElementIDsInGroupID(groupID);
- elementSymbols = createElements(elementIDs, metadata);
-
- dataMgr.registerTuples(groupID, elementSymbols,
-
- new List[] {
+ dataMgr.registerTuples(metadata, "pm1.g2", new List[] {
Arrays.asList(new Object[] {
"a", new Integer(1), Boolean.TRUE, new Double(2.0) }), //$NON-NLS-1$
Arrays.asList(new Object[] {
@@ -180,13 +101,7 @@
});
// Group pm2.g1
- groupID = (FakeMetadataObject) metadata.getGroupID("pm2.g1"); //$NON-NLS-1$
- elementIDs = metadata.getElementIDsInGroupID(groupID);
- elementSymbols = createElements(elementIDs, metadata);
-
- dataMgr.registerTuples(groupID, elementSymbols,
-
- new List[] {
+ dataMgr.registerTuples(metadata, "pm2.g1", new List[] {
Arrays.asList(new Object[] {
"b", new Integer(0), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
Arrays.asList(new Object[] {
@@ -196,13 +111,7 @@
});
// Group pm2.g2
- groupID = (FakeMetadataObject) metadata.getGroupID("pm2.g2"); //$NON-NLS-1$
- elementIDs = metadata.getElementIDsInGroupID(groupID);
- elementSymbols = createElements(elementIDs, metadata);
-
- dataMgr.registerTuples(groupID, elementSymbols,
-
- new List[] {
+ dataMgr.registerTuples(metadata, "pm2.g2", new List[] {
Arrays.asList(new Object[] {
"a", new Integer(1), Boolean.TRUE, new Double(2.0) }), //$NON-NLS-1$
Arrays.asList(new Object[] {
@@ -216,13 +125,7 @@
});
// Group pm1.table1
- groupID = (FakeMetadataObject) metadata.getGroupID("pm1.table1"); //$NON-NLS-1$
- elementIDs = metadata.getElementIDsInGroupID(groupID);
- elementSymbols = createElements(elementIDs, metadata);
-
- dataMgr.registerTuples(groupID, elementSymbols,
-
- new List[] {
+ dataMgr.registerTuples(metadata, "pm1.table1", new List[] {
Arrays.asList(new Object[] {
"a", new Integer(0), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
Arrays.asList(new Object[] {
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -37,14 +37,14 @@
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
import org.teiid.query.sql.lang.Command;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.translator.SourceSystemFunctions;
@SuppressWarnings("nls")
public class TestAggregateProcessing {
static void sampleDataBQT3(FakeDataManager dataMgr) throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
// Group bqt1.smalla
@@ -74,7 +74,7 @@
}
private void sampleDataBQT_defect9842(FakeDataManager dataMgr) throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
List[] tuples = new List[5];
for (int i = 0; i < tuples.length; i++) {
@@ -123,7 +123,7 @@
sampleDataBQT3(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory
.exampleBQTCached());
// Run query
@@ -162,7 +162,7 @@
sampleDataBQT3(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory
.exampleBQTCached());
// Run query
@@ -187,7 +187,7 @@
sampleDataBQT_defect9842(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory
.exampleBQTCached());
// Run query
@@ -213,7 +213,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -243,7 +243,7 @@
Arrays.asList(null, Integer.valueOf(5)),
});
- ProcessorPlan plan = helpGetPlan(command, FakeMetadataFactory.example1Cached(), capFinder);
+ ProcessorPlan plan = helpGetPlan(command, RealMetadataFactory.example1Cached(), capFinder);
List[] expected = new List[] {
Arrays.asList(null, Integer.valueOf(1), Integer.valueOf(5)),
@@ -274,7 +274,7 @@
Arrays.asList("1", Integer.valueOf(1), Integer.valueOf(4), Boolean.FALSE), //$NON-NLS-1$
});
- ProcessorPlan plan = helpGetPlan(command, FakeMetadataFactory.example1Cached(), capFinder);
+ ProcessorPlan plan = helpGetPlan(command, RealMetadataFactory.example1Cached(), capFinder);
List[] expected = new List[] {
Arrays.asList(Integer.valueOf(7), Boolean.TRUE),
@@ -292,7 +292,7 @@
capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
capFinder.addCapabilities("pm1", TestOptimizer.getTypicalCapabilities()); //$NON-NLS-1$
- ProcessorPlan plan = helpGetPlan(helpParse("select max(e2), count(*), stddev_pop(e2), var_samp(e2) from (select e1, e2 from pm1.g1 union all select e1, e2 from pm2.g2) z"), FakeMetadataFactory.example1Cached(), capFinder); //$NON-NLS-1$
+ ProcessorPlan plan = helpGetPlan(helpParse("select max(e2), count(*), stddev_pop(e2), var_samp(e2) from (select e1, e2 from pm1.g1 union all select e1, e2 from pm2.g2) z"), RealMetadataFactory.example1Cached(), capFinder); //$NON-NLS-1$
HardcodedDataManager dataManager = new HardcodedDataManager();
dataManager.addData("SELECT g_0.e2 FROM pm1.g1 AS g_0", new List[] {Arrays.asList(1), Arrays.asList(2)});
@@ -315,7 +315,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached());
helpProcess(plan, dataManager, expected);
}
@@ -330,7 +330,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached());
helpProcess(plan, dataManager, expected);
}
@@ -345,7 +345,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached());
helpProcess(plan, dataManager, expected);
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -31,6 +31,7 @@
import org.junit.Test;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.optimizer.TestOptimizer;
import org.teiid.query.optimizer.TestOptimizer.ComparisonMode;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
@@ -40,9 +41,7 @@
import org.teiid.query.processor.relational.RelationalNode;
import org.teiid.query.processor.relational.RelationalPlan;
import org.teiid.query.sql.lang.Command;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
@SuppressWarnings({"unchecked", "nls"})
@@ -62,7 +61,7 @@
// Plan query
ProcessorPlan plan = TestProcessor.helpGetPlan(TestProcessor.helpParse(sql),
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
capFinder);
return plan;
}
@@ -88,7 +87,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -141,7 +140,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -168,7 +167,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -195,7 +194,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -221,7 +220,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -246,7 +245,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -273,7 +272,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -300,7 +299,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -370,7 +369,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -395,7 +394,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -419,10 +418,6 @@
Arrays.asList(new Object[] { "cc ", "cc ", new Integer(2)}) //$NON-NLS-1$ //$NON-NLS-2$
};
- // Construct data manager with data
- FakeDataManager dataManager = new FakeDataManager();
- TestProcessor.sampleData2b(dataManager);
-
// Plan query
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities depcaps = new BasicSourceCapabilities();
@@ -442,7 +437,7 @@
// Slightly modify metadata to set max set size to just a few rows - this
// will allow us to test the dependent overflow case
- FakeMetadataFacade fakeMetadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface fakeMetadata = RealMetadataFactory.example1Cached();
Command command = TestProcessor.helpParse(sql);
ProcessorPlan plan = TestProcessor.helpGetPlan(command, fakeMetadata, capFinder);
@@ -454,6 +449,10 @@
RelationalNode join = project.getChildren()[0];
assertTrue("Expected instance of JoinNode (for dep join) but got " + join.getClass(), join instanceof JoinNode); //$NON-NLS-1$
+ // Construct data manager with data
+ FakeDataManager dataManager = new FakeDataManager();
+ TestProcessor.sampleData2b(dataManager, fakeMetadata);
+
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -467,7 +466,7 @@
String sql = "select a.intkey from bqt1.smalla a, bqt1.smallb b where concat(a.stringkey, 't') = b.stringkey option makedep a"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), null, capFinder, new String[] {"SELECT a.stringkey, a.intkey FROM bqt1.smalla AS a", "SELECT b.stringkey FROM bqt1.smallb AS b"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder, new String[] {"SELECT a.stringkey, a.intkey FROM bqt1.smalla AS a", "SELECT b.stringkey FROM bqt1.smallb AS b"}, TestOptimizer.SHOULD_SUCCEED); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
@@ -527,7 +526,7 @@
String sql = "select a.intkey from bqt1.smalla a, bqt2.smallb b where concat(a.stringkey, 't') = b.stringkey and a.intkey = b.intkey option makedep a"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(), null, capFinder,
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder,
new String[] {"SELECT g_0.stringkey, g_0.intkey FROM bqt1.smalla AS g_0 WHERE g_0.intkey IN (<dependent values>)", "SELECT g_0.stringkey, g_0.intkey FROM bqt2.smallb AS g_0"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -564,37 +563,23 @@
}
static void sampleData4(FakeDataManager dataMgr) throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
- // Group pm1.g1
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g1"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = FakeDataStore.createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
+ metadata,
+ "pm1.g1", new List[] {
+ Arrays.asList(new Object[] { "a", new Integer(0), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "b", new Integer(1), Boolean.TRUE, null }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "c", new Integer(2), Boolean.FALSE, new Double(0.0) }), //$NON-NLS-1$
+ } );
- new List[] {
- Arrays.asList(new Object[] { "a", new Integer(0), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "b", new Integer(1), Boolean.TRUE, null }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "c", new Integer(2), Boolean.FALSE, new Double(0.0) }), //$NON-NLS-1$
- } );
-
- // Group pm6.g1
- groupID = (FakeMetadataObject) metadata.getGroupID("pm6.g1"); //$NON-NLS-1$
- elementIDs = metadata.getElementIDsInGroupID(groupID);
- elementSymbols = FakeDataStore.createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList(new Object[] { "b", new Integer(0) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "d", new Integer(3) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "e", new Integer(1) }), //$NON-NLS-1$
- } );
+ metadata,
+ "pm6.g1", new List[] {
+ Arrays.asList(new Object[] { "b", new Integer(0) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "d", new Integer(3) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "e", new Integer(1) }), //$NON-NLS-1$
+ } );
}
/** SELECT pm1.g1.e1 FROM pm1.g1, pm6.g1 WHERE pm1.g1.e1=pm6.g1.e1 OPTION MAKEDEP pm6.g1 */
@@ -608,7 +593,7 @@
// Slightly modify metadata to set max set size to just a few rows - this
// will allow us to test the dependent overflow case
- FakeMetadataFacade fakeMetadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface fakeMetadata = RealMetadataFactory.example1Cached();
// Plan query
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
@@ -665,7 +650,7 @@
// Slightly modify metadata to set max set size to just a few rows - this
// will allow us to test the dependent overflow case
- FakeMetadataFacade fakeMetadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface fakeMetadata = RealMetadataFactory.example1Cached();
// Plan query
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
@@ -722,10 +707,6 @@
"cc ", "cc ", new Integer(2)}) //$NON-NLS-1$ //$NON-NLS-2$
};
- // Construct data manager with data
- FakeDataManager dataManager = new FakeDataManager();
- TestProcessor.sampleData2b(dataManager);
-
// Plan query
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities depcaps = new BasicSourceCapabilities();
@@ -740,7 +721,7 @@
capFinder.addCapabilities("pm4", depcaps); //$NON-NLS-1$
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade fakeMetadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface fakeMetadata = RealMetadataFactory.example1Cached();
Command command = TestProcessor.helpParse(sql);
ProcessorPlan plan = TestProcessor.helpGetPlan(command, fakeMetadata, capFinder);
@@ -752,6 +733,10 @@
RelationalNode join = project.getChildren()[0];
assertTrue("Expected instance of JoinNode (for dep join) but got " + join.getClass(), join instanceof JoinNode); //$NON-NLS-1$
+ // Construct data manager with data
+ FakeDataManager dataManager = new FakeDataManager();
+ TestProcessor.sampleData2b(dataManager, fakeMetadata);
+
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -770,7 +755,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -806,7 +791,7 @@
capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
Command command = TestProcessor.helpParse(sql);
- ProcessorPlan plan = TestProcessor.helpGetPlan(command, FakeMetadataFactory.example1Cached(), capFinder);
+ ProcessorPlan plan = TestProcessor.helpGetPlan(command, RealMetadataFactory.example1Cached(), capFinder);
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -820,10 +805,10 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData4(dataManager);
- FakeMetadataFacade fakeMetadata = FakeMetadataFactory.example1();
+ QueryMetadataInterface fakeMetadata = RealMetadataFactory.example1();
- FakeMetadataFactory.setCardinality("pm1.g1", 1, fakeMetadata);
- FakeMetadataFactory.setCardinality("pm6.g1", 1000, fakeMetadata);
+ RealMetadataFactory.setCardinality("pm1.g1", 1, fakeMetadata);
+ RealMetadataFactory.setCardinality("pm6.g1", 1000, fakeMetadata);
// Plan query
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities depcaps = new BasicSourceCapabilities();
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -9,27 +9,28 @@
import org.junit.Test;
import org.teiid.core.types.DataTypeManager;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Schema;
+import org.teiid.metadata.Table;
+import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.optimizer.TestOptimizer;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
-import org.teiid.query.processor.ProcessorPlan;
import org.teiid.query.sql.lang.BatchedUpdateCommand;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.lang.Insert;
import org.teiid.query.sql.symbol.Constant;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
-import org.teiid.query.unittest.FakeMetadataStore;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.translator.SourceSystemFunctions;
-
+@SuppressWarnings("nls")
public class TestInsertProcessing {
@Test public void testSelectIntoWithTypeConversion() {
- FakeMetadataObject pm1 = FakeMetadataFactory.createPhysicalModel("pm1"); //$NON-NLS-1$
- FakeMetadataObject pm1g1 = FakeMetadataFactory.createPhysicalGroup("pm1.g1", pm1); //$NON-NLS-1$
+ MetadataStore metadataStore = new MetadataStore();
+ Schema pm1 = RealMetadataFactory.createPhysicalModel("pm1", metadataStore); //$NON-NLS-1$
+ Table pm1g1 = RealMetadataFactory.createPhysicalGroup("g1", pm1); //$NON-NLS-1$
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
@@ -37,17 +38,12 @@
caps.setFunctionSupport(SourceSystemFunctions.CONVERT, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- List pm1g1e = FakeMetadataFactory.createElements(pm1g1,
+ RealMetadataFactory.createElements(pm1g1,
new String[] { "e1", "e2", "e3" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.BIG_INTEGER, DataTypeManager.DefaultDataTypes.FLOAT, DataTypeManager.DefaultDataTypes.FLOAT});
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(pm1);
- store.addObject(pm1g1);
- store.addObjects(pm1g1e);
+ QueryMetadataInterface metadata = RealMetadataFactory.createTransformationMetadata(metadataStore, "foo");
- FakeMetadataFacade metadata = new FakeMetadataFacade(store);
-
HardcodedDataManager dataManager = new HardcodedDataManager();
dataManager.addData("BatchedUpdate{I}", //$NON-NLS-1$
new List[] { Arrays.asList(new Object[] { new Integer(1) })});
@@ -103,7 +99,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
HardcodedDataManager dataManager = new HardcodedDataManager();
@@ -150,10 +146,10 @@
@Test public void testSelectInto_Case5412a() {
-
+ MetadataStore metadataStore = new MetadataStore();
// test setting BULK_INSERT capability to true
- FakeMetadataObject pm1 = FakeMetadataFactory.createPhysicalModel("pm1"); //$NON-NLS-1$
- FakeMetadataObject pm1g1 = FakeMetadataFactory.createPhysicalGroup("pm1.g1", pm1); //$NON-NLS-1$
+ Schema pm1 = RealMetadataFactory.createPhysicalModel("pm1", metadataStore); //$NON-NLS-1$
+ Table pm1g1 = RealMetadataFactory.createPhysicalGroup("g1", pm1); //$NON-NLS-1$
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
@@ -161,17 +157,12 @@
caps.setFunctionSupport(SourceSystemFunctions.CONVERT, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- List pm1g1e = FakeMetadataFactory.createElements(pm1g1,
+ RealMetadataFactory.createElements(pm1g1,
new String[] { "e1", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
new String[] { DataTypeManager.DefaultDataTypes.BIG_INTEGER, DataTypeManager.DefaultDataTypes.FLOAT});
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(pm1);
- store.addObject(pm1g1);
- store.addObjects(pm1g1e);
+ QueryMetadataInterface metadata = RealMetadataFactory.createTransformationMetadata(metadataStore, "foo");
- FakeMetadataFacade metadata = new FakeMetadataFacade(store);
-
HardcodedDataManager dataManager = new HardcodedDataManager();
dataManager.addData("INSERT INTO pm1.g1 (pm1.g1.e1, pm1.g1.e2) VALUES (?, ?)", //$NON-NLS-1$
new List[] { Arrays.asList(new Object[] { new Integer(1) })});
@@ -190,27 +181,22 @@
@Test public void testSelectInto_Case5412b() {
-
+ MetadataStore metadataStore = new MetadataStore();
// test setting BULK_INSERT capability to false
- FakeMetadataObject pm1 = FakeMetadataFactory.createPhysicalModel("pm1"); //$NON-NLS-1$
- FakeMetadataObject pm1g1 = FakeMetadataFactory.createPhysicalGroup("pm1.g1", pm1); //$NON-NLS-1$
+ Schema pm1 = RealMetadataFactory.createPhysicalModel("pm1", metadataStore); //$NON-NLS-1$
+ Table pm1g1 = RealMetadataFactory.createPhysicalGroup("g1", pm1); //$NON-NLS-1$
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.BULK_UPDATE, false);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
caps.setFunctionSupport(SourceSystemFunctions.CONVERT, true);
- List pm1g1e = FakeMetadataFactory.createElements(pm1g1,
+ RealMetadataFactory.createElements(pm1g1,
new String[] { "e1", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
new String[] { DataTypeManager.DefaultDataTypes.BIG_INTEGER, DataTypeManager.DefaultDataTypes.FLOAT});
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(pm1);
- store.addObject(pm1g1);
- store.addObjects(pm1g1e);
+ QueryMetadataInterface metadata = RealMetadataFactory.createTransformationMetadata(metadataStore, "foo");
- FakeMetadataFacade metadata = new FakeMetadataFacade(store);
-
HardcodedDataManager dataManager = new HardcodedDataManager();
dataManager.addData("INSERT INTO pm1.g1 (pm1.g1.e1, pm1.g1.e2) VALUES (1, 1.0)", //$NON-NLS-1$
new List[] { Arrays.asList(new Object[] { new Integer(1) })});
@@ -261,7 +247,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
HardcodedDataManager dataManager = new HardcodedDataManager();
@@ -342,7 +328,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
HardcodedDataManager dataManager = new HardcodedDataManager();
@@ -399,7 +385,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestJoinWithFunction.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestJoinWithFunction.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestJoinWithFunction.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -31,7 +31,7 @@
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
import org.teiid.query.processor.ProcessorPlan;
import org.teiid.query.sql.lang.Command;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import junit.framework.TestCase;
@@ -57,7 +57,7 @@
* @throws TeiidComponentException
* @throws QueryMetadataException
*/
- public void testNonDeterministicPostJoin() throws QueryMetadataException, TeiidComponentException {
+ public void testNonDeterministicPostJoin() throws Exception {
// source query for one side of a JOIN
String leftQuery = "SELECT pm1.g1.e1 as ID, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 " //$NON-NLS-1$
+ "FROM pm1.g1"; //$NON-NLS-1$
@@ -105,7 +105,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
Command command = TestProcessor.helpParse(sql);
- ProcessorPlan plan = TestProcessor.helpGetPlan(command, FakeMetadataFactory.example1Cached(), capFinder);
+ ProcessorPlan plan = TestProcessor.helpGetPlan(command, RealMetadataFactory.example1Cached(), capFinder);
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -127,7 +127,7 @@
* @throws TeiidComponentException
* @throws QueryMetadataException
*/
- public void testNonDeterministicPreJoin() throws QueryMetadataException, TeiidComponentException {
+ public void testNonDeterministicPreJoin() throws Exception {
// source query for one side of a JOIN
String leftQuery = "SELECT pm1.g1.e1 as ID, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4, RAND() AS RandomLeft " //$NON-NLS-1$
+ "FROM pm1.g1"; //$NON-NLS-1$
@@ -176,7 +176,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
Command command = TestProcessor.helpParse(sql);
- ProcessorPlan plan = TestProcessor.helpGetPlan(command, FakeMetadataFactory.example1Cached(), capFinder);
+ ProcessorPlan plan = TestProcessor.helpGetPlan(command, RealMetadataFactory.example1Cached(), capFinder);
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -192,7 +192,7 @@
* @throws TeiidComponentException
* @throws QueryMetadataException
*/
- public void testNonDeterministicPrePostJoin() throws TeiidComponentException, QueryMetadataException {
+ public void testNonDeterministicPrePostJoin() throws Exception {
// source query for one side of a JOIN
String leftQuery = "SELECT pm1.g1.e1 as ID, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4, RAND() AS RandomLeft " //$NON-NLS-1$
+ "FROM pm1.g1"; //$NON-NLS-1$
@@ -241,7 +241,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
Command command = TestProcessor.helpParse(sql);
- ProcessorPlan plan = TestProcessor.helpGetPlan(command, FakeMetadataFactory.example1Cached(), capFinder);
+ ProcessorPlan plan = TestProcessor.helpGetPlan(command, RealMetadataFactory.example1Cached(), capFinder);
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -256,7 +256,7 @@
* @throws TeiidComponentException
* @throws QueryMetadataException
*/
- public void testDeterministicPostJoin() throws TeiidComponentException, QueryMetadataException {
+ public void testDeterministicPostJoin() throws Exception {
// source query for one side of a JOIN
String leftQuery = "SELECT pm1.g1.e1 as ID, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 " //$NON-NLS-1$
+ "FROM pm1.g1"; //$NON-NLS-1$
@@ -303,7 +303,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
Command command = TestProcessor.helpParse(sql);
- ProcessorPlan plan = TestProcessor.helpGetPlan(command, FakeMetadataFactory.example1Cached(), capFinder);
+ ProcessorPlan plan = TestProcessor.helpGetPlan(command, RealMetadataFactory.example1Cached(), capFinder);
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -322,7 +322,7 @@
* @throws TeiidComponentException
* @throws QueryMetadataException
*/
- public void testDeterministicPreJoin() throws QueryMetadataException, TeiidComponentException {
+ public void testDeterministicPreJoin() throws Exception {
// source query for one side of a JOIN
String leftQuery = "SELECT pm1.g1.e1 as ID, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4, SQRT(100) AS SqrtLeft " //$NON-NLS-1$
+ "FROM pm1.g1"; //$NON-NLS-1$
@@ -368,7 +368,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
Command command = TestProcessor.helpParse(sql);
- ProcessorPlan plan = TestProcessor.helpGetPlan(command, FakeMetadataFactory.example1Cached(), capFinder);
+ ProcessorPlan plan = TestProcessor.helpGetPlan(command, RealMetadataFactory.example1Cached(), capFinder);
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -384,7 +384,7 @@
* @see #testDeterministicPostJoin
* @see #testDeterministicPreJoin
*/
- public void testDeterministicPrePostJoin() throws QueryMetadataException, TeiidComponentException {
+ public void testDeterministicPrePostJoin() throws Exception {
// sub-query for one side of a JOIN
String leftQuery = "SELECT pm1.g1.e1 as ID, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4, SQRT(100) AS SqrtLeft " //$NON-NLS-1$
+ "FROM pm1.g1"; //$NON-NLS-1$
@@ -431,7 +431,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
Command command = TestProcessor.helpParse(sql);
- ProcessorPlan plan = TestProcessor.helpGetPlan(command, FakeMetadataFactory.example1Cached(), capFinder);
+ ProcessorPlan plan = TestProcessor.helpGetPlan(command, RealMetadataFactory.example1Cached(), capFinder);
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestOptionalJoins.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestOptionalJoins.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestOptionalJoins.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -27,7 +27,7 @@
import org.junit.Test;
import org.teiid.query.processor.ProcessorPlan;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
public class TestOptionalJoins {
@@ -48,7 +48,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -76,7 +76,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -101,7 +101,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -126,7 +126,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -157,7 +157,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -188,7 +188,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -213,7 +213,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -238,7 +238,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -263,7 +263,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -288,7 +288,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -313,7 +313,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -338,7 +338,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -358,7 +358,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -383,7 +383,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -408,7 +408,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -432,7 +432,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -457,7 +457,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -482,7 +482,7 @@
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestOrderByProcessing.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestOrderByProcessing.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestOrderByProcessing.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -28,12 +28,12 @@
import java.util.List;
import org.junit.Test;
+import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.optimizer.TestOptimizer;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.translator.ExecutionFactory.NullOrder;
@SuppressWarnings({"nls", "unchecked"})
@@ -49,7 +49,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached());
helpProcess(plan, dataManager, expected);
}
@@ -74,7 +74,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached(), TestOptimizer.getGenericFinder());
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached(), TestOptimizer.getGenericFinder());
// Run query
helpProcess(plan, dataManager, expected);
@@ -90,7 +90,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached(), TestOptimizer.getGenericFinder());
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached(), TestOptimizer.getGenericFinder());
helpProcess(plan, dataManager, expected);
}
@@ -101,7 +101,7 @@
@Test public void testOrderByWithDuplicateExpressions() throws Exception {
String sql = "select e1 as x, e1 as y from pm1.g1 order by y ASC"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpGetPlan(helpParse(sql), metadata);
@@ -122,7 +122,7 @@
@Test public void testExplicitNullOrdering() throws Exception {
String sql = "select e1, case when e4 = 2.0 then null else e4 end as x from pm1.g1 order by e1 ASC NULLS LAST, x DESC NULLS FIRST"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpGetPlan(helpParse(sql), metadata);
List[] expected = new List[] { Arrays.asList("a", null),
@@ -145,7 +145,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan("select e1 from pm1.g1 order by e1 desc, e2 asc", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null, capFinder,
+ RealMetadataFactory.example1Cached(), null, capFinder,
new String[] { "SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 ORDER BY c_0 DESC NULLS LAST, g_0.e2 NULLS FIRST"}, //$NON-NLS-1$
TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);
@@ -160,7 +160,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan("select e1 from pm1.g1 order by e1 desc, e2 asc", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null, capFinder,
+ RealMetadataFactory.example1Cached(), null, capFinder,
new String[] { "SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 ORDER BY c_0 DESC, g_0.e2 NULLS FIRST"}, //$NON-NLS-1$
TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);
@@ -174,7 +174,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan("select e1 from pm1.g1 order by e1 desc NULLS FIRST, e2 asc NULLS LAST", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null, capFinder,
+ RealMetadataFactory.example1Cached(), null, capFinder,
new String[] { "SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 ORDER BY c_0 DESC NULLS FIRST, g_0.e2 NULLS LAST"}, //$NON-NLS-1$
TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);
@@ -192,7 +192,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan("select e1 from pm1.g1 order by e1 desc, e2 asc NULLS LAST", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(), null, capFinder,
+ RealMetadataFactory.example1Cached(), null, capFinder,
new String[] { "SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 ORDER BY c_0 DESC, g_0.e2"}, //$NON-NLS-1$
TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -33,7 +33,13 @@
import org.teiid.common.buffer.TupleSource;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.types.DataTypeManager;
+import org.teiid.metadata.ColumnSet;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Procedure;
+import org.teiid.metadata.ProcedureParameter;
+import org.teiid.metadata.Schema;
import org.teiid.query.mapping.relational.QueryNode;
+import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.optimizer.TestOptimizer;
import org.teiid.query.processor.proc.CreateCursorResultSetInstruction;
import org.teiid.query.processor.proc.ProcedurePlan;
@@ -45,19 +51,16 @@
import org.teiid.query.sql.lang.SPParameter;
import org.teiid.query.sql.lang.StoredProcedure;
import org.teiid.query.sql.symbol.Constant;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
-import org.teiid.query.unittest.FakeMetadataStore;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
-
+@SuppressWarnings("nls")
public class TestProcedureRelational {
@Test public void testProcInExistsSubquery() throws Exception {
String sql = "select pm1.g1.e1 from pm1.g1 where exists (select * from (EXEC pm1.vsp9(pm1.g1.e2 + 1)) x where x.e1 = pm1.g1.e1)"; //$NON-NLS-1$
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
Arrays.asList(new Object[] { "a" }), //$NON-NLS-1$
Arrays.asList(new Object[] { "a" }), //$NON-NLS-1$
};
@@ -65,7 +68,7 @@
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -73,7 +76,7 @@
@Test public void testProcInSelectScalarSubquery() throws Exception {
String sql = "select (EXEC pm1.vsp36(pm1.g1.e2)) from pm1.g1 where pm1.g1.e1 = 'a'"; //$NON-NLS-1$
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
Arrays.asList(new Object[] { new Integer(0) }),
Arrays.asList(new Object[] { new Integer(6) }),
Arrays.asList(new Object[] { new Integer(0) }),
@@ -82,7 +85,7 @@
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -91,14 +94,14 @@
String sql = "select param1, param2, e1, e2 from pm1.vsp26 where param1=1 and param2='a'"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
Arrays.asList(new Object[] { new Integer(1), "a", "a", new Integer(3)}), //$NON-NLS-1$ //$NON-NLS-2$
};
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -108,14 +111,14 @@
String sql = "select param1, param2, e1, e2 from pm1.vsp26 as x where param1=1 and param2='a'"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
Arrays.asList(new Object[] { new Integer(1), "a", "a", new Integer(3)}), //$NON-NLS-1$ //$NON-NLS-2$
};
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -124,14 +127,14 @@
String sql = "select x.param1, x.param2, y.param1, y.param2, x.e1 from pm1.vsp26 as x, pm1.vsp26 as y where x.param1=1 and x.param2='a' and y.param1 = 2 and y.param2 = 'b'"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
Arrays.asList(new Object[] { new Integer(1), "a", new Integer(2), "b", "a"}), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
};
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -141,14 +144,14 @@
String sql = "select x.param1, x.param2, y.param1, y.param2, x.e1 from pm1.vsp26 as x, pm1.vsp26 as y where x.param1=1 and x.param2='a' and y.param1 = x.param1 and y.param2 = x.param2"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
Arrays.asList(new Object[] { new Integer(1), "a", new Integer(1), "a", "a"}), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
};
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -159,7 +162,7 @@
@Test public void testProcAsTable1(){
String sql = "select param1, param2, e1, e2 from pm1.vsp26 where param1=1"; //$NON-NLS-1$
- TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null, TestOptimizer.getGenericFinder(), null, false);
+ TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), null, TestOptimizer.getGenericFinder(), null, false);
}
/**
@@ -168,14 +171,14 @@
@Test public void testProcAsTable2(){
String sql = "select param1, param2, e1, e2 from pm1.vsp26 where param1<1 and param2='a'"; //$NON-NLS-1$
- TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null, TestOptimizer.getGenericFinder(), null, false);
+ TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), null, TestOptimizer.getGenericFinder(), null, false);
}
@Test public void testProcAsTable3(){
String sql = "select param1, param2, e1, e2 from pm1.vsp26 where param1 in (1,2,3) and param2 in ('a', 'b') order by param1, param2"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
Arrays.asList(new Object[] { new Integer(1), "a", "a", new Integer(3)}), //$NON-NLS-1$ //$NON-NLS-2$
Arrays.asList(new Object[] { new Integer(1), "b", "b", new Integer(2)}), //$NON-NLS-1$ //$NON-NLS-2$
Arrays.asList(new Object[] { new Integer(2), "a", "a", new Integer(3)}), //$NON-NLS-1$ //$NON-NLS-2$
@@ -186,7 +189,7 @@
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -197,7 +200,7 @@
@Test public void testProcAsTable4(){
String sql = "select param1, param2, e1, e2 from pm1.vsp26 where param1=1 and not(param2 = 'a')"; //$NON-NLS-1$
- TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null, TestOptimizer.getGenericFinder(), null, false);
+ TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), null, TestOptimizer.getGenericFinder(), null, false);
}
/**
@@ -206,14 +209,14 @@
@Test public void testProcAsTable5(){
String sql = "select param1, param2, e1, e2 from pm1.vsp26 where param1=e2 and param2 = 'a'"; //$NON-NLS-1$
- TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null, TestOptimizer.getGenericFinder(), null, false);
+ TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), null, TestOptimizer.getGenericFinder(), null, false);
}
@Test public void testProcAsTableInJoin(){
String sql = "select param1, param2, pm1.vsp26.e2 from pm1.vsp26, pm1.g1 where param1 = pm1.g1.e2 and param2 = pm1.g1.e1 order by param1, param2, e2"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
Arrays.asList(new Object[] { new Integer(0), "a", new Integer(0)}), //$NON-NLS-1$
Arrays.asList(new Object[] { new Integer(0), "a", new Integer(0)}), //$NON-NLS-1$
Arrays.asList(new Object[] { new Integer(0), "a", new Integer(0)}), //$NON-NLS-1$
@@ -228,7 +231,7 @@
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -237,7 +240,7 @@
String sql = "select param1, param2, pm1.vsp26.e2, (select count(e1) from pm1.vsp26 where param1 = 1 and param2 = 'a') x from pm1.vsp26, pm1.g1 where param1 = pm1.g1.e2 and param2 = pm1.g1.e1 order by param1, param2, e2"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
Arrays.asList(new Object[] { new Integer(0), "a", new Integer(0), new Integer(1)}), //$NON-NLS-1$
Arrays.asList(new Object[] { new Integer(0), "a", new Integer(0), new Integer(1)}), //$NON-NLS-1$
Arrays.asList(new Object[] { new Integer(0), "a", new Integer(0), new Integer(1)}), //$NON-NLS-1$
@@ -252,7 +255,7 @@
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -260,7 +263,7 @@
private void helpTestProcRelational(String userQuery,
String inputCriteria,
String atomicQuery) {
- ProcessorPlan plan = TestOptimizer.helpPlan(userQuery, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(userQuery, RealMetadataFactory.example1Cached(),
new String[] {} );
RelationalPlan rplan = (RelationalPlan)plan;
@@ -295,7 +298,7 @@
String userQuery = "select e1 from pm1.vsp26 where param1=1 and param2='a'"; //$NON-NLS-1$
String inputCriteria = "(pm1.vsp26.param1 = 1) AND (pm1.vsp26.param2 = 'a')"; //$NON-NLS-1$
- String atomicQuery = "SELECT g_0.e1, g_0.e2 FROM pm1.g1 AS g_0 WHERE (g_0.e2 >= PM1.VSP26.param1) AND (g_0.e1 = PM1.VSP26.param2)"; //$NON-NLS-1$
+ String atomicQuery = "SELECT g_0.e1, g_0.e2 FROM pm1.g1 AS g_0 WHERE (g_0.e2 >= pm1.vsp26.param1) AND (g_0.e1 = pm1.vsp26.param2)"; //$NON-NLS-1$
helpTestProcRelational(userQuery, inputCriteria, atomicQuery);
}
@@ -304,7 +307,7 @@
@Test public void testCase3403() {
String userQuery = "select e1 from pm1.vsp26 where param1=2 and param2='a' and 'x'='x'"; //$NON-NLS-1$
String inputCriteria = "(pm1.vsp26.param1 = 2) AND (pm1.vsp26.param2 = 'a')"; //$NON-NLS-1$
- String atomicQuery = "SELECT g_0.e1, g_0.e2 FROM pm1.g1 AS g_0 WHERE (g_0.e2 >= PM1.VSP26.param1) AND (g_0.e1 = PM1.VSP26.param2)"; //$NON-NLS-1$
+ String atomicQuery = "SELECT g_0.e1, g_0.e2 FROM pm1.g1 AS g_0 WHERE (g_0.e2 >= pm1.vsp26.param1) AND (g_0.e1 = pm1.vsp26.param2)"; //$NON-NLS-1$
helpTestProcRelational(userQuery, inputCriteria, atomicQuery);
}
@@ -312,7 +315,7 @@
@Test public void testCase3448() {
String userQuery = "select e1 from pm1.vsp26 where (param1=1 and e2=2) and param2='a'"; //$NON-NLS-1$
String inputCriteria = "(pm1.vsp26.param1 = 1) AND (pm1.vsp26.param2 = 'a')"; //$NON-NLS-1$
- String atomicQuery = "SELECT g_0.e1, g_0.e2 FROM pm1.g1 AS g_0 WHERE (g_0.e2 >= PM1.VSP26.param1) AND (g_0.e1 = PM1.VSP26.param2)"; //$NON-NLS-1$
+ String atomicQuery = "SELECT g_0.e1, g_0.e2 FROM pm1.g1 AS g_0 WHERE (g_0.e2 >= pm1.vsp26.param1) AND (g_0.e1 = pm1.vsp26.param2)"; //$NON-NLS-1$
helpTestProcRelational(userQuery, inputCriteria, atomicQuery);
}
@@ -321,14 +324,14 @@
String sql = "select e1 from (SELECT * FROM pm1.vsp26 as P where P.e1='a') x where param1=1 and param2='a'"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
Arrays.asList(new Object[] { "a"}), //$NON-NLS-1$
};
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -337,14 +340,14 @@
String sql = "select e1 from (SELECT * FROM pm1.vsp26 as P where P.e1='a') x where param1=1 and param2='a'"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
Arrays.asList(new Object[] { "a"}), //$NON-NLS-1$
};
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -353,7 +356,7 @@
String sql = "SELECT P.e1 as ve3 FROM pm1.vsp26 as P, pm1.g2 where P.e1=g2.e1 and param1=1 and param2='a'"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
Arrays.asList(new Object[] { "a"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "a"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "a"}) //$NON-NLS-1$
@@ -362,7 +365,7 @@
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -371,14 +374,14 @@
String sql = "select e1 from (SELECT * FROM pm1.vsp26 as P where P.e1='a') x where param1=1 and param2='a' and e1='a'"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
Arrays.asList(new Object[] { "a"}), //$NON-NLS-1$
};
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -387,7 +390,7 @@
String sql = "SELECT P.e1 as ve3 FROM pm1.vsp26 as P, vm1.g1 where P.e1=g1.e1 and param1=1 and param2='a'"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
Arrays.asList(new Object[] { "a"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "a"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "a"}) //$NON-NLS-1$
@@ -396,7 +399,7 @@
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -405,7 +408,7 @@
String sql = "SELECT e1 FROM (SELECT p.e1, param1, param2 FROM pm1.vsp26 as P, vm1.g1 where P.e1=g1.e1) x where param1=1 and param2='a'"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
Arrays.asList(new Object[] { "a"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "a"}), //$NON-NLS-1$
Arrays.asList(new Object[] { "a"}) //$NON-NLS-1$
@@ -414,7 +417,7 @@
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -423,12 +426,12 @@
String sql = "select e1 from (SELECT * FROM pm1.vsp26 as P where P.e1='a') x where (param1=1 and param2='a') and e1='c'"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[0];
+ List<?>[] expected = new List[0];
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -437,14 +440,14 @@
String sql = "SELECT P.e1 as ve3, P.e2 as ve4 FROM pm1.vsp26 as P where param1=1 and param2='a' and e2=3"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
Arrays.asList(new Object[] { "a", new Integer(3)}), //$NON-NLS-1$
};
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -454,14 +457,14 @@
String sql = "SELECT P.e2 as ve3, P.e1 as ve4 FROM pm1.vsp47 as P where param1=1 and param2='a'"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
Arrays.asList(new Object[] { new Integer(1), "FOO" }), //$NON-NLS-1$
};
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -475,14 +478,14 @@
String sql = "SELECT P.e2 as ve3, P.e1 as ve4 FROM pm1.vsp47 as P where param2='a'"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
Arrays.asList(new Object[] { new Integer(2112), "a" }), //$NON-NLS-1$
};
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -496,14 +499,14 @@
String sql = "SELECT P.e2 as ve3, P.e1 as ve4 FROM pm1.vsp47 as P"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
Arrays.asList(new Object[] { new Integer(2112), null })
};
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -512,32 +515,27 @@
* test for defect 22376
*/
@Test public void testParameterPassing() throws Exception {
- FakeMetadataObject v1 = FakeMetadataFactory.createVirtualModel("v1"); //$NON-NLS-1$
+ MetadataStore metadataStore = new MetadataStore();
+ Schema v1 = RealMetadataFactory.createVirtualModel("v1", metadataStore); //$NON-NLS-1$
- FakeMetadataObject rs1 = FakeMetadataFactory.createResultSet("v1.rs1", v1, new String[] {"e1"}, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs1p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs1); //$NON-NLS-1$
+ ColumnSet<Procedure> rs1 = RealMetadataFactory.createResultSet("v1.rs1", new String[] {"e1"}, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- QueryNode n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN declare string VARIABLES.x = '1'; SELECT e1 FROM v1.vp2 where v1.vp2.in = VARIABLES.x; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vt1 = FakeMetadataFactory.createVirtualProcedure("v1.vp1", v1, Arrays.asList(new FakeMetadataObject[] { rs1p1 }), n1); //$NON-NLS-1$
+ QueryNode n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN declare string VARIABLES.x = '1'; SELECT e1 FROM v1.vp2 where v1.vp2.in = VARIABLES.x; END"); //$NON-NLS-1$
+ Procedure vt1 = RealMetadataFactory.createVirtualProcedure("vp1", v1, null, n1); //$NON-NLS-1$
+ vt1.setResultSet(rs1);
- FakeMetadataObject p1 = FakeMetadataFactory.createParameter("v1.vp2.in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode n2 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN declare string VARIABLES.x; declare string VARIABLES.y; VARIABLES.x = '2'; VARIABLES.y = v1.vp2.in; select VARIABLES.y; end"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vt2 = FakeMetadataFactory.createVirtualProcedure("v1.vp2", v1, Arrays.asList(new FakeMetadataObject[] { rs1p1, p1 }), n2); //$NON-NLS-1$
+ ProcedureParameter p1 = RealMetadataFactory.createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ QueryNode n2 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN declare string VARIABLES.x; declare string VARIABLES.y; VARIABLES.x = '2'; VARIABLES.y = v1.vp2.in; select VARIABLES.y; end"); //$NON-NLS-1$
+ Procedure vt2 = RealMetadataFactory.createVirtualProcedure("vp2", v1, Arrays.asList(p1), n2); //$NON-NLS-1$
+ vt2.setResultSet(RealMetadataFactory.createResultSet("v1.rs1", new String[] {"e1"}, new String[] { DataTypeManager.DefaultDataTypes.STRING }));
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(v1);
- store.addObject(rs1);
- store.addObject(vt1);
- store.addObject(vt2);
- store.addObject(vt2);
-
String sql = "select * from (exec v1.vp1()) foo"; //$NON-NLS-1$
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
Arrays.asList(new Object[] { "1" }), //$NON-NLS-1$
};
- FakeMetadataFacade metadata = new FakeMetadataFacade(store);
+ QueryMetadataInterface metadata = RealMetadataFactory.createTransformationMetadata(metadataStore, "foo");
// Construct data manager with data
// Plan query
@@ -552,14 +550,14 @@
String sql = "SELECT P.e2 as ve3, P.e1 as ve4 FROM pm1.vsp47 as P where param1=1 and param2='a'"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
Arrays.asList(new Object[] { new Integer(1), "FOO" }), //$NON-NLS-1$
};
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -572,14 +570,14 @@
String sql = "select e1 from (SELECT * FROM pm1.vsp26 as P where P.e1='a') x where param1=1 and param2 is null"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
};
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
try {
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.doProcess(plan, dataManager, expected, TestProcessor.createCommandContext());
fail("QueryPlannerException was expected."); //$NON-NLS-1$
@@ -596,14 +594,14 @@
String sql = "select * from pm1.vsp47 where param1 is null and param2 is null"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
Arrays.asList(new Object[] { null, new Integer(2112), null, null })
};
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -615,13 +613,13 @@
String sql = "select e1 from (SELECT * FROM pm1.vsp26 as P where P.e1='a') x where param1=1 and param2 = commandpayload()"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
};
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
@@ -632,51 +630,51 @@
* access patterns and access patterns have a wider range of semantics.
*
@Test public void testProcInVirtualGroupDefect14609_1() throws Exception{
- helpValidate("select ve3 from vm1.vgvp1 where ve1=1.1 and ve2='a'", new String[] {"ve1 = 1.1"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("select ve3 from vm1.vgvp1 where ve1=1.1 and ve2='a'", new String[] {"ve1 = 1.1"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testProcInVirtualGroupDefect14609_2() throws Exception{
- helpValidate("select ve3 from vm1.vgvp1 where convert(ve1, integer)=1 and ve2='a'", new String[] {"convert(ve1, integer) = 1" }, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("select ve3 from vm1.vgvp1 where convert(ve1, integer)=1 and ve2='a'", new String[] {"convert(ve1, integer) = 1" }, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testProcInVirtualGroupDefect14609_3() throws Exception{
- helpValidate("select ve3 from vm1.vgvp1 where 1.1=ve1 and ve2='a'", new String[] {"1.1 = ve1" }, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("select ve3 from vm1.vgvp1 where 1.1=ve1 and ve2='a'", new String[] {"1.1 = ve1" }, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testProcInVirtualGroupDefect14609_4() throws Exception{
- helpValidate("select ve3 from vm1.vgvp1 where 1=convert(ve1, integer) and ve2='a'", new String[] {"1 = convert(ve1, integer)" }, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("select ve3 from vm1.vgvp1 where 1=convert(ve1, integer) and ve2='a'", new String[] {"1 = convert(ve1, integer)" }, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testDefect15861() throws Exception{
- helpValidate("select ve3 from vm1.vgvp1 where (ve1=1 or ve1=2) and ve2='a'", new String[] {"(ve1 = 1) OR (ve1 = 2)", "ve1 = 2"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ helpValidate("select ve3 from vm1.vgvp1 where (ve1=1 or ve1=2) and ve2='a'", new String[] {"(ve1 = 1) OR (ve1 = 2)", "ve1 = 2"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
@Test public void testProcInVirtualGroup1_Defect20164() {
- helpFailProcedure("select ve3 from vm1.vgvp2 where (ve1=1 and ve2='a') or ve3='c'", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpFailProcedure("select ve3 from vm1.vgvp2 where (ve1=1 and ve2='a') or ve3='c'", RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testProcInVirtualGroup2_Defect20164() {
- helpFailProcedure("select ve3 from vm1.vgvp2 where ve1=1 or ve2='a'", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpFailProcedure("select ve3 from vm1.vgvp2 where ve1=1 or ve2='a'", RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testProcInVirtualGroup3_Defect20164() {
- helpFailProcedure("select ve3 from vm1.vgvp2, pm1.g1 where ve1=pm1.g1.e2 and ve2='a'", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpFailProcedure("select ve3 from vm1.vgvp2, pm1.g1 where ve1=pm1.g1.e2 and ve2='a'", RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testProcInVirtualGroup4_Defect20164() {
- helpValidate("select ve3 from vm1.vgvp2 where (ve1=1 and ve2='a') and (ve3='a' OR ve3='c')", new String[0], FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpValidate("select ve3 from vm1.vgvp2 where (ve1=1 and ve2='a') and (ve3='a' OR ve3='c')", new String[0], RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testProcInVirtualGroup5_Defect20164() {
- helpFailProcedure("select ve3 from vm1.vgvp2 where ve1=1 and NOT(ve2='a')", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpFailProcedure("select ve3 from vm1.vgvp2 where ve1=1 and NOT(ve2='a')", RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testProcInVirtualGroup6_Defect20164() {
- helpValidate("select ve3 from vm1.vgvp2 where ve1=1 and ve2 is null", new String[0], FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpValidate("select ve3 from vm1.vgvp2 where ve1=1 and ve2 is null", new String[0], RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testProcInVirtualGroup7_Defect20164() {
- helpFailProcedure("select ve3 from vm1.vgvp2 where ve1=1 and ve2 is not null", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpFailProcedure("select ve3 from vm1.vgvp2 where ve1=1 and ve2 is not null", RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}*/
/**
@@ -684,28 +682,22 @@
* are set correctly.
*/
@Test public void testIssue119() throws Exception {
- FakeMetadataObject v1 = FakeMetadataFactory.createVirtualModel("v1"); //$NON-NLS-1$
- FakeMetadataObject pm1 = FakeMetadataFactory.createPhysicalModel("pm1"); //$NON-NLS-1$
+ MetadataStore metadataStore = new MetadataStore();
+ Schema v1 = RealMetadataFactory.createVirtualModel("v1", metadataStore); //$NON-NLS-1$
+ Schema pm1 = RealMetadataFactory.createPhysicalModel("pm1", metadataStore); //$NON-NLS-1$
- FakeMetadataObject in = FakeMetadataFactory.createParameter("v1.vp1.in1", 2, SPParameter.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- FakeMetadataObject rs1 = FakeMetadataFactory.createResultSet("v1.vp1.rs1", v1, new String[] {"e1", "e2", "e3", "e4", "e5"}, new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- FakeMetadataObject rs1p1 = FakeMetadataFactory.createParameter("ret", 1, SPParameter.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs1); //$NON-NLS-1$
+ ProcedureParameter in = RealMetadataFactory.createParameter("in1", SPParameter.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ ColumnSet<Procedure> rs1 = RealMetadataFactory.createResultSet("v1.vp1.rs1", new String[] {"e1", "e2", "e3", "e4", "e5"}, new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- QueryNode n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT vp1.in1 e1, x.in1 e2, x.e1 e3, y.in1 e4, y.e1 e5 FROM pm1.sp119 x, pm1.sp119 y where x.in1 = vp1.in1 and y.in1 = x.e1; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vt1 = FakeMetadataFactory.createVirtualProcedure("v1.vp1", v1, Arrays.asList(new FakeMetadataObject[] { rs1p1, in }), n1); //$NON-NLS-1$
+ QueryNode n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT vp1.in1 e1, x.in1 e2, x.e1 e3, y.in1 e4, y.e1 e5 FROM pm1.sp119 x, pm1.sp119 y where x.in1 = vp1.in1 and y.in1 = x.e1; END"); //$NON-NLS-1$
+ Procedure vt1 = RealMetadataFactory.createVirtualProcedure("vp1", v1, Arrays.asList(in), n1); //$NON-NLS-1$
+ vt1.setResultSet(rs1);
- FakeMetadataObject in1 = FakeMetadataFactory.createParameter("pm1.sp119.in1", 2, SPParameter.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- FakeMetadataObject rs3 = FakeMetadataFactory.createResultSet("pm1.sp119.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs3p1 = FakeMetadataFactory.createParameter("ret", 1, SPParameter.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs3); //$NON-NLS-1$
- FakeMetadataObject sp1 = FakeMetadataFactory.createStoredProcedure("pm1.sp119", pm1, Arrays.asList(new FakeMetadataObject[] { rs3p1, in1 })); //$NON-NLS-1$ //$NON-NLS-2$
-
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(pm1);
- store.addObject(v1);
- store.addObject(rs1);
- store.addObject(vt1);
- store.addObject(sp1);
-
+ ProcedureParameter in1 = RealMetadataFactory.createParameter("in1", SPParameter.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ ColumnSet<Procedure> rs3 = RealMetadataFactory.createResultSet("pm1.sp119.rs1", new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sp1 = RealMetadataFactory.createStoredProcedure("sp119", pm1, Arrays.asList(in1)); //$NON-NLS-1$
+ sp1.setResultSet(rs3);
+
String sql = "select * from (exec v1.vp1(1)) foo order by e4, e5"; //$NON-NLS-1$
List<?>[] expected = new List[] {
@@ -715,7 +707,7 @@
Arrays.asList(1, 1, 6, 6, 11),
};
- FakeMetadataFacade metadata = new FakeMetadataFacade(store);
+ QueryMetadataInterface metadata = RealMetadataFactory.createTransformationMetadata(metadataStore, "foo");
// Construct data manager with data
// Plan query
@@ -749,14 +741,14 @@
String sql = "select e1 from pm1.vsp2 order by e1 desc limit 1"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
+ List<?>[] expected = new List[] {
Arrays.asList("c") //$NON-NLS-1$
};
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestProcessor.helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -59,13 +59,18 @@
import org.teiid.dqp.internal.process.PreparedPlan;
import org.teiid.dqp.internal.process.QueryProcessorFactoryImpl;
import org.teiid.dqp.internal.process.SessionAwareCache;
+import org.teiid.metadata.ColumnSet;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Procedure;
+import org.teiid.metadata.Schema;
+import org.teiid.metadata.Table;
import org.teiid.query.analysis.AnalysisRecord;
-import org.teiid.query.function.FunctionLibrary;
import org.teiid.query.function.FunctionTree;
import org.teiid.query.mapping.relational.QueryNode;
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.metadata.TempMetadataAdapter;
import org.teiid.query.metadata.TempMetadataStore;
+import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.optimizer.FakeFunctionMetadataSource;
import org.teiid.query.optimizer.QueryOptimizer;
import org.teiid.query.optimizer.TestOptimizer;
@@ -85,16 +90,12 @@
import org.teiid.query.rewriter.QueryRewriter;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.lang.SPParameter;
-import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.Reference;
import org.teiid.query.sql.util.VariableContext;
import org.teiid.query.sql.visitor.ReferenceCollectorVisitor;
import org.teiid.query.tempdata.TempTableDataManager;
import org.teiid.query.tempdata.TempTableStore;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
-import org.teiid.query.unittest.FakeMetadataStore;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.unittest.TimestampUtil;
import org.teiid.query.util.CommandContext;
import org.teiid.query.validator.Validator;
@@ -105,7 +106,16 @@
// ################################## TEST HELPERS ################################
- static Command helpParse(String sql) {
+ private static final List[] SP1RS = new List[] {
+ Arrays.asList(new Object[] { "a", new Integer(0) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { null, new Integer(1)}),
+ Arrays.asList(new Object[] { "a", new Integer(3) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "c", new Integer(1)}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "b", new Integer(2)}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "a", new Integer(0) }) //$NON-NLS-1$
+ };
+
+ static Command helpParse(String sql) {
// parse
try {
return QueryParser.getQueryParser().parseCommand(sql);
@@ -357,7 +367,7 @@
public static void sampleData1(FakeDataManager dataMgr) {
try {
- FakeDataStore.sampleData1(dataMgr, FakeMetadataFactory.example1Cached());
+ FakeDataStore.sampleData1(dataMgr, RealMetadataFactory.example1Cached());
} catch(Throwable e) {
throw new RuntimeException(e);
}
@@ -372,164 +382,71 @@
}
private void sampleData2a(FakeDataManager dataMgr) {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
try {
- // Group pm1.g1
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g1"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = FakeDataStore.createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
+ metadata,
+ "pm1.g1", new List[] {
+ Arrays.asList(new Object[] { "a", new Integer(0), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "b", new Integer(1), Boolean.TRUE, null }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "c", new Integer(2), Boolean.FALSE, new Double(0.0) }), //$NON-NLS-1$
+ } );
- new List[] {
- Arrays.asList(new Object[] { "a", new Integer(0), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "b", new Integer(1), Boolean.TRUE, null }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "c", new Integer(2), Boolean.FALSE, new Double(0.0) }), //$NON-NLS-1$
- } );
-
- // Group pm2.g1
- groupID = (FakeMetadataObject) metadata.getGroupID("pm2.g1"); //$NON-NLS-1$
- elementIDs = metadata.getElementIDsInGroupID(groupID);
- elementSymbols = FakeDataStore.createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList(new Object[] { "b", new Integer(0), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "b", new Integer(7), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "d", new Integer(3), Boolean.TRUE, new Double(7.0) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "e", new Integer(1), Boolean.TRUE, null }), //$NON-NLS-1$
- } );
+ metadata,
+ "pm2.g1", new List[] {
+ Arrays.asList(new Object[] { "b", new Integer(0), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "b", new Integer(7), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "d", new Integer(3), Boolean.TRUE, new Double(7.0) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "e", new Integer(1), Boolean.TRUE, null }), //$NON-NLS-1$
+ } );
- // Group pm4.g1
- groupID = (FakeMetadataObject) metadata.getGroupID("pm4.g1"); //$NON-NLS-1$
- elementIDs = metadata.getElementIDsInGroupID(groupID);
- elementSymbols = FakeDataStore.createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList(new Object[] { "aa", new Integer(0), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "bb", new Integer(1), Boolean.TRUE, null }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "cc", new Integer(2), Boolean.FALSE, new Double(0.0) }), //$NON-NLS-1$
- } );
+ metadata,
+ "pm4.g1", new List[] {
+ Arrays.asList(new Object[] { "aa", new Integer(0), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "bb", new Integer(1), Boolean.TRUE, null }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "cc", new Integer(2), Boolean.FALSE, new Double(0.0) }), //$NON-NLS-1$
+ } );
} catch(TeiidException e) {
throw new RuntimeException(e);
}
}
- public static void sampleData2b(FakeDataManager dataMgr) {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
+ public static void sampleData2b(FakeDataManager dataMgr, QueryMetadataInterface metadata) {
try {
- // Group pm1.g1
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g1"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = FakeDataStore.createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
+ metadata,
+ "pm1.g1", new List[] {
+ Arrays.asList(new Object[] { "aa ", new Integer(0), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "bb ", new Integer(1), Boolean.TRUE, null }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "cc ", new Integer(2), Boolean.FALSE, new Double(0.0) }), //$NON-NLS-1$
+ } );
- new List[] {
- Arrays.asList(new Object[] { "aa ", new Integer(0), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "bb ", new Integer(1), Boolean.TRUE, null }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "cc ", new Integer(2), Boolean.FALSE, new Double(0.0) }), //$NON-NLS-1$
- } );
-
- // Group pm2.g1
- groupID = (FakeMetadataObject) metadata.getGroupID("pm2.g1"); //$NON-NLS-1$
- elementIDs = metadata.getElementIDsInGroupID(groupID);
- elementSymbols = FakeDataStore.createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList(new Object[] { "b", new Integer(0), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "d", new Integer(3), Boolean.TRUE, new Double(7.0) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "e", new Integer(1), Boolean.TRUE, null }), //$NON-NLS-1$
- } );
+ metadata,
+ "pm2.g1", new List[] {
+ Arrays.asList(new Object[] { "b", new Integer(0), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "d", new Integer(3), Boolean.TRUE, new Double(7.0) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "e", new Integer(1), Boolean.TRUE, null }), //$NON-NLS-1$
+ } );
- // Group pm4.g1
- groupID = (FakeMetadataObject) metadata.getGroupID("pm4.g1"); //$NON-NLS-1$
- elementIDs = metadata.getElementIDsInGroupID(groupID);
- elementSymbols = FakeDataStore.createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList(new Object[] { "aa ", new Integer(0), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "bb ", new Integer(1), Boolean.TRUE, null }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "cc ", new Integer(2), Boolean.FALSE, new Double(0.0) }), //$NON-NLS-1$
- } );
-
-
+ metadata,
+ "pm4.g1", new List[] {
+ Arrays.asList(new Object[] { "aa ", new Integer(0), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "bb ", new Integer(1), Boolean.TRUE, null }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "cc ", new Integer(2), Boolean.FALSE, new Double(0.0) }), //$NON-NLS-1$
+ } );
} catch(TeiidException e) {
throw new RuntimeException(e);
}
}
- private void sampleData3(FakeDataManager dataMgr) {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- try {
- // Group pm1.g1
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g1"); //$NON-NLS-1$
- List elementSymbols = new ArrayList(1);
- ElementSymbol count = new ElementSymbol("Count"); //$NON-NLS-1$
- count.setType(Integer.class);
- elementSymbols.add(count);
-
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList(new Object[] { new Integer(1) }),
- } );
- }catch(TeiidException e) {
- throw new RuntimeException(e);
- }
- }
-
- private void sampleDataStringTimestamps(FakeDataManager dataMgr) {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
-
- try {
- // Group pm1.g1
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g1"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = FakeDataStore.createElements(elementIDs);
-
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
- new List[] {
- Arrays.asList(new Object[] { "Jan 01 2004 12:00:00", new Integer(0), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Dec 31 2004 12:00:00", new Integer(1), Boolean.TRUE, null }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Aug 01 2004 12:00:00", new Integer(2), Boolean.FALSE, new Double(0.0) }), //$NON-NLS-1$
- } );
-
-
- } catch(TeiidException e) {
- throw new RuntimeException(e);
- }
- }
-
private void sampleDataBQT1(FakeDataManager dataMgr) {
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
try {
// Group bqt1.smalla
@@ -562,7 +479,7 @@
}
private void sampleDataBQT2(FakeDataManager dataMgr) {
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
String[] groups = new String[] {"bqt1.smalla", "bqt2.smalla", "bqt3.smalla" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -593,7 +510,7 @@
* @since 4.2
*/
private void sampleDataBQT_defect11682(FakeDataManager dataMgr) {
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
try {
List[] tuples = new List[2];
@@ -627,7 +544,7 @@
}
private void sampleDataBQTSmall(FakeDataManager dataMgr) {
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
try {
List[] tuples = new List[1];
@@ -655,7 +572,7 @@
}
private void sampleDataBQT_case1566(FakeDataManager dataMgr) throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
dataMgr.registerTuples(metadata, "bqt1.smalla", new List[] { //$NON-NLS-1$
createRowWithTimestamp("2002-01-01 10:00:00"), //$NON-NLS-1$
@@ -704,7 +621,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -724,7 +641,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -744,7 +661,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -765,7 +682,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -785,7 +702,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -810,7 +727,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -840,7 +757,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -871,7 +788,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -893,7 +810,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -914,7 +831,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -939,7 +856,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -962,7 +879,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -987,7 +904,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1012,7 +929,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1038,7 +955,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1064,7 +981,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1088,7 +1005,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1112,7 +1029,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1133,7 +1050,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1158,10 +1075,10 @@
CommandContext context = createCommandContext();
context.setProcessorBatchSize(2);
context.setConnectorBatchSize(2);
- context.setMetadata(FakeMetadataFactory.example1Cached());
+ context.setMetadata(RealMetadataFactory.example1Cached());
// Plan query
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached(), new DefaultCapabilitiesFinder(), context);
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached(), new DefaultCapabilitiesFinder(), context);
// Run query
helpProcess(plan, context, dataManager, expected);
@@ -1182,7 +1099,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1211,7 +1128,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1231,7 +1148,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1254,7 +1171,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1277,7 +1194,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1302,7 +1219,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1325,7 +1242,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1353,7 +1270,7 @@
Arrays.asList(4),
});
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached(), TestOptimizer.getGenericFinder());
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached(), TestOptimizer.getGenericFinder());
CommandContext cc = createCommandContext();
cc.setProcessorBatchSize(2);
helpProcess(plan, cc, hdm, expected);
@@ -1379,7 +1296,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1402,7 +1319,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1428,7 +1345,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1454,7 +1371,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1480,7 +1397,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1506,7 +1423,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1532,7 +1449,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1558,7 +1475,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1577,7 +1494,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1597,34 +1514,12 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
}
- @Test public void testTempGroup() {
- // Create query
- String sql = "SELECT e1 FROM tm1.g1 WHERE e1 = 'a'"; //$NON-NLS-1$
-
- // Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "a" }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "a" }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "a" }) //$NON-NLS-1$
- };
-
- // Construct data manager with data
- FakeDataManager dataManager = new FakeDataManager();
- sampleData1(dataManager);
-
- // Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
-
- // Run query
- helpProcess(plan, dataManager, expected);
- }
-
@Test public void testSubquery1() {
// Create query
String sql = "SELECT e1 FROM (SELECT e1 FROM pm1.g1) AS x"; //$NON-NLS-1$
@@ -1644,7 +1539,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1669,7 +1564,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1691,7 +1586,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1713,7 +1608,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1743,7 +1638,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1768,7 +1663,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1793,7 +1688,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1816,7 +1711,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1840,7 +1735,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1863,7 +1758,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1885,7 +1780,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1908,7 +1803,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1931,7 +1826,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1953,7 +1848,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -1976,7 +1871,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2000,7 +1895,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2021,7 +1916,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2044,7 +1939,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2067,7 +1962,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2087,7 +1982,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2109,7 +2004,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2133,7 +2028,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2156,7 +2051,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2179,7 +2074,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2192,7 +2087,7 @@
String sql = "SELECT e1 FROM pm1.g1 WHERE e2 < SOME (SELECT e2 FROM pm2.g1 WHERE EXISTS (SELECT e2 FROM pm2.g1))"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
// Construct data manager with data
@@ -2235,7 +2130,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2259,7 +2154,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2277,7 +2172,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcessException(plan, dataManager);
@@ -2301,7 +2196,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2325,7 +2220,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2358,7 +2253,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.exampleBQTCached(), capFinder);
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.exampleBQTCached(), capFinder);
// Run query
helpProcess(plan, dataManager, expected);
@@ -2376,7 +2271,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2413,7 +2308,7 @@
String sql = "Select e1, e2, e4 from pm2.g1 where 1=2 " + //$NON-NLS-1$
"UNION ALL Select e1, e2, e4 from vm1.g1 outg1 where outg1.e2 in (select ing1.e2 FROM vm1.g1 ing1 WHERE outg1.e4 = ing1.e4)";//$NON-NLS-1$
Command command = helpParse(sql);
- ProcessorPlan plan = helpGetPlan(command, FakeMetadataFactory.example1Cached(), capFinder);
+ ProcessorPlan plan = helpGetPlan(command, RealMetadataFactory.example1Cached(), capFinder);
// Run query
List[] expected = new List[] {
@@ -2449,7 +2344,7 @@
// Plan query
String sql = "Select e1, e2, e4 from vm1.g1 outg1 where outg1.e2 in (select ing1.e2 FROM vm1.g1 ing1 WHERE outg1.e4 = ing1.e4)";//$NON-NLS-1$
Command command = helpParse(sql);
- ProcessorPlan plan = helpGetPlan(command, FakeMetadataFactory.example1Cached(), capFinder);
+ ProcessorPlan plan = helpGetPlan(command, RealMetadataFactory.example1Cached(), capFinder);
// Run query
List[] expected = new List[] {
@@ -2475,7 +2370,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2497,7 +2392,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2518,7 +2413,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2539,7 +2434,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2560,7 +2455,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2579,7 +2474,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2598,7 +2493,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2617,7 +2512,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2636,7 +2531,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2655,7 +2550,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2675,7 +2570,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2698,7 +2593,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2720,7 +2615,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2747,7 +2642,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2774,7 +2669,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2797,7 +2692,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2822,7 +2717,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2840,7 +2735,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2857,7 +2752,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2881,7 +2776,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2905,7 +2800,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2930,7 +2825,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2954,7 +2849,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2971,7 +2866,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -2996,7 +2891,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3013,7 +2908,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3032,7 +2927,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3055,7 +2950,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3079,7 +2974,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3106,7 +3001,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3134,7 +3029,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3153,7 +3048,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3175,7 +3070,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3197,7 +3092,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3221,7 +3116,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3244,7 +3139,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3267,7 +3162,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3290,7 +3185,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3314,7 +3209,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3338,7 +3233,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3359,7 +3254,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3384,7 +3279,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3405,7 +3300,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3430,7 +3325,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3455,7 +3350,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3489,7 +3384,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3514,7 +3409,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(query, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(query, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3536,7 +3431,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3556,7 +3451,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3581,7 +3476,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3603,7 +3498,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3626,7 +3521,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3637,21 +3532,14 @@
String sql = "EXEC pm1.sq1()"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "a", new Integer(0) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { null, new Integer(1) }),
- Arrays.asList(new Object[] { "a", new Integer(3) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "c", new Integer(1) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "b", new Integer(2) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "a", new Integer(0) }) //$NON-NLS-1$
- };
+ List[] expected = SP1RS;
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3673,7 +3561,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3698,7 +3586,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3720,7 +3608,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3731,21 +3619,14 @@
String sql = "EXEC pm1.sp1()"; //$NON-NLS-1$
// Create expected results
- List[] expected = new List[] {
- Arrays.asList(new Object[] { "a", new Integer(0) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { null, new Integer(1)}),
- Arrays.asList(new Object[] { "a", new Integer(3) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { "c", new Integer(1)}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "b", new Integer(2)}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "a", new Integer(0) }) //$NON-NLS-1$
- };
+ List[] expected = SP1RS;
// Construct data manager with data
- FakeDataManager dataManager = new FakeDataManager();
- sampleData1(dataManager);
+ HardcodedDataManager dataManager = new HardcodedDataManager();
+ dataManager.addData("EXEC pm1.sp1()", expected);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3766,11 +3647,11 @@
};
// Construct data manager with data
- FakeDataManager dataManager = new FakeDataManager();
- sampleData1(dataManager);
+ HardcodedDataManager dataManager = new HardcodedDataManager();
+ dataManager.addData("EXEC pm1.sp1()", SP1RS);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3793,7 +3674,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3813,7 +3694,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3836,7 +3717,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3859,7 +3740,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3875,11 +3756,11 @@
};
// Construct data manager with data
- FakeDataManager dataManager = new FakeDataManager();
- sampleData3(dataManager);
+ HardcodedDataManager dataManager = new HardcodedDataManager();
+ dataManager.addData("INSERT INTO pm1.g1 (pm1.g1.e1, pm1.g1.e2) VALUES ('MyString', 1)", new List[] {Arrays.asList(1)});
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3910,7 +3791,7 @@
sampleDataBQT1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.exampleBQTCached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.exampleBQTCached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3941,7 +3822,7 @@
sampleDataBQT1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.exampleBQTCached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.exampleBQTCached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3972,7 +3853,7 @@
sampleDataBQT1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.exampleBQTCached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.exampleBQTCached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -3997,7 +3878,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4026,7 +3907,7 @@
sampleDataBQT2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.exampleBQTCached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.exampleBQTCached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4065,7 +3946,7 @@
sampleDataBQT1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.exampleBQTCached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.exampleBQTCached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4085,7 +3966,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4107,7 +3988,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4141,7 +4022,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4171,7 +4052,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4205,7 +4086,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4235,7 +4116,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4257,7 +4138,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4277,7 +4158,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4297,7 +4178,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4327,7 +4208,7 @@
Command command = QueryParser.getQueryParser().parseCommand(sql);
// Plan query
- ProcessorPlan plan = helpGetPlan(command, FakeMetadataFactory.exampleBQTCached(), capFinder);
+ ProcessorPlan plan = helpGetPlan(command, RealMetadataFactory.exampleBQTCached(), capFinder);
// Run query
helpProcess(plan, dataManager, expected);
@@ -4350,7 +4231,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4373,7 +4254,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4396,7 +4277,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4421,7 +4302,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4444,7 +4325,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4562,7 +4443,7 @@
dataManager = hardCoded;
}
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_IN, pushDown);
@@ -4595,7 +4476,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4617,7 +4498,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4641,7 +4522,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4668,7 +4549,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4697,7 +4578,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4725,7 +4606,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4752,7 +4633,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4779,7 +4660,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4801,7 +4682,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4827,7 +4708,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4843,7 +4724,7 @@
};
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, new FakeDataManager(), expected);
@@ -4865,7 +4746,7 @@
sampleDataBQT_defect11682(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.exampleBQTCached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.exampleBQTCached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4886,7 +4767,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4905,7 +4786,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4925,7 +4806,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4945,7 +4826,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4966,7 +4847,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -4994,7 +4875,7 @@
capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
Command command = helpParse(sql);
- ProcessorPlan plan = helpGetPlan(command, FakeMetadataFactory.example1Cached(), capFinder);
+ ProcessorPlan plan = helpGetPlan(command, RealMetadataFactory.example1Cached(), capFinder);
// Run query
helpProcess(plan, dataManager, expected);
@@ -5007,7 +4888,7 @@
};
// Plan query
- ProcessorPlan plan = helpGetPlan("EXEC pm1.vsp36(5)", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ ProcessorPlan plan = helpGetPlan("EXEC pm1.vsp36(5)", RealMetadataFactory.example1Cached()); //$NON-NLS-1$
// Run query
helpProcess(plan, new FakeDataManager(), expected);
@@ -5024,11 +4905,17 @@
Command command = helpParse("SELECT e5, e2, e3, e4 FROM vm1.g1c WHERE e5 >= {ts'2004-08-01 00:00:00.0'}"); //$NON-NLS-1$
ProcessorPlan plan = helpGetPlan(command,
- FakeMetadataFactory.example1Cached(), capFinder);
+ RealMetadataFactory.example1Cached(), capFinder);
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
- sampleDataStringTimestamps(dataManager);
+ dataManager.registerTuples(
+ RealMetadataFactory.example1Cached(),
+ "pm1.g1", new List[] {
+ Arrays.asList(new Object[] { "Jan 01 2004 12:00:00", new Integer(0), Boolean.FALSE, new Double(2.0) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Dec 31 2004 12:00:00", new Integer(1), Boolean.TRUE, null }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Aug 01 2004 12:00:00", new Integer(2), Boolean.FALSE, new Double(0.0) }), //$NON-NLS-1$
+ } );
Calendar cal = Calendar.getInstance();
cal.set(2004, Calendar.DECEMBER, 31, 0, 0, 0);
@@ -5060,10 +4947,6 @@
Arrays.asList(new Object[] { "bb ", "b", new Integer(0) }) //$NON-NLS-1$ //$NON-NLS-2$
};
- // Construct data manager with data
- FakeDataManager dataManager = new FakeDataManager();
- sampleData2b(dataManager);
-
// Plan query
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -5075,12 +4958,14 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- FakeMetadataObject g1 = metadata.getStore().findObject("pm1.g1", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g1.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000));
- FakeMetadataObject g2 = metadata.getStore().findObject("pm2.g1", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g2.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1));
+ QueryMetadataInterface metadata = RealMetadataFactory.example1();
+ RealMetadataFactory.setCardinality("pm1.g1", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata);
+ RealMetadataFactory.setCardinality("pm2.g1", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1, metadata);
+ // Construct data manager with data
+ FakeDataManager dataManager = new FakeDataManager();
+ sampleData2b(dataManager, metadata);
+
Command command = helpParse(sql);
CommandContext context = createCommandContext();
context.setMetadata(metadata);
@@ -5107,10 +4992,6 @@
Arrays.asList(new Object[] { "bb ", "b", new Integer(0) }) //$NON-NLS-1$ //$NON-NLS-2$
};
- // Construct data manager with data
- FakeDataManager dataManager = new FakeDataManager();
- sampleData2b(dataManager);
-
// Plan query
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
@@ -5122,12 +5003,14 @@
capFinder.addCapabilities("pm4", caps); //$NON-NLS-1$
capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- FakeMetadataObject g1 = metadata.getStore().findObject("pm4.g1", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g1.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000));
- FakeMetadataObject g2 = metadata.getStore().findObject("pm2.g1", FakeMetadataObject.GROUP); //$NON-NLS-1$
- g2.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1));
+ QueryMetadataInterface metadata = RealMetadataFactory.example1();
+ RealMetadataFactory.setCardinality("pm4.g1", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY + 1000, metadata);
+ RealMetadataFactory.setCardinality("pm2.g1", RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1, metadata);
+ // Construct data manager with data
+ FakeDataManager dataManager = new FakeDataManager();
+ sampleData2b(dataManager, metadata);
+
Command command = helpParse(sql);
CommandContext context = createCommandContext();
context.setMetadata(metadata);
@@ -5169,7 +5052,7 @@
sampleDataBQT2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.exampleBQTCached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.exampleBQTCached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -5199,7 +5082,7 @@
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_COUNT_STAR, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -5235,7 +5118,7 @@
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -5264,10 +5147,9 @@
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setFunctionSupport("myrtrim", true); //$NON-NLS-1$
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
-
- FunctionLibrary funcLibrary = new FunctionLibrary(FakeMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new FakeFunctionMetadataSource(), true));
- FakeMetadataFacade metadata = new FakeMetadataFacade(FakeMetadataFactory.example1Cached().getStore(), funcLibrary);
+ QueryMetadataInterface metadata = RealMetadataFactory.createTransformationMetadata(RealMetadataFactory.example1Cached().getMetadataStore(), "example1", new FunctionTree("foo", new FakeFunctionMetadataSource(), true));
+
processPreparedStatement(sql, expected, dataManager, capFinder,
metadata, Arrays.asList("a "));
}
@@ -5313,8 +5195,7 @@
caps.setFunctionSupport("concat", true); //$NON-NLS-1$
capFinder.addCapabilities("pm4", caps); //$NON-NLS-1$
- FunctionLibrary funcLibrary = new FunctionLibrary(FakeMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new FakeFunctionMetadataSource(), true));
- FakeMetadataFacade metadata = new FakeMetadataFacade(FakeMetadataFactory.example1Cached().getStore(), funcLibrary);
+ QueryMetadataInterface metadata = RealMetadataFactory.createTransformationMetadata(RealMetadataFactory.example1Cached().getMetadataStore(), "example1", new FunctionTree("foo", new FakeFunctionMetadataSource(), true));
processPreparedStatement(sql, expected, dataManager, capFinder,
metadata, Arrays.asList("a"));
@@ -5332,7 +5213,7 @@
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -5363,7 +5244,7 @@
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -5411,7 +5292,7 @@
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -5459,7 +5340,7 @@
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -5495,7 +5376,7 @@
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_ORDERED, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -5533,7 +5414,7 @@
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_SUM, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -5572,7 +5453,7 @@
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_SUM, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -5605,7 +5486,7 @@
BasicSourceCapabilities caps = new BasicSourceCapabilities();
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -5644,7 +5525,7 @@
caps.setCapabilitySupport(Capability.QUERY_UNION, true);
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -5685,7 +5566,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -5703,7 +5584,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -5722,7 +5603,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -5741,7 +5622,7 @@
caps.setFunctionSupport("concat", true); //$NON-NLS-1$
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = TestOptimizer.helpPlan(sql,
metadata,
@@ -5803,7 +5684,7 @@
BasicSourceCapabilities caps = new BasicSourceCapabilities();
capFinder.addCapabilities("BQT1", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = TestOptimizer.helpPlan(sql,
metadata,
@@ -5878,7 +5759,7 @@
capFinder.addCapabilities("BQT2", new BasicSourceCapabilities()); //$NON-NLS-1$
Command command = helpParse(sql);
- ProcessorPlan plan = helpGetPlan(command, FakeMetadataFactory.exampleBQTCached(), capFinder);
+ ProcessorPlan plan = helpGetPlan(command, RealMetadataFactory.exampleBQTCached(), capFinder);
// Construct data manager with data
HardcodedDataManager dataManager = new HardcodedDataManager();
@@ -5926,7 +5807,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
}
@@ -5945,7 +5826,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -5967,7 +5848,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -5987,7 +5868,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -6007,7 +5888,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -6027,7 +5908,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -6047,7 +5928,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -6067,7 +5948,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -6087,13 +5968,13 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
}
- @Test public void testBitwiseAggregateProc() {
+ @Test public void testBitwiseAggregateProc() throws Exception {
// Create query
String sql = "EXEC virt.agg()"; //$NON-NLS-1$
@@ -6105,7 +5986,7 @@
};
// Plan query
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleBitwise();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBitwise();
ProcessorPlan plan = helpGetPlan(sql, metadata);
// Construct data manager with data
@@ -6116,30 +5997,17 @@
helpProcess(plan, dataManager, expected);
}
- private void sampleDataBitwise(FakeDataManager dataMgr, FakeMetadataFacade metadata) {
- try {
- // Group pm1.g1
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("phys.t"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = FakeDataStore.createElements(elementIDs);
-
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList(new Object[] { new Integer(0), "a", new Integer(1) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { new Integer(0), "a", new Integer(3) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { new Integer(0), "a", new Integer(16) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { new Integer(1), "b", new Integer(4) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { new Integer(2), "c", new Integer(2) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { new Integer(2), "c", new Integer(1) }), //$NON-NLS-1$
- } );
-
- } catch(Throwable e) {
- e.printStackTrace();
- fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ private void sampleDataBitwise(FakeDataManager dataMgr, QueryMetadataInterface metadata) throws Exception {
+ dataMgr.registerTuples(
+ metadata,
+ "phys.t", new List[] {
+ Arrays.asList(new Object[] { new Integer(0), "a", new Integer(1) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { new Integer(0), "a", new Integer(3) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { new Integer(0), "a", new Integer(16) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { new Integer(1), "b", new Integer(4) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { new Integer(2), "c", new Integer(2) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { new Integer(2), "c", new Integer(1) }), //$NON-NLS-1$
+ } );
}
@Test public void testFunctionGroupByInJoinCriteria() {
@@ -6158,41 +6026,33 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
}
- private FakeMetadataFacade createProjectErrorMetadata() {
- FakeMetadataObject p1 = FakeMetadataFactory.createPhysicalModel("p1"); //$NON-NLS-1$
- FakeMetadataObject t1 = FakeMetadataFactory.createPhysicalGroup("p1.t", p1); //$NON-NLS-1$
- List e1 = FakeMetadataFactory.createElements(t1, new String[] {"a", "b" }, new String[] { "string", "string" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ private TransformationMetadata createProjectErrorMetadata() {
+ MetadataStore metadataStore = new MetadataStore();
+ Schema p1 = RealMetadataFactory.createPhysicalModel("p1", metadataStore); //$NON-NLS-1$
+ Table t1 = RealMetadataFactory.createPhysicalGroup("t", p1); //$NON-NLS-1$
+ RealMetadataFactory.createElements(t1, new String[] {"a", "b" }, new String[] { "string", "string" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- FakeMetadataObject v1 = FakeMetadataFactory.createVirtualModel("v1"); //$NON-NLS-1$
+ Schema v1 = RealMetadataFactory.createVirtualModel("v1", metadataStore); //$NON-NLS-1$
QueryNode n1 = new QueryNode("SELECT convert(a, integer) as c, b FROM p1.t"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vt1 = FakeMetadataFactory.createVirtualGroup("v1.t1", v1, n1); //$NON-NLS-1$
- List vte1 = FakeMetadataFactory.createElements(vt1, new String[] {"c", "b" }, new String[] { "integer", "string" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ Table vt1 = RealMetadataFactory.createVirtualGroup("t1", v1, n1); //$NON-NLS-1$
+ RealMetadataFactory.createElements(vt1, new String[] {"c", "b" }, new String[] { "integer", "string" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
QueryNode n3 = new QueryNode("SELECT c, b FROM v1.t1 UNION ALL SELECT c, b FROM v1.t1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vu1 = FakeMetadataFactory.createVirtualGroup("v1.u1", v1, n3); //$NON-NLS-1$
- List vtu1 = FakeMetadataFactory.createElements(vu1, new String[] {"c", "b" }, new String[] { "integer", "string" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ Table vu1 = RealMetadataFactory.createVirtualGroup("u1", v1, n3); //$NON-NLS-1$
+ RealMetadataFactory.createElements(vu1, new String[] {"c", "b" }, new String[] { "integer", "string" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(p1);
- store.addObject(t1);
- store.addObjects(e1);
- store.addObject(v1);
- store.addObject(vt1);
- store.addObjects(vte1);
- store.addObject(vu1);
- store.addObjects(vtu1);
- return new FakeMetadataFacade(store);
+ return RealMetadataFactory.createTransformationMetadata(metadataStore, "projectError");
}
@Test public void testProjectionErrorOverUnionWithConvert() {
// Create query
- FakeMetadataFacade metadata = createProjectErrorMetadata();
+ QueryMetadataInterface metadata = createProjectErrorMetadata();
String sql = "SELECT COUNT(*) FROM v1.u1"; //$NON-NLS-1$
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
@@ -6221,7 +6081,7 @@
String sql = "update vm1.g39 set e2=3"; //$NON-NLS-1$
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached(), TestOptimizer.getGenericFinder());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached(), TestOptimizer.getGenericFinder());
// Construct data manager with data
HardcodedDataManager dataManager = new HardcodedDataManager();
@@ -6252,7 +6112,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -6264,18 +6124,16 @@
*
*/
@Test public void testInsertTempTableCreation() {
- FakeMetadataObject v1 = FakeMetadataFactory.createVirtualModel("v1"); //$NON-NLS-1$
+ MetadataStore metadataStore = new MetadataStore();
+ Schema v1 = RealMetadataFactory.createVirtualModel("v1", metadataStore); //$NON-NLS-1$
QueryNode n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN insert into #temp (var1) values (1); select #temp.var1 from #temp; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs = FakeMetadataFactory.createResultSet("rs", v1, new String[] { "var1" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER}); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject paramRS = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs); //$NON-NLS-1$
- FakeMetadataObject vp = FakeMetadataFactory.createVirtualProcedure("v1.vp", v1, Arrays.asList(new Object[] {paramRS}), n1); //$NON-NLS-1$
+ ColumnSet<Procedure> rs = RealMetadataFactory.createResultSet("rs", new String[] { "var1" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER}); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vp = RealMetadataFactory.createVirtualProcedure("vp", v1, null, n1); //$NON-NLS-1$
+ vp.setResultSet(rs);
+ QueryMetadataInterface metadata = RealMetadataFactory.createTransformationMetadata(metadataStore, "foo");
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(v1);
- store.addObject(vp);
+ ProcessorPlan plan = helpGetPlan("exec v1.vp()", metadata); //$NON-NLS-1$
- ProcessorPlan plan = helpGetPlan("exec v1.vp()", new FakeMetadataFacade(store)); //$NON-NLS-1$
-
List[] expected = new List[] {
Arrays.asList(new Object[] { new Integer(1) })
};
@@ -6283,18 +6141,16 @@
}
@Test public void testInsertTempTableCreation1() {
- FakeMetadataObject v1 = FakeMetadataFactory.createVirtualModel("v1"); //$NON-NLS-1$
+ MetadataStore metadataStore = new MetadataStore();
+ Schema v1 = RealMetadataFactory.createVirtualModel("v1", metadataStore); //$NON-NLS-1$
QueryNode n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN insert into #temp (var1) values (1); select 2 as var1 into #temp; select #temp.var1 from #temp; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs = FakeMetadataFactory.createResultSet("rs", v1, new String[] { "var1" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER}); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject paramRS = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs); //$NON-NLS-1$
- FakeMetadataObject vp = FakeMetadataFactory.createVirtualProcedure("v1.vp", v1, Arrays.asList(new Object[] {paramRS}), n1); //$NON-NLS-1$
+ ColumnSet<Procedure> rs = RealMetadataFactory.createResultSet("rs", new String[] { "var1" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER}); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vp = RealMetadataFactory.createVirtualProcedure("vp", v1, null, n1); //$NON-NLS-1$
+ vp.setResultSet(rs);
+ QueryMetadataInterface metadata = RealMetadataFactory.createTransformationMetadata(metadataStore, "foo");
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(v1);
- store.addObject(vp);
+ ProcessorPlan plan = helpGetPlan("exec v1.vp()", metadata); //$NON-NLS-1$
- ProcessorPlan plan = helpGetPlan("exec v1.vp()", new FakeMetadataFacade(store)); //$NON-NLS-1$
-
List[] expected = new List[] {
Arrays.asList(new Object[] { new Integer(1) }),
Arrays.asList(new Object[] { new Integer(2) })
@@ -6313,7 +6169,7 @@
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
Command command = helpParse(sql);
- ProcessorPlan plan = helpGetPlan(command, FakeMetadataFactory.exampleBQTCached(), capFinder);
+ ProcessorPlan plan = helpGetPlan(command, RealMetadataFactory.exampleBQTCached(), capFinder);
// Run query
// Create expected results
@@ -6334,7 +6190,7 @@
}
private void sampleDataBQT2a(FakeDataManager dataMgr) throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
String[] groups = new String[] {"bqt1.smalla", "bqt2.smalla", "bqt3.smalla" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -6388,7 +6244,7 @@
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
capFinder.addCapabilities("pm2", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -6425,7 +6281,7 @@
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT3", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -6455,7 +6311,7 @@
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT3", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -6485,7 +6341,7 @@
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT3", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -6515,7 +6371,7 @@
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT3", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -6545,7 +6401,7 @@
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT3", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -6575,7 +6431,7 @@
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT3", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -6605,7 +6461,7 @@
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT3", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -6635,7 +6491,7 @@
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT3", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -6665,7 +6521,7 @@
capFinder.addCapabilities("BQT2", caps); //$NON-NLS-1$
capFinder.addCapabilities("BQT3", caps); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -6690,7 +6546,7 @@
HardcodedDataManager dataManager = new HardcodedDataManager();
dataManager.addData("SELECT DISTINCT g_0.e1 FROM pm1.g3 AS g_0 WHERE g_0.e1 IN (SELECT g_0.e1 FROM pm1.g3 AS g_1)", expected); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// Plan query
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
@@ -6718,7 +6574,7 @@
// Plan query
String sql = "SELECT e1 FROM pm1.g2 WHERE LOOKUP('pm1.g1','e1', 'e2', 0) = e1";//$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
Command command = TestProcessor.helpParse(sql);
CommandContext context = createCommandContext();
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder, context);
@@ -6736,7 +6592,7 @@
@Test public void testRaiseNullWithSelectInto() {
String sql = "select pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4 into pm1.g2 from pm1.g1 where (1=0)"; //$NON-NLS-1$
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached(), TestOptimizer.getGenericFinder());
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached(), TestOptimizer.getGenericFinder());
TestOptimizer.checkNodeTypes(plan, new int[] {
0, // Access
@@ -6768,7 +6624,7 @@
*/
@Test public void testCase6219() {
String sql = "SELECT e1 FROM pm1.g1, (SELECT 'ACT' AS StateCode,'A' AS StateAbbrv UNION ALL SELECT 'NSW' AS StateCode, 'N' AS StateAbbrv) AS StateNames_Abbrvs WHERE (pm1.g1.e1 = StateCode) AND ((StateNames_Abbrvs.StateAbbrv || pm1.g1.e1) = 'VVIC')"; //$NON-NLS-1$
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached(), TestOptimizer.getGenericFinder());
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached(), TestOptimizer.getGenericFinder());
TestOptimizer.checkNodeTypes(plan, new int[] {
0, // Access
@@ -6799,7 +6655,7 @@
@Test public void testSortWithLimit() {
String sql = "select e1 from (select pm1.g1.e1, pm1.g1.e2 from pm1.g1 order by pm1.g1.e1, pm1.g1.e2 limit 1) x"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpGetPlan(helpParse(sql), metadata);
@@ -6815,7 +6671,7 @@
@Test public void testSortWithLimit1() {
String sql = "select c from (select pm1.g1.e1 a, pm1.g1.e2 b, pm1.g1.e3 c from pm1.g1 order by b limit 1) x"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpGetPlan(helpParse(sql), metadata);
@@ -6833,7 +6689,7 @@
@Test public void testSortWithLimit2() {
String sql = "select a from (select max(e2) a from pm1.g1 group by e2 order by a limit 1) x where a = 0"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpGetPlan(helpParse(sql), metadata, TestOptimizer.getGenericFinder());
@@ -6852,7 +6708,7 @@
@Test public void testSortWithLimit3() {
String sql = "select c from (select pm1.g1.e3 c from pm1.g1 order by pm1.g1.e2 limit 1) x"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpGetPlan(helpParse(sql), metadata, TestOptimizer.getGenericFinder());
@@ -6868,7 +6724,7 @@
@Test public void testSortWithLimit4() {
String sql = "select c from (select pm1.g1.e1 a, pm1.g1.e2 b, pm1.g1.e3 c from pm1.g1 order by b limit 1) x"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.QUERY_ORDERBY_UNRELATED, false);
@@ -6888,7 +6744,7 @@
@Test public void testCountWithHaving() {
String sql = "select e1, count(*) from pm1.g1 group by e1 having count(*) > 1"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpGetPlan(helpParse(sql), metadata, TestOptimizer.getGenericFinder());
@@ -6904,7 +6760,7 @@
@Test public void testLimitZero() {
String sql = "select e1 from pm1.g1 limit 0"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpGetPlan(helpParse(sql), metadata, TestOptimizer.getGenericFinder());
@@ -6921,7 +6777,7 @@
@Test public void testLimitZero1() {
String sql = "select distinct vm1.g1.e1, y.e1 from vm1.g1 left outer join (select 1 x, e1 from vm1.g2 limit 0) y on vm1.g1.e1 = y.e1 where vm1.g1.e1 = 'a'"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpGetPlan(helpParse(sql), metadata, TestOptimizer.getGenericFinder());
@@ -6954,7 +6810,7 @@
@Test public void testLimitZero2() {
String sql = "select vm1.g1.e1 from vm1.g1 union select e1 from pm1.g2 limit 0"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpGetPlan(helpParse(sql), metadata, TestOptimizer.getGenericFinder());
@@ -6974,7 +6830,7 @@
String sql = "select e1 from pm1.g2 limit 0"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpGetPlan(helpParse(sql), metadata, capFinder);
@@ -6989,7 +6845,7 @@
@Test public void testUnionWithTypeConversion() {
String sql = "select pm1.g1.e1, pm1.g1.e2 from pm1.g1 where e1 = 'b' union select e2, e1 from pm1.g2 where e1 = 'b' order by e1, e2"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpGetPlan(helpParse(sql), metadata, TestOptimizer.getGenericFinder());
@@ -7014,7 +6870,7 @@
@Test public void testNonDeterministicEvaluation() throws Exception {
String sql = "select e1, convert(rand()*1000, integer) as x from pm1.g1 where e1 = 'a'"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpGetPlan(helpParse(sql), metadata, TestOptimizer.getGenericFinder());
@@ -7035,7 +6891,7 @@
@Test public void testDeterministicEvaluation() throws Exception {
String sql = "select e1, convert(rand(0)*1000, integer) as x from pm1.g1 where e1 = 'a'"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpGetPlan(helpParse(sql), metadata, TestOptimizer.getGenericFinder());
@@ -7053,7 +6909,7 @@
@Test public void testEmptyAggregate() throws Exception {
String sql = "select count(e1) from pm1.g1 where 1 = 0"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpGetPlan(helpParse(sql), metadata, TestOptimizer.getGenericFinder());
@@ -7069,7 +6925,7 @@
@Test public void testNullAggregate() throws Exception {
String sql = "select count(*), count(e1), sum(convert(e1, integer)) from pm1.g1 where e1 is null"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpGetPlan(helpParse(sql), metadata, TestOptimizer.getGenericFinder());
@@ -7088,7 +6944,7 @@
@Test public void testNullAggregate1() throws Exception {
String sql = "select e1 from pm1.g1 where 1 = 0 group by e1"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpGetPlan(helpParse(sql), metadata, TestOptimizer.getGenericFinder());
@@ -7103,7 +6959,7 @@
@Test public void testReferenceReplacementWithExpression() throws Exception {
String sql = "select e1, e2 from (select e1, convert(e2, string) e2 from pm1.g1) x where exists (select e3 from pm1.g2 where x.e2 = e1)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpGetPlan(helpParse(sql), metadata, TestOptimizer.getGenericFinder());
@@ -7145,7 +7001,7 @@
sampleDataBQT2(dataManager);
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.exampleBQTCached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(),
new String[] {"SELECT b.intkey FROM bqt2.SMALLA AS b", "SELECT a.intkey FROM bqt1.smalla AS a"}, new DefaultCapabilitiesFinder(), ComparisonMode.CORRECTED_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -7191,7 +7047,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
new String[] {"SELECT a.e4, a.e2 FROM pm1.g1 AS a", "SELECT b.e4, b.e2 FROM pm1.g2 AS b"}, new DefaultCapabilitiesFinder(), ComparisonMode.CORRECTED_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -7234,7 +7090,7 @@
sampleData1(dataManager);
// Plan query
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(),
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(),
new String[] {"SELECT a.e4, a.e2 FROM pm1.g1 AS a", "SELECT b.e4, b.e2 FROM pm1.g2 AS b"}, new DefaultCapabilitiesFinder(), ComparisonMode.CORRECTED_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -7269,7 +7125,7 @@
caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
List[] expected = new List[] {
Arrays.asList("a", "b"), //$NON-NLS-1$ //$NON-NLS-2$
@@ -7301,7 +7157,7 @@
sampleData2(dataManager);
// Plan query
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
// Run query
helpProcess(plan, dataManager, expected);
@@ -7323,7 +7179,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData2(dataManager);
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null, capFinder, new String[] {"SELECT pm1.g1.e1 FROM pm1.g1 LIMIT 6"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), null, capFinder, new String[] {"SELECT pm1.g1.e1 FROM pm1.g1 LIMIT 6"}, TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
helpProcess(plan, dataManager, expected);
}
@@ -7341,7 +7197,7 @@
Arrays.asList(Integer.valueOf(2))
});
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
List[] expected = new List[] {
Arrays.asList(new Object[] { "b" }), //$NON-NLS-1$
@@ -7372,7 +7228,7 @@
" SELECT CONVERT(e2, long) AS e2 FROM pm1.g1 AS A WHERE e1 = 'a'" + //$NON-NLS-1$
") AS A"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpGetPlan(helpParse(sql), metadata, TestOptimizer.getGenericFinder());
@@ -7395,7 +7251,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached());
helpProcess(plan, dataManager, expected);
}
@@ -7419,7 +7275,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached());
helpProcess(plan, dataManager, expected);
}
@@ -7435,7 +7291,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached());
helpProcess(plan, dataManager, expected);
}
@@ -7454,7 +7310,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached());
helpProcess(plan, dataManager, expected);
}
@@ -7474,7 +7330,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached());
helpProcess(plan, dataManager, expected);
}
@@ -7495,7 +7351,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached());
helpProcess(plan, dataManager, expected);
}
@@ -7510,14 +7366,14 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached());
helpProcess(plan, dataManager, expected);
}
@Test public void testUncorrelatedScalarSubqueryPushdown() throws Exception {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
BasicSourceCapabilities caps = getTypicalCapabilities();
caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_SCALAR, false);
@@ -7543,7 +7399,7 @@
@Test public void testNonDeterministicScalarSubquery() throws Exception {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
BasicSourceCapabilities caps = getTypicalCapabilities();
caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_SCALAR, false);
@@ -7567,7 +7423,7 @@
@Test public void testUncorrelatedScalarSubqueryPushdown1() throws Exception {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
BasicSourceCapabilities caps = getTypicalCapabilities();
caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_SCALAR, false);
@@ -7601,7 +7457,7 @@
HardcodedDataManager dataManager = new HardcodedDataManager();
dataManager.addData("SELECT pm1.g1.e2, pm1.g1.e1 FROM pm1.g1", new List[] {Arrays.asList(1, "2"), Arrays.asList(3, "4")});
dataManager.addData("EXEC pm1.sp2(1)", new List[] {Arrays.asList("b", 2)});
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached());
helpProcess(plan, dataManager, expected);
}
@@ -7616,7 +7472,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached());
helpProcess(plan, dataManager, expected);
}
@@ -7631,7 +7487,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example4(), TestOptimizer.getGenericFinder());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example4(), TestOptimizer.getGenericFinder());
helpProcess(plan, dataManager, expected);
}
@@ -7646,7 +7502,9 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example4(), TestOptimizer.getGenericFinder());
+ BasicSourceCapabilities caps = getTypicalCapabilities();
+ caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, false);
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example4(), new DefaultCapabilitiesFinder(caps));
helpProcess(plan, dataManager, expected);
}
@@ -7659,7 +7517,7 @@
dataManager.addData("SELECT g_0.e1 FROM pm1.g1 AS g_0", new List[] {Arrays.asList(1)});
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached(), TestOptimizer.getGenericFinder());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached(), TestOptimizer.getGenericFinder());
helpProcess(plan, dataManager, new List[] {Arrays.asList(1, 1)});
}
@@ -7671,7 +7529,7 @@
dataManager.addData("SELECT 2 FROM pm1.g1 AS g_0", new List[] {Arrays.asList(2)});
- ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached(), TestOptimizer.getGenericFinder());
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached(), TestOptimizer.getGenericFinder());
helpProcess(plan, dataManager, new List[] {Arrays.asList(1, 2)});
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -43,7 +43,7 @@
import org.teiid.core.util.TimestampWithTimezone;
import org.teiid.core.util.UnitTestUtil;
import org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.unittest.TimestampUtil;
@SuppressWarnings({"nls", "unchecked"})
@@ -338,7 +338,7 @@
Arrays.asList(ObjectConverterUtil.convertToString(new FileInputStream(UnitTestUtil.getTestDataFile("udf.xmi")))),
};
- processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(), Arrays.asList(TestTextTable.clobFromFile("udf.xmi")));
+ processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), RealMetadataFactory.example1Cached(), Arrays.asList(TestTextTable.clobFromFile("udf.xmi")));
}
@Test public void testXmlParseBlob() throws Exception {
@@ -348,7 +348,7 @@
Arrays.asList(ObjectConverterUtil.convertToString(new FileInputStream(UnitTestUtil.getTestDataFile("udf.xmi")))),
};
- processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(), Arrays.asList(blobFromFile("udf.xmi")));
+ processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), RealMetadataFactory.example1Cached(), Arrays.asList(blobFromFile("udf.xmi")));
}
@Test public void testXmlParseBlobWithEncoding() throws Exception {
@@ -358,7 +358,7 @@
Arrays.asList(ObjectConverterUtil.convertToString(new InputStreamReader(new FileInputStream(UnitTestUtil.getTestDataFile("encoding.xml")), Charset.forName("ISO-8859-1")))),
};
- processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(), Arrays.asList(blobFromFile("encoding.xml")));
+ processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), RealMetadataFactory.example1Cached(), Arrays.asList(blobFromFile("encoding.xml")));
}
@Test public void testXmlTableTypes() throws Exception {
@@ -393,7 +393,7 @@
}
private void process(String sql, List<?>[] expected) throws Exception {
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached(), new DefaultCapabilitiesFinder(), createCommandContext());
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached(), new DefaultCapabilitiesFinder(), createCommandContext());
helpProcess(plan, createCommandContext(), dataManager, expected);
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestSecurityFunctions.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestSecurityFunctions.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestSecurityFunctions.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -30,7 +30,7 @@
import org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder;
import org.teiid.query.processor.ProcessorPlan;
import org.teiid.query.sql.lang.Command;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
import junit.framework.TestCase;
@@ -58,7 +58,7 @@
});
Command command = TestProcessor.helpParse(sql);
- ProcessorPlan plan = TestProcessor.helpGetPlan(command, FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = TestProcessor.helpGetPlan(command, RealMetadataFactory.example1Cached());
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
@@ -86,7 +86,7 @@
}});
Command command = TestProcessor.helpParse(sql);
- ProcessorPlan plan = TestProcessor.helpGetPlan(command, FakeMetadataFactory.example1Cached(), new DefaultCapabilitiesFinder(), context);
+ ProcessorPlan plan = TestProcessor.helpGetPlan(command, RealMetadataFactory.example1Cached(), new DefaultCapabilitiesFinder(), context);
// Run query
TestProcessor.helpProcess(plan, context, dataManager, expected);
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestSetProcessing.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestSetProcessing.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestSetProcessing.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -30,7 +30,7 @@
import org.teiid.query.optimizer.TestOptimizer.ComparisonMode;
import org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder;
import org.teiid.query.processor.ProcessorPlan;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
public class TestSetProcessing {
@@ -38,7 +38,7 @@
@Test public void testExcept() throws Exception {
String sql = "select e1, e2 from pm1.g2 except select e1, 1 from pm1.g2"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null, new DefaultCapabilitiesFinder(), new String[] {"SELECT pm1.g2.e1 FROM pm1.g2", "SELECT pm1.g2.e1, pm1.g2.e2 FROM pm1.g2"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), null, new DefaultCapabilitiesFinder(), new String[] {"SELECT pm1.g2.e1 FROM pm1.g2", "SELECT pm1.g2.e1, pm1.g2.e2 FROM pm1.g2"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
List<?>[] expected = new List[] {
Arrays.asList(new Object[] {"a", 0}), //$NON-NLS-1$
@@ -54,7 +54,7 @@
@Test public void testIntersect() throws Exception {
String sql = "select e1, e2 from pm1.g2 intersect select e1, 1 from pm1.g2"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null, new DefaultCapabilitiesFinder(), new String[] {"SELECT pm1.g2.e1 FROM pm1.g2", "SELECT pm1.g2.e1, pm1.g2.e2 FROM pm1.g2"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), null, new DefaultCapabilitiesFinder(), new String[] {"SELECT pm1.g2.e1 FROM pm1.g2", "SELECT pm1.g2.e1, pm1.g2.e2 FROM pm1.g2"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //$NON-NLS-2$
List<?>[] expected = new List[] {
Arrays.asList(new Object[] {null, 1}),
@@ -69,7 +69,7 @@
@Test public void testIntersectExcept() {
String sql = "select e1, e2 from pm1.g2 except select e1, 1 from pm1.g2 intersect select 'a', e2 from pm1.g2"; //$NON-NLS-1$
- ProcessorPlan plan = TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), new String[] {"SELECT g_0.e1 FROM pm1.g2 AS g_0", "SELECT g_0.e1, g_0.e2 FROM pm1.g2 AS g_0", "SELECT g_0.e2 FROM pm1.g2 AS g_0"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), new String[] {"SELECT g_0.e1 FROM pm1.g2 AS g_0", "SELECT g_0.e1, g_0.e2 FROM pm1.g2 AS g_0", "SELECT g_0.e2 FROM pm1.g2 AS g_0"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
List<?>[] expected = new List[] {
Arrays.asList(new Object[] {null, 1}),
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestTempTables.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestTempTables.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestTempTables.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -42,7 +42,7 @@
import org.teiid.query.optimizer.TestOptimizer.ComparisonMode;
import org.teiid.query.tempdata.TempTableDataManager;
import org.teiid.query.tempdata.TempTableStore;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
@SuppressWarnings({"nls", "unchecked"})
@@ -68,7 +68,7 @@
@Before public void setUp() {
tempStore = new TempTableStore("1"); //$NON-NLS-1$
- metadata = new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), tempStore.getMetadataStore());
+ metadata = new TempMetadataAdapter(RealMetadataFactory.example1Cached(), tempStore.getMetadataStore());
metadata.setSession(true);
FakeDataManager fdm = new FakeDataManager();
TestProcessor.sampleData1(fdm);
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestTextTable.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestTextTable.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestTextTable.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -37,13 +37,13 @@
import org.teiid.core.types.ClobType;
import org.teiid.core.types.InputStreamFactory;
import org.teiid.core.util.UnitTestUtil;
+import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.optimizer.TestOptimizer.ComparisonMode;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
@SuppressWarnings({"unchecked", "nls"})
public class TestTextTable {
@@ -72,7 +72,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(), Arrays.asList(clobFromFile("text/cdm_dos.txt")));
+ processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), RealMetadataFactory.example1Cached(), Arrays.asList(clobFromFile("text/cdm_dos.txt")));
}
@Test public void testTextTableFixedWin() throws Exception {
@@ -85,7 +85,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(), Arrays.asList(clobFromFile("text/cdm_dos_win.txt")));
+ processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), RealMetadataFactory.example1Cached(), Arrays.asList(clobFromFile("text/cdm_dos_win.txt")));
}
@Test public void testTextTableFixedPartial() throws Exception {
@@ -98,7 +98,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(), Arrays.asList(clobFromFile("text/cdm_dos.txt")));
+ processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), RealMetadataFactory.example1Cached(), Arrays.asList(clobFromFile("text/cdm_dos.txt")));
}
@Test public void testNamedMultilineHeader() throws Exception {
@@ -114,7 +114,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(), Arrays.asList(clobFromFile("text/test-file.txt.csv")));
+ processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), RealMetadataFactory.example1Cached(), Arrays.asList(clobFromFile("text/test-file.txt.csv")));
}
@Test public void testHeaderWithSkip() throws Exception {
@@ -127,7 +127,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(), Arrays.asList(clobFromFile("text/TextParts_HeaderRow2.csv")));
+ processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), RealMetadataFactory.example1Cached(), Arrays.asList(clobFromFile("text/TextParts_HeaderRow2.csv")));
}
@Test public void testEscape() throws Exception {
@@ -248,7 +248,7 @@
public static void process(String sql, List[] expectedResults) throws Exception {
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached());
helpProcess(plan, createCommandContext(), dataManager, expectedResults);
}
@@ -258,7 +258,7 @@
@Test public void testTextAgg() throws Exception {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
BasicSourceCapabilities caps = getTypicalCapabilities();
caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_SCALAR, false);
@@ -285,7 +285,7 @@
@Test public void testTextAggOrderByUnrelated() throws Exception {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
BasicSourceCapabilities caps = getTypicalCapabilities();
caps.setCapabilitySupport(Capability.QUERY_SUBQUERIES_SCALAR, false);
@@ -317,7 +317,7 @@
sampleData1(dataManager);
char[] data = new char[5000];
- processPreparedStatement(sql, null, dataManager, new DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(), Arrays.asList(new ClobType(new SerialClob(data))));
+ processPreparedStatement(sql, null, dataManager, new DefaultCapabilitiesFinder(), RealMetadataFactory.example1Cached(), Arrays.asList(new ClobType(new SerialClob(data))));
}
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestVirtualDepJoin.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestVirtualDepJoin.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestVirtualDepJoin.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -28,7 +28,6 @@
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -40,21 +39,24 @@
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidException;
import org.teiid.core.types.DataTypeManager;
+import org.teiid.metadata.Column;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Schema;
+import org.teiid.metadata.Table;
import org.teiid.query.mapping.relational.QueryNode;
+import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.optimizer.TestOptimizer;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
import org.teiid.query.sql.lang.Command;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
-import org.teiid.query.unittest.FakeMetadataStore;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.unittest.TimestampUtil;
import org.teiid.query.util.CommandContext;
import org.teiid.query.validator.TestValidator;
-
+@SuppressWarnings("nls")
public class TestVirtualDepJoin {
/**
@@ -65,37 +67,34 @@
* @param object2
* @since 4.3
*/
- private static void setStats(List elementObjects,
+ private static void setStats(List<Column> elementObjects,
int[] ndvs,
int[] nnvs,
String[] mins,
String[] maxs) {
-
- Iterator iter = elementObjects.iterator();
- for(int i=0; iter.hasNext(); i++) {
- FakeMetadataObject obj = (FakeMetadataObject) iter.next();
+ for (int i = 0; i < elementObjects.size(); i++) {
+ Column obj = elementObjects.get(i);
if(ndvs != null) {
- obj.putProperty(FakeMetadataObject.Props.DISTINCT_VALUES, new Integer(ndvs[i]));
+ obj.setDistinctValues(ndvs[i]);
}
if(nnvs != null) {
- obj.putProperty(FakeMetadataObject.Props.NULL_VALUES, new Integer(nnvs[i]));
+ obj.setNullValues(nnvs[i]);
}
if(mins != null) {
- obj.putProperty(FakeMetadataObject.Props.MIN_VALUE, mins[i]);
+ obj.setMinimumValue(mins[i]);
}
if(maxs != null) {
- obj.putProperty(FakeMetadataObject.Props.MAX_VALUE, maxs[i]);
+ obj.setMaximumValue(maxs[i]);
}
-
}
}
- public static FakeMetadataFacade exampleVirtualDepJoin() {
- FakeMetadataObject us = FakeMetadataFactory.createPhysicalModel("US"); //$NON-NLS-1$
- us.putProperty(FakeMetadataObject.Props.MAX_SET_SIZE, new Integer(0));
- FakeMetadataObject usAccts = FakeMetadataFactory.createPhysicalGroup("US.Accounts", us); //$NON-NLS-1$
- usAccts.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(1000000));
- List usAcctsElem = FakeMetadataFactory.createElements(usAccts,
+ public static TransformationMetadata exampleVirtualDepJoin() {
+ MetadataStore metadataStore = new MetadataStore();
+ Schema us = RealMetadataFactory.createPhysicalModel("US", metadataStore); //$NON-NLS-1$
+ Table usAccts = RealMetadataFactory.createPhysicalGroup("Accounts", us); //$NON-NLS-1$
+ usAccts.setCardinality(1000000);
+ List<Column> usAcctsElem = RealMetadataFactory.createElements(usAccts,
new String[] { "customer", "account", "txn", "txnid", "pennies" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
new String[] { DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER });
setStats(usAcctsElem,
@@ -105,11 +104,10 @@
new String[] {"1000", null, null, null, "-5"} // max per column - use defaults //$NON-NLS-1$ //$NON-NLS-2$
);
- FakeMetadataObject europe = FakeMetadataFactory.createPhysicalModel("Europe"); //$NON-NLS-1$
- europe.putProperty(FakeMetadataObject.Props.MAX_SET_SIZE, new Integer(0));
- FakeMetadataObject euAccts = FakeMetadataFactory.createPhysicalGroup("Europe.CustAccts", europe); //$NON-NLS-1$
- euAccts.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(1000000));
- List euAcctsElem = FakeMetadataFactory.createElements(euAccts,
+ Schema europe = RealMetadataFactory.createPhysicalModel("Europe", metadataStore); //$NON-NLS-1$
+ Table euAccts = RealMetadataFactory.createPhysicalGroup("CustAccts", europe); //$NON-NLS-1$
+ euAccts.setCardinality(1000000);
+ List<Column> euAcctsElem = RealMetadataFactory.createElements(euAccts,
new String[] { "id", "accid", "type", "amount" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.SHORT, DataTypeManager.DefaultDataTypes.BIG_DECIMAL });
setStats(euAcctsElem,
@@ -119,11 +117,10 @@
null // max per column - use defaults
);
- FakeMetadataObject cust = FakeMetadataFactory.createPhysicalModel("CustomerMaster"); //$NON-NLS-1$
- cust.putProperty(FakeMetadataObject.Props.MAX_SET_SIZE, new Integer(0));
- FakeMetadataObject customers = FakeMetadataFactory.createPhysicalGroup("CustomerMaster.Customers", cust); //$NON-NLS-1$
- customers.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(1000));
- List customersElem = FakeMetadataFactory.createElements(customers,
+ Schema cust = RealMetadataFactory.createPhysicalModel("CustomerMaster", metadataStore); //$NON-NLS-1$
+ Table customers = RealMetadataFactory.createPhysicalGroup("Customers", cust); //$NON-NLS-1$
+ customers.setCardinality(1000);
+ List<Column> customersElem = RealMetadataFactory.createElements(customers,
new String[] { "id", "first", "last", "birthday" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DATE });
setStats(customersElem,
@@ -132,9 +129,9 @@
null, // min per column - use defaults
null // max per column - use defaults
);
- FakeMetadataObject locations = FakeMetadataFactory.createPhysicalGroup("CustomerMaster.Locations", cust); //$NON-NLS-1$
- locations.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(1200));
- List locationsElem = FakeMetadataFactory.createElements(locations,
+ Table locations = RealMetadataFactory.createPhysicalGroup("Locations", cust); //$NON-NLS-1$
+ locations.setCardinality(1200);
+ List<Column> locationsElem = RealMetadataFactory.createElements(locations,
new String[] { "id", "location" }, //$NON-NLS-1$ //$NON-NLS-2$
new String[] { DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.STRING });
setStats(locationsElem,
@@ -144,46 +141,23 @@
null // max per column - use defaults
);
- FakeMetadataObject vAccts = FakeMetadataFactory.createVirtualModel("Accounts"); //$NON-NLS-1$
+ Schema vAccts = RealMetadataFactory.createVirtualModel("Accounts", metadataStore); //$NON-NLS-1$
QueryNode accountsPlan = new QueryNode("SELECT customer as customer_id, convert(account, long) as account_id, convert(txnid, long) as transaction_id, case txn when 'DEP' then 1 when 'TFR' then 2 when 'WD' then 3 else -1 end as txn_type, (pennies + convert('0.00', bigdecimal)) / 100 as amount, 'US' as source FROM US.Accounts where txn != 'X'" + //$NON-NLS-1$
"UNION ALL " + //$NON-NLS-1$
"SELECT id, convert(accid / 10000, long), mod(accid, 10000), convert(type, integer), amount, 'EU' from Europe.CustAccts"); //$NON-NLS-1$
- FakeMetadataObject accounts = FakeMetadataFactory.createVirtualGroup("Accounts.Accounts", vAccts, accountsPlan); //$NON-NLS-1$
- List accountsElem = FakeMetadataFactory.createElements(accounts,
+ Table accounts = RealMetadataFactory.createVirtualGroup("Accounts", vAccts, accountsPlan); //$NON-NLS-1$
+ RealMetadataFactory.createElements(accounts,
new String[] { "customer_id", "account_id", "transaction_id", "txn_type", "amount", "source" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
new String[] { DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BIG_DECIMAL, DataTypeManager.DefaultDataTypes.STRING });
- FakeMetadataObject master = FakeMetadataFactory.createVirtualModel("Master"); //$NON-NLS-1$
+ Schema master = RealMetadataFactory.createVirtualModel("Master", metadataStore); //$NON-NLS-1$
QueryNode masterPlan = new QueryNode("select id as CustomerID, First, Last, a.account_id as AccountID, transaction_id as TransactionID, txn_type AS TxnCode, Amount from CustomerMaster.Customers c, Accounts.Accounts a where c.id=a.customer_id"); //$NON-NLS-1$
- FakeMetadataObject transactions = FakeMetadataFactory.createVirtualGroup("Master.Transactions", master, masterPlan); //$NON-NLS-1$
- List transactionsElem = FakeMetadataFactory.createElements(transactions,
+ Table transactions = RealMetadataFactory.createVirtualGroup("Transactions", master, masterPlan); //$NON-NLS-1$
+ RealMetadataFactory.createElements(transactions,
new String[] { "CustomerID", "First", "Last", "AccountID", "TransactionID", "TxnCode", "Amount" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
new String[] { DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BIG_DECIMAL });
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(us);
- store.addObject(usAccts);
- store.addObjects(usAcctsElem);
-
- store.addObject(europe);
- store.addObject(euAccts);
- store.addObjects(euAcctsElem);
-
- store.addObject(cust);
- store.addObject(customers);
- store.addObjects(customersElem);
- store.addObject(locations);
- store.addObjects(locationsElem);
-
- store.addObject(vAccts);
- store.addObject(accounts);
- store.addObjects(accountsElem);
-
- store.addObject(master);
- store.addObject(transactions);
- store.addObjects(transactionsElem);
-
- return new FakeMetadataFacade(store);
+ return RealMetadataFactory.createTransformationMetadata(metadataStore, "virtualDepJoin");
}
@Test public void testVirtualDepJoinNoValues() throws Exception {
@@ -195,7 +169,7 @@
};
// Construct data manager with data
- FakeMetadataFacade metadata = exampleVirtualDepJoin();
+ QueryMetadataInterface metadata = exampleVirtualDepJoin();
FakeDataManager dataManager = new FakeDataManager();
sampleDataVirtualDepJoin(dataManager, metadata);
@@ -208,7 +182,7 @@
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, false);
finder.addCapabilities("Europe", caps);//$NON-NLS-1$
finder.addCapabilities("CustomerMaster", caps);//$NON-NLS-1$
- ProcessorPlan plan = TestProcessor.helpGetPlan(command, exampleVirtualDepJoin(), finder, context);
+ ProcessorPlan plan = TestProcessor.helpGetPlan(command, metadata, finder, context);
TestOptimizer.checkDependentJoinCount(plan, 1);
// Run query
@@ -235,7 +209,7 @@
};
// Construct data manager with data
- FakeMetadataFacade metadata = exampleVirtualDepJoin();
+ QueryMetadataInterface metadata = exampleVirtualDepJoin();
FakeDataManager dataManager = new FakeDataManager();
sampleDataVirtualDepJoin(dataManager, metadata);
@@ -251,7 +225,7 @@
finder.addCapabilities("US", caps); //$NON-NLS-1$
finder.addCapabilities("Europe", caps);//$NON-NLS-1$
finder.addCapabilities("CustomerMaster", caps);//$NON-NLS-1$
- ProcessorPlan plan = TestProcessor.helpGetPlan(command, exampleVirtualDepJoin(), finder, context);
+ ProcessorPlan plan = TestProcessor.helpGetPlan(command, metadata, finder, context);
// Check plan contents
int selectCount = !setPushdown ? 3 : 0;
@@ -302,7 +276,7 @@
};
// Construct data manager with data
- FakeMetadataFacade metadata = exampleVirtualDepJoin();
+ QueryMetadataInterface metadata = exampleVirtualDepJoin();
FakeDataManager dataManager = new FakeDataManager();
sampleDataVirtualDepJoin(dataManager, metadata);
@@ -317,7 +291,7 @@
finder.addCapabilities("US", caps1); //$NON-NLS-1$
finder.addCapabilities("Europe", caps2);//$NON-NLS-1$
finder.addCapabilities("CustomerMaster", caps1);//$NON-NLS-1$
- ProcessorPlan plan = TestProcessor.helpGetPlan(command, exampleVirtualDepJoin(), finder, context);
+ ProcessorPlan plan = TestProcessor.helpGetPlan(command, metadata, finder, context);
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
@@ -351,7 +325,7 @@
};
// Construct data manager with data
- FakeMetadataFacade metadata = exampleVirtualDepJoin();
+ QueryMetadataInterface metadata = exampleVirtualDepJoin();
FakeDataManager dataManager = new FakeDataManager();
sampleDataVirtualDepJoin(dataManager, metadata);
@@ -364,7 +338,7 @@
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, false);
finder.addCapabilities("Europe", caps);//$NON-NLS-1$
finder.addCapabilities("CustomerMaster", caps);//$NON-NLS-1$
- ProcessorPlan plan = TestProcessor.helpGetPlan(command, exampleVirtualDepJoin(), finder, context);
+ ProcessorPlan plan = TestProcessor.helpGetPlan(command, metadata, finder, context);
TestOptimizer.checkNodeTypes(plan, new int[] {
1, // Access
@@ -419,7 +393,7 @@
// Create query
String sql = "SELECT * from Master.Transactions where last = 'Davis' order by CustomerID, TransactionID"; //$NON-NLS-1$
- List expected = new LinkedList();
+ List<List<Object>> expected = new LinkedList<List<Object>>();
// Create expected results
@@ -460,7 +434,7 @@
expected.add(Arrays.asList(new Object[] { new Long(300), "CloneB", "Davis", new Long(630), new Long(1008), new Integer(2), new BigDecimal("62.00") })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// Construct data manager with data
- FakeMetadataFacade metadata = exampleVirtualDepJoin();
+ QueryMetadataInterface metadata = exampleVirtualDepJoin();
FakeDataManager dataManager = new FakeDataManager();
sampleDataVirtualDepJoin(dataManager, metadata);
overrideVirtualDepJoinData(dataManager, metadata, unique);
@@ -475,7 +449,7 @@
finder.addCapabilities("US", caps); //$NON-NLS-1$
finder.addCapabilities("Europe", caps);//$NON-NLS-1$
finder.addCapabilities("CustomerMaster", caps);//$NON-NLS-1$
- ProcessorPlan plan = TestProcessor.helpGetPlan(command, exampleVirtualDepJoin(), finder, context);
+ ProcessorPlan plan = TestProcessor.helpGetPlan(command, metadata, finder, context);
// Run query
BufferManager bufferMgr = createCustomBufferMgr(2);
@@ -515,7 +489,7 @@
};
// Construct data manager with data
- FakeMetadataFacade metadata = exampleVirtualDepJoin();
+ QueryMetadataInterface metadata = exampleVirtualDepJoin();
FakeDataManager dataManager = new FakeDataManager();
sampleDataVirtualDepJoin(dataManager, metadata);
@@ -527,102 +501,71 @@
finder.addCapabilities("US", caps); //$NON-NLS-1$
finder.addCapabilities("Europe", caps);//$NON-NLS-1$
finder.addCapabilities("CustomerMaster", caps);//$NON-NLS-1$
- ProcessorPlan plan = TestProcessor.helpGetPlan(command, exampleVirtualDepJoin(), finder);
+ ProcessorPlan plan = TestProcessor.helpGetPlan(command, metadata, finder);
// Run query
CommandContext context = TestProcessor.createCommandContext();
TestProcessor.helpProcess(plan, context, dataManager, expected);
}
- private void sampleDataVirtualDepJoin(FakeDataManager dataMgr, FakeMetadataFacade metadata) throws Exception {
+ private void sampleDataVirtualDepJoin(FakeDataManager dataMgr, QueryMetadataInterface metadata) throws Exception {
dataMgr.setBlockOnce();
- // Group US.Accounts
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("US.Accounts"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = FakeDataStore.createElements(elementIDs);
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList(new Object[] { new Long(100), new Integer(15000), "DEP", new Integer(123), new Integer(10000) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { new Long(100), new Integer(15000), "TFR", new Integer(127), new Integer(25000) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { new Long(100), new Integer(15000), "WD", new Integer(128), new Integer(100000) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { new Long(100), new Integer(15001), "DEP", new Integer(134), new Integer(1000) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { new Long(100), new Integer(15001), "DEP", new Integer(201), new Integer(1000) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { new Long(200), new Integer(16000), "WD", new Integer(207), new Integer(1234) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { new Long(200), new Integer(16000), "WD", new Integer(299), new Integer(95034) }), //$NON-NLS-1$
- Arrays.asList(new Object[] { new Long(200), new Integer(16000), "X", new Integer(301), new Integer(5000) }), //$NON-NLS-1$
- } );
+ metadata,
+ "US.Accounts", new List[] {
+ Arrays.asList(new Object[] { new Long(100), new Integer(15000), "DEP", new Integer(123), new Integer(10000) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { new Long(100), new Integer(15000), "TFR", new Integer(127), new Integer(25000) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { new Long(100), new Integer(15000), "WD", new Integer(128), new Integer(100000) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { new Long(100), new Integer(15001), "DEP", new Integer(134), new Integer(1000) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { new Long(100), new Integer(15001), "DEP", new Integer(201), new Integer(1000) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { new Long(200), new Integer(16000), "WD", new Integer(207), new Integer(1234) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { new Long(200), new Integer(16000), "WD", new Integer(299), new Integer(95034) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { new Long(200), new Integer(16000), "X", new Integer(301), new Integer(5000) }), //$NON-NLS-1$
+ } );
- // Group Europe.CustAccts
- groupID = (FakeMetadataObject) metadata.getGroupID("Europe.CustAccts"); //$NON-NLS-1$
- elementIDs = metadata.getElementIDsInGroupID(groupID);
- elementSymbols = FakeDataStore.createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList(new Object[] { new Long(100), new Long(5401002), new Short((short)1), new BigDecimal("7.20") }), //$NON-NLS-1$
- Arrays.asList(new Object[] { new Long(100), new Long(5401003), new Short((short)2), new BigDecimal("1000.00") }), //$NON-NLS-1$
- Arrays.asList(new Object[] { new Long(200), new Long(5501004), new Short((short)3), new BigDecimal("542.20") }), //$NON-NLS-1$
- Arrays.asList(new Object[] { new Long(200), new Long(5501005), new Short((short)1), new BigDecimal("99.99") }), //$NON-NLS-1$
- Arrays.asList(new Object[] { new Long(300), new Long(6201006), new Short((short)1), new BigDecimal("10000.00") }), //$NON-NLS-1$
- Arrays.asList(new Object[] { new Long(300), new Long(6201007), new Short((short)2), new BigDecimal("0.75") }), //$NON-NLS-1$
- Arrays.asList(new Object[] { new Long(300), new Long(6301008), new Short((short)2), new BigDecimal("62.00") }), //$NON-NLS-1$
- } );
+ metadata,
+ "Europe.CustAccts", new List[] {
+ Arrays.asList(new Object[] { new Long(100), new Long(5401002), new Short((short)1), new BigDecimal("7.20") }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { new Long(100), new Long(5401003), new Short((short)2), new BigDecimal("1000.00") }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { new Long(200), new Long(5501004), new Short((short)3), new BigDecimal("542.20") }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { new Long(200), new Long(5501005), new Short((short)1), new BigDecimal("99.99") }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { new Long(300), new Long(6201006), new Short((short)1), new BigDecimal("10000.00") }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { new Long(300), new Long(6201007), new Short((short)2), new BigDecimal("0.75") }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { new Long(300), new Long(6301008), new Short((short)2), new BigDecimal("62.00") }), //$NON-NLS-1$
+ } );
- // Group CustomerMaster.Customers
- groupID = (FakeMetadataObject) metadata.getGroupID("CustomerMaster.Customers"); //$NON-NLS-1$
- elementIDs = metadata.getElementIDsInGroupID(groupID);
- elementSymbols = FakeDataStore.createElements(elementIDs);
-
- dataMgr.registerTuples(groupID, elementSymbols,
- new List[] {
- Arrays.asList(new Object[] { new Long(100), "Miles", "Davis", TimestampUtil.createDate(1926, 4, 25) }), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList(new Object[] { new Long(200), "John", "Coltrane", TimestampUtil.createDate(1926, 8, 23) }), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList(new Object[] { new Long(300), "Thelonious", "Monk", TimestampUtil.createDate(1917, 9, 10) }), //$NON-NLS-1$ //$NON-NLS-2$
- } );
+ dataMgr.registerTuples(metadata, "CustomerMaster.Customers", new List[] {
+ Arrays.asList(new Object[] { new Long(100), "Miles", "Davis", TimestampUtil.createDate(1926, 4, 25) }), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList(new Object[] { new Long(200), "John", "Coltrane", TimestampUtil.createDate(1926, 8, 23) }), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList(new Object[] { new Long(300), "Thelonious", "Monk", TimestampUtil.createDate(1917, 9, 10) }), //$NON-NLS-1$ //$NON-NLS-2$
+ } );
- // Group CustomerMaster.Locations
- groupID = (FakeMetadataObject) metadata.getGroupID("CustomerMaster.Locations"); //$NON-NLS-1$
- elementIDs = metadata.getElementIDsInGroupID(groupID);
- elementSymbols = FakeDataStore.createElements(elementIDs);
-
- dataMgr.registerTuples(groupID, elementSymbols,
- new List[] {
- Arrays.asList(new Object[] { new Long(100), "US" }), //$NON-NLS-1$
- Arrays.asList(new Object[] { new Long(100), "EU" }), //$NON-NLS-1$
- Arrays.asList(new Object[] { new Long(200), "US" }), //$NON-NLS-1$
- Arrays.asList(new Object[] { new Long(200), "EU" }), //$NON-NLS-1$
- Arrays.asList(new Object[] { new Long(300), "EU" }), //$NON-NLS-1$
- } );
+ dataMgr.registerTuples(metadata, "CustomerMaster.Locations", new List[] {
+ Arrays.asList(new Object[] { new Long(100), "US" }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { new Long(100), "EU" }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { new Long(200), "US" }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { new Long(200), "EU" }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { new Long(300), "EU" }), //$NON-NLS-1$
+ } );
}
- private void overrideVirtualDepJoinData(FakeDataManager dataMgr, FakeMetadataFacade metadata, boolean unique) throws Exception {
+ private void overrideVirtualDepJoinData(FakeDataManager dataMgr, QueryMetadataInterface metadata, boolean unique) throws Exception {
// Group CustomerMaster.Customers
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("CustomerMaster.Customers"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = FakeDataStore.createElements(elementIDs);
+ List<List<?>> data = new LinkedList<List<?>>();
- TimestampUtil ts = new TimestampUtil();
-
- List data = new LinkedList();
-
- data.add(Arrays.asList(new Object[] { new Long(100), "Miles", "Davis", ts.createDate(1926, 4, 25) })); //$NON-NLS-1$ //$NON-NLS-2$
+ data.add(Arrays.asList(new Object[] { new Long(100), "Miles", "Davis", TimestampUtil.createDate(1926, 4, 25) })); //$NON-NLS-1$ //$NON-NLS-2$
if (!unique) {
- data.add(Arrays.asList(new Object[] { new Long(100), "Miles", "Davis", ts.createDate(1926, 4, 25) })); //$NON-NLS-1$ //$NON-NLS-2$
+ data.add(Arrays.asList(new Object[] { new Long(100), "Miles", "Davis", TimestampUtil.createDate(1926, 4, 25) })); //$NON-NLS-1$ //$NON-NLS-2$
}
- data.add(Arrays.asList(new Object[] { new Long(200), "CloneA", "Davis", ts.createDate(1926, 4, 26) })); //$NON-NLS-1$ //$NON-NLS-2$
- data.add(Arrays.asList(new Object[] { new Long(300), "CloneB", "Davis", ts.createDate(1926, 4, 27) })); //$NON-NLS-1$ //$NON-NLS-2$
- data.add(Arrays.asList(new Object[] { new Long(400), "CloneC", "Davis", ts.createDate(1926, 4, 28) })); //$NON-NLS-1$ //$NON-NLS-2$
+ data.add(Arrays.asList(new Object[] { new Long(200), "CloneA", "Davis", TimestampUtil.createDate(1926, 4, 26) })); //$NON-NLS-1$ //$NON-NLS-2$
+ data.add(Arrays.asList(new Object[] { new Long(300), "CloneB", "Davis", TimestampUtil.createDate(1926, 4, 27) })); //$NON-NLS-1$ //$NON-NLS-2$
+ data.add(Arrays.asList(new Object[] { new Long(400), "CloneC", "Davis", TimestampUtil.createDate(1926, 4, 28) })); //$NON-NLS-1$ //$NON-NLS-2$
dataMgr.registerTuples(
- groupID,
- elementSymbols, (List[])data.toArray(new List[data.size()]));
+ metadata,
+ "CustomerMaster.Customers", (List[])data.toArray(new List[data.size()]));
}
@Test public void testVirtualAccessVirtualDep() throws Exception {
@@ -686,7 +629,7 @@
};
// Construct data manager with data
- FakeMetadataFacade metadata = exampleVirtualDepJoin();
+ QueryMetadataInterface metadata = exampleVirtualDepJoin();
FakeDataManager dataManager = new FakeDataManager();
sampleDataVirtualDepJoin(dataManager, metadata);
@@ -699,7 +642,7 @@
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, false);
finder.addCapabilities("Europe", caps);//$NON-NLS-1$
finder.addCapabilities("CustomerMaster", caps);//$NON-NLS-1$
- ProcessorPlan plan = TestProcessor.helpGetPlan(command, exampleVirtualDepJoin(), finder, context);
+ ProcessorPlan plan = TestProcessor.helpGetPlan(command, metadata, finder, context);
TestOptimizer.checkNodeTypes(plan, new int[] {
2, // Access
@@ -735,7 +678,7 @@
};
// Construct data manager with data
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestWithClauseProcessing.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestWithClauseProcessing.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestWithClauseProcessing.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -12,7 +12,7 @@
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
@SuppressWarnings({"nls", "unchecked"})
public class TestWithClauseProcessing {
@@ -30,7 +30,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached());
helpProcess(plan, dataManager, expected);
}
@@ -50,7 +50,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached());
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached());
helpProcess(plan, dataManager, expected);
}
@@ -67,7 +67,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null, capFinder, new String[] {"WITH a (x, y, z) AS (SELECT g_0.e1, g_0.e2, g_0.e3 FROM pm1.g1 AS g_0) SELECT g_0.x FROM a AS g_0, a AS g_1"}, ComparisonMode.EXACT_COMMAND_STRING);
+ TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), null, capFinder, new String[] {"WITH a (x, y, z) AS (SELECT g_0.e1, g_0.e2, g_0.e3 FROM pm1.g1 AS g_0) SELECT g_0.x FROM a AS g_0, a AS g_1"}, ComparisonMode.EXACT_COMMAND_STRING);
}
@Test public void testWithPushdownWithConstants() throws TeiidException {
@@ -82,7 +82,7 @@
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
- TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null, capFinder, new String[] {"WITH a (x, y) AS (SELECT 1, 2 FROM pm1.g1 AS g_0) SELECT g_0.x FROM a AS g_0, a AS g_1"}, ComparisonMode.EXACT_COMMAND_STRING);
+ TestOptimizer.helpPlan(sql, RealMetadataFactory.example1Cached(), null, capFinder, new String[] {"WITH a (x, y) AS (SELECT 1, 2 FROM pm1.g1 AS g_0) SELECT g_0.x FROM a AS g_0, a AS g_1"}, ComparisonMode.EXACT_COMMAND_STRING);
}
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -60,7 +60,7 @@
import org.teiid.query.sql.symbol.TestCaseExpression;
import org.teiid.query.sql.symbol.TestSearchedCaseExpression;
import org.teiid.query.sql.util.ValueIterator;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
@SuppressWarnings("nls")
@@ -194,7 +194,7 @@
e2.setType(String.class);
Function func = new Function("concat", new Expression[] { e1, e2 }); //$NON-NLS-1$
- FunctionDescriptor desc = FakeMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("concat", new Class[] { String.class, String.class } ); //$NON-NLS-1$
+ FunctionDescriptor desc = RealMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("concat", new Class[] { String.class, String.class } ); //$NON-NLS-1$
func.setFunctionDescriptor(desc);
SingleElementSymbol[] elements = new SingleElementSymbol[] {
@@ -216,7 +216,7 @@
e2.setType(String.class);
Function func = new Function("concat", new Expression[] { e2, e1 }); //$NON-NLS-1$
- FunctionDescriptor desc = FakeMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("concat", new Class[] { String.class, String.class } ); //$NON-NLS-1$
+ FunctionDescriptor desc = RealMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("concat", new Class[] { String.class, String.class } ); //$NON-NLS-1$
func.setFunctionDescriptor(desc);
SingleElementSymbol[] elements = new SingleElementSymbol[] {
@@ -237,7 +237,7 @@
e1.setType(Integer.class);
Function func = new Function("lookup", new Expression[] { new Constant("pm1.g1"), new Constant("e2"), new Constant("e1"), e1 }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- FunctionDescriptor desc = FakeMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("lookup", new Class[] { String.class, String.class, String.class, String.class } ); //$NON-NLS-1$
+ FunctionDescriptor desc = RealMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("lookup", new Class[] { String.class, String.class, String.class, String.class } ); //$NON-NLS-1$
func.setFunctionDescriptor(desc);
SingleElementSymbol[] elements = new SingleElementSymbol[] {
@@ -309,7 +309,7 @@
@Test public void testUser() throws Exception {
Function func = new Function("user", new Expression[] {}); //$NON-NLS-1$
- FunctionDescriptor desc = FakeMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("user", new Class[] {} ); //$NON-NLS-1$
+ FunctionDescriptor desc = RealMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("user", new Class[] {} ); //$NON-NLS-1$
func.setFunctionDescriptor(desc);
FakeDataManager dataMgr = new FakeDataManager();
@@ -326,7 +326,7 @@
*/
@Test public void testEnv() throws Exception {
Function func = new Function("env", new Expression[] {}); //$NON-NLS-1$
- FunctionDescriptor desc = FakeMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("env", new Class[] {String.class} ); //$NON-NLS-1$
+ FunctionDescriptor desc = RealMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("env", new Class[] {String.class} ); //$NON-NLS-1$
func.setFunctionDescriptor(desc);
FakeDataManager dataMgr = new FakeDataManager();
@@ -352,7 +352,7 @@
} else {
parameterSignature = new Class[] { String.class };
}
- FunctionDescriptor desc = FakeMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("commandpayload", parameterSignature ); //$NON-NLS-1$
+ FunctionDescriptor desc = RealMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("commandpayload", parameterSignature ); //$NON-NLS-1$
func.setFunctionDescriptor(desc);
FakeDataManager dataMgr = new FakeDataManager();
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -33,9 +33,14 @@
import org.teiid.api.exception.query.QueryProcessingException;
import org.teiid.api.exception.query.QueryValidatorException;
import org.teiid.client.metadata.ParameterInfo;
-import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidException;
import org.teiid.core.types.DataTypeManager;
+import org.teiid.metadata.ColumnSet;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Procedure;
+import org.teiid.metadata.ProcedureParameter;
+import org.teiid.metadata.Schema;
+import org.teiid.metadata.Table;
import org.teiid.query.analysis.AnalysisRecord;
import org.teiid.query.mapping.relational.QueryNode;
import org.teiid.query.metadata.QueryMetadataInterface;
@@ -59,11 +64,6 @@
import org.teiid.query.rewriter.QueryRewriter;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.lang.SPParameter;
-import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
-import org.teiid.query.unittest.FakeMetadataStore;
import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
import org.teiid.query.validator.Validator;
@@ -125,131 +125,76 @@
helpTestProcess(procPlan, new List[] {Arrays.asList(expectedRows)}, dataMgr, metadata);
}
- // Helper to create a list of elements - used in creating sample data
- private static List createElements(List elementIDs) {
- List elements = new ArrayList();
- for(int i=0; i<elementIDs.size(); i++) {
- FakeMetadataObject elementID = (FakeMetadataObject) elementIDs.get(i);
- ElementSymbol element = new ElementSymbol(elementID.getName());
- elements.add(element);
- }
-
- return elements;
- }
-
- private FakeDataManager exampleDataManager(FakeMetadataFacade metadata) throws QueryMetadataException, TeiidComponentException {
+ private FakeDataManager exampleDataManager(QueryMetadataInterface metadata) throws TeiidException {
FakeDataManager dataMgr = new FakeDataManager();
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g1"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Second", new Integer(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
- } );
+ metadata,
+ "pm1.g1", new List[] {
+ Arrays.asList( new Object[] { "First", Integer.valueOf(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Second", Integer.valueOf(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", Integer.valueOf(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
+ } );
- groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g2"); //$NON-NLS-1$
- elementIDs = metadata.getElementIDsInGroupID(groupID);
- elementSymbols = createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Second", new Integer(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
- } );
+ metadata,
+ "pm1.g2", new List[] {
+ Arrays.asList( new Object[] { "First", Integer.valueOf(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Second", Integer.valueOf(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", Integer.valueOf(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
+ } );
return dataMgr;
}
- private FakeDataManager exampleDataManager2(FakeMetadataFacade metadata) throws QueryMetadataException, TeiidComponentException {
+ private FakeDataManager exampleDataManager2(QueryMetadataInterface metadata) throws TeiidException {
FakeDataManager dataMgr = new FakeDataManager();
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g1"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Second", new Integer(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
- } );
+ metadata,
+ "pm1.g1", new List[] {
+ Arrays.asList( new Object[] { "First", Integer.valueOf(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Second", Integer.valueOf(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", Integer.valueOf(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
+ } );
- groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g2"); //$NON-NLS-1$
- elementIDs = metadata.getElementIDsInGroupID(groupID);
- elementSymbols = createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Second", new Integer(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
- } );
+ metadata,
+ "pm1.g2", new List[] {
+ Arrays.asList( new Object[] { "First", Integer.valueOf(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Second", Integer.valueOf(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", Integer.valueOf(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
+ } );
- groupID = (FakeMetadataObject) metadata.getGroupID("pm2.g1"); //$NON-NLS-1$
- elementIDs = metadata.getElementIDsInGroupID(groupID);
- elementSymbols = createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Second", new Integer(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
- } );
+ metadata,
+ "pm2.g1", new List[] {
+ Arrays.asList( new Object[] { "First", Integer.valueOf(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Second", Integer.valueOf(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", Integer.valueOf(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
+ } );
- groupID = (FakeMetadataObject) metadata.getGroupID("pm2.g2"); //$NON-NLS-1$
- elementIDs = metadata.getElementIDsInGroupID(groupID);
- elementSymbols = createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Second", new Integer(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
- } );
+ metadata,
+ "pm2.g2", new List[] {
+ Arrays.asList( new Object[] { "First", Integer.valueOf(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Second", Integer.valueOf(15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", Integer.valueOf(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
+ } );
return dataMgr;
}
- private FakeDataManager exampleDataManagerPm5(FakeMetadataFacade metadata) throws QueryMetadataException, TeiidComponentException {
+ private FakeDataManager exampleDataManagerPm5(QueryMetadataInterface metadata) throws TeiidException {
FakeDataManager dataMgr = new FakeDataManager();
- // Group stock.items
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm5.g3"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "First", new Short((short)5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Second", new Short((short)15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", new Short((short)51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
- } );
+ metadata,
+ "pm5.g3", new List[] {
+ Arrays.asList( new Object[] { "First", new Short((short)5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Second", new Short((short)15), new Boolean(true), new Double(2.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", new Short((short)51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
+ } );
return dataMgr;
}
@@ -264,7 +209,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure);
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -287,7 +232,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure);
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -310,7 +255,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure);
FakeDataManager dataMgr = exampleDataManager(metadata);
dataMgr.setBlockOnce();
@@ -332,7 +277,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e2=40"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure);
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -362,7 +307,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e2=45"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure);
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -391,7 +336,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e2=45"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure);
FakeDataManager dataMgr = exampleDataManager(metadata);
dataMgr.setBlockOnce();
@@ -419,7 +364,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e2=45"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure);
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -437,7 +382,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure);
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -474,7 +419,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure);
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -494,7 +439,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure);
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -522,7 +467,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e2=30"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure);
FakeDataManager dataMgr = new FakeDataManager();
FakeDataStore.sampleData2(dataMgr);
@@ -550,7 +495,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e2=30"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure);
FakeDataManager dataMgr = new FakeDataManager();
FakeDataStore.sampleData2(dataMgr);
@@ -561,7 +506,7 @@
@Test public void testVirtualProcedure() throws Exception {
String userUpdateStr = "EXEC pm1.vsp2()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -578,7 +523,7 @@
@Test public void testVirtualProcedureWithBlockedException() throws Exception {
String userUpdateStr = "EXEC pm1.vsp2()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
FakeDataManager dataMgr = exampleDataManager(metadata);
dataMgr.setBlockOnce();
@@ -596,7 +541,7 @@
@Test public void testVirtualProcedure2() throws Exception {
String userUpdateStr = "EXEC pm1.vsp3()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -611,7 +556,7 @@
@Test public void testVirtualProcedure3() throws Exception {
String userUpdateStr = "EXEC pm1.vsp4()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -626,7 +571,7 @@
@Test public void testVirtualProcedure4() throws Exception {
String userUpdateStr = "EXEC pm1.vsp5()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -641,7 +586,7 @@
@Test public void testVirtualProcedure5() throws Exception {
String userUpdateStr = "EXEC pm1.vsp6()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -656,7 +601,7 @@
@Test public void testVirtualProcedure6() throws Exception {
String userUpdateStr = "EXEC pm1.vsp7(5)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -671,7 +616,7 @@
@Test public void testVirtualProcedure7() throws Exception {
String userUpdateStr = "EXEC pm1.vsp8(51)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -686,7 +631,7 @@
@Test public void testVirtualProcedure8() throws Exception {
String userUpdateStr = "EXEC pm1.vsp9(51)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -701,7 +646,7 @@
@Test public void testVirtualProcedure9() throws Exception {
String userUpdateStr = "EXEC pm1.vsp10(51)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -716,7 +661,7 @@
@Test public void testVirtualProcedure10() throws Exception {
String userUpdateStr = "EXEC pm1.vsp13()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -724,13 +669,13 @@
// Create expected results
List[] expected = new List[] {
- Arrays.asList(new Object[] { "Third", new Integer(5)})}; //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third", Integer.valueOf(5)})}; //$NON-NLS-1$
helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedure11() throws Exception {
String userUpdateStr = "EXEC pm1.vsp14()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// Set up data
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -746,24 +691,18 @@
@Test public void testVirtualProcedure12() throws Exception {
String userUpdateStr = "EXEC pm1.vsp15()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// Set up data
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g2"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
- } );
+ metadata,
+ "pm1.g2", new List[] {
+ Arrays.asList( new Object[] { "First", Integer.valueOf(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", Integer.valueOf(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
+ } );
// Create expected results
List[] expected = new List[] {
@@ -775,25 +714,19 @@
//Defect17447_testVirtualProcedure13
@Test public void testVirtualProcedure13() throws Exception {
String userUpdateStr = "EXEC pm1.vsp16()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// Set up data
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g2"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
- } );
+ metadata,
+ "pm1.g2", new List[] {
+ Arrays.asList( new Object[] { "First", Integer.valueOf(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", Integer.valueOf(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
+ } );
// Create expected results
List[] expected = new List[] {
@@ -804,7 +737,7 @@
@Test public void testVirtualProcedure14() throws Exception {
String userUpdateStr = "EXEC pm1.vsp17()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// Set up data
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -818,7 +751,7 @@
@Test public void testVirtualProcedure15() throws Exception {
String userUpdateStr = "EXEC pm1.vsp19()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// Set up data
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -838,7 +771,7 @@
@Test public void testVirtualProcedure16() throws Exception {
String userUpdateStr = "EXEC pm1.vsp20()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// Set up data
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -858,7 +791,7 @@
@Test public void testVirtualProcedure17() throws Exception {
String userUpdateStr = "EXEC pm1.vsp21(7)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
//Set up data
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -866,16 +799,16 @@
// Create expected results
List[] expected = new List[] {
- Arrays.asList(new Object[] { "First", new Integer(5)}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Second", new Integer(15)}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third", new Integer(51)}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Fourth", new Integer(7)})}; //$NON-NLS-1$
+ Arrays.asList(new Object[] { "First", Integer.valueOf(5)}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second", Integer.valueOf(15)}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third", Integer.valueOf(51)}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Fourth", Integer.valueOf(7)})}; //$NON-NLS-1$
helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedure18() throws Exception {
String userUpdateStr = "EXEC pm1.vsp22(7)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
//Set up data
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -883,14 +816,14 @@
// Create expected results
List[] expected = new List[] {
- Arrays.asList(new Object[] { "Second", new Integer(15)}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third", new Integer(51)}) }; //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second", Integer.valueOf(15)}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third", Integer.valueOf(51)}) }; //$NON-NLS-1$
helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedure19() throws Exception {
String userUpdateStr = "EXEC pm1.vsp23(7)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
//Set up data
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -898,26 +831,26 @@
// Create expected results
List[] expected = new List[] {
- Arrays.asList(new Object[] { "Second", new Integer(15)})}; //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second", Integer.valueOf(15)})}; //$NON-NLS-1$
helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedure19WithBlockedException() throws Exception {
String userUpdateStr = "EXEC pm1.vsp23(7)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
//Set up data
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
// Create expected results
List[] expected = new List[] {
- Arrays.asList(new Object[] { "Second", new Integer(15)})}; //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second", Integer.valueOf(15)})}; //$NON-NLS-1$
helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testVirtualProcedureNoDataInTempTable() throws Exception {
String userUpdateStr = "EXEC pm1.vsp25()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
//Set up data
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -946,7 +879,7 @@
String userUpdateStr = "UPDATE g4 SET e1='x' where e2=5"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure);
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -957,7 +890,7 @@
@Test public void testVirtualProcedure30() throws Exception {
String userUpdateStr = "EXEC pm1.vsp30()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
@@ -974,7 +907,7 @@
@Test public void testVirtualProcedure31() throws Exception {
String userUpdateStr = "EXEC pm1.vsp31(51)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
// Set up data
@@ -989,7 +922,7 @@
@Test public void testVirtualProcedureDefect14282() throws Exception {
String userUpdateStr = "EXEC pm1.vsp24()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -1003,7 +936,7 @@
@Test public void testDefect16193() throws Exception {
String userUpdateStr = "EXEC pm1.vsp35(51)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
// Set up data
@@ -1017,33 +950,23 @@
@Test public void testVirtualProcedure16602() throws Exception {
String userUpdateStr = "EXEC pm1.vsp37()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
// Set up data
- FakeDataManager dataMgr = exampleDataManager(metadata);
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g1"); //$NON-NLS-1$
- List elementSymbols = new ArrayList();
- ElementSymbol element = new ElementSymbol("Count"); //$NON-NLS-1$
- elementSymbols.add(element);
+ HardcodedDataManager dataMgr = new HardcodedDataManager();
+ dataMgr.addData("INSERT INTO pm1.g1 (e1, e2, e3, e4) VALUES (null, 5, UNKNOWN, null)", new List[] {Arrays.asList(1)});
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
- new List[] {
- Arrays.asList( new Object[] { new Integer(1) } )
- } );
-
// Create expected results
List[] expected = new List[] {
- Arrays.asList(new Object[] { new Integer(1)})};
+ Arrays.asList(1)};
helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDefect16649_1() throws Exception {
String userUpdateStr = "EXEC pm1.vsp38()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
// Set up data
@@ -1057,7 +980,7 @@
@Test public void testDefect16649_2() throws Exception {
String userUpdateStr = "EXEC pm1.vsp39()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
// Set up data
@@ -1071,7 +994,7 @@
@Test public void testDefect16694() throws Exception {
String userUpdateStr = "EXEC pm1.vsp40()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
// Set up data
@@ -1085,7 +1008,7 @@
@Test public void testDefect16707() throws Exception {
String userUpdateStr = "EXEC pm1.vsp44(2)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
// Set up data
@@ -1101,7 +1024,7 @@
@Test public void testDefect16707_1() throws Exception {
String userUpdateStr = "EXEC pm1.vsp43(2)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
// Set up data
@@ -1117,25 +1040,19 @@
@Test public void testDefect17451() throws Exception {
String userUpdateStr = "EXEC pm1.vsp45()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
//Set up data
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
-
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g2"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "First", new Integer(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", new Integer(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
- } );
+ metadata,
+ "pm1.g2", new List[] {
+ Arrays.asList( new Object[] { "First", Integer.valueOf(5), new Boolean(true), new Double(1.003)} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", Integer.valueOf(51), new Boolean(true), new Double(3.003)} ) //$NON-NLS-1$
+ } );
// Create expected results
List[] expected = new List[] {
@@ -1147,7 +1064,7 @@
//Defect 17447
@Test public void testVirtualProcedure46() throws Exception {
String userUpdateStr = "EXEC pm1.vsp46()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
@@ -1181,7 +1098,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x' where e2=5"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure1, procedure2);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure1, procedure2);
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -1192,7 +1109,7 @@
@Test public void testDefect19982() throws Exception {
String userUpdateStr = "EXEC pm1.vsp55(5)"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
// Set up data
@@ -1200,16 +1117,16 @@
// Create expected results
List[] expected = new List[] {
- Arrays.asList(new Object[] { "First", new Integer(5)}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Second", new Integer(5)}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third", new Integer(5)})}; //$NON-NLS-1$
+ Arrays.asList(new Object[] { "First", Integer.valueOf(5)}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second", Integer.valueOf(5)}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third", Integer.valueOf(5)})}; //$NON-NLS-1$
helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testCase3521() throws Exception {
String userUpdateStr = "EXEC pm1.vsp1()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -1242,7 +1159,7 @@
String userUpdateStr = "UPDATE g4 SET e1='x' where e2=5"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure);
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -1254,21 +1171,14 @@
@Test public void testDynamicCommandWithIntoExpression() throws Exception {
//Test INTO clause with expression
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "execute string 'SELECT e1 FROM pm1.g1 WHERE e1 = ''First''' as x string into #temp; declare string VARIABLES.RESULT = select x from #temp;select VARIABLES.RESULT; END"); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.example1();
+ String query = "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "execute string 'SELECT e1 FROM pm1.g1 WHERE e1 = ''First''' as x string into #temp; declare string VARIABLES.RESULT = select x from #temp;select VARIABLES.RESULT; END";
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
+ addProc(metadata, query);
+
+ String userUpdateStr = "EXEC pm1.sq2()"; //$NON-NLS-1$
- String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
-
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
@@ -1279,16 +1189,31 @@
};
helpTestProcess(plan, expected, dataMgr, metadata);
}
+
+ private void addProc(TransformationMetadata metadata, String query)
+ throws QueryMetadataException {
+ addProc(metadata, "sq2", query, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }, new String[0], new String[0]);
+ }
+
+ private void addProc(TransformationMetadata metadata, String name, String query, String[] rsCols, String[] rsTypes, String[] params, String[] paramTypes)
+ throws QueryMetadataException {
+ Schema pm1 = metadata.getMetadataStore().getSchema("PM1"); //$NON-NLS-1$
+ pm1.getProcedures().remove(name.toUpperCase());
+ ColumnSet<Procedure> rs2 = RealMetadataFactory.createResultSet("rs1", rsCols, rsTypes);
+ QueryNode sq2n1 = new QueryNode(query); //$NON-NLS-1$
+ ArrayList<ProcedureParameter> procParams = new ArrayList<ProcedureParameter>(params.length);
+ for (int i = 0; i < params.length; i++) {
+ procParams.add(RealMetadataFactory.createParameter(params[i], SPParameter.IN, paramTypes[i]));
+ }
+ Procedure sq1 = RealMetadataFactory.createVirtualProcedure(name, pm1, procParams, sq2n1); //$NON-NLS-1$
+ sq1.setResultSet(rs2);
+ }
@Test public void testDynamicCommandWithIntoAndLoop() throws Exception {
//Test INTO clause with loop
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+ TransformationMetadata metadata = RealMetadataFactory.example1();
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n"); //$NON-NLS-1$
procedure.append("BEGIN\n"); //$NON-NLS-1$
procedure.append("declare integer VARIABLES.e2_total=0;\n"); //$NON-NLS-1$
@@ -1301,13 +1226,9 @@
procedure.append("SELECT VARIABLES.e2_total;\n"); //$NON-NLS-1$
procedure.append("END"); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode(procedure.toString()); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
+ addProc(metadata, procedure.toString());
- String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
+ String userUpdateStr = "EXEC pm1.sq2()"; //$NON-NLS-1$
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -1315,26 +1236,18 @@
//Create expected results
List[] expected = new List[] {
- Arrays.asList(new Object[] { new Integer(66)}),
+ Arrays.asList(new Object[] { Integer.valueOf(66)}),
};
helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDynamicCommandWithParameter() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+ TransformationMetadata metadata = RealMetadataFactory.example1();
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "execute string 'SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq2.in' as e1 string, e2 integer; END"); //$NON-NLS-1$ //
- FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
+ addProc(metadata, "sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "execute string 'SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq2.in' as e1 string, e2 integer; END", new String[] { "e1", "e2" }
+ , new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }, new String[] {"in"}, new String[] {DataTypeManager.DefaultDataTypes.STRING});
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq2);
-
String userUpdateStr = "EXEC pm1.sq2('First')"; //$NON-NLS-1$
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -1343,26 +1256,18 @@
// Create expected results
List[] expected = new List[] {
- Arrays.asList(new Object[] { "First", new Integer(5) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "First", Integer.valueOf(5) }), //$NON-NLS-1$
};
helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDynamicCommandWithUsing() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+ TransformationMetadata metadata = RealMetadataFactory.example1();
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+ addProc(metadata, "sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "execute string 'SELECT e1, e2 FROM pm1.g1 WHERE e1=using.id' using id=pm1.sq2.in; END", new String[] { "e1", "e2" }
+ , new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }, new String[] {"in"}, new String[] {DataTypeManager.DefaultDataTypes.STRING});
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "execute string 'SELECT e1, e2 FROM pm1.g1 WHERE e1=using.id' using id=pm1.sq2.in; END"); //$NON-NLS-1$
- FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq2);
-
String userUpdateStr = "EXEC pm1.sq2('First')"; //$NON-NLS-1$
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -1371,26 +1276,18 @@
// Create expected results
List[] expected = new List[] {
- Arrays.asList(new Object[] { "First", new Integer(5) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "First", Integer.valueOf(5) }), //$NON-NLS-1$
};
helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDynamicCommandWithVariable() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+ TransformationMetadata metadata = RealMetadataFactory.example1();
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+ addProc(metadata, "sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "declare string VARIABLES.x; VARIABLES.x = pm1.sq2.in; execute string 'SELECT e1, e2 FROM pm1.g1 WHERE e1=VARIABLES.x'; END", new String[] { "e1", "e2" }
+ , new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }, new String[] {"in"}, new String[] {DataTypeManager.DefaultDataTypes.STRING});
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "declare string VARIABLES.x; VARIABLES.x = pm1.sq2.in; execute string 'SELECT e1, e2 FROM pm1.g1 WHERE e1=VARIABLES.x'; END"); //$NON-NLS-1$
- FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq2);
-
String userUpdateStr = "EXEC pm1.sq2('First')"; //$NON-NLS-1$
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -1399,26 +1296,18 @@
// Create expected results
List[] expected = new List[] {
- Arrays.asList(new Object[] { "First", new Integer(5) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "First", Integer.valueOf(5) }), //$NON-NLS-1$
};
helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDynamicCommandValidationFails() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+ TransformationMetadata metadata = RealMetadataFactory.example1();
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+ addProc(metadata, "sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "declare object VARIABLES.x; execute string 'SELECT xmlelement(name elem, x)'; select 1; END", new String[] { "e1", "e2" }
+ , new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }, new String[] {"in"}, new String[] {DataTypeManager.DefaultDataTypes.STRING});
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "declare object VARIABLES.x; execute string 'SELECT xmlelement(name elem, x)'; select 1; END"); //$NON-NLS-1$
- FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq2);
-
String userUpdateStr = "EXEC pm1.sq2('First')"; //$NON-NLS-1$
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -1434,21 +1323,13 @@
}
@Test public void testDynamicCommandWithSingleSelect() throws Exception {
- //Test select of a single value in a DynamicCommand
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+ TransformationMetadata metadata = RealMetadataFactory.example1();
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
- FakeMetadataObject rs1 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs1); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "execute string 'SELECT 26'; END"); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
+ addProc(metadata, "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "execute string 'SELECT 26'; END");
- metadata.getStore().addObject(rs1);
- metadata.getStore().addObject(sq1);
+ String userUpdateStr = "EXEC pm1.sq2()"; //$NON-NLS-1$
- String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
-
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
@@ -1463,20 +1344,12 @@
//converts e1 from integer to string, with a different name
@Test public void testDynamicCommandTypeConversion() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "declare string VARIABLES.x; VARIABLES.x = 'a'; execute string 'SELECT e2 ' || ' FROM pm1.g1 ' || ' where e1=pm1.sq2.in'; END"); //$NON-NLS-1$ //
- FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq2);
-
+ TransformationMetadata metadata = RealMetadataFactory.example1();
+
+ addProc(metadata, "sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "declare string VARIABLES.x; VARIABLES.x = 'a'; execute string 'SELECT e2 ' || ' FROM pm1.g1 ' || ' where e1=pm1.sq2.in'; END", new String[] { "e1" }
+ , new String[] { DataTypeManager.DefaultDataTypes.STRING }, new String[] {"in"}, new String[] {DataTypeManager.DefaultDataTypes.STRING});
+
String userUpdateStr = "EXEC pm1.sq2('First')"; //$NON-NLS-1$
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -1491,24 +1364,12 @@
}
@Test public void testDynamicCommandRecursion() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+ TransformationMetadata metadata = RealMetadataFactory.example1();
+
+ addProc(metadata, "sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "execute string 'EXEC pm1.sq2(''First'')' as e1 string, e2 integer; END", new String[] { "e1", "e2" }
+ , new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }, new String[] {"in"}, new String[] {DataTypeManager.DefaultDataTypes.STRING});
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory
- .createResultSet("pm1.rs2", pm1, new String[] {"e1", "e2"}, new String[] {DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs2p1 = FakeMetadataFactory
- .createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory
- .createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "execute string 'EXEC pm1.sq2(''First'')' as e1 string, e2 integer; END"); //$NON-NLS-1$ //
- FakeMetadataObject sq2 = FakeMetadataFactory
- .createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] {rs2p1, rs2p2}), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq2);
-
String userUpdateStr = "EXEC pm1.sq2('First')"; //$NON-NLS-1$
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -1522,25 +1383,16 @@
@Test public void testDynamicCommandIncorrectProjectSymbolCount() throws Exception {
//Tests dynamic query with incorrect number of elements
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+ TransformationMetadata metadata = RealMetadataFactory.example1();
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "SELECT pm1.g1.e1 FROM pm1.g1; END"); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- QueryNode sq2n2 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "execute string 'EXEC pm1.sq1(''First'')' as e1 string, e2 integer; END"); //$NON-NLS-1$
- FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n2); //$NON-NLS-1$
+ addProc(metadata, "sq1", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "SELECT pm1.g1.e1 FROM pm1.g1; END", new String[] { "e1" }
+ , new String[] { DataTypeManager.DefaultDataTypes.STRING }, new String[] {"in"}, new String[] {DataTypeManager.DefaultDataTypes.STRING});
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
- metadata.getStore().addObject(sq2);
-
+ addProc(metadata, "sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "execute string 'EXEC pm1.sq1(''First'')' as e1 string, e2 integer; END", new String[] { "e1" }
+ , new String[] { DataTypeManager.DefaultDataTypes.STRING }, new String[] {"in"}, new String[] {DataTypeManager.DefaultDataTypes.STRING});
+
String userUpdateStr = "EXEC pm1.sq2('test')"; //$NON-NLS-1$
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -1551,23 +1403,14 @@
}
@Test public void testDynamicCommandPositional() throws Exception {
- //Tests dynamic query with incorrect number of elements
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+ TransformationMetadata metadata = RealMetadataFactory.example1();
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+ addProc(metadata, "sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "execute string 'select e1 as x, e2 from pm1.g1'; END", new String[] { "e1", "e2" }
+ , new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING }, new String[] {"in"}, new String[] {DataTypeManager.DefaultDataTypes.STRING});
+
+ String userUpdateStr = "EXEC pm1.sq2('test')"; //$NON-NLS-1$
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "execute string 'select e1 as x, e2 from pm1.g1'; END"); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
-
- String userUpdateStr = "EXEC pm1.sq1('test')"; //$NON-NLS-1$
-
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
@@ -1578,23 +1421,13 @@
}
@Test public void testDynamicCommandIncorrectProjectSymbolDatatypes() throws Exception {
- //Tests dynamic query with a different datatype definition for an element in the AS clause that
- //has no implicit conversion.
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+ TransformationMetadata metadata = RealMetadataFactory.example1();
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+ addProc(metadata, "sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "execute string 'select e1 from pm1.g1'; END", new String[] { "e1"}, new String[] { DataTypeManager.DefaultDataTypes.INTEGER}, new String[0], new String[0]); //$NON-NLS-1$
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "execute string 'select e1 from pm1.g1'; END"); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
+ String userUpdateStr = "EXEC pm1.sq2()"; //$NON-NLS-1$
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
-
- String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
-
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
@@ -1604,19 +1437,12 @@
@Test public void testDynamicCommandWithTwoDynamicStatements() throws Exception {
//Tests dynamic query with two consecutive DynamicCommands. The first without an AS clause and returning different results.
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+ TransformationMetadata metadata = RealMetadataFactory.example1();
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+ addProc(metadata, "sq1", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "execute string 'select e1 as x, e2 from pm1.g1'; END", new String[] { "e1", "e2" }
+ , new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING }, new String[0], new String[0]);
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "execute string 'select e1 from pm1.g1'; execute string 'select e1, e2 from pm1.g1' as e1 string, e2 integer; END"); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
-
String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -1625,15 +1451,15 @@
// Create expected results
List[] expected = new List[] {
- Arrays.asList(new Object[] { "First", new Integer(5)}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Second", new Integer(15)}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third", new Integer(51)})}; //$NON-NLS-1$
+ Arrays.asList(new Object[] { "First", "5"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second", "15"}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third", "51"})}; //$NON-NLS-1$
helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testAssignmentWithCase() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+ TransformationMetadata metadata = RealMetadataFactory.example1();
String sql = new StringBuffer("declare integer caseValue = ") //$NON-NLS-1$
.append("CASE") //$NON-NLS-1$
@@ -1644,18 +1470,9 @@
.append(" ELSE 9999") //$NON-NLS-1$
.append(" END").toString(); //$NON-NLS-1$
+ addProc(metadata, "sq1", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + sql + "; SELECT caseValue; END", new String[] { "e1"}, new String[] { DataTypeManager.DefaultDataTypes.INTEGER}, new String[] {"param"}, new String[] {DataTypeManager.DefaultDataTypes.STRING}); //$NON-NLS-1$
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("param", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- FakeMetadataObject rs1 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs1); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + sql + "; SELECT caseValue; END"); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs1);
- metadata.getStore().addObject(sq1);
-
String userUpdateStr = "EXEC pm1.sq1('d')"; //$NON-NLS-1$
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -1664,7 +1481,7 @@
// Create expected results
List[] expected = new List[] {
- Arrays.asList(new Object[] { new Integer(3) }),
+ Arrays.asList(new Object[] { Integer.valueOf(3) }),
};
helpTestProcess(plan, expected, dataMgr, metadata);
}
@@ -1672,50 +1489,35 @@
@Test public void testDynamicCommandInsertIntoTempTableWithDifferentDatatypeFromSource() throws Exception {
//Tests dynamic query with insert into a temp table using data returned from a physical table.
//See defect 23394
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+ TransformationMetadata metadata = RealMetadataFactory.example1();
- FakeMetadataObject pm5 = metadata.getStore().findObject("pm5",FakeMetadataObject.MODEL); //$NON-NLS-1$
- FakeMetadataObject rs1 = FakeMetadataFactory.createResultSet("pm5.rs1", pm5, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.SHORT}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs1); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "execute string 'select e1,e2 from pm5.g3' as e1 string, e2 integer INTO #temp; select * from #temp; END"); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm5.sq1", pm5, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1 ); //$NON-NLS-1$
+ addProc(metadata, "sq2", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "execute string 'select e1,e2 from pm5.g3' as e1 string, e2 integer INTO #temp; select * from #temp; END", new String[] { "e1", "e2"}, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.SHORT}, new String[0], new String[0]); //$NON-NLS-1$
- metadata.getStore().addObject(rs1);
- metadata.getStore().addObject(sq1);
+ String userUpdateStr = "EXEC pm1.sq2()"; //$NON-NLS-1$
- String userUpdateStr = "EXEC pm5.sq1()"; //$NON-NLS-1$
-
FakeDataManager dataMgr = exampleDataManagerPm5(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
// Create expected results
List[] expected = new List[] {
- Arrays.asList(new Object[] { "First", new Integer(5)}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Second", new Integer(15)}), //$NON-NLS-1$
- Arrays.asList(new Object[] { "Third", new Integer(51)})}; //$NON-NLS-1$
+ Arrays.asList(new Object[] { "First", Integer.valueOf(5)}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Second", Integer.valueOf(15)}), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "Third", Integer.valueOf(51)})}; //$NON-NLS-1$
helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testDynamicCommandWithVariableOnly() throws Exception {
//Tests dynamic query with only a variable that represents thte entire dynamic query.
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+ TransformationMetadata metadata = RealMetadataFactory.example1();
- FakeMetadataObject pm5 = metadata.getStore().findObject("pm5",FakeMetadataObject.MODEL); //$NON-NLS-1$
- FakeMetadataObject rs1 = FakeMetadataFactory.createResultSet("pm5.rs1", pm5, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.SHORT}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("param", 1, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.SHORT, rs1); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("ret", 2, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs1); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "DECLARE string VARIABLES.CRIT = 'select e1, e2 from pm5.g3 where e2=using.id'; execute string VARIABLES.CRIT USING ID = pm5.sq1.param; END"); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm5.sq1", pm5, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1 ); //$NON-NLS-1$
+ addProc(metadata, "sq1", "CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "DECLARE string VARIABLES.CRIT = 'select e1, e2 from pm5.g3 where e2=using.id'; execute string VARIABLES.CRIT USING ID = pm1.sq1.param; END", new String[] { "e1", "e2"}, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.SHORT}, new String[] {"param"}, new String[] {DataTypeManager.DefaultDataTypes.SHORT}); //$NON-NLS-1$
- metadata.getStore().addObject(rs1);
- metadata.getStore().addObject(sq1);
+ String userUpdateStr = "EXEC pm1.sq1(convert(5,short))"; //$NON-NLS-1$
- String userUpdateStr = "EXEC pm5.sq1(convert(5,short))"; //$NON-NLS-1$
-
FakeDataManager dataMgr = exampleDataManagerPm5(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
@@ -1729,7 +1531,7 @@
@Test public void testVirtualProcedureWithCreate() throws Exception{
String userUpdateStr = "EXEC pm1.vsp60()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -1746,7 +1548,7 @@
@Test public void testVirtualProcedureWithCreateAndDrop() throws Exception{
String userUpdateStr = "EXEC pm1.vsp61()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -1763,7 +1565,7 @@
@Test public void testVirtualProcedureWithCreateAndSelectInto() throws Exception{
String userUpdateStr = "EXEC pm1.vsp62()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -1779,12 +1581,8 @@
@Test public void testDifferentlyScopedTempTables() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+ TransformationMetadata metadata = RealMetadataFactory.example1();
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n"); //$NON-NLS-1$
procedure.append("BEGIN\n"); //$NON-NLS-1$
procedure.append("declare integer VARIABLES.e2_total=0;\n"); //$NON-NLS-1$
@@ -1801,13 +1599,9 @@
procedure.append("SELECT VARIABLES.e2_total;\n"); //$NON-NLS-1$
procedure.append("END"); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode(procedure.toString()); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
+ addProc(metadata, procedure.toString());
- String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
+ String userUpdateStr = "EXEC pm1.sq2()"; //$NON-NLS-1$
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -1815,19 +1609,15 @@
//Create expected results
List[] expected = new List[] {
- Arrays.asList(new Object[] { new Integer(3)}),
+ Arrays.asList(new Object[] { Integer.valueOf(3)}),
};
helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testLoopsWithBreak() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+ TransformationMetadata metadata = RealMetadataFactory.example1();
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n"); //$NON-NLS-1$
procedure.append("BEGIN\n"); //$NON-NLS-1$
procedure.append("declare integer VARIABLES.e2_total=0;\n"); //$NON-NLS-1$
@@ -1843,13 +1633,9 @@
procedure.append("SELECT VARIABLES.e2_total;\n"); //$NON-NLS-1$
procedure.append("END"); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode(procedure.toString()); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
+ addProc(metadata, procedure.toString());
- String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
+ String userUpdateStr = "EXEC pm1.sq2()"; //$NON-NLS-1$
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -1857,19 +1643,15 @@
//Create expected results
List[] expected = new List[] {
- Arrays.asList(new Object[] { new Integer(76)}),
+ Arrays.asList(new Object[] { Integer.valueOf(76)}),
};
helpTestProcess(plan, expected, dataMgr, metadata);
}
@Test public void testCreateWithoutDrop() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+ TransformationMetadata metadata = RealMetadataFactory.example1();
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n"); //$NON-NLS-1$
procedure.append("BEGIN\n"); //$NON-NLS-1$
procedure.append("create local temporary table t1 (e1 integer);\n"); //$NON-NLS-1$
@@ -1877,13 +1659,9 @@
procedure.append("SELECT e1 from t1;\n"); //$NON-NLS-1$
procedure.append("END"); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode(procedure.toString()); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
+ addProc(metadata, procedure.toString());
- String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
+ String userUpdateStr = "EXEC pm1.sq2()"; //$NON-NLS-1$
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -1897,12 +1675,8 @@
*/
@Test public void testDoubleDrop() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+ TransformationMetadata metadata = RealMetadataFactory.example1();
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n"); //$NON-NLS-1$
procedure.append("BEGIN\n"); //$NON-NLS-1$
procedure.append("create local temporary table t1 (e1 string);\n"); //$NON-NLS-1$
@@ -1912,13 +1686,9 @@
procedure.append("SELECT 1;\n"); //$NON-NLS-1$
procedure.append("END"); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode(procedure.toString()); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
+ addProc(metadata, procedure.toString());
- String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
+ String userUpdateStr = "EXEC pm1.sq2()"; //$NON-NLS-1$
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -1931,33 +1701,28 @@
* defect 23975
*/
@Test public void testFunctionInput() throws Exception {
- FakeMetadataObject v1 = FakeMetadataFactory.createVirtualModel("v1"); //$NON-NLS-1$
+ MetadataStore metadataStore = new MetadataStore();
+ Schema v1 = RealMetadataFactory.createVirtualModel("v1", metadataStore); //$NON-NLS-1$
- FakeMetadataObject p1 = FakeMetadataFactory.createParameter("v1.vp1.in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- FakeMetadataObject rs1 = FakeMetadataFactory.createResultSet("v1.rs1", v1, new String[] {"e1"}, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs1p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs1); //$NON-NLS-1$
+ ProcedureParameter p1 = RealMetadataFactory.createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ ColumnSet<Procedure> rs1 = RealMetadataFactory.createResultSet("v1.rs1", new String[] {"e1"}, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
QueryNode n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN declare string VARIABLES.x = '1'; exec v1.vp2(concat(x, v1.vp1.in)); END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vt1 = FakeMetadataFactory.createVirtualProcedure("v1.vp1", v1, Arrays.asList(new FakeMetadataObject[] { rs1p1, p1 }), n1); //$NON-NLS-1$
+ Procedure vt1 = RealMetadataFactory.createVirtualProcedure("vp1", v1, Arrays.asList(p1), n1); //$NON-NLS-1$
+ vt1.setResultSet(rs1);
- FakeMetadataObject p2 = FakeMetadataFactory.createParameter("v1.vp2.in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
+ ProcedureParameter p2 = RealMetadataFactory.createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
QueryNode n2 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN select v1.vp2.in; end"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vt2 = FakeMetadataFactory.createVirtualProcedure("v1.vp2", v1, Arrays.asList(new FakeMetadataObject[] { rs1p1, p2 }), n2); //$NON-NLS-1$
+ Procedure vt2 = RealMetadataFactory.createVirtualProcedure("vp2", v1, Arrays.asList(p2), n2); //$NON-NLS-1$
+ vt2.setResultSet(RealMetadataFactory.createResultSet("v1.rs1", new String[] {"e1"}, new String[] { DataTypeManager.DefaultDataTypes.STRING })); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(v1);
- store.addObject(rs1);
- store.addObject(vt1);
- store.addObject(vt2);
- store.addObject(vt2);
-
String sql = "exec v1.vp1('1')"; //$NON-NLS-1$
List[] expected = new List[] {
Arrays.asList(new Object[] { "11" }), //$NON-NLS-1$
};
- FakeMetadataFacade metadata = new FakeMetadataFacade(store);
+ QueryMetadataInterface metadata = RealMetadataFactory.createTransformationMetadata(metadataStore, "foo");
// Construct data manager with data
// Plan query
@@ -1989,7 +1754,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x' where e2=5"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure1, procedure2);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure1, procedure2);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
@@ -2004,23 +1769,15 @@
// Create query
String sql = "EXEC pm1.vsp49()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+ TransformationMetadata metadata = RealMetadataFactory.example1();
- FakeMetadataStore store = metadata.getStore();
+ addProc(metadata, "sq2", "CREATE VIRTUAL PROCEDURE BEGIN if (1 = 2) begin declare integer x = 1; end SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq2.in; END",
+ new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }
+ , new String[] {"in"}, new String[] {DataTypeManager.DefaultDataTypes.STRING}); //$NON-NLS-1$
- FakeMetadataObject pm1 = store.findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN if (1 = 2) begin declare integer x = 1; end SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq2.in; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- store.addObject(sq2);
-
// Create expected results
List[] expected = new List[] {
- Arrays.asList(new Object[] { "b", new Integer(2) }), //$NON-NLS-1$
+ Arrays.asList(new Object[] { "b", Integer.valueOf(2) }), //$NON-NLS-1$
};
// Construct data manager with data
@@ -2035,12 +1792,8 @@
}
@Test public void testInsertAfterCreate() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+ TransformationMetadata metadata = RealMetadataFactory.example1();
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n") //$NON-NLS-1$
.append("BEGIN\n") //$NON-NLS-1$
.append("\n create local temporary table #temp (e1 string, e2 string);") //$NON-NLS-1$
@@ -2049,13 +1802,9 @@
.append("SELECT e2 as e1 from #temp;\n") //$NON-NLS-1$
.append("END"); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode(procedure.toString()); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
+ addProc(metadata, procedure.toString());
- String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
+ String userUpdateStr = "EXEC pm1.sq2()"; //$NON-NLS-1$
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -2079,7 +1828,7 @@
String userUpdateStr = "UPDATE g4 SET e1='x' where e2=5"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure);
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -2108,7 +1857,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x' where e2=5"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure, procedure2);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure, procedure2);
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -2118,23 +1867,14 @@
}
@Test public void testEvaluatableSelectWithOrderBy() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+ TransformationMetadata metadata = RealMetadataFactory.example1();
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("param", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n") //$NON-NLS-1$
.append("BEGIN\n") //$NON-NLS-1$
.append("SELECT param from pm1.g1 order by param limit 1;\n") //$NON-NLS-1$
.append("END"); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode(procedure.toString()); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
+ addProc(metadata, "sq1", procedure.toString(), new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }, new String[] {"param"}, new String[] {DataTypeManager.DefaultDataTypes.STRING});
String userUpdateStr = "EXEC pm1.sq1(1)"; //$NON-NLS-1$
@@ -2148,23 +1888,14 @@
}
@Test public void testEvaluatableSelectWithOrderBy1() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+ TransformationMetadata metadata = RealMetadataFactory.example1();
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("param", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n") //$NON-NLS-1$
.append("BEGIN\n") //$NON-NLS-1$
.append("SELECT param from pm1.g1 union select e1 from pm1.g1 order by param limit 2;\n") //$NON-NLS-1$
.append("END"); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode(procedure.toString()); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
+ addProc(metadata, "sq1", procedure.toString(), new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }, new String[] {"param"}, new String[] {DataTypeManager.DefaultDataTypes.STRING});
String userUpdateStr = "EXEC pm1.sq1(1)"; //$NON-NLS-1$
@@ -2200,7 +1931,7 @@
.append("SELECT * FROM #TEMP;\n") //$NON-NLS-1$
.append("END"); //$NON-NLS-1$
- FakeMetadataFacade metadata = createProcedureMetadata(procedure.toString());
+ QueryMetadataInterface metadata = createProcedureMetadata(procedure.toString());
String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
@@ -2210,24 +1941,13 @@
helpTestProcess(plan, new List[] {
- Arrays.asList(new Object[] {new Integer(240)}),
- Arrays.asList(new Object[] {new Integer(637)})}, dataMgr, metadata);
+ Arrays.asList(new Object[] {Integer.valueOf(240)}),
+ Arrays.asList(new Object[] {Integer.valueOf(637)})}, dataMgr, metadata);
}
- private FakeMetadataFacade createProcedureMetadata(String procedure) {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
-
-
- QueryNode sq2n1 = new QueryNode(procedure.toString()); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1}), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
+ private QueryMetadataInterface createProcedureMetadata(String procedure) throws QueryMetadataException {
+ TransformationMetadata metadata = RealMetadataFactory.example1();
+ addProc(metadata, "sq1", procedure, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }, new String[0], new String[0]);
return metadata;
}
@@ -2240,7 +1960,7 @@
procedure += "Select x from temp;\n"; //$NON-NLS-1$
procedure += "END\n"; //$NON-NLS-1$
- FakeMetadataFacade metadata = createProcedureMetadata(procedure);
+ QueryMetadataInterface metadata = createProcedureMetadata(procedure);
String userUpdateStr = "EXEC pm1.sq1()"; //$NON-NLS-1$
@@ -2257,24 +1977,21 @@
* wraps {@link TestXMLPlanningEnhancements.testNested2WithContextCriteria5d1} in a procedure
*/
@Test public void testXMLWithExternalCriteria() throws Exception {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadataCached();
+ TransformationMetadata metadata = TestXMLProcessor.exampleMetadata();
FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
String resultFile = "TestXMLProcessor-testNested2WithContextCriteria5d.xml"; //$NON-NLS-1$
String expectedDoc = TestXMLProcessor.readFile(resultFile);
- FakeMetadataObject pm1 = metadata.getStore().findObject("xqttest",FakeMetadataObject.MODEL); //$NON-NLS-1$
+ Schema pm1 = metadata.getMetadataStore().getSchemas().get("XMLTEST"); //$NON-NLS-1
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.XML }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("input", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
+ ColumnSet<Procedure> rs2 = RealMetadataFactory.createResultSet("pm1.rs2", new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.XML }); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcedureParameter rs2p2 = RealMetadataFactory.createParameter("input", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "declare integer VARIABLES.x = xqttest.proc.input; SELECT * FROM xmltest.doc9 WHERE context(SupplierID, OrderID)=x OR OrderID='2'; END"); //$NON-NLS-1$
- FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("xqttest.proc", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq2);
+ + "declare integer VARIABLES.x = proc.input; SELECT * FROM xmltest.doc9 WHERE context(SupplierID, OrderID)=x OR OrderID='2'; END"); //$NON-NLS-1$
+ Procedure sq2 = RealMetadataFactory.createVirtualProcedure("proc", pm1, Arrays.asList(rs2p2), sq2n1); //$NON-NLS-1$
+ sq2.setResultSet(rs2);
- String userUpdateStr = "EXEC xqttest.proc(5)"; //$NON-NLS-1$
+ String userUpdateStr = "EXEC proc(5)"; //$NON-NLS-1$
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
@@ -2286,25 +2003,22 @@
}
@Test public void testXMLWithExternalCriteria_InXMLVar() throws Exception {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadataCached();
+ TransformationMetadata metadata = TestXMLProcessor.exampleMetadata();
FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
String resultFile = "TestXMLProcessor-testNested2WithContextCriteria5d.xml"; //$NON-NLS-1$
String expectedDoc = TestXMLProcessor.readFile(resultFile);
- expectedDoc = expectedDoc.replaceAll("\\r", ""); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject pm1 = metadata.getStore().findObject("xqttest",FakeMetadataObject.MODEL); //$NON-NLS-1$
+ expectedDoc = expectedDoc.replaceAll("\\r", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ Schema pm1 = metadata.getMetadataStore().getSchemas().get("XMLTEST"); //$NON-NLS-1
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.XML }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("input", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
+ ColumnSet<Procedure> rs2 = RealMetadataFactory.createResultSet("pm1.rs2", new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.XML }); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcedureParameter rs2p2 = RealMetadataFactory.createParameter("input", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "declare integer VARIABLES.x = xqttest.proc.input; declare xml y = SELECT * FROM xmltest.doc9 WHERE context(SupplierID, OrderID)=x OR OrderID='2'; select convert(y, string); END"); //$NON-NLS-1$
- FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("xqttest.proc", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
+ + "declare integer VARIABLES.x = proc.input; declare xml y = SELECT * FROM xmltest.doc9 WHERE context(SupplierID, OrderID)=x OR OrderID='2'; select convert(y, string); END"); //$NON-NLS-1$
+ Procedure sq2 = RealMetadataFactory.createVirtualProcedure("proc", pm1, Arrays.asList(rs2p2), sq2n1); //$NON-NLS-1$
+ sq2.setResultSet(rs2);
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq2);
+ String userUpdateStr = "EXEC proc(5)"; //$NON-NLS-1$
- String userUpdateStr = "EXEC xqttest.proc(5)"; //$NON-NLS-1$
-
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
// Create expected results
@@ -2320,7 +2034,7 @@
* This one will successfully auto-stage
*/
@Test public void testXMLWithExternalCriteria1() throws Exception {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadataCached();
+ TransformationMetadata metadata = TestXMLProcessor.exampleMetadata();
FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + //$NON-NLS-1$
@@ -2358,18 +2072,14 @@
" </Catalog>\n" + //$NON-NLS-1$
"</Catalogs>"; //$NON-NLS-1$
- FakeMetadataObject pm1 = metadata.getStore().findObject("xmltest",FakeMetadataObject.MODEL); //$NON-NLS-1$
+ Schema pm1 = metadata.getMetadataStore().getSchemas().get("XMLTEST"); //$NON-NLS-1
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.XML }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("input", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
+ ColumnSet<Procedure> rs2 = RealMetadataFactory.createResultSet("pm1.rs2", new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.XML }); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcedureParameter rs2p2 = RealMetadataFactory.createParameter("input", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "declare integer VARIABLES.x = xmltest.proc.input; SELECT * FROM xmltest.doc9 WHERE context(SupplierID, SupplierID)=x; END"); //$NON-NLS-1$
- FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("xmltest.proc", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq2);
-
+ Procedure sq2 = RealMetadataFactory.createVirtualProcedure("proc", pm1, Arrays.asList(rs2p2), sq2n1); //$NON-NLS-1$
+ sq2.setResultSet(rs2);
String userUpdateStr = "EXEC xmltest.proc(52)"; //$NON-NLS-1$
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
@@ -2384,7 +2094,7 @@
@Test public void testCase174806() throws Exception{
String userUpdateStr = "EXEC pm1.vsp63()"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
FakeDataManager dataMgr = exampleDataManager(metadata);
@@ -2398,7 +2108,7 @@
@Test public void testJoinProcAndPhysicalModel() throws Exception {
String userUpdateStr = "select a.e1 from (EXEC pm1.vsp46()) as a, pm1.g1 where a.e1=pm1.g1.e1"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
@@ -2451,12 +2161,12 @@
procedure += " SELECT VARIABLES.Var1 AS e1;\n"; //$NON-NLS-1$
procedure += "END\n"; //$NON-NLS-1$
- FakeMetadataFacade metadata = createProcedureMetadata(procedure);
+ QueryMetadataInterface metadata = createProcedureMetadata(procedure);
String userQuery = "SELECT e1 FROM (EXEC pm1.sq1()) as proc"; //$NON-NLS-1$
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userQuery, metadata);
- List[] expected = new List[] {Arrays.asList(new Object[] {new Integer(3)})};
+ List[] expected = new List[] {Arrays.asList(new Object[] {Integer.valueOf(3)})};
helpTestProcess(plan, expected, dataMgr, metadata);
}
@@ -2473,7 +2183,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure);
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
helpTestProcess(plan, 5, dataMgr, metadata);
@@ -2491,7 +2201,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure);
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
helpTestProcess(plan, 0, dataMgr, metadata);
@@ -2506,7 +2216,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure);
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
helpTestProcess(plan, 8, dataMgr, metadata);
@@ -2542,15 +2252,15 @@
" " + sql + ";" + //$NON-NLS-1$ //$NON-NLS-2$
"END"; //$NON-NLS-1$
- FakeMetadataFacade metadata = createProcedureMetadata(proc);
+ QueryMetadataInterface metadata = createProcedureMetadata(proc);
String userQuery = "SELECT * FROM (EXEC pm1.sq1()) as proc"; //$NON-NLS-1$
FakeDataManager dataMgr = exampleDataManager2(metadata);
ProcessorPlan plan = getProcedurePlan(userQuery, metadata);
List[] expected = new List[] {
- Arrays.asList( new Object[] { "First", "First", new Integer(5), new Integer(5)} ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "Second", null, new Integer(15), null} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", null, new Integer(51), null} ) //$NON-NLS-1$
+ Arrays.asList( new Object[] { "First", "First", Integer.valueOf(5), Integer.valueOf(5)} ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "Second", null, Integer.valueOf(15), null} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", null, Integer.valueOf(51), null} ) //$NON-NLS-1$
};
helpTestProcess(plan, expected, dataMgr, metadata);
@@ -2588,15 +2298,15 @@
" " + sql + ";" + //$NON-NLS-1$ //$NON-NLS-2$
"END"; //$NON-NLS-1$
- FakeMetadataFacade metadata = createProcedureMetadata(proc);
+ QueryMetadataInterface metadata = createProcedureMetadata(proc);
String userQuery = "SELECT * FROM (EXEC pm1.sq1()) as proc"; //$NON-NLS-1$
FakeDataManager dataMgr = exampleDataManager2(metadata);
ProcessorPlan plan = getProcedurePlan(userQuery, metadata, TestOptimizer.getGenericFinder());
List[] expected = new List[] {
- Arrays.asList( new Object[] { "First", "First", new Integer(5), new Integer(5)} ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "Second", null, new Integer(15), null} ), //$NON-NLS-1$
- Arrays.asList( new Object[] { "Third", null, new Integer(51), null} ) //$NON-NLS-1$
+ Arrays.asList( new Object[] { "First", "First", Integer.valueOf(5), Integer.valueOf(5)} ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "Second", null, Integer.valueOf(15), null} ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { "Third", null, Integer.valueOf(51), null} ) //$NON-NLS-1$
};
helpTestProcess(plan, expected, dataMgr, metadata);
}
@@ -2610,7 +2320,7 @@
" select e1 from #t1;\n" + //$NON-NLS-1$
"END"; //$NON-NLS-1$
- FakeMetadataFacade metadata = createProcedureMetadata(proc);
+ QueryMetadataInterface metadata = createProcedureMetadata(proc);
String userQuery = "SELECT * FROM (EXEC pm1.sq1()) as proc"; //$NON-NLS-1$
FakeDataManager dataMgr = exampleDataManager2(metadata);
ProcessorPlan plan = getProcedurePlan(userQuery, metadata, TestOptimizer.getGenericFinder());
@@ -2629,7 +2339,7 @@
" select e2 from (exec pm1.sq2((select max(e1) from t1))) x;\n" + //$NON-NLS-1$
"END"; //$NON-NLS-1$
- FakeMetadataFacade metadata = createProcedureMetadata(proc);
+ QueryMetadataInterface metadata = createProcedureMetadata(proc);
String userQuery = "SELECT * FROM (EXEC pm1.sq1()) as proc"; //$NON-NLS-1$
FakeDataManager dataMgr = exampleDataManager2(metadata);
ProcessorPlan plan = getProcedurePlan(userQuery, metadata, TestOptimizer.getGenericFinder());
@@ -2642,7 +2352,7 @@
@Test public void testUnambiguousVirtualProc() throws Exception {
String userQuery = "EXEC MMSP6('1')"; //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = getProcedurePlan(userQuery, metadata, TestOptimizer.getGenericFinder());
List[] expected = new List[] {
@@ -2664,13 +2374,7 @@
@Test public void testNonQueryPushdownValidation() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject in = FakeMetadataFactory.createParameter("pm1.sq1.in1", 2, SPParameter.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
+ TransformationMetadata metadata = RealMetadataFactory.example1();
StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n"); //$NON-NLS-1$
procedure.append("BEGIN\n"); //$NON-NLS-1$
@@ -2681,12 +2385,8 @@
procedure.append("exec pm1.sq2(in1 || 'foo');\n"); //$NON-NLS-1$
procedure.append("END"); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode(procedure.toString()); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { in, rs2p1 }), sq2n1); //$NON-NLS-1$
+ addProc(metadata, "sq1", procedure.toString(), new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }, new String[] {"in1"}, new String[] {DataTypeManager.DefaultDataTypes.INTEGER});
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
-
String userUpdateStr = "EXEC pm1.sq1(1)"; //$NON-NLS-1$
FakeDataManager dataMgr = exampleDataManager(metadata);
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestAccessNode.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestAccessNode.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestAccessNode.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -42,7 +42,7 @@
import org.teiid.query.sql.symbol.Constant;
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
@@ -74,7 +74,7 @@
}
@Test public void testOpen_Defect16059() throws Exception {
- Query query = (Query)TestResolver.helpResolve("SELECT e1, e2 FROM pm1.g1 WHERE e2 = 5 AND ? IS NULL", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ Query query = (Query)TestResolver.helpResolve("SELECT e1, e2 FROM pm1.g1 WHERE e2 = 5 AND ? IS NULL", RealMetadataFactory.example1Cached()); //$NON-NLS-1$
IsNullCriteria nullCrit = (IsNullCriteria)((CompoundCriteria)query.getCriteria()).getCriteria(1);
nullCrit.setExpression(new Constant(null));
@@ -82,7 +82,7 @@
}
@Test public void testOpen_Defect16059_2() throws Exception {
- Query query = (Query)TestResolver.helpResolve("SELECT e1, e2 FROM pm1.g1 WHERE e2 = 5 AND ? IS NOT NULL", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ Query query = (Query)TestResolver.helpResolve("SELECT e1, e2 FROM pm1.g1 WHERE e2 = 5 AND ? IS NOT NULL", RealMetadataFactory.example1Cached()); //$NON-NLS-1$
IsNullCriteria nullCrit = (IsNullCriteria)((CompoundCriteria)query.getCriteria()).getCriteria(1);
nullCrit.setExpression(new Constant(null));
@@ -92,7 +92,7 @@
@Test public void testExecCount()throws Exception{
// Setup
AccessNode node = new AccessNode(1);
- Query query = (Query)TestResolver.helpResolve("SELECT e1, e2 FROM pm1.g1 WHERE e2 = 5", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ Query query = (Query)TestResolver.helpResolve("SELECT e1, e2 FROM pm1.g1 WHERE e2 = 5", RealMetadataFactory.example1Cached()); //$NON-NLS-1$
node.setCommand(query);
CommandContext context = new CommandContext();
context.setProcessorID("processorID"); //$NON-NLS-1$
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -44,7 +44,7 @@
import org.teiid.query.sql.lang.BatchedUpdateCommand;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.visitor.EvaluatableVisitor;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
@@ -69,7 +69,7 @@
}
private BatchedUpdateNode helpOpen(String[] commands, ProcessorDataManager pdm) throws Exception {
- BatchedUpdateNode node = helpGetNode(commands, FakeMetadataFactory.example1Cached(), pdm);
+ BatchedUpdateNode node = helpGetNode(commands, RealMetadataFactory.example1Cached(), pdm);
node.open();
return node;
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestGroupingNode.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestGroupingNode.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestGroupingNode.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -50,7 +50,7 @@
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.symbol.Function;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
@@ -308,7 +308,7 @@
col2.setType(Integer.class);
Function func = new Function("lookup", new Expression[] { new Constant("pm1.g1"), new Constant("e2"), new Constant("e1"), col2 }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- FunctionDescriptor desc = FakeMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("lookup", new Class[] { String.class, String.class, String.class, Integer.class } ); //$NON-NLS-1$
+ FunctionDescriptor desc = RealMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("lookup", new Class[] { String.class, String.class, String.class, Integer.class } ); //$NON-NLS-1$
func.setFunctionDescriptor(desc);
func.setType(DataTypeManager.DefaultDataClasses.INTEGER);
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestJoinNode.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestJoinNode.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestJoinNode.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -47,7 +47,7 @@
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.symbol.Function;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
@SuppressWarnings("unchecked")
@@ -203,7 +203,7 @@
case FUNCTION_CRITERIA :
Function func = new Function("lookup", new Expression[] { new Constant("pm1.g1"), new Constant("e2"), new Constant("e1"), es1 }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- FunctionDescriptor desc = FakeMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("lookup", new Class[] { String.class, String.class, String.class, Integer.class }); //$NON-NLS-1$
+ FunctionDescriptor desc = RealMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("lookup", new Class[] { String.class, String.class, String.class, Integer.class }); //$NON-NLS-1$
func.setFunctionDescriptor(desc);
func.setType(DataTypeManager.DefaultDataClasses.INTEGER);
CompareCriteria joinCriteria = new CompareCriteria(es2, CompareCriteria.EQ, func);
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestProjectNode.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestProjectNode.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestProjectNode.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -46,7 +46,7 @@
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.symbol.ExpressionSymbol;
import org.teiid.query.sql.symbol.Function;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
@@ -212,7 +212,7 @@
elements.add(es1);
Function func = new Function("concat", new Expression[] { es1, new Constant("abc")}); //$NON-NLS-1$ //$NON-NLS-2$
- FunctionDescriptor fd = FakeMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("concat", new Class[] { DataTypeManager.DefaultDataClasses.STRING, DataTypeManager.DefaultDataClasses.STRING }); //$NON-NLS-1$
+ FunctionDescriptor fd = RealMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("concat", new Class[] { DataTypeManager.DefaultDataClasses.STRING, DataTypeManager.DefaultDataClasses.STRING }); //$NON-NLS-1$
func.setFunctionDescriptor(fd);
func.setType(DataTypeManager.DefaultDataClasses.STRING);
ExpressionSymbol expr = new ExpressionSymbol("expr", func); //$NON-NLS-1$
@@ -236,7 +236,7 @@
elements.add(es1);
Function func = new Function("convert", new Expression[] { es1, new Constant("integer")}); //$NON-NLS-1$ //$NON-NLS-2$
- FunctionDescriptor fd = FakeMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("convert", new Class[] { DataTypeManager.DefaultDataClasses.STRING, DataTypeManager.DefaultDataClasses.STRING }); //$NON-NLS-1$
+ FunctionDescriptor fd = RealMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("convert", new Class[] { DataTypeManager.DefaultDataClasses.STRING, DataTypeManager.DefaultDataClasses.STRING }); //$NON-NLS-1$
func.setFunctionDescriptor(fd);
func.setType(DataTypeManager.DefaultDataClasses.INTEGER);
ExpressionSymbol expr = new ExpressionSymbol("expr", func); //$NON-NLS-1$
@@ -259,7 +259,7 @@
elements.add(es1);
Function func = new Function("lookup", new Expression[] { new Constant("pm1.g1"), new Constant("e2"), new Constant("e1"), es1 }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- FunctionDescriptor desc = FakeMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("lookup", new Class[] { String.class, String.class, String.class, String.class } ); //$NON-NLS-1$
+ FunctionDescriptor desc = RealMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("lookup", new Class[] { String.class, String.class, String.class, String.class } ); //$NON-NLS-1$
func.setFunctionDescriptor(desc);
func.setType(DataTypeManager.DefaultDataClasses.STRING);
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestSelectNode.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestSelectNode.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/relational/TestSelectNode.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -51,7 +51,7 @@
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.symbol.Function;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
public class TestSelectNode {
@@ -237,7 +237,7 @@
elements.add(es1);
Function func = new Function("lookup", new Expression[] { new Constant("pm1.g1"), new Constant("e2"), new Constant("e1"), es1 }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- FunctionDescriptor desc = FakeMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("lookup", new Class[] { String.class, String.class, String.class, Integer.class } ); //$NON-NLS-1$
+ FunctionDescriptor desc = RealMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("lookup", new Class[] { String.class, String.class, String.class, Integer.class } ); //$NON-NLS-1$
func.setFunctionDescriptor(desc);
func.setType(DataTypeManager.DefaultDataClasses.INTEGER);
CompareCriteria crit = new CompareCriteria(func, CompareCriteria.EQ, new Constant(new Integer(1)));
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/xml/TestInstructions.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/xml/TestInstructions.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/xml/TestInstructions.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -26,6 +26,8 @@
import java.util.Arrays;
import java.util.List;
+import junit.framework.TestCase;
+
import org.teiid.api.exception.query.QueryParserException;
import org.teiid.api.exception.query.QueryResolverException;
import org.teiid.common.buffer.BufferManager;
@@ -33,27 +35,16 @@
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.types.DataTypeManager;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Schema;
+import org.teiid.metadata.Table;
import org.teiid.query.mapping.relational.QueryNode;
import org.teiid.query.mapping.xml.MappingNodeConstants;
import org.teiid.query.mapping.xml.ResultSetInfo;
+import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.parser.QueryParser;
import org.teiid.query.processor.FakeDataManager;
import org.teiid.query.processor.TestProcessor;
-import org.teiid.query.processor.xml.AddNodeInstruction;
-import org.teiid.query.processor.xml.Condition;
-import org.teiid.query.processor.xml.CriteriaCondition;
-import org.teiid.query.processor.xml.EndDocumentInstruction;
-import org.teiid.query.processor.xml.ExecSqlInstruction;
-import org.teiid.query.processor.xml.IfInstruction;
-import org.teiid.query.processor.xml.InitializeDocumentInstruction;
-import org.teiid.query.processor.xml.MoveCursorInstruction;
-import org.teiid.query.processor.xml.MoveDocInstruction;
-import org.teiid.query.processor.xml.NodeDescriptor;
-import org.teiid.query.processor.xml.ProcessorInstruction;
-import org.teiid.query.processor.xml.Program;
-import org.teiid.query.processor.xml.WhileInstruction;
-import org.teiid.query.processor.xml.XMLPlan;
-import org.teiid.query.processor.xml.XMLProcessorEnvironment;
import org.teiid.query.resolver.QueryResolver;
import org.teiid.query.resolver.util.ResolverVisitor;
import org.teiid.query.rewriter.QueryRewriter;
@@ -61,17 +52,13 @@
import org.teiid.query.sql.lang.Criteria;
import org.teiid.query.sql.lang.QueryCommand;
import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
-import org.teiid.query.unittest.FakeMetadataStore;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
-import junit.framework.TestCase;
-
/**
*/
+@SuppressWarnings("nls")
public class TestInstructions extends TestCase {
public TestInstructions(String name) {
@@ -92,43 +79,34 @@
* itemName (string)
* itemQuantity (integer)
*/
- public FakeMetadataFacade exampleMetadata() {
+ public QueryMetadataInterface exampleMetadata() {
+ MetadataStore metadataStore = new MetadataStore();
// Create models
- FakeMetadataObject stock = FakeMetadataFactory.createPhysicalModel("stock"); //$NON-NLS-1$
- FakeMetadataObject xmltest = FakeMetadataFactory.createVirtualModel("xmltest"); //$NON-NLS-1$
+ Schema stock = RealMetadataFactory.createPhysicalModel("stock", metadataStore); //$NON-NLS-1$
+ Schema xmltest = RealMetadataFactory.createVirtualModel("xmltest", metadataStore); //$NON-NLS-1$
// Create physical groups
- FakeMetadataObject items = FakeMetadataFactory.createPhysicalGroup("stock.items", stock); //$NON-NLS-1$
+ Table items = RealMetadataFactory.createPhysicalGroup("items", stock); //$NON-NLS-1$
// Create physical elements
- List itemElements = FakeMetadataFactory.createElements(items,
+ RealMetadataFactory.createElements(items,
new String[] { "itemNum", "itemName", "itemQuantity" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
// Create virtual groups
QueryNode rsQuery = new QueryNode("SELECT itemNum, itemName, itemQuantity FROM stock.items"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs = FakeMetadataFactory.createVirtualGroup("xmltest.rs", xmltest, rsQuery); //$NON-NLS-1$
+ Table rs = RealMetadataFactory.createVirtualGroup("rs", xmltest, rsQuery); //$NON-NLS-1$
// Create virtual elements
- List rsElements = FakeMetadataFactory.createElements(rs,
+ RealMetadataFactory.createElements(rs,
new String[] { "itemNum", "itemName", "itemQuantity" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
- // Add all objects to the store
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(stock);
- store.addObject(items);
- store.addObjects(itemElements);
-
- store.addObject(xmltest);
- store.addObject(rs);
- store.addObjects(rsElements);
-
// Create the facade from the store
- return new FakeMetadataFacade(store);
+ return RealMetadataFactory.createTransformationMetadata(metadataStore, "example");
}
- private Command helpGetCommand(String sql, FakeMetadataFacade metadata) throws TeiidComponentException, TeiidProcessingException {
+ private Command helpGetCommand(String sql, QueryMetadataInterface metadata) throws TeiidComponentException, TeiidProcessingException {
// parse
QueryParser parser = new QueryParser();
Command command = parser.parseCommand(sql);
@@ -139,7 +117,7 @@
return command;
}
- private Criteria helpGetCriteria(String sql, FakeMetadataFacade metadata) throws QueryParserException, QueryResolverException, TeiidComponentException {
+ private Criteria helpGetCriteria(String sql, QueryMetadataInterface metadata) throws QueryParserException, QueryResolverException, TeiidComponentException {
QueryParser parser = new QueryParser();
Criteria crit = parser.parseCriteria(sql);
@@ -154,7 +132,7 @@
TestProcessor.doProcess(plan, new FakeDataManager(), new List[] {Arrays.asList(expected)}, new CommandContext());
}
- public Program exampleProgram(FakeMetadataFacade metadata, XMLProcessorEnvironment env) throws Exception{
+ public Program exampleProgram() throws Exception{
ProcessorInstruction i0 = new InitializeDocumentInstruction("UTF-8", true); //$NON-NLS-1$
NodeDescriptor descriptor = NodeDescriptor.createNodeDescriptor("Catalogs", null, AddNodeInstruction.ELEMENT, null, null, null,false, null, MappingNodeConstants.NORMALIZE_TEXT_PRESERVE);//$NON-NLS-1$
@@ -223,7 +201,7 @@
return program;
}
- public Program exampleProgram2(Criteria crit, FakeMetadataFacade metadata, XMLProcessorEnvironment env) throws Exception{
+ public Program exampleProgram2(Criteria crit) throws Exception{
ProcessorInstruction i0 = new InitializeDocumentInstruction("UTF-8", true); //$NON-NLS-1$
NodeDescriptor descriptor = NodeDescriptor.createNodeDescriptor("Catalogs", null, AddNodeInstruction.ELEMENT, null, null, null,false, null, MappingNodeConstants.NORMALIZE_TEXT_PRESERVE);//$NON-NLS-1$
ProcessorInstruction i1 = new AddNodeInstruction(descriptor);
@@ -304,18 +282,18 @@
public void testProcess1() throws Exception {
- FakeMetadataFacade metadata = exampleMetadata();
+ QueryMetadataInterface metadata = exampleMetadata();
String resultSetName = "xmltest.rs"; //$NON-NLS-1$
FakeXMLProcessorEnvironment env = new FakeXMLProcessorEnvironment();
- Program program = exampleProgram(metadata, env);
+ Program program = exampleProgram();
BufferManager bufferMgr = BufferManagerFactory.getStandaloneBufferManager();
XMLPlan temp = new XMLPlan(env);
CommandContext context = new CommandContext("pid", null, null, null, 1); //$NON-NLS-1$
temp.initialize(context,null,bufferMgr);
- List schema = new ArrayList();
+ List<ElementSymbol> schema = new ArrayList<ElementSymbol>();
schema.add(new ElementSymbol(resultSetName + ElementSymbol.SEPARATOR + "itemNum")); //$NON-NLS-1$
schema.add(new ElementSymbol(resultSetName + ElementSymbol.SEPARATOR + "itemName")); //$NON-NLS-1$
schema.add(new ElementSymbol(resultSetName + ElementSymbol.SEPARATOR + "itemQuantity")); //$NON-NLS-1$
@@ -348,7 +326,7 @@
}
public void testProcess2() throws Exception {
- FakeMetadataFacade metadata = exampleMetadata();
+ QueryMetadataInterface metadata = exampleMetadata();
String resultSetName = "xmltest.rs"; //$NON-NLS-1$
@@ -357,7 +335,7 @@
Criteria crit = helpGetCriteria("xmltest.rs.itemName = 'Screwdriver'", metadata); //$NON-NLS-1$
FakeXMLProcessorEnvironment env = new FakeXMLProcessorEnvironment();
- Program program = exampleProgram2(crit, metadata, env);
+ Program program = exampleProgram2(crit);
BufferManager bufferMgr = BufferManagerFactory.getStandaloneBufferManager();
XMLPlan temp = new XMLPlan(env);
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/xml/TestXMLPlanningEnhancements.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/xml/TestXMLPlanningEnhancements.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/xml/TestXMLPlanningEnhancements.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -32,58 +32,53 @@
import org.teiid.client.metadata.ParameterInfo;
import org.teiid.common.buffer.BufferManager;
import org.teiid.core.types.DataTypeManager;
+import org.teiid.metadata.ColumnSet;
+import org.teiid.metadata.Procedure;
+import org.teiid.metadata.ProcedureParameter;
+import org.teiid.metadata.Schema;
+import org.teiid.metadata.Table;
import org.teiid.query.mapping.relational.QueryNode;
import org.teiid.query.mapping.xml.MappingAttribute;
import org.teiid.query.mapping.xml.MappingDocument;
import org.teiid.query.mapping.xml.MappingElement;
-import org.teiid.query.mapping.xml.MappingNode;
+import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.optimizer.TestOptimizer;
import org.teiid.query.optimizer.relational.rules.RuleChooseDependent;
import org.teiid.query.processor.FakeDataManager;
import org.teiid.query.processor.ProcessorPlan;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
-import org.teiid.query.unittest.FakeMetadataStore;
+import org.teiid.query.unittest.RealMetadataFactory;
-
+@SuppressWarnings("nls")
public class TestXMLPlanningEnhancements {
- private FakeMetadataFacade getMetadata(String query) {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadata();
+ private TransformationMetadata getMetadata(String query) {
+ TransformationMetadata metadata = TestXMLProcessor.exampleMetadata();
- FakeMetadataStore store = metadata.getStore();
+ Schema xmltest = metadata.getMetadataStore().getSchemas().get("XMLTEST");
- FakeMetadataObject xmltest = store.findObject("xmltest", FakeMetadataObject.MODEL); //$NON-NLS-1$
-
QueryNode rsQueryY = new QueryNode(query); //$NON-NLS-1$
rsQueryY.addBinding("xmltest.group.items.itemNum"); //$NON-NLS-1$
rsQueryY.addBinding("xmltest.group.items.itemNum"); //$NON-NLS-1$
- FakeMetadataObject rsQY = FakeMetadataFactory.createVirtualGroup("xmltest.suppliersY", xmltest, rsQueryY); //$NON-NLS-1$
+ Table rsQY = RealMetadataFactory.createVirtualGroup("suppliersY", xmltest, rsQueryY); //$NON-NLS-1$
- List rsElementsY = FakeMetadataFactory.createElements(rsQY,
+ RealMetadataFactory.createElements(rsQY,
new String[] { "supplierNum", "supplierName", "supplierZipCode" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- FakeMetadataObject doc18a = FakeMetadataFactory.createVirtualGroup("xmltest.doc18a", xmltest, TestXMLProcessor.createXMLPlanNested("xmltest.suppliersY")); //$NON-NLS-1$ //$NON-NLS-2$
- List docE18a = FakeMetadataFactory.createElements(doc18a, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier.@SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$
+ Table doc18a = RealMetadataFactory.createXmlDocument("doc18a", xmltest, TestXMLProcessor.createXMLPlanNested("xmltest.suppliersY")); //$NON-NLS-1$ //$NON-NLS-2$
+ RealMetadataFactory.createElements(doc18a, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier.@SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
- store.addObject(rsQY);
- store.addObjects(rsElementsY);
- store.addObject(doc18a);
- store.addObjects(docE18a);
return metadata;
}
- private FakeMetadataFacade getTempTableMetadata(boolean simpleTempSelect) {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadata();
+ private TransformationMetadata getTempTableMetadata(boolean simpleTempSelect) {
+ TransformationMetadata metadata = TestXMLProcessor.exampleMetadata();
- FakeMetadataStore store = metadata.getStore();
+ Schema xmltest = metadata.getMetadataStore().getSchemas().get("XMLTEST");
- FakeMetadataObject xmltest = store.findObject("xmltest", FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject docJoin = FakeMetadataFactory.createVirtualGroup("xmltest.docJoin", xmltest, createXMLPlanNestedJoin()); //$NON-NLS-1$
- List docEJoin = FakeMetadataFactory.createElements(docJoin, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier.@SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name", "Catalogs.Catalog.items.item.suppliers.supplier.orders", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.@OrderID" ,"Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderDate", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderQuantity", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderStatus"}, //$NON-NLS-1$ //$NON-!
NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$ //$NON-NLS-18$
+ Table docJoin = RealMetadataFactory.createXmlDocument("docJoin", xmltest, createXMLPlanNestedJoin()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(docJoin, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier.@SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name", "Catalogs.Catalog.items.item.suppliers.supplier.orders", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.@OrderID" ,"Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderDate", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderQuantity", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderStatus"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NL!
S-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$ //$NON-NLS-18$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
QueryNode tempQueryJoin = null;
@@ -93,44 +88,37 @@
tempQueryJoin = new QueryNode("SELECT stock.orders.* FROM stock.orders join stock.suppliers on stock.orders.supplierFK=stock.suppliers.supplierNum"); //$NON-NLS-1$ //$NON-NLS-2$
}
- FakeMetadataObject tempJoin = FakeMetadataFactory.createVirtualGroup("tempGroup.orders", xmltest, tempQueryJoin); //$NON-NLS-1$
+ Table tempJoin = RealMetadataFactory.createXmlStagingTable("docJoin.orders", xmltest, tempQueryJoin); //$NON-NLS-1$
// Created virtual group w/ nested result set & binding - selects from 2nd temp root group
QueryNode rsQueryJoin = null;
if (!simpleTempSelect) {
- rsQueryJoin = new QueryNode("SELECT orderNum, orderDate, orderQty, orderStatus FROM tempGroup.orders join stock.suppliers on tempGroup.orders.supplierFK=stock.suppliers.supplierNum WHERE itemFK = ? AND supplierNameFK = ?"); //$NON-NLS-1$ //$NON-NLS-2$
+ rsQueryJoin = new QueryNode("SELECT orderNum, orderDate, orderQty, orderStatus FROM docJoin.orders join stock.suppliers on docJoin.orders.supplierFK=stock.suppliers.supplierNum WHERE itemFK = ? AND supplierNameFK = ?"); //$NON-NLS-1$ //$NON-NLS-2$
rsQueryJoin.addBinding("xmltest.group.items.itemNum"); //$NON-NLS-1$
rsQueryJoin.addBinding("xmltest.suppliers.supplierName"); //$NON-NLS-1$
} else {
- rsQueryJoin = new QueryNode("SELECT orderNum, orderDate, orderQty, orderStatus FROM tempGroup.orders WHERE supplierNameFK = ?"); //$NON-NLS-1$ //$NON-NLS-2$
+ rsQueryJoin = new QueryNode("SELECT orderNum, orderDate, orderQty, orderStatus FROM docJoin.orders WHERE supplierNameFK = ?"); //$NON-NLS-1$ //$NON-NLS-2$
rsQueryJoin.addBinding("xmltest.suppliers.supplierName"); //$NON-NLS-1$
}
- FakeMetadataObject rsJoin = FakeMetadataFactory.createVirtualGroup("xmltest.ordersC", xmltest, rsQueryJoin); //$NON-NLS-1$
+ Table rsJoin = RealMetadataFactory.createVirtualGroup("ordersC", xmltest, rsQueryJoin); //$NON-NLS-1$
- List tempJoinElements = FakeMetadataFactory.createElements(tempJoin,
+ RealMetadataFactory.createElements(tempJoin,
new String[] { "orderNum", "itemFK", "supplierFK", "supplierNameFK", "orderDate", "orderQty", "orderStatus" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING});
- List rsElementsJoin = FakeMetadataFactory.createElements(rsJoin,
+ RealMetadataFactory.createElements(rsJoin,
new String[] { "orderNum", "orderDate", "orderQty", "orderStatus" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING});
- store.addObject(docJoin);
- store.addObjects(docEJoin);
- store.addObjects(tempJoinElements);
- store.addObjects(rsElementsJoin);
- store.addObject(tempJoin);
- store.addObject(rsJoin);
-
return metadata;
}
- private static MappingNode createXMLPlanNestedJoin() {
+ private static MappingDocument createXMLPlanNestedJoin() {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("Catalogs")); //$NON-NLS-1$
- root.setStagingTables(Arrays.asList(new String[] {"tempGroup.orders"})); //$NON-NLS-1$
+ root.setStagingTables(Arrays.asList("xmltest.docJoin.orders")); //$NON-NLS-1$
MappingElement cats = root.addChildElement(new MappingElement("Catalog")); //$NON-NLS-1$
MappingElement items = cats.addChildElement(new MappingElement("Items")); //$NON-NLS-1$
@@ -168,7 +156,7 @@
@Test public void testBaseballPlayersDocDefect19541() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleCase3225();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleCase3225();
FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerCase3225(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -216,7 +204,7 @@
}
@Test public void testNested2WithContextCriteria5c() throws Exception {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadataCached();
+ QueryMetadataInterface metadata = TestXMLProcessor.exampleMetadataCached();
FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
String resultFile = "TestXMLProcessor-testNested2WithContextCriteria5c.xml"; //$NON-NLS-1$
String expectedDoc = TestXMLProcessor.readFile(resultFile);
@@ -225,7 +213,7 @@
}
@Test public void testNested2WithContextCriteria5d() throws Exception {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadataCached();
+ QueryMetadataInterface metadata = TestXMLProcessor.exampleMetadataCached();
FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
String resultFile = "TestXMLProcessor-testNested2WithContextCriteria5d.xml"; //$NON-NLS-1$
String expectedDoc = TestXMLProcessor.readFile(resultFile);
@@ -234,7 +222,7 @@
}
@Test public void testNested2WithContextCriteria5d1() throws Exception {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadataCached();
+ QueryMetadataInterface metadata = TestXMLProcessor.exampleMetadataCached();
FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
String resultFile = "TestXMLProcessor-testNested2WithContextCriteria5d.xml"; //$NON-NLS-1$
String expectedDoc = TestXMLProcessor.readFile(resultFile);
@@ -243,7 +231,7 @@
}
@Test public void testNested2WithContextCriteria5e() throws Exception {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadataCached();
+ QueryMetadataInterface metadata = TestXMLProcessor.exampleMetadataCached();
FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
String resultFile = "TestXMLProcessor-testNested2WithContextCriteria5e.xml"; //$NON-NLS-1$
String expectedDoc = TestXMLProcessor.readFile(resultFile);
@@ -252,7 +240,7 @@
}
@Test public void testXQTChoice_6796() throws Exception {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadata2();
+ QueryMetadataInterface metadata = TestXMLProcessor.exampleMetadata2();
FakeDataManager dataMgr = TestXMLProcessor.exampleXQTDataManager(metadata);
String resultFile = "TestXMLProcessor-testXQTChoice_6796.xml"; //$NON-NLS-1$
String expectedDoc = TestXMLProcessor.readFile(resultFile);
@@ -261,7 +249,7 @@
}
@Test public void testOrderByWithChoiceCriteriaElement() throws Exception {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadata2();
+ QueryMetadataInterface metadata = TestXMLProcessor.exampleMetadata2();
FakeDataManager dataMgr = TestXMLProcessor.exampleXQTDataManager(metadata);
String expectedDoc = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<root>\n <wrapper/>\n <wrapper/>\n <wrapper/>\n <wrapper/>\n <wrapper/>\n <wrapper/>\n <wrapper/>\n <wrapper/>\n <wrapper/>\n</root>"; //$NON-NLS-1$
@@ -269,7 +257,7 @@
}
@Test public void testXQTChoice_withContextCriteria() throws Exception {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadata2();
+ QueryMetadataInterface metadata = TestXMLProcessor.exampleMetadata2();
FakeDataManager dataMgr = TestXMLProcessor.exampleXQTDataManager(metadata);
String resultFile = "TestXMLProcessor-testXQTChoice_withContextCriteria.xml"; //$NON-NLS-1$
String expectedDoc = TestXMLProcessor.readFile(resultFile);
@@ -278,7 +266,7 @@
}
@Test public void testXQTChoice_withContextCriteria1() throws Exception {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadata2();
+ QueryMetadataInterface metadata = TestXMLProcessor.exampleMetadata2();
FakeDataManager dataMgr = TestXMLProcessor.exampleXQTDataManager(metadata);
String resultFile = "TestXMLProcessor-testXQTChoice_withContextCriteria1.xml"; //$NON-NLS-1$
String expectedDoc = TestXMLProcessor.readFile(resultFile);
@@ -287,7 +275,7 @@
}
@Test public void testMappingClassWithInlineViewAndCriteria() throws Exception {
- FakeMetadataFacade metadata = getMetadata("SELECT upper(x.supplierNum) as supplierNum, x.supplierName, x.supplierZipCode from (select stock.suppliers.supplierNum, supplierName, supplierZipCode, itemNum FROM stock.suppliers, stock.item_supplier WHERE stock.suppliers.supplierNum = stock.item_supplier.supplierNum) x where x.itemNum = ?"); //$NON-NLS-1$
+ QueryMetadataInterface metadata = getMetadata("SELECT upper(x.supplierNum) as supplierNum, x.supplierName, x.supplierZipCode from (select stock.suppliers.supplierNum, supplierName, supplierZipCode, itemNum FROM stock.suppliers, stock.item_supplier WHERE stock.suppliers.supplierNum = stock.item_supplier.supplierNum) x where x.itemNum = ?"); //$NON-NLS-1$
FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
String expectedDoc = TestXMLProcessor.readFile("TestXMLPlanningEnhancements-testMappingClassWithStoredProcedureAndCriteria.xml"); //$NON-NLS-1$
@@ -296,7 +284,7 @@
}
@Test public void testMappingClassWithUnionAndCriteria() throws Exception {
- FakeMetadataFacade metadata = getMetadata("SELECT concat(stock.suppliers.supplierNum, '') as supplierNum, supplierName, supplierZipCode FROM stock.suppliers, stock.item_supplier WHERE stock.suppliers.supplierNum = stock.item_supplier.supplierNum AND stock.item_supplier.itemNum = ? union all SELECT concat(stock.suppliers.supplierNum, '1'), supplierName, convert(12345, string) FROM stock.suppliers WHERE stock.suppliers.supplierNum = ?"); //$NON-NLS-1$
+ QueryMetadataInterface metadata = getMetadata("SELECT concat(stock.suppliers.supplierNum, '') as supplierNum, supplierName, supplierZipCode FROM stock.suppliers, stock.item_supplier WHERE stock.suppliers.supplierNum = stock.item_supplier.supplierNum AND stock.item_supplier.itemNum = ? union all SELECT concat(stock.suppliers.supplierNum, '1'), supplierName, convert(12345, string) FROM stock.suppliers WHERE stock.suppliers.supplierNum = ?"); //$NON-NLS-1$
FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
String expectedDoc = TestXMLProcessor.readFile("TestXMLPlanningEnhancements-testMappingClassWithStoredProcedureAndCriteria.xml"); //$NON-NLS-1$
@@ -305,7 +293,7 @@
}
@Test public void testMappingClassWithInputSetElementNameConflict() throws Exception {
- FakeMetadataFacade metadata = getMetadata("SELECT concat(stock.suppliers.supplierNum, '') as supplierNum, supplierName, supplierZipCode FROM stock.suppliers, stock.item_supplier WHERE stock.suppliers.supplierNum = stock.item_supplier.supplierNum AND stock.item_supplier.supplierNum = ?"); //$NON-NLS-1$
+ QueryMetadataInterface metadata = getMetadata("SELECT concat(stock.suppliers.supplierNum, '') as supplierNum, supplierName, supplierZipCode FROM stock.suppliers, stock.item_supplier WHERE stock.suppliers.supplierNum = stock.item_supplier.supplierNum AND stock.item_supplier.supplierNum = ?"); //$NON-NLS-1$
FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
String expectedDoc = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Catalogs>\n<Catalog>\n<Items/>\n</Catalog>\n</Catalogs>"; //$NON-NLS-1$
@@ -313,19 +301,17 @@
}
@Test public void testAutoStagingFailsForMappingClassWithProcRelational() throws Exception {
- FakeMetadataFacade metadata = getMetadata("SELECT supplierNum, supplierName, supplierZipCode FROM v1.supplierProc where itemnum = ?"); //$NON-NLS-1$
+ TransformationMetadata metadata = getMetadata("SELECT supplierNum, supplierName, supplierZipCode FROM v1.supplierProc where itemnum = ?"); //$NON-NLS-1$
- FakeMetadataObject v1 = FakeMetadataFactory.createVirtualModel("v1"); //$NON-NLS-1$
+ Schema v1 = RealMetadataFactory.createVirtualModel("v1", metadata.getMetadataStore()); //$NON-NLS-1$
- FakeMetadataObject rs1 = FakeMetadataFactory.createResultSet("v1.rs1", v1, new String[] {"supplierNum", "supplierName", "supplierZipCode"}, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING,DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ ColumnSet<Procedure> rs1 = RealMetadataFactory.createResultSet("v1.rs1", new String[] {"supplierNum", "supplierName", "supplierZipCode"}, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING,DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- FakeMetadataObject rs1p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs1); //$NON-NLS-1$
- FakeMetadataObject rs1p2 = FakeMetadataFactory.createParameter("itemNum", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
+ ProcedureParameter rs1p2 = RealMetadataFactory.createParameter("itemNum", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
QueryNode n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT concat(stock.suppliers.supplierNum, '') as supplierNum, supplierName, supplierZipCode FROM stock.suppliers, stock.item_supplier WHERE stock.suppliers.supplierNum = stock.item_supplier.supplierNum AND stock.item_supplier.itemNum = v1.supplierProc.itemNum; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vt1 = FakeMetadataFactory.createVirtualProcedure("v1.supplierProc", v1, Arrays.asList(new FakeMetadataObject[] { rs1p1, rs1p2 }), n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(vt1);
-
+ Procedure vt1 = RealMetadataFactory.createVirtualProcedure("supplierProc", v1, Arrays.asList(rs1p2), n1); //$NON-NLS-1$
+ vt1.setResultSet(rs1);
+
FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
String expectedDoc = TestXMLProcessor.readFile("TestXMLPlanningEnhancements-testMappingClassWithStoredProcedureAndCriteria.xml"); //$NON-NLS-1$
@@ -336,7 +322,7 @@
}
@Test public void testMappingClassWitSelectDistinctAndCriteria() throws Exception {
- FakeMetadataFacade metadata = getMetadata("SELECT distinct '1' as supplierNum, '2' as supplierName, '3' as supplierZipCode FROM stock.suppliers, stock.item_supplier WHERE stock.suppliers.supplierNum = stock.item_supplier.supplierNum AND stock.item_supplier.itemNum like substring(?,1,1) || '%'"); //$NON-NLS-1$
+ QueryMetadataInterface metadata = getMetadata("SELECT distinct '1' as supplierNum, '2' as supplierName, '3' as supplierZipCode FROM stock.suppliers, stock.item_supplier WHERE stock.suppliers.supplierNum = stock.item_supplier.supplierNum AND stock.item_supplier.itemNum like substring(?,1,1) || '%'"); //$NON-NLS-1$
FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
@@ -352,7 +338,7 @@
* be used as inputs
*/
@Test public void testMappingClassWithStoredProcedureAndCriteria() throws Exception {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadataCached();
+ QueryMetadataInterface metadata = TestXMLProcessor.exampleMetadataCached();
FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
String expectedDoc = TestXMLProcessor.readFile("TestXMLPlanningEnhancements-testMappingClassWithStoredProcedureAndCriteria.xml"); //$NON-NLS-1$
@@ -360,7 +346,7 @@
}
public void defer_testXMLQueryWithFalseRootCriteria() throws Exception {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadataCached();
+ QueryMetadataInterface metadata = TestXMLProcessor.exampleMetadataCached();
FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
String expectedDoc = ""; //$NON-NLS-1$
@@ -371,13 +357,13 @@
* @see #testNested2WithCriteria2
*/
@Test public void testAutoStagingByCosting() throws Exception {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadata();
+ TransformationMetadata metadata = TestXMLProcessor.exampleMetadata();
FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
- FakeMetadataObject suppliers = metadata.getStore().findObject("stock.suppliers", FakeMetadataObject.GROUP); //$NON-NLS-1$
- FakeMetadataObject itemSuppliers = metadata.getStore().findObject("stock.item_supplier", FakeMetadataObject.GROUP); //$NON-NLS-1$
+ Table suppliers = metadata.getGroupID("stock.suppliers"); //$NON-NLS-1$
+ Table itemSuppliers = metadata.getGroupID("stock.item_supplier"); //$NON-NLS-1$
- suppliers.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(10));
- itemSuppliers.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(10));
+ suppliers.setCardinality(10);
+ itemSuppliers.setCardinality(10);
String expectedDoc = TestXMLProcessor.readFile("TestXMLProcessor-FullSuppliers.xml"); //$NON-NLS-1$
@@ -392,13 +378,13 @@
* @see #testNested2WithCriteria2
*/
@Test public void testAutoStagingFailsByCosting() throws Exception {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadata();
+ TransformationMetadata metadata = TestXMLProcessor.exampleMetadata();
FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
- FakeMetadataObject suppliers = metadata.getStore().findObject("stock.suppliers", FakeMetadataObject.GROUP); //$NON-NLS-1$
- FakeMetadataObject itemSuppliers = metadata.getStore().findObject("stock.item_supplier", FakeMetadataObject.GROUP); //$NON-NLS-1$
+ Table suppliers = metadata.getGroupID("stock.suppliers"); //$NON-NLS-1$
+ Table itemSuppliers = metadata.getGroupID("stock.item_supplier"); //$NON-NLS-1$
- suppliers.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(10000));
- itemSuppliers.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(10000));
+ suppliers.setCardinality(10000);
+ itemSuppliers.setCardinality(10000);
String expectedDoc = TestXMLProcessor.readFile("TestXMLProcessor-FullSuppliers.xml"); //$NON-NLS-1$
@@ -410,7 +396,7 @@
}
@Test public void testAutoStagingFailsByNoCache() throws Exception {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadataCached();
+ QueryMetadataInterface metadata = TestXMLProcessor.exampleMetadataCached();
FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
String expectedDoc = TestXMLProcessor.readFile("TestXMLProcessor-FullSuppliers.xml"); //$NON-NLS-1$
@@ -423,7 +409,7 @@
}
@Test public void testAutoStagingFailsByNoCacheByGroup() throws Exception {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadataCached();
+ QueryMetadataInterface metadata = TestXMLProcessor.exampleMetadataCached();
FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
String expectedDoc = TestXMLProcessor.readFile("TestXMLProcessor-FullSuppliers.xml"); //$NON-NLS-1$
@@ -443,7 +429,7 @@
// see the next test with costing information too.
@Test public void testUseOfStagingCardinalityOnDependentJoinsNoCost() throws Exception {
- FakeMetadataFacade metadata = getTempTableMetadata(false);
+ QueryMetadataInterface metadata = getTempTableMetadata(false);
FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
String expectedDoc = TestXMLProcessor.readFile("TestXMLProcessor-FullSuppliers.xml"); //$NON-NLS-1$
@@ -477,15 +463,15 @@
}
@Test public void testUseOfStagingCardinalityOnDependentJoinsWithCost() throws Exception {
- FakeMetadataFacade metadata = getTempTableMetadata(false);
+ TransformationMetadata metadata = getTempTableMetadata(false);
FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
- FakeMetadataObject orders = metadata.getStore().findObject("stock.orders", FakeMetadataObject.GROUP); //$NON-NLS-1$
- FakeMetadataObject suppliers = metadata.getStore().findObject("stock.suppliers", FakeMetadataObject.GROUP); //$NON-NLS-1$
- // supply the costing information for OrdersC
- orders.putProperty(FakeMetadataObject.Props.CARDINALITY, BufferManager.DEFAULT_PROCESSOR_BATCH_SIZE - 1);
- suppliers.putProperty(FakeMetadataObject.Props.CARDINALITY, RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1);
+ Table orders = metadata.getGroupID("stock.orders"); //$NON-NLS-1$
+ Table suppliers = metadata.getGroupID("stock.suppliers"); //$NON-NLS-1$
+ orders.setCardinality(BufferManager.DEFAULT_PROCESSOR_BATCH_SIZE - 1);
+ suppliers.setCardinality(RuleChooseDependent.DEFAULT_INDEPENDENT_CARDINALITY - 1);
+
String expectedDoc = TestXMLProcessor.readFile("TestXMLProcessor-FullSuppliers.xml"); //$NON-NLS-1$
XMLPlan xmlPlan = (XMLPlan)TestXMLProcessor.helpTestProcess("SELECT * FROM xmltest.docJoin", metadata, dataMgr, null, TestOptimizer.getGenericFinder(false), expectedDoc); //$NON-NLS-1$
@@ -516,13 +502,14 @@
}
@Test public void testNoRedundentStagingTables() throws Exception {
- FakeMetadataFacade metadata = getTempTableMetadata(true);
+ TransformationMetadata metadata = getTempTableMetadata(true);
FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
- FakeMetadataObject suppliers = metadata.getStore().findObject("stock.suppliers", FakeMetadataObject.GROUP); //$NON-NLS-1$
- FakeMetadataObject orders = metadata.getStore().findObject("stock.orders", FakeMetadataObject.GROUP); //$NON-NLS-1$
+
+ Table suppliers = metadata.getGroupID("stock.suppliers"); //$NON-NLS-1$
+ Table orders = metadata.getGroupID("stock.orders"); //$NON-NLS-1$
- suppliers.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(10));
- orders.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(10));
+ suppliers.setCardinality(10);
+ orders.setCardinality(10);
String expectedDoc = TestXMLProcessor.readFile("TestXMLProcessor-OnlySupplier51.xml"); //$NON-NLS-1$
@@ -532,20 +519,4 @@
assertEquals(4, ((List)stats.get(ExecStagingTableInstruction.class)).size());
}
- @Test public void testEmptyMappingClass() throws Exception {
- FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadata();
- FakeDataManager dataMgr = TestXMLProcessor.exampleDataManagerNested(metadata);
- FakeMetadataObject suppliers = metadata.getStore().findObject("xmltest.suppliers", FakeMetadataObject.GROUP); //$NON-NLS-1$
- QueryNode node = (QueryNode)suppliers.getProperty(FakeMetadataObject.Props.PLAN);
- node.setQuery(null);
-
- FakeMetadataObject docGroup = metadata.getStore().findObject("xmltest.doc9", FakeMetadataObject.GROUP); //$NON-NLS-1$
- MappingDocument doc = (MappingDocument)docGroup.getProperty(FakeMetadataObject.Props.PLAN);
- MappingNode suppliersNode = MappingNode.findNode(doc, "Catalogs.Catalog.Items.Item.Suppliers.Supplier".toUpperCase());
- suppliersNode.setExclude(true);
-
- String expectedDoc = TestXMLProcessor.readFile("TestXMLPlanningEnhancements-testEmptyMappingClass.xml"); //$NON-NLS-1$
-
- TestXMLProcessor.helpTestProcess("SELECT * FROM xmltest.doc9", expectedDoc, metadata, dataMgr); //$NON-NLS-1$
- }
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -26,20 +26,27 @@
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import org.teiid.api.exception.query.QueryPlannerException;
+import org.teiid.api.exception.query.QueryResolverException;
import org.teiid.client.metadata.ParameterInfo;
import org.teiid.common.buffer.BufferManager;
import org.teiid.common.buffer.BufferManagerFactory;
import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidException;
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.UnitTestUtil;
+import org.teiid.metadata.ColumnSet;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Procedure;
+import org.teiid.metadata.ProcedureParameter;
+import org.teiid.metadata.Schema;
+import org.teiid.metadata.Table;
import org.teiid.query.analysis.AnalysisRecord;
import org.teiid.query.mapping.relational.QueryNode;
import org.teiid.query.mapping.xml.MappingAttribute;
@@ -48,7 +55,6 @@
import org.teiid.query.mapping.xml.MappingCriteriaNode;
import org.teiid.query.mapping.xml.MappingDocument;
import org.teiid.query.mapping.xml.MappingElement;
-import org.teiid.query.mapping.xml.MappingNode;
import org.teiid.query.mapping.xml.MappingNodeConstants;
import org.teiid.query.mapping.xml.MappingRecursiveElement;
import org.teiid.query.mapping.xml.MappingSequenceNode;
@@ -56,6 +62,7 @@
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.metadata.TempMetadataAdapter;
import org.teiid.query.metadata.TempMetadataStore;
+import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.optimizer.QueryOptimizer;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.CapabilitiesFinder;
@@ -71,11 +78,7 @@
import org.teiid.query.resolver.QueryResolver;
import org.teiid.query.rewriter.QueryRewriter;
import org.teiid.query.sql.lang.Command;
-import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
-import org.teiid.query.unittest.FakeMetadataStore;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
@@ -103,47 +106,46 @@
* itemName (string)
* itemQuantity (integer)
*/
- public static FakeMetadataFacade exampleMetadataCached() {
+ public static TransformationMetadata exampleMetadataCached() {
return EXAMPLE_CACHED;
}
- private static final FakeMetadataFacade EXAMPLE_CACHED = exampleMetadata();
+ private static final TransformationMetadata EXAMPLE_CACHED = exampleMetadata();
- public static FakeMetadataFacade exampleMetadata() {
- FakeMetadataStore store = new FakeMetadataStore();
- FakeMetadataFacade facade = new FakeMetadataFacade(store);
+ public static TransformationMetadata exampleMetadata() {
+ MetadataStore metadataStore = new MetadataStore();
// Create models
- FakeMetadataObject stock = FakeMetadataFactory.createPhysicalModel("stock"); //$NON-NLS-1$
- FakeMetadataObject xmltest = FakeMetadataFactory.createVirtualModel("xmltest"); //$NON-NLS-1$
+ Schema stock = RealMetadataFactory.createPhysicalModel("stock", metadataStore); //$NON-NLS-1$
+ Schema xmltest = RealMetadataFactory.createVirtualModel("xmltest", metadataStore); //$NON-NLS-1$
// Create physical groups
- FakeMetadataObject items = FakeMetadataFactory.createPhysicalGroup("stock.items", stock); //$NON-NLS-1$
- FakeMetadataObject item_supplier = FakeMetadataFactory.createPhysicalGroup("stock.item_supplier", stock); //$NON-NLS-1$
+ Table items = RealMetadataFactory.createPhysicalGroup("items", stock); //$NON-NLS-1$
+ Table item_supplier = RealMetadataFactory.createPhysicalGroup("item_supplier", stock); //$NON-NLS-1$
- FakeMetadataObject suppliers = FakeMetadataFactory.createPhysicalGroup("stock.suppliers", stock); //$NON-NLS-1$
- FakeMetadataObject orders = FakeMetadataFactory.createPhysicalGroup("stock.orders", stock); //$NON-NLS-1$
- FakeMetadataObject employees = FakeMetadataFactory.createPhysicalGroup("stock.employees", stock); //$NON-NLS-1$
+ Table suppliers = RealMetadataFactory.createPhysicalGroup("suppliers", stock); //$NON-NLS-1$
+ Table orders = RealMetadataFactory.createPhysicalGroup("orders", stock); //$NON-NLS-1$
+ Table employees = RealMetadataFactory.createPhysicalGroup("employees", stock); //$NON-NLS-1$
// Create physical elements
- List itemElements = FakeMetadataFactory.createElements(items,
+ RealMetadataFactory.createElements(items,
new String[] { "itemNum", "itemName", "itemQuantity", "itemStatus" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
//many-to-many join table
- List itemSupplierElements = FakeMetadataFactory.createElements(item_supplier,
+ RealMetadataFactory.createElements(item_supplier,
new String[] { "itemNum", "supplierNum" }, //$NON-NLS-1$ //$NON-NLS-2$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- List supplierElements = FakeMetadataFactory.createElements(suppliers,
+ RealMetadataFactory.createElements(suppliers,
new String[] { "supplierNum", "supplierName", "supplierZipCode"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
- List stockOrders = FakeMetadataFactory.createElements(orders,
+ RealMetadataFactory.createElements(orders,
new String[] { "orderNum", "itemFK", "supplierFK", "supplierNameFK", "orderDate", "orderQty", "orderStatus" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING});
- List supplierEmployees = FakeMetadataFactory.createElements(employees,
+ RealMetadataFactory.createElements(employees,
new String[] { "employeeNum", "supplierNumFK", "supervisorNum", "firstName", "lastName" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
@@ -154,43 +156,43 @@
// Create virtual groups
// per defect 6829 - intentionally including the reserved word "group" as part of this virtual group name
QueryNode rsQuery = new QueryNode("SELECT itemNum, itemName, itemQuantity, itemStatus FROM stock.items"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs = FakeMetadataFactory.createVirtualGroup("xmltest.group.items", xmltest, rsQuery); //$NON-NLS-1$
+ Table rs = RealMetadataFactory.createVirtualGroup("group.items", xmltest, rsQuery); //$NON-NLS-1$
// Created 2nd virtual group w/ nested result set & binding
QueryNode rsQuery2 = new QueryNode("SELECT concat(stock.suppliers.supplierNum, '') as supplierNum, supplierName, supplierZipCode FROM stock.suppliers, stock.item_supplier WHERE stock.suppliers.supplierNum = stock.item_supplier.supplierNum AND stock.item_supplier.itemNum = input.x"); //$NON-NLS-1$ //$NON-NLS-2$
//QueryNode rsQuery2 = new QueryNode("xmltest.suppliers", "SELECT stock.suppliers.supplierNum, supplierName, supplierZipCode FROM stock.suppliers, stock.item_supplier WHERE stock.suppliers.supplierNum = stock.item_supplier.supplierNum AND stock.item_supplier.itemNum = ?");
rsQuery2.addBinding("xmltest.group.items.itemNum as x"); //$NON-NLS-1$
- FakeMetadataObject rs2 = FakeMetadataFactory.createVirtualGroup("xmltest.suppliers", xmltest, rsQuery2); //$NON-NLS-1$
+ Table rs2 = RealMetadataFactory.createVirtualGroup("suppliers", xmltest, rsQuery2); //$NON-NLS-1$
// Created virtual group w/ nested result set & binding
QueryNode rsQuery3 = new QueryNode("SELECT orderNum, orderDate, orderQty, orderStatus FROM stock.orders WHERE itemFK = ? AND supplierFK = ? AND supplierNameFK = ?"); //$NON-NLS-1$ //$NON-NLS-2$
rsQuery3.addBinding("xmltest.group.items.itemNum"); //$NON-NLS-1$
rsQuery3.addBinding("xmltest.suppliers.supplierNum"); //$NON-NLS-1$
rsQuery3.addBinding("xmltest.suppliers.supplierName"); //$NON-NLS-1$
- FakeMetadataObject rs3 = FakeMetadataFactory.createVirtualGroup("xmltest.orders", xmltest, rsQuery3); //$NON-NLS-1$
+ Table rs3 = RealMetadataFactory.createVirtualGroup("orders", xmltest, rsQuery3); //$NON-NLS-1$
// ======================================================================================================================
//create employees - not connected to any of the above
QueryNode rsEmployees = new QueryNode("SELECT employeeNum, firstName, lastName FROM stock.employees WHERE supervisorNum IS NULL"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs4 = FakeMetadataFactory.createVirtualGroup("xmltest.employees", xmltest, rsEmployees); //$NON-NLS-1$
+ Table rs4 = RealMetadataFactory.createVirtualGroup("employees", xmltest, rsEmployees); //$NON-NLS-1$
//recursive piece
QueryNode rsEmployeesRecursive = new QueryNode("SELECT employeeNum, firstName, lastName FROM stock.employees WHERE supervisorNum = ?"); //$NON-NLS-1$ //$NON-NLS-2$
rsEmployeesRecursive.addBinding("xmltest.employees.employeeNum"); //$NON-NLS-1$
- FakeMetadataObject rs4a = FakeMetadataFactory.createVirtualGroup("xmltest.employeesRecursive", xmltest, rsEmployeesRecursive); //$NON-NLS-1$
+ Table rs4a = RealMetadataFactory.createVirtualGroup("employeesRecursive", xmltest, rsEmployeesRecursive); //$NON-NLS-1$
// ======================================================================================================================
//create employees - not connected to any of the above
QueryNode rsEmployees2 = new QueryNode("SELECT employeeNum, firstName, lastName, supervisorNum FROM stock.employees WHERE supplierNumFK = '2' AND NOT (supervisorNum IS NULL)"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs5 = FakeMetadataFactory.createVirtualGroup("xmltest.employees2", xmltest, rsEmployees2); //$NON-NLS-1$
+ Table rs5 = RealMetadataFactory.createVirtualGroup("employees2", xmltest, rsEmployees2); //$NON-NLS-1$
//recursive piece
QueryNode rsEmployees2Recursive = new QueryNode("SELECT employeeNum, firstName, lastName, supervisorNum FROM stock.employees WHERE employeeNum = ?"); //$NON-NLS-1$ //$NON-NLS-2$
rsEmployees2Recursive.addBinding("xmltest.employees2.supervisorNum"); //$NON-NLS-1$
- FakeMetadataObject rs5a = FakeMetadataFactory.createVirtualGroup("xmltest.employees2Recursive", xmltest, rsEmployees2Recursive); //$NON-NLS-1$
+ Table rs5a = RealMetadataFactory.createVirtualGroup("employees2Recursive", xmltest, rsEmployees2Recursive); //$NON-NLS-1$
// ======================================================================================================================
// Alternate mapping class which selects from stored query
@@ -198,25 +200,25 @@
// Created 2nd virtual group w/ nested result set & binding
QueryNode rsQueryX = new QueryNode("SELECT * FROM (exec xmltest.sqX(?)) as X"); //$NON-NLS-1$ //$NON-NLS-2$
rsQueryX.addBinding("xmltest.group.items.itemNum"); //$NON-NLS-1$
- FakeMetadataObject rsQX = FakeMetadataFactory.createVirtualGroup("xmltest.suppliersX", xmltest, rsQueryX); //$NON-NLS-1$
+ Table rsQX = RealMetadataFactory.createVirtualGroup("suppliersX", xmltest, rsQueryX); //$NON-NLS-1$
// ======================================================================================================================
// ALTERNATE METADATA A (temp groups)
// root temp group
QueryNode tempQuery = new QueryNode("SELECT * FROM stock.orders"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject temp = FakeMetadataFactory.createVirtualGroup("tempGroup.orders", xmltest, tempQuery); //$NON-NLS-1$
+ Table temp = RealMetadataFactory.createXmlStagingTable("doc9a.tempGroup.orders", xmltest, tempQuery); //$NON-NLS-1$
// 2nd bogus root temp group selects from first - tests that temp groups can select from others
QueryNode tempQuery2 = new QueryNode("SELECT * FROM tempGroup.orders"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject temp2 = FakeMetadataFactory.createVirtualGroup("tempGroup.orders2", xmltest, tempQuery2); //$NON-NLS-1$
+ Table temp2 = RealMetadataFactory.createXmlStagingTable("doc9a.tempGroup.orders2", xmltest, tempQuery2); //$NON-NLS-1$
// Created virtual group w/ nested result set & binding - selects from 2nd temp root group
QueryNode rsQuery3a = new QueryNode("SELECT orderNum, orderDate, orderQty, orderStatus FROM tempGroup.orders2 WHERE itemFK = ? AND supplierFK = ? AND supplierNameFK = ?"); //$NON-NLS-1$ //$NON-NLS-2$
rsQuery3a.addBinding("xmltest.group.items.itemNum"); //$NON-NLS-1$
rsQuery3a.addBinding("xmltest.suppliers.supplierNum"); //$NON-NLS-1$
rsQuery3a.addBinding("xmltest.suppliers.supplierName"); //$NON-NLS-1$
- FakeMetadataObject rs3a = FakeMetadataFactory.createVirtualGroup("xmltest.ordersA", xmltest, rsQuery3a); //$NON-NLS-1$
+ Table rs3a = RealMetadataFactory.createVirtualGroup("ordersA", xmltest, rsQuery3a); //$NON-NLS-1$
// ======================================================================================================================
// ALTERNATE METADATA B (temp groups)
@@ -228,11 +230,11 @@
tempQuery3b.addBinding("xmltest.group.items.itemNum"); //$NON-NLS-1$
tempQuery3b.addBinding("xmltest.suppliers.supplierNum"); //$NON-NLS-1$
tempQuery3b.addBinding("xmltest.suppliers.supplierName"); //$NON-NLS-1$
- FakeMetadataObject temp3b = FakeMetadataFactory.createVirtualGroup("tempGroup.orders3B", xmltest, tempQuery3b); //$NON-NLS-1$
+ Table temp3b = RealMetadataFactory.createVirtualGroup("tempGroup.orders3B", xmltest, tempQuery3b); //$NON-NLS-1$
// Created virtual group w/ nested result set & binding
QueryNode rsQuery3b = new QueryNode("SELECT orderNum, orderDate, orderQty, orderStatus FROM tempGroup.orders3B"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs3b = FakeMetadataFactory.createVirtualGroup("xmltest.ordersB", xmltest, rsQuery3b); //$NON-NLS-1$
+ Table rs3b = RealMetadataFactory.createVirtualGroup("ordersB", xmltest, rsQuery3b); //$NON-NLS-1$
// ======================================================================================================================
@@ -243,11 +245,11 @@
// tempQuery3b.addBinding("xmltest.group.items.itemNum");
// tempQuery3b.addBinding("xmltest.suppliers.supplierNum");
// tempQuery3b.addBinding("xmltest.suppliers.supplierName");
-// FakeMetadataObject temp3b = FakeMetadataFactory.createVirtualGroup("tempGroup.orders3B", xmltest, tempQuery3b);
+// Table temp3b = RealMetadataFactory.createVirtualGroup("orders3B", xmltest, tempQuery3b);
//
// // Created virtual group w/ nested result set & binding
// QueryNode rsQuery3b = new QueryNode("xmltest.ordersB", "SELECT orderNum, orderDate, orderQty, orderStatus FROM tempGroup.orders3B");
-// FakeMetadataObject rs3b = FakeMetadataFactory.createVirtualGroup("xmltest.ordersB", xmltest, rs Query3b);
+// Table rs3b = RealMetadataFactory.createVirtualGroup("ordersB", xmltest, rs Query3b);
// ======================================================================================================================
@@ -256,9 +258,9 @@
// Create virtual groups
// per defect 12260 - correlated subquery in mapping class transformation
QueryNode rsQuery12260 = new QueryNode("SELECT itemNum, itemName, itemQuantity, itemStatus, convert((select count(*) from stock.item_supplier where stock.items.itemNum = stock.item_supplier.itemNum), string) as NUMSuppliers FROM stock.items"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs12260 = FakeMetadataFactory.createVirtualGroup("xmltest.group.itemsWithNumSuppliers", xmltest, rsQuery12260); //$NON-NLS-1$
+ Table rs12260 = RealMetadataFactory.createVirtualGroup("group.itemsWithNumSuppliers", xmltest, rsQuery12260); //$NON-NLS-1$
- List rsElements12260 = FakeMetadataFactory.createElements(rs12260,
+ RealMetadataFactory.createElements(rs12260,
new String[] { "itemNum", "itemName", "itemQuantity", "itemStatus", "numSuppliers" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
@@ -267,24 +269,24 @@
// Create virtual groups
// per defect 8373
QueryNode rsQuery8373 = new QueryNode("SELECT itemNum, itemName, itemQuantity, itemStatus FROM stock.items UNION ALL SELECT itemNum, itemName, itemQuantity, itemStatus FROM stock.items"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs8373 = FakeMetadataFactory.createVirtualGroup("xmltest.items8373", xmltest, rsQuery8373); //$NON-NLS-1$
+ Table rs8373 = RealMetadataFactory.createVirtualGroup("items8373", xmltest, rsQuery8373); //$NON-NLS-1$
- List rsElements8373 = FakeMetadataFactory.createElements(rs8373,
+ RealMetadataFactory.createElements(rs8373,
new String[] { "itemNum", "itemName", "itemQuantity", "itemStatus" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
//select * from xmltest.items8373
QueryNode rsQuery8373a = new QueryNode("SELECT * FROM xmltest.items8373"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs8373a = FakeMetadataFactory.createVirtualGroup("xmltest.items8373a", xmltest, rsQuery8373a); //$NON-NLS-1$
+ Table rs8373a = RealMetadataFactory.createVirtualGroup("items8373a", xmltest, rsQuery8373a); //$NON-NLS-1$
- List rsElements8373a = FakeMetadataFactory.createElements(rs8373a,
+ RealMetadataFactory.createElements(rs8373a,
new String[] { "itemNum", "itemName", "itemQuantity", "itemStatus" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
QueryNode rsQuery8373b = new QueryNode("SELECT * FROM xmltest.group.items UNION ALL SELECT * FROM xmltest.group.items"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs8373b = FakeMetadataFactory.createVirtualGroup("xmltest.items8373b", xmltest, rsQuery8373b); //$NON-NLS-1$
+ Table rs8373b = RealMetadataFactory.createVirtualGroup("items8373b", xmltest, rsQuery8373b); //$NON-NLS-1$
- List rsElements8373b = FakeMetadataFactory.createElements(rs8373b,
+ RealMetadataFactory.createElements(rs8373b,
new String[] { "itemNum", "itemName", "itemQuantity", "itemStatus" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
@@ -294,133 +296,132 @@
// Test an update query as a mapping class transformation, as if it were a
// mapping class returning a single int - defect 8812
QueryNode rsUpdateQuery = new QueryNode("INSERT INTO stock.items (itemNum, itemName, itemQuantity, itemStatus) VALUES ('3','beer',12,'something')"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rsUpdate = FakeMetadataFactory.createVirtualGroup("xmltest.updateTest", xmltest, rsUpdateQuery); //$NON-NLS-1$
+ Table rsUpdate = RealMetadataFactory.createVirtualGroup("updateTest", xmltest, rsUpdateQuery); //$NON-NLS-1$
// Create virtual elements
- List rsElements = FakeMetadataFactory.createElements(rs,
+ RealMetadataFactory.createElements(rs,
new String[] { "itemNum", "itemName", "itemQuantity", "itemStatus" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
- List rsElements2 = FakeMetadataFactory.createElements(rs2,
+ RealMetadataFactory.createElements(rs2,
new String[] { "supplierNum", "supplierName", "supplierZipCode"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
- List rsElements3 = FakeMetadataFactory.createElements(rs3,
+ RealMetadataFactory.createElements(rs3,
new String[] { "orderNum", "orderDate", "orderQty", "orderStatus" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING});
- List rsElements4 = FakeMetadataFactory.createElements(rs4,
+ RealMetadataFactory.createElements(rs4,
new String[] { "employeeNum", "firstName", "lastName" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
- List rsElements4a = FakeMetadataFactory.createElements(rs4a,
+ RealMetadataFactory.createElements(rs4a,
new String[] { "employeeNum", "firstName", "lastName" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
- List rsElements5 = FakeMetadataFactory.createElements(rs5,
+ RealMetadataFactory.createElements(rs5,
new String[] { "employeeNum", "firstName", "lastName", "supervisorNum" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
- List rsElements5a = FakeMetadataFactory.createElements(rs5a,
+ RealMetadataFactory.createElements(rs5a,
new String[] { "employeeNum", "firstName", "lastName", "supervisorNum" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
- List tempElements = FakeMetadataFactory.createElements(temp,
+ RealMetadataFactory.createElements(temp,
new String[] { "orderNum", "itemFK", "supplierFK", "supplierNameFK", "orderDate", "orderQty", "orderStatus" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING});
- List tempElements2 = FakeMetadataFactory.createElements(temp2,
+ RealMetadataFactory.createElements(temp2,
new String[] { "orderNum", "itemFK", "supplierFK", "supplierNameFK", "orderDate", "orderQty", "orderStatus" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING});
- List rsElements3a = FakeMetadataFactory.createElements(rs3a,
+ RealMetadataFactory.createElements(rs3a,
new String[] { "orderNum", "orderDate", "orderQty", "orderStatus" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING});
- List tempElements3b = FakeMetadataFactory.createElements(temp3b,
+ RealMetadataFactory.createElements(temp3b,
new String[] { "orderNum", "orderDate", "orderQty", "orderStatus" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING});
- List rsElements3b = FakeMetadataFactory.createElements(rs3b,
+ RealMetadataFactory.createElements(rs3b,
new String[] { "orderNum", "orderDate", "orderQty", "orderStatus" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING});
- List rsUpdateElement = FakeMetadataFactory.createElements(rsUpdate,
+ RealMetadataFactory.createElements(rsUpdate,
new String[] { "rowCount" }, //$NON-NLS-1$
new String[] { DataTypeManager.DefaultDataTypes.INTEGER});
- List rsElementsX = FakeMetadataFactory.createElements(rsQX,
+ RealMetadataFactory.createElements(rsQX,
new String[] { "supplierNum", "supplierName", "supplierZipCode" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
// Create virtual docs
- FakeMetadataObject doc1 = FakeMetadataFactory.createVirtualGroup("xmltest.doc1", xmltest, createXMLMappingNode(true)); //$NON-NLS-1$
- List docE1 = FakeMetadataFactory.createElements(doc1, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+ Table doc1 = RealMetadataFactory.createXmlDocument("doc1", xmltest, createXMLMappingNode(true)); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc1, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
- FakeMetadataObject doc1a = FakeMetadataFactory.createVirtualGroup("xmltest.doc1Unformatted", xmltest, createXMLMappingNode(false)); //$NON-NLS-1$
- FakeMetadataObject doc1b = FakeMetadataFactory.createVirtualGroup("xmltest.doc1b", xmltest, createXMLPlan2(false, true, 0 )); //$NON-NLS-1$
- List docE1b = FakeMetadataFactory.createElements(doc1b, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+ RealMetadataFactory.createXmlDocument("doc1Unformatted", xmltest, createXMLMappingNode(false)); //$NON-NLS-1$
+ Table doc1b = RealMetadataFactory.createXmlDocument("doc1b", xmltest, createXMLPlan2(false, true, 0 )); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc1b, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
- FakeMetadataObject doc1c = FakeMetadataFactory.createVirtualGroup("xmltest.doc1c", xmltest, createXMLPlan2(false, true, 1 )); //$NON-NLS-1$
- List docE1c = FakeMetadataFactory.createElements(doc1c, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+ Table doc1c = RealMetadataFactory.createXmlDocument("doc1c", xmltest, createXMLPlan2(false, true, 1 )); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc1c, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
- FakeMetadataObject docBounded = FakeMetadataFactory.createVirtualGroup("xmltest.docBounded", xmltest, createXMLMappingBoundingNode()); //$NON-NLS-1$
- List docBoundedElements = FakeMetadataFactory.createElements(docBounded, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+ Table docBounded = RealMetadataFactory.createXmlDocument("docBounded", xmltest, createXMLMappingBoundingNode()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(docBounded, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
-
- FakeMetadataObject doc2 = FakeMetadataFactory.createVirtualGroup("xmltest.doc2", xmltest, createXMLPlan2(1, -1, false)); //$NON-NLS-1$
- List docE2 = FakeMetadataFactory.createElements(doc2, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Table doc2 = RealMetadataFactory.createXmlDocument("doc2", xmltest, createXMLPlan2(1, -1, false)); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc2, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- FakeMetadataObject doc2a = FakeMetadataFactory.createVirtualGroup("xmltest.doc2a", xmltest, createXMLPlan2(1, 1, false)); //$NON-NLS-1$
- FakeMetadataObject doc2b = FakeMetadataFactory.createVirtualGroup("xmltest.doc2b", xmltest, createXMLPlan2(1, -1, true)); //$NON-NLS-1$
- FakeMetadataObject doc2c = FakeMetadataFactory.createVirtualGroup("xmltest.doc2c", xmltest, createXMLPlan2(2, -1, false)); //$NON-NLS-1$
- FakeMetadataObject doc2d = FakeMetadataFactory.createVirtualGroup("xmltest.doc2d", xmltest, createXMLPlan2(2, 1, false)); //$NON-NLS-1$
- FakeMetadataObject doc2e = FakeMetadataFactory.createVirtualGroup("xmltest.doc2e", xmltest, createXMLPlan2(2, 3, false)); //$NON-NLS-1$
+ RealMetadataFactory.createXmlDocument("doc2a", xmltest, createXMLPlan2(1, 1, false)); //$NON-NLS-1$
+ RealMetadataFactory.createXmlDocument("doc2b", xmltest, createXMLPlan2(1, -1, true)); //$NON-NLS-1$
+ RealMetadataFactory.createXmlDocument("doc2c", xmltest, createXMLPlan2(2, -1, false)); //$NON-NLS-1$
+ RealMetadataFactory.createXmlDocument("doc2d", xmltest, createXMLPlan2(2, 1, false)); //$NON-NLS-1$
+ RealMetadataFactory.createXmlDocument("doc2e", xmltest, createXMLPlan2(2, 3, false)); //$NON-NLS-1$
- FakeMetadataObject doc3 = FakeMetadataFactory.createVirtualGroup("xmltest.doc3", xmltest, createXMLPlanWithDefaults()); //$NON-NLS-1$
- List docE3 = FakeMetadataFactory.createElements(doc3, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+ Table doc3 = RealMetadataFactory.createXmlDocument("doc3", xmltest, createXMLPlanWithDefaults()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc3, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
- FakeMetadataObject doc4 = FakeMetadataFactory.createVirtualGroup("xmltest.doc4", xmltest, createXMLPlanAdvanced()); //$NON-NLS-1$
- List docE4 = FakeMetadataFactory.createElements(doc4, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Fake", "Catalogs.Fake.FakeChild2", "Catalogs.Fake.FakeChild2.FakeChild2a", "Catalogs.Fake.FakeChild3", "Catalogs.Fake.FakeChild3.@FakeAtt" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$
+ Table doc4 = RealMetadataFactory.createXmlDocument("doc4", xmltest, createXMLPlanAdvanced()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc4, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Fake", "Catalogs.Fake.FakeChild2", "Catalogs.Fake.FakeChild2.FakeChild2a", "Catalogs.Fake.FakeChild3", "Catalogs.Fake.FakeChild3.@FakeAtt" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER,DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
- FakeMetadataObject doc5 = FakeMetadataFactory.createVirtualGroup("xmltest.doc5", xmltest, createXMLPlanUltraAdvanced()); //$NON-NLS-1$
- List docE5 = FakeMetadataFactory.createElements(doc5, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem.@ItemID", "Catalogs.Catalog.items.DiscontinuedItem.Name", "Catalogs.Catalog.items.DiscontinuedItem.Quantity", "Catalogs.Catalog.items.StatusUnknown", "Catalogs.Catalog.items.StatusUnknown.@ItemID", "Catalogs.Catalog.items.StatusUnknown.Name", "Catalogs.Catalog.items.StatusUnknown.Quantity", "Catalogs.Catalog.items.Shouldn't see", "Catalogs.Catalog.items.Shouldn't see 2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$
+ Table doc5 = RealMetadataFactory.createXmlDocument("doc5", xmltest, createXMLPlanUltraAdvanced()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc5, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem.@ItemID", "Catalogs.Catalog.items.DiscontinuedItem.Name", "Catalogs.Catalog.items.DiscontinuedItem.Quantity", "Catalogs.Catalog.items.StatusUnknown", "Catalogs.Catalog.items.StatusUnknown.@ItemID", "Catalogs.Catalog.items.StatusUnknown.Name", "Catalogs.Catalog.items.StatusUnknown.Quantity", "Catalogs.Catalog.items.Shouldn't see", "Catalogs.Catalog.items.Shouldn't see 2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- FakeMetadataObject doc6 = FakeMetadataFactory.createVirtualGroup("xmltest.doc6", xmltest, createXMLPlanUltraAdvancedExceptionOnDefault()); //$NON-NLS-1$
- List docE6 = FakeMetadataFactory.createElements(doc6, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem.@ItemID", "Catalogs.Catalog.items.DiscontinuedItem.Name", "Catalogs.Catalog.items.DiscontinuedItem.Quantity", "Catalogs.Catalog.items.Shouldn't see"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$
+ Table doc6 = RealMetadataFactory.createXmlDocument("doc6", xmltest, createXMLPlanUltraAdvancedExceptionOnDefault()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc6, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem.@ItemID", "Catalogs.Catalog.items.DiscontinuedItem.Name", "Catalogs.Catalog.items.DiscontinuedItem.Quantity", "Catalogs.Catalog.items.Shouldn't see"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
- FakeMetadataObject doc7 = FakeMetadataFactory.createVirtualGroup("xmltest.doc7", xmltest, createTestAttributePlan()); //$NON-NLS-1$
- List docE7 = FakeMetadataFactory.createElements(doc7, new String[] { "FixedValueTest", "FixedValueTest.wrapper", "FixedValueTest.wrapper.@fixed", "FixedValueTest.wrapper.@key", "FixedValueTest.wrapper.@fixedAttr"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ Table doc7 = RealMetadataFactory.createXmlDocument("doc7", xmltest, createTestAttributePlan()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc7, new String[] { "FixedValueTest", "FixedValueTest.wrapper", "FixedValueTest.wrapper.@fixed", "FixedValueTest.wrapper.@key", "FixedValueTest.wrapper.@fixedAttr"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
- FakeMetadataObject doc8 = FakeMetadataFactory.createVirtualGroup("xmltest.doc8", xmltest, createXMLPlanNested()); //$NON-NLS-1$
- List docE8 = FakeMetadataFactory.createElements(doc8, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier.@SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$
+ Table doc8 = RealMetadataFactory.createXmlDocument("doc8", xmltest, createXMLPlanNested()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc8, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier.@SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
- FakeMetadataObject doc9 = FakeMetadataFactory.createVirtualGroup("xmltest.doc9", xmltest, createXMLPlanNested2()); //$NON-NLS-1$
- List docE9 = FakeMetadataFactory.createElements(doc9, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier.@SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name", "Catalogs.Catalog.items.item.suppliers.supplier.orders", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.@OrderID" ,"Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderDate", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderQuantity", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderStatus"}, //$NON-NLS-1$ //$NON-NLS-2$!
//$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$ //$NON-NLS-18$
+ Table doc9 = RealMetadataFactory.createXmlDocument("doc9", xmltest, createXMLPlanNested2()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc9, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier.@SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name", "Catalogs.Catalog.items.item.suppliers.supplier.orders", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.@OrderID" ,"Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderDate", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderQuantity", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderStatus"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3!
$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$ //$NON-NLS-18$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
- FakeMetadataObject doc9a = FakeMetadataFactory.createVirtualGroup("xmltest.doc9a", xmltest, createXMLPlanNested2a()); //$NON-NLS-1$
- List docE9a = FakeMetadataFactory.createElements(doc9a, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier.@SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name", "Catalogs.Catalog.items.item.suppliers.supplier.orders", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.@OrderID" ,"Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderDate", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderQuantity", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderStatus"}, //$NON-NLS-1$ //$NON-NLS-!
2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$ //$NON-NLS-18$
+ Table doc9a = RealMetadataFactory.createXmlDocument("doc9a", xmltest, createXMLPlanNested2a()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc9a, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier.@SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name", "Catalogs.Catalog.items.item.suppliers.supplier.orders", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.@OrderID" ,"Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderDate", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderQuantity", "Catalogs.Catalog.items.item.suppliers.supplier.orders.order.OrderStatus"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-!
3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$ //$NON-NLS-18$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
- FakeMetadataObject doc9b = FakeMetadataFactory.createVirtualGroup("xmltest.doc9b", xmltest, createXMLPlanNested2b()); //$NON-NLS-1$
- FakeMetadataObject doc10 = FakeMetadataFactory.createVirtualGroup("xmltest.doc10", xmltest, createXMLPlanNestedWithChoice()); //$NON-NLS-1$
- List docE10 = FakeMetadataFactory.createElements(doc10, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier.@SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order.@OrderID" ,"Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order.OrderDate", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order.OrderQuantity", "Catalogs.Catalog.items.item.suppliers.supplier.Pro!
cessingOrders.order.OrderStatus", "Catalogs.Catalog.items.item.suppliers.supplier.orders.ProcessingOrders" ,"Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.otherorder.@OrderID", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.otherorder"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$ //$NON-NLS-18$ //$NON-NLS-19$ //$NON-NLS-20$ //$NON-NLS-21$
+ RealMetadataFactory.createXmlDocument("doc9b", xmltest, createXMLPlanNested2b()); //$NON-NLS-1$
+ Table doc10 = RealMetadataFactory.createXmlDocument("doc10", xmltest, createXMLPlanNestedWithChoice()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc10, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier.@SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order.@OrderID" ,"Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order.OrderDate", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order.OrderQuantity", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.!
order.OrderStatus", "Catalogs.Catalog.items.item.suppliers.supplier.orders.ProcessingOrders" ,"Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.otherorder.@OrderID", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.otherorder"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$ //$NON-NLS-18$ //$NON-NLS-19$ //$NON-NLS-20$ //$NON-NLS-21$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
- FakeMetadataObject doc10L = FakeMetadataFactory.createVirtualGroup("xmltest.doc10L", xmltest, createXMLPlanNestedWithLookupChoice()); //$NON-NLS-1$
- List docE10L = FakeMetadataFactory.createElements(doc10L, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier.@SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order.@OrderID" ,"Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order.OrderDate", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order.OrderQuantity", "Catalogs.Catalog.items.item.suppliers.supplier.P!
rocessingOrders.order.OrderStatus", "Catalogs.Catalog.items.item.suppliers.supplier.orders.ProcessingOrders" ,"Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.otherorder.@OrderID", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.otherorder"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$ //$NON-NLS-18$ //$NON-NLS-19$ //$NON-NLS-20$ //$NON-NLS-21$
+ Table doc10L = RealMetadataFactory.createXmlDocument("doc10L", xmltest, createXMLPlanNestedWithLookupChoice()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc10L, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier.@SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order.@OrderID" ,"Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order.OrderDate", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.order.OrderQuantity", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders!
.order.OrderStatus", "Catalogs.Catalog.items.item.suppliers.supplier.orders.ProcessingOrders" ,"Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.otherorder.@OrderID", "Catalogs.Catalog.items.item.suppliers.supplier.ProcessingOrders.otherorder"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$ //$NON-NLS-18$ //$NON-NLS-19$ //$NON-NLS-20$ //$NON-NLS-21$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
- FakeMetadataObject doc11 = FakeMetadataFactory.createVirtualGroup("xmltest.doc11", xmltest, createXMLPlanMultipleDocs()); //$NON-NLS-1$
- List docE11 = FakeMetadataFactory.createElements(doc11, new String[] { "Item", "Item.@ItemID", "Item.Name", "Item.Quantity", "Item.Suppliers", "Item.Suppliers.Supplier", "Item.Suppliers.Supplier.@SupplierID", "Item.Suppliers.Supplier.Name", "Item.Suppliers.Supplier.Zip"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
+ Table doc11 = RealMetadataFactory.createXmlDocument("doc11", xmltest, createXMLPlanMultipleDocs()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc11, new String[] { "Item", "Item.@ItemID", "Item.Name", "Item.Quantity", "Item.Suppliers", "Item.Suppliers.Supplier", "Item.Suppliers.Supplier.@SupplierID", "Item.Suppliers.Supplier.Name", "Item.Suppliers.Supplier.Zip"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
//variations on the same recursive doc====================
@@ -428,92 +429,92 @@
int recursionlimit = -1;
boolean exceptionOnLimit = false;
- FakeMetadataObject doc12 = FakeMetadataFactory.createVirtualGroup("xmltest.doc12", xmltest, createXMLPlanRecursive(useRecursiveCriteria, recursionlimit, exceptionOnLimit)); //$NON-NLS-1$
- FakeMetadataObject doc12a = FakeMetadataFactory.createVirtualGroup("xmltest.doc12a", xmltest, createXMLPlanRecursiveA(useRecursiveCriteria, recursionlimit, exceptionOnLimit)); //$NON-NLS-1$
+ RealMetadataFactory.createXmlDocument("doc12", xmltest, createXMLPlanRecursive(useRecursiveCriteria, recursionlimit, exceptionOnLimit)); //$NON-NLS-1$
+ RealMetadataFactory.createXmlDocument("doc12a", xmltest, createXMLPlanRecursiveA(useRecursiveCriteria, recursionlimit, exceptionOnLimit)); //$NON-NLS-1$
useRecursiveCriteria = true;
- FakeMetadataObject doc13 = FakeMetadataFactory.createVirtualGroup("xmltest.doc13", xmltest, createXMLPlanRecursive(useRecursiveCriteria, recursionlimit, exceptionOnLimit)); //$NON-NLS-1$
+ RealMetadataFactory.createXmlDocument("doc13", xmltest, createXMLPlanRecursive(useRecursiveCriteria, recursionlimit, exceptionOnLimit)); //$NON-NLS-1$
useRecursiveCriteria = false;
recursionlimit = 2;
- FakeMetadataObject doc14 = FakeMetadataFactory.createVirtualGroup("xmltest.doc14", xmltest, createXMLPlanRecursive(useRecursiveCriteria, recursionlimit, exceptionOnLimit)); //$NON-NLS-1$
+ RealMetadataFactory.createXmlDocument("doc14", xmltest, createXMLPlanRecursive(useRecursiveCriteria, recursionlimit, exceptionOnLimit)); //$NON-NLS-1$
exceptionOnLimit = true;
- FakeMetadataObject doc15 = FakeMetadataFactory.createVirtualGroup("xmltest.doc15", xmltest, createXMLPlanRecursive(useRecursiveCriteria, recursionlimit, exceptionOnLimit)); //$NON-NLS-1$
+ RealMetadataFactory.createXmlDocument("doc15", xmltest, createXMLPlanRecursive(useRecursiveCriteria, recursionlimit, exceptionOnLimit)); //$NON-NLS-1$
useRecursiveCriteria = false;
recursionlimit = -1;
exceptionOnLimit = false;
- FakeMetadataObject doc16 = FakeMetadataFactory.createVirtualGroup("xmltest.doc16", xmltest, createXMLPlanRecursive2(useRecursiveCriteria, recursionlimit, exceptionOnLimit)); //$NON-NLS-1$
+ RealMetadataFactory.createXmlDocument("doc16", xmltest, createXMLPlanRecursive2(useRecursiveCriteria, recursionlimit, exceptionOnLimit)); //$NON-NLS-1$
- FakeMetadataObject doc17 = FakeMetadataFactory.createVirtualGroup("xmltest.doc17", xmltest, createXMLPlanWithComment()); //$NON-NLS-1$
+ RealMetadataFactory.createXmlDocument("doc17", xmltest, createXMLPlanWithComment()); //$NON-NLS-1$
- FakeMetadataObject doc_5266a = FakeMetadataFactory.createVirtualGroup("xmltest.doc_5266a", xmltest, createXMLPlanNestedWithChoiceFor5266()); //$NON-NLS-1$
- List doc_E5266a = FakeMetadataFactory.createElements(doc_5266a, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Table doc_5266a = RealMetadataFactory.createXmlDocument("doc_5266a", xmltest, createXMLPlanNestedWithChoiceFor5266()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc_5266a, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- FakeMetadataObject doc_8917 = FakeMetadataFactory.createVirtualGroup("xmltest.doc_8917", xmltest, createXMLPlan_defect8917()); //$NON-NLS-1$
- FakeMetadataObject doc_9446 = FakeMetadataFactory.createVirtualGroup("xmltest.doc_9446", xmltest, createXMLPlan_defect9446()); //$NON-NLS-1$
- FakeMetadataObject doc_9530 = FakeMetadataFactory.createVirtualGroup("xmltest.doc_9530", xmltest, createXMLPlan_defect_9530()); //$NON-NLS-1$
+ RealMetadataFactory.createXmlDocument("doc_8917", xmltest, createXMLPlan_defect8917()); //$NON-NLS-1$
+ Table doc_9446 = RealMetadataFactory.createXmlDocument("doc_9446", xmltest, createXMLPlan_defect9446()); //$NON-NLS-1$
+ RealMetadataFactory.createXmlDocument("doc_9530", xmltest, createXMLPlan_defect_9530()); //$NON-NLS-1$
- List docE_9446 = FakeMetadataFactory.createElements(doc_9446, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.XXXXX", "Catalogs.Catalog.items.item.XXXXX", "Catalogs.Catalog.items.item.XXXXX"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER});
+ RealMetadataFactory.createElements(doc_9446, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.XXXXX"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER});
//Test doc w/ update mapping class transformation
- FakeMetadataObject docUpdateTest = FakeMetadataFactory.createVirtualGroup("xmltest.docUpdateTest", xmltest, createUpdateTestDoc()); //$NON-NLS-1$
+ RealMetadataFactory.createXmlDocument("docUpdateTest", xmltest, createUpdateTestDoc()); //$NON-NLS-1$
- FakeMetadataObject doc_9893 = FakeMetadataFactory.createVirtualGroup("xmltest.doc9893", xmltest, createXMLPlan_9893()); //$NON-NLS-1$
- List docE_9893 = FakeMetadataFactory.createElements(doc_9893, new String[] { "Root", "Root.ItemName"}, //$NON-NLS-1$ //$NON-NLS-2$
+ Table doc_9893 = RealMetadataFactory.createXmlDocument("doc9893", xmltest, createXMLPlan_9893()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc_9893, new String[] { "Root", "Root.ItemName"}, //$NON-NLS-1$ //$NON-NLS-2$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
- FakeMetadataObject doc18 = FakeMetadataFactory.createVirtualGroup("xmltest.doc18", xmltest, createXMLPlanNested("xmltest.suppliersX")); //$NON-NLS-1$ //$NON-NLS-2$
- List docE18 = FakeMetadataFactory.createElements(doc18, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier.@SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$
+ Table doc18 = RealMetadataFactory.createXmlDocument("doc18", xmltest, createXMLPlanNested("xmltest.suppliersX")); //$NON-NLS-1$ //$NON-NLS-2$
+ RealMetadataFactory.createElements(doc18, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier.@SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
- FakeMetadataObject doc12260 = FakeMetadataFactory.createVirtualGroup("xmltest.doc12260", xmltest, createXMLPlanCorrelatedSubqueryTransform()); //$NON-NLS-1$
- List docE12260 = FakeMetadataFactory.createElements(doc12260, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.numSuppliers" }, //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-7$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-8$
+ Table doc12260 = RealMetadataFactory.createXmlDocument("doc12260", xmltest, createXMLPlanCorrelatedSubqueryTransform()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc12260, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.numSuppliers" }, //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-7$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-8$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING});
- FakeMetadataObject doc8373 = FakeMetadataFactory.createVirtualGroup("xmltest.doc8373", xmltest, createXMLPlan_defect8373()); //$NON-NLS-1$
- List docE8373 = FakeMetadataFactory.createElements(doc8373, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.numSuppliers" }, //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-7$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-8$
+ Table doc8373 = RealMetadataFactory.createXmlDocument("doc8373", xmltest, createXMLPlan_defect8373()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc8373, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.numSuppliers" }, //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-7$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-8$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING});
- FakeMetadataObject doc8373a = FakeMetadataFactory.createVirtualGroup("xmltest.doc8373a", xmltest, createXMLPlan_defect8373a()); //$NON-NLS-1$
- List docE8373a = FakeMetadataFactory.createElements(doc8373a, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.numSuppliers" }, //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-7$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-8$
+ Table doc8373a = RealMetadataFactory.createXmlDocument("doc8373a", xmltest, createXMLPlan_defect8373a()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc8373a, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.numSuppliers" }, //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-7$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-8$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING});
- FakeMetadataObject doc8373b = FakeMetadataFactory.createVirtualGroup("xmltest.doc8373b", xmltest, createXMLPlan_defect8373b()); //$NON-NLS-1$
- List docE8373b = FakeMetadataFactory.createElements(doc8373b, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.numSuppliers" }, //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-7$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-8$
+ Table doc8373b = RealMetadataFactory.createXmlDocument("doc8373b", xmltest, createXMLPlan_defect8373b()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc8373b, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.numSuppliers" }, //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-7$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-8$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING});
- FakeMetadataObject doc13617 = FakeMetadataFactory.createVirtualGroup("xmltest.doc13617", xmltest, createXMLPlanDefect13617()); //$NON-NLS-1$
- List docE13617 = FakeMetadataFactory.createElements(doc13617, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity" }, //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-7$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ Table doc13617 = RealMetadataFactory.createXmlDocument("doc13617", xmltest, createXMLPlanDefect13617()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc13617, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity" }, //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-7$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER});
// recursive + staging ========================================================
- FakeMetadataObject doc19 = FakeMetadataFactory.createVirtualGroup("xmltest.doc19", xmltest, createXMLPlanRecursiveStaging(true, recursionlimit, exceptionOnLimit)); //$NON-NLS-1$
+ RealMetadataFactory.createXmlDocument("doc19", xmltest, createXMLPlanRecursiveStaging(true, recursionlimit, exceptionOnLimit)); //$NON-NLS-1$
// root temp group
QueryNode doc19TempQuery = new QueryNode("SELECT employeeNum, firstName, lastName, supervisorNum FROM stock.employees"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject tempDoc19 = FakeMetadataFactory.createVirtualGroup("xmltest.doc19temp", xmltest, doc19TempQuery); //$NON-NLS-1$
- List doc19TempQueryE = FakeMetadataFactory.createElements(tempDoc19,
+ Table tempDoc19 = RealMetadataFactory.createVirtualGroup("doc19temp", xmltest, doc19TempQuery); //$NON-NLS-1$
+ RealMetadataFactory.createElements(tempDoc19,
new String[] { "employeeNum", "firstName", "lastName", "supervisorNum" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
//create employees - not connected to any of the above
QueryNode rsEmployeesDoc19 = new QueryNode("SELECT employeeNum, firstName, lastName FROM xmltest.doc19temp WHERE supervisorNum IS NULL"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject mc1Doc19 = FakeMetadataFactory.createVirtualGroup("xmltest.employeesDoc19", xmltest, rsEmployeesDoc19); //$NON-NLS-1$
- List mc1Doc19E = FakeMetadataFactory.createElements(mc1Doc19,
+ Table mc1Doc19 = RealMetadataFactory.createVirtualGroup("employeesDoc19", xmltest, rsEmployeesDoc19); //$NON-NLS-1$
+ RealMetadataFactory.createElements(mc1Doc19,
new String[] { "employeeNum", "firstName", "lastName" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
//recursive piece
QueryNode rsEmployeesRecursiveDoc19 = new QueryNode("SELECT employeeNum, firstName, lastName FROM xmltest.doc19temp WHERE supervisorNum = ?"); //$NON-NLS-1$ //$NON-NLS-2$
rsEmployeesRecursiveDoc19.addBinding("xmltest.employeesDoc19.employeeNum"); //$NON-NLS-1$
- FakeMetadataObject mc2Doc19 = FakeMetadataFactory.createVirtualGroup("xmltest.employeesRecursiveDoc19", xmltest, rsEmployeesRecursiveDoc19); //$NON-NLS-1$
- List mc2Doc19E = FakeMetadataFactory.createElements(mc2Doc19,
+ Table mc2Doc19 = RealMetadataFactory.createVirtualGroup("employeesRecursiveDoc19", xmltest, rsEmployeesRecursiveDoc19); //$NON-NLS-1$
+ RealMetadataFactory.createElements(mc2Doc19,
new String[] { "employeeNum", "firstName", "lastName" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
@@ -522,217 +523,71 @@
//========================================================
// Stored queries
- FakeMetadataObject rsX = FakeMetadataFactory.createResultSet("xmltest.rsX", xmltest, new String[] { "supplierNum", "supplierName", "supplierZipCode" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- FakeMetadataObject rsXp1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rsX); //$NON-NLS-1$
- FakeMetadataObject rsXp2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
+ ColumnSet<Procedure> rsX = RealMetadataFactory.createResultSet("xmltest.rsX", new String[] { "supplierNum", "supplierName", "supplierZipCode" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ ProcedureParameter rsXp2 = RealMetadataFactory.createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
//there is an extra statement in this proc so that the procedure wrapper is not removed
QueryNode sqXn1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN declare string x; SELECT concat(stock.suppliers.supplierNum, '') as supplierNum, supplierName, supplierZipCode FROM stock.suppliers, stock.item_supplier WHERE stock.suppliers.supplierNum = stock.item_supplier.supplierNum AND stock.item_supplier.itemNum = xmltest.sqX.in; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sqX = FakeMetadataFactory.createVirtualProcedure("xmltest.sqX", xmltest, Arrays.asList(new FakeMetadataObject[] { rsXp1, rsXp2 }), sqXn1); //$NON-NLS-1$
+ Procedure sqX = RealMetadataFactory.createVirtualProcedure("sqX", xmltest, Arrays.asList(rsXp2), sqXn1); //$NON-NLS-1$
+ sqX.setResultSet(rsX);
// Documents for Text Normalization Test
// normDoc1 - for collapse
// normDoc2 - for replace
// normDoc3 - for preserve
- FakeMetadataObject normDoc1 = FakeMetadataFactory.createVirtualGroup("xmltest.normDoc1", xmltest, createXMLPlanNormalization(MappingNodeConstants.NORMALIZE_TEXT_COLLAPSE)); //$NON-NLS-1$
- List normDocE1 = FakeMetadataFactory.createElements(normDoc1, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem.@ItemID", "Catalogs.Catalog.items.DiscontinuedItem.Name", "Catalogs.Catalog.items.DiscontinuedItem.Quantity", "Catalogs.Catalog.items.StatusUnknown", "Catalogs.Catalog.items.StatusUnknown.@ItemID", "Catalogs.Catalog.items.StatusUnknown.Name", "Catalogs.Catalog.items.StatusUnknown.Quantity", "Catalogs.Catalog.items.Shouldn't see", "Catalogs.Catalog.items.Shouldn't see 2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-N!
LS-17$
+ Table normDoc1 = RealMetadataFactory.createXmlDocument("normDoc1", xmltest, createXMLPlanNormalization(MappingNodeConstants.NORMALIZE_TEXT_COLLAPSE)); //$NON-NLS-1$
+ RealMetadataFactory.createElements(normDoc1, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem.@ItemID", "Catalogs.Catalog.items.DiscontinuedItem.Name", "Catalogs.Catalog.items.DiscontinuedItem.Quantity", "Catalogs.Catalog.items.StatusUnknown", "Catalogs.Catalog.items.StatusUnknown.@ItemID", "Catalogs.Catalog.items.StatusUnknown.Name", "Catalogs.Catalog.items.StatusUnknown.Quantity", "Catalogs.Catalog.items.Shouldn't see", "Catalogs.Catalog.items.Shouldn't see 2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- FakeMetadataObject normDoc2 = FakeMetadataFactory.createVirtualGroup("xmltest.normDoc2", xmltest, createXMLPlanNormalization(MappingNodeConstants.NORMALIZE_TEXT_REPLACE)); //$NON-NLS-1$
- List normDocE2 = FakeMetadataFactory.createElements(normDoc2, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem.@ItemID", "Catalogs.Catalog.items.DiscontinuedItem.Name", "Catalogs.Catalog.items.DiscontinuedItem.Quantity", "Catalogs.Catalog.items.StatusUnknown", "Catalogs.Catalog.items.StatusUnknown.@ItemID", "Catalogs.Catalog.items.StatusUnknown.Name", "Catalogs.Catalog.items.StatusUnknown.Quantity", "Catalogs.Catalog.items.Shouldn't see", "Catalogs.Catalog.items.Shouldn't see 2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-N!
LS-17$
+ Table normDoc2 = RealMetadataFactory.createXmlDocument("normDoc2", xmltest, createXMLPlanNormalization(MappingNodeConstants.NORMALIZE_TEXT_REPLACE)); //$NON-NLS-1$
+ RealMetadataFactory.createElements(normDoc2, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem.@ItemID", "Catalogs.Catalog.items.DiscontinuedItem.Name", "Catalogs.Catalog.items.DiscontinuedItem.Quantity", "Catalogs.Catalog.items.StatusUnknown", "Catalogs.Catalog.items.StatusUnknown.@ItemID", "Catalogs.Catalog.items.StatusUnknown.Name", "Catalogs.Catalog.items.StatusUnknown.Quantity", "Catalogs.Catalog.items.Shouldn't see", "Catalogs.Catalog.items.Shouldn't see 2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- FakeMetadataObject normDoc3 = FakeMetadataFactory.createVirtualGroup("xmltest.normDoc3", xmltest, createXMLPlanNormalization(MappingNodeConstants.NORMALIZE_TEXT_PRESERVE)); //$NON-NLS-1$
- List normDocE3 = FakeMetadataFactory.createElements(normDoc3, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem.@ItemID", "Catalogs.Catalog.items.DiscontinuedItem.Name", "Catalogs.Catalog.items.DiscontinuedItem.Quantity", "Catalogs.Catalog.items.StatusUnknown", "Catalogs.Catalog.items.StatusUnknown.@ItemID", "Catalogs.Catalog.items.StatusUnknown.Name", "Catalogs.Catalog.items.StatusUnknown.Quantity", "Catalogs.Catalog.items.Shouldn't see", "Catalogs.Catalog.items.Shouldn't see 2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-N!
LS-17$
+ Table normDoc3 = RealMetadataFactory.createXmlDocument("normDoc3", xmltest, createXMLPlanNormalization(MappingNodeConstants.NORMALIZE_TEXT_PRESERVE)); //$NON-NLS-1$
+ RealMetadataFactory.createElements(normDoc3, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem.@ItemID", "Catalogs.Catalog.items.DiscontinuedItem.Name", "Catalogs.Catalog.items.DiscontinuedItem.Quantity", "Catalogs.Catalog.items.StatusUnknown", "Catalogs.Catalog.items.StatusUnknown.@ItemID", "Catalogs.Catalog.items.StatusUnknown.Name", "Catalogs.Catalog.items.StatusUnknown.Quantity", "Catalogs.Catalog.items.Shouldn't see", "Catalogs.Catalog.items.Shouldn't see 2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
QueryNode vspqn1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN insert into #temp select * from stock.items where itemquantity < param; SELECT * FROM xmltest.doc1 where Item.Quantity < (select avg(itemquantity) from #temp); END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsprs1 = FakeMetadataFactory.createResultSet("pm1.vsprs1", xmltest, new String[] { "xml" }, new String[] { DataTypeManager.DefaultDataTypes.XML }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vspp1 = FakeMetadataFactory.createParameter("param", 1, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, vsprs1); //$NON-NLS-1$
- FakeMetadataObject vspp2 = FakeMetadataFactory.createParameter("ret", 2, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.XML, vsprs1); //$NON-NLS-1$
- FakeMetadataObject vsp1 = FakeMetadataFactory.createVirtualProcedure("xmltest.vsp1", xmltest, Arrays.asList(vspp1, vspp2 ), vspqn1); //$NON-NLS-1$
+ ColumnSet<Procedure> vsprs1 = RealMetadataFactory.createResultSet("pm1.vsprs1", new String[] { "xml" }, new String[] { DataTypeManager.DefaultDataTypes.XML }); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcedureParameter vspp1 = RealMetadataFactory.createParameter("param", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ Procedure vsp1 = RealMetadataFactory.createVirtualProcedure("vsp1", xmltest, Arrays.asList(vspp1 ), vspqn1); //$NON-NLS-1$
+ vsp1.setResultSet(vsprs1);
- // Add all objects to the store
- store.addObject(stock);
- store.addObject(items);
- store.addObject(item_supplier);
-
- store.addObject(suppliers);
- store.addObject(orders);
- store.addObject(employees);
- store.addObjects(itemElements);
- store.addObjects(itemSupplierElements);
- store.addObjects(supplierElements);
- store.addObjects(stockOrders);
- store.addObjects(supplierEmployees);
-
- store.addObject(xmltest);
- store.addObject(rs);
- store.addObject(rs2);
- store.addObject(rs3);
- store.addObject(rs4);
- store.addObject(rs4a);
- store.addObject(rs5);
- store.addObject(rs5a);
- store.addObject(temp);
- store.addObject(temp2);
- store.addObject(rs3a);
- store.addObject(temp3b);
- store.addObject(rs3b);
- store.addObject(rsQX);
- store.addObject(rs12260);
- store.addObject(rs8373);
- store.addObject(rs8373a);
- store.addObject(rs8373b);
-
- //Stored query
- store.addObject(rsX);
- store.addObject(sqX);
-
- store.addObject(rsUpdate);
- store.addObjects(rsElements);
- store.addObjects(rsElements2);
- store.addObjects(rsElements3);
- store.addObjects(rsElements4);
- store.addObjects(rsElements4a);
- store.addObjects(rsElements5);
- store.addObjects(rsElements5a);
- store.addObjects(tempElements);
- store.addObjects(tempElements2);
- store.addObjects(rsElements3a);
- store.addObjects(tempElements3b);
- store.addObjects(rsElements3b);
- store.addObjects(rsUpdateElement);
- store.addObjects(rsElementsX);
- store.addObjects(rsElements12260);
- store.addObjects(rsElements8373);
- store.addObjects(rsElements8373a);
- store.addObjects(rsElements8373b);
-
- store.addObject(doc1);
- store.addObject(docBounded);
- store.addObject(doc1a);
- store.addObject(doc1b);
- store.addObject(doc1c);
- store.addObject(doc2);
- store.addObject(doc2a);
- store.addObject(doc2b);
- store.addObject(doc2c);
- store.addObject(doc2d);
- store.addObject(doc2e);
- store.addObject(doc3);
- store.addObject(doc4);
- store.addObject(doc5);
-
- store.addObject(normDoc1);
- store.addObject(normDoc2);
- store.addObject(normDoc3);
-
- store.addObject(doc6);
- store.addObject(doc7);
- store.addObject(doc8);
- store.addObject(doc9);
- store.addObject(doc9a);
- store.addObject(doc9b);
-
- store.addObject(doc10);
- store.addObject(doc10L);
- store.addObject(doc11);
- store.addObject(doc12);
- store.addObject(doc12a);
- store.addObject(doc13);
- store.addObject(doc14);
- store.addObject(doc15);
- store.addObject(doc16);
- store.addObject(doc17);
- store.addObject(doc_8917);
- store.addObject(doc_9446);
- store.addObject(doc_9530);
- store.addObject(docUpdateTest);
- store.addObject(doc_9893);
- store.addObject(doc18);
- store.addObject(doc12260);
- store.addObject(doc8373);
- store.addObject(doc8373a);
- store.addObject(doc8373b);
- store.addObject(doc13617);
- store.addObject(doc19);
- store.addObject(tempDoc19);
- store.addObject(mc1Doc19);
- store.addObject(mc2Doc19);
- store.addObject(doc_5266a);
-
- store.addObjects(doc19TempQueryE);
- store.addObjects(mc1Doc19E);
- store.addObjects(mc2Doc19E);
-
- store.addObjects(docE1);
- store.addObjects(docE1b);
- store.addObjects(docE1c);
- store.addObjects(docBoundedElements);
- store.addObjects(docE2);
- store.addObjects(docE3);
- store.addObjects(docE4);
- store.addObjects(docE5);
- store.addObjects(normDocE1);
- store.addObjects(normDocE2);
- store.addObjects(normDocE3);
- store.addObjects(docE6);
- store.addObjects(docE7);
- store.addObjects(docE8);
- store.addObjects(docE9);
- store.addObjects(docE9a);
- store.addObjects(docE_9446);
- store.addObjects(docE_9893);
- store.addObjects(docE18);
- store.addObjects(docE12260);
- store.addObjects(docE8373);
- store.addObjects(docE8373a);
- store.addObjects(docE8373b);
- store.addObjects(docE13617);
- store.addObjects(doc_E5266a);
-
- store.addObjects(docE10);
- store.addObjects(docE10L);
- store.addObjects(docE11);
-
- store.addObject(vsp1);
- return facade;
+ return RealMetadataFactory.createTransformationMetadata(metadataStore, "example1");
}
- public FakeMetadataFacade exampleMetadataNestedWithSibling() {
- FakeMetadataStore store = new FakeMetadataStore();
- FakeMetadataFacade facade = new FakeMetadataFacade(store);
+ public QueryMetadataInterface exampleMetadataNestedWithSibling() {
+ MetadataStore metadataStore = new MetadataStore();
// Create models
- FakeMetadataObject stock = FakeMetadataFactory.createPhysicalModel("stock"); //$NON-NLS-1$
- FakeMetadataObject xmltest = FakeMetadataFactory.createVirtualModel("xmltest"); //$NON-NLS-1$
+ Schema stock = RealMetadataFactory.createPhysicalModel("stock", metadataStore); //$NON-NLS-1$
+ Schema xmltest = RealMetadataFactory.createVirtualModel("xmltest", metadataStore); //$NON-NLS-1$
// Create physical groups
- FakeMetadataObject items = FakeMetadataFactory.createPhysicalGroup("stock.items", stock); //$NON-NLS-1$
- FakeMetadataObject item_supplier = FakeMetadataFactory.createPhysicalGroup("stock.item_supplier", stock); //$NON-NLS-1$
- FakeMetadataObject item_order = FakeMetadataFactory.createPhysicalGroup("stock.item_order", stock); //$NON-NLS-1$
- FakeMetadataObject orders = FakeMetadataFactory.createPhysicalGroup("stock.orders", stock); //$NON-NLS-1$
- FakeMetadataObject suppliers = FakeMetadataFactory.createPhysicalGroup("stock.suppliers", stock); //$NON-NLS-1$
+ Table items = RealMetadataFactory.createPhysicalGroup("items", stock); //$NON-NLS-1$
+ Table item_supplier = RealMetadataFactory.createPhysicalGroup("item_supplier", stock); //$NON-NLS-1$
+ Table item_order = RealMetadataFactory.createPhysicalGroup("item_order", stock); //$NON-NLS-1$
+ Table orders = RealMetadataFactory.createPhysicalGroup("orders", stock); //$NON-NLS-1$
+ Table suppliers = RealMetadataFactory.createPhysicalGroup("suppliers", stock); //$NON-NLS-1$
// Create physical elements
- List itemElements = FakeMetadataFactory.createElements(items,
+ RealMetadataFactory.createElements(items,
new String[] { "itemNum", "itemName", "itemQuantity", "itemStatus" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
//many-to-many join table
- List itemSupplierElements = FakeMetadataFactory.createElements(item_supplier,
+ RealMetadataFactory.createElements(item_supplier,
new String[] { "itemNum", "supplierNum" }, //$NON-NLS-1$ //$NON-NLS-2$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- List supplierElements = FakeMetadataFactory.createElements(suppliers,
+ RealMetadataFactory.createElements(suppliers,
new String[] { "supplierNum", "supplierName", "supplierZipCode" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
//many-to-many join table
- List itemOrderElements = FakeMetadataFactory.createElements(item_order,
+ RealMetadataFactory.createElements(item_order,
new String[] { "itemNum", "orderNum" }, //$NON-NLS-1$ //$NON-NLS-2$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- List stockOrders = FakeMetadataFactory.createElements(orders,
+ RealMetadataFactory.createElements(orders,
new String[] { "orderNum", "orderName", "orderZipCode" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
@@ -740,288 +595,204 @@
// Create virtual groups
QueryNode rsQuery1 = new QueryNode("SELECT itemNum, itemName, itemQuantity, itemStatus FROM stock.items"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs1 = FakeMetadataFactory.createVirtualGroup("xmltest.group.items", xmltest, rsQuery1); //$NON-NLS-1$
+ Table rs1 = RealMetadataFactory.createVirtualGroup("group.items", xmltest, rsQuery1); //$NON-NLS-1$
QueryNode rsQuery2 = new QueryNode("SELECT concat(stock.suppliers.supplierNum, '') as supplierNum, supplierName, supplierZipCode FROM stock.suppliers, stock.item_supplier WHERE stock.suppliers.supplierNum = stock.item_supplier.supplierNum AND stock.item_supplier.itemNum = ?"); //$NON-NLS-1$ //$NON-NLS-2$
rsQuery2.addBinding("xmltest.group.items.itemNum"); //$NON-NLS-1$
- FakeMetadataObject rs2 = FakeMetadataFactory.createVirtualGroup("xmltest.suppliers", xmltest, rsQuery2); //$NON-NLS-1$
+ Table rs2 = RealMetadataFactory.createVirtualGroup("suppliers", xmltest, rsQuery2); //$NON-NLS-1$
QueryNode rsQuery3 = new QueryNode("SELECT concat(stock.orders.orderNum, '') as orderNum, orderName, orderZipCode FROM stock.orders, stock.item_order WHERE stock.orders.orderNum = stock.item_order.orderNum AND stock.item_order.itemNum = ?"); //$NON-NLS-1$ //$NON-NLS-2$
rsQuery3.addBinding("xmltest.group.items.itemNum"); //$NON-NLS-1$
- FakeMetadataObject rs3= FakeMetadataFactory.createVirtualGroup("xmltest.orders", xmltest, rsQuery3); //$NON-NLS-1$
+ Table rs3= RealMetadataFactory.createVirtualGroup("orders", xmltest, rsQuery3); //$NON-NLS-1$
// Create virtual elements
- List rsElements1 = FakeMetadataFactory.createElements(rs1,
+ RealMetadataFactory.createElements(rs1,
new String[] { "itemNum", "itemName", "itemQuantity", "itemStatus" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
- List rsElements2 = FakeMetadataFactory.createElements(rs2,
+ RealMetadataFactory.createElements(rs2,
new String[] { "supplierNum", "supplierName", "supplierZipCode" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- List rsElements3 = FakeMetadataFactory.createElements(rs3,
+ RealMetadataFactory.createElements(rs3,
new String[] { "orderNum", "orderName", "orderZipCode" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
// =========================================================================================================
// Create virtual docs
- FakeMetadataObject doc9c= FakeMetadataFactory.createVirtualGroup("xmltest.doc9c", xmltest, createXMLPlanNested2c()); //$NON-NLS-1$
- List docE9c = FakeMetadataFactory.createElements(doc9c, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier.@SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name", "Catalogs.Catalog.items.item.orders", "Catalogs.Catalog.items.item.orders.order", "Catalogs.Catalog.items.item.orders.order.@OrderID" ,"Catalogs.Catalog.items.item.orders.order.zip", "Catalogs.Catalog.items.item.orders.order.Name"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ !
//$NON-NLS-16$ //$NON-NLS-17$
+ Table doc9c= RealMetadataFactory.createXmlDocument("doc9c", xmltest, createXMLPlanNested2c()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc9c, new String[] { "Catalogs", "Catalogs.Catalog", "Catalogs.Catalog.items", "Catalogs.Catalog.items.item", "Catalogs.Catalog.items.item.@ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.item.suppliers", "Catalogs.Catalog.items.item.suppliers.supplier", "Catalogs.Catalog.items.item.suppliers.supplier.@SupplierID", "Catalogs.Catalog.items.item.suppliers.supplier.zip", "Catalogs.Catalog.items.item.suppliers.supplier.Name", "Catalogs.Catalog.items.item.orders", "Catalogs.Catalog.items.item.orders.order", "Catalogs.Catalog.items.item.orders.order.@OrderID" ,"Catalogs.Catalog.items.item.orders.order.zip", "Catalogs.Catalog.items.item.orders.order.Name"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$!
//$NON-NLS-17$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
- //========================================================
-
- // Add all objects to the store
- store.addObject(stock);
-
- store.addObject(items);
- store.addObject(item_supplier);
- store.addObject(item_order);
- store.addObject(suppliers);
- store.addObject(orders);
-
- store.addObjects(itemElements);
- store.addObjects(itemSupplierElements);
- store.addObjects(supplierElements);
- store.addObjects(stockOrders);
- store.addObjects(itemOrderElements);
-
- store.addObject(xmltest);
- store.addObject(rs1);
- store.addObject(rs2);
- store.addObject(rs3);
-
- store.addObjects(rsElements1);
- store.addObjects(rsElements2);
- store.addObjects(rsElements3);
-
- store.addObject(doc9c);
- store.addObjects(docE9c);
-
- // Create the facade from the store
- return facade;
+ return RealMetadataFactory.createTransformationMetadata(metadataStore, "nestedWithSibling");
}
- public static FakeMetadataFacade exampleMetadata2() {
- FakeMetadataStore store = new FakeMetadataStore();
- FakeMetadataFacade facade = new FakeMetadataFacade(store);
+ public static TransformationMetadata exampleMetadata2() {
+ MetadataStore metadataStore = new MetadataStore();
// Create models
- FakeMetadataObject xqt = FakeMetadataFactory.createPhysicalModel("xqt"); //$NON-NLS-1$
- FakeMetadataObject xqttest = FakeMetadataFactory.createVirtualModel("xqttest"); //$NON-NLS-1$
+ Schema xqt = RealMetadataFactory.createPhysicalModel("xqt", metadataStore); //$NON-NLS-1$
+ Schema xqttest = RealMetadataFactory.createVirtualModel("xqttest", metadataStore); //$NON-NLS-1$
// Create physical groups
- FakeMetadataObject xqtGroup = FakeMetadataFactory.createPhysicalGroup("xqt.data", xqt); //$NON-NLS-1$
+ Table xqtGroup = RealMetadataFactory.createPhysicalGroup("data", xqt); //$NON-NLS-1$
// Create physical elements
- List xqtData = FakeMetadataFactory.createElements(xqtGroup,
+ RealMetadataFactory.createElements(xqtGroup,
new String[] { "intKey", "intNum", "stringNum" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
// Create new XML recursion tests virtual groups
QueryNode xqtDataGroup = new QueryNode("SELECT intKey as key, intNum as data, (intKey + 2) as nextKey FROM xqt.data"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject objData = FakeMetadataFactory.createVirtualGroup("xqttest.xqtData", xqttest, xqtDataGroup); //$NON-NLS-1$
+ Table objData = RealMetadataFactory.createVirtualGroup("xqtData", xqttest, xqtDataGroup); //$NON-NLS-1$
QueryNode rsGroup = new QueryNode("SELECT key as ID, data as CODE, nextKey as supervisorID FROM xqttest.xqtData"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject objGroup = FakeMetadataFactory.createVirtualGroup("xqttest.group", xqttest, rsGroup); //$NON-NLS-1$
+ Table objGroup = RealMetadataFactory.createVirtualGroup("group", xqttest, rsGroup); //$NON-NLS-1$
QueryNode rsSupervisor = new QueryNode("SELECT key as ID, data as CODE, nextKey as groupID FROM xqttest.xqtData WHERE key = ?"); //$NON-NLS-1$ //$NON-NLS-2$
rsSupervisor.addBinding("xqttest.group.supervisorID"); //$NON-NLS-1$
- FakeMetadataObject objSupervisor = FakeMetadataFactory.createVirtualGroup("xqttest.supervisor", xqttest, rsSupervisor); //$NON-NLS-1$
+ Table objSupervisor = RealMetadataFactory.createVirtualGroup("supervisor", xqttest, rsSupervisor); //$NON-NLS-1$
QueryNode rsGroup1 = new QueryNode("SELECT key as ID, data as CODE, nextKey as supervisorID FROM xqttest.xqtData WHERE key = ?"); //$NON-NLS-1$ //$NON-NLS-2$
rsGroup1.addBinding("xqttest.supervisor.groupID"); //$NON-NLS-1$
- FakeMetadataObject objGroup1 = FakeMetadataFactory.createVirtualGroup("xqttest.group1", xqttest, rsGroup1); //$NON-NLS-1$
+ Table objGroup1 = RealMetadataFactory.createVirtualGroup("group1", xqttest, rsGroup1); //$NON-NLS-1$
// Create virtual elements
- List elemXQTData = FakeMetadataFactory.createElements(objData,
+ RealMetadataFactory.createElements(objData,
new String[] { "key", "data", "nextKey" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER });
- List elemGroup = FakeMetadataFactory.createElements(objGroup,
+ RealMetadataFactory.createElements(objGroup,
new String[] { "ID", "code", "supervisorID" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER });
- List elemSupervisor = FakeMetadataFactory.createElements(objSupervisor,
+ RealMetadataFactory.createElements(objSupervisor,
new String[] { "ID", "code", "groupID" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER });
- List elemGroup1 = FakeMetadataFactory.createElements(objGroup1,
+ RealMetadataFactory.createElements(objGroup1,
new String[] { "ID", "code", "supervisorID" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER });
// Create virtual groups
QueryNode rsQuery = new QueryNode("SELECT intKey, intNum, stringNum FROM xqt.data WHERE intKey=13"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs = FakeMetadataFactory.createVirtualGroup("xqttest.data", xqttest, rsQuery); //$NON-NLS-1$
+ Table rs = RealMetadataFactory.createVirtualGroup("data", xqttest, rsQuery); //$NON-NLS-1$
QueryNode rsQuery2 = new QueryNode("SELECT intKey, intNum, stringNum FROM xqt.data WHERE intKey = ?"); //$NON-NLS-1$ //$NON-NLS-2$
rsQuery2.addBinding("xqttest.data.intNum"); //$NON-NLS-1$
- FakeMetadataObject rs2 = FakeMetadataFactory.createVirtualGroup("xqttest.data2", xqttest, rsQuery2); //$NON-NLS-1$
+ Table rs2 = RealMetadataFactory.createVirtualGroup("data2", xqttest, rsQuery2); //$NON-NLS-1$
QueryNode rsQuery3 = new QueryNode("SELECT intKey, intNum, stringNum FROM xqt.data WHERE intKey = ?"); //$NON-NLS-1$ //$NON-NLS-2$
rsQuery3.addBinding("xqttest.data2.intNum"); //$NON-NLS-1$
- FakeMetadataObject rs3 = FakeMetadataFactory.createVirtualGroup("xqttest.data3", xqttest, rsQuery3); //$NON-NLS-1$
+ Table rs3 = RealMetadataFactory.createVirtualGroup("data3", xqttest, rsQuery3); //$NON-NLS-1$
QueryNode rsQuery4 = new QueryNode("SELECT intKey, intNum, stringNum FROM xqt.data WHERE intKey = ?"); //$NON-NLS-1$ //$NON-NLS-2$
rsQuery4.addBinding("xqttest.data.intNum"); //$NON-NLS-1$
- FakeMetadataObject rs4 = FakeMetadataFactory.createVirtualGroup("xqttest.data4", xqttest, rsQuery4); //$NON-NLS-1$
+ Table rs4 = RealMetadataFactory.createVirtualGroup("data4", xqttest, rsQuery4); //$NON-NLS-1$
QueryNode rsQuery5 = new QueryNode("SELECT intKey, intNum, stringNum FROM xqt.data WHERE intKey = ?"); //$NON-NLS-1$ //$NON-NLS-2$
rsQuery5.addBinding("xqttest.data4.intNum"); //$NON-NLS-1$
- FakeMetadataObject rs5 = FakeMetadataFactory.createVirtualGroup("xqttest.data5", xqttest, rsQuery5); //$NON-NLS-1$
+ Table rs5 = RealMetadataFactory.createVirtualGroup("data5", xqttest, rsQuery5); //$NON-NLS-1$
QueryNode rsQuery6 = new QueryNode("SELECT intKey, intNum, stringNum FROM xqt.data WHERE intKey = ?"); //$NON-NLS-1$ //$NON-NLS-2$
rsQuery6.addBinding("xqttest.data5.intNum"); //$NON-NLS-1$
- FakeMetadataObject rs6 = FakeMetadataFactory.createVirtualGroup("xqttest.data6", xqttest, rsQuery6); //$NON-NLS-1$
+ Table rs6 = RealMetadataFactory.createVirtualGroup("data6", xqttest, rsQuery6); //$NON-NLS-1$
QueryNode rsQuery7 = new QueryNode("SELECT intKey, intNum, stringNum FROM xqt.data"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs7 = FakeMetadataFactory.createVirtualGroup("xqttest.data7", xqttest, rsQuery7); //$NON-NLS-1$
+ Table rs7 = RealMetadataFactory.createVirtualGroup("data7", xqttest, rsQuery7); //$NON-NLS-1$
QueryNode rsQuery8 = new QueryNode("SELECT intKey, intNum, stringNum FROM xqt.data WHERE intKey < ?"); //$NON-NLS-1$ //$NON-NLS-2$
rsQuery8.addBinding("xqttest.data7.intNum"); //$NON-NLS-1$
- FakeMetadataObject rs8 = FakeMetadataFactory.createVirtualGroup("xqttest.data8", xqttest, rsQuery8); //$NON-NLS-1$
+ Table rs8 = RealMetadataFactory.createVirtualGroup("data8", xqttest, rsQuery8); //$NON-NLS-1$
// Create virtual elements
- List rsElements = FakeMetadataFactory.createElements(rs,
+ RealMetadataFactory.createElements(rs,
new String[] { "intKey", "intNum", "stringNum" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
- List rsElements2 = FakeMetadataFactory.createElements(rs2,
+ RealMetadataFactory.createElements(rs2,
new String[] { "intKey", "intNum", "stringNum" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
- List rsElements3 = FakeMetadataFactory.createElements(rs3,
+ RealMetadataFactory.createElements(rs3,
new String[] { "intKey", "intNum", "stringNum" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
- List rsElements4 = FakeMetadataFactory.createElements(rs4,
+ RealMetadataFactory.createElements(rs4,
new String[] { "intKey", "intNum", "stringNum" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
- List rsElements5 = FakeMetadataFactory.createElements(rs5,
+ RealMetadataFactory.createElements(rs5,
new String[] { "intKey", "intNum", "stringNum" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
- List rsElements6 = FakeMetadataFactory.createElements(rs6,
+ RealMetadataFactory.createElements(rs6,
new String[] { "intKey", "intNum", "stringNum" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
- List rsElements7 = FakeMetadataFactory.createElements(rs7,
+ RealMetadataFactory.createElements(rs7,
new String[] { "intKey", "intNum", "stringNum" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
- List rsElements8 = FakeMetadataFactory.createElements(rs8,
+ RealMetadataFactory.createElements(rs8,
new String[] { "intKey", "intNum", "stringNum" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
- FakeMetadataObject doc1 = FakeMetadataFactory.createVirtualGroup("xqttest.doc1", xqttest, createXQTPlanRecursive_5988()); //$NON-NLS-1$
- FakeMetadataObject doc1a = FakeMetadataFactory.createVirtualGroup("xqttest.doc1a", xqttest, createXQTPlanRecursive1a_5988()); //$NON-NLS-1$
- FakeMetadataObject doc2 = FakeMetadataFactory.createVirtualGroup("xqttest.doc2", xqttest, createXQTPlanRecursiveSiblings()); //$NON-NLS-1$
- FakeMetadataObject doc3 = FakeMetadataFactory.createVirtualGroup("xqttest.doc3", xqttest, createXQTPlanRecursive3_5988()); //$NON-NLS-1$
- FakeMetadataObject doc4 = FakeMetadataFactory.createVirtualGroup("xqttest.doc4", xqttest, createXQTPlanChoice_6796()); //$NON-NLS-1$
- FakeMetadataObject doc5 = FakeMetadataFactory.createVirtualGroup("xqttest.doc5", xqttest, createChoiceDefect24651()); //$NON-NLS-1$
- FakeMetadataObject groupDoc = FakeMetadataFactory.createVirtualGroup("xqttest.groupDoc", xqttest, createGroupDoc()); //$NON-NLS-1$
+ RealMetadataFactory.createXmlDocument("doc1", xqttest, createXQTPlanRecursive_5988()); //$NON-NLS-1$
+ RealMetadataFactory.createXmlDocument("doc1a", xqttest, createXQTPlanRecursive1a_5988()); //$NON-NLS-1$
+ RealMetadataFactory.createXmlDocument("doc2", xqttest, createXQTPlanRecursiveSiblings()); //$NON-NLS-1$
+ RealMetadataFactory.createXmlDocument("doc3", xqttest, createXQTPlanRecursive3_5988()); //$NON-NLS-1$
+ Table doc4 = RealMetadataFactory.createXmlDocument("doc4", xqttest, createXQTPlanChoice_6796()); //$NON-NLS-1$
+ Table doc5 = RealMetadataFactory.createXmlDocument("doc5", xqttest, createChoiceDefect24651()); //$NON-NLS-1$
+ Table groupDoc = RealMetadataFactory.createXmlDocument("groupDoc", xqttest, createGroupDoc()); //$NON-NLS-1$
- List elemGroupDoc = FakeMetadataFactory.createElements(groupDoc, new String[] { "group", "group.pseudoID" /*, etc...*/ }, //$NON-NLS-1$ //$NON-NLS-2$
+ RealMetadataFactory.createElements(groupDoc, new String[] { "group", "group.pseudoID" /*, etc...*/ }, //$NON-NLS-1$ //$NON-NLS-2$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
- List elemGroupDoc4 = FakeMetadataFactory.createElements(doc4, new String[] { "root", "root.key", "root.key.keys", "root.key.keys.nestedkey", "root.wrapper.key", "root.wrapper.key.keys", "root.wrapper.key.keys.nestedkey"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+ RealMetadataFactory.createElements(doc4, new String[] { "root", "root.key", "root.key.keys", "root.key.keys.nestedkey", "root.wrapper.key", "root.wrapper.key.keys", "root.wrapper.key.keys.nestedkey"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
- List elemGroupDoc5 = FakeMetadataFactory.createElements(doc5, new String[] { "root", "root.wrapper.key" }, //$NON-NLS-1$ //$NON-NLS-2$
+ RealMetadataFactory.createElements(doc5, new String[] { "root", "root.wrapper.key" }, //$NON-NLS-1$ //$NON-NLS-2$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
- store.addObject(xqt);
- store.addObject(xqtGroup);
- store.addObjects(xqtData);
-
- store.addObject(xqttest);
-
- store.addObject(objData);
- store.addObject(objGroup);
- store.addObject(objSupervisor);
- store.addObject(objGroup1);
- store.addObjects(elemXQTData);
- store.addObjects(elemGroup);
- store.addObjects(elemSupervisor);
- store.addObjects(elemGroup1);
-
- store.addObject(rs);
- store.addObject(rs2);
- store.addObject(rs3);
- store.addObject(rs4);
- store.addObject(rs5);
- store.addObject(rs6);
- store.addObject(rs7);
- store.addObject(rs8);
- store.addObjects(rsElements);
- store.addObjects(rsElements2);
- store.addObjects(rsElements3);
- store.addObjects(rsElements4);
- store.addObjects(rsElements5);
- store.addObjects(rsElements6);
- store.addObjects(rsElements7);
- store.addObjects(rsElements8);
-
- store.addObject(doc1);
- store.addObject(doc1a);
- store.addObject(doc2);
- store.addObject(doc3);
- store.addObject(doc4);
- store.addObject(doc5);
- store.addObject(groupDoc);
- store.addObjects(elemGroupDoc);
- store.addObjects(elemGroupDoc4);
- store.addObjects(elemGroupDoc5);
-
- return facade;
+ return RealMetadataFactory.createTransformationMetadata(metadataStore, "example2");
}
- public static FakeMetadataFacade exampleMetadataSoap1() {
- FakeMetadataStore store = new FakeMetadataStore();
- FakeMetadataFacade facade = new FakeMetadataFacade(store);
+ public static TransformationMetadata exampleMetadataSoap1() {
+ MetadataStore metadataStore = new MetadataStore();
// Create models
- FakeMetadataObject taxReport = FakeMetadataFactory.createPhysicalModel("taxReport"); //$NON-NLS-1$
- FakeMetadataObject xmltest = FakeMetadataFactory.createVirtualModel("xmltest"); //$NON-NLS-1$
+ Schema taxReport = RealMetadataFactory.createPhysicalModel("taxReport", metadataStore); //$NON-NLS-1$
+ Schema xmltest = RealMetadataFactory.createVirtualModel("xmltest", metadataStore); //$NON-NLS-1$
// Create physical groups
- FakeMetadataObject arrayOfItem = FakeMetadataFactory.createPhysicalGroup("taxReport.TaxIDs", taxReport); //$NON-NLS-1$
+ Table arrayOfItem = RealMetadataFactory.createPhysicalGroup("TaxIDs", taxReport); //$NON-NLS-1$
// Create physical elements
- List itemElements = FakeMetadataFactory.createElements(arrayOfItem,
+ RealMetadataFactory.createElements(arrayOfItem,
new String[] { "ID" }, //$NON-NLS-1$
new String[] {DataTypeManager.DefaultDataTypes.STRING});
QueryNode rsQuerySoap = new QueryNode("SELECT ID FROM taxReport.TaxIDs"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rsSoap = FakeMetadataFactory.createVirtualGroup("xmltest.group.TaxIDs", xmltest, rsQuerySoap); //$NON-NLS-1$
+ Table rsSoap = RealMetadataFactory.createVirtualGroup("group.TaxIDs", xmltest, rsQuerySoap); //$NON-NLS-1$
- List rsSoapElements = FakeMetadataFactory.createElements(rsSoap,
+ RealMetadataFactory.createElements(rsSoap,
new String[] { "ID"}, //$NON-NLS-1$
new String[] {DataTypeManager.DefaultDataTypes.STRING});
- FakeMetadataObject doc_SOAP = FakeMetadataFactory.createVirtualGroup("xmltest.docSoap", xmltest, createXMLPlanSOAP()); //$NON-NLS-1$
- List doc_SOAPE1 = FakeMetadataFactory.createElements(doc_SOAP, new String[] { "TaxReports", "TaxReports.TaxReport", "TaxReports.TaxReport.ArrayOfTaxID","TaxReports.TaxReport.ArrayOfTaxID.TaxID","TaxReports.TaxReport.ArrayOfTaxID.TaxID.ID"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ Table doc_SOAP = RealMetadataFactory.createXmlDocument("docSoap", xmltest, createXMLPlanSOAP()); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc_SOAP, new String[] { "TaxReports", "TaxReports.TaxReport", "TaxReports.TaxReport.ArrayOfTaxID","TaxReports.TaxReport.ArrayOfTaxID.TaxID","TaxReports.TaxReport.ArrayOfTaxID.TaxID.ID"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- store.addObject(taxReport);
- store.addObject(arrayOfItem);
- store.addObjects(itemElements);
-
- store.addObject(xmltest);
- store.addObject(rsSoap);
- store.addObjects(rsSoapElements);
- store.addObject(doc_SOAP);
- store.addObjects(doc_SOAPE1);
- return facade;
+ return RealMetadataFactory.createTransformationMetadata(metadataStore, "soap1");
}
- private static MappingNode createXQTPlanChoice_6796() {
+ private static MappingDocument createXQTPlanChoice_6796() {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("root")); //$NON-NLS-1$
@@ -1050,7 +821,7 @@
return doc;
}
- private static MappingNode createChoiceDefect24651() {
+ private static MappingDocument createChoiceDefect24651() {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("root")); //$NON-NLS-1$
@@ -1070,7 +841,7 @@
* Method createXQTPlanRecursive.
* @return Object
*/
- private static MappingNode createXQTPlanRecursive_5988() {
+ private static MappingDocument createXQTPlanRecursive_5988() {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("recursiveTest")); //$NON-NLS-1$
@@ -1102,7 +873,7 @@
* Method createXQTPlanRecursive.
* @return Object
*/
- private static MappingNode createXQTPlanRecursive1a_5988() {
+ private static MappingDocument createXQTPlanRecursive1a_5988() {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("recursiveTest")); //$NON-NLS-1$
@@ -1135,7 +906,7 @@
* all nested "anchor" nodes are named "srcNested". Test of defect #5988
* @return Object
*/
- private static MappingNode createXQTPlanRecursive3_5988() {
+ private static MappingDocument createXQTPlanRecursive3_5988() {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("recursiveTest")); //$NON-NLS-1$
@@ -1160,7 +931,7 @@
}
- private static MappingNode createXQTPlanRecursiveSiblings() {
+ private static MappingDocument createXQTPlanRecursiveSiblings() {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("recursiveTest")); //$NON-NLS-1$
@@ -1184,7 +955,7 @@
* Method createXMLPlanNested.
* @return MappingNode root of mapping doc
*/
- private static MappingNode createXMLPlanNested() {
+ private static MappingDocument createXMLPlanNested() {
MappingDocument doc = new MappingDocument(true);
MappingElement root = new MappingElement("Catalogs"); //$NON-NLS-1$
@@ -1227,7 +998,7 @@
/**
* for defect 9929
*/
- static MappingNode createXMLPlanNested(String queryGroup) {
+ static MappingDocument createXMLPlanNested(String queryGroup) {
MappingDocument doc = new MappingDocument(true);
MappingElement root = new MappingElement("Catalogs"); //$NON-NLS-1$
doc.addChildElement(root);
@@ -1268,7 +1039,7 @@
/**
* for defect 12260
*/
- private static MappingNode createXMLPlanCorrelatedSubqueryTransform() {
+ private static MappingDocument createXMLPlanCorrelatedSubqueryTransform() {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("Catalogs")); //$NON-NLS-1$
@@ -1291,7 +1062,7 @@
return doc;
}
- private static MappingNode createXMLPlan_9893() {
+ private static MappingDocument createXMLPlan_9893() {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("Root")); //$NON-NLS-1$
@@ -1307,7 +1078,7 @@
/**
* DEFECT 8373
*/
- private static Object createXMLPlan_defect8373() {
+ private static MappingDocument createXMLPlan_defect8373() {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("Catalogs")); //$NON-NLS-1$
@@ -1327,7 +1098,7 @@
/**
* DEFECT 8373
*/
- private static Object createXMLPlan_defect8373a() {
+ private static MappingDocument createXMLPlan_defect8373a() {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("Catalogs")); //$NON-NLS-1$
@@ -1348,7 +1119,7 @@
/**
* DEFECT 8373
*/
- private static Object createXMLPlan_defect8373b() {
+ private static MappingDocument createXMLPlan_defect8373b() {
MappingDocument doc = new MappingDocument(true);
@@ -1367,7 +1138,7 @@
return doc;
}
- private static MappingNode createXMLPlanNested2() {
+ private static MappingDocument createXMLPlanNested2() {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("Catalogs")); //$NON-NLS-1$
@@ -1408,7 +1179,7 @@
}
/** nested with sibling*/
- private MappingNode createXMLPlanNested2c() {
+ private MappingDocument createXMLPlanNested2c() {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("Catalogs")); //$NON-NLS-1$
@@ -1445,13 +1216,13 @@
}
- private static MappingNode createXMLPlanNested2a() {
+ private static MappingDocument createXMLPlanNested2a() {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("Catalogs")); //$NON-NLS-1$
- root.setStagingTables(Arrays.asList(new String[] {"tempGroup.orders", "tempGroup.orders2"})); //$NON-NLS-1$ //$NON-NLS-2$
+ root.setStagingTables(Arrays.asList(new String[] {"xmltest.doc9a.tempGroup.orders", "xmltest.doc9a.tempGroup.orders2"})); //$NON-NLS-1$ //$NON-NLS-2$
MappingElement cats = root.addChildElement(new MappingElement("Catalog")); //$NON-NLS-1$
MappingElement items = cats.addChildElement(new MappingElement("Items")); //$NON-NLS-1$
@@ -1489,7 +1260,7 @@
}
// for doc 9b - test temp group w/ bindings
- private static MappingNode createXMLPlanNested2b() {
+ private static MappingDocument createXMLPlanNested2b() {
MappingDocument doc = new MappingDocument(true);
@@ -1538,12 +1309,12 @@
return baseXMLPlanNestedWithLookupChoice("xmltest.orders.orderStatus = 'processing'", critNode); //$NON-NLS-1$
}
- private static MappingNode createXMLPlanNestedWithChoiceFor5266() {
+ private static MappingDocument createXMLPlanNestedWithChoiceFor5266() {
MappingCriteriaNode critNode = new MappingCriteriaNode("xmltest.orders.orderStatus = 'shipped'", true); //$NON-NLS-1$
return baseXMLPlanNestedWithLookupChoice("xmltest.orders.orderStatus = 'processing'", critNode); //$NON-NLS-1$
}
- private static MappingNode createXMLPlanNestedWithLookupChoice() {
+ private static MappingDocument createXMLPlanNestedWithLookupChoice() {
MappingCriteriaNode critNode = new MappingCriteriaNode();
MappingElement defaltElement = critNode.addChildElement(new MappingElement("OtherOrder"));//$NON-NLS-1$
defaltElement.addAttribute(new MappingAttribute("OrderID", "xmltest.orders.orderNum"));//$NON-NLS-1$ //$NON-NLS-2$
@@ -1601,7 +1372,7 @@
}
- private static MappingNode createTestAttributePlan() {
+ private static MappingDocument createTestAttributePlan() {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("FixedValueTest")); //$NON-NLS-1$
@@ -1624,7 +1395,7 @@
return doc;
}
- private static Object createUpdateTestDoc() {
+ private static MappingDocument createUpdateTestDoc() {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("UpdateTest")); //$NON-NLS-1$
@@ -1634,7 +1405,7 @@
return doc;
}
- private static MappingNode createXMLPlanWithComment(){
+ private static MappingDocument createXMLPlanWithComment(){
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("Root")); //$NON-NLS-1$
@@ -1667,13 +1438,13 @@
return doc;
}
- private static MappingNode createXMLPlan2(boolean format, boolean testNillable, int cardinality ) {
+ private static MappingDocument createXMLPlan2(boolean format, boolean testNillable, int cardinality ) {
MappingDocument doc = new MappingDocument(format);
doc.addChildElement(createXMLPlan1Unformatted(testNillable, cardinality));
return doc;
}
- private static MappingNode createXMLPlanSOAP() {
+ private static MappingDocument createXMLPlanSOAP() {
Namespace namespace = new Namespace("ORG", "http://www.mm.org/dummy"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -1732,7 +1503,7 @@
return root;
}
- private static MappingNode createXMLPlanDefect13617() {
+ private static MappingDocument createXMLPlanDefect13617() {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("Catalogs")); //$NON-NLS-1$
@@ -1755,7 +1526,7 @@
}
- private static MappingNode createXMLPlan2(int numChoices, int numDefaultChoice, boolean exception_on_Default) {
+ private static MappingDocument createXMLPlan2(int numChoices, int numDefaultChoice, boolean exception_on_Default) {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("Catalogs")); //$NON-NLS-1$
MappingElement cat = root.addChildElement(new MappingElement("Catalog")); //$NON-NLS-1$
@@ -1818,7 +1589,7 @@
return doc;
}
- private static MappingNode createXMLPlanUltraAdvanced() {
+ private static MappingDocument createXMLPlanUltraAdvanced() {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("Catalogs")); //$NON-NLS-1$
@@ -1860,10 +1631,8 @@
return doc;
}
-
-
- private static MappingNode createXMLPlanUltraAdvancedExceptionOnDefault() {
+ private static MappingDocument createXMLPlanUltraAdvancedExceptionOnDefault() {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("Catalogs")); //$NON-NLS-1$
@@ -1898,7 +1667,7 @@
}
//advanced tests of namespace declarations, use and scope; also fixed values
- private static MappingNode createXMLPlanAdvanced() {
+ private static MappingDocument createXMLPlanAdvanced() {
//add to previous example
MappingDocument doc = createXMLPlanWithDefaults();
MappingElement root = (MappingElement)doc.getRootNode();
@@ -1938,7 +1707,7 @@
* Method createXMLPlanNested.
* @return MappingNode root of mapping doc
*/
- private static MappingNode createXMLPlanMultipleDocs() {
+ private static MappingDocument createXMLPlanMultipleDocs() {
MappingDocument doc = new MappingDocument(true);
@@ -1966,7 +1735,7 @@
return doc;
}
- private static MappingNode createXMLPlanRecursive(boolean useRecursiveCriteria, int recursionLimit, boolean exceptionOnLimit) {
+ private static MappingDocument createXMLPlanRecursive(boolean useRecursiveCriteria, int recursionLimit, boolean exceptionOnLimit) {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("OrgHierarchy")); //$NON-NLS-1$
@@ -1997,7 +1766,7 @@
/*
* Recursion root mapping class is anchored at sequence node instead of "Employee" node
*/
- private static MappingNode createXMLPlanRecursiveA(boolean useRecursiveCriteria, int recursionLimit, boolean exceptionOnLimit) {
+ private static MappingDocument createXMLPlanRecursiveA(boolean useRecursiveCriteria, int recursionLimit, boolean exceptionOnLimit) {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("OrgHierarchy")); //$NON-NLS-1$
@@ -2027,8 +1796,7 @@
return doc;
}
-
- private static MappingNode createXMLPlanRecursiveStaging(boolean useRecursiveCriteria, int recursionLimit, boolean exceptionOnLimit) {
+ private static MappingDocument createXMLPlanRecursiveStaging(boolean useRecursiveCriteria, int recursionLimit, boolean exceptionOnLimit) {
MappingDocument doc = new MappingDocument(true);
@@ -2060,7 +1828,7 @@
return doc;
}
- private static MappingNode createXMLPlanRecursive2(boolean useRecursiveCriteria, int recursionLimit, boolean exceptionOnLimit) {
+ private static MappingDocument createXMLPlanRecursive2(boolean useRecursiveCriteria, int recursionLimit, boolean exceptionOnLimit) {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("Employees")); //$NON-NLS-1$
@@ -2089,7 +1857,7 @@
//this is for testing how "optional" XML elements are included/
//excluded from the result document
- private static MappingNode createXMLPlan_defect8917() {
+ private static MappingDocument createXMLPlan_defect8917() {
Namespace namespace1 = new Namespace("xsi", "http://www.w3.org/2001/XMLSchema-instance"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -2192,7 +1960,7 @@
/*
* Test of identically named nodes
*/
- private static MappingNode createXMLPlan_defect9446() {
+ private static MappingDocument createXMLPlan_defect9446() {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("Catalogs")); //$NON-NLS-1$
@@ -2207,7 +1975,7 @@
return doc;
}
- private static MappingNode createXMLPlan_defect_9530() {
+ private static MappingDocument createXMLPlan_defect_9530() {
Namespace namespace = new Namespace("mm", "http://www.duh.org/duh"); //$NON-NLS-1$ //$NON-NLS-2$
Namespace namespace2 = new Namespace("mm", "http://www.duh2.org/duh2"); //$NON-NLS-1$ //$NON-NLS-2$
Namespace namespace3 = new Namespace("mm2", "http://www.duh3.org/duh3"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -2231,7 +1999,7 @@
return doc;
}
- private static MappingNode createGroupDoc() {
+ private static MappingDocument createGroupDoc() {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("group")); //$NON-NLS-1$
@@ -2262,391 +2030,247 @@
group1.setMaxOccurrs(-1);
return doc;
}
-
- // Helper to create a list of elements - used in creating sample data
- private static List createElements(List elementIDs) {
- List elements = new ArrayList();
- for(int i=0; i<elementIDs.size(); i++) {
- FakeMetadataObject elementID = (FakeMetadataObject) elementIDs.get(i);
- ElementSymbol element = new ElementSymbol(elementID.getName());
- elements.add(element);
- }
-
- return elements;
- }
-
- public static FakeDataManager exampleDataManager(FakeMetadataFacade metadata) {
+ public static FakeDataManager exampleDataManager(QueryMetadataInterface metadata) {
FakeDataManager dataMgr = new FakeDataManager();
try {
- // Group stock.items
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("stock.items"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "001", "Lamp", new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "002", "Screwdriver", new Integer(100), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "003", "Goat", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } );
+ metadata,
+ "stock.items", new List[] {
+ Arrays.asList( new Object[] { "001", "Lamp", new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "002", "Screwdriver", new Integer(100), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "003", "Goat", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } );
- } catch(Throwable e) {
- e.printStackTrace();
- fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch(TeiidException e) {
+ throw new RuntimeException(e);
}
return dataMgr;
}
- public static FakeDataManager exampleDataManager15117(FakeMetadataFacade metadata) {
+ public static FakeDataManager exampleDataManager15117(QueryMetadataInterface metadata) {
FakeDataManager dataMgr = new FakeDataManager();
try {
- // Group stock.items
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("stock.items"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "001", " Lamp ", new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "002", " Screw driver ", new Integer(100), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "003", " Goat ", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } );
+ metadata,
+ "stock.items", new List[] {
+ Arrays.asList( new Object[] { "001", " Lamp ", new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "002", " Screw driver ", new Integer(100), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "003", " Goat ", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } );
- } catch(Throwable e) {
- e.printStackTrace();
- fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch(TeiidException e) {
+ throw new RuntimeException(e);
}
return dataMgr;
}
/** unusual characters in text */
- public static FakeDataManager exampleDataManager15117a(FakeMetadataFacade metadata) {
+ public static FakeDataManager exampleDataManager15117a(QueryMetadataInterface metadata) {
FakeDataManager dataMgr = new FakeDataManager();
try {
- // Group stock.items
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("stock.items"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "001", "\t \n\r", new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "002", " >Screw< \n driver &", new Integer(100), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "003", " >>\rGoat ", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } );
+ metadata,
+ "stock.items", new List[] {
+ Arrays.asList( new Object[] { "001", "\t \n\r", new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "002", " >Screw< \n driver &", new Integer(100), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "003", " >>\rGoat ", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } );
- } catch(Throwable e) {
- e.printStackTrace();
- fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch(TeiidException e) {
+ throw new RuntimeException(e);
}
return dataMgr;
}
- public static FakeDataManager exampleDataManager14905(FakeMetadataFacade metadata) {
+ public static FakeDataManager exampleDataManager14905(QueryMetadataInterface metadata) {
FakeDataManager dataMgr = new FakeDataManager();
try {
- // Group stock.items
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("stock.items"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { " ", " ", new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { " ", " ", new Integer(100), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { " ", " ", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } );
+ metadata,
+ "stock.items", new List[] {
+ Arrays.asList( new Object[] { " ", " ", new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { " ", " ", new Integer(100), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { " ", " ", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } );
- } catch(Throwable e) {
- e.printStackTrace();
- fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch(TeiidException e) {
+ throw new RuntimeException(e);
}
return dataMgr;
}
- public static FakeDataManager exampleDataManager13617(FakeMetadataFacade metadata) {
+ public static FakeDataManager exampleDataManager13617(QueryMetadataInterface metadata) {
FakeDataManager dataMgr = new FakeDataManager();
try {
- // Group stock.items
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("stock.items"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "001", "Lamp", new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "002", "Screwdriver", new Integer(100), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "003", "Goat", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "004", null, new Integer(1), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$
- } );
+ metadata,
+ "stock.items", new List[] {
+ Arrays.asList( new Object[] { "001", "Lamp", new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "002", "Screwdriver", new Integer(100), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "003", "Goat", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "004", null, new Integer(1), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ } );
- } catch(Throwable e) {
- e.printStackTrace();
- fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch(TeiidException e) {
+ throw new RuntimeException(e);
}
-
+
return dataMgr;
}
- public static FakeDataManager exampleDataManagerNested(FakeMetadataFacade metadata) {
+ public static FakeDataManager exampleDataManagerNested(QueryMetadataInterface metadata) {
FakeDataManager dataMgr = new FakeDataManager();
try {
- // Group stock.items
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("stock.items"); //$NON-NLS-1$
-
- // Group stock.supplier
- FakeMetadataObject groupID2 = (FakeMetadataObject) metadata.getGroupID("stock.suppliers"); //$NON-NLS-1$
-
- // Group stock.orders
- FakeMetadataObject groupID3 = (FakeMetadataObject) metadata.getGroupID("stock.orders"); //$NON-NLS-1$
-
- // Group stock.item_supplier
- FakeMetadataObject groupID1_2join = (FakeMetadataObject) metadata.getGroupID("stock.item_supplier"); //$NON-NLS-1$
-
- // Group stock.employees
- FakeMetadataObject groupEmployees = (FakeMetadataObject) metadata.getGroupID("stock.employees"); //$NON-NLS-1$
-
- // Items
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
- // Supplier
- elementIDs = metadata.getElementIDsInGroupID(groupID2);
- List supplierElementSymbols = createElements(elementIDs);
-
- // Orders
- elementIDs = metadata.getElementIDsInGroupID(groupID3);
- List ordersElementSymbols = createElements(elementIDs);
-
- // Item_supplier
- elementIDs = metadata.getElementIDsInGroupID(groupID1_2join);
- List itemSupplierElementSymbols = createElements(elementIDs);
-
- // Employees
- elementIDs = metadata.getElementIDsInGroupID(groupEmployees);
- List employeeSymbols = createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "001", "Lamp", new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "002", "Screwdriver", new Integer(100), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "003", "Goat", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } );
+ metadata,
+ "stock.items", new List[] {
+ Arrays.asList( new Object[] { "001", "Lamp", new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "002", "Screwdriver", new Integer(100), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "003", "Goat", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } );
dataMgr.registerTuples(
- groupID1_2join,
- itemSupplierElementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "001", "51" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "001", "52" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "001", "53" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "001", "56" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "002", "54" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "002", "55" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "002", "56" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "003", "56" } ), //$NON-NLS-1$ //$NON-NLS-2$
- } );
+ metadata,
+ "stock.item_supplier", new List[] {
+ Arrays.asList( new Object[] { "001", "51" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "001", "52" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "001", "53" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "001", "56" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "002", "54" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "002", "55" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "002", "56" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "003", "56" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ } );
dataMgr.registerTuples(
- groupID2,
- supplierElementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "51", "Chucky", "11111" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "52", "Biff's Stuff", "22222" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "53", "AAAA", "33333" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "54", "Nugent Co.", "44444" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "55", "Zeta", "55555" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "56", "Microsoft", "66666" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } );
+ metadata,
+ "stock.suppliers", new List[] {
+ Arrays.asList( new Object[] { "51", "Chucky", "11111" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "52", "Biff's Stuff", "22222" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "53", "AAAA", "33333" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "54", "Nugent Co.", "44444" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "55", "Zeta", "55555" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "56", "Microsoft", "66666" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } );
dataMgr.registerTuples(
- groupID3,
- ordersElementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "1", "002", "54", "Nugent Co.", "10/23/01", new Integer(5), "complete" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- Arrays.asList( new Object[] { "2", "001", "52", "Biff's Stuff", "12/31/01", new Integer(87), "complete" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- Arrays.asList( new Object[] { "3", "003", "56", "Microsoft", "02/31/02", new Integer(12), "complete" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- Arrays.asList( new Object[] { "4", "003", "56", "Microsoft", "05/31/02", new Integer(9), "processing" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- Arrays.asList( new Object[] { "5", "002", "56", "Microsoft", "06/01/02", new Integer(87), "complete" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- Arrays.asList( new Object[] { "6", "002", "56", "Microsoft", "07/01/02", new Integer(1), null } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- Arrays.asList( new Object[] { "7", "002", "56", "bad data, shouldn't see", "07/01/02", new Integer(1), "complete" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- } );
+ metadata,
+ "stock.orders", new List[] {
+ Arrays.asList( new Object[] { "1", "002", "54", "Nugent Co.", "10/23/01", new Integer(5), "complete" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ Arrays.asList( new Object[] { "2", "001", "52", "Biff's Stuff", "12/31/01", new Integer(87), "complete" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ Arrays.asList( new Object[] { "3", "003", "56", "Microsoft", "02/31/02", new Integer(12), "complete" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ Arrays.asList( new Object[] { "4", "003", "56", "Microsoft", "05/31/02", new Integer(9), "processing" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ Arrays.asList( new Object[] { "5", "002", "56", "Microsoft", "06/01/02", new Integer(87), "complete" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ Arrays.asList( new Object[] { "6", "002", "56", "Microsoft", "07/01/02", new Integer(1), null } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ Arrays.asList( new Object[] { "7", "002", "56", "bad data, shouldn't see", "07/01/02", new Integer(1), "complete" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ } );
dataMgr.registerTuples(
- groupEmployees,
- employeeSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "01", "1", null, "Ted", "Nugent" } ), //ceo, Nugent Co. //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- Arrays.asList( new Object[] { "02", "1", "01", "Bill", "Squier" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- Arrays.asList( new Object[] { "03", "1", "01", "John", "Smith" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- Arrays.asList( new Object[] { "04", "1", "02", "Leland", "Sklar" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- Arrays.asList( new Object[] { "05", "1", "03", "Kevin", "Moore" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- Arrays.asList( new Object[] { "06", "1", "04", "John", "Zorn" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- Arrays.asList( new Object[] { "07", "2", null, "Geoff", "Tate" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- Arrays.asList( new Object[] { "08", "2", "07", "Les", "Claypool" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- Arrays.asList( new Object[] { "09", "2", "08", "Meat", "Loaf" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- Arrays.asList( new Object[] { "10", "2", "08", "Keith", "Sweat" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- Arrays.asList( new Object[] { "11", "1", "06", "Mike", "Patton" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- Arrays.asList( new Object[] { "12", "1", "06", "Devin", "Townsend" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- Arrays.asList( new Object[] { "13", "1", "11", "Puffy", "Bordin" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- } );
+ metadata,
+ "stock.employees", new List[] {
+ Arrays.asList( new Object[] { "01", "1", null, "Ted", "Nugent" } ), //ceo, Nugent Co. //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ Arrays.asList( new Object[] { "02", "1", "01", "Bill", "Squier" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ Arrays.asList( new Object[] { "03", "1", "01", "John", "Smith" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ Arrays.asList( new Object[] { "04", "1", "02", "Leland", "Sklar" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ Arrays.asList( new Object[] { "05", "1", "03", "Kevin", "Moore" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ Arrays.asList( new Object[] { "06", "1", "04", "John", "Zorn" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ Arrays.asList( new Object[] { "07", "2", null, "Geoff", "Tate" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ Arrays.asList( new Object[] { "08", "2", "07", "Les", "Claypool" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ Arrays.asList( new Object[] { "09", "2", "08", "Meat", "Loaf" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ Arrays.asList( new Object[] { "10", "2", "08", "Keith", "Sweat" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ Arrays.asList( new Object[] { "11", "1", "06", "Mike", "Patton" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ Arrays.asList( new Object[] { "12", "1", "06", "Devin", "Townsend" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ Arrays.asList( new Object[] { "13", "1", "11", "Puffy", "Bordin" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ } );
- } catch(Throwable e) {
- e.printStackTrace();
- fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch(TeiidException e) {
+ throw new RuntimeException(e);
}
-
+
return dataMgr;
}
- private FakeDataManager exampleDataManagerNestedWithSibling(FakeMetadataFacade metadata) {
+ private FakeDataManager exampleDataManagerNestedWithSibling(QueryMetadataInterface metadata) {
FakeDataManager dataMgr = new FakeDataManager();
try {
- // Group stock.items
- FakeMetadataObject groupID1 = (FakeMetadataObject) metadata.getGroupID("stock.items"); //$NON-NLS-1$
- // Group stock.supplier
- FakeMetadataObject groupID2 = (FakeMetadataObject) metadata.getGroupID("stock.suppliers"); //$NON-NLS-1$
-
- // Group stock.orders
- FakeMetadataObject groupID3 = (FakeMetadataObject) metadata.getGroupID("stock.orders"); //$NON-NLS-1$
-
- // Group stock.item_supplier
- FakeMetadataObject groupID1_2join = (FakeMetadataObject) metadata.getGroupID("stock.item_supplier"); //$NON-NLS-1$
-
- // Group stock.item_order
- FakeMetadataObject groupID1_3join = (FakeMetadataObject) metadata.getGroupID("stock.item_order"); //$NON-NLS-1$
-
- // Items
- List elementIDs = metadata.getElementIDsInGroupID(groupID1);
- List elementSymbols = createElements(elementIDs);
-
- // Supplier
- elementIDs = metadata.getElementIDsInGroupID(groupID2);
- List supplierElementSymbols = createElements(elementIDs);
-
- // Orders
- elementIDs = metadata.getElementIDsInGroupID(groupID3);
- List ordersElementSymbols = createElements(elementIDs);
-
- // Item_supplier
- elementIDs = metadata.getElementIDsInGroupID(groupID1_2join);
- List itemSupplierElementSymbols = createElements(elementIDs);
-
- // Item_order
- elementIDs = metadata.getElementIDsInGroupID(groupID1_3join);
- List itemOrderElementSymbols = createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID1,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "001", "Lamp", new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "002", "Screwdriver", new Integer(100), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "003", "Goat", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } );
+ metadata,
+ "stock.items", new List[] {
+ Arrays.asList( new Object[] { "001", "Lamp", new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "002", "Screwdriver", new Integer(100), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "003", "Goat", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } );
dataMgr.registerTuples(
- groupID1_2join,
- itemSupplierElementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "001", "51" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "001", "52" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "001", "53" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "001", "56" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "002", "54" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "002", "55" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "002", "56" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "003", "56" } ), //$NON-NLS-1$ //$NON-NLS-2$
- } );
+ metadata,
+ "stock.item_supplier", new List[] {
+ Arrays.asList( new Object[] { "001", "51" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "001", "52" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "001", "53" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "001", "56" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "002", "54" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "002", "55" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "002", "56" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "003", "56" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ } );
dataMgr.registerTuples(
- groupID2,
- supplierElementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "51", "Chucky", "11111" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "52", "Biff's Stuff", "22222" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "53", "AAAA", "33333" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "54", "Nugent Co.", "44444" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "55", "Zeta", "55555" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "56", "Microsoft", "66666" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } );
+ metadata,
+ "stock.suppliers", new List[] {
+ Arrays.asList( new Object[] { "51", "Chucky", "11111" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "52", "Biff's Stuff", "22222" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "53", "AAAA", "33333" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "54", "Nugent Co.", "44444" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "55", "Zeta", "55555" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "56", "Microsoft", "66666" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } );
dataMgr.registerTuples(
- groupID3,
- ordersElementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "1", "KMart", "12345" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "2", "Sun", "94040" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "3", "Cisco", "94041" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "4", "Doc", "94042" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "5", "Excite", "21098" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "6", "Yahoo", "94043" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "7", "Inktomi", "94044" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } );
+ metadata,
+ "stock.orders", new List[] {
+ Arrays.asList( new Object[] { "1", "KMart", "12345" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "2", "Sun", "94040" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "3", "Cisco", "94041" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "4", "Doc", "94042" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "5", "Excite", "21098" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "6", "Yahoo", "94043" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "7", "Inktomi", "94044" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } );
dataMgr.registerTuples(
- groupID1_3join,
- itemOrderElementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "001", "1" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "001", "2" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "001", "3" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "001", "4" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "002", "5" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "002", "6" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "003", "7" } ), //$NON-NLS-1$ //$NON-NLS-2$
- } );
+ metadata,
+ "stock.item_order", new List[] {
+ Arrays.asList( new Object[] { "001", "1" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "001", "2" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "001", "3" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "001", "4" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "002", "5" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "002", "6" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "003", "7" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ } );
- } catch(Throwable e) {
- e.printStackTrace();
- fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ } catch(TeiidException e) {
+ throw new RuntimeException(e);
+ }
return dataMgr;
}
@@ -2655,43 +2279,30 @@
* Returned with some null values in the tuples, to test default/fixed attributes of nodes
* as well as nillable nodes
*/
- private FakeDataManager exampleDataManagerWithNulls(FakeMetadataFacade metadata) {
+ private FakeDataManager exampleDataManagerWithNulls(QueryMetadataInterface metadata) {
FakeDataManager dataMgr = new FakeDataManager();
try {
- // Group stock.items
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("stock.items"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "001", null, new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "002", "Screwdriver", null, "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "003", "Goat", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } );
+ metadata,
+ "stock.items", new List[] {
+ Arrays.asList( new Object[] { "001", null, new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "002", "Screwdriver", null, "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "003", "Goat", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } );
- } catch(Throwable e) {
- e.printStackTrace();
- fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch(TeiidException e) {
+ throw new RuntimeException(e);
}
return dataMgr;
}
- public static FakeDataManager exampleDataManagerForSoap1(FakeMetadataFacade metadata, boolean makeEmpty) {
+ public static FakeDataManager exampleDataManagerForSoap1(QueryMetadataInterface metadata, boolean makeEmpty) {
FakeDataManager dataMgr = new FakeDataManager();
try {
- // Group stock.items
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("taxReport.TaxIDs"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
- List[] tuples = null;
+ List<?>[] tuples = null;
if (makeEmpty){
tuples = new List[0];
} else {
@@ -2703,93 +2314,60 @@
}
dataMgr.registerTuples(
- groupID,
- elementSymbols,
- tuples );
+ metadata,
+ "taxReport.TaxIDs", tuples );
- } catch(Throwable e) {
- e.printStackTrace();
- fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch(TeiidException e) {
+ throw new RuntimeException(e);
}
return dataMgr;
}
- /** data has a null value */
- private FakeDataManager exampleDataManager_8917(FakeMetadataFacade metadata) {
+ /** data has a null value
+ * @throws TeiidComponentException
+ * @throws QueryResolverException */
+ private FakeDataManager exampleDataManager_8917(QueryMetadataInterface metadata) throws QueryResolverException, TeiidComponentException {
FakeDataManager dataMgr = new FakeDataManager();
- try {
- // Group stock.items
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("stock.items"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "001", null, new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$
- } );
-
- } catch(Throwable e) {
- e.printStackTrace();
- fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
+ dataMgr.registerTuples(
+ metadata,
+ "stock.items", new List[] {
+ Arrays.asList( new Object[] { "001", null, new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ } );
return dataMgr;
}
/** data has a NON-EMPTY WHITESPACE string */
- private FakeDataManager exampleDataManager_8917a(FakeMetadataFacade metadata) {
+ private FakeDataManager exampleDataManager_8917a(QueryMetadataInterface metadata) {
FakeDataManager dataMgr = new FakeDataManager();
try {
- // Group stock.items
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("stock.items"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "001", " ", new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } );
+ metadata,
+ "stock.items", new List[] {
+ Arrays.asList( new Object[] { "001", " ", new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } );
- } catch(Throwable e) {
- e.printStackTrace();
- fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch(TeiidException e) {
+ throw new RuntimeException(e);
}
return dataMgr;
}
- /** data has an EMPTY STRING */
- private FakeDataManager exampleDataManager_8917b(FakeMetadataFacade metadata) {
+ /** data has an EMPTY STRING
+ * @throws TeiidComponentException
+ * @throws QueryResolverException */
+ private FakeDataManager exampleDataManager_8917b(QueryMetadataInterface metadata) throws QueryResolverException, TeiidComponentException {
FakeDataManager dataMgr = new FakeDataManager();
- try {
- // Group stock.items
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("stock.items"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
+ dataMgr.registerTuples(
+ metadata,
+ "stock.items", new List[] {
+ Arrays.asList( new Object[] { "001", "", new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } );
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "001", "", new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } );
-
- } catch(Throwable e) {
- e.printStackTrace();
- fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
return dataMgr;
}
@@ -2797,30 +2375,19 @@
* Duplicate records in data
* @param metadata
* @return FakeDataManager
+ * @throws TeiidComponentException
+ * @throws QueryResolverException
*/
- private FakeDataManager exampleDataManagerWithDuplicates(FakeMetadataFacade metadata) {
+ private FakeDataManager exampleDataManagerWithDuplicates(QueryMetadataInterface metadata) throws QueryResolverException, TeiidComponentException {
FakeDataManager dataMgr = new FakeDataManager();
- try {
- // Group stock.items
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("stock.items"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
+ dataMgr.registerTuples(
+ metadata,
+ "stock.items", new List[] {
Arrays.asList( new Object[] { "001", "Goat", new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Arrays.asList( new Object[] { "002", "Screwdriver",new Integer(100), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Arrays.asList( new Object[] { "003", "Goat", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} );
-
- } catch(Throwable e) {
- e.printStackTrace();
- fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
- }
return dataMgr;
}
@@ -2830,94 +2397,65 @@
* Duplicate records in data to test more than two order by elements at the same depth
* @param metadata
* @return FakeDataManager
+ * @throws TeiidComponentException
+ * @throws QueryResolverException
*/
- private FakeDataManager exampleDataManagerWithDuplicates1(FakeMetadataFacade metadata) {
+ private FakeDataManager exampleDataManagerWithDuplicates1(QueryMetadataInterface metadata) throws QueryResolverException, TeiidComponentException {
FakeDataManager dataMgr = new FakeDataManager();
- try {
- // Group stock.items
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("stock.items"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
+ dataMgr.registerTuples(
+ metadata,
+ "stock.items", new List[] {
Arrays.asList( new Object[] { "001", "Goat", new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Arrays.asList( new Object[] { "003", "Screwdriver",new Integer(100), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Arrays.asList( new Object[] { "001", "Goat", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} );
- } catch(Throwable e) {
- e.printStackTrace();
- fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
return dataMgr;
}
/**
* Deluxe example
+ * @throws TeiidComponentException
+ * @throws QueryResolverException
*/
- private FakeDataManager exampleDataManagerDuJour(FakeMetadataFacade metadata) {
+ private FakeDataManager exampleDataManagerDuJour(QueryMetadataInterface metadata) throws QueryResolverException, TeiidComponentException {
FakeDataManager dataMgr = new FakeDataManager();
- try {
- // Group stock.items
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("stock.items"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
- dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "001", null, new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "002", "Screwdriver", null, "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "003", "Goat", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "004", "Flux Capacitor", new Integer(2), "discontinued" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "005", "Milkshake", new Integer(88), null } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "006", "Feta Matrix", new Integer(0), "discontinued" } ) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } );
-
- } catch(Throwable e) {
- e.printStackTrace();
- fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
+ dataMgr.registerTuples(
+ metadata,
+ "stock.items", new List[] {
+ Arrays.asList( new Object[] { "001", null, new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "002", "Screwdriver", null, "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "003", "Goat", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "004", "Flux Capacitor", new Integer(2), "discontinued" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "005", "Milkshake", new Integer(88), null } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "006", "Feta Matrix", new Integer(0), "discontinued" } ) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } );
return dataMgr;
}
- public static FakeDataManager exampleXQTDataManager(FakeMetadataFacade metadata) throws Exception {
+ public static FakeDataManager exampleXQTDataManager(QueryMetadataInterface metadata) throws Exception {
FakeDataManager dataMgr = new FakeDataManager();
// Group stock.items
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("xqt.data"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List xqtData = createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- xqtData,
-
- new List[] {
- Arrays.asList( new Object[] { new Integer(1), new Integer(-2), "-2" } ), //$NON-NLS-1$
- Arrays.asList( new Object[] { new Integer(2), new Integer(-1), null } ),
- Arrays.asList( new Object[] { new Integer(3), null, "0" } ), //$NON-NLS-1$
- Arrays.asList( new Object[] { new Integer(4), new Integer(1), "1" } ), //$NON-NLS-1$
- Arrays.asList( new Object[] { new Integer(5), new Integer(2), "2" } ), //$NON-NLS-1$
- Arrays.asList( new Object[] { new Integer(6), new Integer(3), "3" } ), //$NON-NLS-1$
- Arrays.asList( new Object[] { new Integer(7), new Integer(4), "4" } ), //$NON-NLS-1$
- Arrays.asList( new Object[] { new Integer(8), new Integer(5), null } ),
- Arrays.asList( new Object[] { new Integer(9), null, "6" } ), //$NON-NLS-1$
- Arrays.asList( new Object[] { new Integer(10), new Integer(7), "7" } ), //$NON-NLS-1$
- Arrays.asList( new Object[] { new Integer(11), new Integer(8), "8" } ), //$NON-NLS-1$
- Arrays.asList( new Object[] { new Integer(12), new Integer(9), "9" } ), //$NON-NLS-1$
- Arrays.asList( new Object[] { new Integer(13), new Integer(10), "10" } ), //$NON-NLS-1$
- } );
+ metadata,
+ "xqt.data", new List[] {
+ Arrays.asList( new Object[] { new Integer(1), new Integer(-2), "-2" } ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { new Integer(2), new Integer(-1), null } ),
+ Arrays.asList( new Object[] { new Integer(3), null, "0" } ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { new Integer(4), new Integer(1), "1" } ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { new Integer(5), new Integer(2), "2" } ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { new Integer(6), new Integer(3), "3" } ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { new Integer(7), new Integer(4), "4" } ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { new Integer(8), new Integer(5), null } ),
+ Arrays.asList( new Object[] { new Integer(9), null, "6" } ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { new Integer(10), new Integer(7), "7" } ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { new Integer(11), new Integer(8), "8" } ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { new Integer(12), new Integer(9), "9" } ), //$NON-NLS-1$
+ Arrays.asList( new Object[] { new Integer(13), new Integer(10), "10" } ), //$NON-NLS-1$
+ } );
return dataMgr;
}
@@ -2930,16 +2468,16 @@
return command;
}
- static ProcessorPlan helpTestProcess(String sql, String expectedDoc, FakeMetadataFacade metadata, FakeDataManager dataMgr) throws Exception{
+ static ProcessorPlan helpTestProcess(String sql, String expectedDoc, QueryMetadataInterface metadata, FakeDataManager dataMgr) throws Exception{
return helpTestProcess(sql, expectedDoc, metadata, dataMgr, null);
}
- static ProcessorPlan helpTestProcess(String sql, String expectedDoc, FakeMetadataFacade metadata, FakeDataManager dataMgr, Class expectedException) throws Exception{
+ static ProcessorPlan helpTestProcess(String sql, String expectedDoc, QueryMetadataInterface metadata, FakeDataManager dataMgr, Class<?> expectedException) throws Exception{
return helpTestProcess(sql, metadata, dataMgr, expectedException, new DefaultCapabilitiesFinder(), expectedDoc);
}
- static ProcessorPlan helpTestProcess(String sql, FakeMetadataFacade metadata, FakeDataManager dataMgr, Class expectedException, CapabilitiesFinder capFinder, String... expectedDoc) throws Exception{
+ static ProcessorPlan helpTestProcess(String sql, QueryMetadataInterface metadata, FakeDataManager dataMgr, Class<?> expectedException, CapabilitiesFinder capFinder, String... expectedDoc) throws Exception{
Command command = helpGetCommand(sql, metadata);
AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG);
@@ -2951,7 +2489,7 @@
if(DEBUG) {
System.out.println(analysisRecord.getDebugLog());
}
- List[] expected = new List[expectedDoc.length];
+ List<?>[] expected = new List[expectedDoc.length];
for (int i = 0; i < expectedDoc.length; i++) {
expected[i] = Arrays.asList(expectedDoc[i]);
}
@@ -2976,7 +2514,7 @@
// =============================================================================================
@Test public void test1() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -3003,7 +2541,7 @@
}
@Test public void testOrderBy1() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -3030,7 +2568,7 @@
}
@Test public void testOrderBy1a() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -3057,7 +2595,7 @@
}
@Test public void testOrderBy1b() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -3084,7 +2622,7 @@
}
@Test public void testOrderBy2() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -3111,7 +2649,7 @@
}
@Test public void testOrderBy3() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -3176,7 +2714,7 @@
}
@Test public void testOrderBy3a() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -3241,7 +2779,7 @@
}
@Test public void testOrderBy4() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
@@ -3261,7 +2799,7 @@
}
@Test public void testOrderBy5() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -3288,7 +2826,7 @@
}
@Test public void testOrderBy6() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -3396,14 +2934,14 @@
//order by with temp group at the root
@Test public void testOrderBy7() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
helpTestProcess("SELECT * FROM xmltest.doc9a ORDER BY ItemID DESC", EXPECTED_ORDERED_DOC9A, metadata, dataMgr); //$NON-NLS-1$
}
//order by with multiple elements and criteria with long name, short name doesn't work
@Test public void testOrderBy8() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -3474,7 +3012,7 @@
/*
@Test public void testOrderBy9() throws Exception {
- FakeMetadataFacade metadata = exampleMetadata();
+ QueryMetadataInterface metadata = exampleMetadata();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc = "";
@@ -3487,7 +3025,7 @@
*/
@Test public void testOrderBy10() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
@@ -3511,13 +3049,13 @@
}
@Test public void testOrderBy11() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
helpTestProcess("SELECT * FROM xmltest.doc9a WHERE ItemID='001' OR ItemID='002' OR ItemID='003' ORDER BY ItemID DESC", EXPECTED_ORDERED_DOC9A, metadata, dataMgr); //$NON-NLS-1$
}
@Test public void testOrderBy13() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
@@ -3545,7 +3083,7 @@
}
@Test public void testOrderBy14() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -3652,7 +3190,7 @@
}
@Test public void testOrderBy15() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
@@ -3681,7 +3219,7 @@
/** test null elements*/
@Test public void testOrderBy17() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerWithNulls(metadata);
String expectedDoc =
@@ -3710,7 +3248,7 @@
/** test duplicate elements*/
@Test public void testOrderBy18() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerWithDuplicates(metadata);
String expectedDoc =
@@ -3739,7 +3277,7 @@
/** test more than two parallel elements*/
@Test public void testOrderBy19() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerWithDuplicates1(metadata);
String expectedDoc =
@@ -3767,7 +3305,7 @@
}
@Test public void testOrderBy20() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -3825,7 +3363,7 @@
* ORDER BY clause of an XML doc query
*/
@Test public void testOrderBy_defect9803() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
try {
@@ -3841,7 +3379,7 @@
//defect 8130
@Test public void test1CriteriaWithUnmappedElementFails() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
helpTestProcess("SELECT * FROM xmltest.doc1 WHERE Catalog = 'something'", null, metadata, dataMgr, QueryPlannerException.class); //$NON-NLS-1$
@@ -3849,14 +3387,14 @@
//defect 8130
@Test public void test1CriteriaWithUnmappedElementFails2() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
helpTestProcess("SELECT * FROM xmltest.doc1 WHERE Item = 'something'", null, metadata, dataMgr, QueryPlannerException.class); //$NON-NLS-1$
}
@Test public void testNested() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -4062,7 +3600,7 @@
"</Catalogs>\r\n\r\n"; //$NON-NLS-1$
@Test public void testNested2() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc = EXPECTED_DOC_NESTED_2;
helpTestProcess("SELECT * FROM xmltest.doc9", expectedDoc, metadata, dataMgr); //$NON-NLS-1$
@@ -4073,14 +3611,14 @@
* selects from B
*/
@Test public void testNested2aTempGroup() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc = EXPECTED_DOC_NESTED_2;
helpTestProcess("SELECT * FROM xmltest.doc9a", expectedDoc, metadata, dataMgr); //$NON-NLS-1$
}
@Test public void testNested2aTempGroupCriteria() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -4160,7 +3698,7 @@
/** defect 13172, CSE Case 1811 */
@Test public void testNested2aTempGroupCompoundCriteria() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -4241,7 +3779,7 @@
/** defect 13172, CSE Case 1811 */
@Test public void testNested2aTempGroupCompoundCriteria1() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -4322,7 +3860,7 @@
/** defect 13172, CSE Case 1811 */
@Test public void testNested2aTempGroupCompoundCriteria2() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -4408,7 +3946,7 @@
}
@Test public void testNested2cTempGroup() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc = EXPECTED_DOC_NESTED_3;
helpTestProcess("SELECT * FROM xmltest.doc9a WHERE ItemID = '001'", expectedDoc, metadata, dataMgr); //$NON-NLS-1$
@@ -4419,7 +3957,7 @@
* some ancestor mapping classes ( we no longer support bindings on staging tables)
*/
public void defer_testNested2bTempGroup() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc = EXPECTED_DOC_NESTED_2;
helpTestProcess("SELECT * FROM xmltest.doc9b", expectedDoc, metadata, dataMgr); //$NON-NLS-1$
@@ -4427,7 +3965,7 @@
@Test public void testNested2WithCriteria() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -4484,7 +4022,7 @@
* @see #testNested2WithCriteria2a
*/
@Test public void testNested2WithCriteria2() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -4544,7 +4082,7 @@
* @see #testNested2WithCriteria2a
*/
@Test public void testNested2WithCriteria2_defect9802() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -4594,7 +4132,7 @@
* @see #testNested2WithCriteria2
*/
@Test public void testNested2WithCriteria2_function() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -4650,7 +4188,7 @@
* the criteria is actually specified on.</p>
*/
@Test public void testNested2WithCriteria2a() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -4699,7 +4237,7 @@
@Test public void testNested2WithContextCriteria() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -4746,7 +4284,7 @@
}
@Test public void testNested2WithContextCriteria2() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -4799,7 +4337,7 @@
}
@Test public void testNested2WithContextCriteria3() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -4892,7 +4430,7 @@
@Test public void testNested2WithContextCriteria4() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc = EXPECTED_DOC_NESTED_2_WITH_CONTEXT_CRITERIA_4;
@@ -4900,7 +4438,7 @@
}
@Test public void testNested2WithContextCriteria4a() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc = EXPECTED_DOC_NESTED_2_WITH_CONTEXT_CRITERIA_4;
@@ -4908,7 +4446,7 @@
}
@Test public void testNested2WithContextCriteria4b() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc = EXPECTED_DOC_NESTED_2_WITH_CONTEXT_CRITERIA_4;
@@ -4994,7 +4532,7 @@
"</Catalogs>\r\n\r\n"; //$NON-NLS-1$
@Test public void testNested2WithContextCriteria5() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc = EXPECTED_DOC_NESTED_2_WITH_CONTEXT_CRITERIA_5;
@@ -5002,7 +4540,7 @@
}
@Test public void testNested2WithContextCriteria5a() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc = EXPECTED_DOC_NESTED_2_WITH_CONTEXT_CRITERIA_5;
@@ -5010,7 +4548,7 @@
}
@Test public void testNested2WithContextCriteria5b() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc = EXPECTED_DOC_NESTED_2_WITH_CONTEXT_CRITERIA_5;
@@ -5031,19 +4569,17 @@
}
@Test public void testNested2WithContextCriteria5Fail() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc = ""; //doesn't matter //$NON-NLS-1$
- boolean shouldSucceed = false;
- Class expectedException = QueryPlannerException.class;
- String shouldFailMsg = "expected failure since two different contexts were specified in conjunct"; //$NON-NLS-1$
+ Class<?> expectedException = QueryPlannerException.class;
helpTestProcess("SELECT * FROM xmltest.doc9 WHERE context(Item, OrderID)='5' OR context(SupplierID, OrderID)='2'", expectedDoc, metadata, dataMgr, expectedException); //$NON-NLS-1$
}
@Test public void testNested2WithContextCriteria6() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -5056,7 +4592,7 @@
}
@Test public void testNested2WithContextCriteria6b() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -5106,14 +4642,14 @@
"</Catalogs>\r\n\r\n"; //$NON-NLS-1$
@Test public void testNested2WithContextCriteria7() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc = EXPECTED_DOC_NESTED_2_WITH_CONTEXT_CRITERIA_7;
helpTestProcess("SELECT * FROM xmltest.doc9 WHERE CONTEXT(SupplierID, OrderID)='5' AND context(OrderID, OrderID)='5'", expectedDoc, metadata, dataMgr); //$NON-NLS-1$
}
@Test public void testNested2WithContextCriteria7b() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc = EXPECTED_DOC_NESTED_2_WITH_CONTEXT_CRITERIA_7;
String query = "SELECT * FROM xmltest.doc9 WHERE CONTEXT(Catalogs.Catalog.Items.Item.Suppliers.Supplier.SupplierID, " //$NON-NLS-1$
@@ -5122,7 +4658,7 @@
}
@Test public void testNested2WithContextCriteria7c() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc = EXPECTED_DOC_NESTED_2_WITH_CONTEXT_CRITERIA_7;
String query = "SELECT * FROM xmltest.doc9 WHERE CONTEXT(Catalogs.Catalog.Items.Item.Suppliers.Supplier.SupplierID, " //$NON-NLS-1$
@@ -5134,7 +4670,7 @@
* per defect 7333
*/
@Test public void testNested2WithContextCriteria_7333() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -5173,7 +4709,7 @@
* per defect 7333
*/
@Test public void testNested2WithContextCriteria_7333b() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -5212,7 +4748,7 @@
* per defect 7333
*/
@Test public void testNested2WithContextCriteria_7333c() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -5228,7 +4764,7 @@
* per defect 7333
*/
@Test public void testNested2WithContextCriteria_7333d() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -5244,7 +4780,7 @@
* Select a single item, and then limit the suppliers based on an order #
*/
@Test public void testNested2WithContextCriteria8() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -5280,7 +4816,7 @@
}
@Test public void testNestedWithChoice() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -5369,7 +4905,7 @@
* Does not use 'context' operator
*/
@Test public void testNestedWithChoiceAndCriteria2_6796() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -5413,7 +4949,7 @@
* Uses the 'context' operator
*/
@Test public void testNestedWithChoiceAndCriteria2a_6796() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -5491,7 +5027,7 @@
* Does not use 'context' operator
*/
@Test public void testNestedWithLookupChoice() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
@@ -5533,7 +5069,7 @@
}
@Test public void test1Unformatted() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + //$NON-NLS-1$
@@ -5563,7 +5099,7 @@
// jhTODO: complete this
@Test public void testChoice_5266a() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -5642,7 +5178,7 @@
@Test public void test1WithCriteriaShortName() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -5665,7 +5201,7 @@
}
@Test public void test1WithCriteriaLongName() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -5688,7 +5224,7 @@
}
@Test public void test2() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -5707,7 +5243,7 @@
}
@Test public void test2a() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -5734,13 +5270,13 @@
}
@Test public void test2b() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
helpTestProcess("SELECT * FROM xmltest.doc2b", null, metadata, dataMgr, TeiidComponentException.class); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void test2c() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -5763,7 +5299,7 @@
}
@Test public void test2d() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -5790,7 +5326,7 @@
}
@Test public void test2e() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -5817,7 +5353,7 @@
}
@Test public void testWithNillableNode() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerWithNulls(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -5844,7 +5380,7 @@
}
@Test public void testWithDefault() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerWithNulls(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -5871,7 +5407,7 @@
}
@Test public void testWithNamespaces() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerWithNulls(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -5904,7 +5440,7 @@
}
@Test public void testWithNewIter3Properties() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerDuJour(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -5943,7 +5479,7 @@
}
@Test public void testWithNewIter3PropertiesException() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerDuJour(metadata);
Command command = helpGetCommand("SELECT * FROM xmltest.doc6", metadata); //$NON-NLS-1$
@@ -5965,7 +5501,7 @@
}
@Test public void testAttributeBug() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
@@ -5989,7 +5525,7 @@
}
@Test public void testMultipleDocs() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc1 =
@@ -6056,7 +5592,7 @@
}
@Test public void testRecursive() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
@@ -6141,7 +5677,7 @@
}
@Test public void testRecursiveA() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
@@ -6239,7 +5775,7 @@
* @throws Exception
*/
@Test public void testRecursive2() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
@@ -6301,7 +5837,7 @@
helpTestProcess("SELECT * FROM xmltest.doc13", expectedDoc, metadata, dataMgr); //$NON-NLS-1$
}
@Test public void testRecursive3() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
@@ -6363,7 +5899,7 @@
}
@Test public void testRecursive4Exception() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
helpTestProcess("SELECT * FROM xmltest.doc15", null, metadata, dataMgr, TeiidComponentException.class); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -6372,7 +5908,7 @@
* Seems to be failing as a result of changes for defect 12288
*/
@Test public void testRecursive5() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
@@ -6423,7 +5959,7 @@
* @throws Exception
*/
@Test public void testRecursiveWithStagingTable_defect15607() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
@@ -6490,7 +6026,7 @@
* all nested "anchor" nodes are named "srcNestedRecursive". Test of defect #5988
*/
@Test public void testXQTRecursive_5988() throws Exception {
- FakeMetadataFacade metadata = exampleMetadata2();
+ QueryMetadataInterface metadata = exampleMetadata2();
FakeDataManager dataMgr = exampleXQTDataManager(metadata);
String expectedDoc =
@@ -6566,7 +6102,7 @@
* all nested "anchor" nodes are named "srcNested". Test of defect #5988
*/
public void DEFER_testXQTRecursive1a_5988() throws Exception {
- FakeMetadataFacade metadata = exampleMetadata2();
+ QueryMetadataInterface metadata = exampleMetadata2();
FakeDataManager dataMgr = exampleXQTDataManager(metadata);
String expectedDoc =
@@ -6618,7 +6154,7 @@
* all nested "anchor" nodes are named "srcNested". Test of defect #5988
*/
@Test public void testXQTRecursive2_5988() throws Exception {
- FakeMetadataFacade metadata = exampleMetadata2();
+ QueryMetadataInterface metadata = exampleMetadata2();
FakeDataManager dataMgr = exampleXQTDataManager(metadata);
String expectedDoc =
@@ -6670,7 +6206,7 @@
* for defect 5988
*/
@Test public void testXQTRecursiveSiblings_5988() throws Exception {
- FakeMetadataFacade metadata = exampleMetadata2();
+ QueryMetadataInterface metadata = exampleMetadata2();
FakeDataManager dataMgr = exampleXQTDataManager(metadata);
String expectedDoc =
@@ -6806,7 +6342,7 @@
}
@Test public void testSelectElement1() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -6830,7 +6366,7 @@
}
@Test public void testSelectElement2() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
@@ -6907,7 +6443,7 @@
/** select element in the reverse order of depth*/
@Test public void testSelectElement3() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
@@ -6984,7 +6520,7 @@
/** two select elements at the same level*/
@Test public void testSelectElement4() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -7014,7 +6550,7 @@
/** defect 9756 */
@Test public void testSelectElement4_defect9756() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -7034,7 +6570,7 @@
/** three select elements with two of them at the same level and there are other nodes with the same name*/
@Test public void testSelectElement5() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
@@ -7119,7 +6655,7 @@
/** check element.* case */
@Test public void testSelectElement6() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -7147,7 +6683,7 @@
/** check element.* case without attribute in order by*/
@Test public void testSelectElement6a() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -7175,7 +6711,7 @@
}
@Test public void testSelectElement7() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -7203,7 +6739,7 @@
}
@Test public void testSelectElement8() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -7232,7 +6768,7 @@
/** SELECT clause has element.*, but the sibling elements should not be included, only subtree should */
@Test public void testSelectElement9() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -7268,7 +6804,7 @@
}
@Test public void testSelectElement9a() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -7301,7 +6837,7 @@
/** check element.* case with criteria and order by clause */
@Test public void testSelectElement10() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -7329,7 +6865,7 @@
}
@Test public void testSelectElement12() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -7382,7 +6918,7 @@
}
@Test public void testSelectElement13() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -7404,7 +6940,7 @@
}
@Test public void testSelectElement14() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -7458,7 +6994,7 @@
}
@Test public void testSelectElement15() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -7511,7 +7047,7 @@
}
@Test public void testSelectElement16() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -7565,7 +7101,7 @@
/** CSE query 0 */
@Test public void testSelectElement17() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
@@ -7666,7 +7202,7 @@
/** CSE query 1 */
@Test public void testSelectElement18() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -7711,7 +7247,7 @@
/** CSE query 2 */
@Test public void testSelectElement19() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -7757,7 +7293,7 @@
/** CSE query 3 */
@Test public void testSelectElement20() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -7790,7 +7326,7 @@
/** CSE query 3a */
@Test public void testSelectElement20a() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -7820,7 +7356,7 @@
/** CSE query 4 */
@Test public void testSelectElement21() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -7907,7 +7443,7 @@
/** CSE query 4a */
@Test public void testSelectElement21a() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -7970,7 +7506,7 @@
/** CSE query 5 */
@Test public void testSelectElement22() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
@@ -8029,7 +7565,7 @@
/** CSE query 5a */
@Test public void testSelectElement22a() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
@@ -8085,7 +7621,7 @@
/** CSE query 6 */
@Test public void testSelectElement23() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
@@ -8127,7 +7663,7 @@
/** CSE query 6a */
@Test public void testSelectElement23a() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -8166,7 +7702,7 @@
/** test with order by and the element in the criteria is not in the select elements*/
@Test public void testSelectElement24() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -8206,7 +7742,7 @@
/** test element.* with order by and the element in the criteria is not in the select elements*/
@Test public void testSelectElement24a() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -8267,7 +7803,7 @@
/** test with order by with only necessary sub-mapping classes are queried*/
@Test public void testSelectElement25() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -8308,7 +7844,7 @@
/** test element.* with order by with only necessary sub-mapping classes are queried*/
@Test public void testSelectElement25a() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -8375,7 +7911,7 @@
* and case_insensitive nodes in the mapping tree
*/
@Test public void testSelectElement25b() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -8439,7 +7975,7 @@
}
@Test public void testSelectElement26() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -8506,7 +8042,7 @@
* --> refer to Defect9497, this should fail
*/
@Test public void testSelectElement27() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -8534,7 +8070,7 @@
/** test special element, root element */
@Test public void testSelectElement28() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -8558,7 +8094,7 @@
/** test special element */
@Test public void testSelectElement28a() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -8584,7 +8120,7 @@
/** test model.document.* */
@Test public void testSelectElement28b() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -8615,7 +8151,7 @@
/** test special element, root element */
@Test public void testSelectElement29() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -8640,7 +8176,7 @@
/** test simple case for two elements in a mapping class */
@Test public void testSelectElement30() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
@@ -8661,7 +8197,7 @@
/** test NullPointerException*/
@Test public void testDefect_9496_1() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -8725,7 +8261,7 @@
}
@Test public void testDefect_9496_2() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -8782,7 +8318,7 @@
/** test StringIndexOutOfBoundsException */
@Test public void testDefect_9496_3() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -8887,7 +8423,7 @@
/** should fail: because there are other element other than "xml" */
/*@Test public void testResolver1() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc = "";
@@ -8903,7 +8439,7 @@
/** should fail: partial qualified element name and "model.document.xml" */
/*@Test public void testResolver2() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc = "";
@@ -8919,7 +8455,7 @@
/** should fail: test XMLResolver validatation for model.* */
/*@Test public void testDefect_9498_1() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc = "";
@@ -8932,7 +8468,7 @@
/** should fail: test XMLResolver validatation for model.document.* */
/*@Test public void testDefect_9498_2() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc = "";
@@ -8945,7 +8481,7 @@
/** should fail: test XMLResolver validatation for xml.* */
/*@Test public void testDefect_9498_3() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc = "";
@@ -8960,7 +8496,7 @@
* and case_insensitive nodes in the mapping tree
*/
@Test public void testCommentNodeInDoc() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -9009,7 +8545,7 @@
"</Catalogs>\r\n\r\n"; //$NON-NLS-1$
@Test public void testDefect8917() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager_8917(metadata);
// helpTestProcess("SELECT * FROM xmltest.doc_8917 WHERE Catalog.Items.Item.ItemID = '001'",
@@ -9020,7 +8556,7 @@
* jhTODO
*/
@Test public void testNillableOptional() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
@@ -9039,7 +8575,7 @@
* jhTODO
*/
@Test public void testNillableNonOptional() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
@@ -9061,7 +8597,7 @@
* see also defect 15117
*/
@Test public void testDefect11789() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager_8917a(metadata);
String expected =
@@ -9123,7 +8659,7 @@
* testDefect8917
*/
@Test public void testDefect11789b() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager_8917b(metadata);
helpTestProcess("SELECT * FROM xmltest.doc_8917", //$NON-NLS-1$
@@ -9131,7 +8667,7 @@
}
@Test public void testDefect9446() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager_8917(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -9152,7 +8688,7 @@
}
@Test public void testDefect9446_2() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager_8917(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -9167,7 +8703,7 @@
}
@Test public void testDefect_9530() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -9198,7 +8734,7 @@
}
@Test public void testSubqueryInXMLQueryCriteria() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -9225,7 +8761,7 @@
}
@Test public void testSubqueryInXMLQueryCriteria2() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -9252,7 +8788,7 @@
}
@Test public void testSubqueryInXMLQueryCriteria3() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -9279,7 +8815,7 @@
}
public void XXXtestSubqueryInXMLQueryCriteria4() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -9306,7 +8842,7 @@
}
@Test public void testSubqueryInXMLQueryCriteriaNestedSubquery() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -9333,7 +8869,7 @@
}
@Test public void testSubqueryInXMLQueryCriteriaNestedMappingClass() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -9398,7 +8934,7 @@
}
@Test public void testSubqueryInXMLQueryCriteriaNestedMappingClass2() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -9463,7 +8999,7 @@
}
@Test public void testSubqueryInXMLQueryCriteriaNestedMappingClass3() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -9528,7 +9064,7 @@
}
@Test public void testSubqueryInXMLQueryCriteriaNestedMappingClass3a() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -9594,7 +9130,7 @@
@Test public void testSubqueryInXMLQueryCriteriaNestedMappingClass4() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -9661,7 +9197,7 @@
}
@Test public void testCritNestedMappingClass() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -9726,7 +9262,7 @@
}
@Test public void testDefect_9893() throws Exception{
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -9741,7 +9277,7 @@
}
@Test public void testDefect_9893_2() throws Exception{
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -9756,7 +9292,7 @@
}
@Test public void testDefect_9893_3() throws Exception{
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -9771,7 +9307,7 @@
}
@Test public void testDefect_9893_4() throws Exception{
- FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+ QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -9785,13 +9321,12 @@
" </Catalog>\r\n" + //$NON-NLS-1$
"</Catalogs>\r\n\r\n"; //$NON-NLS-1$
- final boolean SHOULD_SUCCEED = true;
helpTestProcess("SELECT Item FROM xmltest.doc9c", //$NON-NLS-1$
expectedDoc, metadata, dataMgr, null);
}
@Test public void testNestedWithStoredQueryInMappingClass() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -9857,7 +9392,7 @@
/** homegenous, simple array elements */
@Test public void testWithSOAPEncoding1() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataSoap1();
+ QueryMetadataInterface metadata = exampleMetadataSoap1();
FakeDataManager dataMgr = exampleDataManagerForSoap1(metadata, false);
String expectedDoc =
@@ -9891,7 +9426,7 @@
* whole fragment
*/
@Test public void testWithSOAPEncodingNoRows() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataSoap1();
+ QueryMetadataInterface metadata = exampleMetadataSoap1();
FakeDataManager dataMgr = exampleDataManagerForSoap1(metadata, true);
String expectedDoc =
@@ -9917,7 +9452,7 @@
}
@Test public void testDefect12260() throws Exception{
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -9957,7 +9492,7 @@
@Test public void testDefect8373() throws Exception{
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerWithNulls(metadata);
String expectedDoc =
@@ -9998,7 +9533,7 @@
@Test public void testDefect8373a() throws Exception{
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerWithNulls(metadata);
String expectedDoc =
@@ -10039,7 +9574,7 @@
@Test public void testDefect8373b() throws Exception{
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerWithNulls(metadata);
String expectedDoc =
@@ -10079,7 +9614,7 @@
}
@Test public void testDefect13617() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager13617(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -10103,7 +9638,7 @@
}
@Test public void testDefect13617a() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager13617(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -10134,7 +9669,7 @@
* @since 4.2
*/
@Test public void testDefect14905() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager14905(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -10161,7 +9696,7 @@
}
@Test public void testTextUnnormalizedDefect15117() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager15117(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -10188,7 +9723,7 @@
}
@Test public void testTextUnnormalizedDefect15117a() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager15117a(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -10216,7 +9751,7 @@
@Test public void testRecursiveGroupDoc() throws Exception {
- FakeMetadataFacade metadata = exampleMetadata2();
+ QueryMetadataInterface metadata = exampleMetadata2();
FakeDataManager dataMgr = exampleXQTDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -10250,7 +9785,7 @@
@Test public void testCase2951MaxRows() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -10317,7 +9852,7 @@
/** test rowlimitexception() doesn't throw exception is rowlimit isn't passed */
@Test public void testDefect19173RowLimitException() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -10384,7 +9919,7 @@
/** test criteria can be written backwards */
@Test public void testDefect19173RowLimitExceptionBackwardsCriteria() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -10450,7 +9985,7 @@
@Test public void testCase2951MaxRows2() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -10505,7 +10040,7 @@
/** test processing exception is thrown if row limit is passed */
@Test public void testDefect19173RowLimitException2() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
helpTestProcess("SELECT * FROM xmltest.doc8 WHERE rowlimitexception(supplier) = 2", null, metadata, dataMgr, TeiidProcessingException.class); //$NON-NLS-1$ //$NON-NLS-2$
@@ -10514,7 +10049,7 @@
/** Two row limits on the same mapping class should be harmless as long as the row limits are identical. */
@Test public void testCase2951MaxRows2a() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -10569,7 +10104,7 @@
/** test processing exception is thrown if row limit is passed */
@Test public void testDefect19173RowLimitException2a() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
helpTestProcess("SELECT * FROM xmltest.doc8 WHERE rowlimitexception(supplier) = 2 AND rowlimitexception(supplierid) = 2", null, metadata, dataMgr, TeiidProcessingException.class); //$NON-NLS-1$ //$NON-NLS-2$
@@ -10578,7 +10113,7 @@
/** compound criteria */
@Test public void testCase2951MaxRows3() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -10609,7 +10144,7 @@
/** compound criteria */
@Test public void testDefect19173RowLimitException3() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
helpTestProcess("SELECT * FROM xmltest.doc8 WHERE ItemID='002' AND rowlimitexception(supplier) = 2", null, metadata, dataMgr, TeiidProcessingException.class); //$NON-NLS-1$ //$NON-NLS-2$
@@ -10617,7 +10152,7 @@
@Test public void testCase2951MaxRows4() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -10661,7 +10196,7 @@
@Test public void testCase2951AndDefect19173MixTwoFunctions() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -10716,7 +10251,7 @@
/** arg to rowlimit function isn't in the scope of any mapping class */
@Test public void testCase2951MaxRowsFails() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
helpTestProcess("SELECT * FROM xmltest.doc8 WHERE rowlimit(catalogs) = 2", null, metadata, dataMgr, QueryPlannerException.class); //$NON-NLS-1$ //$NON-NLS-2$
@@ -10725,7 +10260,7 @@
/** two conflicting row limits on the same mapping class */
@Test public void testCase2951MaxRowsFails2() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
helpTestProcess("SELECT * FROM xmltest.doc8 WHERE rowlimit(supplier) = 2 AND rowlimit(supplierID) = 3", null, metadata, dataMgr, QueryPlannerException.class); //$NON-NLS-1$ //$NON-NLS-2$
@@ -10734,7 +10269,7 @@
/** arg to rowlimitexception function isn't in the scope of any mapping class */
@Test public void testDefect19173RowLimitExceptionFails() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
helpTestProcess("SELECT * FROM xmltest.doc8 WHERE rowlimitexception(catalogs) = 2", null, metadata, dataMgr, QueryPlannerException.class); //$NON-NLS-1$ //$NON-NLS-2$
@@ -10743,7 +10278,7 @@
/** two conflicting rowlimitexceptions on the same mapping class */
@Test public void testDefect19173RowLimitExceptionFails2() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
helpTestProcess("SELECT * FROM xmltest.doc8 WHERE rowlimitexception(supplier) = 2 AND rowlimitexception(supplierID) = 3", null, metadata, dataMgr, QueryPlannerException.class); //$NON-NLS-1$ //$NON-NLS-2$
@@ -10752,7 +10287,7 @@
/** two conflicting rowlimit and rowlimitexceptions on the same mapping class fails planning */
@Test public void testDefect19173RowLimitAndRowLimitExceptionMixFails2() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
helpTestProcess("SELECT * FROM xmltest.doc8 WHERE rowlimit(supplier) = 2 AND rowlimitexception(supplierID) = 3", null, metadata, dataMgr, QueryPlannerException.class); //$NON-NLS-1$ //$NON-NLS-2$
@@ -10761,7 +10296,7 @@
/** try rowlimit criteria written the reverse way */
@Test public void testCase2951MaxRows5() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNested(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -10815,7 +10350,7 @@
@Test public void testNormalizationCollapse() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNormalization(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -10854,7 +10389,7 @@
}
@Test public void testNormalizationReplace() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNormalization(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -10892,7 +10427,7 @@
helpTestProcess("SELECT * FROM xmltest.normDoc2", expectedDoc, metadata, dataMgr); //$NON-NLS-1$
}
@Test public void testNormalizationPreserve() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManagerNormalization2(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -10933,66 +10468,50 @@
/**
* Deluxe example
*/
- private FakeDataManager exampleDataManagerNormalization(FakeMetadataFacade metadata) {
+ private FakeDataManager exampleDataManagerNormalization(QueryMetadataInterface metadata) {
FakeDataManager dataMgr = new FakeDataManager();
try {
- // Group stock.items
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("stock.items"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "001", null, new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "002", " \n Screwdriver \t \r", null, "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "003", " \t\rGoat \n", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "004", "Flux \t\r\n Capacitor", new Integer(2), "discontinued" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "005", "Milkshake", new Integer(88), null } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "006", " Feta Matrix ", new Integer(0), "discontinued" } ) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } );
+ metadata,
+ "stock.items", new List[] {
+ Arrays.asList( new Object[] { "001", null, new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "002", " \n Screwdriver \t \r", null, "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "003", " \t\rGoat \n", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "004", "Flux \t\r\n Capacitor", new Integer(2), "discontinued" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "005", "Milkshake", new Integer(88), null } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "006", " Feta Matrix ", new Integer(0), "discontinued" } ) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } );
- } catch(Throwable e) {
- e.printStackTrace();
- fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch(TeiidException e) {
+ throw new RuntimeException(e);
}
return dataMgr;
}
- private FakeDataManager exampleDataManagerNormalization2(FakeMetadataFacade metadata) {
+ private FakeDataManager exampleDataManagerNormalization2(QueryMetadataInterface metadata) {
FakeDataManager dataMgr = new FakeDataManager();
try {
- // Group stock.items
- FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("stock.items"); //$NON-NLS-1$
- List elementIDs = metadata.getElementIDsInGroupID(groupID);
- List elementSymbols = createElements(elementIDs);
-
dataMgr.registerTuples(
- groupID,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "001", null, new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "002", "My Screwdriver", null, "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "003", "My Goat", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "004", "My Flux Capacitor", new Integer(2), "discontinued" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "005", "My Milkshake", new Integer(88), null } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "006", "My Feta Matrix", new Integer(0), "discontinued" } ) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } );
+ metadata,
+ "stock.items", new List[] {
+ Arrays.asList( new Object[] { "001", null, new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "002", "My Screwdriver", null, "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "003", "My Goat", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "004", "My Flux Capacitor", new Integer(2), "discontinued" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "005", "My Milkshake", new Integer(88), null } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "006", "My Feta Matrix", new Integer(0), "discontinued" } ) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } );
- } catch(Throwable e) {
- e.printStackTrace();
- fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch(TeiidException e) {
+ throw new RuntimeException(e);
}
return dataMgr;
}
- private static MappingNode createXMLPlanNormalization(String normMode) {
+ private static MappingDocument createXMLPlanNormalization(String normMode) {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("Catalogs")); //$NON-NLS-1$
@@ -11039,116 +10558,70 @@
return doc;
}
- static FakeDataManager exampleDataManagerCase3225(FakeMetadataFacade metadata) {
+ static FakeDataManager exampleDataManagerCase3225(QueryMetadataInterface metadata) {
FakeDataManager dataMgr = new FakeDataManager();
try {
- // Group stock.items
- FakeMetadataObject groupItems = (FakeMetadataObject) metadata.getGroupID("stock.items"); //$NON-NLS-1$
-
- // Group stock.supplier
- FakeMetadataObject groupSuppliers = (FakeMetadataObject) metadata.getGroupID("stock.suppliers"); //$NON-NLS-1$
-
- // Group stock.orders
- FakeMetadataObject groupOrders = (FakeMetadataObject) metadata.getGroupID("stock.orders"); //$NON-NLS-1$
-
- // Group stock.employees
- FakeMetadataObject groupEmployees = (FakeMetadataObject) metadata.getGroupID("stock.employees"); //$NON-NLS-1$
-
- // Group stock.item_supplier
- FakeMetadataObject groupItemSupplier = (FakeMetadataObject) metadata.getGroupID("stock.item_supplier"); //$NON-NLS-1$
-
- // Items
- List elementIDs = metadata.getElementIDsInGroupID(groupItems);
- List elementSymbols = createElements(elementIDs);
-
- // Supplier
- elementIDs = metadata.getElementIDsInGroupID(groupSuppliers);
- List supplierElementSymbols = createElements(elementIDs);
-
- // Orders
- elementIDs = metadata.getElementIDsInGroupID(groupOrders);
- List ordersElementSymbols = createElements(elementIDs);
-
- // Employees
- elementIDs = metadata.getElementIDsInGroupID(groupEmployees);
- List employeesElementSymbols = createElements(elementIDs);
-
- // Item_supplier
- elementIDs = metadata.getElementIDsInGroupID(groupItemSupplier);
- List itemSupplierElementSymbols = createElements(elementIDs);
-
dataMgr.registerTuples(
- groupItems,
- elementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "001", "Lamp", new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "002", "Screwdriver", new Integer(100), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "003", "Goat", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } );
+ metadata,
+ "stock.items", new List[] {
+ Arrays.asList( new Object[] { "001", "Lamp", new Integer(5), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "002", "Screwdriver", new Integer(100), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "003", "Goat", new Integer(4), "okay" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } );
dataMgr.registerTuples(
- groupItemSupplier,
- itemSupplierElementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "001", "51" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "001", "52" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "001", "53" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "001", "56" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "002", "54" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "002", "55" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "002", "56" } ), //$NON-NLS-1$ //$NON-NLS-2$
- Arrays.asList( new Object[] { "003", "56" } ), //$NON-NLS-1$ //$NON-NLS-2$
- } );
+ metadata,
+ "stock.item_supplier", new List[] {
+ Arrays.asList( new Object[] { "001", "51" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "001", "52" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "001", "53" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "001", "56" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "002", "54" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "002", "55" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "002", "56" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ Arrays.asList( new Object[] { "003", "56" } ), //$NON-NLS-1$ //$NON-NLS-2$
+ } );
dataMgr.registerTuples(
- groupSuppliers,
- supplierElementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "51", "Chucky", "11111" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "52", "Biff's Stuff", "22222" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "53", "AAAA", "33333" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "54", "Nugent Co.", "44444" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "55", "Zeta", "55555" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "56", "Microsoft", "66666" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } );
+ metadata,
+ "stock.suppliers", new List[] {
+ Arrays.asList( new Object[] { "51", "Chucky", "11111" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "52", "Biff's Stuff", "22222" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "53", "AAAA", "33333" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "54", "Nugent Co.", "44444" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "55", "Zeta", "55555" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "56", "Microsoft", "66666" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } );
dataMgr.registerTuples(
- groupOrders,
- ordersElementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "1", "001", "51", "2/13/05", new Integer(2), "complete" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- Arrays.asList( new Object[] { "2", "001", "52", "3/13/05", new Integer(1), "processing" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- Arrays.asList( new Object[] { "3", "002", "53", "4/13/05", new Integer(1), "complete" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- Arrays.asList( new Object[] { "4", "002", "56", "5/13/05", new Integer(1), "cancelled" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- Arrays.asList( new Object[] { "5", "003", "56", "6/13/05", new Integer(800), "processing" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- } );
+ metadata,
+ "stock.orders", new List[] {
+ Arrays.asList( new Object[] { "1", "001", "51", "2/13/05", new Integer(2), "complete" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ Arrays.asList( new Object[] { "2", "001", "52", "3/13/05", new Integer(1), "processing" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ Arrays.asList( new Object[] { "3", "002", "53", "4/13/05", new Integer(1), "complete" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ Arrays.asList( new Object[] { "4", "002", "56", "5/13/05", new Integer(1), "cancelled" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ Arrays.asList( new Object[] { "5", "003", "56", "6/13/05", new Integer(800), "processing" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ } );
dataMgr.registerTuples(
- groupEmployees,
- employeesElementSymbols,
-
- new List[] {
- Arrays.asList( new Object[] { "1001", "51", "001", "1004", "Albert", "Pujols" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- Arrays.asList( new Object[] { "1002", "51", "001", "1004", "Jim", "Edmunds" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- Arrays.asList( new Object[] { "1003", "54", "002", "1004", "David", "Eckstein" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- Arrays.asList( new Object[] { "1004", null, null, "1009", "Tony", "LaRussa" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- Arrays.asList( new Object[] { "1005", "56", "001", "1007", "Derrek", "Lee" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- Arrays.asList( new Object[] { "1006", "56", "003", "1007", "Corey", "Patterson" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- Arrays.asList( new Object[] { "1007", null, null, "1010", "Dusty", "Baker" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- Arrays.asList( new Object[] { "1008", "56", "002", "1007", "Carlos", "Zambrano" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- Arrays.asList( new Object[] { "1009", null, null, null, "Bill", "DeWitt" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Arrays.asList( new Object[] { "1010", null, null, null, "Some", "Guy" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } );
+ metadata,
+ "stock.employees", new List[] {
+ Arrays.asList( new Object[] { "1001", "51", "001", "1004", "Albert", "Pujols" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ Arrays.asList( new Object[] { "1002", "51", "001", "1004", "Jim", "Edmunds" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ Arrays.asList( new Object[] { "1003", "54", "002", "1004", "David", "Eckstein" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ Arrays.asList( new Object[] { "1004", null, null, "1009", "Tony", "LaRussa" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ Arrays.asList( new Object[] { "1005", "56", "001", "1007", "Derrek", "Lee" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ Arrays.asList( new Object[] { "1006", "56", "003", "1007", "Corey", "Patterson" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ Arrays.asList( new Object[] { "1007", null, null, "1010", "Dusty", "Baker" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ Arrays.asList( new Object[] { "1008", "56", "002", "1007", "Carlos", "Zambrano" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ Arrays.asList( new Object[] { "1009", null, null, null, "Bill", "DeWitt" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Arrays.asList( new Object[] { "1010", null, null, null, "Some", "Guy" } ), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } );
- } catch(Throwable e) {
- e.printStackTrace();
- fail("Exception building test data (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch(TeiidException e) {
+ throw new RuntimeException(e);
}
return dataMgr;
@@ -11159,7 +10632,7 @@
* @throws Exception
*/
@Test public void testCase3225() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleCase3225();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleCase3225();
FakeDataManager dataMgr = exampleDataManagerCase3225(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -11477,7 +10950,7 @@
* @throws Exception
*/
@Test public void testCase3225WithCriteria() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleCase3225();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleCase3225();
FakeDataManager dataMgr = exampleDataManagerCase3225(metadata);
helpTestProcess("select * from xmltest.itemsdoc where employee.@supervisorID='1004' and order.orderquantity > 1", CASE_3225_WITH_CRITERIA_EXPECTED_DOC, metadata, dataMgr); //$NON-NLS-1$
}
@@ -11499,7 +10972,7 @@
* @throws Exception
*/
@Test public void testCase3225WithCriteriaReversed() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleCase3225();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleCase3225();
FakeDataManager dataMgr = exampleDataManagerCase3225(metadata);
helpTestProcess("select * from xmltest.itemsdoc where order.orderquantity > 1 and employee.@supervisorID='1004'", CASE_3225_WITH_CRITERIA_EXPECTED_DOC, metadata, dataMgr); //$NON-NLS-1$
}
@@ -11511,7 +10984,7 @@
* @throws Exception
*/
@Test public void testCase3225WithEmptyDocCriteria() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleCase3225();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleCase3225();
FakeDataManager dataMgr = exampleDataManagerCase3225(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -11531,7 +11004,7 @@
*/
@Test public void testBaseballPlayersDoc() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleCase3225();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleCase3225();
FakeDataManager dataMgr = exampleDataManagerCase3225(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -11623,7 +11096,7 @@
*/
@Test public void testBaseballPlayersDocCriteria() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleCase3225();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleCase3225();
FakeDataManager dataMgr = exampleDataManagerCase3225(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -11678,7 +11151,7 @@
*/
@Test public void testBaseballPlayersDocContextCriteria() throws Exception {
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleCase3225();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleCase3225();
FakeDataManager dataMgr = exampleDataManagerCase3225(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -11741,7 +11214,7 @@
* Ensures that temp tables are still visible when processing criteria
*/
@Test public void testProcedureAndXML() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -11763,7 +11236,7 @@
}
@Test public void testProcedureAndXML1() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc1 =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
@@ -11808,7 +11281,7 @@
* of bounded, but result set is returning more results then it should fail.
*/
public void defer_testMinMaxOnSourceNode() throws Exception {
- FakeMetadataFacade metadata = exampleMetadataCached();
+ QueryMetadataInterface metadata = exampleMetadataCached();
FakeDataManager dataMgr = exampleDataManager(metadata);
String expectedDoc =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + //$NON-NLS-1$
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/resolver/TestFunctionResolving.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/resolver/TestFunctionResolving.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/resolver/TestFunctionResolving.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -36,7 +36,7 @@
import org.teiid.query.sql.symbol.Function;
import org.teiid.query.sql.symbol.Reference;
import org.teiid.query.sql.symbol.XMLSerialize;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
public class TestFunctionResolving {
@@ -45,7 +45,7 @@
Function function = new Function("convert", new Expression[] {new Constant(new Character('a')), new Constant(DataTypeManager.DefaultDataTypes.DATE)}); //$NON-NLS-1$
try {
- ResolverVisitor.resolveLanguageObject(function, FakeMetadataFactory.example1Cached());
+ ResolverVisitor.resolveLanguageObject(function, RealMetadataFactory.example1Cached());
fail("excpetion expected"); //$NON-NLS-1$
} catch (QueryResolverException err) {
assertEquals("Error Code:ERR.015.008.0037 Message:The conversion from char to date is not allowed.", err.getMessage()); //$NON-NLS-1$
@@ -59,7 +59,7 @@
e1.setMetadataID(new Object());
Function function = new Function("abs", new Expression[] {e1}); //$NON-NLS-1$
- ResolverVisitor.resolveLanguageObject(function, FakeMetadataFactory.example1Cached());
+ ResolverVisitor.resolveLanguageObject(function, RealMetadataFactory.example1Cached());
assertEquals(DataTypeManager.DefaultDataClasses.INTEGER, function.getType());
}
@@ -67,7 +67,7 @@
@Test public void testResolveConvertReference() throws Exception {
Function function = new Function("convert", new Expression[] {new Reference(0), new Constant(DataTypeManager.DefaultDataTypes.BOOLEAN)}); //$NON-NLS-1$
- ResolverVisitor.resolveLanguageObject(function, FakeMetadataFactory.example1Cached());
+ ResolverVisitor.resolveLanguageObject(function, RealMetadataFactory.example1Cached());
assertEquals(DataTypeManager.DefaultDataClasses.BOOLEAN, function.getType());
assertEquals(DataTypeManager.DefaultDataClasses.BOOLEAN, function.getArgs()[0].getType());
@@ -77,7 +77,7 @@
Function function = new Function("LCASE", new Expression[] {new Reference(0)}); //$NON-NLS-1$
try {
- ResolverVisitor.resolveLanguageObject(function, FakeMetadataFactory.example1Cached());
+ ResolverVisitor.resolveLanguageObject(function, RealMetadataFactory.example1Cached());
fail("excpetion expected"); //$NON-NLS-1$
} catch (QueryResolverException err) {
assertEquals("Error Code:ERR.015.008.0036 Message:The function 'LCASE(?)' has more than one possible signature.", err.getMessage()); //$NON-NLS-1$
@@ -130,7 +130,7 @@
public static Expression getExpression(String sql) throws QueryParserException,
TeiidComponentException, QueryResolverException {
Expression func = QueryParser.getQueryParser().parseExpression(sql);
- ResolverVisitor.resolveLanguageObject(func, FakeMetadataFactory.example1Cached());
+ ResolverVisitor.resolveLanguageObject(func, RealMetadataFactory.example1Cached());
return func;
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -24,17 +24,15 @@
import static org.junit.Assert.*;
-import java.util.Arrays;
import java.util.Map;
import org.junit.Test;
import org.teiid.api.exception.query.QueryMetadataException;
import org.teiid.api.exception.query.QueryParserException;
import org.teiid.api.exception.query.QueryResolverException;
-import org.teiid.client.metadata.ParameterInfo;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.types.DataTypeManager;
-import org.teiid.query.mapping.relational.QueryNode;
+import org.teiid.metadata.Table;
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.metadata.TempMetadataAdapter;
import org.teiid.query.metadata.TempMetadataStore;
@@ -53,34 +51,15 @@
import org.teiid.query.sql.symbol.GroupSymbol;
import org.teiid.query.sql.visitor.CommandCollectorVisitor;
import org.teiid.query.sql.visitor.ElementCollectorVisitor;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
+import org.teiid.query.unittest.RealMetadataFactory;
-
public class TestProcedureResolving {
- private QueryMetadataInterface exampleStoredProcedure(String procedure) {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode(procedure);
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- metadata.getStore().addObject(rs2);
- metadata.getStore().addObject(sq1);
-
- return metadata;
- }
-
- private void helpFailUpdateProcedure(String procedure, String userUpdateStr, String procedureType) {
+ private void helpFailUpdateProcedure(String procedure, String userUpdateStr, Table.TriggerEvent procedureType) {
helpFailUpdateProcedure(procedure, userUpdateStr, procedureType, null);
}
- private void helpFailUpdateProcedure(String procedure, String userUpdateStr, String procedureType, String msg) {
+ private void helpFailUpdateProcedure(String procedure, String userUpdateStr, Table.TriggerEvent procedureType, String msg) {
// resolve
try {
helpResolveUpdateProcedure(procedure, userUpdateStr, procedureType);
@@ -112,7 +91,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
- Command command = helpResolveUpdateProcedure(proc.toString(), userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Command command = helpResolveUpdateProcedure(proc.toString(), userUpdateStr, Table.TriggerEvent.UPDATE);
Map tempIDs = command.getTemporaryMetadata();
assertNotNull(tempIDs);
assertNull(tempIDs.get("LOOPCURSOR")); //$NON-NLS-1$
@@ -131,8 +110,8 @@
assertNull(tempIDs.get("LOOPCURSOR2")); //$NON-NLS-1$
}
- private CreateUpdateProcedureCommand helpResolveUpdateProcedure(String procedure, String userUpdateStr, String procedureType) throws QueryParserException, QueryResolverException, TeiidComponentException {
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleUpdateProc(procedureType, procedure);
+ private CreateUpdateProcedureCommand helpResolveUpdateProcedure(String procedure, String userUpdateStr, Table.TriggerEvent procedureType) throws QueryParserException, QueryResolverException, TeiidComponentException {
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(procedureType, procedure);
return resolveProcedure(userUpdateStr, metadata);
}
@@ -149,6 +128,7 @@
private void helpResolveException(String userUpdateStr, QueryMetadataInterface metadata, String msg) throws QueryParserException, TeiidComponentException {
try {
helpResolve(userUpdateStr, metadata);
+ fail();
} catch (QueryResolverException e) {
assertEquals(msg, e.getMessage());
}
@@ -162,7 +142,7 @@
* Constants will now auto resolve if they are consistently representable in the target type
*/
@Test public void testDefect23257() throws Exception{
- CreateUpdateProcedureCommand command = helpResolve("EXEC pm5.vsp59()", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ CreateUpdateProcedureCommand command = helpResolve("EXEC pm6.vsp59()", RealMetadataFactory.example1Cached()); //$NON-NLS-1$
CommandStatement cs = (CommandStatement)command.getBlock().getStatements().get(1);
@@ -187,7 +167,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
CreateUpdateProcedureCommand command = helpResolveUpdateProcedure(proc.toString(), userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
Block block = command.getBlock();
@@ -217,7 +197,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// variable resolution, variable used in if statement, invalid operation on variable
@@ -232,7 +212,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// variable resolution, variables declared in different blocks local variables
@@ -251,7 +231,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE, "Variable var1 was previously declared."); //$NON-NLS-1$
+ Table.TriggerEvent.UPDATE, "Variable var1 was previously declared."); //$NON-NLS-1$
}
// variable resolution, variables declared in different blocks local variables
@@ -270,7 +250,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// variable resolution, variables declared in different blocks local variables
@@ -290,7 +270,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// variable resolution, variables declared in different blocks local variables
@@ -310,7 +290,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// special variable ROWS_UPDATED resolution
@@ -326,7 +306,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// special variable ROWS_UPDATED used with declared variable
@@ -341,7 +321,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// special variable INPUT used with declared variable
@@ -356,7 +336,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// special variable CHANGING used with declared variable
@@ -374,7 +354,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// special variable CHANGING and INPUT used in compound criteria
@@ -392,7 +372,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// special variable CHANGING and INPUT used in compound criteria, with declared variables
@@ -410,7 +390,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// special variable CHANGING compared against integer no implicit conversion available
@@ -426,7 +406,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE, "Error Code:ERR.015.008.0027 Message:The expressions in this criteria are being compared but are of differing types (boolean and date) and no implicit conversion is available: CHANGING.e4 = {d'2000-01-01'}"); //$NON-NLS-1$
+ Table.TriggerEvent.UPDATE, "Error Code:ERR.015.008.0027 Message:The expressions in this criteria are being compared but are of differing types (boolean and date) and no implicit conversion is available: CHANGING.e4 = {d'2000-01-01'}"); //$NON-NLS-1$
}
// virtual group elements used in procedure(HAS CRITERIA)
@@ -441,7 +421,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// virtual group elements used in procedure in if statement(HAS CRITERIA)
@@ -459,7 +439,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// virtual group elements used in procedure(TRANSLATE CRITERIA)
@@ -474,7 +454,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// virtual group elements used in procedure(TRANSLATE CRITERIA)
@@ -489,7 +469,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// using undefined variable should fail
@@ -505,7 +485,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// using undefined variable declared is of invalid datatype
@@ -520,7 +500,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// using declare variable that has parts
@@ -533,7 +513,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// using declare variable is qualified
@@ -546,7 +526,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// using declare variable is qualified but has more parts
@@ -559,7 +539,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// using a variable that has not been declared in an assignment stmt
@@ -572,7 +552,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// using a variable that has not been declared in an assignment stmt
@@ -585,7 +565,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// using invalid function in assignment expr
@@ -599,7 +579,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// using invalid function in assignment expr
@@ -613,7 +593,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// using a variable being used inside a subcomand
@@ -627,7 +607,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// variable resolution, variables declared in different blocks local variables
@@ -648,7 +628,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// physical elements used on criteria of the if statement
@@ -665,7 +645,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE, "Symbol pm1.g1.e2 is specified with an unknown group context"); //$NON-NLS-1$
+ Table.TriggerEvent.UPDATE, "Symbol pm1.g1.e2 is specified with an unknown group context"); //$NON-NLS-1$
}
// virtual elements used on criteria of the if statement
@@ -682,7 +662,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// physical elements used on criteria of the if statement
@@ -699,7 +679,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// TranslateCriteria on criteria of the if statement
@@ -716,7 +696,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// validating Translate CRITERIA, elements on it should be virtual group elements
@@ -731,7 +711,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// physical elements used on criteria of the if statement
@@ -748,7 +728,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// TranslateCriteria on criteria of the if statement
@@ -765,7 +745,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// TranslateCriteria on criteria of the if statement
@@ -782,7 +762,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// TranslateCriteria on criteria of the if statement
@@ -799,7 +779,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// TranslateCriteria on criteria of the if statement
@@ -812,7 +792,7 @@
// procedure = procedure + "UPDATE pm1.g1 SET pm1.g1.e1 = INPUTS.e1, pm1.g1.e2 = INPUTS.e2;\n";
procedure = procedure + "END\n"; //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure);
Command procCommand = QueryParser.getQueryParser().parseCommand(procedure);
GroupSymbol virtualGroup = new GroupSymbol("vm1.g1"); //$NON-NLS-1$
@@ -833,7 +813,7 @@
String userUpdateStr = "INSERT into vm1.g1 (e1) values('x')"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.INSERT_PROCEDURE);
+ Table.TriggerEvent.INSERT);
}
// special variable CHANGING compared against integer no implicit conversion available
@@ -848,7 +828,7 @@
Command procCommand = QueryParser.getQueryParser().parseCommand(procedure);
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.INSERT_PROCEDURE, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.INSERT, procedure);
GroupSymbol virtualGroup = new GroupSymbol("vm1.g1"); //$NON-NLS-1$
virtualGroup.setMetadataID(metadata.getGroupID("vm1.g1")); //$NON-NLS-1$
@@ -865,7 +845,7 @@
Command procCommand = QueryParser.getQueryParser().parseCommand(procedure);
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure);
GroupSymbol virtualGroup = new GroupSymbol("vm1.g1"); //$NON-NLS-1$
virtualGroup.setMetadataID(metadata.getGroupID("vm1.g1")); //$NON-NLS-1$
@@ -887,7 +867,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// validating Translate CRITERIA, elements(left elements on on it should be virtual group elements
@@ -901,7 +881,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// resolving Translate CRITERIA, right element should be present on the command
@@ -914,7 +894,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// resolving criteria selector(on HAS CRITERIA), elements on it should be virtual group elements
@@ -931,7 +911,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// resolving Translate CRITERIA, right side expression in the translate criteria should be elements on the command
@@ -947,7 +927,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// validating Translate CRITERIA, elements on it should be virtual group elements
@@ -963,7 +943,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// resolving AssignmentStatement, variable type and assigned type
@@ -979,7 +959,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// resolving AssignmentStatement, variable type and assigned type
@@ -995,7 +975,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// resolving AssignmentStatement, variable type and assigned type
@@ -1011,7 +991,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
@Test public void testDefect14912_CreateUpdateProcedure57_FunctionWithElementParamInAssignmentStatement() {
@@ -1025,7 +1005,7 @@
String userCommand = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
- helpFailUpdateProcedure(procedure, userCommand, FakeMetadataObject.Props.UPDATE_PROCEDURE, "Element \"badElement\" is not defined by any relevant group."); //$NON-NLS-1$
+ helpFailUpdateProcedure(procedure, userCommand, Table.TriggerEvent.UPDATE, "Element \"badElement\" is not defined by any relevant group."); //$NON-NLS-1$
}
// addresses Cases 4624. Before change to UpdateProcedureResolver,
@@ -1044,7 +1024,7 @@
String userCommand = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
- helpFailUpdateProcedure(procedure, userCommand, FakeMetadataObject.Props.UPDATE_PROCEDURE, "Group does not exist: Bert_MAP.BERT3.RACK"); //$NON-NLS-1$
+ helpFailUpdateProcedure(procedure, userCommand, Table.TriggerEvent.UPDATE, "Group does not exist: Bert_MAP.BERT3.RACK"); //$NON-NLS-1$
}
// addresses Cases 5474.
@@ -1055,7 +1035,7 @@
procedure = procedure + "VARIABLES.NLEVELS = SELECT COUNT(*) FROM (SELECT oi.e1 AS Col1, oi.e2 AS Col2, oi.e3 FROM pm1.g2 AS oi) AS TOBJ, pm2.g2 AS TModel WHERE TModel.e3 = TOBJ.e3;\n"; //$NON-NLS-1$
procedure = procedure + "END\n"; //$NON-NLS-1$
- TestResolver.helpResolve(procedure, FakeMetadataFactory.example1Cached());
+ TestResolver.helpResolve(procedure, RealMetadataFactory.example1Cached());
}
@Test public void testIssue174102() throws Exception {
@@ -1066,23 +1046,9 @@
procedure = procedure + "EXECUTE STRING ('SELECT e1 FROM pm1.sq2 ' || crit ) AS e1 string INTO #TTable;\n"; //$NON-NLS-1$
procedure = procedure + "END\n"; //$NON-NLS-1$
- TestResolver.helpResolve(procedure, FakeMetadataFactory.example1Cached());
+ TestResolver.helpResolve(procedure, RealMetadataFactory.example1Cached());
}
- // Address Issue 174519.
- // Expected result is resolver failure, but with different error.
- @Test public void testIssue174519() throws Exception {
- String procedure = "CREATE VIRTUAL PROCEDURE \n"; //$NON-NLS-1$
- procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
- procedure = procedure + "DECLARE string VARIABLES.l_in = pm1.sq1.in;\n"; //$NON-NLS-1$
- procedure = procedure + "INSERT INTO #temp \n"; //$NON-NLS-1$
- procedure = procedure + "SELECT pm1.sq3.e1 FROM pm1.sq3 WHERE pm1.sq3.in = VARIABLES.l_in;\n"; //$NON-NLS-1$
- procedure = procedure + "END\n"; //$NON-NLS-1$
-
- QueryMetadataInterface metadata = exampleStoredProcedure(procedure);
- helpResolveException("EXEC pm1.sq1(1)", metadata, "Error Code:ERR.015.008.0010 Message:INSERT statement must have the same number of elements and values specified. This statement has 0 elements and 0 values."); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
/*@Test public void testCommandUpdatingCountFromLastStatement() throws Exception {
String procedure = "CREATE VIRTUAL PROCEDURE \n"; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
@@ -1106,7 +1072,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
- helpFailUpdateProcedure(procedure, userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ helpFailUpdateProcedure(procedure, userUpdateStr, Table.TriggerEvent.UPDATE);
}
@Test public void testDynamicIntoInProc() throws Exception {
@@ -1119,7 +1085,7 @@
.append("ROWS_UPDATED =0;\n") //$NON-NLS-1$
.append("END\n"); //$NON-NLS-1$
helpResolveUpdateProcedure(procedure.toString(), userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
@Test public void testDynamicStatement() throws Exception {
@@ -1131,7 +1097,7 @@
.append("ROWS_UPDATED =0;\n") //$NON-NLS-1$
.append("END\n"); //$NON-NLS-1$
helpResolveUpdateProcedure(procedure.toString(), userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
@Test public void testDynamicStatementType() {
@@ -1143,7 +1109,7 @@
.append("execute string VARIABLES.X;\n") //$NON-NLS-1$
.append("ROWS_UPDATED =0;\n") //$NON-NLS-1$
.append("END\n"); //$NON-NLS-1$
- helpFailUpdateProcedure(procedure.toString(), userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ helpFailUpdateProcedure(procedure.toString(), userUpdateStr, Table.TriggerEvent.UPDATE);
}
// variable resolution
@@ -1158,7 +1124,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1=1"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// variable resolution, variable used in if statement
@@ -1174,7 +1140,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
@Test public void testSelectIntoInProc() throws Exception {
@@ -1187,7 +1153,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure.toString(), userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
procedure = new StringBuffer("CREATE PROCEDURE ") //$NON-NLS-1$
.append("BEGIN\n") //$NON-NLS-1$
@@ -1195,7 +1161,7 @@
.append("ROWS_UPDATED =0;\n") //$NON-NLS-1$
.append("END\n"); //$NON-NLS-1$
helpResolveUpdateProcedure(procedure.toString(), userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
@Test public void testSelectIntoInProcNoFrom() throws Exception {
@@ -1208,7 +1174,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure.toString(), userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
procedure = new StringBuffer("CREATE PROCEDURE ") //$NON-NLS-1$
.append("BEGIN\n") //$NON-NLS-1$
@@ -1216,7 +1182,7 @@
.append("ROWS_UPDATED =0;\n") //$NON-NLS-1$
.append("END\n"); //$NON-NLS-1$
helpResolveUpdateProcedure(procedure.toString(), userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
/*@Test public void testCommandUpdating3() throws Exception{
@@ -1229,7 +1195,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
Command command = helpResolveUpdateProcedure(procedure.toString(), userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
assertEquals(2, command.updatingModelCount(metadata));
}*/
@@ -1245,7 +1211,7 @@
String userUpdateStr = "INSERT into vm1.g1 (e1) values('x')"; //$NON-NLS-1$
Command command = helpResolveUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.INSERT_PROCEDURE);
+ Table.TriggerEvent.INSERT);
assertEquals(2, command.updatingModelCount(metadata));
}*/
@@ -1260,7 +1226,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE, "Variable rows_updated was previously declared."); //$NON-NLS-1$
+ Table.TriggerEvent.UPDATE, "Variable rows_updated was previously declared."); //$NON-NLS-1$
}
// validating INPUT element assigned
@@ -1275,7 +1241,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// validating CHANGING element assigned
@@ -1290,7 +1256,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// variables cannot be used among insert elements
@@ -1305,7 +1271,7 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where e3= 1"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE, "Column variables do not reference columns on group \"pm1.g1\": [Unable to resolve 'var1': Element \"var1\" is not defined by any relevant group.]"); //$NON-NLS-1$
+ Table.TriggerEvent.UPDATE, "Column variables do not reference columns on group \"pm1.g1\": [Unable to resolve 'var1': Element \"var1\" is not defined by any relevant group.]"); //$NON-NLS-1$
}
// variables cannot be used among insert elements
@@ -1320,7 +1286,7 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where e3= 1"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE, "Column variables do not reference columns on group \"pm1.g1\": [Unable to resolve 'INPUTS.x': Symbol INPUTS.x is specified with an unknown group context]"); //$NON-NLS-1$
+ Table.TriggerEvent.UPDATE, "Column variables do not reference columns on group \"pm1.g1\": [Unable to resolve 'INPUTS.x': Symbol INPUTS.x is specified with an unknown group context]"); //$NON-NLS-1$
}
//should resolve first to the table's column
@@ -1335,7 +1301,7 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where e3= 1"; //$NON-NLS-1$
helpResolveUpdateProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
@Test public void testAmbigousInput() {
@@ -1347,7 +1313,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE, "Element \"e1\" is ambiguous, it exists in two or more groups."); //$NON-NLS-1$
+ Table.TriggerEvent.UPDATE, "Element \"e1\" is ambiguous, it exists in two or more groups."); //$NON-NLS-1$
}
@Test public void testLoopRedefinition() {
@@ -1366,7 +1332,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(proc.toString(), userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE, "Nested Loop can not use the same cursor name as that of its parent."); //$NON-NLS-1$
+ Table.TriggerEvent.UPDATE, "Nested Loop can not use the same cursor name as that of its parent."); //$NON-NLS-1$
}
@Test public void testTempGroupElementShouldNotBeResolable() {
@@ -1379,7 +1345,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(proc.toString(), userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE, "Symbol #temp.a is specified with an unknown group context"); //$NON-NLS-1$
+ Table.TriggerEvent.UPDATE, "Symbol #temp.a is specified with an unknown group context"); //$NON-NLS-1$
}
@Test public void testTempGroupElementShouldNotBeResolable1() {
@@ -1392,7 +1358,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(proc.toString(), userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE, "Symbol #temp.a is specified with an unknown group context"); //$NON-NLS-1$
+ Table.TriggerEvent.UPDATE, "Symbol #temp.a is specified with an unknown group context"); //$NON-NLS-1$
}
@Test public void testProcedureCreate() throws Exception {
@@ -1406,7 +1372,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
- helpResolveUpdateProcedure(proc.toString(), userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ helpResolveUpdateProcedure(proc.toString(), userUpdateStr, Table.TriggerEvent.UPDATE);
}
/**
@@ -1423,7 +1389,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
- helpFailUpdateProcedure(proc.toString(), userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE, "Cannot create temporary table \"loopCursor\". A table with the same name already exists."); //$NON-NLS-1$
+ helpFailUpdateProcedure(proc.toString(), userUpdateStr, Table.TriggerEvent.UPDATE, "Cannot create temporary table \"loopCursor\". A table with the same name already exists."); //$NON-NLS-1$
}
@Test public void testProcedureCreateDrop() {
@@ -1435,7 +1401,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
- helpFailUpdateProcedure(proc.toString(), userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE, "Group does not exist: t1"); //$NON-NLS-1$
+ helpFailUpdateProcedure(proc.toString(), userUpdateStr, Table.TriggerEvent.UPDATE, "Group does not exist: t1"); //$NON-NLS-1$
}
@Test public void testProcedureCreateDrop1() throws Exception {
@@ -1447,7 +1413,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
- helpResolveUpdateProcedure(proc.toString(), userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ helpResolveUpdateProcedure(proc.toString(), userUpdateStr, Table.TriggerEvent.UPDATE);
}
@Test public void testCreateAfterImplicitTempTable() throws Exception {
@@ -1459,7 +1425,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
- helpResolveUpdateProcedure(proc.toString(), userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ helpResolveUpdateProcedure(proc.toString(), userUpdateStr, Table.TriggerEvent.UPDATE);
}
@Test public void testInsertAfterCreate() throws Exception {
@@ -1471,7 +1437,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
- helpResolveUpdateProcedure(proc.toString(), userUpdateStr, FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ helpResolveUpdateProcedure(proc.toString(), userUpdateStr, Table.TriggerEvent.UPDATE);
}
/**
@@ -1487,11 +1453,11 @@
String userUpdateStr = "delete from vm1.g1 where e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.DELETE_PROCEDURE, "Symbol INPUTS.e1 is specified with an unknown group context"); //$NON-NLS-1$
+ Table.TriggerEvent.DELETE, "Symbol INPUTS.e1 is specified with an unknown group context"); //$NON-NLS-1$
}
@Test public void testInvalidVirtualProcedure3() throws Exception {
- helpResolveException("EXEC pm1.vsp18()", FakeMetadataFactory.example1Cached(), "Group does not exist: temptable"); //$NON-NLS-1$ //$NON-NLS-2$
+ helpResolveException("EXEC pm1.vsp18()", RealMetadataFactory.example1Cached(), "Group does not exist: temptable"); //$NON-NLS-1$ //$NON-NLS-2$
}
// variable resolution, variable compared against
@@ -1506,7 +1472,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1=1"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE, "Error Code:ERR.015.008.0041 Message:Cannot set symbol 'pm1.g1.e4' with expected type double to expression 'convert(var1, string)'"); //$NON-NLS-1$
+ Table.TriggerEvent.UPDATE, "Error Code:ERR.015.008.0041 Message:Cannot set symbol 'pm1.g1.e4' with expected type double to expression 'convert(var1, string)'"); //$NON-NLS-1$
}
// special variable INPUT compared against invalid type
@@ -1521,48 +1487,48 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailUpdateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE, "Error Code:ERR.015.008.0041 Message:Cannot set symbol 'pm1.g1.e2' with expected type integer to expression 'INPUTS.e1'"); //$NON-NLS-1$
+ Table.TriggerEvent.UPDATE, "Error Code:ERR.015.008.0041 Message:Cannot set symbol 'pm1.g1.e2' with expected type integer to expression 'INPUTS.e1'"); //$NON-NLS-1$
}
@Test public void testVirtualProcedure() throws Exception {
- helpResolve("EXEC pm1.vsp1()", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpResolve("EXEC pm1.vsp1()", RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testVirtualProcedure2() throws Exception {
- helpResolve("EXEC pm1.vsp14()", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpResolve("EXEC pm1.vsp14()", RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testVirtualProcedurePartialParameterReference() throws Exception {
- helpResolve("EXEC pm1.vsp58(5)", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpResolve("EXEC pm1.vsp58(5)", RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
//cursor starts with "#" Defect14924
@Test public void testVirtualProcedureInvalid1() throws Exception {
- helpResolveException("EXEC pm1.vsp32()",FakeMetadataFactory.example1Cached(), "Cursor names cannot begin with \"#\" as that indicates the name of a temporary table: #mycursor."); //$NON-NLS-1$ //$NON-NLS-2$
+ helpResolveException("EXEC pm1.vsp32()",RealMetadataFactory.example1Cached(), "Cursor names cannot begin with \"#\" as that indicates the name of a temporary table: #mycursor."); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testVirtualProcedureWithOrderBy() throws Exception {
- helpResolve("EXEC pm1.vsp29()", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpResolve("EXEC pm1.vsp29()", RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testVirtualProcedureWithTempTableAndOrderBy() throws Exception {
- helpResolve("EXEC pm1.vsp33()", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpResolve("EXEC pm1.vsp33()", RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testVirtualProcedureWithConstAndOrderBy() throws Exception {
- helpResolve("EXEC pm1.vsp34()", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpResolve("EXEC pm1.vsp34()", RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testVirtualProcedureWithNoFromAndOrderBy() throws Exception {
- helpResolve("EXEC pm1.vsp28()", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpResolve("EXEC pm1.vsp28()", RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testInvalidVirtualProcedure2() throws Exception {
- helpResolveException("EXEC pm1.vsp12()", FakeMetadataFactory.example1Cached(), "Symbol mycursor.e2 is specified with an unknown group context"); //$NON-NLS-1$ //$NON-NLS-2$
+ helpResolveException("EXEC pm1.vsp12()", RealMetadataFactory.example1Cached(), "Symbol mycursor.e2 is specified with an unknown group context"); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testLoopRedefinition2() throws Exception {
- helpResolveException("EXEC pm1.vsp11()", FakeMetadataFactory.example1Cached(), "Nested Loop can not use the same cursor name as that of its parent."); //$NON-NLS-1$ //$NON-NLS-2$
+ helpResolveException("EXEC pm1.vsp11()", RealMetadataFactory.example1Cached(), "Nested Loop can not use the same cursor name as that of its parent."); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testVariableResolutionWithIntervening() throws Exception {
@@ -1574,11 +1540,11 @@
.append("\n y = '1';") //$NON-NLS-1$
.append("\nEND"); //$NON-NLS-1$
- TestResolver.helpResolve(proc.toString(), FakeMetadataFactory.example1Cached());
+ TestResolver.helpResolve(proc.toString(), RealMetadataFactory.example1Cached());
}
@Test public void testVDBQualified() throws Exception {
- helpResolve("EXEC myvdb.pm1.vsp29()", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpResolve("EXEC example1.pm1.vsp29()", RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/resolver/TestResolver.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/resolver/TestResolver.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/resolver/TestResolver.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -47,6 +47,13 @@
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidException;
import org.teiid.core.types.DataTypeManager;
+import org.teiid.metadata.ColumnSet;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Procedure;
+import org.teiid.metadata.ProcedureParameter;
+import org.teiid.metadata.Schema;
+import org.teiid.metadata.Table;
+import org.teiid.metadata.Table.TriggerEvent;
import org.teiid.query.analysis.AnalysisRecord;
import org.teiid.query.function.FunctionDescriptor;
import org.teiid.query.function.FunctionLibrary;
@@ -55,6 +62,7 @@
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.metadata.TempMetadataID;
import org.teiid.query.metadata.TempMetadataStore;
+import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.optimizer.FakeFunctionMetadataSource;
import org.teiid.query.parser.QueryParser;
import org.teiid.query.sql.LanguageObject;
@@ -91,20 +99,16 @@
import org.teiid.query.sql.visitor.ElementCollectorVisitor;
import org.teiid.query.sql.visitor.FunctionCollectorVisitor;
import org.teiid.query.sql.visitor.GroupCollectorVisitor;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
-import org.teiid.query.unittest.FakeMetadataStore;
import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.unittest.TimestampUtil;
@SuppressWarnings("nls")
public class TestResolver {
- private FakeMetadataFacade metadata;
+ private QueryMetadataInterface metadata;
@Before public void setUp() {
- metadata = FakeMetadataFactory.example1Cached();
+ metadata = RealMetadataFactory.example1Cached();
}
// ################################## TEST HELPERS ################################
@@ -131,9 +135,9 @@
assertTrue("Expected variables size " + variableNames.length + " but was " + variables.size(), //$NON-NLS-1$ //$NON-NLS-2$
variables.size() == variableNames.length);
- Iterator variablesIter = variables.iterator();
+ Iterator<ElementSymbol> variablesIter = variables.iterator();
for (int i=0; variablesIter.hasNext(); i++) {
- ElementSymbol variable = (ElementSymbol)variablesIter.next();
+ ElementSymbol variable = variablesIter.next();
assertTrue("Expected variable name " + variableNames[i] + " but was " + variable.getName(), //$NON-NLS-1$ //$NON-NLS-2$
variable.getName().equalsIgnoreCase(variableNames[i]));
}
@@ -277,18 +281,13 @@
private void helpCheckFrom(Query query, String[] groupIDs) {
From from = query.getFrom();
- List groups = from.getGroups();
+ List<GroupSymbol> groups = from.getGroups();
assertEquals("Wrong number of group IDs: ", groupIDs.length, groups.size()); //$NON-NLS-1$
for(int i=0; i<groups.size(); i++) {
- GroupSymbol group = (GroupSymbol) groups.get(i);
- String matchString = null;
- if(group.getMetadataID() instanceof FakeMetadataObject) {
- matchString = ((FakeMetadataObject)group.getMetadataID()).getName();
- } else if(group.getMetadataID() instanceof TempMetadataID) {
- matchString = ((TempMetadataID)group.getMetadataID()).getID();
- }
- assertEquals("Group ID does not match: ", groupIDs[i].toUpperCase(), matchString.toUpperCase()); //$NON-NLS-1$
+ GroupSymbol group = groups.get(i);
+ assertNotNull(group.getMetadataID());
+ assertEquals("Group ID does not match: ", groupIDs[i].toUpperCase(), group.getNonCorrelationName().toUpperCase()); //$NON-NLS-1$
}
}
@@ -304,17 +303,22 @@
}
private void helpCheckElements(LanguageObject langObj, String[] elementNames, String[] elementIDs) {
- List elements = new ArrayList();
+ List<ElementSymbol> elements = new ArrayList<ElementSymbol>();
ElementCollectorVisitor.getElements(langObj, elements);
assertEquals("Wrong number of elements: ", elementNames.length, elements.size()); //$NON-NLS-1$
for(int i=0; i<elements.size(); i++) {
- ElementSymbol symbol = (ElementSymbol) elements.get(i);
+ ElementSymbol symbol = elements.get(i);
assertEquals("Element name does not match: ", elementNames[i].toUpperCase(), symbol.getName().toUpperCase()); //$NON-NLS-1$
- FakeMetadataObject elementID = (FakeMetadataObject) symbol.getMetadataID();
- assertNotNull("ElementSymbol " + symbol + " was not resolved and has no metadataID", elementID); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("ElementID name does not match: ", elementIDs[i].toUpperCase(), elementID.getName().toUpperCase()); //$NON-NLS-1$
+ Object elementID = symbol.getMetadataID();
+ try {
+ String name = metadata.getFullName(elementID);
+ assertNotNull("ElementSymbol " + symbol + " was not resolved and has no metadataID", elementID); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("ElementID name does not match: ", elementIDs[i].toUpperCase(), name.toUpperCase()); //$NON-NLS-1$
+ } catch (TeiidComponentException e) {
+ throw new RuntimeException(e);
+ }
}
}
@@ -390,84 +394,84 @@
}
@Test public void testGroupWithVDB() {
- String sql = "SELECT e1 FROM myvdb.pm1.g1"; //$NON-NLS-1$
+ String sql = "SELECT e1 FROM example1.pm1.g1"; //$NON-NLS-1$
Query resolvedQuery = (Query) helpResolve(sql);
helpCheckFrom(resolvedQuery, new String[] { "pm1.g1" }); //$NON-NLS-1$
assertEquals("Resolved string form was incorrect ", sql, resolvedQuery.toString()); //$NON-NLS-1$
}
@Test public void testAliasedGroupWithVDB() {
- String sql = "SELECT e1 FROM myvdb.pm1.g1 AS x"; //$NON-NLS-1$
+ String sql = "SELECT e1 FROM example1.pm1.g1 AS x"; //$NON-NLS-1$
Query resolvedQuery = (Query) helpResolve(sql);
helpCheckFrom(resolvedQuery, new String[] { "pm1.g1" }); //$NON-NLS-1$
assertEquals("Resolved string form was incorrect ", sql, resolvedQuery.toString()); //$NON-NLS-1$
}
@Test public void testPartiallyQualifiedGroup1() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
String sql = "SELECT e1 FROM cat2.cat3.g1"; //$NON-NLS-1$
Query resolvedQuery = (Query) helpResolve(sql);
helpCheckFrom(resolvedQuery, new String[] { "pm1.cat1.cat2.cat3.g1" }); //$NON-NLS-1$
}
@Test public void testPartiallyQualifiedGroup2() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
String sql = "SELECT e1 FROM cat1.g2"; //$NON-NLS-1$
Query resolvedQuery = (Query) helpResolve(sql);
helpCheckFrom(resolvedQuery, new String[] { "pm1.cat1.g2" }); //$NON-NLS-1$
}
@Test public void testPartiallyQualifiedGroup3() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
String sql = "SELECT e1 FROM cat1.cat2.cat3.g1"; //$NON-NLS-1$
Query resolvedQuery = (Query) helpResolve(sql);
helpCheckFrom(resolvedQuery, new String[] { "pm1.cat1.cat2.cat3.g1" }); //$NON-NLS-1$
}
@Test public void testPartiallyQualifiedGroup4() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
String sql = "SELECT e1 FROM cat2.g2"; //$NON-NLS-1$
Query resolvedQuery = (Query) helpResolve(sql);
helpCheckFrom(resolvedQuery, new String[] { "pm2.cat2.g2" }); //$NON-NLS-1$
}
@Test public void testPartiallyQualifiedGroup5() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
String sql = "SELECT e1 FROM cat2.g3"; //$NON-NLS-1$
Query resolvedQuery = (Query) helpResolve(sql);
helpCheckFrom(resolvedQuery, new String[] { "pm1.cat2.g3" }); //$NON-NLS-1$
}
@Test public void testPartiallyQualifiedGroup6() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
String sql = "SELECT e1 FROM cat1.g1"; //$NON-NLS-1$
Query resolvedQuery = (Query) helpResolve(sql);
helpCheckFrom(resolvedQuery, new String[] { "pm2.cat1.g1" }); //$NON-NLS-1$
}
@Test public void testPartiallyQualifiedGroup7() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
String sql = "SELECT e1 FROM g4"; //$NON-NLS-1$
Query resolvedQuery = (Query) helpResolve(sql);
- helpCheckFrom(resolvedQuery, new String[] { "pm2.g4" }); //$NON-NLS-1$
+ helpCheckFrom(resolvedQuery, new String[] { "pm3.g4" }); //$NON-NLS-1$
}
@Test public void testPartiallyQualifiedGroup8() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
String sql = "SELECT e1 FROM pm2.g3"; //$NON-NLS-1$
Query resolvedQuery = (Query) helpResolve(sql);
helpCheckFrom(resolvedQuery, new String[] { "pm2.g3" }); //$NON-NLS-1$
}
@Test public void testPartiallyQualifiedGroupWithAlias() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
String sql = "SELECT X.e1 FROM cat2.cat3.g1 as X"; //$NON-NLS-1$
Query resolvedQuery = (Query) helpResolve(sql);
helpCheckFrom(resolvedQuery, new String[] { "pm1.cat1.cat2.cat3.g1" }); //$NON-NLS-1$
}
@Test public void testPartiallyQualifiedElement1() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
String sql = "SELECT cat2.cat3.g1.e1 FROM cat2.cat3.g1"; //$NON-NLS-1$
Query resolvedQuery = (Query) helpResolve(sql);
helpCheckSelect(resolvedQuery, new String[] { "pm1.cat1.cat2.cat3.g1.e1" }); //$NON-NLS-1$
@@ -475,7 +479,7 @@
/** defect 12536 */
@Test public void testPartiallyQualifiedElement2() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
String sql = "SELECT cat3.g1.e1 FROM cat2.cat3.g1"; //$NON-NLS-1$
Query resolvedQuery = (Query) helpResolve(sql);
helpCheckSelect(resolvedQuery, new String[] { "pm1.cat1.cat2.cat3.g1.e1" }); //$NON-NLS-1$
@@ -483,7 +487,7 @@
/** defect 12536 */
@Test public void testPartiallyQualifiedElement3() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
String sql = "SELECT cat3.g1.e1 FROM cat2.cat3.g1, cat1.g2"; //$NON-NLS-1$
Query resolvedQuery = (Query) helpResolve(sql);
helpCheckSelect(resolvedQuery, new String[] { "pm1.cat1.cat2.cat3.g1.e1" }); //$NON-NLS-1$
@@ -491,86 +495,86 @@
/** defect 12536 */
@Test public void testPartiallyQualifiedElement4() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
String sql = "SELECT cat3.g1.e1, cat1.g2.e1 FROM cat2.cat3.g1, cat1.g2"; //$NON-NLS-1$
Query resolvedQuery = (Query) helpResolve(sql);
helpCheckSelect(resolvedQuery, new String[] { "pm1.cat1.cat2.cat3.g1.e1", "pm1.cat1.g2.e1" }); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testPartiallyQualifiedElement5() {
- metadata = FakeMetadataFactory.example3();
- String sql = "SELECT cat3.g1.e1, cat1.g2.e1 FROM myvdb.pm1.cat1.cat2.cat3.g1, pm1.cat1.g2"; //$NON-NLS-1$
+ metadata = RealMetadataFactory.example3();
+ String sql = "SELECT cat3.g1.e1, cat1.g2.e1 FROM example3.pm1.cat1.cat2.cat3.g1, pm1.cat1.g2"; //$NON-NLS-1$
Query resolvedQuery = (Query) helpResolve(sql);
helpCheckSelect(resolvedQuery, new String[] { "pm1.cat1.cat2.cat3.g1.e1", "pm1.cat1.g2.e1" }); //$NON-NLS-1$ //$NON-NLS-2$
}
/** defect 12536 */
@Test public void testPartiallyQualifiedElement6() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
String sql = "SELECT cat3.g1.e1, e2 FROM cat2.cat3.g1"; //$NON-NLS-1$
Query resolvedQuery = (Query) helpResolve(sql);
helpCheckSelect(resolvedQuery, new String[] { "pm1.cat1.cat2.cat3.g1.e1", "pm1.cat1.cat2.cat3.g1.e2" }); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testPartiallyQualifiedElement7() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
String sql = "SELECT cat3.g1.e1, cat2.cat3.g1.e2, g1.e3 FROM pm1.cat1.cat2.cat3.g1"; //$NON-NLS-1$
Query resolvedQuery = (Query) helpResolve(sql);
helpCheckSelect(resolvedQuery, new String[] { "pm1.cat1.cat2.cat3.g1.e1", "pm1.cat1.cat2.cat3.g1.e2", "pm1.cat1.cat2.cat3.g1.e3" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
@Test public void testFailPartiallyQualifiedGroup1() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
helpResolveException("SELECT e1 FROM cat3.g1"); //$NON-NLS-1$
}
@Test public void testFailPartiallyQualifiedGroup2() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
helpResolveException("SELECT e1 FROM g1"); //$NON-NLS-1$
}
@Test public void testFailPartiallyQualifiedGroup3() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
helpResolveException("SELECT e1 FROM g2"); //$NON-NLS-1$
}
@Test public void testFailPartiallyQualifiedGroup4() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
helpResolveException("SELECT e1 FROM g3"); //$NON-NLS-1$
}
@Test public void testFailPartiallyQualifiedGroup5() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
helpResolveException("SELECT e1 FROM g5"); //$NON-NLS-1$
}
@Test public void testFailPartiallyQualifiedElement1() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
helpResolveException("SELECT cat3.g1.e1 FROM pm1.cat1.cat2.cat3.g1, pm2.cat3.g1"); //$NON-NLS-1$
}
@Test public void testFailPartiallyQualifiedElement2() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
helpResolveException("SELECT g1.e1 FROM pm1.cat1.cat2.cat3.g1, pm2.cat3.g1"); //$NON-NLS-1$
}
@Test public void testFailPartiallyQualifiedElement3() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
helpResolveException("SELECT cat3.g1.e1 FROM pm2.cat2.g2, pm1.cat2.g3"); //$NON-NLS-1$
}
@Test public void testFailPartiallyQualifiedElement4() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
helpResolveException("SELECT cat3.g1.e1 FROM pm2.cat2.g2"); //$NON-NLS-1$
}
@Test public void testFailPartiallyQualifiedElement5() {
- metadata = FakeMetadataFactory.example3();
+ metadata = RealMetadataFactory.example3();
helpResolveException("SELECT cat3.g1.e1 FROM g1"); //$NON-NLS-1$
}
@Test public void testElementWithVDB() {
- String sql = "SELECT myvdb.pm1.g1.e1 FROM pm1.g1"; //$NON-NLS-1$
+ String sql = "SELECT example1.pm1.g1.e1 FROM pm1.g1"; //$NON-NLS-1$
Query resolvedQuery = (Query) helpResolve(sql);
helpCheckSelect(resolvedQuery, new String[] { "pm1.g1.e1" }); //$NON-NLS-1$
helpCheckElements(resolvedQuery.getSelect(),
@@ -580,7 +584,7 @@
}
@Test public void testAliasedElementWithVDB() {
- Query resolvedQuery = (Query) helpResolve("SELECT myvdb.pm1.g1.e1 AS x FROM pm1.g1"); //$NON-NLS-1$
+ Query resolvedQuery = (Query) helpResolve("SELECT example1.pm1.g1.e1 AS x FROM pm1.g1"); //$NON-NLS-1$
helpCheckSelect(resolvedQuery, new String[] { "x" }); //$NON-NLS-1$
helpCheckElements(resolvedQuery.getSelect(),
new String[] { "pm1.g1.e1" }, //$NON-NLS-1$
@@ -887,15 +891,15 @@
StoredProcedure proc = (StoredProcedure) helpResolve("EXEC pm1.sq2('abc')"); //$NON-NLS-1$
// Check number of resolved parameters
- List params = proc.getParameters();
+ List<SPParameter> params = proc.getParameters();
assertEquals("Did not get expected parameter count", 2, params.size()); //$NON-NLS-1$
// Check resolved parameters
- SPParameter param1 = (SPParameter) params.get(0);
- helpCheckParameter(param1, ParameterInfo.RESULT_SET, 1, "pm1.sq2.ret", java.sql.ResultSet.class, null); //$NON-NLS-1$
+ SPParameter param1 = params.get(1);
+ helpCheckParameter(param1, ParameterInfo.RESULT_SET, 2, "pm1.sq2.ret", java.sql.ResultSet.class, null); //$NON-NLS-1$
- SPParameter param2 = (SPParameter) params.get(1);
- helpCheckParameter(param2, ParameterInfo.IN, 2, "pm1.sq2.in", DataTypeManager.DefaultDataClasses.STRING, new Constant("abc")); //$NON-NLS-1$ //$NON-NLS-2$
+ SPParameter param2 = params.get(0);
+ helpCheckParameter(param2, ParameterInfo.IN, 1, "pm1.sq2.in", DataTypeManager.DefaultDataClasses.STRING, new Constant("abc")); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -911,18 +915,18 @@
StoredProcedure proc = (StoredProcedure) helpResolve("EXEC pm1.sq3a('abc', 123)"); //$NON-NLS-1$
// Check number of resolved parameters
- List params = proc.getParameters();
- assertEquals("Did not get expected parameter count", 2, params.size()); //$NON-NLS-1$
+ List<SPParameter> params = proc.getParameters();
+ assertEquals("Did not get expected parameter count", 3, params.size()); //$NON-NLS-1$
// Check resolved parameters
- SPParameter param1 = (SPParameter) params.get(0);
+ SPParameter param1 = params.get(0);
helpCheckParameter(param1, ParameterInfo.IN, 1, "pm1.sq3a.in", DataTypeManager.DefaultDataClasses.STRING, new Constant("abc")); //$NON-NLS-1$ //$NON-NLS-2$
- SPParameter param2 = (SPParameter) params.get(1);
- helpCheckParameter(param2, ParameterInfo.IN, 3, "pm1.sq3a.in2", DataTypeManager.DefaultDataClasses.INTEGER, new Constant(new Integer(123))); //$NON-NLS-1$
+ SPParameter param2 = params.get(1);
+ helpCheckParameter(param2, ParameterInfo.IN, 2, "pm1.sq3a.in2", DataTypeManager.DefaultDataClasses.INTEGER, new Constant(new Integer(123))); //$NON-NLS-1$
}
- private void helpCheckParameter(SPParameter param, int paramType, int index, String name, Class type, Expression expr) {
+ private void helpCheckParameter(SPParameter param, int paramType, int index, String name, Class<?> type, Expression expr) {
assertEquals("Did not get expected parameter type", paramType, param.getParameterType()); //$NON-NLS-1$
assertEquals("Did not get expected index for param", index, param.getIndex()); //$NON-NLS-1$
assertEquals("Did not get expected name for param", name, param.getName()); //$NON-NLS-1$
@@ -1116,7 +1120,7 @@
"WHERE (y.IntKey >= 10) AND (y.IntKey < 30) " + //$NON-NLS-1$
"ORDER BY IntKey, FloatNum"; //$NON-NLS-1$
- helpResolve(sql, FakeMetadataFactory.exampleBQTCached());
+ helpResolve(sql, RealMetadataFactory.exampleBQTCached());
}
@Test public void testSubQueryINClause1(){
@@ -1334,7 +1338,7 @@
String tgtTypeName = DataTypeManager.DefaultDataTypes.DATE;
Expression expression = new Constant("2003-02-27"); //$NON-NLS-1$
- FunctionLibrary library = FakeMetadataFactory.SFM.getSystemFunctionLibrary();
+ FunctionLibrary library = RealMetadataFactory.SFM.getSystemFunctionLibrary();
FunctionDescriptor fd = library.findFunction(FunctionLibrary.CONVERT, new Class[] { srcType, DataTypeManager.DefaultDataClasses.STRING });
Function conversion = new Function(fd.getName(), new Expression[] { expression, new Constant(tgtTypeName) });
@@ -1370,7 +1374,7 @@
String tgtTypeName = DataTypeManager.DefaultDataTypes.DATE;
Expression expression = new Constant("2003-02-27"); //$NON-NLS-1$
- FunctionLibrary library = FakeMetadataFactory.SFM.getSystemFunctionLibrary();
+ FunctionLibrary library = RealMetadataFactory.SFM.getSystemFunctionLibrary();
FunctionDescriptor fd = library.findFunction(FunctionLibrary.CONVERT, new Class[] { srcType, DataTypeManager.DefaultDataClasses.STRING });
Function conversion = new Function(fd.getName(), new Expression[] { expression, new Constant(tgtTypeName) });
@@ -1488,13 +1492,13 @@
@Test public void testLookupFunctionVirtualGroup() throws Exception {
String sql = "SELECT lookup('vm1.g1', 'e1', 'e2', e2) FROM vm1.g1 "; //$NON-NLS-1$
Query command = (Query) helpParse(sql);
- QueryResolver.resolveCommand(command, FakeMetadataFactory.example1Cached());
+ QueryResolver.resolveCommand(command, RealMetadataFactory.example1Cached());
}
@Test public void testLookupFunctionPhysicalGroup() throws Exception {
String sql = "SELECT lookup('pm1.g1', 'e1', 'e2', e2) FROM pm1.g1 "; //$NON-NLS-1$
Query command = (Query) helpParse(sql);
- QueryResolver.resolveCommand(command, FakeMetadataFactory.example1Cached());
+ QueryResolver.resolveCommand(command, RealMetadataFactory.example1Cached());
}
@Test public void testLookupFunctionFailBadKeyElement() throws Exception {
@@ -1511,15 +1515,13 @@
@Test public void testNamespacedFunction() throws Exception {
String sql = "SELECT namespace.func('e1') FROM vm1.g1 "; //$NON-NLS-1$
- FunctionLibrary funcLibrary = new FunctionLibrary(FakeMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new FakeFunctionMetadataSource()));
- FakeMetadataFacade metadata = new FakeMetadataFacade(FakeMetadataFactory.example1Cached().getStore(), funcLibrary);
+ QueryMetadataInterface metadata = RealMetadataFactory.createTransformationMetadata(RealMetadataFactory.example1Cached().getMetadataStore(), "example1", new FunctionTree("foo", new FakeFunctionMetadataSource()));
Query command = (Query) helpParse(sql);
QueryResolver.resolveCommand(command, metadata);
command = (Query) helpParse("SELECT func('e1') FROM vm1.g1 ");
QueryResolver.resolveCommand(command, metadata);
-
}
// special test for both sides are String
@@ -1537,8 +1539,8 @@
// resolve
try {
- QueryResolver.resolveCriteria(expected, FakeMetadataFactory.exampleBQTCached());
- QueryResolver.resolveCriteria(actual, FakeMetadataFactory.exampleBQTCached());
+ QueryResolver.resolveCriteria(expected, RealMetadataFactory.exampleBQTCached());
+ QueryResolver.resolveCriteria(actual, RealMetadataFactory.exampleBQTCached());
} catch(TeiidException e) {
fail("Exception during resolution (" + e.getClass().getName() + "): " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -1834,7 +1836,7 @@
//String sql = "select intkey from SmallA where user() = 'bqt2'";
// Expected left expression
- FunctionLibrary library = FakeMetadataFactory.SFM.getSystemFunctionLibrary();
+ FunctionLibrary library = RealMetadataFactory.SFM.getSystemFunctionLibrary();
FunctionDescriptor fd = library.findFunction(FunctionLibrary.USER, new Class[] { });
Function user = new Function(fd.getName(), new Expression[] {});
user.setFunctionDescriptor(fd);
@@ -1890,7 +1892,7 @@
@Test public void testDefect10809(){
String sql = "select * from LOB_TESTING_ONE where CLOB_COLUMN LIKE '%fff%'"; //$NON-NLS-1$
- helpResolve(helpParse(sql), FakeMetadataFactory.exampleBQTCached());
+ helpResolve(helpParse(sql), RealMetadataFactory.exampleBQTCached());
}
@Test public void testNonAutoConversionOfLiteralIntegerToShort() throws Exception {
@@ -1898,7 +1900,7 @@
Query command = (Query) QueryParser.getQueryParser().parseCommand("SELECT intkey FROM bqt1.smalla WHERE shortvalue = 5"); //$NON-NLS-1$
// resolve
- QueryResolver.resolveCommand(command, FakeMetadataFactory.exampleBQTCached());
+ QueryResolver.resolveCommand(command, RealMetadataFactory.exampleBQTCached());
// Check whether an implicit conversion was added on the correct side
CompareCriteria crit = (CompareCriteria) command.getCriteria();
@@ -1912,7 +1914,7 @@
Query command = (Query) QueryParser.getQueryParser().parseCommand("SELECT intkey FROM bqt1.smalla WHERE 5 = shortvalue"); //$NON-NLS-1$
// resolve
- QueryResolver.resolveCommand(command, FakeMetadataFactory.exampleBQTCached());
+ QueryResolver.resolveCommand(command, RealMetadataFactory.exampleBQTCached());
// Check whether an implicit conversion was added on the correct side
CompareCriteria crit = (CompareCriteria) command.getCriteria();
@@ -1974,30 +1976,23 @@
assertTrue(((Expression)command.getValues().get(0)).getType() == DataTypeManager.DefaultDataClasses.SHORT);
}
- public static FakeMetadataFacade example_12968() {
+ public static TransformationMetadata example_12968() {
+ MetadataStore metadataStore = new MetadataStore();
// Create models
- FakeMetadataObject pm1 = FakeMetadataFactory.createPhysicalModel("myModel"); //$NON-NLS-1$
- FakeMetadataObject pm2 = FakeMetadataFactory.createPhysicalModel("myModel2"); //$NON-NLS-1$
+ Schema pm1 = RealMetadataFactory.createPhysicalModel("myModel", metadataStore); //$NON-NLS-1$
+ Schema pm2 = RealMetadataFactory.createPhysicalModel("myModel2", metadataStore); //$NON-NLS-1$
- FakeMetadataObject pm1g1 = FakeMetadataFactory.createPhysicalGroup("myModel.myTable", pm1); //$NON-NLS-1$
- FakeMetadataObject pm2g1 = FakeMetadataFactory.createPhysicalGroup("myModel2.mySchema.myTable2", pm2); //$NON-NLS-1$
+ Table pm1g1 = RealMetadataFactory.createPhysicalGroup("myTable", pm1); //$NON-NLS-1$
+ Table pm2g1 = RealMetadataFactory.createPhysicalGroup("mySchema.myTable2", pm2); //$NON-NLS-1$
- List pm1g1e = FakeMetadataFactory.createElements(pm1g1,
+ RealMetadataFactory.createElements(pm1g1,
new String[] { "myColumn", "myColumn2" }, //$NON-NLS-1$ //$NON-NLS-2$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
- List pm2g1e = FakeMetadataFactory.createElements(pm2g1,
+ RealMetadataFactory.createElements(pm2g1,
new String[] { "myColumn", "myColumn2" }, //$NON-NLS-1$ //$NON-NLS-2$
new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
- // Add all objects to the store
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(pm1);
- store.addObject(pm1g1);
- store.addObjects(pm1g1e);
- store.addObject(pm2g1);
- store.addObjects(pm2g1e);
-
- return new FakeMetadataFacade(store);
+ return RealMetadataFactory.createTransformationMetadata(metadataStore, "12968");
}
@Test public void testDefect12968_union() {
@@ -2109,7 +2104,7 @@
@Test public void testProcParamComparison_defect13653() {
String userSql = "SELECT * FROM (EXEC mmspTest1.MMSP5('a')) AS a, (EXEC mmsptest1.mmsp6('b')) AS b"; //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
AnalysisRecord analysis = AnalysisRecord.createNonRecordingRecord();
Query query = (Query) helpResolve(userSql, metadata);
@@ -2140,7 +2135,7 @@
String userSql = "SELECT null as x"; //$NON-NLS-1$
Query query = (Query)helpParse(userSql);
- QueryResolver.resolveCommand(query, FakeMetadataFactory.exampleBQTCached());
+ QueryResolver.resolveCommand(query, RealMetadataFactory.exampleBQTCached());
// Check type of resolved null constant
SingleElementSymbol symbol = (SingleElementSymbol) query.getSelect().getSymbols().get(0);
@@ -2195,7 +2190,7 @@
@Test public void testUnionInSubquery() throws Exception {
String sql = "SELECT StringKey FROM (SELECT BQT2.SmallB.StringKey FROM BQT2.SmallB union SELECT convert(BQT2.SmallB.FloatNum, string) FROM BQT2.SmallB) x"; //$NON-NLS-1$
Command command = QueryParser.getQueryParser().parseCommand(sql);
- QueryResolver.resolveCommand(command, FakeMetadataFactory.exampleBQTCached());
+ QueryResolver.resolveCommand(command, RealMetadataFactory.exampleBQTCached());
}
@Test public void testParameterError() throws Exception {
@@ -2388,7 +2383,7 @@
+ " SELECT ID, Name, #temp.BITS AS source_bits FROM #temp;" //$NON-NLS-1$
+ "END"; //$NON-NLS-1$
- helpResolveException(proc, FakeMetadataFactory.exampleBitwise(), "Group does not exist: #temp"); //$NON-NLS-1$
+ helpResolveException(proc, RealMetadataFactory.exampleBitwise(), "Group does not exist: #temp"); //$NON-NLS-1$
}
@Test public void testDrop() {
@@ -2530,21 +2525,17 @@
}
@Test public void testExecWithDuplicateNames() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
-
- FakeMetadataStore store = metadata.getStore();
-
- FakeMetadataObject pm1 = store.findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "in", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq2.in; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
+ MetadataStore metadataStore = new MetadataStore();
- store.addObject(rs2);
- store.addObject(sq2);
+ Schema pm1 = RealMetadataFactory.createPhysicalModel("pm1", metadataStore);
+ ColumnSet<Procedure> rs2 = RealMetadataFactory.createResultSet("rs2", new String[] { "in", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ProcedureParameter rs2p2 = RealMetadataFactory.createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ Procedure sq2 = RealMetadataFactory.createStoredProcedure("sq2", pm1, Arrays.asList(rs2p2)); //$NON-NLS-1$
+ sq2.setResultSet(rs2);
+
+ QueryMetadataInterface metadata = RealMetadataFactory.createTransformationMetadata(metadataStore, "example1");
+
helpResolveException("select * from pm1.sq2", metadata, "Cannot access procedure pm1.sq2 using table semantics since the parameter and result set column names are not all unique."); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -2670,11 +2661,11 @@
@Test public void testCase6319() throws QueryResolverException, TeiidComponentException {
String sql = "select floatnum from bqt1.smalla group by floatnum having sum(floatnum) between 51.0 and 100.0 "; //$NON-NLS-1$
Query query = (Query)helpParse(sql);
- QueryResolver.resolveCommand(query, FakeMetadataFactory.exampleBQTCached());
+ QueryResolver.resolveCommand(query, RealMetadataFactory.exampleBQTCached());
}
@Test public void testUniqeNamesWithInlineView() {
- helpResolveException("select * from (select count(intNum) a, count(stringKey) b, bqt1.smalla.intkey as b from bqt1.smalla group by bqt1.smalla.intkey) q1 order by q1.a", FakeMetadataFactory.exampleBQTCached(), "Cannot create group 'q1' with multiple columns named 'b'"); //$NON-NLS-1$ //$NON-NLS-2$
+ helpResolveException("select * from (select count(intNum) a, count(stringKey) b, bqt1.smalla.intkey as b from bqt1.smalla group by bqt1.smalla.intkey) q1 order by q1.a", RealMetadataFactory.exampleBQTCached(), "Cannot create group 'q1' with multiple columns named 'b'"); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testResolveOldProcRelational() {
@@ -2702,13 +2693,13 @@
@Test public void testCallableStatementTooManyParameters() throws Exception {
String sql = "{call pm4.spTest9(?, ?)}"; //$NON-NLS-1$
- TestResolver.helpResolveException(sql, FakeMetadataFactory.exampleBQTCached(), "Error Code:ERR.015.008.0007 Message:Incorrect number of parameters specified on the stored procedure pm4.spTest9 - expected 1 but got 2"); //$NON-NLS-1$
+ TestResolver.helpResolveException(sql, RealMetadataFactory.exampleBQTCached(), "Error Code:ERR.015.008.0007 Message:Incorrect number of parameters specified on the stored procedure pm4.spTest9 - expected 1 but got 2"); //$NON-NLS-1$
}
@Test public void testUpdateSetClauseReferenceType() {
String sql = "UPDATE pm1.g1 SET pm1.g1.e1 = 1, pm1.g1.e2 = ?;"; //$NON-NLS-1$
- Update update = (Update)helpResolve(sql, FakeMetadataFactory.example1Cached());
+ Update update = (Update)helpResolve(sql, RealMetadataFactory.example1Cached());
Expression ref = update.getChangeList().getClauses().get(1).getValue();
assertTrue(ref instanceof Reference);
@@ -2718,26 +2709,26 @@
@Test public void testNoTypeCriteria() {
String sql = "select * from pm1.g1 where ? = ?"; //$NON-NLS-1$
- helpResolveException(sql, FakeMetadataFactory.example1Cached(), "Error Code:ERR.015.008.0026 Message:Expression '? = ?' has a parameter with non-determinable type information. The use of an explicit convert may be necessary."); //$NON-NLS-1$
+ helpResolveException(sql, RealMetadataFactory.example1Cached(), "Error Code:ERR.015.008.0026 Message:Expression '? = ?' has a parameter with non-determinable type information. The use of an explicit convert may be necessary."); //$NON-NLS-1$
}
@Test public void testReferenceInSelect() {
String sql = "select ?, e1 from pm1.g1"; //$NON-NLS-1$
- Query command = (Query)helpResolve(sql, FakeMetadataFactory.example1Cached());
+ Query command = (Query)helpResolve(sql, RealMetadataFactory.example1Cached());
assertEquals(DataTypeManager.DefaultDataClasses.STRING, command.getProjectedSymbols().get(0).getType());
}
@Test public void testReferenceInSelect1() {
String sql = "select convert(?, integer), e1 from pm1.g1"; //$NON-NLS-1$
- Query command = (Query)helpResolve(sql, FakeMetadataFactory.example1Cached());
+ Query command = (Query)helpResolve(sql, RealMetadataFactory.example1Cached());
assertEquals(DataTypeManager.DefaultDataClasses.INTEGER, command.getProjectedSymbols().get(0).getType());
}
@Test public void testUnionWithObjectTypeConversion() {
String sql = "select convert(null, xml) from pm1.g1 union all select 1"; //$NON-NLS-1$
- SetQuery query = (SetQuery)helpResolve(sql, FakeMetadataFactory.example1Cached());
+ SetQuery query = (SetQuery)helpResolve(sql, RealMetadataFactory.example1Cached());
assertEquals(DataTypeManager.DefaultDataClasses.OBJECT, ((SingleElementSymbol)query.getProjectedSymbols().get(0)).getType());
}
@@ -2780,7 +2771,7 @@
}
@Test public void testSPOutParamWithExec() {
- StoredProcedure proc = (StoredProcedure)helpResolve("exec pm2.spTest8(1)", FakeMetadataFactory.exampleBQTCached());
+ StoredProcedure proc = (StoredProcedure)helpResolve("exec pm2.spTest8(1)", RealMetadataFactory.exampleBQTCached());
assertEquals(2, proc.getProjectedSymbols().size());
}
@@ -2789,21 +2780,21 @@
* That hack is handled by the PreparedStatementRequest
*/
@Test public void testSPOutParamWithCallableStatement() {
- StoredProcedure proc = (StoredProcedure)helpResolve("{call pm2.spTest8(1)}", FakeMetadataFactory.exampleBQTCached());
+ StoredProcedure proc = (StoredProcedure)helpResolve("{call pm2.spTest8(1)}", RealMetadataFactory.exampleBQTCached());
assertEquals(3, proc.getProjectedSymbols().size());
}
@Test public void testOutWithWrongType() {
- helpResolveException("exec pm2.spTest8(inkey=>1, outkey=>{t '12:00:00'})", FakeMetadataFactory.exampleBQTCached());
+ helpResolveException("exec pm2.spTest8(inkey=>1, outkey=>{t '12:00:00'})", RealMetadataFactory.exampleBQTCached());
}
@Test public void testProcRelationalWithOutParam() {
- Query proc = (Query)helpResolve("select * from pm2.spTest8 where inkey = 1", FakeMetadataFactory.exampleBQTCached());
+ Query proc = (Query)helpResolve("select * from pm2.spTest8 where inkey = 1", RealMetadataFactory.exampleBQTCached());
assertEquals(3, proc.getProjectedSymbols().size());
}
@Test public void testSPReturnParamWithNoResultSet() {
- StoredProcedure proc = (StoredProcedure)helpResolve("exec pm4.spTest9(1)", FakeMetadataFactory.exampleBQTCached());
+ StoredProcedure proc = (StoredProcedure)helpResolve("exec pm4.spTest9(1)", RealMetadataFactory.exampleBQTCached());
assertEquals(1, proc.getProjectedSymbols().size());
}
@@ -2930,7 +2921,7 @@
String userUpdateStr) throws QueryParserException,
QueryResolverException, TeiidComponentException,
QueryMetadataException {
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(TriggerEvent.UPDATE, procedure);
ProcedureContainer userCommand = (ProcedureContainer)QueryParser.getQueryParser().parseCommand(userUpdateStr);
QueryResolver.resolveCommand(userCommand, metadata);
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/resolver/TestXMLResolver.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/resolver/TestXMLResolver.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/resolver/TestXMLResolver.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -35,23 +35,23 @@
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.symbol.Function;
import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
public class TestXMLResolver extends TestCase {
public Command helpResolve(String sql) {
- Command cmd = TestResolver.helpResolve(sql, FakeMetadataFactory.example1Cached());
+ Command cmd = TestResolver.helpResolve(sql, RealMetadataFactory.example1Cached());
ResolverUtil.fullyQualifyElements(cmd);
return cmd;
}
public void helpResolveException(String sql) {
- TestResolver.helpResolveException(sql, FakeMetadataFactory.example1Cached());
+ TestResolver.helpResolveException(sql, RealMetadataFactory.example1Cached());
}
public void helpResolveException(String sql, String expectedMessage) {
- TestResolver.helpResolveException(sql, FakeMetadataFactory.example1Cached(), expectedMessage);
+ TestResolver.helpResolveException(sql, RealMetadataFactory.example1Cached(), expectedMessage);
}
public void testXMLCriteriaShortElement() {
@@ -405,7 +405,7 @@
expected.setOperator(CompareCriteria.EQ);
expected.setRightExpression(new Constant("yyz")); //$NON-NLS-1$
- Query query = (Query) TestResolver.helpResolve(QueryParser.getQueryParser().parseCommand("select \"xml\" from xmltest.doc1 where node1 = 'yyz'"), FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ Query query = (Query) TestResolver.helpResolve(QueryParser.getQueryParser().parseCommand("select \"xml\" from xmltest.doc1 where node1 = 'yyz'"), RealMetadataFactory.example1Cached()); //$NON-NLS-1$
Criteria actual = query.getCriteria();
assertEquals("Did not match expected criteria", expected, actual); //$NON-NLS-1$
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/rewriter/TestOrderByRewrite.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/rewriter/TestOrderByRewrite.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/rewriter/TestOrderByRewrite.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -32,9 +32,9 @@
import org.junit.Test;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.metadata.Column;
import org.teiid.query.parser.QueryParser;
import org.teiid.query.resolver.QueryResolver;
-import org.teiid.query.sql.LanguageObject;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.lang.OrderBy;
import org.teiid.query.sql.lang.Query;
@@ -42,8 +42,7 @@
import org.teiid.query.sql.symbol.ExpressionSymbol;
import org.teiid.query.sql.symbol.SingleElementSymbol;
import org.teiid.query.sql.visitor.ElementCollectorVisitor;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
+import org.teiid.query.unittest.RealMetadataFactory;
/**
@@ -54,36 +53,36 @@
private static Command getCommand(String sql) throws TeiidComponentException, TeiidProcessingException {
Command command = QueryParser.getQueryParser().parseCommand(sql);
- QueryResolver.resolveCommand(command, FakeMetadataFactory.example1Cached());
+ QueryResolver.resolveCommand(command, RealMetadataFactory.example1Cached());
- return QueryRewriter.rewrite(command, FakeMetadataFactory.example1Cached(), null);
+ return QueryRewriter.rewrite(command, RealMetadataFactory.example1Cached(), null);
}
private void helpCheckElements(OrderBy langObj,
String[] elementNames,
String[] elementIDs) {
- List elements = new ArrayList();
- for (Iterator i = langObj.getSortKeys().iterator(); i.hasNext();) {
- ElementCollectorVisitor.getElements((LanguageObject)i.next(), elements);
+ List<ElementSymbol> elements = new ArrayList<ElementSymbol>();
+ for (Iterator<SingleElementSymbol> i = langObj.getSortKeys().iterator(); i.hasNext();) {
+ ElementCollectorVisitor.getElements(i.next(), elements);
}
assertEquals("Wrong number of elements: ", elementNames.length, elements.size()); //$NON-NLS-1$
for (int i = 0; i < elements.size(); i++) {
- ElementSymbol symbol = (ElementSymbol)elements.get(i);
+ ElementSymbol symbol = elements.get(i);
assertEquals("Element name does not match: ", elementNames[i].toUpperCase(), symbol.getName().toUpperCase()); //$NON-NLS-1$
- FakeMetadataObject elementID = (FakeMetadataObject)symbol.getMetadataID();
+ Column elementID = (Column)symbol.getMetadataID();
assertNotNull("ElementSymbol " + symbol + " was not resolved and has no metadataID", elementID); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("ElementID name does not match: ", elementIDs[i].toUpperCase(), elementID.getName().toUpperCase()); //$NON-NLS-1$
+ assertEquals("ElementID name does not match: ", elementIDs[i].toUpperCase(), elementID.getFullName().toUpperCase()); //$NON-NLS-1$
}
}
private void helpCheckExpressionsSymbols(OrderBy langObj,
String[] functionsNames) {
int expCount = 0;
- for (Iterator i = langObj.getSortKeys().iterator(); i.hasNext();) {
- SingleElementSymbol ses = (SingleElementSymbol)i.next();
+ for (Iterator<SingleElementSymbol> i = langObj.getSortKeys().iterator(); i.hasNext();) {
+ SingleElementSymbol ses = i.next();
if (ses instanceof ExpressionSymbol) {
assertEquals("Expression Symbols does not match: ", functionsNames[expCount++], ses.toString()); //$NON-NLS-1$
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -48,8 +48,8 @@
import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.TimestampWithTimezone;
+import org.teiid.metadata.Table;
import org.teiid.query.eval.Evaluator;
-import org.teiid.query.function.FunctionLibrary;
import org.teiid.query.function.FunctionTree;
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.optimizer.FakeFunctionMetadataSource;
@@ -79,9 +79,7 @@
import org.teiid.query.sql.symbol.SearchedCaseExpression;
import org.teiid.query.sql.symbol.SingleElementSymbol;
import org.teiid.query.sql.visitor.CorrelatedReferenceCollectorVisitor;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
import org.teiid.query.util.ContextProperties;
@@ -116,7 +114,7 @@
}
private Criteria helpTestRewriteCriteria(String original, String expected, boolean rewrite) throws QueryMetadataException, TeiidComponentException, TeiidProcessingException {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
Criteria expectedCrit = parseCriteria(expected, metadata);
if (rewrite) {
QueryResolver.resolveCriteria(expectedCrit, metadata);
@@ -168,8 +166,8 @@
return actualExp;
}
- private String getRewritenProcedure(String procedure, String userUpdateStr, String procedureType) throws TeiidComponentException, TeiidProcessingException {
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleUpdateProc(procedureType, procedure);
+ private String getRewritenProcedure(String procedure, String userUpdateStr, Table.TriggerEvent procedureType) throws TeiidComponentException, TeiidProcessingException {
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(procedureType, procedure);
return getRewritenProcedure(userUpdateStr, metadata);
}
@@ -187,7 +185,7 @@
static Command helpTestRewriteCommand(String original, String expected) {
try {
- return helpTestRewriteCommand(original, expected, FakeMetadataFactory.example1Cached());
+ return helpTestRewriteCommand(original, expected, RealMetadataFactory.example1Cached());
} catch(TeiidException e) {
throw new TeiidRuntimeException(e);
}
@@ -438,7 +436,7 @@
@Ignore(value="Should be moved to the validator")
@Test public void testRewriteCrit_invalidParseDate() {
- QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
Criteria origCrit = parseCriteria("PARSEDATE(pm3.g1.e1, '''') = {d'2003-05-01'}", metadata); //$NON-NLS-1$
try {
@@ -600,7 +598,7 @@
String original = "formatBigInteger(convert(pm1.g1.e2, biginteger), '#,##0') = '1,234,567,890'"; //$NON-NLS-1$
String expected = "pm1.g1.e2 = 1234567890"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
Criteria origCrit = parseCriteria(original, metadata);
Criteria expectedCrit = parseCriteria(expected, metadata);
@@ -614,7 +612,7 @@
String original = "formatFloat(convert(pm1.g1.e4, float), '#,##0.###') = '1,234.123'"; //$NON-NLS-1$
String expected = "pm1.g1.e4 = 1234.123046875"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
Criteria origCrit = parseCriteria(original, metadata);
// rewrite
@@ -627,7 +625,7 @@
String original = "formatDouble(convert(pm1.g1.e4, double), '$#,##0.00') = '$1,234.50'"; //$NON-NLS-1$
String expected = "pm1.g1.e4 = '1234.5'"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
Criteria origCrit = parseCriteria(original, metadata);
Criteria expectedCrit = parseCriteria(expected, metadata);
((CompareCriteria)expectedCrit).setRightExpression(new Constant(new Double(1234.5)));
@@ -642,7 +640,7 @@
String original = "formatBigDecimal(convert(pm1.g1.e4, bigdecimal), '#,##0.###') = '1,234.5'"; //$NON-NLS-1$
String expected = "pm1.g1.e4 = 1234.5"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
Criteria origCrit = parseCriteria(original, metadata);
Criteria expectedCrit = parseCriteria(expected, metadata);
@@ -868,7 +866,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.INSERT_PROCEDURE);
+ Table.TriggerEvent.INSERT);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -896,7 +894,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.INSERT_PROCEDURE);
+ Table.TriggerEvent.INSERT);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -924,7 +922,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.INSERT_PROCEDURE);
+ Table.TriggerEvent.INSERT);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -947,7 +945,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.INSERT_PROCEDURE);
+ Table.TriggerEvent.INSERT);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -970,7 +968,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -992,7 +990,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1016,7 +1014,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1040,7 +1038,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1063,12 +1061,12 @@
rewritProc = rewritProc + "DECLARE String var1;\n"; //$NON-NLS-1$
rewritProc = rewritProc + "IF(var1 IN ('y', 'x'))\n"; //$NON-NLS-1$
rewritProc = rewritProc + "BEGIN\n"; //$NON-NLS-1$
- rewritProc = rewritProc + "SELECT pm1.g1.e2, null, FALSE, TRUE FROM pm1.g1;\n"; //$NON-NLS-1$
+ rewritProc = rewritProc + "SELECT pm1.g1.e2, 123, FALSE, TRUE FROM pm1.g1;\n"; //$NON-NLS-1$
rewritProc = rewritProc + "END\n"; //$NON-NLS-1$
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.INSERT_PROCEDURE);
+ Table.TriggerEvent.INSERT);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1090,7 +1088,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1112,7 +1110,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1135,7 +1133,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1158,7 +1156,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1180,7 +1178,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1202,7 +1200,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1220,7 +1218,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1237,7 +1235,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1254,7 +1252,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1278,7 +1276,7 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where e4= 1"; //$NON-NLS-1$
this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// Bug 8212 elements in INPUT and CHANGING special groups are cese sensitive
@@ -1296,7 +1294,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.INSERT_PROCEDURE);
+ Table.TriggerEvent.INSERT);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1317,7 +1315,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.INSERT_PROCEDURE);
+ Table.TriggerEvent.INSERT);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1338,7 +1336,7 @@
rewritProc = rewritProc + "UPDATE pm1.g1 SET e3 = TRUE;\n"; //$NON-NLS-1$
rewritProc = rewritProc + "END"; //$NON-NLS-1$
- this.getRewritenProcedure(procedure, userQuery, FakeMetadataObject.Props.INSERT_PROCEDURE);
+ this.getRewritenProcedure(procedure, userQuery, Table.TriggerEvent.INSERT);
}
@Test public void testRewriteProcedure21a() throws Exception {
@@ -1351,11 +1349,11 @@
String rewritProc = "CREATE PROCEDURE\n"; //$NON-NLS-1$
rewritProc = rewritProc + "BEGIN\n"; //$NON-NLS-1$
- rewritProc = rewritProc + "UPDATE pm1.g1 SET e1 = null, e2 = null, e3 = TRUE;\n"; //$NON-NLS-1$
+ rewritProc = rewritProc + "UPDATE pm1.g1 SET e1 = '124', e2 = 123, e3 = TRUE;\n"; //$NON-NLS-1$
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.INSERT_PROCEDURE);
+ Table.TriggerEvent.INSERT);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1374,7 +1372,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1393,7 +1391,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1409,11 +1407,11 @@
String rewritProc = "CREATE PROCEDURE\n"; //$NON-NLS-1$
rewritProc = rewritProc + "BEGIN\n"; //$NON-NLS-1$
- rewritProc = rewritProc + "UPDATE pm1.g1 SET e2 = null, e3 = TRUE;\n"; //$NON-NLS-1$
+ rewritProc = rewritProc + "UPDATE pm1.g1 SET e2 = 123, e3 = TRUE;\n"; //$NON-NLS-1$
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.INSERT_PROCEDURE);
+ Table.TriggerEvent.INSERT);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1427,7 +1425,7 @@
String userQuery = "UPDATE vm1.g1 set E2=1 where e2 = 1 and e1 LIKE 'mnopxyz_'"; //$NON-NLS-1$
this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// INPUT vars in insert statements replaced by default variable when user's inser ignores values
@@ -1445,7 +1443,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.INSERT_PROCEDURE);
+ Table.TriggerEvent.INSERT);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1467,7 +1465,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1482,7 +1480,7 @@
String userQuery = "UPDATE vm1.g1 SET e1='x' where e2 LIKE 'xyz'"; //$NON-NLS-1$
this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
/**
@@ -1516,7 +1514,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1524,8 +1522,8 @@
//base test. no change is expected
@Test public void testRewriteLookupFunction1() {
String criteria = "lookup('pm1.g1','e1', 'e2', 1) = 'ab'"; //$NON-NLS-1$
- CompareCriteria expected = (CompareCriteria)parseCriteria(criteria, FakeMetadataFactory.example1Cached());
- helpTestRewriteCriteria(criteria, expected, FakeMetadataFactory.example1Cached());
+ CompareCriteria expected = (CompareCriteria)parseCriteria(criteria, RealMetadataFactory.example1Cached());
+ helpTestRewriteCriteria(criteria, expected, RealMetadataFactory.example1Cached());
}
@Test public void testRewriteLookupFunction1b() {
@@ -1535,8 +1533,8 @@
/** defect 11630 1 should still get rewritten as '1'*/
@Test public void testRewriteLookupFunctionCompoundCriteria() {
String criteria = "LOOKUP('pm1.g1','e1', 'e2', 1) IS NULL AND pm1.g1.e1='1'"; //$NON-NLS-1$
- CompoundCriteria expected = (CompoundCriteria)parseCriteria(criteria, FakeMetadataFactory.example1Cached());
- helpTestRewriteCriteria("LOOKUP('pm1.g1','e1', 'e2', 1) IS NULL AND pm1.g1.e1=1", expected, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ CompoundCriteria expected = (CompoundCriteria)parseCriteria(criteria, RealMetadataFactory.example1Cached());
+ helpTestRewriteCriteria("LOOKUP('pm1.g1','e1', 'e2', 1) IS NULL AND pm1.g1.e1=1", expected, RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testSelectWithNoFrom() {
@@ -1550,7 +1548,7 @@
Command command = parser.parseCommand("exec pm1.sp4(5)"); //$NON-NLS-1$
// resolve
- QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
QueryResolver.resolveCommand(command, metadata);
// rewrite
@@ -1566,7 +1564,7 @@
}
@Test public void testRewriteFunctionThrowsEvaluationError() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
Criteria origCrit = parseCriteria("5 / 0 = 5", metadata); //$NON-NLS-1$
// rewrite
@@ -1580,7 +1578,7 @@
}
@Test public void testRewriteConvertThrowsEvaluationError() {
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
Criteria origCrit = parseCriteria("convert('x', integer) = 0", metadata); //$NON-NLS-1$
// rewrite
@@ -1610,7 +1608,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.DELETE_PROCEDURE);
+ Table.TriggerEvent.DELETE);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1623,7 +1621,7 @@
}
@Test public void testRewriteCase1954b() throws Exception{
- FakeMetadataFacade metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
CompareCriteria expected = new CompareCriteria();
ElementSymbol leftElement = new ElementSymbol("pm1.g1.e4"); //$NON-NLS-1$
@@ -1736,8 +1734,8 @@
@Test public void testRewriteSearchedCaseExpr4() {
String criteria = "lookup('pm1.g1', 'e2', 'e1', '2') = 0"; //$NON-NLS-1$
- CompareCriteria expected = (CompareCriteria)parseCriteria(criteria, FakeMetadataFactory.example1Cached());
- helpTestRewriteCriteria("lookup('pm1.g1', 'e2', 'e1', case 0 when 1 then pm1.g1.e1 else 2 end) = 0", expected, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ CompareCriteria expected = (CompareCriteria)parseCriteria(criteria, RealMetadataFactory.example1Cached());
+ helpTestRewriteCriteria("lookup('pm1.g1', 'e2', 'e1', case 0 when 1 then pm1.g1.e1 else 2 end) = 0", expected, RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
// First WHEN always false, so remove it
@@ -1788,13 +1786,13 @@
@Test public void testRewriteExecEnv() throws Exception {
Command command = QueryParser.getQueryParser().parseCommand("exec pm1.sq2(env('sessionid'))"); //$NON-NLS-1$
- QueryResolver.resolveCommand(command, FakeMetadataFactory.example1Cached());
+ QueryResolver.resolveCommand(command, RealMetadataFactory.example1Cached());
CommandContext context = new CommandContext();
Properties props = new Properties();
props.setProperty(ContextProperties.SESSION_ID, "1"); //$NON-NLS-1$
context.setEnvironmentProperties(props);
- Command rewriteCommand = QueryRewriter.rewrite(command, FakeMetadataFactory.example1Cached(), context);
+ Command rewriteCommand = QueryRewriter.rewrite(command, RealMetadataFactory.example1Cached(), context);
assertEquals("EXEC pm1.sq2('1')", rewriteCommand.toString()); //$NON-NLS-1$
}
@@ -1830,7 +1828,7 @@
String userQuery = "Insert into vm1.g1 (e1, e2) values ('String', 1)"; //$NON-NLS-1$
try {
- getRewritenProcedure(procedure, userQuery, FakeMetadataObject.Props.INSERT_PROCEDURE);
+ getRewritenProcedure(procedure, userQuery, Table.TriggerEvent.INSERT);
fail("exception expected"); //$NON-NLS-1$
} catch (QueryValidatorException e) {
assertEquals("Infinite loop detected, procedure will not be executed.", e.getMessage()); //$NON-NLS-1$
@@ -1854,7 +1852,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.INSERT_PROCEDURE);
+ Table.TriggerEvent.INSERT);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1877,7 +1875,7 @@
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getRewritenProcedure(procedure, userQuery,
- FakeMetadataObject.Props.INSERT_PROCEDURE);
+ Table.TriggerEvent.INSERT);
assertEquals("Rewritten command was not expected", rewritProc, procReturned); //$NON-NLS-1$
}
@@ -1903,7 +1901,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1 = 'x' WHERE e2 = 5"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.exampleUpdateProc(FakeMetadataObject.Props.UPDATE_PROCEDURE, procedure1, procedure2);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(Table.TriggerEvent.UPDATE, procedure1, procedure2);
String rewriten = getRewritenProcedure(userUpdateStr, metadata);
@@ -2013,9 +2011,9 @@
private void verifyProjectedTypesOnUnionBranches(String unionQuery, Class<?>[] types) throws TeiidComponentException, TeiidProcessingException {
SetQuery union = (SetQuery)QueryParser.getQueryParser().parseCommand(unionQuery);
- QueryResolver.resolveCommand(union, FakeMetadataFactory.example1Cached());
+ QueryResolver.resolveCommand(union, RealMetadataFactory.example1Cached());
- union = (SetQuery)QueryRewriter.rewrite(union, FakeMetadataFactory.example1Cached(), null);
+ union = (SetQuery)QueryRewriter.rewrite(union, RealMetadataFactory.example1Cached(), null);
for (QueryCommand query : union.getQueryCommands()) {
List<SingleElementSymbol> projSymbols = query.getProjectedSymbols();
@@ -2056,7 +2054,7 @@
*/
@Test public void testVirtualRightOuterJoinSwap() throws Exception {
String sql = "SELECT sa.IntKey AS sa_IntKey, mb.IntKey AS mb_IntKey FROM (select * from BQT1.smalla) sa RIGHT OUTER JOIN (select BQT1.mediumb.intkey from BQT1.mediumb) mb ON sa.IntKey = mb.IntKey"; //$NON-NLS-1$
- helpTestRewriteCommand(sql, "SELECT sa.IntKey AS sa_IntKey, mb.IntKey AS mb_IntKey FROM (SELECT BQT1.mediumb.intkey FROM BQT1.mediumb) AS mb LEFT OUTER JOIN (SELECT * FROM BQT1.smalla) AS sa ON sa.IntKey = mb.IntKey", FakeMetadataFactory.exampleBQTCached()); //$NON-NLS-1$
+ helpTestRewriteCommand(sql, "SELECT sa.IntKey AS sa_IntKey, mb.IntKey AS mb_IntKey FROM (SELECT BQT1.mediumb.intkey FROM BQT1.mediumb) AS mb LEFT OUTER JOIN (SELECT * FROM BQT1.smalla) AS sa ON sa.IntKey = mb.IntKey", RealMetadataFactory.exampleBQTCached()); //$NON-NLS-1$
}
/**
@@ -2064,7 +2062,7 @@
*/
@Test public void testVirtualRightOuterJoinSwap1() throws Exception {
String sql = "SELECT sa.IntKey AS sa_IntKey, mb.IntKey AS mb_IntKey FROM ((select * from BQT1.smalla) sa inner join BQT1.smallb on sa.intkey = smallb.intkey) RIGHT OUTER JOIN (select BQT1.mediumb.intkey from BQT1.mediumb) mb ON sa.IntKey = mb.IntKey"; //$NON-NLS-1$
- helpTestRewriteCommand(sql, "SELECT sa.IntKey AS sa_IntKey, mb.IntKey AS mb_IntKey FROM (SELECT BQT1.mediumb.intkey FROM BQT1.mediumb) AS mb LEFT OUTER JOIN ((SELECT * FROM BQT1.smalla) AS sa INNER JOIN BQT1.smallb ON sa.intkey = smallb.intkey) ON sa.IntKey = mb.IntKey", FakeMetadataFactory.exampleBQTCached()); //$NON-NLS-1$
+ helpTestRewriteCommand(sql, "SELECT sa.IntKey AS sa_IntKey, mb.IntKey AS mb_IntKey FROM (SELECT BQT1.mediumb.intkey FROM BQT1.mediumb) AS mb LEFT OUTER JOIN ((SELECT * FROM BQT1.smalla) AS sa INNER JOIN BQT1.smallb ON sa.intkey = smallb.intkey) ON sa.IntKey = mb.IntKey", RealMetadataFactory.exampleBQTCached()); //$NON-NLS-1$
}
@Test public void testRewriteConcat2() {
@@ -2321,7 +2319,7 @@
@Test public void testRewriteBigDecimal() {
String original = "convert(BQT1.SmallA.LongNum, bigdecimal) = '22.0'"; //$NON-NLS-1$
CompareCriteria crit = new CompareCriteria(new ElementSymbol("BQT1.SmallA.LongNum"), CompareCriteria.EQ, new Constant(new Long(22))); //$NON-NLS-1$
- helpTestRewriteCriteria(original, crit, FakeMetadataFactory.exampleBQTCached());
+ helpTestRewriteCriteria(original, crit, RealMetadataFactory.exampleBQTCached());
}
/**
@@ -2329,54 +2327,54 @@
*/
@Test public void testRewriteWideningIn() {
String original = "convert(BQT1.SmallA.TimestampValue, time) in ({t'10:00:00'}, {t'11:00:00'})"; //$NON-NLS-1$
- helpTestRewriteCriteria(original, parseCriteria("convert(BQT1.SmallA.TimestampValue, time) in ({t'10:00:00'}, {t'11:00:00'})", FakeMetadataFactory.exampleBQTCached()), FakeMetadataFactory.exampleBQTCached()); //$NON-NLS-1$
+ helpTestRewriteCriteria(original, parseCriteria("convert(BQT1.SmallA.TimestampValue, time) in ({t'10:00:00'}, {t'11:00:00'})", RealMetadataFactory.exampleBQTCached()), RealMetadataFactory.exampleBQTCached()); //$NON-NLS-1$
}
@Test public void testRewriteParseDate() {
String original = "parsedate(BQT1.SmallA.stringkey, 'yymmdd') = {d'1970-01-01'}"; //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
helpTestRewriteCriteria(original, parseCriteria("convert(parsetimestamp(BQT1.SmallA.stringkey, 'yymmdd'), date) = {d'1970-01-01'}", metadata), metadata); //$NON-NLS-1$
}
@Test public void testRewriteFormatTime() {
String original = "formattime(BQT1.SmallA.timevalue, 'hh:mm') = '08:02'"; //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
helpTestRewriteCriteria(original, parseCriteria("formattimestamp(convert(BQT1.SmallA.timevalue, timestamp), 'hh:mm') = '08:02'", metadata), metadata); //$NON-NLS-1$
}
@Test public void testRewriteTimestampAdd() {
String original = "timestampadd(SQL_TSI_SECOND, 1, BQT1.SmallA.timevalue) = {t'08:02:00'}"; //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
helpTestRewriteCriteria(original, parseCriteria("convert(timestampadd(SQL_TSI_SECOND, 1, convert(BQT1.SmallA.timevalue, timestamp)), time) = {t'08:02:00'}", metadata), metadata); //$NON-NLS-1$
}
@Test public void testRewriteXmlElement() throws Exception {
String original = "xmlserialize(document xmlelement(name a, xmlattributes('b' as c)) as string)"; //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
helpTestRewriteExpression(original, "'<a c=\"b\"></a>'", metadata);
}
@Test public void testRewriteXmlElement1() throws Exception {
String original = "xmlelement(name a, xmlattributes(1+1 as c), BQT1.SmallA.timevalue)"; //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
helpTestRewriteExpression(original, "XMLELEMENT(NAME a, XMLATTRIBUTES(2 AS c), BQT1.SmallA.timevalue)", metadata);
}
@Test public void testRewriteXmlSerialize() throws Exception {
String original = "xmlserialize(document xmlelement(name a, xmlattributes('b' as c)) as string)"; //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
helpTestRewriteExpression(original, "'<a c=\"b\"></a>'", metadata);
}
@Test public void testRewriteXmlTable() throws Exception {
String original = "select * from xmltable('/' passing 1 + 1 as a columns x string default curdate()) as x"; //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
helpTestRewriteCommand(original, "SELECT * FROM XMLTABLE('/' PASSING 2 AS a COLUMNS x string DEFAULT curdate()) AS x", metadata);
}
@Test public void testRewriteQueryString() throws Exception {
String original = "querystring('path', 'value' as \"&x\", ' & ' as y, null as z)"; //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
helpTestRewriteExpression(original, "'path?%26x=value&y=%20%26%20'", metadata);
}
@@ -2446,8 +2444,7 @@
}
@Test public void testUDFParse() throws Exception {
- FunctionLibrary funcLibrary = new FunctionLibrary(FakeMetadataFactory.SFM.getSystemFunctions(), new FunctionTree("foo", new FakeFunctionMetadataSource()));
- FakeMetadataFacade metadata = new FakeMetadataFacade(FakeMetadataFactory.example1Cached().getStore(), funcLibrary);
+ QueryMetadataInterface metadata = RealMetadataFactory.createTransformationMetadata(RealMetadataFactory.example1Cached().getMetadataStore(), "example1", new FunctionTree("foo", new FakeFunctionMetadataSource()));
String sql = "parsedate_(pm1.g1.e1) = {d'2001-01-01'}";
helpTestRewriteCriteria(sql, parseCriteria(sql, metadata), metadata);
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/sql/util/TestElementSymbolOptimizer.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/sql/util/TestElementSymbolOptimizer.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/sql/util/TestElementSymbolOptimizer.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -36,7 +36,7 @@
import org.teiid.query.resolver.util.ResolverUtil;
import org.teiid.query.resolver.util.ResolverVisitor;
import org.teiid.query.sql.lang.Command;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
/**
*/
@@ -65,51 +65,51 @@
/** Can be optimized */
@Test public void testOptimize1() throws Exception {
helpTestOptimize("SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
"SELECT e1, e2 FROM pm1.g1"); //$NON-NLS-1$
}
/** Can't be optimized */
@Test public void testOptimize2() throws Exception {
helpTestOptimize("SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1, pm1.g2", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
"SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1, pm1.g2"); //$NON-NLS-1$
}
@Test public void testOptimize3() throws Exception {
helpTestOptimize("UPDATE pm1.g1 SET pm1.g1.e1 = 'e' WHERE pm1.g1.e2 = 3", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
"UPDATE pm1.g1 SET e1 = 'e' WHERE e2 = 3"); //$NON-NLS-1$
}
@Test public void testOptimize4() throws Exception {
helpTestOptimize("INSERT INTO pm1.g1 (pm1.g1.e1, pm1.g1.e2) VALUES ('e', 3)", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
"INSERT INTO pm1.g1 (e1, e2) VALUES ('e', 3)"); //$NON-NLS-1$
}
@Test public void testOptimize5() throws Exception {
helpTestOptimize("DELETE FROM pm1.g1 WHERE pm1.g1.e2 = 3", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
"DELETE FROM pm1.g1 WHERE e2 = 3"); //$NON-NLS-1$
}
@Test public void testOptimize6() throws Exception {
helpTestOptimize("SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1 WHERE e2 > (SELECT AVG(pm1.g2.e2) FROM pm1.g2 WHERE pm1.g1.e1 = pm1.g2.e1)", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
"SELECT e1, e2 FROM pm1.g1 WHERE e2 > (SELECT AVG(e2) FROM pm1.g2 WHERE pm1.g1.e1 = e1)"); //$NON-NLS-1$
}
/** alias */
@Test public void testOptimize7() throws Exception {
helpTestOptimize("SELECT 'text' AS zz, pm1.g1.e2 FROM pm1.g1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
"SELECT 'text' AS zz, e2 FROM pm1.g1"); //$NON-NLS-1$
}
@Test public void testOptimize8() throws Exception {
helpTestOptimize("SELECT 1, 'xyz'", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
"SELECT 1, 'xyz'"); //$NON-NLS-1$
}
@@ -123,37 +123,37 @@
@Test public void testFullyQualify1() throws Exception {
helpTestFullyQualify("SELECT e1, e2 FROM pm1.g1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
"SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1"); //$NON-NLS-1$
}
@Test public void testXMLQuery() throws Exception {
helpTestOptimize("SELECT root.node1.node2.node3 FROM xmltest.doc1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
"SELECT root.node1.node2.node3 FROM xmltest.doc1"); //$NON-NLS-1$
}
@Test public void testVirtualStoredProcedure() throws Exception {
helpTestOptimize("EXEC pm1.vsp7(5)", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
"EXEC pm1.vsp7(5)"); //$NON-NLS-1$
}
@Test public void testStoredQuerySubquery() throws Exception {
helpTestOptimize("select x.e1 from (EXEC pm1.sq1()) as x", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
"SELECT e1 FROM (EXEC pm1.sq1()) AS x"); //$NON-NLS-1$
}
@Test public void testStoredQuerySubquery2() throws Exception {
helpTestOptimize("select x.e1 from (EXEC pm1.sq1()) as x WHERE x.e2 = 3", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
"SELECT e1 FROM (EXEC pm1.sq1()) AS x WHERE e2 = 3"); //$NON-NLS-1$
}
@Test public void testOptimizeOrderBy() throws Exception {
helpTestOptimize("SELECT pm1.g1.e1 FROM pm1.g1 order by pm1.g1.e1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
"SELECT e1 FROM pm1.g1 ORDER BY e1"); //$NON-NLS-1$
}
@@ -163,13 +163,13 @@
*/
@Test public void testOptimizeOrderBy1() throws Exception {
helpTestFullyQualify("SELECT e1 FROM pm1.g1 order by e1", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
"SELECT pm1.g1.e1 FROM pm1.g1 ORDER BY e1"); //$NON-NLS-1$
}
@Test public void testOptimizeOrderByWithoutGroup() throws Exception {
helpTestOptimize("SELECT pm1.g1.e1, count(*) as x FROM pm1.g1 order by x", //$NON-NLS-1$
- FakeMetadataFactory.example1Cached(),
+ RealMetadataFactory.example1Cached(),
"SELECT e1, COUNT(*) AS x FROM pm1.g1 ORDER BY x"); //$NON-NLS-1$
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/sql/visitor/TestEvaluatableVisitor.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/sql/visitor/TestEvaluatableVisitor.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/sql/visitor/TestEvaluatableVisitor.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -26,14 +26,14 @@
import org.teiid.query.resolver.TestResolver;
import org.teiid.query.sql.lang.Query;
import org.teiid.query.sql.visitor.EvaluatableVisitor;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
import static org.junit.Assert.*;
public class TestEvaluatableVisitor {
@Test public void testNestedNeedsEvaluation() throws Exception {
- Query command = (Query)TestResolver.helpResolve("select * from pm1.g1 where e1 in (select e1 from pm1.g2 where e2 = ?)", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ Query command = (Query)TestResolver.helpResolve("select * from pm1.g1 where e1 in (select e1 from pm1.g2 where e2 = ?)", RealMetadataFactory.example1Cached()); //$NON-NLS-1$
assertTrue(EvaluatableVisitor.needsProcessingEvaluation(command));
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/sql/visitor/TestSQLStringVisitor.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/sql/visitor/TestSQLStringVisitor.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/sql/visitor/TestSQLStringVisitor.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -91,7 +91,7 @@
import org.teiid.query.sql.symbol.SearchedCaseExpression;
import org.teiid.query.sql.symbol.TestCaseExpression;
import org.teiid.query.sql.symbol.TestSearchedCaseExpression;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.RealMetadataFactory;
public class TestSQLStringVisitor extends TestCase {
@@ -1871,25 +1871,25 @@
public void testUnionOrderBy() throws Exception {
Command command = QueryParser.getQueryParser().parseCommand("select pm1.g1.e1 from pm1.g1 union select e2 from pm1.g2 order by e1"); //$NON-NLS-1$
- QueryResolver.resolveCommand(command, FakeMetadataFactory.example1Cached());
+ QueryResolver.resolveCommand(command, RealMetadataFactory.example1Cached());
helpTest(command, "SELECT pm1.g1.e1 FROM pm1.g1 UNION SELECT e2 FROM pm1.g2 ORDER BY e1"); //$NON-NLS-1$
}
public void testUnionBranchOrderBy() throws Exception {
Command command = QueryParser.getQueryParser().parseCommand("select pm1.g1.e1 from pm1.g1 union (select e2 from pm1.g2 order by e1)"); //$NON-NLS-1$
- QueryResolver.resolveCommand(command, FakeMetadataFactory.example1Cached());
+ QueryResolver.resolveCommand(command, RealMetadataFactory.example1Cached());
helpTest(command, "SELECT pm1.g1.e1 FROM pm1.g1 UNION (SELECT e2 FROM pm1.g2 ORDER BY e1)"); //$NON-NLS-1$
}
public void testAliasedOrderBy() throws Exception {
Command command = QueryParser.getQueryParser().parseCommand("select pm1.g1.e1 as a from pm1.g1 order by a"); //$NON-NLS-1$
- QueryResolver.resolveCommand(command, FakeMetadataFactory.example1Cached());
+ QueryResolver.resolveCommand(command, RealMetadataFactory.example1Cached());
helpTest(command, "SELECT pm1.g1.e1 AS a FROM pm1.g1 ORDER BY a"); //$NON-NLS-1$
}
public void testNumberOrderBy() throws Exception {
Command command = QueryParser.getQueryParser().parseCommand("select pm1.g1.e1 as a from pm1.g1 order by 1"); //$NON-NLS-1$
- QueryResolver.resolveCommand(command, FakeMetadataFactory.example1Cached());
+ QueryResolver.resolveCommand(command, RealMetadataFactory.example1Cached());
helpTest(command, "SELECT pm1.g1.e1 AS a FROM pm1.g1 ORDER BY 1"); //$NON-NLS-1$
}
Deleted: branches/7.4.x/engine/src/test/java/org/teiid/query/unittest/FakeMetadataFacade.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/unittest/FakeMetadataFacade.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/unittest/FakeMetadataFacade.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -1,774 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.query.unittest;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-
-import org.teiid.api.exception.query.QueryMetadataException;
-import org.teiid.client.metadata.ParameterInfo;
-import org.teiid.core.TeiidComponentException;
-import org.teiid.core.types.DataTypeManager;
-import org.teiid.core.util.ArgCheck;
-import org.teiid.core.util.Assertion;
-import org.teiid.query.function.FunctionLibrary;
-import org.teiid.query.mapping.relational.QueryNode;
-import org.teiid.query.mapping.xml.MappingBaseNode;
-import org.teiid.query.mapping.xml.MappingDocument;
-import org.teiid.query.mapping.xml.MappingNode;
-import org.teiid.query.mapping.xml.MappingVisitor;
-import org.teiid.query.mapping.xml.Navigator;
-import org.teiid.query.metadata.BasicQueryMetadata;
-import org.teiid.query.metadata.QueryMetadataInterface;
-import org.teiid.query.metadata.StoredProcedureInfo;
-import org.teiid.query.metadata.SupportConstants;
-import org.teiid.query.sql.lang.SPParameter;
-import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
-
-
-public class FakeMetadataFacade extends BasicQueryMetadata {
-
- private FakeMetadataStore store;
- private FunctionLibrary functionLibrary;
-
- public FakeMetadataFacade(FakeMetadataStore store) {
- this.store = store;
- this.functionLibrary = FakeMetadataFactory.SFM.getSystemFunctionLibrary();
- }
-
- public FakeMetadataFacade(FakeMetadataStore store, FunctionLibrary funcLibrary) {
- this.store = store;
- this.functionLibrary = funcLibrary;
- }
-
- public FakeMetadataStore getStore() {
- return this.store;
- }
-
- public Object getElementID(String elementName)
- throws TeiidComponentException, QueryMetadataException {
-
- Assertion.isNotNull(elementName);
-
- Object obj = store.findObject(elementName, FakeMetadataObject.ELEMENT);
- if(obj == null) {
- throw new QueryMetadataException("Element '" + elementName + "' not found."); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return obj;
- }
-
- public Object getGroupID(String groupName)
- throws TeiidComponentException, QueryMetadataException {
-
- Assertion.isNotNull(groupName);
-
- Object result = store.findObject(groupName, FakeMetadataObject.GROUP);
- if (result == null){
- throw new QueryMetadataException("Group '" + groupName + "' not found."); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return result;
- }
-
- public Collection getGroupsForPartialName(String partialGroupName)
- throws TeiidComponentException, QueryMetadataException {
-
- if(partialGroupName == null) {
- throw new QueryMetadataException("Group name cannot be null"); //$NON-NLS-1$
- }
-
- String qualifiedPartialPart = "."+partialGroupName; //$NON-NLS-1$
-
- // get all groupNames present in metadata
- Collection groupNames = store.findObjects(FakeMetadataObject.GROUP, "dummy", null); //$NON-NLS-1$
-
- // these are the correct group names whose valid partially qualified
- // part this partial name is part of
- Collection correctGroups = new ArrayList();
- Iterator groupIter = groupNames.iterator();
- while(groupIter.hasNext()) {
- String groupName = ((FakeMetadataObject) groupIter.next()).getName();
- if(groupName.toLowerCase().endsWith(qualifiedPartialPart.toLowerCase())) {
- correctGroups.add(groupName);
- }
- }
-
- return correctGroups;
- }
-
- public Object getModelID(Object groupOrElementID)
- throws TeiidComponentException, QueryMetadataException {
-
- ArgCheck.isInstanceOf(FakeMetadataObject.class, groupOrElementID);
- FakeMetadataObject obj = (FakeMetadataObject) groupOrElementID;
- return obj.getProperty(FakeMetadataObject.Props.MODEL);
- }
-
- public String getInsertPlan(Object groupID)
- throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, groupID);
- FakeMetadataObject obj = (FakeMetadataObject) groupID;
- return (String) obj.getProperty(FakeMetadataObject.Props.INSERT_PROCEDURE);
- }
-
- public String getUpdatePlan(Object groupID)
- throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, groupID);
- FakeMetadataObject obj = (FakeMetadataObject) groupID;
- return (String) obj.getProperty(FakeMetadataObject.Props.UPDATE_PROCEDURE);
- }
-
- public String getDeletePlan(Object groupID)
- throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, groupID);
- FakeMetadataObject obj = (FakeMetadataObject) groupID;
- return (String) obj.getProperty(FakeMetadataObject.Props.DELETE_PROCEDURE);
- }
-
- public String getFullName(Object metadataID)
- throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, metadataID);
- return ((FakeMetadataObject)metadataID).getName();
- }
-
- @Override
- public String getName(Object metadataID) throws TeiidComponentException,
- QueryMetadataException {
- String name = getFullName(metadataID);
- Object groupID = getGroupIDForElementID(metadataID);
- boolean isXml = false;
- String groupFullName = null;
- if (groupID != null) {
- isXml = isXMLGroup(groupID);
- groupFullName = getFullName(groupID);
- }
-
- if (isXml) {
- name = name.substring(groupFullName.length() + 1);
- } else {
- //the logic about should work in either case,
- //but there is a lot of metadata to correct
- name = SingleElementSymbol.getShortName(name);
- }
- return name;
- }
-
- public List getElementIDsInGroupID(Object groupID)
- throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, groupID);
- List ids = store.findObjects(FakeMetadataObject.ELEMENT, FakeMetadataObject.Props.GROUP, groupID);
- Collections.sort(ids);
- return ids;
- }
-
- public Object getGroupIDForElementID(Object elementID)
- throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, elementID);
- FakeMetadataObject element = (FakeMetadataObject) elementID;
- return element.getProperty(FakeMetadataObject.Props.GROUP);
- }
-
- public String getElementType(Object elementID)
- throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, elementID);
- FakeMetadataObject element = (FakeMetadataObject) elementID;
- return (String) element.getProperty(FakeMetadataObject.Props.TYPE);
- }
-
- public Object getDefaultValue(Object elementID)
- throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, elementID);
- return ((FakeMetadataObject)elementID).getDefaultValue();
- }
-
- public boolean isVirtualGroup(Object groupID)
- throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, groupID);
- FakeMetadataObject group = (FakeMetadataObject) groupID;
- return Boolean.TRUE.equals(group.getProperty(FakeMetadataObject.Props.IS_VIRTUAL));
- }
-
- public boolean isVirtualModel(Object modelID)
- throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, modelID);
- FakeMetadataObject model = (FakeMetadataObject) modelID;
- return ((Boolean)model.getProperty(FakeMetadataObject.Props.IS_VIRTUAL)).booleanValue();
-
- }
-
- public QueryNode getVirtualPlan(Object groupID)
- throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, groupID);
- FakeMetadataObject group = (FakeMetadataObject) groupID;
- QueryNode queryNode = (QueryNode) group.getProperty(FakeMetadataObject.Props.PLAN);
- if (queryNode.getQuery() == null) {
- throw new QueryMetadataException("no query");//$NON-NLS-1$
- }
- return queryNode;
- }
-
- public boolean modelSupports(Object modelID, int supportConstant)
- throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, modelID);
- switch(supportConstant) {
- default:
- throw new QueryMetadataException("Unknown model support constant: " + supportConstant); //$NON-NLS-1$
- }
- }
-
- public boolean groupSupports(Object groupID, int groupConstant)
- throws TeiidComponentException,QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, groupID);
- FakeMetadataObject group = (FakeMetadataObject) groupID;
- Boolean supports = null;
- switch(groupConstant) {
- case SupportConstants.Group.UPDATE:
- supports = (Boolean) group.getProperty(FakeMetadataObject.Props.UPDATE);
- break;
- default:
- throw new QueryMetadataException("Unknown group support constant: " + groupConstant); //$NON-NLS-1$
- }
- return supports.booleanValue();
- }
-
- public boolean elementSupports(Object elementID, int elementConstant)
- throws TeiidComponentException,QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, elementID);
- FakeMetadataObject element = (FakeMetadataObject) elementID;
- Boolean supports = null;
- switch(elementConstant) {
- case SupportConstants.Element.NULL:
- supports = (Boolean) element.getProperty(FakeMetadataObject.Props.NULL);
- break;
- case SupportConstants.Element.NULL_UNKNOWN:
- supports = Boolean.FALSE;
- break;
- case SupportConstants.Element.SEARCHABLE_COMPARE:
- supports = (Boolean) element.getProperty(FakeMetadataObject.Props.SEARCHABLE_COMPARE);
- break;
- case SupportConstants.Element.SEARCHABLE_LIKE:
- supports = (Boolean) element.getProperty(FakeMetadataObject.Props.SEARCHABLE_LIKE);
- break;
- case SupportConstants.Element.SELECT:
- supports = (Boolean) element.getProperty(FakeMetadataObject.Props.SELECT);
- break;
- case SupportConstants.Element.UPDATE:
- supports = (Boolean) element.getProperty(FakeMetadataObject.Props.UPDATE);
- break;
- case SupportConstants.Element.DEFAULT_VALUE:
- Object defaultValue = element.getProperty(FakeMetadataObject.Props.DEFAULT_VALUE);
- if(defaultValue == null) {
- supports = Boolean.FALSE;
- } else if(defaultValue instanceof Boolean) {
- supports = (Boolean) defaultValue;
- } else {
- supports = Boolean.TRUE;
- }
- break;
- case SupportConstants.Element.AUTO_INCREMENT:
- supports = (Boolean) element.getProperty(FakeMetadataObject.Props.AUTO_INCREMENT);
- break;
- case SupportConstants.Element.CASE_SENSITIVE:
- supports = (Boolean) element.getProperty(FakeMetadataObject.Props.CASE_SENSITIVE);
- break;
- case SupportConstants.Element.SIGNED:
- supports = (Boolean) element.getProperty(FakeMetadataObject.Props.SIGNED);
- break;
- default:
- throw new QueryMetadataException("Unknown element support constant: " + elementConstant); //$NON-NLS-1$
- }
- if(supports != null) {
- return supports.booleanValue();
- }
- return false;
- }
-
- public int getMaxSetSize(Object modelID)
- throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, modelID);
- FakeMetadataObject model = (FakeMetadataObject) modelID;
- Integer maxSetSize = (Integer) model.getProperty(FakeMetadataObject.Props.MAX_SET_SIZE);
- if(maxSetSize == null) {
- return 100;
- }
- return maxSetSize.intValue();
- }
-
- public StoredProcedureInfo getStoredProcedureInfoForProcedure(String fullyQualifiedProcedureName)
- throws TeiidComponentException, QueryMetadataException {
-
- Assertion.isNotNull(fullyQualifiedProcedureName);
-
- FakeMetadataObject procedureID = store.findObject(fullyQualifiedProcedureName, FakeMetadataObject.PROCEDURE);
- if(procedureID == null) {
- throw new QueryMetadataException("Unknown stored procedure: " + fullyQualifiedProcedureName); //$NON-NLS-1$
- }
-
- StoredProcedureInfo procInfo = new StoredProcedureInfo();
- procInfo.setProcedureID(procedureID);
- procInfo.setModelID(procedureID.getProperty(FakeMetadataObject.Props.MODEL));
- procInfo.setQueryPlan((QueryNode)procedureID.getProperty(FakeMetadataObject.Props.PLAN));
- procInfo.setProcedureCallableName(fullyQualifiedProcedureName);
- procInfo.setUpdateCount(((Integer)procedureID.getProperty(FakeMetadataObject.Props.UPDATE_COUNT, new Integer(-1))).intValue());
-
- // Read params
- List params = (List) procedureID.getProperty(FakeMetadataObject.Props.PARAMS);
- List paramInfos = new ArrayList(params.size());
- Iterator iter = params.iterator();
- while(iter.hasNext()) {
- FakeMetadataObject param = (FakeMetadataObject) iter.next();
-
- String name = param.getName();
- if(name.indexOf(".") < 0) { //$NON-NLS-1$
- name = procedureID.getName() + "." + name; //$NON-NLS-1$
- }
-
- int index = ( (Integer) param.getProperty(FakeMetadataObject.Props.INDEX) ).intValue();
- int direction = ( (Integer) param.getProperty(FakeMetadataObject.Props.DIRECTION) ).intValue();
- String dataTypeName = (String) param.getProperty(FakeMetadataObject.Props.TYPE);
- Class dataTypeClass = DataTypeManager.getDataTypeClass(dataTypeName);
-
- SPParameter paramInfo = new SPParameter(index, direction, name);
- paramInfo.setParameterType(direction);
- paramInfo.setMetadataID(param);
- if(direction == ParameterInfo.RESULT_SET) {
- paramInfo.setClassType(java.sql.ResultSet.class);
- } else {
- paramInfo.setClassType(dataTypeClass);
- }
-
- FakeMetadataObject resultSet = (FakeMetadataObject)param.getProperty(FakeMetadataObject.Props.RESULT_SET);
- if(resultSet != null){
- Iterator iter2 = ((List)resultSet.getProperty(FakeMetadataObject.Props.COLUMNS)).iterator();
- while(iter2.hasNext()){
- ElementSymbol col = (ElementSymbol) iter2.next();
- paramInfo.addResultSetColumn(col.getName(), col.getType(), col.getMetadataID());
- }
- }
- paramInfos.add(paramInfo);
- }
-
- procInfo.setParameters(paramInfos);
-
- return procInfo;
- }
-
- /**
- * @see org.teiid.query.metadata.QueryMetadataInterface#getIndexesInGroup(java.lang.Object)
- */
- public Collection getIndexesInGroup(Object groupID)
- throws TeiidComponentException, QueryMetadataException {
- return getTypeOfKeysInGroup(groupID, FakeMetadataObject.TYPE_INDEX);
- }
-
- public Collection getUniqueKeysInGroup(Object groupID)
- throws TeiidComponentException, QueryMetadataException {
- return getTypeOfKeysInGroup(groupID, FakeMetadataObject.TYPE_PRIMARY_KEY);
- }
-
- /**
- * @see org.teiid.query.metadata.QueryMetadataInterface#getForeignKeysInGroup(java.lang.Object)
- */
- public Collection getForeignKeysInGroup(Object groupID)
- throws TeiidComponentException, QueryMetadataException {
- return getTypeOfKeysInGroup(groupID, FakeMetadataObject.TYPE_FOREIGN_KEY);
- }
-
- /**
- * @see org.teiid.query.metadata.QueryMetadataInterface#getPrimaryKeyIDForForeignKeyID(java.lang.Object)
- */
- public Object getPrimaryKeyIDForForeignKeyID(Object foreignKeyID)
- throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, foreignKeyID);
- FakeMetadataObject keyObj = (FakeMetadataObject) foreignKeyID;
- return keyObj.getProperty(FakeMetadataObject.Props.REFERENCED_KEY);
- }
-
- /**
- * @see org.teiid.query.metadata.QueryMetadataInterface#getElementIDsInIndex(java.lang.Object)
- */
- public List getElementIDsInIndex(Object index)
- throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, index);
- FakeMetadataObject keyObj = (FakeMetadataObject) index;
- return (List)keyObj.getProperty(FakeMetadataObject.Props.KEY_ELEMENTS);
- }
-
- public List getElementIDsInKey(Object keyID)
- throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, keyID);
- FakeMetadataObject keyObj = (FakeMetadataObject) keyID;
- return (List)keyObj.getProperty(FakeMetadataObject.Props.KEY_ELEMENTS);
- }
-
- /**
- * @see org.teiid.query.metadata.QueryMetadataInterface#getAccessPatternsInGroup(Object)
- */
- public Collection getAccessPatternsInGroup(Object groupID)
- throws TeiidComponentException, QueryMetadataException {
- return getTypeOfKeysInGroup(groupID, FakeMetadataObject.TYPE_ACCESS_PATTERN);
- }
-
- //Used to get either keys or access patterns
- private Collection getTypeOfKeysInGroup(Object groupID,
- final Integer KEY_TYPE) {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, groupID);
- FakeMetadataObject group = (FakeMetadataObject)groupID;
-
- Collection keys = (Collection)group.getProperty(FakeMetadataObject.Props.KEYS);
- if (keys == null){
- return Collections.EMPTY_LIST;
- }
-
- Collection keysOfType = new ArrayList(keys.size());
- Iterator keyIter = keys.iterator();
- while (keyIter.hasNext()) {
- FakeMetadataObject key = (FakeMetadataObject) keyIter.next();
- if (KEY_TYPE.equals(key.getProperty(FakeMetadataObject.Props.KEY_TYPE))){
- keysOfType.add(key);
- }
- }
-
- return keysOfType;
- }
-
- /**
- * @see org.teiid.query.metadata.QueryMetadataInterface#getElementIDsInAccessPattern(Object)
- */
- public List getElementIDsInAccessPattern(Object accessPattern)
- throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, accessPattern);
- FakeMetadataObject accessPatternObj = (FakeMetadataObject) accessPattern;
- return (List)accessPatternObj.getProperty(FakeMetadataObject.Props.KEY_ELEMENTS);
- }
-
- public MappingNode getMappingNode(Object groupID)
- throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, groupID);
- FakeMetadataObject group = (FakeMetadataObject) groupID;
- MappingDocument doc = (MappingDocument)group.getProperty(FakeMetadataObject.Props.PLAN);
- doc.setName(getFullName(groupID));
- return doc;
- }
-
- public boolean isXMLGroup(Object groupID) throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, groupID);
- FakeMetadataObject group = (FakeMetadataObject) groupID;
- Object plan = group.getProperty(FakeMetadataObject.Props.PLAN);
- if(plan == null) {
- return false;
- }
- return (plan instanceof MappingNode);
- }
-
- public String getVirtualDatabaseName() throws TeiidComponentException, QueryMetadataException {
- return "myvdb"; //$NON-NLS-1$
- }
-
- public boolean isTemporaryTable(Object groupID) throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, groupID);
- FakeMetadataObject group = (FakeMetadataObject) groupID;
- Boolean isTemp = (Boolean)group.getProperty(FakeMetadataObject.Props.TEMP);
- if(isTemp != null && isTemp.equals(Boolean.TRUE)) {
- return true;
- }
- return false;
- }
-
- public Collection getXMLTempGroups(Object groupID)
- throws TeiidComponentException, QueryMetadataException{
-
- ArgCheck.isInstanceOf(FakeMetadataObject.class, groupID);
- MappingDocument mappingDoc = (MappingDocument)((FakeMetadataObject)groupID).getProperty(FakeMetadataObject.Props.PLAN);
- List tempGroups = resolveGroups(getStagingTables(mappingDoc));
- return tempGroups;
- }
-
- List getStagingTables(MappingDocument doc) {
- final List tables = new ArrayList();
-
- // visitor to extract all the explicit staging tables.
- MappingVisitor visitor = new MappingVisitor() {
- public void visit(MappingBaseNode baseNode) {
- if (baseNode.getStagingTables() != null) {
- tables.addAll(baseNode.getStagingTables());
- }
- }
- };
- doc.acceptVisitor(new Navigator(true, visitor));
- return tables;
- }
-
-
- private List resolveGroups(List groupNames)
- throws QueryMetadataException, TeiidComponentException {
-
- if(groupNames != null && !groupNames.isEmpty()) {
- ArrayList tempGroups = new ArrayList();
- for(int i = 0; i < groupNames.size(); i++) {
- tempGroups.add(this.getGroupID((String)groupNames.get(i)));
- }
- return tempGroups;
- }
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @see org.teiid.query.metadata.QueryMetadataInterface#getCardinality(java.lang.Object)
- */
- public int getCardinality(Object groupID)
- throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, groupID);
- Integer cardinality = (Integer)((FakeMetadataObject)groupID).getProperty(FakeMetadataObject.Props.CARDINALITY);
- if (cardinality != null){
- return cardinality.intValue();
- }
- return QueryMetadataInterface.UNKNOWN_CARDINALITY;
- }
-
- public String getNameInSource(Object metadataID) throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, metadataID);
- return (String)((FakeMetadataObject)metadataID).getProperty(FakeMetadataObject.Props.NAME_IN_SOURCE);
- }
-
- public Properties getExtensionProperties(Object metadataID)
- throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, metadataID);
- return ((FakeMetadataObject)metadataID).getExtensionProps();
- }
-
- public int getElementLength(Object elementID) throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, elementID);
- FakeMetadataObject element = (FakeMetadataObject) elementID;
- return Integer.parseInt((String) element.getProperty(FakeMetadataObject.Props.LENGTH));
- }
-
- /**
- * Return position of element in group or result set. Position returned is 1-based!
- */
- public int getPosition(Object elementID) throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, elementID);
- FakeMetadataObject element = (FakeMetadataObject) elementID;
- return ((Integer) element.getProperty(FakeMetadataObject.Props.INDEX)).intValue() + 1;
- }
-
- public int getPrecision(Object elementID) throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, elementID);
- FakeMetadataObject element = (FakeMetadataObject) elementID;
- String precision = (String) element.getProperty(FakeMetadataObject.Props.PRECISION);
- if (precision == null) {
- return 0;
- }
- return Integer.parseInt(precision);
- }
-
- public int getRadix(Object elementID) throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, elementID);
- FakeMetadataObject element = (FakeMetadataObject) elementID;
- String radix = (String) element.getProperty(FakeMetadataObject.Props.RADIX);
- if (radix == null) {
- return 0;
- }
- return Integer.parseInt(radix);
- }
-
- public int getScale(Object elementID) throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, elementID);
- FakeMetadataObject element = (FakeMetadataObject) elementID;
- String scale = (String) element.getProperty(FakeMetadataObject.Props.SCALE);
- if (scale == null) {
- return 0;
- }
- return Integer.parseInt(scale);
- }
-
-
- public String getNativeType(Object elementID) throws TeiidComponentException,
- QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, elementID);
- FakeMetadataObject element = (FakeMetadataObject) elementID;
- String nativeType = (String) element.getProperty(FakeMetadataObject.Props.NATIVE_TYPE);
- if(nativeType == null) {
- return ""; //$NON-NLS-1$
- }
- return nativeType;
- }
-
- public boolean hasMaterialization(Object groupID) throws TeiidComponentException,
- QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, groupID);
- FakeMetadataObject group = (FakeMetadataObject)groupID;
- return group.getProperty(FakeMetadataObject.Props.MAT_GROUP) != null;
- }
-
- public Object getMaterialization(Object groupID) throws TeiidComponentException,
- QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, groupID);
- FakeMetadataObject group = (FakeMetadataObject) groupID;
- return group.getProperty(FakeMetadataObject.Props.MAT_GROUP);
- }
-
- public Object getMaterializationStage(Object groupID) throws TeiidComponentException,
- QueryMetadataException {
-
- ArgCheck.isInstanceOf(FakeMetadataObject.class, groupID);
- FakeMetadataObject group = (FakeMetadataObject) groupID;
- return group.getProperty(FakeMetadataObject.Props.MAT_STAGE);
- }
-
- public Object getMaximumValue(Object elementID) throws TeiidComponentException,
- QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, elementID);
- FakeMetadataObject element = (FakeMetadataObject) elementID;
- return element.getProperty(FakeMetadataObject.Props.MAX_VALUE);
- }
-
- public Object getMinimumValue(Object elementID) throws TeiidComponentException,
- QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, elementID);
- FakeMetadataObject element = (FakeMetadataObject) elementID;
- return element.getProperty(FakeMetadataObject.Props.MIN_VALUE);
- }
-
- public int getDistinctValues(Object elementID) throws TeiidComponentException,
- QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, elementID);
- FakeMetadataObject element = (FakeMetadataObject)elementID;
- Integer val = (Integer) element.getProperty(FakeMetadataObject.Props.DISTINCT_VALUES);
- if(val != null) {
- return val.intValue();
- }
- return -1;
- }
-
- public int getNullValues(Object elementID) throws TeiidComponentException,
- QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, elementID);
- FakeMetadataObject element = (FakeMetadataObject)elementID;
- Integer val = (Integer) element.getProperty(FakeMetadataObject.Props.NULL_VALUES);
- if(val != null) {
- return val.intValue();
- }
- return -1;
- }
-
- public List getXMLSchemas(Object groupID) throws TeiidComponentException,
- QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, groupID);
- FakeMetadataObject group = (FakeMetadataObject) groupID;
- return (List) group.getProperty(FakeMetadataObject.Props.XML_SCHEMAS);
- }
-
- public boolean isProcedure(Object elementID) {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, elementID);
- FakeMetadataObject element = (FakeMetadataObject) elementID;
- return FakeMetadataObject.PROCEDURE.equals(element.getType());
- }
-
- public byte[] getBinaryVDBResource(String resourcePath) throws TeiidComponentException, QueryMetadataException {
- return "ResourceContents".getBytes(); //$NON-NLS-1$
- }
-
- public String getCharacterVDBResource(String resourcePath) throws TeiidComponentException, QueryMetadataException {
- return "ResourceContents"; //$NON-NLS-1$
- }
-
- public String[] getVDBResourcePaths() throws TeiidComponentException, QueryMetadataException {
- return new String[] {"my/resource/path"}; //$NON-NLS-1$
- }
-
- /**
- * @see org.teiid.query.metadata.BasicQueryMetadata#getModeledType(java.lang.Object)
- * @since 5.0
- */
- public String getModeledType(Object elementID) throws TeiidComponentException,
- QueryMetadataException {
-
- ArgCheck.isInstanceOf(FakeMetadataObject.class, elementID);
- FakeMetadataObject element = (FakeMetadataObject) elementID;
- return (String) element.getProperty(FakeMetadataObject.Props.MODELED_TYPE);
- }
-
- /**
- * @see org.teiid.query.metadata.BasicQueryMetadata#getModeledBaseType(java.lang.Object)
- * @since 5.0
- */
- public String getModeledBaseType(Object elementID) throws TeiidComponentException,
- QueryMetadataException {
-
- ArgCheck.isInstanceOf(FakeMetadataObject.class, elementID);
- FakeMetadataObject element = (FakeMetadataObject) elementID;
- return (String) element.getProperty(FakeMetadataObject.Props.MODELED_BASE_TYPE);
- }
-
- /**
- * @see org.teiid.query.metadata.BasicQueryMetadata#getModeledPrimitiveType(java.lang.Object)
- * @since 5.0
- */
- public String getModeledPrimitiveType(Object elementID) throws TeiidComponentException,
- QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, elementID);
- FakeMetadataObject element = (FakeMetadataObject) elementID;
- return (String) element.getProperty(FakeMetadataObject.Props.MODELED_PRIMITIVE_TYPE);
- }
-
- @Override
- public Object addToMetadataCache(Object metadataID, String key, Object value)
- throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, metadataID);
- FakeMetadataObject object = (FakeMetadataObject) metadataID;
- synchronized (object) {
- Object result = object.getProperty(key);
- object.putProperty(key, value);
- return result;
- }
- }
-
- @Override
- public Object getFromMetadataCache(Object metadataID, String key)
- throws TeiidComponentException, QueryMetadataException {
- ArgCheck.isInstanceOf(FakeMetadataObject.class, metadataID);
- FakeMetadataObject object = (FakeMetadataObject) metadataID;
- synchronized (object) {
- return object.getProperty(key);
- }
- }
-
- @Override
- public FunctionLibrary getFunctionLibrary() {
- return this.functionLibrary;
- }
-
- @Override
- public Object getPrimaryKey(Object metadataID) {
- Collection keys = getTypeOfKeysInGroup(metadataID, FakeMetadataObject.TYPE_PRIMARY_KEY);
- if (!keys.isEmpty()) {
- return keys.iterator().next();
- }
- return null;
- }
-}
Deleted: branches/7.4.x/engine/src/test/java/org/teiid/query/unittest/FakeMetadataFactory.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/unittest/FakeMetadataFactory.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/unittest/FakeMetadataFactory.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -1,3039 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.query.unittest;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-
-import org.teiid.adminapi.Model;
-import org.teiid.adminapi.impl.ModelMetaData;
-import org.teiid.adminapi.impl.SessionMetadata;
-import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.api.exception.query.QueryMetadataException;
-import org.teiid.client.metadata.ParameterInfo;
-import org.teiid.core.TeiidComponentException;
-import org.teiid.core.types.DataTypeManager;
-import org.teiid.dqp.internal.process.DQPWorkContext;
-import org.teiid.metadata.Table;
-import org.teiid.query.function.SystemFunctionManager;
-import org.teiid.query.mapping.relational.QueryNode;
-import org.teiid.query.mapping.xml.MappingAttribute;
-import org.teiid.query.mapping.xml.MappingDocument;
-import org.teiid.query.mapping.xml.MappingElement;
-import org.teiid.query.mapping.xml.MappingSequenceNode;
-import org.teiid.query.metadata.QueryMetadataInterface;
-import org.teiid.query.metadata.TransformationMetadata;
-import org.teiid.query.sql.symbol.ElementSymbol;
-
-@SuppressWarnings("nls")
-public class FakeMetadataFactory {
-
- public static SystemFunctionManager SFM = new SystemFunctionManager();
- private static FakeMetadataFacade CACHED_EXAMPLE1 = example1();
- private static FakeMetadataFacade CACHED_AGGREGATES = exampleAggregates();
-
- private FakeMetadataFactory() { }
-
- public static FakeMetadataFacade example1Cached() {
- return CACHED_EXAMPLE1;
- }
-
- public static TransformationMetadata exampleBQTCached() {
- return RealMetadataFactory.exampleBQTCached();
- }
-
- public static void setCardinality(String group, int cardinality, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException {
- if (metadata instanceof TransformationMetadata) {
- Table t = (Table)metadata.getGroupID(group);
- t.setCardinality(cardinality);
- } else if (metadata instanceof FakeMetadataFacade) {
- FakeMetadataObject fmo = (FakeMetadataObject)metadata.getGroupID(group);
- fmo.putProperty(FakeMetadataObject.Props.CARDINALITY, cardinality);
- } else {
- throw new RuntimeException("unknown metadata"); //$NON-NLS-1$
- }
-
- }
-
- public static FakeMetadataFacade exampleAggregatesCached() {
- return CACHED_AGGREGATES;
- }
-
- public static DQPWorkContext buildWorkContext(TransformationMetadata metadata) {
- return buildWorkContext(metadata, metadata.getVdbMetaData());
- }
-
- public static DQPWorkContext buildWorkContext(QueryMetadataInterface metadata, VDBMetaData vdb) {
- DQPWorkContext workContext = new DQPWorkContext();
- SessionMetadata session = new SessionMetadata();
- workContext.setSession(session);
- session.setVDBName(vdb.getName());
- session.setVDBVersion(vdb.getVersion());
- session.setSessionId(String.valueOf(1));
- session.setUserName("foo"); //$NON-NLS-1$
- session.setVdb(vdb);
- workContext.getVDB().addAttchment(QueryMetadataInterface.class, metadata);
- if (metadata instanceof TransformationMetadata) {
- workContext.getVDB().addAttchment(TransformationMetadata.class, (TransformationMetadata)metadata);
- }
- DQPWorkContext.setWorkContext(workContext);
- return workContext;
- }
-
- public static FakeMetadataFacade exampleBitwise() {
- FakeMetadataObject phys = createPhysicalModel("phys"); //$NON-NLS-1$
- FakeMetadataObject t = createPhysicalGroup("phys.t", phys); //$NON-NLS-1$
- List tElem = createElements(t,
- new String[] { "ID", "Name", "source_bits" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
-
- FakeMetadataObject virt = createVirtualModel("virt"); //$NON-NLS-1$
- FakeMetadataObject rs = createResultSet("rs", virt, new String[] { "ID", "Name", "source_bits" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- FakeMetadataObject paramRS = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs); //$NON-NLS-1$
- QueryNode qn = new QueryNode("CREATE VIRTUAL PROCEDURE " //$NON-NLS-1$
- + "BEGIN " //$NON-NLS-1$
- + " DECLARE integer VARIABLES.BITS;" //$NON-NLS-1$
- + " create local temporary table #temp (id integer, name string, bits integer);" //$NON-NLS-1$
- + " LOOP ON (SELECT DISTINCT phys.t.ID, phys.t.Name FROM phys.t) AS idCursor" //$NON-NLS-1$
- + " BEGIN" //$NON-NLS-1$
- + " VARIABLES.BITS = 0;" //$NON-NLS-1$
- + " LOOP ON (SELECT phys.t.source_bits FROM phys.t WHERE phys.t.ID = idCursor.id) AS bitsCursor" //$NON-NLS-1$
- + " BEGIN" //$NON-NLS-1$
- + " VARIABLES.BITS = bitor(VARIABLES.BITS, bitsCursor.source_bits);" //$NON-NLS-1$
- + " END" //$NON-NLS-1$
- + " SELECT idCursor.id, idCursor.name, VARIABLES.BITS INTO #temp;" //$NON-NLS-1$
- + " END" //$NON-NLS-1$
- + " SELECT ID, Name, #temp.BITS AS source_bits FROM #temp;" //$NON-NLS-1$
- + "END"); //$NON-NLS-1$
- FakeMetadataObject proc = createVirtualProcedure("virt.agg", virt, Arrays.asList(new FakeMetadataObject[] { paramRS }), qn); //$NON-NLS-1$
-
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(phys);
- store.addObject(t);
- store.addObjects(tElem);
- store.addObject(virt);
- store.addObject(proc);
-
- return new FakeMetadataFacade(store);
-
- }
-
- public static VDBMetaData example1VDB() {
- VDBMetaData vdb = new VDBMetaData();
- vdb.setName("example1");
- vdb.setVersion(1);
- vdb.addModel(createModel("pm1", true));
- vdb.addModel(createModel("pm2", true));
- vdb.addModel(createModel("pm3", true));
- vdb.addModel(createModel("pm4", true));
- vdb.addModel(createModel("pm5", true));
- vdb.addModel(createModel("pm6", true));
- vdb.addModel(createModel("vm1", false));
- vdb.addModel(createModel("vm2", false));
- vdb.addModel(createModel("tm1", false));
-
- return vdb;
- }
-
- public static ModelMetaData createModel(String name, boolean source) {
- ModelMetaData model = new ModelMetaData();
- model.setName(name);
- if (source) {
- model.setModelType(Model.Type.PHYSICAL);
- }
- else {
- model.setModelType(Model.Type.VIRTUAL);
- }
- model.setVisible(true);
- model.setSupportsMultiSourceBindings(false);
- model.addSourceMapping(name, name, null);
-
- return model;
- }
-
- public static FakeMetadataFacade example1() {
- // Create models
- FakeMetadataObject pm1 = createPhysicalModel("pm1"); //$NON-NLS-1$
- FakeMetadataObject pm2 = createPhysicalModel("pm2"); //$NON-NLS-1$
- FakeMetadataObject pm3 = createPhysicalModel("pm3"); //allows push of SELECT DISTINCT //$NON-NLS-1$
- FakeMetadataObject pm4 = createPhysicalModel("pm4"); //all groups w/ access pattern(s) //$NON-NLS-1$
- FakeMetadataObject pm5 = createPhysicalModel("pm5"); //all groups w/ access pattern(s); model supports join //$NON-NLS-1$
- FakeMetadataObject pm6 = createPhysicalModel("pm6"); //model does not support where all //$NON-NLS-1$
- FakeMetadataObject vm1 = createVirtualModel("vm1"); //$NON-NLS-1$
- FakeMetadataObject vm2 = createVirtualModel("vm2"); //$NON-NLS-1$
- FakeMetadataObject tm1 = createVirtualModel("tm1"); //$NON-NLS-1$
-
- // Create physical groups
- FakeMetadataObject pm1g1 = createPhysicalGroup("pm1.g1", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g2 = createPhysicalGroup("pm1.g2", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g3 = createPhysicalGroup("pm1.g3", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g4 = createPhysicalGroup("pm1.g4", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g5 = createPhysicalGroup("pm1.g5", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g6 = createPhysicalGroup("pm1.g6", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1table = createPhysicalGroup("pm1.table1", pm1); //$NON-NLS-1$
- FakeMetadataObject pm2g1 = createPhysicalGroup("pm2.g1", pm2); //$NON-NLS-1$
- FakeMetadataObject pm2g2 = createPhysicalGroup("pm2.g2", pm2); //$NON-NLS-1$
- FakeMetadataObject pm2g3 = createPhysicalGroup("pm2.g3", pm2); //$NON-NLS-1$
- FakeMetadataObject pm3g1 = createPhysicalGroup("pm3.g1", pm3); //$NON-NLS-1$
- FakeMetadataObject pm3g2 = createPhysicalGroup("pm3.g2", pm3); //$NON-NLS-1$
- FakeMetadataObject pm4g1 = createPhysicalGroup("pm4.g1", pm4); //$NON-NLS-1$
- FakeMetadataObject pm4g2 = createPhysicalGroup("pm4.g2", pm4); //$NON-NLS-1$
- FakeMetadataObject pm5g1 = createPhysicalGroup("pm5.g1", pm5); //$NON-NLS-1$
- FakeMetadataObject pm5g2 = createPhysicalGroup("pm5.g2", pm5); //$NON-NLS-1$
- FakeMetadataObject pm5g3 = createPhysicalGroup("pm5.g3", pm5); //$NON-NLS-1$
- FakeMetadataObject pm6g1 = createPhysicalGroup("pm6.g1", pm6); //$NON-NLS-1$
-
-
- // Create physical elements
- List pm1g1e = createElements(pm1g1,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm1g2e = createElements(pm1g2,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm1g3e = createElements(pm1g3,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm1g4e = createElements(pm1g4,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- ((FakeMetadataObject)pm1g4e.get(1)).putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- ((FakeMetadataObject)pm1g4e.get(3)).putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- List pm1g5e = createElements(pm1g5,
- new String[] { "e1" }, //$NON-NLS-1$
- new String[] { DataTypeManager.DefaultDataTypes.STRING });
- ((FakeMetadataObject)pm1g5e.get(0)).putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- List pm1g6e = createElements(pm1g6,
- new String[] { "in", "in3" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- List pm1tablee = createElements(pm1table,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm2g1e = createElements(pm2g1,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm2g2e = createElements(pm2g2,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm2g3e = createElements(pm2g3,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm3g1e = createElements(pm3g1,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DATE, DataTypeManager.DefaultDataTypes.TIME, DataTypeManager.DefaultDataTypes.TIMESTAMP });
- List pm3g2e = createElements(pm3g2,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DATE, DataTypeManager.DefaultDataTypes.TIME, DataTypeManager.DefaultDataTypes.TIMESTAMP });
- List pm4g1e = createElements(pm4g1,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm4g2e = createElements(pm4g2,
- new String[] { "e1", "e2", "e3", "e4", "e5", "e6" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
- List pm5g1e = createElements(pm5g1,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm5g2e = createElements(pm5g2,
- new String[] { "e1", "e2", "e3", "e4", "e5", "e6" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
- List pm5g3e = createElements(pm5g3,
- new String[] { "e1", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.SHORT });
- List pm6g1e = createElements(pm6g1,
- new String[] { "e1", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
-
-
- // Create access patterns - pm4
- List elements = new ArrayList(1);
- elements.add(pm4g1e.iterator().next());
- FakeMetadataObject pm4g1ap1 = createAccessPattern("pm4.g1.ap1", pm4g1, elements); //e1 //$NON-NLS-1$
- elements = new ArrayList(2);
- Iterator iter = pm4g2e.iterator();
- elements.add(iter.next());
- elements.add(iter.next());
- FakeMetadataObject pm4g2ap1 = createAccessPattern("pm4.g2.ap1", pm4g2, elements); //e1,e2 //$NON-NLS-1$
- elements = new ArrayList(1);
- elements.add(pm4g2e.get(4)); //"e5"
- FakeMetadataObject pm4g2ap2 =createAccessPattern("pm4.g2.ap2", pm4g2, elements); //e5 //$NON-NLS-1$
- // Create access patterns - pm5
- elements = new ArrayList(1);
- elements.add(pm5g1e.iterator().next());
- FakeMetadataObject pm5g1ap1 = createAccessPattern("pm5.g1.ap1", pm5g1, elements); //e1 //$NON-NLS-1$
- elements = new ArrayList(2);
- iter = pm5g2e.iterator();
- elements.add(iter.next());
- elements.add(iter.next());
- FakeMetadataObject pm5g2ap1 = createAccessPattern("pm5.g2.ap1", pm5g2, elements); //e1,e2 //$NON-NLS-1$
- elements = new ArrayList(1);
- elements.add(pm5g2e.get(4)); //"e5"
- FakeMetadataObject pm5g2ap2 = createAccessPattern("pm5.g2.ap2", pm5g2, elements); //e5 //$NON-NLS-1$
-
- // Create temp groups
- FakeMetadataObject tm1g1 = createTempGroup("tm1.g1", tm1, null); //$NON-NLS-1$
-
- // Create temp elements - the element "node1" is purposely named to be ambiguous with a document node named "node1"
- List tm1g1e = createElements(tm1g1,
- new String[] { "e1", "e2", "e3", "e4", "node1"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.STRING });
-
- // Create temp groups
- FakeMetadataObject tm1g2 = createTempGroup("tm1.g1", tm1, null); //$NON-NLS-1$
-
- // Create temp elements
- List tm1g2e = createElements(tm1g2,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
-
- // Create virtual groups
- QueryNode vm1g1n1 = new QueryNode("SELECT * FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g1 = createUpdatableVirtualGroup("vm1.g1", vm1, vm1g1n1); //$NON-NLS-1$
-
- QueryNode vm2g1n1 = new QueryNode("SELECT pm1.g1.* FROM pm1.g1, pm1.g2 where pm1.g1.e2 = pm1.g2.e2"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm2g1 = FakeMetadataFactory.createUpdatableVirtualGroup("vm2.g1", vm2, vm2g1n1); //$NON-NLS-1$
-
- QueryNode vm1g1n1_defect10711 = new QueryNode("SELECT * FROM vm1.g1 as X"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g1_defect10711 = createVirtualGroup("vm1.g1a", vm1, vm1g1n1_defect10711); //$NON-NLS-1$
-
- QueryNode vm1g1n1_defect12081 = new QueryNode("SELECT e1, upper(e1) as e1Upper FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g1_defect12081 = createVirtualGroup("vm1.g1b", vm1, vm1g1n1_defect12081); //$NON-NLS-1$
-
- QueryNode vm1g1n1c = new QueryNode("SELECT PARSETIMESTAMP(pm1.g1.e1, 'MMM dd yyyy hh:mm:ss') as e5, e2, e3, e4 FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g1c = createVirtualGroup("vm1.g1c", vm1, vm1g1n1c); //$NON-NLS-1$
-
- QueryNode vm1g2an1 = new QueryNode("SELECT * FROM pm1.g2"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g2a = createVirtualGroup("vm1.g2a", vm1, vm1g2an1); //$NON-NLS-1$
-
- QueryNode vm1g2n1 = new QueryNode("SELECT pm1.g1.e1, pm1.g1.e2, pm1.g2.e3, pm1.g2.e4 FROM pm1.g1, pm1.g2 WHERE pm1.g1.e1=pm1.g2.e1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g2 = createVirtualGroup("vm1.g2", vm1, vm1g2n1); //$NON-NLS-1$
-
- QueryNode vm1g4n1 = new QueryNode("SELECT e1 FROM pm1.g1 UNION ALL SELECT convert(e2, string) as x FROM pm1.g2 ORDER BY e1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g4 = createVirtualGroup("vm1.g4", vm1, vm1g4n1); //$NON-NLS-1$
-
- QueryNode vm1g5n1 = new QueryNode("SELECT concat(e1, 'val'), e2 FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g5 = createVirtualGroup("vm1.g5", vm1, vm1g5n1); //$NON-NLS-1$
-
- QueryNode vm1g6n1 = new QueryNode("SELECT concat(e1, 'val') AS e, e2 FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g6 = createVirtualGroup("vm1.g6", vm1, vm1g6n1); //$NON-NLS-1$
-
- QueryNode vm1g7n1 = new QueryNode("SELECT concat(e1, e2) AS e, e2 FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g7 = createVirtualGroup("vm1.g7", vm1, vm1g7n1); //$NON-NLS-1$
-
- QueryNode vm1g8n1 = new QueryNode("SELECT concat(e1, 'val') AS e, e2 FROM pm1.g1 ORDER BY e"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g8 = createVirtualGroup("vm1.g8", vm1, vm1g8n1); //$NON-NLS-1$
-
- QueryNode vm1g9n1 = new QueryNode("SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1, pm4.g1 WHERE pm1.g1.e1 = pm4.g1.e1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g9 = createVirtualGroup("vm1.g9", vm1, vm1g9n1); //$NON-NLS-1$
-
- QueryNode vm1g10n1 = new QueryNode("SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1, pm4.g2 WHERE pm1.g1.e1 = pm4.g2.e1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g10 = createVirtualGroup("vm1.g10", vm1, vm1g10n1); //$NON-NLS-1$
-
- QueryNode vm1g11n1 = new QueryNode("SELECT * FROM pm4.g2"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g11 = createVirtualGroup("vm1.g11", vm1, vm1g11n1); //$NON-NLS-1$
-
- QueryNode vm1g12n1 = new QueryNode("SELECT DISTINCT * FROM pm3.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g12 = createVirtualGroup("vm1.g12", vm1, vm1g12n1); //$NON-NLS-1$
-
- QueryNode vm1g13n1 = new QueryNode("SELECT DISTINCT * FROM pm3.g1 ORDER BY e1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g13 = createVirtualGroup("vm1.g13", vm1, vm1g13n1); //$NON-NLS-1$
-
- QueryNode vm1g14n1 = new QueryNode("SELECT * FROM pm3.g1 ORDER BY e1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g14 = createVirtualGroup("vm1.g14", vm1, vm1g14n1); //$NON-NLS-1$
-
- QueryNode vm1g15n1 = new QueryNode("SELECT e1, concat(e1, convert(e2, string)) AS x FROM pm3.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g15 = createVirtualGroup("vm1.g15", vm1, vm1g15n1); //$NON-NLS-1$
-
- QueryNode vm1g16n1 = new QueryNode("SELECT concat(e1, 'val') AS e, e2 FROM pm3.g1 ORDER BY e"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g16 = createVirtualGroup("vm1.g16", vm1, vm1g16n1); //$NON-NLS-1$
-
- QueryNode vm1g17n1 = new QueryNode("SELECT pm3.g1.e1, pm3.g1.e2 FROM pm3.g1 UNION ALL SELECT pm3.g2.e1, pm3.g2.e2 FROM pm3.g2 ORDER BY e2"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g17 = createVirtualGroup("vm1.g17", vm1, vm1g17n1); //$NON-NLS-1$
-
- QueryNode vm1g18n1 = new QueryNode("SELECT (e4 * 100.0) as x FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g18 = createVirtualGroup("vm1.g18", vm1, vm1g18n1); //$NON-NLS-1$
-
- // Transformations with subqueries and correlated subqueries
- QueryNode vm1g19n1 = new QueryNode("Select * from vm1.g4 where not (e1 in (select e1 FROM vm1.g1 WHERE vm1.g4.e1 = e1))"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g19 = createVirtualGroup("vm1.g19", vm1, vm1g19n1); //$NON-NLS-1$
-
- QueryNode vm1g20n1 = new QueryNode("Select * from vm1.g1 where exists (select e1 FROM vm1.g2 WHERE vm1.g1.e1 = e1)"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g20 = createVirtualGroup("vm1.g20", vm1, vm1g20n1); //$NON-NLS-1$
-
- QueryNode vm1g21n1 = new QueryNode("Select * from pm1.g1 where exists (select e1 FROM pm2.g1 WHERE pm1.g1.e1 = e1)"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g21 = createVirtualGroup("vm1.g21", vm1, vm1g21n1); //$NON-NLS-1$
-
- QueryNode vm1g22n1 = new QueryNode("Select e1, e2, e3, e4, (select e4 FROM vm1.g21 WHERE vm1.g20.e4 = e4 and e4 = 7.0) as E5 from vm1.g20"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g22 = createVirtualGroup("vm1.g22", vm1, vm1g22n1); //$NON-NLS-1$
-
- QueryNode vm1g23n1 = new QueryNode("Select e1, e2, e3, e4, (select e4 FROM vm1.g21 WHERE vm1.g20.e4 = 7.0 and e4 = 7.0) as E5 from vm1.g20"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g23 = createVirtualGroup("vm1.g23", vm1, vm1g23n1); //$NON-NLS-1$
-
- QueryNode vm1g24n1 = new QueryNode("Select * from vm1.g20 where exists (select * FROM vm1.g21 WHERE vm1.g20.e4 = E4)"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g24 = createVirtualGroup("vm1.g24", vm1, vm1g24n1); //$NON-NLS-1$
-
- QueryNode vm1g25n1 = new QueryNode("Select e1, e2, e3, e4, (select e4 FROM pm1.g2 WHERE e1 = 'b') as E5 from pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g25 = createVirtualGroup("vm1.g25", vm1, vm1g25n1); //$NON-NLS-1$
-
- QueryNode vm1g26n1 = new QueryNode("Select e1, e2, e3, e4, (select e4 FROM pm1.g2 WHERE e4 = pm1.g1.e4 and e1 = 'b') as E5 from pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g26 = createVirtualGroup("vm1.g26", vm1, vm1g26n1); //$NON-NLS-1$
-
- //defect 10976
-// QueryNode vm1g27n1 = new QueryNode("vm1.g27", "SELECT DISTINCT x as a, lower(e1) as x FROM vm1.g28"); //$NON-NLS-1$ //$NON-NLS-2$
- QueryNode vm1g27n1 = new QueryNode("SELECT upper(e1) as x, e1 FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g27 = createVirtualGroup("vm1.g27", vm1, vm1g27n1); //$NON-NLS-1$
-
- QueryNode vm1g28n1 = new QueryNode("SELECT DISTINCT x as a, lower(e1) as x FROM vm1.g27"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g28 = createVirtualGroup("vm1.g28", vm1, vm1g28n1); //$NON-NLS-1$
-
- QueryNode vm1g29n1 = new QueryNode("SELECT DISTINCT x, lower(e1) FROM vm1.g27"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g29 = createVirtualGroup("vm1.g29", vm1, vm1g29n1); //$NON-NLS-1$
-
- QueryNode vm1g30n1 = new QueryNode("SELECT DISTINCT e1 as x, e1 as y FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g30 = createVirtualGroup("vm1.g30", vm1, vm1g30n1); //$NON-NLS-1$
-
- QueryNode vm1g31n1 = new QueryNode("SELECT e1 as x, e1 as y FROM pm1.g1 ORDER BY x"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g31 = createVirtualGroup("vm1.g31", vm1, vm1g31n1); //$NON-NLS-1$
-
- QueryNode vm1g32n1 = new QueryNode("SELECT DISTINCT e1 as x, e1 as y FROM pm1.g1 ORDER BY x"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g32 = createVirtualGroup("vm1.g32", vm1, vm1g32n1); //$NON-NLS-1$
-
- QueryNode vm1g33n1 = new QueryNode("SELECT e2 FROM pm1.g1 WHERE 2 = e2"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g33 = createVirtualGroup("vm1.g33", vm1, vm1g33n1); //$NON-NLS-1$
-
- QueryNode vm1g34n1 = new QueryNode("SELECT e1 as e1_, e2 as e2_ FROM pm1.g1 UNION ALL SELECT e1 as e1_, e2 as e2_ FROM pm2.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g34 = createVirtualGroup("vm1.g34", vm1, vm1g34n1); //$NON-NLS-1$
-
- QueryNode vm1g36n1 = new QueryNode("SELECT pm1.g1.e1 as ve1, pm1.g2.e1 as ve2 FROM pm1.g1 LEFT OUTER JOIN /* optional */ pm1.g2 on pm1.g1.e1 = pm1.g2.e1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g36 = createVirtualGroup("vm1.g36", vm1, vm1g36n1); //$NON-NLS-1$
-
- QueryNode vm1g37n1 = new QueryNode("SELECT * from pm4.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g37 = createVirtualGroup("vm1.g37", vm1, vm1g37n1); //$NON-NLS-1$
- vm1g37.putProperty(FakeMetadataObject.Props.UPDATE, Boolean.TRUE);
-
- QueryNode vm1g38n1 = new QueryNode("SELECT a.e1, b.e2 from pm1.g1 as a, pm6.g1 as b where a.e1=b.e1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g38 = createVirtualGroup("vm1.g38", vm1, vm1g38n1); //$NON-NLS-1$
-
- // Create virtual groups
- QueryNode vm1g39n1 = new QueryNode("SELECT * FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g39 = createUpdatableVirtualGroup("vm1.g39", vm1, vm1g39n1, "CREATE PROCEDURE BEGIN LOOP ON (SELECT pm1.g1.e2 FROM pm1.g1 where pm1.g1.e2=3) AS mycursor begin update pm1.g1 set pm1.g1.e1 = input.e1 where pm1.g1.e1 = input.e1; ROWS_UPDATED = ROWS_UPDATED + ROWCOUNT;\nupdate pm1.g1 set pm1.g1.e2 = input.e2 where pm1.g1.e2 = input.e2; END END"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Create virtual elements
- List vm1g39e = createElements(vm1g39,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g1e = createElements(vm1g1,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm2g1e = FakeMetadataFactory.createElements(vm2g1,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g1e_defect10711 = createElements(vm1g1_defect10711,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g1e_defect12081 = createElements(vm1g1_defect12081,
- new String[] { "e1", "e1Upper" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- List vm1g1ce = createElements(vm1g1c,
- new String[] { "e5", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.TIMESTAMP, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g2ae = createElements(vm1g2a,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g2e = createElements(vm1g2,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g4e = createElements(vm1g4,
- new String[] { "e1" }, //$NON-NLS-1$
- new String[] { DataTypeManager.DefaultDataTypes.STRING });
- List vm1g5e = createElements(vm1g5,
- new String[] { "expr", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
- List vm1g6e = createElements(vm1g6,
- new String[] { "e", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
- List vm1g7e = createElements(vm1g7,
- new String[] { "e", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
- List vm1g8e = createElements(vm1g8,
- new String[] { "e", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
- List vm1g9e = createElements(vm1g9,
- new String[] { "e1", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
- List vm1g10e = createElements(vm1g10,
- new String[] { "e1", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
- List vm1g11e = createElements(vm1g11,
- new String[] { "e1", "e2", "e3", "e4", "e5", "e6"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
- List vm1g12e = createElements(vm1g12,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DATE, DataTypeManager.DefaultDataTypes.TIME, DataTypeManager.DefaultDataTypes.TIMESTAMP });
- List vm1g13e = createElements(vm1g13,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DATE, DataTypeManager.DefaultDataTypes.TIME, DataTypeManager.DefaultDataTypes.TIMESTAMP });
- List vm1g14e = createElements(vm1g14,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DATE, DataTypeManager.DefaultDataTypes.TIME, DataTypeManager.DefaultDataTypes.TIMESTAMP });
- List vm1g15e = createElements(vm1g15,
- new String[] { "e1", "x" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- List vm1g16e = createElements(vm1g16,
- new String[] { "e", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DATE });
- List vm1g17e = createElements(vm1g17,
- new String[] { "e1", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DATE });
- List vm1g18e = createElements(vm1g18,
- new String[] { "x" }, //$NON-NLS-1$
- new String[] { DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g19e = createElements(vm1g19,
- new String[] { "e1" }, //$NON-NLS-1$
- new String[] { DataTypeManager.DefaultDataTypes.STRING });
- List vm1g20e = createElements(vm1g20,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g21e = createElements(vm1g21,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g22e = createElements(vm1g22,
- new String[] { "e1", "e2", "e3", "e4", "e5" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g23e = createElements(vm1g23,
- new String[] { "e1", "e2", "e3", "e4", "e5" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g24e = createElements(vm1g24,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g25e = createElements(vm1g25,
- new String[] { "e1", "e2", "e3", "e4", "e5" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g26e = createElements(vm1g26,
- new String[] { "e1", "e2", "e3", "e4", "e5" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g27e = createElements(vm1g27,
- new String[] { "x", "e1"}, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- List vm1g28e = createElements(vm1g28,
- new String[] { "a", "x"}, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- List vm1g29e = createElements(vm1g29,
- new String[] { "x", "expr"}, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- List vm1g30e = createElements(vm1g30,
- new String[] { "x", "y"}, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- List vm1g31e = createElements(vm1g31,
- new String[] { "x", "y"}, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- List vm1g32e = createElements(vm1g32,
- new String[] { "x", "y"}, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- List vm1g33e = createElements(vm1g33,
- new String[] { "e2"}, //$NON-NLS-1$
- new String[] { DataTypeManager.DefaultDataTypes.INTEGER });
- List vm1g34e = createElements(vm1g34,
- new String[] { "e1_", "e2_"}, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
- List vm1g36e = createElements(vm1g36,
- new String[] { "ve1", "ve2" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- List vm1g37e = createElements(vm1g37,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g38e = createElements(vm1g38,
- new String[] { "e1", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
-
- //Create access patterns on vm1.g37
- elements = new ArrayList(1);
- elements.add(vm1g37e.iterator().next());
- FakeMetadataObject vm1g37ap1 = createAccessPattern("vm1.g37.ap1", vm1g37, elements); //e1 //$NON-NLS-1$
-
- //XML STUFF =============================================
- FakeMetadataObject doc1 = FakeMetadataFactory.createVirtualGroup("xmltest.doc1", vm1, exampleDoc1()); //$NON-NLS-1$
- FakeMetadataObject doc2 = FakeMetadataFactory.createVirtualGroup("xmltest.doc2", vm1, exampleDoc2()); //$NON-NLS-1$
- FakeMetadataObject doc3 = FakeMetadataFactory.createVirtualGroup("xmltest.doc3", vm1, exampleDoc3()); //$NON-NLS-1$
- FakeMetadataObject doc4 = FakeMetadataFactory.createVirtualGroup("xmltest.doc4", vm1, exampleDoc4()); //$NON-NLS-1$
- FakeMetadataObject doc5 = FakeMetadataFactory.createVirtualGroup("xmltest.doc5", vm1, exampleDoc5()); //$NON-NLS-1$
- FakeMetadataObject doc6 = FakeMetadataFactory.createVirtualGroup("xmltest.doc6", vm1, exampleDoc6()); //$NON-NLS-1$
-
- // Defect 11479 - test ambiguous doc short names
- FakeMetadataObject docAmbiguous1 = FakeMetadataFactory.createVirtualGroup("xmltest2.docA", vm1, exampleDoc1()); //$NON-NLS-1$
- FakeMetadataObject docAmbiguous2 = FakeMetadataFactory.createVirtualGroup("xmltest3.docA", vm1, exampleDoc2()); //$NON-NLS-1$
-
- List docE1 = createElements(doc1, new String[] { "root", "root.node1", "root.node1.node2", "root.node1.node2.node3" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- List docE2 = createElements(doc2, new String[] { "root", "root.node1", "root.node1.node3" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- List docE3 = createElements(doc3, new String[] { "root", "root.node1.node2", "root.node2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- List docE4 = createElements(doc4, new String[] { "root", "root.@node6", "root.node1", "root.node1.@node2", "root.node3", "root.node3.@node4", "root.node3.node4", "root.node3.root.node6" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- Collection tempGroups = new HashSet();
- tempGroups.add(tm1g1);
- doc4.putProperty("TEMP_GROUPS", tempGroups); //$NON-NLS-1$
- List docE5 = createElements(doc5, new String[] { "root", "root.node1", "root.node1.node2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
-
- // Create mapping classes for xmltest.doc5
- QueryNode mc1n1 = new QueryNode("SELECT e1 FROM pm1.g1 UNION ALL SELECT e1 FROM pm1.g2"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1mc1 = createVirtualGroup("xmltest.mc1", vm1, mc1n1); //$NON-NLS-1$
- List vm1mc1e = createElements(vm1mc1,
- new String[] { "e1" }, //$NON-NLS-1$
- new String[] { DataTypeManager.DefaultDataTypes.STRING });
-
- List docE6 = createElements(doc6, new String[] { "root", "root.node", "root.thenode" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
-
- //XML STUFF =============================================
-
- // Procedures and stored queries
- FakeMetadataObject rs1 = createResultSet("pm1.rs1", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs1p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs1); //$NON-NLS-1$
- QueryNode sq1n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq1 = createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { rs1p1 }), sq1n1); //$NON-NLS-1$
-
- FakeMetadataObject rs2 = createResultSet("pm1.rs2", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs2p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq2.in; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq2 = createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- FakeMetadataObject rs5 = createResultSet("pm1.r5", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs5p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs5); //$NON-NLS-1$
- FakeMetadataObject rs5p2 = createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- FakeMetadataObject rs5p3 = createParameter("in2", 3, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode sq3n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq3.in UNION ALL SELECT e1, e2 FROM pm1.g1 WHERE e2=pm1.sq3.in2; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq3 = createVirtualProcedure("pm1.sq3", pm1, Arrays.asList(new FakeMetadataObject[] { rs5p1, rs5p2, rs5p3 }), sq3n1); //$NON-NLS-1$
-
- //For defect 8211 - this stored query has two input params, no return param, and
- //the input params are PURPOSELY numbered with indices "1" and "3" - see defect 8211
- FakeMetadataObject rs5a = createResultSet("pm1.r5a", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs5p1a = createParameter("in", 1, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- FakeMetadataObject rs5p2a = createParameter("in2", 3, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode sq3n1a = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq3a.in UNION ALL SELECT e1, e2 FROM pm1.g1 WHERE e2=pm1.sq3a.in2; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq3a = createVirtualProcedure("pm1.sq3a", pm1, Arrays.asList(new FakeMetadataObject[] { rs5p1a, rs5p2a }), sq3n1a); //$NON-NLS-1$
-
- //Case 3281 - create procedures with optional parameter(s)
-
- //make "in2" parameter optional, make "in3" required but with a default value
- FakeMetadataObject rs5b = createResultSet("pm1.r5b", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs5p1b = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs5b); //$NON-NLS-1$
- FakeMetadataObject rs5p2b = createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- FakeMetadataObject rs5p3b = createParameter("in2", 3, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- FakeMetadataObject rs5p4b = createParameter("in3", 4, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- rs5p3b.putProperty(FakeMetadataObject.Props.NULL, Boolean.TRUE);
- rs5p4b.setDefaultValue("YYZ"); //$NON-NLS-1$
- QueryNode sq3n1b = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq3b.in UNION ALL SELECT e1, e2 FROM pm1.g1 WHERE e2=pm1.sq3b.in2; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq3b = createVirtualProcedure("pm1.sq3b", pm1, Arrays.asList(new FakeMetadataObject[] { rs5p1b, rs5p2b, rs5p3b, rs5p4b }), sq3n1b); //$NON-NLS-1$
-
- //Make parameters of all different types, all with appropriate default values
- //Make some parameters required, some optional
- //Also, fully-qualify the param names
- FakeMetadataObject rsDefaults = createResultSet("pm1.rDefaults", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rsDefaultsParameterReturn = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rsDefaults); //$NON-NLS-1$
- FakeMetadataObject rsDefaultsParameterString = createParameter("inString", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- //rsDefaultsParameterString.putProperty(FakeMetadataObject.Props.NULL, Boolean.TRUE);
- rsDefaultsParameterString.setDefaultValue(new String("x")); //$NON-NLS-1$
- FakeMetadataObject rsParameterBigDecimal = createParameter("inBigDecimal", 3, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.BIG_DECIMAL, null); //$NON-NLS-1$
- rsParameterBigDecimal.putProperty(FakeMetadataObject.Props.NULL, Boolean.TRUE);
- rsParameterBigDecimal.setDefaultValue(new String("13.0")); //$NON-NLS-1$
- FakeMetadataObject rsParameterBigInteger = createParameter("inBigInteger", 4, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.BIG_INTEGER, null); //$NON-NLS-1$
- rsParameterBigInteger.putProperty(FakeMetadataObject.Props.NULL, Boolean.TRUE);
- rsParameterBigInteger.setDefaultValue(new String("13")); //$NON-NLS-1$
- FakeMetadataObject rsParameterBoolean = createParameter("inBoolean", 5, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.BOOLEAN, null); //$NON-NLS-1$
- rsParameterBoolean.putProperty(FakeMetadataObject.Props.NULL, Boolean.TRUE);
- rsParameterBoolean.setDefaultValue(new String("True")); //$NON-NLS-1$
- FakeMetadataObject rsParameterByte = createParameter("inByte", 6, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.BYTE, null); //$NON-NLS-1$
- rsParameterByte.putProperty(FakeMetadataObject.Props.NULL, Boolean.TRUE);
- rsParameterByte.setDefaultValue(new String("1")); //$NON-NLS-1$
- FakeMetadataObject rsParameterChar = createParameter("inChar", 7, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.CHAR, null); //$NON-NLS-1$
- rsParameterChar.putProperty(FakeMetadataObject.Props.NULL, Boolean.TRUE);
- rsParameterChar.setDefaultValue(new String("q")); //$NON-NLS-1$
- FakeMetadataObject rsParameterDate = createParameter("inDate", 8, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.DATE, null); //$NON-NLS-1$
- rsParameterDate.putProperty(FakeMetadataObject.Props.NULL, Boolean.TRUE);
- rsParameterDate.setDefaultValue(new String("2003-03-20")); //$NON-NLS-1$
- FakeMetadataObject rsParameterDouble = createParameter("inDouble", 9, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.DOUBLE, null); //$NON-NLS-1$
- rsParameterDouble.putProperty(FakeMetadataObject.Props.NULL, Boolean.TRUE);
- rsParameterDouble.setDefaultValue(new String("13.0")); //$NON-NLS-1$
- FakeMetadataObject rsParameterFloat = createParameter("inFloat", 10, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.FLOAT, null); //$NON-NLS-1$
- rsParameterFloat.putProperty(FakeMetadataObject.Props.NULL, Boolean.TRUE);
- rsParameterFloat.setDefaultValue(new String("13")); //$NON-NLS-1$
- FakeMetadataObject rsParameterInteger = createParameter("inInteger", 11, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- rsParameterInteger.putProperty(FakeMetadataObject.Props.NULL, Boolean.TRUE);
- rsParameterInteger.setDefaultValue(new String("13")); //$NON-NLS-1$
- FakeMetadataObject rsParameterLong = createParameter("inLong", 12, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.LONG, null); //$NON-NLS-1$
- rsParameterLong.putProperty(FakeMetadataObject.Props.NULL, Boolean.TRUE);
- rsParameterLong.setDefaultValue(new String("13")); //$NON-NLS-1$
- FakeMetadataObject rsParameterShort = createParameter("inShort", 13, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.SHORT, null); //$NON-NLS-1$
- rsParameterShort.putProperty(FakeMetadataObject.Props.NULL, Boolean.TRUE);
- rsParameterShort.setDefaultValue(new String("13")); //$NON-NLS-1$
- FakeMetadataObject rsParameterTimestamp = createParameter("inTimestamp", 14, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.TIMESTAMP, null); //$NON-NLS-1$
- rsParameterTimestamp.putProperty(FakeMetadataObject.Props.NULL, Boolean.TRUE);
- rsParameterTimestamp.setDefaultValue(new String("2003-03-20 21:26:00.000000")); //$NON-NLS-1$
- FakeMetadataObject rsParameterTime = createParameter("inTime", 15, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.TIME, null); //$NON-NLS-1$
- rsParameterTime.putProperty(FakeMetadataObject.Props.NULL, Boolean.TRUE);
- rsParameterTime.setDefaultValue(new String("21:26:00")); //$NON-NLS-1$
- QueryNode sqDefaultsNode = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sqDefaults.inString UNION ALL SELECT e1, e2 FROM pm1.g1 WHERE e2=pm1.sqDefaults.inInteger; END"); //$NON-NLS-1$ //$NON-NLS-2$
-
- FakeMetadataObject sqDefaults = createVirtualProcedure("pm1.sqDefaults", pm1, //$NON-NLS-1$
- Arrays.asList(new FakeMetadataObject[] {
- rsDefaultsParameterReturn,
- rsDefaultsParameterString,
- rsParameterBigDecimal,
- rsParameterBigInteger,
- rsParameterBoolean,
- rsParameterByte,
- rsParameterChar,
- rsParameterDate,
- rsParameterDouble,
- rsParameterFloat,
- rsParameterInteger,
- rsParameterLong,
- rsParameterShort,
- rsParameterTimestamp,
- rsParameterTime,
- }), sqDefaultsNode);
-
-
- FakeMetadataObject rsBadDefault = createResultSet("pm1.rBadDefault", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject paramBadDefaultRet = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rsBadDefault); //$NON-NLS-1$
- FakeMetadataObject paramBadDefaultIn = createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- paramBadDefaultIn.putProperty(FakeMetadataObject.Props.NULL, Boolean.TRUE);
- paramBadDefaultIn.setDefaultValue("Clearly Not An Integer"); //$NON-NLS-1$
- QueryNode sqnBadDefault = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e2=pm1.sqBadDefault.in; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sqBadDefault = createVirtualProcedure("pm1.sqBadDefault", pm1, Arrays.asList(new FakeMetadataObject[] { paramBadDefaultRet, paramBadDefaultIn }), sqnBadDefault); //$NON-NLS-1$
-
- //end case 3281
-
- FakeMetadataObject rs3 = createResultSet("pm1.rs3", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs3p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs3); //$NON-NLS-1$
- FakeMetadataObject sp1 = createStoredProcedure("pm1.sp1", pm1, Arrays.asList(new FakeMetadataObject[] { rs3p1 })); //$NON-NLS-1$ //$NON-NLS-2$
-
- FakeMetadataObject rs4 = createResultSet("pm1.rs4", pm1, new String[] { "e1"}, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs4p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs4); //$NON-NLS-1$
- QueryNode sqsp1n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM (EXEC pm1.sp1()) as x; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sqsp1 = createVirtualProcedure("pm1.sqsp1", pm1, Arrays.asList(new FakeMetadataObject[] { rs4p1 }), sqsp1n1); //$NON-NLS-1$
-
- FakeMetadataObject rs6 = createResultSet("pm1.rs6", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs6p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs6); //$NON-NLS-1$
- QueryNode sq4n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN EXEC pm1.sq1(); END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq4 = createVirtualProcedure("pm1.sq4", pm1, Arrays.asList(new FakeMetadataObject[] { rs6p1}), sq4n1); //$NON-NLS-1$
-
- FakeMetadataObject rs7 = createResultSet("pm1.rs7", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs7p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs7); //$NON-NLS-1$
- FakeMetadataObject rs7p2 = createParameter("in1", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq5n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN EXEC pm1.sq2(pm1.sq5.in1); END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq5 = createVirtualProcedure("pm1.sq5", pm1, Arrays.asList(new FakeMetadataObject[] { rs7p1, rs7p2 }), sq5n1); //$NON-NLS-1$
-
- FakeMetadataObject rs8 = createResultSet("pm1.rs8", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs8p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs8); //$NON-NLS-1$
- QueryNode sq6n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN EXEC pm1.sq2(\'1\'); END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq6 = createVirtualProcedure("pm1.sq6", pm1, Arrays.asList(new FakeMetadataObject[] { rs8p1 }), sq6n1); //$NON-NLS-1$
-
- FakeMetadataObject rs9 = createResultSet("pm1.rs9", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs9p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs9); //$NON-NLS-1$
- QueryNode sq7n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM (EXEC pm1.sq1()) as x; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq7 = createVirtualProcedure("pm1.sq7", pm1, Arrays.asList(new FakeMetadataObject[] { rs9p1 }), sq7n1); //$NON-NLS-1$
-
- FakeMetadataObject rs10 = createResultSet("pm1.rs10", pm1, new String[] { "e1"}, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs10p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs10); //$NON-NLS-1$
- FakeMetadataObject rs10p2 = createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq8n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM (EXEC pm1.sq1()) as x WHERE x.e1=pm1.sq8.in; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq8 = createVirtualProcedure("pm1.sq8", pm1, Arrays.asList(new FakeMetadataObject[] { rs10p1, rs10p2 }), sq8n1); //$NON-NLS-1$
-
- FakeMetadataObject rs11 = createResultSet("pm1.rs11", pm1, new String[] { "e1"}, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs11p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs11); //$NON-NLS-1$
- FakeMetadataObject rs11p2 = createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq9n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM (EXEC pm1.sq2(pm1.sq9.in)) as x; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq9 = createVirtualProcedure("pm1.sq9", pm1, Arrays.asList(new FakeMetadataObject[] { rs11p1, rs11p2 }), sq9n1); //$NON-NLS-1$
-
- FakeMetadataObject rs12 = createResultSet("pm1.rs12", pm1, new String[] { "e1"}, new String[] { DataTypeManager.DefaultDataTypes.STRING}); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs12p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs12); //$NON-NLS-1$
- FakeMetadataObject rs12p2 = createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- FakeMetadataObject rs12p3 = createParameter("in2", 3, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode sq10n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM (EXEC pm1.sq2(pm1.sq10.in)) as x where e2=pm1.sq10.in2; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq10 = createVirtualProcedure("pm1.sq10", pm1, Arrays.asList(new FakeMetadataObject[] { rs12p1, rs12p2, rs12p3}), sq10n1); //$NON-NLS-1$
-
- FakeMetadataObject rs13 = createResultSet("pm1.rs13", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs13p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs13); //$NON-NLS-1$
- FakeMetadataObject rs13p2 = createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- FakeMetadataObject sp2 = createStoredProcedure("pm1.sp2", pm1, Arrays.asList(new FakeMetadataObject[] { rs13p1, rs13p2 })); //$NON-NLS-1$ //$NON-NLS-2$
-
- FakeMetadataObject rs14 = createResultSet("pm1.rs14", pm1, new String[] { "e1"}, new String[] { DataTypeManager.DefaultDataTypes.STRING}); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs14p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs14); //$NON-NLS-1$
- FakeMetadataObject rs14p2 = createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- FakeMetadataObject rs14p3 = createParameter("in2", 3, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode sq11n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM (EXEC pm1.sp2(?)) as x where e2=pm1.sq11.in; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq11 = createVirtualProcedure("pm1.sq11", pm1, Arrays.asList(new FakeMetadataObject[] { rs14p1, rs14p2, rs14p3}), sq11n1); //$NON-NLS-1$
-
- FakeMetadataObject rs15 = createResultSet("pm1.rs15", pm1, new String[] { "count" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs15p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs15); //$NON-NLS-1$
- FakeMetadataObject rs15p2 = createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- FakeMetadataObject rs15p3 = createParameter("in2", 3, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode sq12n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN INSERT INTO pm1.g1 ( e1, e2 ) VALUES( pm1.sq12.in, pm1.sq12.in2 ); END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq12 = createVirtualProcedure("pm1.sq12", pm1, Arrays.asList(new FakeMetadataObject[] { rs15p1, rs15p2, rs15p3 }), sq12n1); //$NON-NLS-1$
-
- FakeMetadataObject rs16 = createResultSet("pm1.rs16", pm1, new String[] { "count" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs16p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs16); //$NON-NLS-1$
- FakeMetadataObject rs16p2 = createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq13n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN INSERT INTO pm1.g1 ( e1, e2 ) VALUES( pm1.sq13.in, 2 ); END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq13 = createVirtualProcedure("pm1.sq13", pm1, Arrays.asList(new FakeMetadataObject[] { rs16p1, rs16p2 }), sq13n1); //$NON-NLS-1$
-
- FakeMetadataObject rs17 = createResultSet("pm1.rs17", pm1, new String[] { "count" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs17p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs17); //$NON-NLS-1$
- FakeMetadataObject rs17p2 = createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- FakeMetadataObject rs17p3 = createParameter("in2", 3, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode sq14n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN UPDATE pm1.g1 SET e1 = pm1.sq14.in WHERE e2 = pm1.sq14.in2; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq14 = createVirtualProcedure("pm1.sq14", pm1, Arrays.asList(new FakeMetadataObject[] { rs17p1, rs17p2, rs17p3 }), sq14n1); //$NON-NLS-1$
-
- FakeMetadataObject rs18 = createResultSet("pm1.rs17", pm1, new String[] { "count" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rs18p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs18); //$NON-NLS-1$
- FakeMetadataObject rs18p2 = createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- FakeMetadataObject rs18p3 = createParameter("in2", 3, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode sq15n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DELETE FROM pm1.g1 WHERE e1 = pm1.sq15.in AND e2 = pm1.sq15.in2; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq15 = createVirtualProcedure("pm1.sq15", pm1, Arrays.asList(new FakeMetadataObject[] { rs18p1, rs18p2, rs18p3 }), sq15n1); //$NON-NLS-1$
-
- QueryNode sq16n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN INSERT INTO pm1.g1 ( e1, e2 ) VALUES( 1, 2 ); END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq16 = createVirtualProcedure("pm1.sq16", pm1, new ArrayList(), sq16n1); //$NON-NLS-1$
-
- FakeMetadataObject rs19 = createResultSet("pm1.rs19", pm1, new String[] { "xml" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq17p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs19); //$NON-NLS-1$
- QueryNode sq17n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT * FROM xmltest.doc1; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq17 = createVirtualProcedure("pm1.sq17", pm1, Arrays.asList(new FakeMetadataObject[] { sq17p1 }), sq17n1); //$NON-NLS-1$
-
- FakeMetadataObject sp3 = createStoredProcedure("pm1.sp3", pm1, new ArrayList()); //$NON-NLS-1$ //$NON-NLS-2$
-
- FakeMetadataObject rs20 = createResultSet("pm1.rs20", pm1, new String[] { "xml" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq18p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs20); //$NON-NLS-1$
- QueryNode sq18n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT * FROM xmltest.doc1; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq18 = createVirtualProcedure("pm1.sq18", pm1, Arrays.asList(new FakeMetadataObject[] { sq18p1 }), sq18n1); //$NON-NLS-1$
-
- FakeMetadataObject rs21 = createResultSet("pm1.rs21", pm1, new String[] { "xml" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq19p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs21); //$NON-NLS-1$
- FakeMetadataObject sq19p2 = createParameter("param1", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode sq19n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT * FROM xmltest.doc4 WHERE root.node1 = param1; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject sq19 = createVirtualProcedure("pm1.sq19", pm1, Arrays.asList(new FakeMetadataObject[] { sq19p1, sq19p2 }), sq19n1); //$NON-NLS-1$
-
- FakeMetadataObject rs22p2 = createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.BIG_INTEGER, null); //$NON-NLS-1$
- FakeMetadataObject sp4 = createStoredProcedure("pm1.sp4", pm1, Arrays.asList(new FakeMetadataObject[] { rs13p1, rs22p2 })); //$NON-NLS-1$ //$NON-NLS-2$
-
- // no params or result set at all
- FakeMetadataObject sp5 = createStoredProcedure("pm1.sp5", pm1, Arrays.asList(new FakeMetadataObject[] {})); //$NON-NLS-1$ //$NON-NLS-2$
-
- //virtual stored procedures
- FakeMetadataObject vsprs1 = createResultSet("pm1.vsprs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vspp1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, vsprs1); //$NON-NLS-1$
-// QueryNode vspqn1 = new QueryNode("vsp1", "CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; LOOP ON (SELECT e1 FROM pm1.g1) AS mycursor BEGIN x=mycursor.e1; IF(x > 5) BEGIN CONTINUE; END END SELECT e1 FROM pm1.g1; END"); //$NON-NLS-1$ //$NON-NLS-2$
- QueryNode vspqn1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN x=mycursor.e2; IF(x = 15) BEGIN BREAK; END END SELECT e1 FROM pm1.g1 where pm1.g1.e2 = x; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp1 = createVirtualProcedure("pm1.vsp1", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn1); //$NON-NLS-1$
-
- QueryNode vspqn2 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN x=mycursor.e2; END SELECT e1 FROM pm1.g1; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp2 = createVirtualProcedure("pm1.vsp2", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn2); //$NON-NLS-1$
-
- QueryNode vspqn3 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN x=mycursor.e2; END SELECT e1 FROM pm1.g1 WHERE x=e2; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp3 = createVirtualProcedure("pm1.vsp3", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn3); //$NON-NLS-1$
-
- QueryNode vspqn4 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN IF(mycursor.e2 > 10) BEGIN BREAK; END x=mycursor.e2; END SELECT e1 FROM pm1.g1 WHERE x=e2; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp4 = createVirtualProcedure("pm1.vsp4", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn4); //$NON-NLS-1$
-
- QueryNode vspqn5 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN IF(mycursor.e2 > 10) BEGIN CONTINUE; END x=mycursor.e2; END SELECT e1 FROM pm1.g1 WHERE x=e2; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp5 = createVirtualProcedure("pm1.vsp5", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn5); //$NON-NLS-1$
-
- QueryNode vspqn6 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; x=0; WHILE (x < 15) BEGIN x=x+1; END SELECT e1 FROM pm1.g1 WHERE x=e2; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp6 = createVirtualProcedure("pm1.vsp6", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn6); //$NON-NLS-1$
-
- FakeMetadataObject vspp2 = createParameter("param1", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode vspqn7 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; x=0; WHILE (x < 12) BEGIN x=x+pm1.vsp7.param1; END SELECT e1 FROM pm1.g1 WHERE x=e2; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp7 = createVirtualProcedure("pm1.vsp7", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1, vspp2 }), vspqn7); //$NON-NLS-1$
-
- FakeMetadataObject vspp8 = createParameter("param1", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode vspqn8 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; x=0; WHILE (x < 12) BEGIN x=x+pm1.vsp8.param1; END SELECT e1 FROM pm1.g1 WHERE e2 >= param1; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp8 = createVirtualProcedure("pm1.vsp8", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1, vspp8 }), vspqn8); //$NON-NLS-1$
-
- FakeMetadataObject vspp9 = createParameter("param1", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode vspqn9 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; x=0; WHILE (x < param1) BEGIN x=x+pm1.vsp9.param1; END SELECT e1 FROM pm1.g1 WHERE e2 >= param1; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp9 = createVirtualProcedure("pm1.vsp9", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1, vspp9 }), vspqn9); //$NON-NLS-1$
-
- FakeMetadataObject vspp3 = createParameter("param1", 1, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode vspqn10 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1 WHERE e2=param1) AS mycursor BEGIN x=mycursor.e2; END END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp10 = createVirtualProcedure("pm1.vsp10", pm1, Arrays.asList(new FakeMetadataObject[] { vspp3 }), vspqn10); //$NON-NLS-1$
-
- //invalid
- QueryNode vspqn11 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN LOOP ON (SELECT e1 FROM pm1.g1) AS mycursor BEGIN END END SELECT e1 FROM pm1.g1; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp11 = createVirtualProcedure("pm1.vsp11", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn11); //$NON-NLS-1$
-
- //invalid
- QueryNode vspqn12 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN END x=mycursor.e2; SELECT e1 FROM pm1.g1; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp12 = createVirtualProcedure("pm1.vsp12", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn12); //$NON-NLS-1$
-
- FakeMetadataObject vsprs2 = createResultSet("pm1.vsprs2", pm1, new String[] { "e1", "const" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject vspp4 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, vsprs2); //$NON-NLS-1$
- QueryNode vspqn13 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; LOOP ON (SELECT e1 FROM pm1.g1) AS mycursor BEGIN x=mycursor.e1; END SELECT x, 5; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp13 = createVirtualProcedure("pm1.vsp13", pm1, Arrays.asList(new FakeMetadataObject[] { vspp4 }), vspqn13); //$NON-NLS-1$
-
- QueryNode vspqn14 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 INTO #temptable FROM pm1.g1; SELECT e1 FROM #temptable; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp14 = createVirtualProcedure("pm1.vsp14", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn14); //$NON-NLS-1$
-
- QueryNode vspqn15 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 INTO #temptable FROM pm1.g1; SELECT #temptable.e1 FROM #temptable, pm1.g2 WHERE #temptable.e2 = pm1.g2.e2; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp15 = createVirtualProcedure("pm1.vsp15", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn15); //$NON-NLS-1$
-
- QueryNode vspqn16 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 INTO #temptable FROM pm1.g1; SELECT a.e1 FROM (SELECT pm1.g2.e1 FROM #temptable, pm1.g2 WHERE #temptable.e2 = pm1.g2.e2) AS a; END"); //$NON-NLS-1$ //$NON-NLS-2$
- //QueryNode vspqn16 = new QueryNode("vsp16", "CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 INTO #temptable FROM pm1.g1; SELECT e1 FROM #temptable where e1 in (SELECT pm1.g2.e1 FROM #temptable, pm1.g2 WHERE #temptable.e2 = pm1.g2.e2); END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp16 = createVirtualProcedure("pm1.vsp16", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn16); //$NON-NLS-1$
-
- QueryNode vspqn17 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; SELECT e1, e2 INTO #temptable FROM pm1.g1; LOOP ON (SELECT e1, e2 FROM #temptable) AS mycursor BEGIN x=mycursor.e2; END SELECT e1 FROM pm1.g1 WHERE x=e2; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp17 = createVirtualProcedure("pm1.vsp17", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn17); //$NON-NLS-1$
-
- //invalid
- QueryNode vspqn18 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 INTO temptable FROM pm1.g1; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp18 = createVirtualProcedure("pm1.vsp18", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn18); //$NON-NLS-1$
-
- QueryNode vspqn19 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 INTO #temptable FROM pm1.g1; SELECT e1 INTO #temptable FROM pm1.g1; SELECT e1 FROM #temptable; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp19 = createVirtualProcedure("pm1.vsp19", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn19); //$NON-NLS-1$
-
- QueryNode vspqn20 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 INTO #temptable FROM pm1.g1; INSERT INTO #temptable(e1) VALUES( 'Fourth'); SELECT e1 FROM #temptable; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp20 = createVirtualProcedure("pm1.vsp20", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn20); //$NON-NLS-1$
-
- FakeMetadataObject vspp21 = createParameter("param1", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode vspqn21 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 INTO #temptable FROM pm1.g1; INSERT INTO #temptable(#temptable.e1, e2) VALUES( 'Fourth', param1); SELECT e1, e2 FROM #temptable; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp21 = createVirtualProcedure("pm1.vsp21", pm1, Arrays.asList(new FakeMetadataObject[] { vspp4, vspp21 }), vspqn21); //$NON-NLS-1$
-
- FakeMetadataObject vspp22 = createParameter("param1", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode vspqn22 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 INTO #temptable FROM pm1.g1 where e2 > param1; SELECT e1, e2 FROM #temptable; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp22 = createVirtualProcedure("pm1.vsp22", pm1, Arrays.asList(new FakeMetadataObject[] { vspp4, vspp22 }), vspqn22); //$NON-NLS-1$
-
- FakeMetadataObject vspp23 = createParameter("param1", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode vspqn23 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; SELECT e1, e2 INTO #temptable FROM pm1.g1 where e2 > param1; x = SELECT e1 FROM #temptable WHERE e2=15; SELECT x, 15; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp23 = createVirtualProcedure("pm1.vsp23", pm1, Arrays.asList(new FakeMetadataObject[] { vspp4, vspp23 }), vspqn23); //$NON-NLS-1$
-
- QueryNode vspqn24 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 INTO #temptable FROM pm1.g1; SELECT #temptable.e1 FROM #temptable WHERE #temptable.e2=15; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp24 = createVirtualProcedure("pm1.vsp24", pm1, Arrays.asList(new FakeMetadataObject[] { vspp4 }), vspqn24); //$NON-NLS-1$
-
- QueryNode vspqn25 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 INTO #temptable FROM pm1.g1 WHERE e1 ='no match'; SELECT e1 FROM #temptable; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp25 = createVirtualProcedure("pm1.vsp25", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn25); //$NON-NLS-1$
-
- QueryNode vspqn27 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 from (exec pm1.vsp25())as c; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp27 = createVirtualProcedure("pm1.vsp27", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn27); //$NON-NLS-1$
-
- QueryNode vspqn28 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT 0 AS e1 ORDER BY e1; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp28 = createVirtualProcedure("pm1.vsp28", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn28); //$NON-NLS-1$
-
- QueryNode vspqn29 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM pm1.g1 ORDER BY e1; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp29 = createVirtualProcedure("pm1.vsp29", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn29); //$NON-NLS-1$
-
- FakeMetadataObject vsprs30 = createResultSet("pm1.vsprs30", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp30p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, null, vsprs30); //$NON-NLS-1$
- QueryNode vspqn30 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM pm1.g1; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp30 = createVirtualProcedure("pm1.vsp30", pm1, Arrays.asList(new FakeMetadataObject[] {vsp30p1}), vspqn30); //$NON-NLS-1$
-
- FakeMetadataObject vsprs31 = createResultSet("pm1.vsprs31", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp31p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, null, vsprs31); //$NON-NLS-1$
- FakeMetadataObject vsp31p2 = createParameter("p1", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode vspqn31 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM pm1.g1 WHERE e2 = pm1.vsp31.p1; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp31 = createVirtualProcedure("pm1.vsp31", pm1, Arrays.asList(new FakeMetadataObject[] {vsp31p1, vsp31p2}), vspqn31); //$NON-NLS-1$
-
- QueryNode vspqn38 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer VARIABLES.y; VARIABLES.y=5; EXEC pm1.vsp7(VARIABLES.y); END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp38 = createVirtualProcedure("pm1.vsp38", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn38); //$NON-NLS-1$
-
- QueryNode vspqn39 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer VARIABLES.x; VARIABLES.x=5; EXEC pm1.vsp7(VARIABLES.x); END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp39 = createVirtualProcedure("pm1.vsp39", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn39); //$NON-NLS-1$
-
- QueryNode vspqn40 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN EXEC pm1.vsp41(); END END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp40 = createVirtualProcedure("pm1.vsp40", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn40); //$NON-NLS-1$
-
- QueryNode vspqn41 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM pm1.g1 where e2=15; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp41 = createVirtualProcedure("pm1.vsp41", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn41); //$NON-NLS-1$
-
- vm1g1.putProperty(FakeMetadataObject.Props.INSERT_PROCEDURE, "CREATE PROCEDURE BEGIN ROWS_UPDATED = INSERT INTO pm1.g1(e1, e2, e3, e4) values(INPUT.e1, INPUT.e2, INPUT.e3, INPUT.e4); END"); //$NON-NLS-1$
- vm1g1.putProperty(FakeMetadataObject.Props.UPDATE_PROCEDURE, "CREATE PROCEDURE BEGIN ROWS_UPDATED = UPDATE pm1.g1 SET e1 = INPUT.e1, e2 = INPUT.e2, e3 = INPUT.e3, e4=INPUT.e4 WHERE TRANSLATE CRITERIA; END"); //$NON-NLS-1$
- vm1g1.putProperty(FakeMetadataObject.Props.DELETE_PROCEDURE, "CREATE PROCEDURE BEGIN ROWS_UPDATED = DELETE FROM pm1.g1 WHERE TRANSLATE CRITERIA; END"); //$NON-NLS-1$
-
- vm1g37.putProperty(FakeMetadataObject.Props.INSERT_PROCEDURE, "CREATE PROCEDURE BEGIN ROWS_UPDATED = INSERT INTO pm4.g1(e1, e2, e3, e4) values(INPUT.e1, INPUT.e2, INPUT.e3, INPUT.e4); END"); //$NON-NLS-1$
- vm1g37.putProperty(FakeMetadataObject.Props.DELETE_PROCEDURE, "CREATE PROCEDURE BEGIN ROWS_UPDATED = DELETE FROM pm4.g1 where translate criteria; END"); //$NON-NLS-1$
- QueryNode vspqn37 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; VARIABLES.x=5; INSERT INTO vm1.g1(e2) values(VARIABLES.x); SELECT ROWCOUNT; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp37 = createVirtualProcedure("pm1.vsp37", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn37); //$NON-NLS-1$
-
- QueryNode vspqn33 = new QueryNode(new StringBuffer("CREATE VIRTUAL PROCEDURE") //$NON-NLS-1$//$NON-NLS-2$
- .append(" BEGIN") //$NON-NLS-1$
- .append(" SELECT 3 AS temp1 INTO #myTempTable;") //$NON-NLS-1$
- .append(" SELECT 2 AS temp1 INTO #myTempTable;") //$NON-NLS-1$
- .append(" SELECT 1 AS temp1 INTO #myTempTable;") //$NON-NLS-1$
- .append(" SELECT temp1 AS e1 FROM #myTempTable ORDER BY e1;") //$NON-NLS-1$
- .append(" END").toString() //$NON-NLS-1$
- );
- FakeMetadataObject vsp33 = createVirtualProcedure("pm1.vsp33", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn33); //$NON-NLS-1$
-
- QueryNode vspqn35 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer VARIABLES.ID; VARIABLES.ID = pm1.vsp35.p1; SELECT e1 FROM pm1.g1 WHERE e2 = VARIABLES.ID; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp35 = createVirtualProcedure("pm1.vsp35", pm1, Arrays.asList(new FakeMetadataObject[] {vsp31p1, vsp31p2}), vspqn35); //$NON-NLS-1$
-
- QueryNode vspqn34 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, 0 AS const FROM pm1.g1 ORDER BY const; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp34 = createVirtualProcedure("pm1.vsp34", pm1, Arrays.asList(new FakeMetadataObject[] { vspp4 }), vspqn34); //$NON-NLS-1$
-
- QueryNode vspqn45 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 INTO #temptable FROM pm1.g1; SELECT #temptable.e1 FROM #temptable where #temptable.e1 in (SELECT pm1.g2.e1 FROM pm1.g2 ); END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp45 = createVirtualProcedure("pm1.vsp45", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn45); //$NON-NLS-1$
-
- // Virtual group w/ procedure in transformation, optional params, named parameter syntax
- QueryNode vspqn47 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN IF (pm1.vsp47.param1 IS NOT NULL) BEGIN SELECT 'FOO' as e1, pm1.vsp47.param1 as e2; END ELSE BEGIN SELECT pm1.vsp47.param2 as e1, 2112 as e2; END END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsprs47 = createResultSet("pm1.vsprs47", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject vspp47_1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, vsprs47); //$NON-NLS-1$
- FakeMetadataObject vspp47_2 = createParameter("param1", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- vspp47_2.putProperty(FakeMetadataObject.Props.NULL, Boolean.TRUE);
- FakeMetadataObject vspp47_3 = createParameter("param2", 3, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- vspp47_3.putProperty(FakeMetadataObject.Props.NULL, Boolean.TRUE);
- FakeMetadataObject vsp47 = createVirtualProcedure("pm1.vsp47", pm1, Arrays.asList(new FakeMetadataObject[] { vspp47_1, vspp47_2, vspp47_3 }), vspqn47); //$NON-NLS-1$
- QueryNode vgvpn7 = new QueryNode("SELECT P.e2 as ve3, P.e1 as ve4 FROM (EXEC pm1.vsp47(param1=vm1.vgvp7.ve1, param2=vm1.vgvp7.ve2)) as P"); //$NON-NLS-1$ //$NON-NLS-2$
-// QueryNode vgvpn7 = new QueryNode("vm1.vgvp7", "SELECT P.e2 as ve1, P.e1 as ve2 FROM (EXEC pm1.vsp47(vm1.vgvp7.ve1, vm1.vgvp7.ve2)) as P"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vgvp7 = createVirtualGroup("vm1.vgvp7", vm1, vgvpn7); //$NON-NLS-1$
- FakeMetadataObject vgvp7e1 = FakeMetadataFactory.createElement("vm1.vgvp7.ve1", vgvp7, DataTypeManager.DefaultDataTypes.INTEGER, 0); //$NON-NLS-1$
- vgvp7e1.putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- FakeMetadataObject vgvp7e2 = FakeMetadataFactory.createElement("vm1.vgvp7.ve2", vgvp7, DataTypeManager.DefaultDataTypes.STRING, 1); //$NON-NLS-1$
- vgvp7e2.putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- FakeMetadataObject vgvp7e3 = FakeMetadataFactory.createElement("vm1.vgvp7.ve3", vgvp7, DataTypeManager.DefaultDataTypes.STRING, 2); //$NON-NLS-1$
- FakeMetadataObject vgvp7e4 = FakeMetadataFactory.createElement("vm1.vgvp7.ve4", vgvp7, DataTypeManager.DefaultDataTypes.STRING, 3); //$NON-NLS-1$
-
-
- //invalid
- QueryNode vspqn32 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1) AS #mycursor BEGIN IF(#mycursor.e2 > 10) BEGIN CONTINUE; END x=#mycursor.e2; END SELECT e1 FROM pm1.g1 WHERE x=e2; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp32 = createVirtualProcedure("pm1.vsp32", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn32); //$NON-NLS-1$
-
- //virtual group with procedure in transformation
- QueryNode vspqn26 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e2 >= pm1.vsp26.param1 and e1 = pm1.vsp26.param2; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vspp26_1 = createParameter("param1", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- FakeMetadataObject vspp26_2 = createParameter("param2", 3, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- FakeMetadataObject vsprs3 = createResultSet("pm1.vsprs3", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject vspp6 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, vsprs3); //$NON-NLS-1$
- FakeMetadataObject vsp26 = createVirtualProcedure("pm1.vsp26", pm1, Arrays.asList(new FakeMetadataObject[] { vspp6, vspp26_1, vspp26_2 }), vspqn26); //$NON-NLS-1$
- QueryNode vgvpn1 = new QueryNode("SELECT P.e1 as ve3 FROM (EXEC pm1.vsp26(vm1.vgvp1.ve1, vm1.vgvp1.ve2)) as P"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vgvp1 = createVirtualGroup("vm1.vgvp1", vm1, vgvpn1); //$NON-NLS-1$
- FakeMetadataObject vgvp1e1 = FakeMetadataFactory.createElement("vm1.vgvp1.ve1", vgvp1, DataTypeManager.DefaultDataTypes.INTEGER, 0); //$NON-NLS-1$
- vgvp1e1.putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- FakeMetadataObject vgvp1e2 = FakeMetadataFactory.createElement("vm1.vgvp1.ve2", vgvp1, DataTypeManager.DefaultDataTypes.STRING, 1); //$NON-NLS-1$
- vgvp1e2.putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- FakeMetadataObject vgvp1e3 = FakeMetadataFactory.createElement("vm1.vgvp1.ve3", vgvp1, DataTypeManager.DefaultDataTypes.STRING, 2); //$NON-NLS-1$
-
- QueryNode vgvpn2 = new QueryNode("SELECT P.e1 as ve3 FROM (EXEC pm1.vsp26(vm1.vgvp2.ve1, vm1.vgvp2.ve2)) as P where P.e1='a'"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vgvp2 = createVirtualGroup("vm1.vgvp2", vm1, vgvpn2); //$NON-NLS-1$
- FakeMetadataObject vgvp2e1 = FakeMetadataFactory.createElement("vm1.vgvp2.ve1", vgvp2, DataTypeManager.DefaultDataTypes.INTEGER, 0); //$NON-NLS-1$
- vgvp2e1.putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- FakeMetadataObject vgvp2e2 = FakeMetadataFactory.createElement("vm1.vgvp2.ve2", vgvp2, DataTypeManager.DefaultDataTypes.STRING, 1); //$NON-NLS-1$
- vgvp2e2.putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- FakeMetadataObject vgvp2e3 = FakeMetadataFactory.createElement("vm1.vgvp2.ve3", vgvp2, DataTypeManager.DefaultDataTypes.STRING, 2); //$NON-NLS-1$
-
- QueryNode vgvpn3 = new QueryNode("SELECT P.e1 as ve3 FROM (EXEC pm1.vsp26(vm1.vgvp3.ve1, vm1.vgvp3.ve2)) as P, pm1.g2 where P.e1=g2.e1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vgvp3 = createVirtualGroup("vm1.vgvp3", vm1, vgvpn3); //$NON-NLS-1$
- FakeMetadataObject vgvp3e1 = FakeMetadataFactory.createElement("vm1.vgvp3.ve1", vgvp3, DataTypeManager.DefaultDataTypes.INTEGER, 0); //$NON-NLS-1$
- vgvp3e1.putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- FakeMetadataObject vgvp3e2 = FakeMetadataFactory.createElement("vm1.vgvp3.ve2", vgvp3, DataTypeManager.DefaultDataTypes.STRING, 1); //$NON-NLS-1$
- vgvp3e2.putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- FakeMetadataObject vgvp3e3 = FakeMetadataFactory.createElement("vm1.vgvp3.ve3", vgvp3, DataTypeManager.DefaultDataTypes.STRING, 2); //$NON-NLS-1$
-
- QueryNode vgvpn4 = new QueryNode("SELECT P.e1 as ve3 FROM (EXEC pm1.vsp26(vm1.vgvp4.ve1, vm1.vgvp4.ve2)) as P, vm1.g1 where P.e1=g1.e1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vgvp4 = createVirtualGroup("vm1.vgvp4", vm1, vgvpn4); //$NON-NLS-1$
- FakeMetadataObject vgvp4e1 = FakeMetadataFactory.createElement("vm1.vgvp4.ve1", vgvp4, DataTypeManager.DefaultDataTypes.INTEGER, 0); //$NON-NLS-1$
- vgvp4e1.putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- FakeMetadataObject vgvp4e2 = FakeMetadataFactory.createElement("vm1.vgvp4.ve2", vgvp4, DataTypeManager.DefaultDataTypes.STRING, 1); //$NON-NLS-1$
- vgvp4e2.putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- FakeMetadataObject vgvp4e3 = FakeMetadataFactory.createElement("vm1.vgvp4.ve3", vgvp4, DataTypeManager.DefaultDataTypes.STRING, 2); //$NON-NLS-1$
-
- QueryNode vgvpn5 = new QueryNode("SELECT * FROM vm1.vgvp4 where vm1.vgvp4.ve1=vm1.vgvp5.ve1 and vm1.vgvp4.ve2=vm1.vgvp5.ve2"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vgvp5 = createVirtualGroup("vm1.vgvp5", vm1, vgvpn5); //$NON-NLS-1$
- FakeMetadataObject vgvp5e1 = FakeMetadataFactory.createElement("vm1.vgvp5.ve1", vgvp5, DataTypeManager.DefaultDataTypes.INTEGER, 0); //$NON-NLS-1$
- vgvp5e1.putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- FakeMetadataObject vgvp5e2 = FakeMetadataFactory.createElement("vm1.vgvp5.ve2", vgvp5, DataTypeManager.DefaultDataTypes.STRING, 1); //$NON-NLS-1$
- vgvp5e2.putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- FakeMetadataObject vgvp5e3 = FakeMetadataFactory.createElement("vm1.vgvp5.ve3", vgvp5, DataTypeManager.DefaultDataTypes.STRING, 2); //$NON-NLS-1$
-
- QueryNode vgvpn6 = new QueryNode("SELECT P.e1 as ve3, P.e2 as ve4 FROM (EXEC pm1.vsp26(vm1.vgvp6.ve1, vm1.vgvp6.ve2)) as P"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vgvp6 = createVirtualGroup("vm1.vgvp6", vm1, vgvpn6); //$NON-NLS-1$
- FakeMetadataObject vgvp6e1 = FakeMetadataFactory.createElement("vm1.vgvp6.ve1", vgvp6, DataTypeManager.DefaultDataTypes.INTEGER, 0); //$NON-NLS-1$
- vgvp6e1.putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- FakeMetadataObject vgvp6e2 = FakeMetadataFactory.createElement("vm1.vgvp6.ve2", vgvp6, DataTypeManager.DefaultDataTypes.STRING, 1); //$NON-NLS-1$
- vgvp6e2.putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- FakeMetadataObject vgvp6e3 = FakeMetadataFactory.createElement("vm1.vgvp6.ve3", vgvp6, DataTypeManager.DefaultDataTypes.STRING, 2); //$NON-NLS-1$
- FakeMetadataObject vgvp6e4 = FakeMetadataFactory.createElement("vm1.vgvp6.ve4", vgvp6, DataTypeManager.DefaultDataTypes.INTEGER, 3); //$NON-NLS-1$
-
- //virtual group with two elements. One selectable, one not.
- QueryNode vm1g35n1 = new QueryNode("SELECT e1, e2 FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g35 = createVirtualGroup("vm1.g35", vm1, vm1g35n1); //$NON-NLS-1$
- FakeMetadataObject vm1g35e1 = FakeMetadataFactory.createElement("vm1.g35.e1", vm1g35, DataTypeManager.DefaultDataTypes.STRING, 1); //$NON-NLS-1$
- vm1g35e1.putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- FakeMetadataObject vm1g35e2 = FakeMetadataFactory.createElement("vm1.g35.e2", vm1g35, DataTypeManager.DefaultDataTypes.INTEGER, 2); //$NON-NLS-1$
-
- FakeMetadataObject vsprs36 = createResultSet("pm1.vsprs36", pm1, new String[] { "x" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp36p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, null, vsprs36); //$NON-NLS-1$
- FakeMetadataObject vsp36p2 = createParameter("param1", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode vspqn36 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; x = pm1.vsp36.param1 * 2; SELECT x; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp36 = createVirtualProcedure("pm1.vsp36", pm1, Arrays.asList(new FakeMetadataObject[] { vsp36p1, vsp36p2 }), vspqn36); //$NON-NLS-1$
-
- FakeMetadataObject vsprs42 = createResultSet("pm1.vsprs42", pm1, new String[] { "x" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp42p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, null, vsprs42); //$NON-NLS-1$
- FakeMetadataObject vsp42p2 = createParameter("param1", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode vspqn42 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN IF (pm1.vsp42.param1 > 0) SELECT 1 AS x; ELSE SELECT 0 AS x; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp42 = createVirtualProcedure("pm1.vsp42", pm1, Arrays.asList(new FakeMetadataObject[] { vsp42p1, vsp42p2 }), vspqn42); //$NON-NLS-1$
-
- FakeMetadataObject vspp44 = createParameter("param1", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode vspqn44 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT pm1.vsp44.param1 INTO #temptable; SELECT e1 from pm1.g1; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp44 = createVirtualProcedure("pm1.vsp44", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1, vspp44 }), vspqn44); //$NON-NLS-1$
-
- FakeMetadataObject vspp43 = createParameter("param1", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode vspqn43 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN exec pm1.vsp44(pm1.vsp43.param1); END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp43 = createVirtualProcedure("pm1.vsp43", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1, vspp43 }), vspqn43); //$NON-NLS-1$
-
- QueryNode vspqn46 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN create local temporary table #temptable (e1 string, e2 string); LOOP ON (SELECT e1 FROM pm1.g1) AS mycursor BEGIN select mycursor.e1, a.e1 as e2 into #temptable from (SELECT pm1.g1.e1 FROM pm1.g1 where pm1.g1.e1 = mycursor.e1) a; END SELECT e1 FROM #temptable; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp46 = createVirtualProcedure("pm1.vsp46", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn46); //$NON-NLS-1$
-
- FakeMetadataObject vsp48rs = createResultSet("pm1vsp48.rs", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp48p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, vsp48rs); //$NON-NLS-1$
- FakeMetadataObject vsp48p2 = createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode vspqn48 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; SELECT e1 FROM (EXEC pm1.sq2(pm1.vsp48.in)) as e; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp48 = createVirtualProcedure("pm1.vsp48", pm1, Arrays.asList(new FakeMetadataObject[] { vsp48p1, vsp48p2 }), vspqn48); //$NON-NLS-1$
-
- FakeMetadataObject vsp49rs = createResultSet("pm1vsp49.rs", pm1, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject vsp49p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, vsp49rs); //$NON-NLS-1$
- QueryNode vspqn49 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; x = 'b'; EXEC pm1.sq2(x); END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp49 = createVirtualProcedure("pm1.vsp49", pm1, Arrays.asList(new FakeMetadataObject[] { vsp49p1 }), vspqn49); //$NON-NLS-1$
-
- FakeMetadataObject vsp50rs = createResultSet("pm1vsp50.rs", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp50p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, vsp50rs); //$NON-NLS-1$
- QueryNode vspqn50 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; x = 'b'; SELECT e1 FROM (EXEC pm1.sq2(x)) as e; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp50 = createVirtualProcedure("pm1.vsp50", pm1, Arrays.asList(new FakeMetadataObject[] { vsp50p1 }), vspqn50); //$NON-NLS-1$
-
- FakeMetadataObject vsp51rs = createResultSet("pm1vsp51.rs", pm1, new String[] { "result" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp51p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, vsp51rs); //$NON-NLS-1$
- QueryNode vspqn51 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; x = 'b'; LOOP ON (SELECT e1 FROM (EXEC pm1.sq2(x)) as e) AS c BEGIN x = x || 'b'; END SELECT x AS result; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp51 = createVirtualProcedure("pm1.vsp51", pm1, Arrays.asList(new FakeMetadataObject[] { vsp51p1 }), vspqn51); //$NON-NLS-1$
-
- FakeMetadataObject vsp52rs = createResultSet("pm1vsp52.rs", pm1, new String[] { "result" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp52p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, vsp52rs); //$NON-NLS-1$
- QueryNode vspqn52 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; x = 'c'; x = SELECT e1 FROM (EXEC pm1.sq2(x)) as e; SELECT x AS result; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp52 = createVirtualProcedure("pm1.vsp52", pm1, Arrays.asList(new FakeMetadataObject[] { vsp52p1 }), vspqn52); //$NON-NLS-1$
-
- FakeMetadataObject vsp53rs = createResultSet("pm1vsp53.rs", pm1, new String[] { "result" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp53p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, vsp53rs); //$NON-NLS-1$
- FakeMetadataObject vsp53p2 = createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode vspqn53 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; x = 'b'; LOOP ON (SELECT e1 FROM (EXEC pm1.sq2(pm1.vsp53.in)) as e) AS c BEGIN x = x || 'b'; END SELECT x AS result; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp53 = createVirtualProcedure("pm1.vsp53", pm1, Arrays.asList(new FakeMetadataObject[] { vsp53p1, vsp53p2 }), vspqn53); //$NON-NLS-1$
-
- FakeMetadataObject vsp54rs = createResultSet("pm1vsp54.rs", pm1, new String[] { "result" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp54p1 = createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, vsp54rs); //$NON-NLS-1$
- FakeMetadataObject vsp54p2 = createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- QueryNode vspqn54 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; x = 'c'; x = SELECT e1 FROM (EXEC pm1.sq2(pm1.vsp54.in)) as e; SELECT x AS result; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp54 = createVirtualProcedure("pm1.vsp54", pm1, Arrays.asList(new FakeMetadataObject[] { vsp54p1, vsp54p2 }), vspqn54); //$NON-NLS-1$
-
- FakeMetadataObject vspp55 = createParameter("param1", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode vspqn55 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN select e1, param1 as a from vm1.g1; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp55 = createVirtualProcedure("pm1.vsp55", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1, vspp55 }), vspqn55); //$NON-NLS-1$
-
- QueryNode vspqn56 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT * INTO #temptable FROM pm1.g1; SELECT #temptable.e1 FROM #temptable; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp56 = createVirtualProcedure("pm1.vsp56", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn56); //$NON-NLS-1$
-
- QueryNode vspqn57 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT * INTO #temptable FROM pm1.g1; SELECT #temptable.e1 FROM #temptable order by #temptable.e1; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp57 = createVirtualProcedure("pm1.vsp57", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn57); //$NON-NLS-1$
-
- FakeMetadataObject vspp58 = createParameter("inp", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- QueryNode vspqn58 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT vsp58.inp; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp58 = createVirtualProcedure("pm1.vsp58", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1, vspp58 }), vspqn58); //$NON-NLS-1$
-
- QueryNode vspqn59 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT * INTO #temp FROM pm5.g3;INSERT INTO #temp (e1, e2) VALUES('integer',1); END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp59 = createVirtualProcedure("pm5.vsp59", pm6, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn59); //$NON-NLS-1$
-
- QueryNode vspqn60 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN create local temporary table temp_table (column1 string);insert into temp_table (column1) values ('First');insert into temp_table (column1) values ('Second');insert into temp_table (column1) values ('Third');select * from temp_table; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp60 = createVirtualProcedure("pm1.vsp60", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn60); //$NON-NLS-1$
-
- QueryNode vspqn61 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN create local temporary table temp_table (column1 string);insert into temp_table (column1) values ('First');drop table temp_table;create local temporary table temp_table (column1 string);insert into temp_table (column1) values ('First');insert into temp_table (column1) values ('Second');insert into temp_table (column1) values ('Third');select * from temp_table; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp61 = createVirtualProcedure("pm1.vsp61", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn61); //$NON-NLS-1$
-
- QueryNode vspqn62 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN create local temporary table temp_table (column1 string); select e1 as column1 into temp_table from pm1.g1;select * from temp_table; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp62 = createVirtualProcedure("pm1.vsp62", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn62); //$NON-NLS-1$
-
- QueryNode vspqn63 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN declare string o; if(1>0) begin declare string a; a='b'; o=a; end if(1>0) begin declare string a; a='c'; o=a; end select o; END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vsp63 = createVirtualProcedure("pm1.vsp63", pm1, Arrays.asList(new FakeMetadataObject[] { vspp1 }), vspqn63); //$NON-NLS-1$
-
- // Add all objects to the store
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(vsp63);
- store.addObject(pm1);
- store.addObject(pm1g1);
- store.addObjects(pm1g1e);
- store.addObject(pm1g2);
- store.addObjects(pm1g2e);
- store.addObject(pm1g3);
- store.addObjects(pm1g3e);
- store.addObject(pm1g4);
- store.addObjects(pm1g4e);
- store.addObject(pm1g5);
- store.addObjects(pm1g5e);
- store.addObject(pm1g6);
- store.addObjects(pm1g6e);
- store.addObject(pm1table);
- store.addObjects(pm1tablee);
-
- store.addObject(pm2);
- store.addObject(pm2g1);
- store.addObjects(pm2g1e);
- store.addObject(pm2g2);
- store.addObjects(pm2g2e);
- store.addObject(pm2g3);
- store.addObjects(pm2g3e);
-
- store.addObject(pm3);
- store.addObject(pm3g1);
- store.addObjects(pm3g1e);
- store.addObject(pm3g2);
- store.addObjects(pm3g2e);
-
- store.addObject(pm4);
- store.addObject(pm4g1);
- store.addObjects(pm4g1e);
- store.addObject(pm4g2);
- store.addObjects(pm4g2e);
- store.addObject(pm4g1ap1);
- store.addObject(pm4g2ap1);
- store.addObject(pm4g2ap2);
-
- store.addObject(pm5);
- store.addObject(pm5g1);
- store.addObjects(pm5g1e);
- store.addObject(pm5g2);
- store.addObjects(pm5g2e);
- store.addObject(pm5g3);
- store.addObjects(pm5g3e);
- store.addObject(pm5g1ap1);
- store.addObject(pm5g2ap1);
- store.addObject(pm5g2ap2);
-
- store.addObject(pm6);
- store.addObject(pm6g1);
- store.addObjects(pm6g1e);
-
- store.addObject(tm1);
- store.addObject(tm1g1);
- store.addObjects(tm1g1e);
- store.addObject(tm1g2);
- store.addObjects(tm1g2e);
-
- store.addObject(vm1);
- store.addObject(vm1g1);
- store.addObjects(vm1g1e);
- store.addObject(vm1g1_defect10711);
- store.addObjects(vm1g1e_defect10711);
- store.addObject(vm1g1_defect12081);
- store.addObjects(vm1g1e_defect12081);
- store.addObject(vm1g1c);
- store.addObjects(vm1g1ce);
- store.addObject(vm1g2a);
- store.addObjects(vm1g2ae);
- store.addObject(vm1g2);
- store.addObjects(vm1g2e);
- store.addObject(vm1g4);
- store.addObjects(vm1g4e);
- store.addObject(vm1g5);
- store.addObjects(vm1g5e);
- store.addObject(vm1g6);
- store.addObjects(vm1g6e);
- store.addObject(vm1g7);
- store.addObjects(vm1g7e);
- store.addObject(vm1g8);
- store.addObjects(vm1g8e);
- store.addObject(vm1g9);
- store.addObjects(vm1g9e);
- store.addObject(vm1g10);
- store.addObjects(vm1g10e);
- store.addObject(vm1g11);
- store.addObjects(vm1g11e);
- store.addObject(vm1g12);
- store.addObjects(vm1g12e);
- store.addObject(vm1g13);
- store.addObjects(vm1g13e);
- store.addObject(vm1g14);
- store.addObjects(vm1g14e);
- store.addObject(vm1g15);
- store.addObjects(vm1g15e);
- store.addObject(vm1g16);
- store.addObjects(vm1g16e);
- store.addObject(vm1g17);
- store.addObjects(vm1g17e);
- store.addObject(vm1g18);
- store.addObjects(vm1g18e);
- store.addObject(vm1g19);
- store.addObjects(vm1g19e);
- store.addObject(vm1g20);
- store.addObjects(vm1g20e);
- store.addObject(vm1g21);
- store.addObjects(vm1g21e);
- store.addObject(vm1g22);
- store.addObjects(vm1g22e);
- store.addObject(vm1g23);
- store.addObjects(vm1g23e);
- store.addObject(vm1g24);
- store.addObjects(vm1g24e);
- store.addObject(vm1g25);
- store.addObjects(vm1g25e);
- store.addObject(vm1g26);
- store.addObjects(vm1g26e);
- store.addObject(vm1g27);
- store.addObjects(vm1g27e);
- store.addObject(vm1g28);
- store.addObjects(vm1g28e);
- store.addObject(vm1g29);
- store.addObjects(vm1g29e);
- store.addObject(vm1g30);
- store.addObjects(vm1g30e);
- store.addObject(vm1g31);
- store.addObjects(vm1g31e);
- store.addObject(vm1g32);
- store.addObjects(vm1g32e);
- store.addObject(vm1g33);
- store.addObjects(vm1g33e);
- store.addObject(vm1g34);
- store.addObjects(vm1g34e);
- store.addObject(vm1g36);
- store.addObjects(vm1g36e);
- store.addObject(vm1g37);
- store.addObjects(vm1g37e);
- store.addObject(vm1g37ap1);
- store.addObject(vm1g38);
- store.addObjects(vm1g38e);
-
- store.addObject(vm2);
- store.addObject(vm2g1);
- store.addObjects(vm2g1e);
-
- store.addObject(doc1);
- store.addObject(doc2);
- store.addObject(doc3);
- store.addObject(doc4);
- store.addObject(doc5);
- store.addObject(doc6);
- store.addObject(docAmbiguous1);
- store.addObject(docAmbiguous2);
- store.addObjects(docE1);
- store.addObjects(docE2);
- store.addObjects(docE3);
- store.addObjects(docE4);
- store.addObjects(docE5);
- store.addObject(vm1mc1);
- store.addObjects(vm1mc1e);
- store.addObjects(docE6);
-
-
- store.addObject(rs1);
- store.addObject(sq1);
- store.addObject(rs2);
- store.addObject(sq2);
- store.addObject(rs3);
- store.addObject(sp1);
- store.addObject(rs4);
- store.addObject(sqsp1);
- store.addObject(rs5);
- store.addObject(rs5a);
- store.addObject(sq3);
- store.addObject(sq3a);
- store.addObject(sq3b);
- store.addObject(sqDefaults);
- store.addObject(sqBadDefault);
- store.addObject(rs6);
- store.addObject(sq4);
- store.addObject(rs7);
- store.addObject(sq5);
- store.addObject(rs8);
- store.addObject(sq6);
- store.addObject(rs9);
- store.addObject(sq7);
- store.addObject(rs10);
- store.addObject(sq8);
- store.addObject(rs11);
- store.addObject(sq9);
- store.addObject(rs12);
- store.addObject(sq10);
- store.addObject(rs13);
- store.addObject(sp2);
- store.addObject(rs14);
- store.addObject(sq11);
- store.addObject(rs15);
- store.addObject(sq12);
- store.addObject(rs16);
- store.addObject(sq13);
- store.addObject(rs17);
- store.addObject(sq14);
- store.addObject(rs18);
- store.addObject(sq15);
- store.addObject(sq16);
- store.addObject(rs19);
- store.addObject(sq17);
- store.addObject(sp3);
- store.addObject(rs20);
- store.addObject(sq18);
- store.addObject(rs21);
- store.addObject(sq19);
- store.addObject(vsp1);
- store.addObject(vsp2);
- store.addObject(vsp3);
- store.addObject(vsp4);
- store.addObject(vsp5);
- store.addObject(vsp6);
- store.addObject(vsp7);
- store.addObject(vsp8);
- store.addObject(vsp9);
- store.addObject(vsp10);
- store.addObject(vsp11);
- store.addObject(vsp12);
- store.addObject(vsp13);
- store.addObject(vsp14);
- store.addObject(vsp15);
- store.addObject(vsp16);
- store.addObject(vsp17);
- store.addObject(vsp18);
- store.addObject(vsp19);
- store.addObject(vsp20);
- store.addObject(vsp21);
- store.addObject(vsp22);
- store.addObject(vsp23);
- store.addObject(vsp24);
- store.addObject(vsp25);
- store.addObject(vsp27);
- store.addObject(vsp28);
- store.addObject(vsp29);
- store.addObject(vsp33);
- store.addObject(vsp34);
- store.addObject(sp4);
- store.addObject(sp5);
- store.addObject(vsp26);
- store.addObject(vsprs30);
- store.addObject(vsp30);
- store.addObject(vsprs31);
- store.addObject(vsp31);
- store.addObject(vsp35);
- store.addObject(vgvp1);
- store.addObject(vgvp1e1);
- store.addObject(vgvp1e2);
- store.addObject(vgvp1e3);
- store.addObject(vgvp2);
- store.addObject(vgvp2e1);
- store.addObject(vgvp2e2);
- store.addObject(vgvp2e3);
- store.addObject(vgvp3);
- store.addObject(vgvp3e1);
- store.addObject(vgvp3e2);
- store.addObject(vgvp3e3);
- store.addObject(vgvp4);
- store.addObject(vgvp4e1);
- store.addObject(vgvp4e2);
- store.addObject(vgvp4e3);
- store.addObject(vgvp5);
- store.addObject(vgvp5e1);
- store.addObject(vgvp5e2);
- store.addObject(vgvp5e3);
- store.addObject(vgvp6);
- store.addObject(vgvp6e1);
- store.addObject(vgvp6e2);
- store.addObject(vgvp6e3);
- store.addObject(vgvp6e4);
- store.addObject(vgvp7);
- store.addObject(vgvp7e1);
- store.addObject(vgvp7e2);
- store.addObject(vgvp7e3);
- store.addObject(vgvp7e4);
- store.addObject(vm1g35);
- store.addObject(vm1g35e1);
- store.addObject(vm1g35e2);
- store.addObject(vsp36);
- store.addObject(vsprs36);
- store.addObject(vsp32);
- store.addObject(vsp37);
- store.addObject(vsp38);
- store.addObject(vsp39);
- store.addObject(vsp40);
- store.addObject(vsp41);
- store.addObject(vsp42);
- store.addObject(vsp43);
- store.addObject(vsp44);
- store.addObject(vsp45);
- store.addObject(vsp46);
- store.addObject(vsp47);
- store.addObject(vsp48rs);
- store.addObject(vsp48);
- store.addObject(vsp49rs);
- store.addObject(vsp49);
- store.addObject(vsp50rs);
- store.addObject(vsp50);
- store.addObject(vsp51rs);
- store.addObject(vsp51);
- store.addObject(vsp52rs);
- store.addObject(vsp52);
- store.addObject(vsp53rs);
- store.addObject(vsp53);
- store.addObject(vsp54rs);
- store.addObject(vsp54);
- store.addObject(vsp55);
- store.addObject(vsp56);
- store.addObject(vsp57);
- store.addObject(vsp58);
- store.addObject(vsp59);
- store.addObject(vsp60);
- store.addObject(vsp61);
- store.addObject(vsp62);
- store.addObject(vm1g39);
- store.addObjects(vm1g39e);
-
- // Create the facade from the store
- return new FakeMetadataFacade(store);
- }
-
- private static MappingDocument exampleDoc1() {
- MappingDocument doc = new MappingDocument(false);
- MappingElement root = doc.addChildElement(new MappingElement("root")); //$NON-NLS-1$
- MappingElement node1 = root.addChildElement(new MappingElement("node1")); //$NON-NLS-1$
- MappingElement node2 = node1.addChildElement(new MappingElement("node2")); //$NON-NLS-1$
- node2.addChildElement(new MappingElement("node3")); //$NON-NLS-1$
- return doc;
- }
-
- private static MappingDocument exampleDoc2() {
-
- MappingDocument doc = new MappingDocument(false);
- MappingElement root = doc.addChildElement(new MappingElement("root")); //$NON-NLS-1$
- MappingElement node1 = root.addChildElement(new MappingElement("node1")); //$NON-NLS-1$
-
- MappingSequenceNode node2 = node1.addSequenceNode(new MappingSequenceNode());
- node2.addChildElement(new MappingElement("node3")); //$NON-NLS-1$
- root.addChildElement(new MappingElement("node2")); //$NON-NLS-1$
- return doc;
- }
-
- // has ambiguous short and long names
- private static MappingDocument exampleDoc3() {
- MappingDocument doc = new MappingDocument(false);
- MappingElement root = doc.addChildElement(new MappingElement("root")); //$NON-NLS-1$
-
- MappingSequenceNode node1 = root.addSequenceNode(new MappingSequenceNode());
- node1.addChildElement(new MappingElement("node2")); //$NON-NLS-1$
- root.addChildElement(new MappingElement("node2")); //$NON-NLS-1$
- return doc;
- }
-
-
- // has attributes and elements
- private static MappingDocument exampleDoc4() {
-
- MappingDocument doc = new MappingDocument(false);
-
- MappingElement root = doc.addChildElement(new MappingElement("root")); //$NON-NLS-1$
-
- root.addAttribute(new MappingAttribute("node6")); //$NON-NLS-1$
- root.addStagingTable("tm1.g1"); //$NON-NLS-1$
-
- MappingElement node1 =root.addChildElement(new MappingElement("node1")); //$NON-NLS-1$
- node1.addAttribute(new MappingAttribute("node2")); //$NON-NLS-1$
-
- MappingElement node3 =root.addChildElement(new MappingElement("node3")); //$NON-NLS-1$
- node3.addAttribute(new MappingAttribute("node4")); //$NON-NLS-1$
-
- MappingElement node5 = node3.addChildElement(new MappingElement("node4")); //$NON-NLS-1$
- MappingElement duplicateRoot = node5.addChildElement(new MappingElement("root")); //$NON-NLS-1$
-
- duplicateRoot.addChildElement(new MappingElement("node6")); //$NON-NLS-1$
- return doc;
- }
-
- // has a union in the mapping class
- private static MappingDocument exampleDoc5() {
- MappingDocument doc = new MappingDocument(false);
- MappingElement root = doc.addChildElement(new MappingElement("root")); //$NON-NLS-1$
-
- MappingElement node1 = root.addChildElement(new MappingElement("node1")); //$NON-NLS-1$
- node1.addChildElement(new MappingElement("node2","xmltest.mc1.e1")); //$NON-NLS-1$ //$NON-NLS-2$
- node1.setSource("xmltest.mc1"); //$NON-NLS-1$
- node1.setMaxOccurrs(-1);
- return doc;
- }
-
- // has two elements with common suffix, but not ambiguous
- private static MappingDocument exampleDoc6() {
- MappingDocument doc = new MappingDocument(false);
- MappingElement root = doc.addChildElement(new MappingElement("root")); //$NON-NLS-1$
-
- root.addChildElement(new MappingElement("node")); //$NON-NLS-1$
- root.addChildElement(new MappingElement("thenode")); //$NON-NLS-1$
- return doc;
- }
-
- public static FakeMetadataFacade example3() {
- // Create models
- FakeMetadataObject pm1 = createPhysicalModel("pm1"); //$NON-NLS-1$
- FakeMetadataObject pm2 = createPhysicalModel("pm2"); //$NON-NLS-1$
- FakeMetadataObject pm3 = createPhysicalModel("pm3"); //$NON-NLS-1$
-
- // Create physical groups
- FakeMetadataObject pm1g1 = createPhysicalGroup("pm1.cat1.cat2.cat3.g1", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g2 = createPhysicalGroup("pm1.cat1.g2", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g3 = createPhysicalGroup("pm1.cat2.g3", pm1); //$NON-NLS-1$
- FakeMetadataObject pm2g1 = createPhysicalGroup("pm2.cat1.g1", pm2); //$NON-NLS-1$
- FakeMetadataObject pm2g2 = createPhysicalGroup("pm2.cat2.g2", pm2); //$NON-NLS-1$
- FakeMetadataObject pm2g3 = createPhysicalGroup("pm2.g3", pm2); //$NON-NLS-1$
- FakeMetadataObject pm2g4 = createPhysicalGroup("pm2.g4", pm3); //$NON-NLS-1$
- FakeMetadataObject pm2g5 = createPhysicalGroup("pm2.cat3.g1", pm2); //$NON-NLS-1$
-
- // Create physical elements
- List pm1g1e = createElements(pm1g1,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm1g2e = createElements(pm1g2,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm1g3e = createElements(pm1g3,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm2g1e = createElements(pm2g1,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm2g2e = createElements(pm2g2,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm2g3e = createElements(pm2g3,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm2g4e = createElements(pm2g4,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm2g5e = createElements(pm2g5,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
-
-
- // Add all objects to the store
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(pm1);
- store.addObject(pm1g1);
- store.addObjects(pm1g1e);
- store.addObject(pm1g2);
- store.addObjects(pm1g2e);
- store.addObject(pm1g3);
- store.addObjects(pm1g3e);
-
- store.addObject(pm2);
- store.addObject(pm2g1);
- store.addObjects(pm2g1e);
- store.addObject(pm2g2);
- store.addObjects(pm2g2e);
- store.addObject(pm2g3);
- store.addObject(pm2g4);
- store.addObject(pm2g5);
- store.addObjects(pm2g3e);
- store.addObjects(pm2g4e);
- store.addObjects(pm2g5e);
-
- store.addObject(pm3);
-
- // Create the facade from the store
- return new FakeMetadataFacade(store);
- }
-
- /**
- * This example is for testing static costing using cardinality information from
- * metadata, as well as key information and maybe access patterns
- * @return FakeMetadataFacade
- */
- public static FakeMetadataFacade example4() {
- // Create models - physical ones will support joins
- FakeMetadataObject pm1 = createPhysicalModel("pm1"); //$NON-NLS-1$
- FakeMetadataObject pm2 = createPhysicalModel("pm2"); //$NON-NLS-1$
- FakeMetadataObject pm3 = createPhysicalModel("pm3"); //$NON-NLS-1$
- FakeMetadataObject pm4 = createPhysicalModel("pm4"); //$NON-NLS-1$
- FakeMetadataObject vm1 = createVirtualModel("vm1"); //$NON-NLS-1$
-
- // Create physical groups
- FakeMetadataObject pm1g1 = createPhysicalGroup("pm1.g1", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g2 = createPhysicalGroup("pm1.g2", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g3 = createPhysicalGroup("pm1.g3", pm1); //$NON-NLS-1$
- FakeMetadataObject pm2g1 = createPhysicalGroup("pm2.g1", pm2); //$NON-NLS-1$
- FakeMetadataObject pm2g2 = createPhysicalGroup("pm2.g2", pm2); //$NON-NLS-1$
- FakeMetadataObject pm2g3 = createPhysicalGroup("pm2.g3", pm2); //$NON-NLS-1$
- FakeMetadataObject pm3g1 = createPhysicalGroup("pm3.g1", pm3); //$NON-NLS-1$
- FakeMetadataObject pm3g2 = createPhysicalGroup("pm3.g2", pm3); //$NON-NLS-1$
- FakeMetadataObject pm3g3 = createPhysicalGroup("pm3.g3", pm3); //$NON-NLS-1$
- FakeMetadataObject pm4g1 = createPhysicalGroup("pm4.g1", pm4); //$NON-NLS-1$
- FakeMetadataObject pm4g2 = createPhysicalGroup("pm4.g2", pm4); //$NON-NLS-1$
- // Add group cardinality metadata
- pm1g1.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(10));
- pm1g2.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(10));
- pm1g3.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(10));
- pm2g1.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(1000));
- pm2g2.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(1000));
- pm3g1.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(100000));
- pm3g2.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(100000));
- pm3g3.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(100000));
- // leave pm4.g1 as unknown
-
- // Create physical elements
- List pm1g1e = createElements(pm1g1,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm1g2e = createElements(pm1g2,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm1g3e = createElements(pm1g3,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm2g1e = createElements(pm2g1,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm2g2e = createElements(pm2g2,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm2g3e = createElements(pm2g3,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm3g1e = createElements(pm3g1,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm3g2e = createElements(pm3g2,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm3g3e = createElements(pm3g3,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm4g1e = createElements(pm4g1,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm4g2e = createElements(pm4g2,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
-
- // Add key metadata
- FakeMetadataObject pm1g1key1 = createKey("pm1.g1.key1", pm1g1, pm1g1e.subList(0, 1)); //e1 //$NON-NLS-1$
- FakeMetadataObject pm3g1key1 = createKey("pm3.g1.key1", pm3g1, pm3g1e.subList(0, 1)); //e1 //$NON-NLS-1$
- FakeMetadataObject pm3g3key1 = createKey("pm3.g3.key1", pm3g3, pm3g3e.subList(0, 1)); //e1 //$NON-NLS-1$
- FakeMetadataObject pm4g1key1 = createKey("pm4.g1.key1", pm4g1, pm4g1e.subList(0, 2)); //e1, e2 //$NON-NLS-1$
- FakeMetadataObject pm4g2key1 = createForeignKey("pm4.g2.fk", pm4g2, pm4g2e.subList(0, 2), pm4g1key1); //$NON-NLS-1$
- // Add access pattern metadata
- // Create access patterns - pm1
- List elements = new ArrayList(1);
- elements.add(pm1g1e.iterator().next());
- FakeMetadataObject pm1g1ap1 = createAccessPattern("pm1.g1.ap1", pm1g1, elements); //e1 //$NON-NLS-1$
- elements = new ArrayList(2);
- Iterator iter = pm1g3e.iterator();
- elements.add(iter.next());
- elements.add(iter.next());
- FakeMetadataObject pm1g3ap1 = createAccessPattern("pm1.g3.ap1", pm1g3, elements); //e1,e2 //$NON-NLS-1$
- // Create access patterns - pm2
- elements = new ArrayList(1);
- elements.add(pm2g1e.iterator().next());
- FakeMetadataObject pm2g1ap1 = createAccessPattern("pm2.g1.ap1", pm2g1, elements); //e1 //$NON-NLS-1$
-
-
- // Create virtual groups
- QueryNode vm1g1n1 = new QueryNode("SELECT * FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g1 = createUpdatableVirtualGroup("vm1.g1", vm1, vm1g1n1); //$NON-NLS-1$
-
- QueryNode vm1g2n1 = new QueryNode("SELECT pm1.g2.e1, pm1.g2.e2, pm1.g2.e3 FROM pm1.g2"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g2 = createUpdatableVirtualGroup("vm1.g2", vm1, vm1g2n1); //$NON-NLS-1$
-
- QueryNode vm1g3n1 = new QueryNode("SELECT pm1.g3.e1 AS x, pm1.g3.e2 AS y from pm1.g3"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g3 = createUpdatableVirtualGroup("vm1.g3", vm1, vm1g3n1); //$NON-NLS-1$
-
- QueryNode vm1g4n1 = new QueryNode("SELECT distinct pm1.g2.e1 as ve1, pm1.g1.e1 as ve2 FROM pm1.g2 LEFT OUTER JOIN /* optional */ pm1.g1 on pm1.g1.e1 = pm1.g2.e1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g4 = createVirtualGroup("vm1.g4", vm1, vm1g4n1); //$NON-NLS-1$
- List vm1g4e = createElements(vm1g4,
- new String[] { "ve1", "ve2" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
-
- // Create virtual elements
- List vm1g1e = createElements(vm1g1,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g2e = createElements(vm1g2,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List vm1g3e = createElements(vm1g3,
- new String[] { "e1", "e2","x", "y" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
-
- // Add all objects to the store
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(pm1);
- store.addObject(pm1g1);
- store.addObjects(pm1g1e);
- store.addObject(pm1g2);
- store.addObjects(pm1g2e);
- store.addObject(pm1g3);
- store.addObjects(pm1g3e);
- store.addObject(pm1g1key1);
- store.addObject(pm1g1ap1);
- store.addObject(pm1g3ap1);
-
- store.addObject(pm2);
- store.addObject(pm2g1);
- store.addObjects(pm2g1e);
- store.addObject(pm2g2);
- store.addObjects(pm2g2e);
- store.addObject(pm2g3);
- store.addObjects(pm2g3e);
- store.addObject(pm2g1ap1);
-
- store.addObject(pm3);
- store.addObject(pm3g1);
- store.addObjects(pm3g1e);
- store.addObject(pm3g2);
- store.addObjects(pm3g2e);
- store.addObject(pm3g3);
- store.addObjects(pm3g3e);
- store.addObject(pm3g1key1);
- store.addObject(pm3g3key1);
-
- store.addObject(pm4);
- store.addObject(pm4g1);
- store.addObjects(pm4g1e);
- store.addObject(pm4g1key1);
- store.addObject(pm4g2);
- store.addObjects(pm4g2e);
- store.addObject(pm4g2key1);
-
- store.addObject(vm1);
- store.addObject(vm1g1);
- store.addObjects(vm1g1e);
- store.addObject(vm1g2);
- store.addObjects(vm1g2e);
- store.addObject(vm1g3);
- store.addObjects(vm1g3e);
- store.addObject(vm1g4);
- store.addObjects(vm1g4e);
-
- // Create the facade from the store
- return new FakeMetadataFacade(store);
- }
-
- public static FakeMetadataFacade exampleUpdateProc(String procedureType, String procedure) {
- // Create models
- FakeMetadataObject pm1 = createPhysicalModel("pm1"); //$NON-NLS-1$
- FakeMetadataObject pm2 = createPhysicalModel("pm2"); //$NON-NLS-1$
- FakeMetadataObject vm1 = createVirtualModel("vm1"); //$NON-NLS-1$
-
- // Create physical groups
- FakeMetadataObject pm1g1 = createPhysicalGroup("pm1.g1", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g2 = createPhysicalGroup("pm1.g2", pm1); //$NON-NLS-1$
- FakeMetadataObject pm2g1 = createPhysicalGroup("pm2.g1", pm2); //$NON-NLS-1$
- FakeMetadataObject pm2g2 = createPhysicalGroup("pm2.g2", pm2); //$NON-NLS-1$
-
- // Create physical group elements
- List pm1g1e = createElements(pm1g1,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm1g2e = createElements(pm1g2,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm2g1e = createElements(pm2g1,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm2g2e = createElements(pm2g2,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
-
- // Create virtual groups
- QueryNode vm1g1n1 = new QueryNode("SELECT * FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g1 = createUpdatableVirtualGroup("vm1.g1", vm1, vm1g1n1); //$NON-NLS-1$
-
- QueryNode vm1g2n1 = new QueryNode("SELECT pm1.g2.e1, pm1.g2.e2, pm1.g2.e3 FROM pm1.g2"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g2 = createUpdatableVirtualGroup("vm1.g2", vm1, vm1g2n1); //$NON-NLS-1$
-
- QueryNode vm1g3n1 = new QueryNode("SELECT CONCAT(e1, 'm') as x, (e2 +1) as y, 1 as e3, e4*50 as e4 FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g3 = createUpdatableVirtualGroup("vm1.g3", vm1, vm1g3n1); //$NON-NLS-1$
-
- QueryNode vm1g4n1 = new QueryNode("SELECT * FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g4 = createUpdatableVirtualGroup("vm1.g4", vm1, vm1g4n1); //$NON-NLS-1$
-
- // Create virtual elements
- List vm1g1e = createElementsWithDefaults(vm1g1,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE },
- new Object[] { "xyz", Integer.getInteger("123"), Boolean.valueOf("true"), Double.valueOf("123.456")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- List vm1g2e = createElementsWithDefaults(vm1g2,
- new String[] { "e1", "e2", "e3" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN },
- new Object[] { "abc", Integer.getInteger("456"), Boolean.valueOf("false")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- List vm1g3e = createElementsWithDefaults(vm1g3,
- new String[] { "x", "y", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER , DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.DOUBLE },
- new Object[] { "mno", Integer.getInteger("789"), Boolean.valueOf("true"), Double.valueOf("789.012")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- List vm1g4e = createElementsWithDefaults(vm1g4,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE },
- new Object[] { "xyz", Integer.getInteger("123"), Boolean.valueOf("true"), Double.valueOf("123.456")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- vm1g1.putProperty(procedureType, procedure);
- vm1g2.putProperty(procedureType, procedure);
- vm1g3.putProperty(procedureType, procedure);
- vm1g4.putProperty(procedureType, procedure);
-
- // Add all objects to the store
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(pm1);
- store.addObject(pm1g1);
- store.addObjects(pm1g1e);
- store.addObject(pm1g2);
- store.addObjects(pm1g2e);
-
- store.addObject(pm2);
- store.addObject(pm2g1);
- store.addObjects(pm2g1e);
- store.addObject(pm2g2);
- store.addObjects(pm2g2e);
-
- store.addObject(vm1);
- store.addObject(vm1g1);
- store.addObjects(vm1g1e);
- store.addObject(vm1g2);
- store.addObjects(vm1g2e);
- store.addObject(vm1g3);
- store.addObjects(vm1g3e);
- store.addObject(vm1g4);
- store.addObjects(vm1g4e);
-
- // Create the facade from the store
- return new FakeMetadataFacade(store);
- }
-
- public static FakeMetadataFacade exampleUpdateProc(String procedureType, String procedure1, String procedure2) {
- // Create models
- FakeMetadataObject pm1 = createPhysicalModel("pm1"); //$NON-NLS-1$
- FakeMetadataObject pm2 = createPhysicalModel("pm2"); //$NON-NLS-1$
- FakeMetadataObject vm1 = createVirtualModel("vm1"); //$NON-NLS-1$
-
- // Create physical groups
- FakeMetadataObject pm1g1 = createPhysicalGroup("pm1.g1", pm1); //$NON-NLS-1$
- FakeMetadataObject pm1g2 = createPhysicalGroup("pm1.g2", pm1); //$NON-NLS-1$
- FakeMetadataObject pm2g1 = createPhysicalGroup("pm2.g1", pm2); //$NON-NLS-1$
- FakeMetadataObject pm2g2 = createPhysicalGroup("pm2.g2", pm2); //$NON-NLS-1$
-
- // Create physical group elements
- List pm1g1e = createElements(pm1g1,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm1g2e = createElements(pm1g2,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm2g1e = createElements(pm2g1,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
- List pm2g2e = createElements(pm2g2,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
-
- // Create virtual groups
- QueryNode vm1g1n1 = new QueryNode("SELECT * FROM vm1.g2"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g1 = createUpdatableVirtualGroup("vm1.g1", vm1, vm1g1n1); //$NON-NLS-1$
-
- QueryNode vm1g2n1 = new QueryNode("SELECT pm1.g2.e1, pm1.g2.e2, pm1.g2.e3, pm1.g2.e4 FROM pm1.g2"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g2 = createUpdatableVirtualGroup("vm1.g2", vm1, vm1g2n1); //$NON-NLS-1$
-
- // Create virtual elements
- List vm1g1e = createElementsWithDefaults(vm1g1,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE },
- new Object[] { "xyz", Integer.getInteger("123"), Boolean.valueOf("true"), Double.valueOf("123.456")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- List vm1g2e = createElementsWithDefaults(vm1g2,
- new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE },
- new Object[] { "abc", Integer.getInteger("456"), Boolean.valueOf("false"), null}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- vm1g1.putProperty(procedureType, procedure1);
- vm1g2.putProperty(procedureType, procedure2);
-
- // Add all objects to the store
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(pm1);
- store.addObject(pm1g1);
- store.addObjects(pm1g1e);
- store.addObject(pm1g2);
- store.addObjects(pm1g2e);
-
- store.addObject(pm2);
- store.addObject(pm2g1);
- store.addObjects(pm2g1e);
- store.addObject(pm2g2);
- store.addObjects(pm2g2e);
-
- store.addObject(vm1);
- store.addObject(vm1g1);
- store.addObjects(vm1g1e);
- store.addObject(vm1g2);
- store.addObjects(vm1g2e);
-
- // Create the facade from the store
- return new FakeMetadataFacade(store);
- }
-
- public static VDBMetaData exampleBQTVDB() {
- VDBMetaData vdb = new VDBMetaData();
- vdb.setName("example1");
- vdb.setVersion(1);
- vdb.addModel(createModel("BQT1", true));
- vdb.addModel(createModel("BQT2", true));
- vdb.addModel(createModel("BQT3", true));
- vdb.addModel(createModel("LOB", true));
- vdb.addModel(createModel("VQT", false));
- vdb.addModel(createModel("pm1", true));
- vdb.addModel(createModel("pm2", true));
- vdb.addModel(createModel("pm3", true));
- vdb.addModel(createModel("pm4", true));
-
- return vdb;
- }
-
- public static TransformationMetadata exampleBQT() {
- return RealMetadataFactory.exampleBQT();
- }
-
- public static FakeMetadataFacade exampleYahoo() {
- // Create models
- FakeMetadataObject yahoo = createPhysicalModel("Yahoo"); //$NON-NLS-1$
-
- // Create physical groups
- FakeMetadataObject quotes = createPhysicalGroup("Yahoo.QuoteServer", yahoo); //$NON-NLS-1$
-
- // Create physical elements
- String[] elemNames = new String[] {
- "TickerSymbol", "LastTrade", //$NON-NLS-1$ //$NON-NLS-2$
- "LastTradeDate", "LastTradeTime", //$NON-NLS-1$ //$NON-NLS-2$
- "PercentageChange", "TickerSymbol2", //$NON-NLS-1$ //$NON-NLS-2$
- "DaysHigh", "DaysLow", //$NON-NLS-1$ //$NON-NLS-2$
- "TotalVolume" //$NON-NLS-1$
- };
- String[] elemTypes = new String[] {
- DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DOUBLE,
- DataTypeManager.DefaultDataTypes.DATE, DataTypeManager.DefaultDataTypes.TIME,
- DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.DOUBLE,
- DataTypeManager.DefaultDataTypes.BIG_INTEGER
- };
-
- List cols = createElements(quotes, elemNames, elemTypes);
-
- // Set name in source on each column
- String[] nameInSource = new String[] {
- "Symbol", "Last", "Date", "Time", "Change", "Symbol2", "High", "Low", "Volume" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
- };
- for(int i=0; i<9; i++) {
- FakeMetadataObject obj = (FakeMetadataObject) cols.get(i);
- obj.putProperty(FakeMetadataObject.Props.NAME_IN_SOURCE, nameInSource[i]);
- }
-
- // Set column-specific properties
- ((FakeMetadataObject) cols.get(0)).putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- for(int i=1; i<9; i++) {
- ((FakeMetadataObject) cols.get(0)).putProperty(FakeMetadataObject.Props.SEARCHABLE_COMPARE, Boolean.FALSE);
- ((FakeMetadataObject) cols.get(0)).putProperty(FakeMetadataObject.Props.SEARCHABLE_LIKE, Boolean.FALSE);
- }
-
- // Add all objects to the store
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(yahoo);
- store.addObject(quotes);
- store.addObjects(cols);
-
- // Create the facade from the store
- return new FakeMetadataFacade(store);
- }
-
- public static VDBMetaData examplePrivatePhysicalModelVDB() {
- VDBMetaData vdb = new VDBMetaData();
- vdb.setName("example1");
- vdb.setVersion(1);
- ModelMetaData m = createModel("pm1", true);
- m.setVisible(false);
- vdb.addModel(m);
- vdb.addModel(createModel("vm1", false));
-
- return vdb;
- }
-
- public static FakeMetadataFacade examplePrivatePhysicalModel() {
- // Create models
- FakeMetadataObject pm1 = createPhysicalModel("pm1"); //$NON-NLS-1$
- FakeMetadataObject vm1 = createVirtualModel("vm1"); //$NON-NLS-1$
-
- // Create physical groups
- FakeMetadataObject pm1g1 = createPhysicalGroup("pm1.g1", pm1); //$NON-NLS-1$
-
- QueryNode vm1g1n1 = new QueryNode("SELECT * FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vm1g1 = createVirtualGroup("vm1.g1", vm1, vm1g1n1); //$NON-NLS-1$
-
- FakeMetadataObject pm1g2 = createPhysicalGroup("pm1.g2", pm1); //$NON-NLS-1$
-
- // Create physical elements
- List pm1g1e = createElements(pm1g1,
- new String[] { "e1"}, //$NON-NLS-1$
- new String[] { DataTypeManager.DefaultDataTypes.SHORT});
-
- // Create physical elements
- List pm1g2e = createElements(pm1g2,
- new String[] { "e1"}, //$NON-NLS-1$
- new String[] { DataTypeManager.DefaultDataTypes.BIG_DECIMAL});
-
- FakeMetadataObject e1 = (FakeMetadataObject)pm1g2e.get(0);
- e1.putProperty(FakeMetadataObject.Props.PRECISION, "19"); //$NON-NLS-1$
- e1.putProperty(FakeMetadataObject.Props.LENGTH, "21"); //$NON-NLS-1$
- e1.putProperty(FakeMetadataObject.Props.SCALE, "4"); //$NON-NLS-1$
-
- List vm1g1e = createElements(vm1g1,
- new String[] { "e1" }, //$NON-NLS-1$
- new String[] { DataTypeManager.DefaultDataTypes.STRING });
- // Add all objects to the store
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(pm1);
- store.addObject(pm1g1);
- store.addObjects(pm1g1e);
-
- store.addObject(vm1);
- store.addObject(vm1g1);
- store.addObjects(vm1g1e);
-
- store.addObject(pm1g2);
- store.addObjects(pm1g2e);
-
- // Create the facade from the store
- return new FakeMetadataFacade(store);
- }
-
- public static FakeMetadataFacade exampleBusObj() {
- // Create db2 tables
- FakeMetadataObject db2Model = createPhysicalModel("db2model"); //$NON-NLS-1$
-
- FakeMetadataObject db2Table = createPhysicalGroup("db2model.DB2_TABLE", db2Model); //$NON-NLS-1$
- List db2Elements = createElements(db2Table,
- new String[] { "PRODUCT", "REGION", "SALES"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DOUBLE});
-
- FakeMetadataObject salesTable = createPhysicalGroup("db2model.SALES", db2Model); //$NON-NLS-1$
- salesTable.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(1000000));
- List salesElem = createElements(salesTable,
- new String[] { "CITY", "MONTH", "SALES"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DOUBLE});
-
- FakeMetadataObject geographyTable2 = createPhysicalGroup("db2model.GEOGRAPHY2", db2Model); //$NON-NLS-1$
- geographyTable2.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(1000));
- List geographyElem2 = createElements(geographyTable2,
- new String[] { "CITY", "REGION"}, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
- List geoPkElem2 = new ArrayList();
- geoPkElem2.add(geographyElem2.get(0));
- FakeMetadataObject geoPk2 = createKey("db2model.GEOGRAPHY2.GEOGRAPHY_PK", geographyTable2, geoPkElem2); //$NON-NLS-1$
-
- FakeMetadataObject db2Table2 = createPhysicalGroup("db2model.DB2TABLE", db2Model); //$NON-NLS-1$
- List db2Elements2 = createElements(db2Table2,
- new String[] { "c0", "c1", "c2"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER});
-
- // Create oracle tables
- FakeMetadataObject oraModel = createPhysicalModel("oraclemodel"); //$NON-NLS-1$
-
- FakeMetadataObject oraTable = createPhysicalGroup("oraclemodel.Oracle_table", oraModel); //$NON-NLS-1$
- List oracleElements = createElements(oraTable,
- new String[] { "COSTS", "REGION", "YEAR"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new String[] { DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
-
- FakeMetadataObject geographyTable = createPhysicalGroup("oraclemodel.GEOGRAPHY", oraModel); //$NON-NLS-1$
- geographyTable.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(1000));
- List geographyElem = createElements(geographyTable,
- new String[] { "CITY", "REGION"}, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
- List geoPkElem = new ArrayList();
- geoPkElem.add(geographyElem.get(0));
- FakeMetadataObject geoPk = createKey("oraclemodel.GEOGRAPHY.GEOGRAPHY_PK", geographyTable, geoPkElem); //$NON-NLS-1$
-
- FakeMetadataObject oraTable2 = createPhysicalGroup("oraclemodel.OraTable", oraModel); //$NON-NLS-1$
- List oracleElements2 = createElements(oraTable2,
- new String[] { "b0", "b1", "b2"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new String[] { DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
-
- // Create sql server tables
- FakeMetadataObject msModel = createPhysicalModel("msmodel"); //$NON-NLS-1$
-
- FakeMetadataObject timeTable = createPhysicalGroup("msmodel.TIME", msModel); //$NON-NLS-1$
- timeTable.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(120));
- List timeElem = createElements(timeTable,
- new String[] { "MONTH", "YEAR"}, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
- List timePkElem = new ArrayList();
- timePkElem.add(timeElem.get(0));
- FakeMetadataObject timePk = createKey("msmodel.TIME.TIME_PK", timeTable, timePkElem); //$NON-NLS-1$
-
- FakeMetadataObject virtModel = createVirtualModel("logical"); //$NON-NLS-1$
- QueryNode n1 = new QueryNode("select sum(c0) as c0, c1, c2 from db2Table group by c1, c2"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject logicalTable1 = createVirtualGroup("logical.logicalTable1", virtModel, n1); //$NON-NLS-1$
- List logicalElem1 = createElements(logicalTable1,
- new String[] { "c0", "c1", "c2"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new String[] { DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER});
-
- QueryNode n2 = new QueryNode("select sum(c0) as c0, c1, c2 from db2Table group by c1, c2"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject logicalTable2 = createVirtualGroup("logical.logicalTable2", virtModel, n2); //$NON-NLS-1$
- List logicalElem2 = createElements(logicalTable2,
- new String[] { "b0", "b1", "b2"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new String[] { DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER});
-
- // Add all objects to the store
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(db2Model);
- store.addObject(db2Table);
- store.addObjects(db2Elements);
- store.addObject(salesTable);
- store.addObjects(salesElem);
- store.addObject(geographyTable2);
- store.addObjects(geographyElem2);
- store.addObject(geoPk2);
- store.addObject(db2Table2);
- store.addObjects(db2Elements2);
-
- store.addObject(oraModel);
- store.addObject(oraTable);
- store.addObjects(oracleElements);
- store.addObject(geographyTable);
- store.addObjects(geographyElem);
- store.addObject(geoPk);
- store.addObject(oraTable2);
- store.addObjects(oracleElements2);
-
- store.addObject(msModel);
- store.addObject(timeTable);
- store.addObjects(timeElem);
- store.addObject(timePk);
-
- store.addObject(virtModel);
- store.addObject(logicalTable1);
- store.addObjects(logicalElem1);
- store.addObject(logicalTable2);
- store.addObjects(logicalElem2);
-
- // Create the facade from the store
- return new FakeMetadataFacade(store);
- }
-
- public static FakeMetadataFacade exampleAggregates() {
- FakeMetadataStore store = new FakeMetadataStore();
- addAggregateTablesToModel("m1", store); //$NON-NLS-1$
- addAggregateTablesToModel("m2", store); //$NON-NLS-1$
-
- // Create the facade from the store
- return new FakeMetadataFacade(store);
- }
-
- public static void addAggregateTablesToModel(String modelName, FakeMetadataStore store) {
- // Create db2 tables
- FakeMetadataObject model = createPhysicalModel(modelName);
-
- FakeMetadataObject orders = createPhysicalGroup(modelName + ".order", model); //$NON-NLS-1$
- orders.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(1000000));
- List orderElements = createElements(orders,
- new String[] { "O_OrderID", "O_ProductID", "O_DealerID", "O_Amount", "O_Date"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BIG_DECIMAL, DataTypeManager.DefaultDataTypes.DATE });
-
- FakeMetadataObject products = createPhysicalGroup(modelName + ".product", model); //$NON-NLS-1$
- products.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(1000));
- List productsElements = createElements(products,
- new String[] { "P_ProductID", "P_Overhead", "P_DivID"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BIG_DECIMAL, DataTypeManager.DefaultDataTypes.INTEGER});
-
- FakeMetadataObject divisions = createPhysicalGroup(modelName + ".division", model); //$NON-NLS-1$
- divisions.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(100));
- List divisionsElements = createElements(divisions,
- new String[] { "V_DIVID", "V_SectorID"}, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER});
-
- FakeMetadataObject dealers = createPhysicalGroup(modelName + ".dealer", model); //$NON-NLS-1$
- dealers.putProperty(FakeMetadataObject.Props.CARDINALITY, new Integer(1000));
- List dealersElements = createElements(dealers,
- new String[] { "D_DealerID", "D_State", "D_Address"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
-
- // Add all objects to the store
- store.addObject(model);
- store.addObject(orders);
- store.addObjects(orderElements);
- store.addObject(products);
- store.addObjects(productsElements);
- store.addObject(divisions);
- store.addObjects(divisionsElements);
- store.addObject(dealers);
- store.addObjects(dealersElements);
- }
-
-
- public static VDBMetaData exampleMultiBindingVDB() {
- VDBMetaData vdb = new VDBMetaData();
- vdb.setName("exampleMultiBinding");
- vdb.setVersion(1);
-
- ModelMetaData model = new ModelMetaData();
- model.setName("MultiModel");
- model.setModelType(Model.Type.PHYSICAL);
- model.setVisible(true);
-
- model.setSupportsMultiSourceBindings(true);
- vdb.addModel(model);
- vdb.addModel(createModel("Virt", false));
-
- return vdb;
- }
-
- /**
- * Metadata for Multi-Binding models
- * @return example
- * @since 4.2
- */
- public static FakeMetadataFacade exampleMultiBinding() {
- FakeMetadataObject virtModel = createVirtualModel("Virt"); //$NON-NLS-1$
- FakeMetadataObject physModel = createPhysicalModel("MultiModel"); //$NON-NLS-1$
-
- FakeMetadataObject physGroup = createPhysicalGroup("MultiModel.Phys", physModel); //$NON-NLS-1$
- List physElements = createElements(physGroup,
- new String[] { "a", "b" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
-
- QueryNode virtTrans = new QueryNode("SELECT * FROM MultiModel.Phys"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject virtGroup = createVirtualGroup("Virt.view", virtModel, virtTrans); //$NON-NLS-1$
- List virtElements = createElements(virtGroup,
- new String[] { "a", "b" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
-
- FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("Virt.rs1", virtModel, new String[] { "a", "b" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- rs2p2.putProperty(FakeMetadataObject.Props.NULL, Boolean.TRUE);
- QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
- + "execute string 'SELECT a, b FROM MultiModel.Phys where SOURCE_NAME = Virt.sq1.in'; END"); //$NON-NLS-1$
- FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("Virt.sq1", virtModel, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1); //$NON-NLS-1$
-
- FakeMetadataObject rs3 = FakeMetadataFactory.createResultSet("MultiModel.rs1", virtModel, new String[] { "a", "b" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject rs3p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs3); //$NON-NLS-1$
- FakeMetadataObject rs3p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- FakeMetadataObject rs3p3 = FakeMetadataFactory.createParameter("source_name", 3, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- rs3p3.putProperty(FakeMetadataObject.Props.NULL, Boolean.TRUE);
- FakeMetadataObject sq2 = FakeMetadataFactory.createStoredProcedure("MultiModel.proc", physModel, Arrays.asList(new FakeMetadataObject[] { rs3p1, rs3p2, rs3p3 }));
- rs3p2.putProperty(FakeMetadataObject.Props.GROUP, sq2);
- rs3p3.putProperty(FakeMetadataObject.Props.GROUP, sq2);
-
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(virtModel);
- store.addObject(physModel);
- store.addObject(physGroup);
- store.addObjects(physElements);
- store.addObject(virtGroup);
- store.addObjects(virtElements);
-
- store.addObject(rs2);
- store.addObject(sq1);
- store.addObject(rs3);
- store.addObject(sq2);
-
- return new FakeMetadataFacade(store);
- }
-
- /**
- * set up metadata for virtual doc model of this basic structure:
- * <pre>
- *
- * items
- * --suppliers (many-to-many relationship between items and suppliers)
- * --orders
- * --employees (an employees works for a supplier and "specializes" in an item)
- *
- * </pre>
- * @return
- */
- public static FakeMetadataFacade exampleCase3225() {
- FakeMetadataStore store = new FakeMetadataStore();
- FakeMetadataFacade facade = new FakeMetadataFacade(store);
-
- // Create models
- FakeMetadataObject stock = FakeMetadataFactory.createPhysicalModel("stock"); //$NON-NLS-1$
- FakeMetadataObject xmltest = FakeMetadataFactory.createVirtualModel("xmltest"); //$NON-NLS-1$
-
- // Create physical groups
- FakeMetadataObject items = FakeMetadataFactory.createPhysicalGroup("stock.items", stock); //$NON-NLS-1$
- FakeMetadataObject item_supplier = FakeMetadataFactory.createPhysicalGroup("stock.item_supplier", stock); //$NON-NLS-1$
- FakeMetadataObject suppliers = FakeMetadataFactory.createPhysicalGroup("stock.suppliers", stock); //$NON-NLS-1$
- FakeMetadataObject orders = FakeMetadataFactory.createPhysicalGroup("stock.orders", stock); //$NON-NLS-1$
- FakeMetadataObject employees = FakeMetadataFactory.createPhysicalGroup("stock.employees", stock); //$NON-NLS-1$
-
- // Create physical elements
- List itemElements = FakeMetadataFactory.createElements(items,
- new String[] { "itemNum", "itemName", "itemQuantity", "itemStatus" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
-
- //many-to-many join table
- List itemSupplierElements = FakeMetadataFactory.createElements(item_supplier,
- new String[] { "itemNum", "supplierNum" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
-
- List supplierElements = FakeMetadataFactory.createElements(suppliers,
- new String[] { "supplierNum", "supplierName", "supplierZipCode" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
-
- List stockOrders = FakeMetadataFactory.createElements(orders,
- new String[] { "orderNum", "itemFK", "supplierFK", "orderDate", "orderQty", "orderStatus" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING});
-
- List supplierEmployees = FakeMetadataFactory.createElements(employees,
- new String[] { "employeeNum", "supplierNumFK", "specializesInItemNum", "supervisorNum", "firstName", "lastName" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
-
- // Create mapping classes - items doc
- QueryNode rsQuery = new QueryNode("SELECT itemNum, itemName, itemQuantity, itemStatus FROM stock.items"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rsItems = FakeMetadataFactory.createVirtualGroup("xmltest.items", xmltest, rsQuery); //$NON-NLS-1$
-
- QueryNode rsQuery2 = new QueryNode("SELECT stock.suppliers.supplierNum, supplierName, supplierZipCode, stock.item_supplier.itemNum FROM stock.suppliers, stock.item_supplier WHERE stock.suppliers.supplierNum = stock.item_supplier.supplierNum AND stock.item_supplier.itemNum = ?"); //$NON-NLS-1$ //$NON-NLS-2$
- rsQuery2.addBinding("xmltest.items.itemNum"); //$NON-NLS-1$
- FakeMetadataObject rsSuppliers = FakeMetadataFactory.createVirtualGroup("xmltest.suppliers", xmltest, rsQuery2); //$NON-NLS-1$
-
- QueryNode rsQuery3 = new QueryNode("SELECT orderNum, orderDate, orderQty, orderStatus, itemFK, supplierFK FROM stock.orders WHERE itemFK = ? AND supplierFK = ?"); //$NON-NLS-1$ //$NON-NLS-2$
- rsQuery3.addBinding("xmltest.suppliers.itemNum"); //$NON-NLS-1$
- rsQuery3.addBinding("xmltest.suppliers.supplierNum"); //$NON-NLS-1$
- FakeMetadataObject rsOrders = FakeMetadataFactory.createVirtualGroup("xmltest.orders", xmltest, rsQuery3); //$NON-NLS-1$
-
- QueryNode rsQuery4 = new QueryNode("SELECT employeeNum, firstName, lastName, supervisorNum, specializesInItemNum, supplierNumFK FROM stock.employees WHERE specializesInItemNum = ? AND supplierNumFK = ?"); //$NON-NLS-1$ //$NON-NLS-2$
- rsQuery4.addBinding("xmltest.suppliers.itemNum"); //$NON-NLS-1$
- rsQuery4.addBinding("xmltest.suppliers.supplierNum"); //$NON-NLS-1$
- FakeMetadataObject rsEmployees = FakeMetadataFactory.createVirtualGroup("xmltest.employees", xmltest, rsQuery4); //$NON-NLS-1$
-
- // Create mapping classes elements - items doc
- List rsItemsElements = FakeMetadataFactory.createElements(rsItems,
- new String[] { "itemNum", "itemName", "itemQuantity", "itemStatus" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
-
- List rsSuppliersElements = FakeMetadataFactory.createElements(rsSuppliers,
- new String[] { "supplierNum", "supplierName", "supplierZipCode", "itemNum" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
-
- List rsOrdersElements = FakeMetadataFactory.createElements(rsOrders,
- new String[] { "orderNum", "orderDate", "orderQty", "orderStatus", "itemFK", "supplierFK" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
-
- List rsEmployeesElements = FakeMetadataFactory.createElements(rsEmployees,
- new String[] { "employeeNum", "firstName", "lastName", "supervisorNum", "specializesInItemNum", "supplierNumFK" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
-
- // MAPPING DOC ======================================================================
- MappingDocument doc = new MappingDocument(true);
- MappingElement root = doc.addChildElement(new MappingElement("Catalogs")); //$NON-NLS-1$
-
- MappingElement cats = root.addChildElement(new MappingElement("Catalog")); //$NON-NLS-1$
- MappingElement itemsA = cats.addChildElement(new MappingElement("Items")); //$NON-NLS-1$
-
- MappingElement item = itemsA.addChildElement(new MappingElement("Item")); //$NON-NLS-1$
- item.setSource("xmltest.items");//$NON-NLS-1$
- item.setMaxOccurrs(-1);
- item.addAttribute(new MappingAttribute("ItemID", "xmltest.items.itemNum")); //$NON-NLS-1$ //$NON-NLS-2$
- item.addChildElement(new MappingElement("Name", "xmltest.items.itemName")); //$NON-NLS-1$ //$NON-NLS-2$
- item.addChildElement(new MappingElement("Quantity", "xmltest.items.itemQuantity")); //$NON-NLS-1$ //$NON-NLS-2$
-
- //NESTED STUFF======================================================================
- MappingElement nestedWrapper = item.addChildElement(new MappingElement("Suppliers")); //$NON-NLS-1$
- MappingElement supplier = nestedWrapper.addChildElement(new MappingElement("Supplier")); //$NON-NLS-1$
- supplier.setSource("xmltest.suppliers");//$NON-NLS-1$
- supplier.setMaxOccurrs(-1);
- supplier.addAttribute(new MappingAttribute("SupplierID", "xmltest.suppliers.supplierNum")); //$NON-NLS-1$ //$NON-NLS-2$
- supplier.addChildElement(new MappingElement("Name","xmltest.suppliers.supplierName")); //$NON-NLS-1$ //$NON-NLS-2$
- supplier.addChildElement(new MappingElement("Zip", "xmltest.suppliers.supplierZipCode")); //$NON-NLS-1$ //$NON-NLS-2$
-
- MappingElement ordersWrapper = supplier.addChildElement(new MappingElement("Orders")); //$NON-NLS-1$
- MappingElement order = ordersWrapper.addChildElement(new MappingElement("Order")); //$NON-NLS-1$
- order.setSource("xmltest.orders"); //$NON-NLS-1$
- order.setMaxOccurrs(-1);
- order.addAttribute(new MappingAttribute("OrderID", "xmltest.orders.orderNum")); //$NON-NLS-1$ //$NON-NLS-2$
- order.addChildElement(new MappingElement("OrderDate", "xmltest.orders.orderDate")); //$NON-NLS-1$ //$NON-NLS-2$
- order.addChildElement(new MappingElement("OrderQuantity", "xmltest.orders.orderQty")); //$NON-NLS-1$ //$NON-NLS-2$
-
- order.addChildElement(new MappingElement("OrderStatus", "xmltest.orders.orderStatus")) //$NON-NLS-1$ //$NON-NLS-2$
- .setMinOccurrs(0);
- //NESTED STUFF======================================================================
-
- MappingElement employeesWrapper = supplier.addChildElement(new MappingElement("Employees")); //$NON-NLS-1$
- MappingElement employee = employeesWrapper.addChildElement(new MappingElement("Employee")); //$NON-NLS-1$
- employee.setSource("xmltest.employees"); //$NON-NLS-1$
- employee.setMaxOccurrs(-1);
- employee.addAttribute(new MappingAttribute("EmployeeID", "xmltest.employees.employeeNum")); //$NON-NLS-1$ //$NON-NLS-2$
- employee.addChildElement(new MappingElement("FirstName", "xmltest.employees.firstName")); //$NON-NLS-1$ //$NON-NLS-2$
- employee.addChildElement(new MappingElement("LastName", "xmltest.employees.lastName")); //$NON-NLS-1$ //$NON-NLS-2$
- employee.addAttribute(new MappingAttribute("SupervisorID", "xmltest.employees.supervisorNum")); //$NON-NLS-1$ //$NON-NLS-2$
-
- // END MAPPING DOC ======================================================================
-
- // Create virtual docs and doc elements
- FakeMetadataObject itemsDoc = FakeMetadataFactory.createVirtualGroup("xmltest.itemsDoc", xmltest, doc); //$NON-NLS-1$
- List docE1 = FakeMetadataFactory.createElements(itemsDoc,
- new String[] { "Catalogs", //$NON-NLS-1$
- "Catalogs.Catalog", //$NON-NLS-1$
- "Catalogs.Catalog.items", //$NON-NLS-1$
- "Catalogs.Catalog.items.item", //$NON-NLS-1$
- "Catalogs.Catalog.items.item.@ItemID", //$NON-NLS-1$
- "Catalogs.Catalog.items.item.Name", //$NON-NLS-1$
- "Catalogs.Catalog.items.item.Quantity", //$NON-NLS-1$
- "Catalogs.Catalog.items.item.Suppliers", //$NON-NLS-1$
- "Catalogs.Catalog.items.item.Suppliers.Supplier", //$NON-NLS-1$
- "Catalogs.Catalog.items.item.Suppliers.Supplier.@SupplierID", //$NON-NLS-1$
- "Catalogs.Catalog.items.item.Suppliers.Supplier.Name", //$NON-NLS-1$
- "Catalogs.Catalog.items.item.Suppliers.Supplier.Zip", //$NON-NLS-1$
- "Catalogs.Catalog.items.item.Suppliers.Supplier.Orders", //$NON-NLS-1$
- "Catalogs.Catalog.items.item.Suppliers.Supplier.Orders.Order", //$NON-NLS-1$
- "Catalogs.Catalog.items.item.Suppliers.Supplier.Orders.Order.@OrderID", //$NON-NLS-1$
- "Catalogs.Catalog.items.item.Suppliers.Supplier.Orders.Order.OrderDate", //$NON-NLS-1$
- "Catalogs.Catalog.items.item.Suppliers.Supplier.Orders.Order.OrderQuantity", //$NON-NLS-1$
- "Catalogs.Catalog.items.item.Suppliers.Supplier.Orders.Order.OrderStatus", //$NON-NLS-1$
- "Catalogs.Catalog.items.item.Suppliers.Supplier.Employees", //$NON-NLS-1$
- "Catalogs.Catalog.items.item.Suppliers.Supplier.Employees.Employee", //$NON-NLS-1$
- "Catalogs.Catalog.items.item.Suppliers.Supplier.Employees.Employee.@EmployeeID", //$NON-NLS-1$
- "Catalogs.Catalog.items.item.Suppliers.Supplier.Employees.Employee.FirstName", //$NON-NLS-1$
- "Catalogs.Catalog.items.item.Suppliers.Supplier.Employees.Employee.LastName", //$NON-NLS-1$
- "Catalogs.Catalog.items.item.Suppliers.Supplier.Employees.Employee.@SupervisorID", //$NON-NLS-1$
-
- },
- new String[] { DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.INTEGER,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- });
-
- // Create mapping classes - baseball players employees doc
- QueryNode playersNode = new QueryNode("SELECT stock.employees.employeeNum, firstName, lastName, supervisorNum FROM stock.employees WHERE specializesInItemNum is not null"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject rsPlayers = FakeMetadataFactory.createVirtualGroup("xmltest.players", xmltest, playersNode); //$NON-NLS-1$
-
- QueryNode managersNode = new QueryNode("SELECT stock.employees.employeeNum, firstName, lastName, supervisorNum FROM stock.employees WHERE stock.employees.employeeNum = ?"); //$NON-NLS-1$ //$NON-NLS-2$
- managersNode.addBinding("xmltest.players.supervisorNum"); //$NON-NLS-1$
- FakeMetadataObject rsManagers = FakeMetadataFactory.createVirtualGroup("xmltest.managers", xmltest, managersNode); //$NON-NLS-1$
-
- // TODO what if elements in criteria weren't fully qualified? see defect 19541
- QueryNode ownersNode = new QueryNode("SELECT stock.employees.employeeNum, firstName, lastName, supervisorNum FROM stock.employees WHERE stock.employees.employeeNum = ?"); //$NON-NLS-1$ //$NON-NLS-2$
- ownersNode.addBinding("xmltest.managers.supervisorNum"); //$NON-NLS-1$
- FakeMetadataObject rsOwners = FakeMetadataFactory.createVirtualGroup("xmltest.owners", xmltest, ownersNode); //$NON-NLS-1$
-
- // Create mapping classes elements - items doc
- List rsPlayersElements = FakeMetadataFactory.createElements(rsPlayers,
- new String[] { "employeeNum", "firstName", "lastName", "supervisorNum" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
-
- List rsManagersElements = FakeMetadataFactory.createElements(rsManagers,
- new String[] { "employeeNum", "firstName", "lastName", "supervisorNum" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
-
- List rsOwnersElements = FakeMetadataFactory.createElements(rsOwners,
- new String[] { "employeeNum", "firstName", "lastName", "supervisorNum" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
-
-
-
- // MAPPING DOC - baseball players ======================================================================
- MappingDocument doc2 = new MappingDocument(true);
- MappingElement root2 = doc2.addChildElement(new MappingElement("BaseballPlayers")); //$NON-NLS-1$
-
- MappingElement player = root2.addChildElement(new MappingElement("Player")); //$NON-NLS-1$
- player.setSource("xmltest.players"); //$NON-NLS-1$
- player.setMaxOccurrs(-1);
- player.addAttribute(new MappingAttribute("PlayerID", "xmltest.players.employeeNum")); //$NON-NLS-1$ //$NON-NLS-2$
- player.addChildElement(new MappingElement("FirstName", "xmltest.players.firstName")); //$NON-NLS-1$ //$NON-NLS-2$
- player.addChildElement(new MappingElement("LastName", "xmltest.players.lastName")); //$NON-NLS-1$ //$NON-NLS-2$
-
- MappingElement manager = player.addChildElement(new MappingElement("Manager")); //$NON-NLS-1$
- manager.setSource("xmltest.managers");//$NON-NLS-1$
- manager.setMaxOccurrs(-1);
- manager.addAttribute(new MappingAttribute("ManagerID", "xmltest.managers.employeeNum")); //$NON-NLS-1$ //$NON-NLS-2$
- manager.addChildElement(new MappingElement("FirstName", "xmltest.managers.firstName")); //$NON-NLS-1$ //$NON-NLS-2$
- manager.addChildElement(new MappingElement("LastName", "xmltest.managers.lastName")); //$NON-NLS-1$ //$NON-NLS-2$
-
- MappingElement owner = manager.addChildElement(new MappingElement("Owner")); //$NON-NLS-1$
- owner.setSource("xmltest.owners"); //$NON-NLS-1$
- owner.setMaxOccurrs(-1);
- owner.addAttribute(new MappingAttribute("OwnerID", "xmltest.owners.employeeNum")); //$NON-NLS-1$ //$NON-NLS-2$
- owner.addChildElement(new MappingElement("FirstName", "xmltest.owners.firstName")); //$NON-NLS-1$ //$NON-NLS-2$
- owner.addChildElement(new MappingElement("LastName", "xmltest.owners.lastName")); //$NON-NLS-1$ //$NON-NLS-2$
- // END MAPPING DOC ======================================================================
-
- // Create virtual docs and doc elements
- FakeMetadataObject playersDoc = FakeMetadataFactory.createVirtualGroup("xmltest.playersDoc", xmltest, doc2); //$NON-NLS-1$
- List playersDocElements = FakeMetadataFactory.createElements(playersDoc,
- new String[] { "BaseballPlayers", //$NON-NLS-1$
- "BaseballPlayers.Player", //$NON-NLS-1$
- "BaseballPlayers.Player.@PlayerID", //$NON-NLS-1$
- "BaseballPlayers.Player.FirstName", //$NON-NLS-1$
- "BaseballPlayers.Player.LastName", //$NON-NLS-1$
- "BaseballPlayers.Player.Manager", //$NON-NLS-1$
- "BaseballPlayers.Player.Manager.@ManagerID", //$NON-NLS-1$
- "BaseballPlayers.Player.Manager.FirstName", //$NON-NLS-1$
- "BaseballPlayers.Player.Manager.LastName", //$NON-NLS-1$
- "BaseballPlayers.Player.Manager.Owner", //$NON-NLS-1$
- "BaseballPlayers.Player.Manager.Owner.@OwnerID", //$NON-NLS-1$
- "BaseballPlayers.Player.Manager.Owner.FirstName", //$NON-NLS-1$
- "BaseballPlayers.Player.Manager.Owner.LastName", //$NON-NLS-1$
-
- },
- new String[] { DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.STRING,
- });
-
-
-
- // Add all objects to the store
- store.addObject(stock);
- store.addObject(items);
- store.addObject(item_supplier);
-
- store.addObject(suppliers);
- store.addObject(orders);
- store.addObject(employees);
- store.addObjects(itemElements);
- store.addObjects(itemSupplierElements);
- store.addObjects(supplierElements);
- store.addObjects(stockOrders);
- store.addObjects(supplierEmployees);
-
- store.addObject(xmltest);
- store.addObject(rsItems);
- store.addObject(rsSuppliers);
- store.addObject(rsOrders);
- store.addObject(rsEmployees);
- store.addObject(rsPlayers);
- store.addObject(rsManagers);
- store.addObject(rsOwners);
-
- store.addObjects(rsItemsElements);
- store.addObjects(rsSuppliersElements);
- store.addObjects(rsOrdersElements);
- store.addObjects(rsEmployeesElements);
- store.addObjects(rsPlayersElements);
- store.addObjects(rsManagersElements);
- store.addObjects(rsOwnersElements);
-
- store.addObject(itemsDoc);
- store.addObject(playersDoc);
-
- store.addObjects(docE1);
- store.addObjects(playersDocElements);
- return facade;
- }
-
- /**
- * Create a physical model with default settings.
- * @param name Name of model
- * @return FakeMetadataObject Metadata object for model
- */
- public static FakeMetadataObject createPhysicalModel(String name) {
- FakeMetadataObject obj = new FakeMetadataObject(name, FakeMetadataObject.MODEL);
- obj.putProperty(FakeMetadataObject.Props.IS_VIRTUAL, Boolean.FALSE);
- obj.putProperty(FakeMetadataObject.Props.UPDATE, Boolean.TRUE);
- return obj;
- }
-
- /**
- * Create a virtual model with default settings.
- * @param name Name of virtual model
- * @return FakeMetadataObject Metadata object for model
- */
- public static FakeMetadataObject createVirtualModel(String name) {
- FakeMetadataObject obj = new FakeMetadataObject(name, FakeMetadataObject.MODEL);
- obj.putProperty(FakeMetadataObject.Props.IS_VIRTUAL, Boolean.TRUE);
- return obj;
- }
-
- /**
- * Create a physical group with default settings.
- * @param name Name of physical group, must match model name
- * @param model Associated model
- * @return FakeMetadataObject Metadata object for group
- */
- public static FakeMetadataObject createPhysicalGroup(String name, FakeMetadataObject model) {
- FakeMetadataObject obj = new FakeMetadataObject(name, FakeMetadataObject.GROUP);
- obj.putProperty(FakeMetadataObject.Props.MODEL, model);
- obj.putProperty(FakeMetadataObject.Props.IS_VIRTUAL, model.getProperty(FakeMetadataObject.Props.IS_VIRTUAL));
- obj.putProperty(FakeMetadataObject.Props.UPDATE, Boolean.TRUE);
- obj.putProperty(FakeMetadataObject.Props.TEMP, Boolean.FALSE);
- obj.putProperty(FakeMetadataObject.Props.NAME_IN_SOURCE, (name.lastIndexOf(".") == -1)? name : name.substring(name.lastIndexOf(".") + 1) ); //$NON-NLS-1$ //$NON-NLS-2$
- return obj;
- }
-
- public static FakeMetadataObject createPhysicalGroup(String name, FakeMetadataObject model, boolean flag) {
- FakeMetadataObject obj = new FakeMetadataObject(name, FakeMetadataObject.GROUP);
- obj.putProperty(FakeMetadataObject.Props.MODEL, model);
- obj.putProperty(FakeMetadataObject.Props.IS_VIRTUAL, model.getProperty(FakeMetadataObject.Props.IS_VIRTUAL));
- obj.putProperty(FakeMetadataObject.Props.UPDATE, Boolean.TRUE);
- obj.putProperty(FakeMetadataObject.Props.TEMP, Boolean.FALSE);
- // actually, the name may be fully qualified, which means, the model + categories + name
- obj.putProperty(FakeMetadataObject.Props.NAME_IN_SOURCE, name );
- return obj;
- }
-
- /**
- * Create a virtual group with default settings.
- * @param name Name of virtual group, must match model name
- * @param model Associated model
- * @param plan Appropriate query plan definition object for the virtual group
- * @return FakeMetadataObject Metadata object for group
- */
- public static FakeMetadataObject createVirtualGroup(String name, FakeMetadataObject model, Object plan) {
- FakeMetadataObject obj = new FakeMetadataObject(name, FakeMetadataObject.GROUP);
- obj.putProperty(FakeMetadataObject.Props.MODEL, model);
- obj.putProperty(FakeMetadataObject.Props.IS_VIRTUAL, model.getProperty(FakeMetadataObject.Props.IS_VIRTUAL));
- obj.putProperty(FakeMetadataObject.Props.PLAN, plan);
- obj.putProperty(FakeMetadataObject.Props.UPDATE, Boolean.FALSE);
- obj.putProperty(FakeMetadataObject.Props.TEMP, Boolean.FALSE);
- return obj;
- }
-
- /**
- * Create a temp group with default settings.
- * @param name Name of virtual group, must match model name
- * @param model Associated model
- * @param plan Appropriate query plan definition object for the temp group
- * @return FakeMetadataObject Metadata object for group
- */
- public static FakeMetadataObject createTempGroup(String name, FakeMetadataObject model, Object plan) {
- FakeMetadataObject obj = new FakeMetadataObject(name, FakeMetadataObject.GROUP);
- obj.putProperty(FakeMetadataObject.Props.MODEL, model);
- obj.putProperty(FakeMetadataObject.Props.IS_VIRTUAL, Boolean.FALSE);
- obj.putProperty(FakeMetadataObject.Props.PLAN, plan);
- obj.putProperty(FakeMetadataObject.Props.UPDATE, Boolean.FALSE);
- obj.putProperty(FakeMetadataObject.Props.TEMP, Boolean.TRUE);
- return obj;
- }
-
- /**
- * Create a virtual group that allows updates with default settings.
- * @param name Name of virtual group, must match model name
- * @param model Associated model
- * @param plan Appropriate query plan definition object for the virtual group
- * @return FakeMetadataObject Metadata object for group
- */
- public static FakeMetadataObject createUpdatableVirtualGroup(String name, FakeMetadataObject model, QueryNode plan) {
- return createUpdatableVirtualGroup(name, model, plan, null);
- }
-
- public static FakeMetadataObject createUpdatableVirtualGroup(String name, FakeMetadataObject model, QueryNode plan, String updatePlan) {
- FakeMetadataObject obj = new FakeMetadataObject(name, FakeMetadataObject.GROUP);
- obj.putProperty(FakeMetadataObject.Props.MODEL, model);
- obj.putProperty(FakeMetadataObject.Props.IS_VIRTUAL, model.getProperty(FakeMetadataObject.Props.IS_VIRTUAL));
- obj.putProperty(FakeMetadataObject.Props.PLAN, plan);
- obj.putProperty(FakeMetadataObject.Props.UPDATE, Boolean.TRUE);
- obj.putProperty(FakeMetadataObject.Props.UPDATE_PROCEDURE, updatePlan);
- obj.putProperty(FakeMetadataObject.Props.INSERT_PROCEDURE, "");
- obj.putProperty(FakeMetadataObject.Props.DELETE_PROCEDURE, "");
- return obj;
- }
-
- /**
- * Create element with default settings.
- * @param name Name of virtual group, must match model name
- * @param group Associated group
- * @param type Type of the element (see DataTypeManager)
- * @param index Column index in group
- * @return FakeMetadataObject Metadata object for element
- */
- public static FakeMetadataObject createElement(String name, FakeMetadataObject group, String type, int index) {
- return createElement(name, group, type, index, true);
- }
-
- public static FakeMetadataObject createElement(String name, FakeMetadataObject group, String type, int index, boolean flag) {
- FakeMetadataObject obj = new FakeMetadataObject(name, FakeMetadataObject.ELEMENT);
- obj.putProperty(FakeMetadataObject.Props.MODEL, group.getProperty(FakeMetadataObject.Props.MODEL));
- obj.putProperty(FakeMetadataObject.Props.GROUP, group);
- obj.putProperty(FakeMetadataObject.Props.TYPE, type);
-
- obj.putProperty(FakeMetadataObject.Props.SELECT, Boolean.TRUE);
- if(type.equals(DataTypeManager.DefaultDataTypes.STRING)) {
- obj.putProperty(FakeMetadataObject.Props.SEARCHABLE_LIKE, Boolean.TRUE);
- } else {
- obj.putProperty(FakeMetadataObject.Props.SEARCHABLE_LIKE, Boolean.FALSE);
- }
- obj.putProperty(FakeMetadataObject.Props.SEARCHABLE_COMPARE, Boolean.TRUE);
- obj.putProperty(FakeMetadataObject.Props.NULL, Boolean.TRUE);
- obj.putProperty(FakeMetadataObject.Props.AUTO_INCREMENT, Boolean.FALSE);
- obj.putProperty(FakeMetadataObject.Props.DEFAULT_VALUE, null);
- obj.putProperty(FakeMetadataObject.Props.INDEX, new Integer(index));
- obj.putProperty(FakeMetadataObject.Props.UPDATE, Boolean.TRUE);
- obj.putProperty(FakeMetadataObject.Props.LENGTH, "100"); //$NON-NLS-1$
-
- int indexOfDot = name.lastIndexOf("."); //$NON-NLS-1$
- if (flag) {
- name = name.substring(indexOfDot+1);
- } else {
- name = String.valueOf(index);
- }
-
- obj.putProperty(FakeMetadataObject.Props.NAME_IN_SOURCE, name);
- return obj;
- }
-
- /**
- * Create a set of elements in batch
- * @param group The group metadata object
- * @param names Array of element names
- * @param types Array of element types
- * @return List Ordered list of elements in the group
- */
- public static List<FakeMetadataObject> createElements(FakeMetadataObject group, String[] names, String[] types) {
- String groupRoot = group.getName() + "."; //$NON-NLS-1$
- List<FakeMetadataObject> elements = new ArrayList<FakeMetadataObject>();
-
- for(int i=0; i<names.length; i++) {
- FakeMetadataObject element = createElement(groupRoot + names[i], group, types[i], i);
- elements.add(element);
- }
-
- return elements;
- }
-
- public static List createElements(FakeMetadataObject group, String[] names, String[] types, boolean flag) {
- String groupRoot = group.getName() + "."; //$NON-NLS-1$
- List elements = new ArrayList();
-
- for(int i=0; i<names.length; i++) {
- FakeMetadataObject element = createElement(groupRoot + names[i], group, types[i], i, flag);
- elements.add(element);
- }
-
- return elements;
- }
-
- /**
- * Create a set of elements in batch
- * @param group The group metadata object
- * @param names Array of element names
- * @param types Array of element types
- * @return List Ordered list of elements in the group
- */
- public static List createElementsWithDefaults(FakeMetadataObject group, String[] names, String[] types, Object[] defaults) {
- String groupRoot = group.getName() + "."; //$NON-NLS-1$
- List elements = new ArrayList();
-
- for(int i=0; i<names.length; i++) {
- FakeMetadataObject element = createElement(groupRoot + names[i], group, types[i], i);
- element.setDefaultValue(defaults[i]);
- elements.add(element);
- }
-
- return elements;
- }
-
- /**
- * Create index. The name will be used as the Object metadataID.
- * @param name String name of index
- * @param group the group for the index
- * @param elements the elements of the index (will be used as if they were
- * metadata IDs)
- * @return key metadata object
- */
- public static FakeMetadataObject createIndex(String name, FakeMetadataObject group, List elements) {
- FakeMetadataObject obj = new FakeMetadataObject(name, FakeMetadataObject.KEY);
- obj.putProperty(FakeMetadataObject.Props.KEY_TYPE, FakeMetadataObject.TYPE_INDEX);
- obj.putProperty(FakeMetadataObject.Props.KEY_ELEMENTS, elements);
- Collection keys = (Collection)group.getProperty(FakeMetadataObject.Props.KEYS);
- if (keys == null){
- keys = new ArrayList();
- group.putProperty(FakeMetadataObject.Props.KEYS, keys);
- }
- keys.add(obj);
- return obj;
- }
-
- /**
- * Create primary key. The name will be used as the Object metadataID.
- * @param name String name of key
- * @param group the group for the key
- * @param elements the elements of the key (will be used as if they were
- * metadata IDs)
- * @return key metadata object
- */
- public static FakeMetadataObject createKey(String name, FakeMetadataObject group, List elements) {
- FakeMetadataObject obj = new FakeMetadataObject(name, FakeMetadataObject.KEY);
- obj.putProperty(FakeMetadataObject.Props.KEY_TYPE, FakeMetadataObject.TYPE_PRIMARY_KEY);
- obj.putProperty(FakeMetadataObject.Props.KEY_ELEMENTS, elements);
- Collection keys = (Collection)group.getProperty(FakeMetadataObject.Props.KEYS);
- if (keys == null){
- keys = new ArrayList();
- group.putProperty(FakeMetadataObject.Props.KEYS, keys);
- }
- keys.add(obj);
- return obj;
- }
-
- /**
- * Create foreign key. The name will be used as the Object metadataID.
- * @param name String name of key
- * @param group the group for the key
- * @param elements the elements of the key (will be used as if they were
- * @param primaryKey referenced by this foreign key
- * metadata IDs)
- * @return key metadata object
- */
- public static FakeMetadataObject createForeignKey(String name, FakeMetadataObject group, List elements, FakeMetadataObject primaryKey) {
- FakeMetadataObject obj = new FakeMetadataObject(name, FakeMetadataObject.KEY);
- obj.putProperty(FakeMetadataObject.Props.KEY_TYPE, FakeMetadataObject.TYPE_FOREIGN_KEY);
- obj.putProperty(FakeMetadataObject.Props.KEY_ELEMENTS, elements);
- obj.putProperty(FakeMetadataObject.Props.REFERENCED_KEY, primaryKey);
- Collection keys = (Collection)group.getProperty(FakeMetadataObject.Props.KEYS);
- if (keys == null){
- keys = new ArrayList();
- group.putProperty(FakeMetadataObject.Props.KEYS, keys);
- }
- keys.add(obj);
- return obj;
- }
-
- /**
- * Create access pattern (currently an access pattern is implemented as a type of key). The name will
- * be used as the Object metadataID.
- * @param name String name of key
- * @param group the group for the access pattern
- * @param elements the elements of the access pattern (will be used as if they were
- * metadata IDs)
- * @return Access pattern metadata object
- */
- public static FakeMetadataObject createAccessPattern(String name, FakeMetadataObject group, List elements) {
- FakeMetadataObject obj = new FakeMetadataObject(name, FakeMetadataObject.KEY);
- obj.putProperty(FakeMetadataObject.Props.KEY_TYPE, FakeMetadataObject.TYPE_ACCESS_PATTERN);
- obj.putProperty(FakeMetadataObject.Props.KEY_ELEMENTS, elements);
- Collection keys = (Collection)group.getProperty(FakeMetadataObject.Props.KEYS);
- if (keys == null){
- keys = new ArrayList();
- group.putProperty(FakeMetadataObject.Props.KEYS, keys);
- }
- keys.add(obj);
- return obj;
- }
-
- /**
- * Create stored procedure parameter.
- * @param name Name of parameter
- * @param direction Direction of parameter
- * @param type Type of parameter
- * @param resultSet Result set metadata object or null if type is not result set
- * @return Metadata object for parameter
- */
- public static FakeMetadataObject createParameter(String name, int index, int direction, String type, Object resultSet) {
- FakeMetadataObject obj = new FakeMetadataObject(name, FakeMetadataObject.PARAMETER);
- obj.putProperty(FakeMetadataObject.Props.INDEX, new Integer(index));
- obj.putProperty(FakeMetadataObject.Props.DIRECTION, new Integer(direction));
- if(resultSet != null) {
- obj.putProperty(FakeMetadataObject.Props.RESULT_SET, resultSet);
- obj.putProperty(FakeMetadataObject.Props.TYPE, DataTypeManager.DefaultDataTypes.INTEGER);
- } else {
- obj.putProperty(FakeMetadataObject.Props.TYPE, type);
- }
- obj.putProperty(FakeMetadataObject.Props.NAME_IN_SOURCE, name);
- return obj;
- }
-
- /**
- * Create stored procedure.
- * @param name Name of procedure, must match model name
- * @param model Metadata object for the model
- * @param params List of FakeMetadataObject that are the parameters for the procedure
- * @return Metadata object for stored procedure
- */
- public static FakeMetadataObject createStoredProcedure(String name, FakeMetadataObject model, List params) {
- FakeMetadataObject obj = new FakeMetadataObject(name, FakeMetadataObject.PROCEDURE);
- obj.putProperty(FakeMetadataObject.Props.MODEL, model);
- obj.putProperty(FakeMetadataObject.Props.PARAMS, params);
-
- return obj;
- }
-
- /**
- * Create virtual sotred procedure.
- * @param name Name of stored query, must match model name
- * @param model Metadata object for the model
- * @param params List of FakeMetadataObject that are the parameters for the procedure
- * @param queryPlan Object representing query plan
- * @return Metadata object for stored procedure
- */
- public static FakeMetadataObject createVirtualProcedure(String name, FakeMetadataObject model, List params, Object queryPlan) {
- FakeMetadataObject obj = new FakeMetadataObject(name, FakeMetadataObject.PROCEDURE);
- obj.putProperty(FakeMetadataObject.Props.MODEL, model);
- obj.putProperty(FakeMetadataObject.Props.PARAMS, params);
- obj.putProperty(FakeMetadataObject.Props.PLAN, queryPlan);
- return obj;
- }
-
- /**
- * Create a result set.
- * @param name Name of result set, must match model name
- * @param model Associated model
- * @param colNames Result set column names
- * @param colTypes Result set column types
- * @return FakeMetadataObject Metadata object for result set
- */
- public static FakeMetadataObject createResultSet(String name, FakeMetadataObject model, String[] colNames, String[] colTypes) {
- FakeMetadataObject obj = new FakeMetadataObject(name, FakeMetadataObject.RESULT_SET);
- obj.putProperty(FakeMetadataObject.Props.MODEL, model);
-
- List columns = new ArrayList();
- for(int i=0; i<colNames.length; i++) {
- ElementSymbol col = new ElementSymbol(colNames[i]);
- col.setType(DataTypeManager.getDataTypeClass(colTypes[i]));
- FakeMetadataObject colId = new FakeMetadataObject(colNames[i], FakeMetadataObject.ELEMENT);
- colId.putProperty(FakeMetadataObject.Props.TYPE, colTypes[i]);
- colId.putProperty(FakeMetadataObject.Props.LENGTH, "10"); //$NON-NLS-1$
- colId.putProperty(FakeMetadataObject.Props.SELECT, Boolean.TRUE);
- col.setMetadataID(colId);
- columns.add(col);
- }
-
- obj.putProperty(FakeMetadataObject.Props.COLUMNS, columns);
- return obj;
- }
-
-}
Deleted: branches/7.4.x/engine/src/test/java/org/teiid/query/unittest/FakeMetadataObject.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/unittest/FakeMetadataObject.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/unittest/FakeMetadataObject.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -1,219 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.query.unittest;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-public class FakeMetadataObject implements Comparable, Serializable {
-
- public static final String MODEL = "Model"; //$NON-NLS-1$
- public static final String GROUP = "Group"; //$NON-NLS-1$
- public static final String ELEMENT = "Element"; //$NON-NLS-1$
- public static final String KEY = "Key"; //$NON-NLS-1$
- public static final String PROCEDURE = "Procedure"; //$NON-NLS-1$
- public static final String PARAMETER = "Parameter"; //$NON-NLS-1$
- public static final String RESULT_SET = "ResultSet"; //$NON-NLS-1$
-
- //KEY TYPES
- public static final Integer TYPE_PRIMARY_KEY = new Integer(2);
- public static final Integer TYPE_FOREIGN_KEY = new Integer(3);
- public static final Integer TYPE_INDEX = new Integer(4);
- public static final Integer TYPE_ACCESS_PATTERN = new Integer(5);
-
-
- private String name;
- private String type;
- private Object defaultValue;
- private Map props = new HashMap();
- private Properties extensionProps;
-
- public FakeMetadataObject(String name, String type) {
- this.name = name;
- this.type = type;
- }
-
- public void setDefaultValue(Object defaultValue) {
- this.defaultValue = defaultValue;
- }
-
- public String getName() {
- return this.name;
- }
-
- public String getType() {
- return this.type;
- }
-
- public Object getDefaultValue() {
- return this.defaultValue;
- }
-
- public void putProperty(String propName, Object value) {
- props.put(propName, value);
- }
-
- public Object getProperty(String propName) {
- return props.get(propName);
- }
-
- public Object getProperty(String propName, Object defaultValue) {
- Object result = props.get(propName);
- if (result == null) {
- return defaultValue;
- }
- return result;
- }
-
- public boolean equals(Object obj) {
- if(this == obj) {
- return true;
- }
-
- if(obj == null || ! (obj instanceof FakeMetadataObject)) {
- return false;
- }
-
- FakeMetadataObject other = (FakeMetadataObject) obj;
- return ( this.getType().equals(other.getType()) &&
- this.getName().equalsIgnoreCase(other.getName()) );
- }
-
- public int hashCode() {
- return this.getName().toUpperCase().hashCode();
- }
-
- public int compareTo(Object obj) {
- FakeMetadataObject other = (FakeMetadataObject) obj;
-
- if ( this.getProperty(Props.INDEX) != null &&
- other.getProperty(Props.INDEX) != null){
-
- return compareToWithIndices(other);
- }
- return compareToWithHashCodes(other);
- }
-
- private int compareToWithIndices(FakeMetadataObject other) {
- Integer otherIndex = (Integer)other.getProperty(Props.INDEX);
- Integer myIndex = (Integer)this.getProperty(Props.INDEX);
- return myIndex.compareTo(otherIndex);
- }
-
- private int compareToWithHashCodes(FakeMetadataObject other) {
-
- int otherHash = other.hashCode();
- int myHash = this.hashCode();
-
- if(myHash < otherHash) {
- return -1;
- } else if(myHash > otherHash) {
- return 1;
- } else {
- return 0;
- }
- }
-
- public void setExtensionProp(String name, String value) {
- if (this.extensionProps == null) {
- this.extensionProps = new Properties();
- }
- this.extensionProps.setProperty(name, value);
- }
-
- public Properties getExtensionProps() {
- return extensionProps;
- }
-
- public String toString() {
- return getType() + "(" + getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
-
- public static class Props {
- // Shared properties
- public static final String IS_VIRTUAL = "isVirtual"; // model/group //$NON-NLS-1$
- public static final String MODEL = "model"; // element/group/procedure //$NON-NLS-1$
- public static final String TYPE = "type"; // element/parameter //$NON-NLS-1$
- public static final String INDEX = "index"; // element/parameter - integer //$NON-NLS-1$
- public static final String NAME_IN_SOURCE = "nameInSource"; // group/element //$NON-NLS-1$
-
- // Model properties
- public static final String PLAN = "plan"; // object - query plan //$NON-NLS-1$
- public static final String UPDATE = "supUpdate"; // Boolean //$NON-NLS-1$
- public static final String MAX_SET_SIZE = "maxSetSize"; // Integer //$NON-NLS-1$
-
- // Group properties
- public static final String TEMP = "temp"; // Boolean //$NON-NLS-1$
- public static final String KEYS = "keys"; // Collection<FakeMetadataObject keys> //$NON-NLS-1$
- public static final String CARDINALITY = "cardinality"; // Integer - estimated size of table (# of rows) //$NON-NLS-1$
- public static final String MAT_GROUP = "matGroup"; // FakeMetadataObject - materialization group //$NON-NLS-1$
- public static final String MAT_STAGE = "matStage"; // FakeMetadataObject - materialization staging group //$NON-NLS-1$
- public static final String XML_SCHEMAS = "xmlSchemas"; // List<String> - xml schemas for a doc //$NON-NLS-1$
-
- // Element properties
- public static final String GROUP = "group"; // FakeMetadataObject group //$NON-NLS-1$
- public static final String SELECT = "supSelect"; // Boolean //$NON-NLS-1$
- public static final String SEARCHABLE_LIKE = "supLike"; // Boolean //$NON-NLS-1$
- public static final String SEARCHABLE_COMPARE = "supCompare"; // Boolean //$NON-NLS-1$
- public static final String NULL = "supNull"; // Boolean //$NON-NLS-1$
- public static final String AUTO_INCREMENT = "supAutoIncrement"; // Boolean //$NON-NLS-1$
- public static final String DEFAULT_VALUE = "supDefaultvalue"; // Boolean //$NON-NLS-1$
- public static final String LENGTH = "length"; // Integer //$NON-NLS-1$
- public static final String CASE_SENSITIVE = "caseSensitive"; // Boolean //$NON-NLS-1$
- public static final String SIGNED = "signed"; // Boolean //$NON-NLS-1$
- public static final String PRECISION = "precision"; // Integer //$NON-NLS-1$
- public static final String SCALE = "scale"; // Integer //$NON-NLS-1$
- public static final String RADIX = "radix"; // Integer //$NON-NLS-1$
- public static final String NATIVE_TYPE = "nativeType"; // String //$NON-NLS-1$
- public static final String MAX_VALUE = "maxValue"; // String //$NON-NLS-1$
- public static final String MIN_VALUE = "minValue"; // String //$NON-NLS-1$
- public static final String DISTINCT_VALUES = "distinctValues"; // Integer //$NON-NLS-1$
- public static final String NULL_VALUES = "nullValues"; // Integer //$NON-NLS-1$
- public static final String MODELED_TYPE = "modeledType"; // String //$NON-NLS-1$
- public static final String MODELED_BASE_TYPE = "baseType"; // String //$NON-NLS-1$
- public static final String MODELED_PRIMITIVE_TYPE = "primitiveType"; // String //$NON-NLS-1$
-
- // Key properties
- public static final String KEY_TYPE = "keyType"; // Integer //$NON-NLS-1$
- public static final String KEY_ELEMENTS = "keyElements"; // List<FakeMetadataObject elements> //$NON-NLS-1$
- public static final String REFERENCED_KEY = "referencedKey"; // FakeMetadataObject referenced primary key (if this is a fk) //$NON-NLS-1$
-
- // Procedure properties
- public static final String PARAMS = "params"; // List<FakeMetadataObject parameters> //$NON-NLS-1$
- public static final String INSERT_PROCEDURE = "insertProcedure"; // string giving the insert procedure //$NON-NLS-1$
- public static final String UPDATE_PROCEDURE = "updateProcedure"; // string giving the update procedure //$NON-NLS-1$
- public static final String DELETE_PROCEDURE = "deleteProcedure"; // string giving the delete procedure //$NON-NLS-1$
- public static final String UPDATE_COUNT = "updateCount"; // integer giving the update count //$NON-NLS-1$
-
- // Parameter properties
- public static final String DIRECTION = "direction"; // integer - see query.sql.lang.SPParameter //$NON-NLS-1$
- public static final String RESULT_SET = "isRS"; // FakeMetadataObject result set //$NON-NLS-1$
-
- // Result set properties
- public static final String COLUMNS = "columns"; // List<FakeMetadataObject elements> //$NON-NLS-1$
- }
-
-}
Deleted: branches/7.4.x/engine/src/test/java/org/teiid/query/unittest/FakeMetadataStore.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/unittest/FakeMetadataStore.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/unittest/FakeMetadataStore.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -1,129 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.query.unittest;
-
-import java.util.*;
-
-public class FakeMetadataStore {
-
- private Map models = new HashMap();
- private Map groups = new HashMap();
- private Map elements = new HashMap();
- private Map keys = new HashMap();
- private Map procedures = new HashMap();
- private Map resultSets = new HashMap();
-
- public FakeMetadataStore() {
- }
-
- public void addObject(FakeMetadataObject object) {
- String lookupName = object.getName().toUpperCase();
- if(object.getType().equals(FakeMetadataObject.ELEMENT)) {
- elements.put(lookupName, object);
- } else if(object.getType().equals(FakeMetadataObject.GROUP)) {
- groups.put(lookupName, object);
- } else if(object.getType().equals(FakeMetadataObject.MODEL)) {
- models.put(lookupName, object);
- } else if(object.getType().equals(FakeMetadataObject.KEY)) {
- keys.put(lookupName, object);
- } else if(object.getType().equals(FakeMetadataObject.PROCEDURE)) {
- procedures.put(lookupName, object);
- } else if(object.getType().equals(FakeMetadataObject.RESULT_SET)) {
- resultSets.put(lookupName, object);
- } else {
- throw new IllegalArgumentException("Bad FakeMetadataObject type: " + object.getType()); //$NON-NLS-1$
- }
- }
-
- public void addObjects(Collection objects) {
- Iterator iter = objects.iterator();
- while(iter.hasNext()) {
- addObject((FakeMetadataObject) iter.next());
- }
- }
-
- public FakeMetadataObject findObject(String name, String type) {
- String lookupName = name.toUpperCase();
- if(type.equals(FakeMetadataObject.ELEMENT)) {
- return (FakeMetadataObject) elements.get(lookupName);
- } else if(type.equals(FakeMetadataObject.GROUP)) {
- return (FakeMetadataObject) groups.get(lookupName);
- } else if(type.equals(FakeMetadataObject.MODEL)) {
- return (FakeMetadataObject) models.get(lookupName);
- } else if(type.equals(FakeMetadataObject.KEY)) {
- return (FakeMetadataObject) keys.get(lookupName);
- } else if(type.equals(FakeMetadataObject.PROCEDURE)) {
- return (FakeMetadataObject) procedures.get(lookupName);
- } else if(type.equals(FakeMetadataObject.RESULT_SET)) {
- return (FakeMetadataObject) resultSets.get(lookupName);
- } else {
- throw new IllegalArgumentException("Bad FakeMetadataObject type: " + type); //$NON-NLS-1$
- }
- }
-
- public List findObjects(String type, String propertyName, Object matchValue) {
- Map domain = null;
- if(type.equals(FakeMetadataObject.ELEMENT)) {
- domain = elements;
- } else if(type.equals(FakeMetadataObject.GROUP)) {
- domain = groups;
- } else if(type.equals(FakeMetadataObject.MODEL)) {
- domain = models;
- } else if(type.equals(FakeMetadataObject.KEY)) {
- domain = keys;
- } else if(type.equals(FakeMetadataObject.PROCEDURE)) {
- domain = procedures;
- } else if(type.equals(FakeMetadataObject.RESULT_SET)) {
- domain = resultSets;
- } else {
- throw new IllegalArgumentException("Bad FakeMetadataObject type: " + type); //$NON-NLS-1$
- }
-
- List found = new ArrayList();
-
- Iterator iter = domain.values().iterator();
- while(iter.hasNext()) {
- FakeMetadataObject mdobj = (FakeMetadataObject) iter.next();
- if(compareWithNull(mdobj.getProperty(propertyName), matchValue)) {
- found.add(mdobj);
- }
- }
-
- return found;
- }
-
-
- public boolean compareWithNull(Object obj1, Object obj2) {
- if(obj1 == null) {
- if(obj2 == null) {
- return true;
- }
- return false;
- }
- if(obj2 == null) {
- return false;
- }
- return obj1.equals(obj2);
- }
-
-}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -22,13 +22,23 @@
package org.teiid.query.unittest;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Iterator;
import java.util.List;
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.SessionMetadata;
import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.api.exception.query.QueryMetadataException;
import org.teiid.client.metadata.ParameterInfo;
+import org.teiid.core.TeiidComponentException;
import org.teiid.core.types.DataTypeManager;
+import org.teiid.dqp.internal.process.DQPWorkContext;
import org.teiid.metadata.Column;
import org.teiid.metadata.ColumnSet;
import org.teiid.metadata.ForeignKey;
@@ -43,24 +53,41 @@
import org.teiid.metadata.BaseColumn.NullType;
import org.teiid.metadata.Column.SearchType;
import org.teiid.metadata.ProcedureParameter.Type;
+import org.teiid.metadata.Table.TriggerEvent;
import org.teiid.query.function.FunctionTree;
+import org.teiid.query.function.SystemFunctionManager;
import org.teiid.query.function.UDFSource;
import org.teiid.query.mapping.relational.QueryNode;
+import org.teiid.query.mapping.xml.MappingAttribute;
+import org.teiid.query.mapping.xml.MappingDocument;
+import org.teiid.query.mapping.xml.MappingElement;
+import org.teiid.query.mapping.xml.MappingOutputter;
+import org.teiid.query.mapping.xml.MappingSequenceNode;
import org.teiid.query.metadata.CompositeMetadataStore;
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.metadata.TransformationMetadata;
+import org.teiid.query.optimizer.FakeFunctionMetadataSource;
import org.teiid.query.sql.lang.SPParameter;
@SuppressWarnings("nls")
public class RealMetadataFactory {
- private static TransformationMetadata CACHED_BQT = exampleBQT();
+ public static final SystemFunctionManager SFM = new SystemFunctionManager();
+
+ private static TransformationMetadata CACHED_EXAMPLE1 = example1();
+ private static TransformationMetadata CACHED_BQT = exampleBQT();
+ static TransformationMetadata CACHED_AGGREGATES = exampleAggregates();
private RealMetadataFactory() { }
public static TransformationMetadata exampleBQTCached() {
return CACHED_BQT;
}
+
+ public static TransformationMetadata example1Cached() {
+ return CACHED_EXAMPLE1;
+ }
+
public static MetadataStore exampleBQTStore() {
MetadataStore metadataStore = new MetadataStore();
@@ -197,31 +224,31 @@
Schema pm1 = createPhysicalModel("pm1", metadataStore); //$NON-NLS-1$
ProcedureParameter rs1p1 = createParameter("intkey", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
ColumnSet<Procedure> rs1 = createResultSet("rs1", new String[] { "IntKey", "StringKey" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Procedure spTest5 = createStoredProcedure("spTest5", pm1, Arrays.asList(rs1p1), "spTest5"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure spTest5 = createStoredProcedure("spTest5", pm1, Arrays.asList(rs1p1)); //$NON-NLS-1$ //$NON-NLS-2$
spTest5.setResultSet(rs1);
Schema pm2 = createPhysicalModel("pm2", metadataStore); //$NON-NLS-1$
ProcedureParameter rs2p1 = createParameter("inkey", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
ProcedureParameter rs2p2 = createParameter("outkey", ParameterInfo.OUT, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
ColumnSet<Procedure> rs2 = createResultSet("rs2", new String[] { "IntKey", "StringKey"}, new String[] { DataTypeManager.DefaultDataTypes.INTEGER , DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Procedure spTest8 = createStoredProcedure("spTest8", pm2, Arrays.asList(rs2p1, rs2p2), "spTest8"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure spTest8 = createStoredProcedure("spTest8", pm2, Arrays.asList(rs2p1, rs2p2)); //$NON-NLS-1$ //$NON-NLS-2$
spTest8.setResultSet(rs2);
ProcedureParameter rs2p2a = createParameter("outkey", ParameterInfo.OUT, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
ColumnSet<Procedure> rs2a = createResultSet("rs2", new String[] { "IntKey", "StringKey"}, new String[] { DataTypeManager.DefaultDataTypes.INTEGER , DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Procedure spTest8a = createStoredProcedure("spTest8a", pm2, Arrays.asList(rs2p2a), "spTest8a"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure spTest8a = createStoredProcedure("spTest8a", pm2, Arrays.asList(rs2p2a)); //$NON-NLS-1$ //$NON-NLS-2$
spTest8a.setResultSet(rs2a);
Schema pm4 = createPhysicalModel("pm4", metadataStore); //$NON-NLS-1$
ProcedureParameter rs4p1 = createParameter("ret", ParameterInfo.RETURN_VALUE, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
ProcedureParameter rs4p2 = createParameter("inkey", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
- createStoredProcedure("spTest9", pm4, Arrays.asList(rs4p1, rs4p2), "spTest9"); //$NON-NLS-1$ //$NON-NLS-2$
+ createStoredProcedure("spTest9", pm4, Arrays.asList(rs4p1, rs4p2)); //$NON-NLS-1$ //$NON-NLS-2$
Schema pm3 = createPhysicalModel("pm3", metadataStore); //$NON-NLS-1$
ProcedureParameter rs3p1 = createParameter("inkey", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
ProcedureParameter rs3p2 = createParameter("outkey", ParameterInfo.INOUT, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
ColumnSet<Procedure> rs3 = createResultSet("rs3", new String[] { "IntKey", "StringKey"}, new String[] { DataTypeManager.DefaultDataTypes.INTEGER , DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Procedure spTest11 = createStoredProcedure("spTest11", pm3, Arrays.asList(rs3p1, rs3p2), "spTest11"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure spTest11 = createStoredProcedure("spTest11", pm3, Arrays.asList(rs3p1, rs3p2)); //$NON-NLS-1$ //$NON-NLS-2$
spTest11.setResultSet(rs3);
//add virtual stored procedures
@@ -259,7 +286,7 @@
vsp6.setResultSet(vsprs6);
createStoredProcedure("spRetOut", pm4, Arrays.asList(createParameter("ret", ParameterInfo.RETURN_VALUE, DataTypeManager.DefaultDataTypes.INTEGER),
- createParameter("x", ParameterInfo.OUT, DataTypeManager.DefaultDataTypes.INTEGER)), "spRetOut"); //$NON-NLS-1$ //$NON-NLS-2$
+ createParameter("x", ParameterInfo.OUT, DataTypeManager.DefaultDataTypes.INTEGER))); //$NON-NLS-1$ //$NON-NLS-2$
ColumnSet<Procedure> vsprs7 = createResultSet("TEIIDSP7.vsprs1", new String[] { "StringKey" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
ProcedureParameter vsp7p1 = createParameter("p1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
@@ -293,20 +320,20 @@
return createTransformationMetadata(exampleBQTStore(), "bqt");
}
-
- public static TransformationMetadata createTransformationMetadata(MetadataStore metadataStore, String vdbName) {
+ public static TransformationMetadata createTransformationMetadata(MetadataStore metadataStore, String vdbName, FunctionTree... functionModels) {
CompositeMetadataStore store = new CompositeMetadataStore(metadataStore);
VDBMetaData vdbMetaData = new VDBMetaData();
vdbMetaData.setName(vdbName); //$NON-NLS-1$
vdbMetaData.setVersion(1);
List<FunctionTree> udfs = new ArrayList<FunctionTree>();
+ udfs.addAll(Arrays.asList(functionModels));
for (Schema schema : metadataStore.getSchemas().values()) {
- vdbMetaData.addModel(FakeMetadataFactory.createModel(schema.getName(), schema.isPhysical()));
+ vdbMetaData.addModel(RealMetadataFactory.createModel(schema.getName(), schema.isPhysical()));
if (!schema.getFunctions().isEmpty()) {
udfs.add(new FunctionTree(schema.getName(), new UDFSource(schema.getFunctions().values()), true));
}
}
- return new TransformationMetadata(vdbMetaData, store, null, FakeMetadataFactory.SFM.getSystemFunctions(), udfs);
+ return new TransformationMetadata(vdbMetaData, store, null, SFM.getSystemFunctions(), udfs);
}
/**
@@ -442,6 +469,1061 @@
return createTransformationMetadata(metadataStore, "");
}
+
+ public static MetadataStore example1Store() {
+ MetadataStore metadataStore = new MetadataStore();
+ // Create models
+ Schema pm1 = createPhysicalModel("pm1", metadataStore); //$NON-NLS-1$
+
+ pm1.addFunction(new FakeFunctionMetadataSource().getFunctionMethods().iterator().next());
+
+ Schema pm2 = createPhysicalModel("pm2", metadataStore); //$NON-NLS-1$
+ Schema pm3 = createPhysicalModel("pm3", metadataStore); //allows push of SELECT DISTINCT //$NON-NLS-1$
+ Schema pm4 = createPhysicalModel("pm4", metadataStore); //all groups w/ access pattern(s) //$NON-NLS-1$
+ Schema pm5 = createPhysicalModel("pm5", metadataStore); //all groups w/ access pattern(s); model supports join //$NON-NLS-1$
+ Schema pm6 = createPhysicalModel("pm6", metadataStore); //model does not support where all //$NON-NLS-1$
+ Schema vm1 = createVirtualModel("vm1", metadataStore); //$NON-NLS-1$
+ Schema vm2 = createVirtualModel("vm2", metadataStore); //$NON-NLS-1$
+ Schema xmltest = createVirtualModel("xmltest", metadataStore); //$NON-NLS-1$
+
+ // Create physical groups
+ Table pm1g1 = createPhysicalGroup("g1", pm1); //$NON-NLS-1$
+ Table pm1g2 = createPhysicalGroup("g2", pm1); //$NON-NLS-1$
+ Table pm1g3 = createPhysicalGroup("g3", pm1); //$NON-NLS-1$
+ Table pm1g4 = createPhysicalGroup("g4", pm1); //$NON-NLS-1$
+ Table pm1g5 = createPhysicalGroup("g5", pm1); //$NON-NLS-1$
+ Table pm1g6 = createPhysicalGroup("g6", pm1); //$NON-NLS-1$
+ Table pm1table = createPhysicalGroup("table1", pm1); //$NON-NLS-1$
+ Table pm2g1 = createPhysicalGroup("g1", pm2); //$NON-NLS-1$
+ Table pm2g2 = createPhysicalGroup("g2", pm2); //$NON-NLS-1$
+ Table pm2g3 = createPhysicalGroup("g3", pm2); //$NON-NLS-1$
+ Table pm3g1 = createPhysicalGroup("g1", pm3); //$NON-NLS-1$
+ Table pm3g2 = createPhysicalGroup("g2", pm3); //$NON-NLS-1$
+ Table pm4g1 = createPhysicalGroup("g1", pm4); //$NON-NLS-1$
+ Table pm4g2 = createPhysicalGroup("g2", pm4); //$NON-NLS-1$
+ Table pm5g1 = createPhysicalGroup("g1", pm5); //$NON-NLS-1$
+ Table pm5g2 = createPhysicalGroup("g2", pm5); //$NON-NLS-1$
+ Table pm5g3 = createPhysicalGroup("g3", pm5); //$NON-NLS-1$
+ Table pm6g1 = createPhysicalGroup("g1", pm6); //$NON-NLS-1$
+
+ // Create physical elements
+ createElements(pm1g1,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(pm1g2,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(pm1g3,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ List<Column> pm1g4e = createElements(pm1g4,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ pm1g4e.get(1).setSelectable(false);
+ pm1g4e.get(3).setSelectable(false);
+ List<Column> pm1g5e = createElements(pm1g5,
+ new String[] { "e1" }, //$NON-NLS-1$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING });
+ pm1g5e.get(0).setSelectable(false);
+ createElements(pm1g6,
+ new String[] { "in", "in3" }, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
+ createElements(pm1table,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(pm2g1,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(pm2g2,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(pm2g3,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(pm3g1,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DATE, DataTypeManager.DefaultDataTypes.TIME, DataTypeManager.DefaultDataTypes.TIMESTAMP });
+ createElements(pm3g2,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DATE, DataTypeManager.DefaultDataTypes.TIME, DataTypeManager.DefaultDataTypes.TIMESTAMP });
+ List<Column> pm4g1e = createElements(pm4g1,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ List<Column> pm4g2e = createElements(pm4g2,
+ new String[] { "e1", "e2", "e3", "e4", "e5", "e6" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
+ List<Column> pm5g1e = createElements(pm5g1,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ List<Column> pm5g2e = createElements(pm5g2,
+ new String[] { "e1", "e2", "e3", "e4", "e5", "e6" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
+ createElements(pm5g3,
+ new String[] { "e1", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.SHORT });
+ createElements(pm6g1,
+ new String[] { "e1", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
+
+
+ // Create access patterns - pm4
+ List<Column> elements = new ArrayList<Column>(1);
+ elements.add(pm4g1e.iterator().next());
+ createAccessPattern("pm4.g1.ap1", pm4g1, elements); //e1 //$NON-NLS-1$
+ elements = new ArrayList<Column>(2);
+ Iterator<Column> iter = pm4g2e.iterator();
+ elements.add(iter.next());
+ elements.add(iter.next());
+ createAccessPattern("pm4.g2.ap1", pm4g2, elements); //e1,e2 //$NON-NLS-1$
+ elements = new ArrayList<Column>(1);
+ elements.add(pm4g2e.get(4)); //"e5"
+ KeyRecord pm4g2ap2 =createAccessPattern("pm4.g2.ap2", pm4g2, elements); //e5 //$NON-NLS-1$
+ // Create access patterns - pm5
+ elements = new ArrayList<Column>(1);
+ elements.add(pm5g1e.iterator().next());
+ createAccessPattern("pm5.g1.ap1", pm5g1, elements); //e1 //$NON-NLS-1$
+ elements = new ArrayList<Column>(2);
+ iter = pm5g2e.iterator();
+ elements.add(iter.next());
+ elements.add(iter.next());
+ createAccessPattern("pm5.g2.ap1", pm5g2, elements); //e1,e2 //$NON-NLS-1$
+ elements = new ArrayList<Column>(1);
+ elements.add(pm5g2e.get(4)); //"e5"
+ createAccessPattern("pm5.g2.ap2", pm5g2, elements); //e5 //$NON-NLS-1$
+
+ // Create temp groups
+ Table tm1g1 = createXmlStagingTable("doc4.tm1.g1", xmltest, new QueryNode("select null, null, null, null, null")); //$NON-NLS-1$
+
+ // Create temp elements - the element "node1" is purposely named to be ambiguous with a document node named "node1"
+ createElements(tm1g1,
+ new String[] { "e1", "e2", "e3", "e4", "node1"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.STRING });
+
+ // Create virtual groups
+ QueryNode vm1g1n1 = new QueryNode("SELECT * FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g1 = createUpdatableVirtualGroup("g1", vm1, vm1g1n1); //$NON-NLS-1$
+
+ QueryNode vm2g1n1 = new QueryNode("SELECT pm1.g1.* FROM pm1.g1, pm1.g2 where pm1.g1.e2 = pm1.g2.e2"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm2g1 = createUpdatableVirtualGroup("g1", vm2, vm2g1n1); //$NON-NLS-1$
+
+ QueryNode vm1g1n1_defect10711 = new QueryNode("SELECT * FROM vm1.g1 as X"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g1_defect10711 = createVirtualGroup("g1a", vm1, vm1g1n1_defect10711); //$NON-NLS-1$
+
+ QueryNode vm1g1n1_defect12081 = new QueryNode("SELECT e1, upper(e1) as e1Upper FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g1_defect12081 = createVirtualGroup("g1b", vm1, vm1g1n1_defect12081); //$NON-NLS-1$
+
+ QueryNode vm1g1n1c = new QueryNode("SELECT PARSETIMESTAMP(pm1.g1.e1, 'MMM dd yyyy hh:mm:ss') as e5, e2, e3, e4 FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g1c = createVirtualGroup("g1c", vm1, vm1g1n1c); //$NON-NLS-1$
+
+ QueryNode vm1g2an1 = new QueryNode("SELECT * FROM pm1.g2"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g2a = createVirtualGroup("g2a", vm1, vm1g2an1); //$NON-NLS-1$
+
+ QueryNode vm1g2n1 = new QueryNode("SELECT pm1.g1.e1, pm1.g1.e2, pm1.g2.e3, pm1.g2.e4 FROM pm1.g1, pm1.g2 WHERE pm1.g1.e1=pm1.g2.e1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g2 = createVirtualGroup("g2", vm1, vm1g2n1); //$NON-NLS-1$
+
+ QueryNode vm1g4n1 = new QueryNode("SELECT e1 FROM pm1.g1 UNION ALL SELECT convert(e2, string) as x FROM pm1.g2 ORDER BY e1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g4 = createVirtualGroup("g4", vm1, vm1g4n1); //$NON-NLS-1$
+
+ QueryNode vm1g5n1 = new QueryNode("SELECT concat(e1, 'val'), e2 FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g5 = createVirtualGroup("g5", vm1, vm1g5n1); //$NON-NLS-1$
+
+ QueryNode vm1g6n1 = new QueryNode("SELECT concat(e1, 'val') AS e, e2 FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g6 = createVirtualGroup("g6", vm1, vm1g6n1); //$NON-NLS-1$
+
+ QueryNode vm1g7n1 = new QueryNode("SELECT concat(e1, e2) AS e, e2 FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g7 = createVirtualGroup("g7", vm1, vm1g7n1); //$NON-NLS-1$
+
+ QueryNode vm1g8n1 = new QueryNode("SELECT concat(e1, 'val') AS e, e2 FROM pm1.g1 ORDER BY e"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g8 = createVirtualGroup("g8", vm1, vm1g8n1); //$NON-NLS-1$
+
+ QueryNode vm1g9n1 = new QueryNode("SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1, pm4.g1 WHERE pm1.g1.e1 = pm4.g1.e1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g9 = createVirtualGroup("g9", vm1, vm1g9n1); //$NON-NLS-1$
+
+ QueryNode vm1g10n1 = new QueryNode("SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1, pm4.g2 WHERE pm1.g1.e1 = pm4.g2.e1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g10 = createVirtualGroup("g10", vm1, vm1g10n1); //$NON-NLS-1$
+
+ QueryNode vm1g11n1 = new QueryNode("SELECT * FROM pm4.g2"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g11 = createVirtualGroup("g11", vm1, vm1g11n1); //$NON-NLS-1$
+
+ QueryNode vm1g12n1 = new QueryNode("SELECT DISTINCT * FROM pm3.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g12 = createVirtualGroup("g12", vm1, vm1g12n1); //$NON-NLS-1$
+
+ QueryNode vm1g13n1 = new QueryNode("SELECT DISTINCT * FROM pm3.g1 ORDER BY e1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g13 = createVirtualGroup("g13", vm1, vm1g13n1); //$NON-NLS-1$
+
+ QueryNode vm1g14n1 = new QueryNode("SELECT * FROM pm3.g1 ORDER BY e1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g14 = createVirtualGroup("g14", vm1, vm1g14n1); //$NON-NLS-1$
+
+ QueryNode vm1g15n1 = new QueryNode("SELECT e1, concat(e1, convert(e2, string)) AS x FROM pm3.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g15 = createVirtualGroup("g15", vm1, vm1g15n1); //$NON-NLS-1$
+
+ QueryNode vm1g16n1 = new QueryNode("SELECT concat(e1, 'val') AS e, e2 FROM pm3.g1 ORDER BY e"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g16 = createVirtualGroup("g16", vm1, vm1g16n1); //$NON-NLS-1$
+
+ QueryNode vm1g17n1 = new QueryNode("SELECT pm3.g1.e1, pm3.g1.e2 FROM pm3.g1 UNION ALL SELECT pm3.g2.e1, pm3.g2.e2 FROM pm3.g2 ORDER BY e2"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g17 = createVirtualGroup("g17", vm1, vm1g17n1); //$NON-NLS-1$
+
+ QueryNode vm1g18n1 = new QueryNode("SELECT (e4 * 100.0) as x FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g18 = createVirtualGroup("g18", vm1, vm1g18n1); //$NON-NLS-1$
+
+ // Transformations with subqueries and correlated subqueries
+ QueryNode vm1g19n1 = new QueryNode("Select * from vm1.g4 where not (e1 in (select e1 FROM vm1.g1 WHERE vm1.g4.e1 = e1))"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g19 = createVirtualGroup("g19", vm1, vm1g19n1); //$NON-NLS-1$
+
+ QueryNode vm1g20n1 = new QueryNode("Select * from vm1.g1 where exists (select e1 FROM vm1.g2 WHERE vm1.g1.e1 = e1)"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g20 = createVirtualGroup("g20", vm1, vm1g20n1); //$NON-NLS-1$
+
+ QueryNode vm1g21n1 = new QueryNode("Select * from pm1.g1 where exists (select e1 FROM pm2.g1 WHERE pm1.g1.e1 = e1)"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g21 = createVirtualGroup("g21", vm1, vm1g21n1); //$NON-NLS-1$
+
+ QueryNode vm1g22n1 = new QueryNode("Select e1, e2, e3, e4, (select e4 FROM vm1.g21 WHERE vm1.g20.e4 = e4 and e4 = 7.0) as E5 from vm1.g20"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g22 = createVirtualGroup("g22", vm1, vm1g22n1); //$NON-NLS-1$
+
+ QueryNode vm1g23n1 = new QueryNode("Select e1, e2, e3, e4, (select e4 FROM vm1.g21 WHERE vm1.g20.e4 = 7.0 and e4 = 7.0) as E5 from vm1.g20"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g23 = createVirtualGroup("g23", vm1, vm1g23n1); //$NON-NLS-1$
+
+ QueryNode vm1g24n1 = new QueryNode("Select * from vm1.g20 where exists (select * FROM vm1.g21 WHERE vm1.g20.e4 = E4)"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g24 = createVirtualGroup("g24", vm1, vm1g24n1); //$NON-NLS-1$
+
+ QueryNode vm1g25n1 = new QueryNode("Select e1, e2, e3, e4, (select e4 FROM pm1.g2 WHERE e1 = 'b') as E5 from pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g25 = createVirtualGroup("g25", vm1, vm1g25n1); //$NON-NLS-1$
+
+ QueryNode vm1g26n1 = new QueryNode("Select e1, e2, e3, e4, (select e4 FROM pm1.g2 WHERE e4 = pm1.g1.e4 and e1 = 'b') as E5 from pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g26 = createVirtualGroup("g26", vm1, vm1g26n1); //$NON-NLS-1$
+
+ //defect 10976
+// QueryNode vm1g27n1 = new QueryNode("vm1.g27", "SELECT DISTINCT x as a, lower(e1) as x FROM vm1.g28"); //$NON-NLS-1$ //$NON-NLS-2$
+ QueryNode vm1g27n1 = new QueryNode("SELECT upper(e1) as x, e1 FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g27 = createVirtualGroup("g27", vm1, vm1g27n1); //$NON-NLS-1$
+
+ QueryNode vm1g28n1 = new QueryNode("SELECT DISTINCT x as a, lower(e1) as x FROM vm1.g27"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g28 = createVirtualGroup("g28", vm1, vm1g28n1); //$NON-NLS-1$
+
+ QueryNode vm1g29n1 = new QueryNode("SELECT DISTINCT x, lower(e1) FROM vm1.g27"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g29 = createVirtualGroup("g29", vm1, vm1g29n1); //$NON-NLS-1$
+
+ QueryNode vm1g30n1 = new QueryNode("SELECT DISTINCT e1 as x, e1 as y FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g30 = createVirtualGroup("g30", vm1, vm1g30n1); //$NON-NLS-1$
+
+ QueryNode vm1g31n1 = new QueryNode("SELECT e1 as x, e1 as y FROM pm1.g1 ORDER BY x"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g31 = createVirtualGroup("g31", vm1, vm1g31n1); //$NON-NLS-1$
+
+ QueryNode vm1g32n1 = new QueryNode("SELECT DISTINCT e1 as x, e1 as y FROM pm1.g1 ORDER BY x"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g32 = createVirtualGroup("g32", vm1, vm1g32n1); //$NON-NLS-1$
+
+ QueryNode vm1g33n1 = new QueryNode("SELECT e2 FROM pm1.g1 WHERE 2 = e2"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g33 = createVirtualGroup("g33", vm1, vm1g33n1); //$NON-NLS-1$
+
+ QueryNode vm1g34n1 = new QueryNode("SELECT e1 as e1_, e2 as e2_ FROM pm1.g1 UNION ALL SELECT e1 as e1_, e2 as e2_ FROM pm2.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g34 = createVirtualGroup("g34", vm1, vm1g34n1); //$NON-NLS-1$
+
+ QueryNode vm1g36n1 = new QueryNode("SELECT pm1.g1.e1 as ve1, pm1.g2.e1 as ve2 FROM pm1.g1 LEFT OUTER JOIN /* optional */ pm1.g2 on pm1.g1.e1 = pm1.g2.e1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g36 = createVirtualGroup("g36", vm1, vm1g36n1); //$NON-NLS-1$
+
+ QueryNode vm1g37n1 = new QueryNode("SELECT * from pm4.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g37 = createVirtualGroup("g37", vm1, vm1g37n1); //$NON-NLS-1$
+ vm1g37.setSupportsUpdate(true);
+
+ QueryNode vm1g38n1 = new QueryNode("SELECT a.e1, b.e2 from pm1.g1 as a, pm6.g1 as b where a.e1=b.e1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g38 = createVirtualGroup("g38", vm1, vm1g38n1); //$NON-NLS-1$
+
+ // Create virtual groups
+ QueryNode vm1g39n1 = new QueryNode("SELECT * FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g39 = createUpdatableVirtualGroup("g39", vm1, vm1g39n1, "CREATE PROCEDURE BEGIN LOOP ON (SELECT pm1.g1.e2 FROM pm1.g1 where pm1.g1.e2=3) AS mycursor begin update pm1.g1 set pm1.g1.e1 = input.e1 where pm1.g1.e1 = input.e1; ROWS_UPDATED = ROWS_UPDATED + ROWCOUNT;\nupdate pm1.g1 set pm1.g1.e2 = input.e2 where pm1.g1.e2 = input.e2; END END"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Create virtual elements
+ createElements(vm1g39,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(vm1g1,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(vm2g1,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(vm1g1_defect10711,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(vm1g1_defect12081,
+ new String[] { "e1", "e1Upper" }, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
+ createElements(vm1g1c,
+ new String[] { "e5", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.TIMESTAMP, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(vm1g2a,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(vm1g2,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(vm1g4,
+ new String[] { "e1" }, //$NON-NLS-1$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING });
+ createElements(vm1g5,
+ new String[] { "expr", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
+ createElements(vm1g6,
+ new String[] { "e", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
+ createElements(vm1g7,
+ new String[] { "e", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
+ createElements(vm1g8,
+ new String[] { "e", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
+ createElements(vm1g9,
+ new String[] { "e1", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
+ createElements(vm1g10,
+ new String[] { "e1", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
+ createElements(vm1g11,
+ new String[] { "e1", "e2", "e3", "e4", "e5", "e6"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
+ createElements(vm1g12,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DATE, DataTypeManager.DefaultDataTypes.TIME, DataTypeManager.DefaultDataTypes.TIMESTAMP });
+ createElements(vm1g13,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DATE, DataTypeManager.DefaultDataTypes.TIME, DataTypeManager.DefaultDataTypes.TIMESTAMP });
+ createElements(vm1g14,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DATE, DataTypeManager.DefaultDataTypes.TIME, DataTypeManager.DefaultDataTypes.TIMESTAMP });
+ createElements(vm1g15,
+ new String[] { "e1", "x" }, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
+ createElements(vm1g16,
+ new String[] { "e", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DATE });
+ createElements(vm1g17,
+ new String[] { "e1", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DATE });
+ createElements(vm1g18,
+ new String[] { "x" }, //$NON-NLS-1$
+ new String[] { DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(vm1g19,
+ new String[] { "e1" }, //$NON-NLS-1$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING });
+ createElements(vm1g20,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(vm1g21,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(vm1g22,
+ new String[] { "e1", "e2", "e3", "e4", "e5" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(vm1g23,
+ new String[] { "e1", "e2", "e3", "e4", "e5" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(vm1g24,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(vm1g25,
+ new String[] { "e1", "e2", "e3", "e4", "e5" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(vm1g26,
+ new String[] { "e1", "e2", "e3", "e4", "e5" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(vm1g27,
+ new String[] { "x", "e1"}, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
+ createElements(vm1g28,
+ new String[] { "a", "x"}, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
+ createElements(vm1g29,
+ new String[] { "x", "expr"}, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
+ createElements(vm1g30,
+ new String[] { "x", "y"}, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
+ createElements(vm1g31,
+ new String[] { "x", "y"}, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
+ createElements(vm1g32,
+ new String[] { "x", "y"}, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
+ createElements(vm1g33,
+ new String[] { "e2"}, //$NON-NLS-1$
+ new String[] { DataTypeManager.DefaultDataTypes.INTEGER });
+ createElements(vm1g34,
+ new String[] { "e1_", "e2_"}, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
+ createElements(vm1g36,
+ new String[] { "ve1", "ve2" }, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
+ List<Column> vm1g37e = createElements(vm1g37,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(vm1g38,
+ new String[] { "e1", "e2" }, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
+
+ //Create access patterns on vm1.g37
+ elements = new ArrayList<Column>(1);
+ elements.add(vm1g37e.iterator().next());
+ createAccessPattern("vm1.g37.ap1", vm1g37, elements); //e1 //$NON-NLS-1$
+
+ //XML STUFF =============================================
+ Table doc1 = createXmlDocument("doc1", xmltest, exampleDoc1()); //$NON-NLS-1$
+ Table doc2 = createXmlDocument("doc2", xmltest, exampleDoc2()); //$NON-NLS-1$
+ Table doc3 = createXmlDocument("doc3", xmltest, exampleDoc3()); //$NON-NLS-1$
+ Table doc4 = createXmlDocument("doc4", xmltest, exampleDoc4()); //$NON-NLS-1$
+ Table doc5 = createXmlDocument("doc5", xmltest, exampleDoc5()); //$NON-NLS-1$
+ Table doc6 = createXmlDocument("doc6", xmltest, exampleDoc6()); //$NON-NLS-1$
+
+ // Defect 11479 - test ambiguous doc short names
+ createXmlDocument("xmltest2.docA", vm1, exampleDoc1()); //$NON-NLS-1$
+ createXmlDocument("xmltest3.docA", vm1, exampleDoc2()); //$NON-NLS-1$
+
+ createElements(doc1, new String[] { "root", "root.node1", "root.node1.node2", "root.node1.node2.node3" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
+ createElements(doc2, new String[] { "root", "root.node1", "root.node1.node3" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
+ createElements(doc3, new String[] { "root", "root.node1.node2", "root.node2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
+ createElements(doc4, new String[] { "root", "root.@node6", "root.node1", "root.node1.@node2", "root.node3", "root.node3.@node4", "root.node3.node4", "root.node3.root.node6" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
+ createElements(doc5, new String[] { "root", "root.node1", "root.node1.node2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
+
+ // Create mapping classes for xmltest.doc5
+ QueryNode mc1n1 = new QueryNode("SELECT e1 FROM pm1.g1 UNION ALL SELECT e1 FROM pm1.g2"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1mc1 = createVirtualGroup("mc1", xmltest, mc1n1); //$NON-NLS-1$
+ createElements(vm1mc1,
+ new String[] { "e1" }, //$NON-NLS-1$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING });
+
+ createElements(doc6, new String[] { "root", "root.node", "root.thenode" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
+
+ //XML STUFF =============================================
+
+ // Procedures and stored queries
+ ColumnSet<Procedure> rs1 = createResultSet("pm1.rs1", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ QueryNode sq1n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sq1 = createVirtualProcedure("sq1", pm1, null, sq1n1); //$NON-NLS-1$
+ sq1.setResultSet(rs1);
+
+ ColumnSet<Procedure> rs2 = createResultSet("ret", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ProcedureParameter rs2p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq2.in; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sq2 = createVirtualProcedure("sq2", pm1, Arrays.asList(rs2p2), sq2n1); //$NON-NLS-1$
+ sq2.setResultSet(rs2);
+
+ ColumnSet<Procedure> rs5 = createResultSet("pm1.r5", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ProcedureParameter rs5p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ ProcedureParameter rs5p3 = createParameter("in2", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ QueryNode sq3n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq3.in UNION ALL SELECT e1, e2 FROM pm1.g1 WHERE e2=pm1.sq3.in2; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sq3 = createVirtualProcedure("sq3", pm1, Arrays.asList(rs5p2, rs5p3), sq3n1); //$NON-NLS-1$
+ sq3.setResultSet(rs5);
+
+ //For defect 8211 - this stored query has two input params, no return param, and
+ //the input params are PURPOSELY numbered with indices "1" and "3" - see defect 8211
+ ColumnSet<Procedure> rs5a = createResultSet("pm1.r5a", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ProcedureParameter rs5p1a = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ ProcedureParameter rs5p2a = createParameter("in2", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ QueryNode sq3n1a = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq3a.in UNION ALL SELECT e1, e2 FROM pm1.g1 WHERE e2=pm1.sq3a.in2; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sq3a = createVirtualProcedure("sq3a", pm1, Arrays.asList(rs5p1a, rs5p2a), sq3n1a); //$NON-NLS-1$
+ sq3a.setResultSet(rs5a);
+ //Case 3281 - create procedures with optional parameter(s)
+
+ //make "in2" parameter optional, make "in3" required but with a default value
+ ColumnSet<Procedure> rs5b = createResultSet("pm1.r5b", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ProcedureParameter rs5p2b = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ ProcedureParameter rs5p3b = createParameter("in2", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ ProcedureParameter rs5p4b = createParameter("in3", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ rs5p3b.setNullType(NullType.Nullable);
+ rs5p4b.setDefaultValue("YYZ"); //$NON-NLS-1$
+ QueryNode sq3n1b = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq3b.in UNION ALL SELECT e1, e2 FROM pm1.g1 WHERE e2=pm1.sq3b.in2; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sq3b = createVirtualProcedure("sq3b", pm1, Arrays.asList(rs5p2b, rs5p3b, rs5p4b), sq3n1b); //$NON-NLS-1$
+ sq3b.setResultSet(rs5b);
+
+ //Make parameters of all different types, all with appropriate default values
+ //Make some parameters required, some optional
+ //Also, fully-qualify the param names
+ ColumnSet<Procedure> rsDefaults = createResultSet("pm1.rDefaults", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ProcedureParameter rsDefaultsParameterString = createParameter("inString", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ //rsDefaultsParameterString.setNullType(NullType.Nullable);
+ rsDefaultsParameterString.setDefaultValue(new String("x")); //$NON-NLS-1$
+ ProcedureParameter rsParameterBigDecimal = createParameter("inBigDecimal", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.BIG_DECIMAL); //$NON-NLS-1$
+ rsParameterBigDecimal.setNullType(NullType.Nullable);
+ rsParameterBigDecimal.setDefaultValue(new String("13.0")); //$NON-NLS-1$
+ ProcedureParameter rsParameterBigInteger = createParameter("inBigInteger", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.BIG_INTEGER); //$NON-NLS-1$
+ rsParameterBigInteger.setNullType(NullType.Nullable);
+ rsParameterBigInteger.setDefaultValue(new String("13")); //$NON-NLS-1$
+ ProcedureParameter rsParameterBoolean = createParameter("inBoolean", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.BOOLEAN); //$NON-NLS-1$
+ rsParameterBoolean.setNullType(NullType.Nullable);
+ rsParameterBoolean.setDefaultValue(new String("True")); //$NON-NLS-1$
+ ProcedureParameter rsParameterByte = createParameter("inByte", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.BYTE); //$NON-NLS-1$
+ rsParameterByte.setNullType(NullType.Nullable);
+ rsParameterByte.setDefaultValue(new String("1")); //$NON-NLS-1$
+ ProcedureParameter rsParameterChar = createParameter("inChar", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.CHAR); //$NON-NLS-1$
+ rsParameterChar.setNullType(NullType.Nullable);
+ rsParameterChar.setDefaultValue(new String("q")); //$NON-NLS-1$
+ ProcedureParameter rsParameterDate = createParameter("inDate", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.DATE); //$NON-NLS-1$
+ rsParameterDate.setNullType(NullType.Nullable);
+ rsParameterDate.setDefaultValue(new String("2003-03-20")); //$NON-NLS-1$
+ ProcedureParameter rsParameterDouble = createParameter("inDouble", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.DOUBLE); //$NON-NLS-1$
+ rsParameterDouble.setNullType(NullType.Nullable);
+ rsParameterDouble.setDefaultValue(new String("13.0")); //$NON-NLS-1$
+ ProcedureParameter rsParameterFloat = createParameter("inFloat", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.FLOAT); //$NON-NLS-1$
+ rsParameterFloat.setNullType(NullType.Nullable);
+ rsParameterFloat.setDefaultValue(new String("13")); //$NON-NLS-1$
+ ProcedureParameter rsParameterInteger = createParameter("inInteger", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ rsParameterInteger.setNullType(NullType.Nullable);
+ rsParameterInteger.setDefaultValue(new String("13")); //$NON-NLS-1$
+ ProcedureParameter rsParameterLong = createParameter("inLong", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.LONG); //$NON-NLS-1$
+ rsParameterLong.setNullType(NullType.Nullable);
+ rsParameterLong.setDefaultValue(new String("13")); //$NON-NLS-1$
+ ProcedureParameter rsParameterShort = createParameter("inShort", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.SHORT); //$NON-NLS-1$
+ rsParameterShort.setNullType(NullType.Nullable);
+ rsParameterShort.setDefaultValue(new String("13")); //$NON-NLS-1$
+ ProcedureParameter rsParameterTimestamp = createParameter("inTimestamp", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.TIMESTAMP); //$NON-NLS-1$
+ rsParameterTimestamp.setNullType(NullType.Nullable);
+ rsParameterTimestamp.setDefaultValue(new String("2003-03-20 21:26:00.000000")); //$NON-NLS-1$
+ ProcedureParameter rsParameterTime = createParameter("inTime", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.TIME); //$NON-NLS-1$
+ rsParameterTime.setNullType(NullType.Nullable);
+ rsParameterTime.setDefaultValue(new String("21:26:00")); //$NON-NLS-1$
+ QueryNode sqDefaultsNode = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sqDefaults.inString UNION ALL SELECT e1, e2 FROM pm1.g1 WHERE e2=pm1.sqDefaults.inInteger; END"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ Procedure sqDefaults = createVirtualProcedure("sqDefaults", pm1, //$NON-NLS-1$
+ Arrays.asList(
+ rsDefaultsParameterString,
+ rsParameterBigDecimal,
+ rsParameterBigInteger,
+ rsParameterBoolean,
+ rsParameterByte,
+ rsParameterChar,
+ rsParameterDate,
+ rsParameterDouble,
+ rsParameterFloat,
+ rsParameterInteger,
+ rsParameterLong,
+ rsParameterShort,
+ rsParameterTimestamp,
+ rsParameterTime
+ ), sqDefaultsNode);
+ sqDefaults.setResultSet(rsDefaults);
+
+ ColumnSet<Procedure> rsBadDefault = createResultSet("pm1.rBadDefault", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ProcedureParameter paramBadDefaultIn = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ paramBadDefaultIn.setNullType(NullType.Nullable);
+ paramBadDefaultIn.setDefaultValue("Clearly Not An Integer"); //$NON-NLS-1$
+ QueryNode sqnBadDefault = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e2=pm1.sqBadDefault.in; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sqBadDefault = createVirtualProcedure("sqBadDefault", pm1, Arrays.asList(paramBadDefaultIn), sqnBadDefault); //$NON-NLS-1$
+
+ //end case 3281
+
+ ColumnSet<Procedure> rs3 = createResultSet("pm1.rs3", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Procedure sp1 = createStoredProcedure("sp1", pm1, null); //$NON-NLS-1$ //$NON-NLS-2$
+ sp1.setResultSet(rs3);
+
+ ColumnSet<Procedure> rs4 = createResultSet("pm1.rs4", new String[] { "e1"}, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ QueryNode sqsp1n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM (EXEC pm1.sp1()) as x; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sqsp1 = createVirtualProcedure("sqsp1", pm1, null, sqsp1n1); //$NON-NLS-1$
+ sqsp1.setResultSet(rs4);
+
+ ColumnSet<Procedure> rs6 = createResultSet("pm1.rs6", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ QueryNode sq4n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN EXEC pm1.sq1(); END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sq4 = createVirtualProcedure("sq4", pm1, null, sq4n1); //$NON-NLS-1$
+ sq4.setResultSet(rs6);
+
+ ColumnSet<Procedure> rs7 = createResultSet("pm1.rs7", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ProcedureParameter rs7p2 = createParameter("in1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ QueryNode sq5n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN EXEC pm1.sq2(pm1.sq5.in1); END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sq5 = createVirtualProcedure("sq5", pm1, Arrays.asList( rs7p2 ), sq5n1); //$NON-NLS-1$
+ sq5.setResultSet(rs7);
+
+ ColumnSet<Procedure> rs8 = createResultSet("pm1.rs8", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ QueryNode sq6n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN EXEC pm1.sq2(\'1\'); END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sq6 = createVirtualProcedure("sq6", pm1, null, sq6n1); //$NON-NLS-1$
+ sq6.setResultSet(rs8);
+
+ ColumnSet<Procedure> rs9 = createResultSet("pm1.rs9", new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ QueryNode sq7n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM (EXEC pm1.sq1()) as x; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sq7 = createVirtualProcedure("sq7", pm1, null, sq7n1); //$NON-NLS-1$
+ sq7.setResultSet(rs9);
+
+ ColumnSet<Procedure> rs10 = createResultSet("pm1.rs10", new String[] { "e1"}, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcedureParameter rs10p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ QueryNode sq8n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM (EXEC pm1.sq1()) as x WHERE x.e1=pm1.sq8.in; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sq8 = createVirtualProcedure("sq8", pm1, Arrays.asList( rs10p2 ), sq8n1); //$NON-NLS-1$
+ sq8.setResultSet(rs10);
+
+ ColumnSet<Procedure> rs11 = createResultSet("pm1.rs11", new String[] { "e1"}, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcedureParameter rs11p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ QueryNode sq9n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM (EXEC pm1.sq2(pm1.sq9.in)) as x; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sq9 = createVirtualProcedure("sq9", pm1, Arrays.asList( rs11p2 ), sq9n1); //$NON-NLS-1$
+ sq9.setResultSet(rs11);
+
+ ColumnSet<Procedure> rs12 = createResultSet("pm1.rs12", new String[] { "e1"}, new String[] { DataTypeManager.DefaultDataTypes.STRING}); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcedureParameter rs12p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ ProcedureParameter rs12p3 = createParameter("in2", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ QueryNode sq10n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM (EXEC pm1.sq2(pm1.sq10.in)) as x where e2=pm1.sq10.in2; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sq10 = createVirtualProcedure("sq10", pm1, Arrays.asList( rs12p2, rs12p3), sq10n1); //$NON-NLS-1$
+ sq10.setResultSet(rs12);
+
+ ColumnSet<Procedure> rs13 = createResultSet("pm1.rs13", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ProcedureParameter rs13p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ Procedure sp2 = createStoredProcedure("sp2", pm1, Arrays.asList( rs13p2 )); //$NON-NLS-1$ //$NON-NLS-2$
+ sp2.setResultSet(rs13);
+
+ ColumnSet<Procedure> rs14 = createResultSet("pm1.rs14", new String[] { "e1"}, new String[] { DataTypeManager.DefaultDataTypes.STRING}); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcedureParameter rs14p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ ProcedureParameter rs14p3 = createParameter("in2", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ QueryNode sq11n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM (EXEC pm1.sp2(?)) as x where e2=pm1.sq11.in; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sq11 = createVirtualProcedure("sq11", pm1, Arrays.asList( rs14p2, rs14p3), sq11n1); //$NON-NLS-1$
+ sq11.setResultSet(rs14);
+
+ ColumnSet<Procedure> rs15 = createResultSet("pm1.rs15", new String[] { "count" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcedureParameter rs15p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ ProcedureParameter rs15p3 = createParameter("in2", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ QueryNode sq12n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN INSERT INTO pm1.g1 ( e1, e2 ) VALUES( pm1.sq12.in, pm1.sq12.in2 ); END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sq12 = createVirtualProcedure("sq12", pm1, Arrays.asList( rs15p2, rs15p3 ), sq12n1); //$NON-NLS-1$
+ sq12.setResultSet(rs15);
+
+ ColumnSet<Procedure> rs16 = createResultSet("pm1.rs16", new String[] { "count" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcedureParameter rs16p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ QueryNode sq13n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN INSERT INTO pm1.g1 ( e1, e2 ) VALUES( pm1.sq13.in, 2 ); END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sq13 = createVirtualProcedure("sq13", pm1, Arrays.asList( rs16p2 ), sq13n1); //$NON-NLS-1$
+ sq13.setResultSet(rs16);
+
+ ColumnSet<Procedure> rs17 = createResultSet("pm1.rs17", new String[] { "count" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcedureParameter rs17p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ ProcedureParameter rs17p3 = createParameter("in2", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ QueryNode sq14n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN UPDATE pm1.g1 SET e1 = pm1.sq14.in WHERE e2 = pm1.sq14.in2; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sq14 = createVirtualProcedure("sq14", pm1, Arrays.asList( rs17p2, rs17p3 ), sq14n1); //$NON-NLS-1$
+ sq14.setResultSet(rs17);
+
+ ColumnSet<Procedure> rs18 = createResultSet("pm1.rs17", new String[] { "count" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcedureParameter rs18p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ ProcedureParameter rs18p3 = createParameter("in2", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ QueryNode sq15n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DELETE FROM pm1.g1 WHERE e1 = pm1.sq15.in AND e2 = pm1.sq15.in2; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sq15 = createVirtualProcedure("sq15", pm1, Arrays.asList( rs18p2, rs18p3 ), sq15n1); //$NON-NLS-1$
+ sq15.setResultSet(rs18);
+
+ QueryNode sq16n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN INSERT INTO pm1.g1 ( e1, e2 ) VALUES( 1, 2 ); END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sq16 = createVirtualProcedure("sq16", pm1, null, sq16n1); //$NON-NLS-1$
+
+ ColumnSet<Procedure> rs19 = createResultSet("pm1.rs19", new String[] { "xml" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ QueryNode sq17n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT * FROM xmltest.doc1; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sq17 = createVirtualProcedure("sq17", pm1, null, sq17n1); //$NON-NLS-1$
+ sq17.setResultSet(rs19);
+
+ Procedure sp3 = createStoredProcedure("sp3", pm1, null); //$NON-NLS-1$ //$NON-NLS-2$
+
+ ColumnSet<Procedure> rs20 = createResultSet("pm1.rs20", new String[] { "xml" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ QueryNode sq18n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT * FROM xmltest.doc1; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sq18 = createVirtualProcedure("sq18", pm1, null, sq18n1); //$NON-NLS-1$
+ sq18.setResultSet(rs20);
+
+ ColumnSet<Procedure> rs21 = createResultSet("pm1.rs21", new String[] { "xml" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcedureParameter sq19p2 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ QueryNode sq19n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT * FROM xmltest.doc4 WHERE root.node1 = param1; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure sq19 = createVirtualProcedure("sq19", pm1, Arrays.asList( sq19p2 ), sq19n1); //$NON-NLS-1$
+ sq19.setResultSet(rs21);
+
+ ColumnSet<Procedure> rs22 = createResultSet("pm1.rs13", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ProcedureParameter rs22p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.BIG_INTEGER); //$NON-NLS-1$
+ Procedure sp4 = createStoredProcedure("sp4", pm1, Arrays.asList( rs22p2 )); //$NON-NLS-1$ //$NON-NLS-2$
+ sp4.setResultSet(rs22);
+
+ // no params or result set at all
+ Procedure sp5 = createStoredProcedure("sp5", pm1, new ArrayList<ProcedureParameter>()); //$NON-NLS-1$ //$NON-NLS-2$
+
+ //virtual stored procedures
+ ColumnSet<Procedure> vsprs1 = vsprs1(); //$NON-NLS-1$ //$NON-NLS-2$
+ QueryNode vspqn1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN x=mycursor.e2; IF(x = 15) BEGIN BREAK; END END SELECT e1 FROM pm1.g1 where pm1.g1.e2 = x; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp1 = createVirtualProcedure("vsp1", pm1, null, vspqn1); //$NON-NLS-1$\
+ vsp1.setResultSet(vsprs1);
+
+ QueryNode vspqn2 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN x=mycursor.e2; END SELECT e1 FROM pm1.g1; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp2 = createVirtualProcedure("vsp2", pm1, null, vspqn2); //$NON-NLS-1$
+ vsp2.setResultSet(vsprs1());
+
+ QueryNode vspqn3 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN x=mycursor.e2; END SELECT e1 FROM pm1.g1 WHERE x=e2; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp3 = createVirtualProcedure("vsp3", pm1, null, vspqn3); //$NON-NLS-1$
+ vsp3.setResultSet(vsprs1());
+
+ QueryNode vspqn4 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN IF(mycursor.e2 > 10) BEGIN BREAK; END x=mycursor.e2; END SELECT e1 FROM pm1.g1 WHERE x=e2; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp4 = createVirtualProcedure("vsp4", pm1, null, vspqn4); //$NON-NLS-1$
+ vsp4.setResultSet(vsprs1());
+
+ QueryNode vspqn5 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN IF(mycursor.e2 > 10) BEGIN CONTINUE; END x=mycursor.e2; END SELECT e1 FROM pm1.g1 WHERE x=e2; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp5 = createVirtualProcedure("vsp5", pm1, null, vspqn5); //$NON-NLS-1$
+ vsp5.setResultSet(vsprs1());
+
+ QueryNode vspqn6 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; x=0; WHILE (x < 15) BEGIN x=x+1; END SELECT e1 FROM pm1.g1 WHERE x=e2; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp6 = createVirtualProcedure("vsp6", pm1, null, vspqn6); //$NON-NLS-1$
+ vsp6.setResultSet(vsprs1());
+
+ ProcedureParameter vspp2 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ QueryNode vspqn7 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; x=0; WHILE (x < 12) BEGIN x=x+pm1.vsp7.param1; END SELECT e1 FROM pm1.g1 WHERE x=e2; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp7 = createVirtualProcedure("vsp7", pm1, Arrays.asList( vspp2 ), vspqn7); //$NON-NLS-1$
+ vsp7.setResultSet(vsprs1());
+
+ ProcedureParameter vspp8 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ QueryNode vspqn8 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; x=0; WHILE (x < 12) BEGIN x=x+pm1.vsp8.param1; END SELECT e1 FROM pm1.g1 WHERE e2 >= param1; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp8 = createVirtualProcedure("vsp8", pm1, Arrays.asList( vspp8 ), vspqn8); //$NON-NLS-1$
+ vsp8.setResultSet(vsprs1());
+
+ ProcedureParameter vspp9 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ QueryNode vspqn9 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; x=0; WHILE (x < param1) BEGIN x=x+pm1.vsp9.param1; END SELECT e1 FROM pm1.g1 WHERE e2 >= param1; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp9 = createVirtualProcedure("vsp9", pm1, Arrays.asList( vspp9 ), vspqn9); //$NON-NLS-1$
+ vsp9.setResultSet(vsprs1());
+
+ ProcedureParameter vspp3 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ QueryNode vspqn10 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1 WHERE e2=param1) AS mycursor BEGIN x=mycursor.e2; END END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp10 = createVirtualProcedure("vsp10", pm1, Arrays.asList( vspp3 ), vspqn10); //$NON-NLS-1$
+
+ //invalid
+ QueryNode vspqn11 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN LOOP ON (SELECT e1 FROM pm1.g1) AS mycursor BEGIN END END SELECT e1 FROM pm1.g1; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp11 = createVirtualProcedure("vsp11", pm1, null, vspqn11); //$NON-NLS-1$
+ vsp11.setResultSet(vsprs1());
+
+ //invalid
+ QueryNode vspqn12 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN END x=mycursor.e2; SELECT e1 FROM pm1.g1; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp12 = createVirtualProcedure("vsp12", pm1, null, vspqn12); //$NON-NLS-1$
+ vsp12.setResultSet(vsprs1());
+
+ ColumnSet<Procedure> vsprs2 = vspp4(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ QueryNode vspqn13 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; LOOP ON (SELECT e1 FROM pm1.g1) AS mycursor BEGIN x=mycursor.e1; END SELECT x, 5; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp13 = createVirtualProcedure("vsp13", pm1, null, vspqn13); //$NON-NLS-1$
+ vsp13.setResultSet(vsprs2);
+
+ QueryNode vspqn14 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 INTO #temptable FROM pm1.g1; SELECT e1 FROM #temptable; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp14 = createVirtualProcedure("vsp14", pm1, null, vspqn14); //$NON-NLS-1$
+ vsp14.setResultSet(vsprs1());
+
+ QueryNode vspqn15 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 INTO #temptable FROM pm1.g1; SELECT #temptable.e1 FROM #temptable, pm1.g2 WHERE #temptable.e2 = pm1.g2.e2; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp15 = createVirtualProcedure("vsp15", pm1, null, vspqn15); //$NON-NLS-1$
+ vsp15.setResultSet(vsprs1());
+
+ QueryNode vspqn16 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 INTO #temptable FROM pm1.g1; SELECT a.e1 FROM (SELECT pm1.g2.e1 FROM #temptable, pm1.g2 WHERE #temptable.e2 = pm1.g2.e2) AS a; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ //QueryNode vspqn16 = new QueryNode("vsp16", "CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 INTO #temptable FROM pm1.g1; SELECT e1 FROM #temptable where e1 in (SELECT pm1.g2.e1 FROM #temptable, pm1.g2 WHERE #temptable.e2 = pm1.g2.e2); END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp16 = createVirtualProcedure("vsp16", pm1, null, vspqn16); //$NON-NLS-1$
+ vsp16.setResultSet(vsprs1());
+
+ QueryNode vspqn17 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; SELECT e1, e2 INTO #temptable FROM pm1.g1; LOOP ON (SELECT e1, e2 FROM #temptable) AS mycursor BEGIN x=mycursor.e2; END SELECT e1 FROM pm1.g1 WHERE x=e2; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp17 = createVirtualProcedure("vsp17", pm1, null, vspqn17); //$NON-NLS-1$
+ vsp17.setResultSet(vsprs1());
+
+ //invalid
+ QueryNode vspqn18 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 INTO temptable FROM pm1.g1; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp18 = createVirtualProcedure("vsp18", pm1, null, vspqn18); //$NON-NLS-1$
+ vsp18.setResultSet(vsprs1());
+
+ QueryNode vspqn19 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 INTO #temptable FROM pm1.g1; SELECT e1 INTO #temptable FROM pm1.g1; SELECT e1 FROM #temptable; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp19 = createVirtualProcedure("vsp19", pm1, null, vspqn19); //$NON-NLS-1$
+ vsp19.setResultSet(vsprs1());
+
+ QueryNode vspqn20 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 INTO #temptable FROM pm1.g1; INSERT INTO #temptable(e1) VALUES( 'Fourth'); SELECT e1 FROM #temptable; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp20 = createVirtualProcedure("vsp20", pm1, null, vspqn20); //$NON-NLS-1$
+ vsp20.setResultSet(vsprs1());
+
+ ProcedureParameter vspp21 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ QueryNode vspqn21 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 INTO #temptable FROM pm1.g1; INSERT INTO #temptable(#temptable.e1, e2) VALUES( 'Fourth', param1); SELECT e1, e2 FROM #temptable; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp21 = createVirtualProcedure("vsp21", pm1, Arrays.asList( vspp21 ), vspqn21); //$NON-NLS-1$
+ vsp21.setResultSet(vspp4());
+
+ ProcedureParameter vspp22 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ QueryNode vspqn22 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 INTO #temptable FROM pm1.g1 where e2 > param1; SELECT e1, e2 FROM #temptable; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp22 = createVirtualProcedure("vsp22", pm1, Arrays.asList( vspp22 ), vspqn22); //$NON-NLS-1$
+ vsp22.setResultSet(vspp4());
+
+ ProcedureParameter vspp23 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ QueryNode vspqn23 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; SELECT e1, e2 INTO #temptable FROM pm1.g1 where e2 > param1; x = SELECT e1 FROM #temptable WHERE e2=15; SELECT x, 15; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp23 = createVirtualProcedure("vsp23", pm1, Arrays.asList( vspp23 ), vspqn23); //$NON-NLS-1$
+ vsp23.setResultSet(vspp4());
+
+ QueryNode vspqn24 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 INTO #temptable FROM pm1.g1; SELECT #temptable.e1 FROM #temptable WHERE #temptable.e2=15; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp24 = createVirtualProcedure("vsp24", pm1, null, vspqn24); //$NON-NLS-1$
+ vsp24.setResultSet(vspp4());
+
+ QueryNode vspqn25 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 INTO #temptable FROM pm1.g1 WHERE e1 ='no match'; SELECT e1 FROM #temptable; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp25 = createVirtualProcedure("vsp25", pm1, null, vspqn25); //$NON-NLS-1$
+ vsp25.setResultSet(vsprs1());
+
+ QueryNode vspqn27 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 from (exec pm1.vsp25())as c; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp27 = createVirtualProcedure("vsp27", pm1, null, vspqn27); //$NON-NLS-1$
+ vsp27.setResultSet(vsprs1());
+
+ QueryNode vspqn28 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT 0 AS e1 ORDER BY e1; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp28 = createVirtualProcedure("vsp28", pm1, null, vspqn28); //$NON-NLS-1$
+ vsp28.setResultSet(vsprs1());
+
+ QueryNode vspqn29 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM pm1.g1 ORDER BY e1; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp29 = createVirtualProcedure("vsp29", pm1, null, vspqn29); //$NON-NLS-1$
+ vsp29.setResultSet(vsprs1());
+
+ ColumnSet<Procedure> vsprs30 = createResultSet("pm1.vsprs30", new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ QueryNode vspqn30 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM pm1.g1; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp30 = createVirtualProcedure("vsp30", pm1, null, vspqn30); //$NON-NLS-1$
+ vsp30.setResultSet(vsprs30);
+
+ ColumnSet<Procedure> vsprs31 = createResultSet("pm1.vsprs31", new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcedureParameter vsp31p2 = createParameter("p1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ QueryNode vspqn31 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM pm1.g1 WHERE e2 = pm1.vsp31.p1; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp31 = createVirtualProcedure("vsp31", pm1, Arrays.asList(createParameter("p1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER)), vspqn31); //$NON-NLS-1$
+ vsp31.setResultSet(vsprs31);
+
+ QueryNode vspqn38 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer VARIABLES.y; VARIABLES.y=5; EXEC pm1.vsp7(VARIABLES.y); END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp38 = createVirtualProcedure("vsp38", pm1, null, vspqn38); //$NON-NLS-1$
+ vsp38.setResultSet(vsprs1());
+
+ QueryNode vspqn39 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer VARIABLES.x; VARIABLES.x=5; EXEC pm1.vsp7(VARIABLES.x); END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp39 = createVirtualProcedure("vsp39", pm1, null, vspqn39); //$NON-NLS-1$
+ vsp39.setResultSet(vsprs1());
+
+ QueryNode vspqn40 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN LOOP ON (SELECT e2 FROM pm1.g1) AS mycursor BEGIN EXEC pm1.vsp41(); END END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp40 = createVirtualProcedure("vsp40", pm1, null, vspqn40); //$NON-NLS-1$
+ vsp40.setResultSet(vsprs1());
+
+ QueryNode vspqn41 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1 FROM pm1.g1 where e2=15; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp41 = createVirtualProcedure("vsp41", pm1, null, vspqn41); //$NON-NLS-1$
+ vsp41.setResultSet(vsprs1());
+
+ vm1g1.setInsertPlan("CREATE PROCEDURE BEGIN ROWS_UPDATED = INSERT INTO pm1.g1(e1, e2, e3, e4) values(INPUT.e1, INPUT.e2, INPUT.e3, INPUT.e4); END"); //$NON-NLS-1$
+ vm1g1.setUpdatePlan("CREATE PROCEDURE BEGIN ROWS_UPDATED = UPDATE pm1.g1 SET e1 = INPUT.e1, e2 = INPUT.e2, e3 = INPUT.e3, e4=INPUT.e4 WHERE TRANSLATE CRITERIA; END"); //$NON-NLS-1$
+ vm1g1.setDeletePlan("CREATE PROCEDURE BEGIN ROWS_UPDATED = DELETE FROM pm1.g1 WHERE TRANSLATE CRITERIA; END"); //$NON-NLS-1$
+
+ vm1g37.setInsertPlan("CREATE PROCEDURE BEGIN ROWS_UPDATED = INSERT INTO pm4.g1(e1, e2, e3, e4) values(INPUT.e1, INPUT.e2, INPUT.e3, INPUT.e4); END"); //$NON-NLS-1$
+ vm1g37.setDeletePlan("CREATE PROCEDURE BEGIN ROWS_UPDATED = DELETE FROM pm4.g1 where translate criteria; END"); //$NON-NLS-1$
+ QueryNode vspqn37 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; VARIABLES.x=5; INSERT INTO vm1.g1(e2) values(VARIABLES.x); SELECT ROWCOUNT; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp37 = createVirtualProcedure("vsp37", pm1, null, vspqn37); //$NON-NLS-1$
+ vsp37.setResultSet(vsprs1());
+
+ QueryNode vspqn33 = new QueryNode(new StringBuffer("CREATE VIRTUAL PROCEDURE") //$NON-NLS-1$//$NON-NLS-2$
+ .append(" BEGIN") //$NON-NLS-1$
+ .append(" SELECT 3 AS temp1 INTO #myTempTable;") //$NON-NLS-1$
+ .append(" SELECT 2 AS temp1 INTO #myTempTable;") //$NON-NLS-1$
+ .append(" SELECT 1 AS temp1 INTO #myTempTable;") //$NON-NLS-1$
+ .append(" SELECT temp1 AS e1 FROM #myTempTable ORDER BY e1;") //$NON-NLS-1$
+ .append(" END").toString() //$NON-NLS-1$
+ );
+ Procedure vsp33 = createVirtualProcedure("vsp33", pm1, null, vspqn33); //$NON-NLS-1$
+ vsp33.setResultSet(vsprs1());
+
+ ColumnSet<Procedure> vsprs35 = createResultSet("pm1.vsprs31", new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ QueryNode vspqn35 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer VARIABLES.ID; VARIABLES.ID = pm1.vsp35.p1; SELECT e1 FROM pm1.g1 WHERE e2 = VARIABLES.ID; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp35 = createVirtualProcedure("vsp35", pm1, Arrays.asList(vsp31p2), vspqn35); //$NON-NLS-1$
+ vsp35.setResultSet(vsprs35);
+
+ QueryNode vspqn34 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, 0 AS const FROM pm1.g1 ORDER BY const; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp34 = createVirtualProcedure("vsp34", pm1, null, vspqn34); //$NON-NLS-1$
+ vsp34.setResultSet(vspp4());
+
+ QueryNode vspqn45 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 INTO #temptable FROM pm1.g1; SELECT #temptable.e1 FROM #temptable where #temptable.e1 in (SELECT pm1.g2.e1 FROM pm1.g2 ); END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp45 = createVirtualProcedure("vsp45", pm1, null, vspqn45); //$NON-NLS-1$
+ vsp45.setResultSet(vsprs1());
+
+ // Virtual group w/ procedure in transformation, optional params, named parameter syntax
+ QueryNode vspqn47 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN IF (pm1.vsp47.param1 IS NOT NULL) BEGIN SELECT 'FOO' as e1, pm1.vsp47.param1 as e2; END ELSE BEGIN SELECT pm1.vsp47.param2 as e1, 2112 as e2; END END"); //$NON-NLS-1$ //$NON-NLS-2$
+ ColumnSet<Procedure> vsprs47 = createResultSet("pm1.vsprs47", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ProcedureParameter vspp47_2 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ vspp47_2.setNullType(NullType.Nullable);
+ ProcedureParameter vspp47_3 = createParameter("param2", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ vspp47_3.setNullType(NullType.Nullable);
+ Procedure vsp47 = createVirtualProcedure("vsp47", pm1, Arrays.asList( vspp47_2, vspp47_3 ), vspqn47); //$NON-NLS-1$
+ vsp47.setResultSet(vsprs47);
+
+ QueryNode vgvpn7 = new QueryNode("SELECT P.e2 as ve3, P.e1 as ve4 FROM (EXEC pm1.vsp47(param1=vm1.vgvp7.ve1, param2=vm1.vgvp7.ve2)) as P"); //$NON-NLS-1$ //$NON-NLS-2$
+// QueryNode vgvpn7 = new QueryNode("vm1.vgvp7", "SELECT P.e2 as ve1, P.e1 as ve2 FROM (EXEC pm1.vsp47(vm1.vgvp7.ve1, vm1.vgvp7.ve2)) as P"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vgvp7 = createVirtualGroup("vgvp7", vm1, vgvpn7); //$NON-NLS-1$
+ Column vgvp7e1 = createElement("ve1", vgvp7, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ vgvp7e1.setSelectable(false);
+ Column vgvp7e2 = createElement("ve2", vgvp7, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ vgvp7e2.setSelectable(false);
+ Column vgvp7e3 = createElement("ve3", vgvp7, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ Column vgvp7e4 = createElement("ve4", vgvp7, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+
+
+ //invalid
+ QueryNode vspqn32 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; LOOP ON (SELECT e2 FROM pm1.g1) AS #mycursor BEGIN IF(#mycursor.e2 > 10) BEGIN CONTINUE; END x=#mycursor.e2; END SELECT e1 FROM pm1.g1 WHERE x=e2; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp32 = createVirtualProcedure("vsp32", pm1, null, vspqn32); //$NON-NLS-1$
+ vsp32.setResultSet(vsprs1());
+
+ //virtual group with procedure in transformation
+ QueryNode vspqn26 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e2 >= pm1.vsp26.param1 and e1 = pm1.vsp26.param2; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcedureParameter vspp26_1 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ ProcedureParameter vspp26_2 = createParameter("param2", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ ColumnSet<Procedure> vsprs3 = createResultSet("pm1.vsprs3", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Procedure vsp26 = createVirtualProcedure("vsp26", pm1, Arrays.asList( vspp26_1, vspp26_2 ), vspqn26); //$NON-NLS-1$
+ vsp26.setResultSet(vsprs3);
+
+ QueryNode vgvpn1 = new QueryNode("SELECT P.e1 as ve3 FROM (EXEC pm1.vsp26(vm1.vgvp1.ve1, vm1.vgvp1.ve2)) as P"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vgvp1 = createVirtualGroup("vgvp1", vm1, vgvpn1); //$NON-NLS-1$
+ Column vgvp1e1 = createElement("ve1", vgvp1, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ vgvp1e1.setSelectable(false);
+ Column vgvp1e2 = createElement("ve2", vgvp1, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ vgvp1e2.setSelectable(false);
+ Column vgvp1e3 = createElement("ve3", vgvp1, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+
+ QueryNode vgvpn2 = new QueryNode("SELECT P.e1 as ve3 FROM (EXEC pm1.vsp26(vm1.vgvp2.ve1, vm1.vgvp2.ve2)) as P where P.e1='a'"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vgvp2 = createVirtualGroup("vgvp2", vm1, vgvpn2); //$NON-NLS-1$
+ Column vgvp2e1 = createElement("ve1", vgvp2, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ vgvp2e1.setSelectable(false);
+ Column vgvp2e2 = createElement("ve2", vgvp2, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ vgvp2e2.setSelectable(false);
+ Column vgvp2e3 = createElement("ve3", vgvp2, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+
+ QueryNode vgvpn3 = new QueryNode("SELECT P.e1 as ve3 FROM (EXEC pm1.vsp26(vm1.vgvp3.ve1, vm1.vgvp3.ve2)) as P, pm1.g2 where P.e1=g2.e1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vgvp3 = createVirtualGroup("vgvp3", vm1, vgvpn3); //$NON-NLS-1$
+ Column vgvp3e1 = createElement("ve1", vgvp3, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ vgvp3e1.setSelectable(false);
+ Column vgvp3e2 = createElement("ve2", vgvp3, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ vgvp3e2.setSelectable(false);
+ createElement("ve3", vgvp3, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+
+ QueryNode vgvpn4 = new QueryNode("SELECT P.e1 as ve3 FROM (EXEC pm1.vsp26(vm1.vgvp4.ve1, vm1.vgvp4.ve2)) as P, vm1.g1 where P.e1=g1.e1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vgvp4 = createVirtualGroup("vgvp4", vm1, vgvpn4); //$NON-NLS-1$
+ Column vgvp4e1 = createElement("ve1", vgvp4, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ vgvp4e1.setSelectable(false);
+ Column vgvp4e2 = createElement("ve2", vgvp4, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ vgvp4e2.setSelectable(false);
+ createElement("ve3", vgvp4, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+
+ QueryNode vgvpn5 = new QueryNode("SELECT * FROM vm1.vgvp4 where vm1.vgvp4.ve1=vm1.vgvp5.ve1 and vm1.vgvp4.ve2=vm1.vgvp5.ve2"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vgvp5 = createVirtualGroup("vgvp5", vm1, vgvpn5); //$NON-NLS-1$
+ Column vgvp5e1 = createElement("ve1", vgvp5, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ vgvp5e1.setSelectable(false);
+ Column vgvp5e2 = createElement("ve2", vgvp5, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ vgvp5e2.setSelectable(false);
+ createElement("ve3", vgvp5, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+
+ QueryNode vgvpn6 = new QueryNode("SELECT P.e1 as ve3, P.e2 as ve4 FROM (EXEC pm1.vsp26(vm1.vgvp6.ve1, vm1.vgvp6.ve2)) as P"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vgvp6 = createVirtualGroup("vgvp6", vm1, vgvpn6); //$NON-NLS-1$
+ Column vgvp6e1 = createElement("ve1", vgvp6, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ vgvp6e1.setSelectable(false);
+ Column vgvp6e2 = createElement("ve2", vgvp6, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ vgvp6e2.setSelectable(false);
+ createElement("ve3", vgvp6, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ createElement("ve4", vgvp6, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+
+ //virtual group with two elements. One selectable, one not.
+ QueryNode vm1g35n1 = new QueryNode("SELECT e1, e2 FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g35 = createVirtualGroup("g35", vm1, vm1g35n1); //$NON-NLS-1$
+ Column vm1g35e1 = createElement("e1", vm1g35, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ vm1g35e1.setSelectable(false);
+ createElement("e2", vm1g35, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+
+ ColumnSet<Procedure> vsprs36 = createResultSet("pm1.vsprs36", new String[] { "x" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcedureParameter vsp36p2 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ QueryNode vspqn36 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; x = pm1.vsp36.param1 * 2; SELECT x; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp36 = createVirtualProcedure("vsp36", pm1, Arrays.asList( vsp36p2 ), vspqn36); //$NON-NLS-1$
+ vsp36.setResultSet(vsprs36);
+
+ ColumnSet<Procedure> vsprs42 = createResultSet("pm1.vsprs42", new String[] { "x" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcedureParameter vsp42p2 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ QueryNode vspqn42 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN IF (pm1.vsp42.param1 > 0) SELECT 1 AS x; ELSE SELECT 0 AS x; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp42 = createVirtualProcedure("vsp42", pm1, Arrays.asList( vsp42p2 ), vspqn42); //$NON-NLS-1$
+ vsp42.setResultSet(vsprs42);
+
+ ProcedureParameter vspp44 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ QueryNode vspqn44 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT pm1.vsp44.param1 INTO #temptable; SELECT e1 from pm1.g1; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp44 = createVirtualProcedure("vsp44", pm1, Arrays.asList( vspp44 ), vspqn44); //$NON-NLS-1$
+ vsp44.setResultSet(vsprs1());
+
+ ProcedureParameter vspp43 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ QueryNode vspqn43 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN exec pm1.vsp44(pm1.vsp43.param1); END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp43 = createVirtualProcedure("vsp43", pm1, Arrays.asList( vspp43 ), vspqn43); //$NON-NLS-1$
+ vsp43.setResultSet(vsprs1());
+
+ QueryNode vspqn46 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN create local temporary table #temptable (e1 string, e2 string); LOOP ON (SELECT e1 FROM pm1.g1) AS mycursor BEGIN select mycursor.e1, a.e1 as e2 into #temptable from (SELECT pm1.g1.e1 FROM pm1.g1 where pm1.g1.e1 = mycursor.e1) a; END SELECT e1 FROM #temptable; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp46 = createVirtualProcedure("vsp46", pm1, null, vspqn46); //$NON-NLS-1$
+ vsp46.setResultSet(vsprs1());
+
+ ColumnSet<Procedure> vsp48rs = createResultSet("pm1vsp48.rs", new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcedureParameter vsp48p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ QueryNode vspqn48 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; SELECT e1 FROM (EXEC pm1.sq2(pm1.vsp48.in)) as e; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp48 = createVirtualProcedure("vsp48", pm1, Arrays.asList( vsp48p2 ), vspqn48); //$NON-NLS-1$
+ vsp48.setResultSet(vsp48rs);
+
+ ColumnSet<Procedure> vsp49rs = createResultSet("pm1vsp49.rs", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ QueryNode vspqn49 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; x = 'b'; EXEC pm1.sq2(x); END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp49 = createVirtualProcedure("vsp49", pm1, null, vspqn49); //$NON-NLS-1$
+ vsp49.setResultSet(vsp49rs);
+
+ ColumnSet<Procedure> vsp50rs = createResultSet("pm1vsp50.rs", new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ QueryNode vspqn50 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; x = 'b'; SELECT e1 FROM (EXEC pm1.sq2(x)) as e; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp50 = createVirtualProcedure("vsp50", pm1, null, vspqn50); //$NON-NLS-1$
+ vsp50.setResultSet(vsp50rs);
+
+ ColumnSet<Procedure> vsp51rs = createResultSet("pm1vsp51.rs", new String[] { "result" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ QueryNode vspqn51 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; x = 'b'; LOOP ON (SELECT e1 FROM (EXEC pm1.sq2(x)) as e) AS c BEGIN x = x || 'b'; END SELECT x AS result; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp51 = createVirtualProcedure("vsp51", pm1, null, vspqn51); //$NON-NLS-1$
+ vsp51.setResultSet(vsp51rs);
+
+ ColumnSet<Procedure> vsp52rs = createResultSet("pm1vsp52.rs", new String[] { "result" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ QueryNode vspqn52 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; x = 'c'; x = SELECT e1 FROM (EXEC pm1.sq2(x)) as e; SELECT x AS result; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp52 = createVirtualProcedure("vsp52", pm1, null, vspqn52); //$NON-NLS-1$
+ vsp52.setResultSet(vsp52rs);
+
+ ColumnSet<Procedure> vsp53rs = createResultSet("pm1vsp53.rs", new String[] { "result" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcedureParameter vsp53p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ QueryNode vspqn53 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; x = 'b'; LOOP ON (SELECT e1 FROM (EXEC pm1.sq2(pm1.vsp53.in)) as e) AS c BEGIN x = x || 'b'; END SELECT x AS result; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp53 = createVirtualProcedure("vsp53", pm1, Arrays.asList( vsp53p2 ), vspqn53); //$NON-NLS-1$
+ vsp53.setResultSet(vsp53rs);
+
+ ColumnSet<Procedure> vsp54rs = createResultSet("pm1vsp54.rs", new String[] { "result" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ ProcedureParameter vsp54p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ QueryNode vspqn54 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN DECLARE string x; x = 'c'; x = SELECT e1 FROM (EXEC pm1.sq2(pm1.vsp54.in)) as e; SELECT x AS result; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp54 = createVirtualProcedure("vsp54", pm1, Arrays.asList( vsp54p2 ), vspqn54); //$NON-NLS-1$
+ vsp54.setResultSet(vsp54rs);
+
+ ProcedureParameter vspp55 = createParameter("param1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ QueryNode vspqn55 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN select e1, param1 as a from vm1.g1; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp55 = createVirtualProcedure("vsp55", pm1, Arrays.asList( vspp55 ), vspqn55); //$NON-NLS-1$
+ vsp55.setResultSet(vsprs1());
+
+ QueryNode vspqn56 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT * INTO #temptable FROM pm1.g1; SELECT #temptable.e1 FROM #temptable; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp56 = createVirtualProcedure("vsp56", pm1, null, vspqn56); //$NON-NLS-1$
+ vsp56.setResultSet(vsprs1());
+
+ QueryNode vspqn57 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT * INTO #temptable FROM pm1.g1; SELECT #temptable.e1 FROM #temptable order by #temptable.e1; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp57 = createVirtualProcedure("vsp57", pm1, null, vspqn57); //$NON-NLS-1$
+ vsp57.setResultSet(vsprs1());
+
+ ProcedureParameter vspp58 = createParameter("inp", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ QueryNode vspqn58 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT vsp58.inp; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp58 = createVirtualProcedure("vsp58", pm1, Arrays.asList( vspp58 ), vspqn58); //$NON-NLS-1$
+ vsp58.setResultSet(vsprs1());
+
+ QueryNode vspqn59 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT * INTO #temp FROM pm5.g3;INSERT INTO #temp (e1, e2) VALUES('integer',1); END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp59 = createVirtualProcedure("vsp59", pm6, null, vspqn59); //$NON-NLS-1$
+ vsp59.setResultSet(vsprs1());
+
+ QueryNode vspqn60 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN create local temporary table temp_table (column1 string);insert into temp_table (column1) values ('First');insert into temp_table (column1) values ('Second');insert into temp_table (column1) values ('Third');select * from temp_table; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp60 = createVirtualProcedure("vsp60", pm1, null, vspqn60); //$NON-NLS-1$
+ vsp60.setResultSet(vsprs1());
+
+ QueryNode vspqn61 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN create local temporary table temp_table (column1 string);insert into temp_table (column1) values ('First');drop table temp_table;create local temporary table temp_table (column1 string);insert into temp_table (column1) values ('First');insert into temp_table (column1) values ('Second');insert into temp_table (column1) values ('Third');select * from temp_table; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp61 = createVirtualProcedure("vsp61", pm1, null, vspqn61); //$NON-NLS-1$
+ vsp61.setResultSet(vsprs1());
+
+ QueryNode vspqn62 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN create local temporary table temp_table (column1 string); select e1 as column1 into temp_table from pm1.g1;select * from temp_table; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp62 = createVirtualProcedure("vsp62", pm1, null, vspqn62); //$NON-NLS-1$
+ vsp62.setResultSet(vsprs1());
+
+ QueryNode vspqn63 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN declare string o; if(1>0) begin declare string a; a='b'; o=a; end if(1>0) begin declare string a; a='c'; o=a; end select o; END"); //$NON-NLS-1$ //$NON-NLS-2$
+ Procedure vsp63 = createVirtualProcedure("vsp63", pm1, null, vspqn63); //$NON-NLS-1$
+ vsp63.setResultSet(vsprs1());
+
+ return metadataStore;
+ }
+
+ public static TransformationMetadata example1() {
+ return createTransformationMetadata(example1Store(), "example1");
+ }
+
+ private static ColumnSet<Procedure> vspp4() {
+ return createResultSet("pm1.vsprs2", new String[] { "e1", "const" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
+ }
+
+ private static ColumnSet<Procedure> vsprs1() {
+ return createResultSet("pm1.vsprs1", new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING });
+ }
/**
* Create primary key. The name will be used as the Object metadataID.
@@ -467,6 +1549,9 @@
case Unique:
group.getUniqueKeys().add(key);
break;
+ case AccessPattern:
+ group.getAccessPatterns().add(key);
+ break;
default:
throw new AssertionError("TODO");
}
@@ -517,6 +1602,7 @@
model.addTable(table);
table.setSupportsUpdate(true);
table.setNameInSource((fullyQualify || name.lastIndexOf(".") == -1)? name : name.substring(name.lastIndexOf(".") + 1)); //$NON-NLS-1$ //$NON-NLS-2$
+ table.setTableType(org.teiid.metadata.Table.Type.Table);
return table;
}
@@ -532,10 +1618,38 @@
table.setName(name);
model.addTable(table);
table.setVirtual(true);
+ table.setTableType(org.teiid.metadata.Table.Type.View);
table.setSelectTransformation(plan.getQuery());
+ table.setBindings(plan.getBindings());
return table;
}
+
+ public static Table createXmlStagingTable(String name, Schema model, QueryNode plan) {
+ Table table = createVirtualGroup(name, model, plan);
+ table.setTableType(org.teiid.metadata.Table.Type.XmlStagingTable);
+ return table;
+ }
+
+ public static Table createXmlDocument(String name, Schema model, MappingDocument plan) {
+ String doc = docToString(plan);
+ Table table = createVirtualGroup(name, model, new QueryNode(doc));
+ table.setTableType(org.teiid.metadata.Table.Type.Document);
+ table.setColumns(new ArrayList<Column>(2));
+ return table;
+ }
+ public static String docToString(MappingDocument plan) {
+ MappingOutputter out = new MappingOutputter();
+ StringWriter stream = new StringWriter();
+ try {
+ out.write(plan, new PrintWriter(stream));
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ String doc = stream.toString();
+ return doc;
+ }
+
/**
* Create a virtual group that allows updates with default settings.
*/
@@ -623,10 +1737,9 @@
* @param name Name of procedure, must match model name
* @param model Metadata object for the model
* @param params List of FakeMetadataObject that are the parameters for the procedure
- * @param callableName Callable name of procedure, usually same as procedure name
* @return Metadata object for stored procedure
*/
- public static Procedure createStoredProcedure(String name, Schema model, List<ProcedureParameter> params, String callableName) {
+ public static Procedure createStoredProcedure(String name, Schema model, List<ProcedureParameter> params) {
Procedure proc = new Procedure();
proc.setName(name);
if (params != null) {
@@ -650,7 +1763,7 @@
* @return Metadata object for stored procedure
*/
public static Procedure createVirtualProcedure(String name, Schema model, List<ProcedureParameter> params, QueryNode queryPlan) {
- Procedure proc = createStoredProcedure(name, model, params, null);
+ Procedure proc = createStoredProcedure(name, model, params);
proc.setVirtual(true);
proc.setQueryPlan(queryPlan.getQuery());
return proc;
@@ -667,5 +1780,950 @@
}
return rs;
}
+
+ public static KeyRecord createAccessPattern(String name, Table group, List<Column> elements) {
+ return createKey(org.teiid.metadata.KeyRecord.Type.AccessPattern, name, group, elements);
+ }
+
+ private static MappingDocument exampleDoc1() {
+ MappingDocument doc = new MappingDocument(false);
+ MappingElement root = doc.addChildElement(new MappingElement("root")); //$NON-NLS-1$
+ MappingElement node1 = root.addChildElement(new MappingElement("node1")); //$NON-NLS-1$
+ MappingElement node2 = node1.addChildElement(new MappingElement("node2")); //$NON-NLS-1$
+ node2.addChildElement(new MappingElement("node3")); //$NON-NLS-1$
+ return doc;
+ }
+ private static MappingDocument exampleDoc2() {
+
+ MappingDocument doc = new MappingDocument(false);
+ MappingElement root = doc.addChildElement(new MappingElement("root")); //$NON-NLS-1$
+ MappingElement node1 = root.addChildElement(new MappingElement("node1")); //$NON-NLS-1$
+
+ MappingSequenceNode node2 = node1.addSequenceNode(new MappingSequenceNode());
+ node2.addChildElement(new MappingElement("node3")); //$NON-NLS-1$
+ root.addChildElement(new MappingElement("node2")); //$NON-NLS-1$
+ return doc;
+ }
+
+ // has ambiguous short and long names
+ private static MappingDocument exampleDoc3() {
+ MappingDocument doc = new MappingDocument(false);
+ MappingElement root = doc.addChildElement(new MappingElement("root")); //$NON-NLS-1$
+
+ MappingSequenceNode node1 = root.addSequenceNode(new MappingSequenceNode());
+ node1.addChildElement(new MappingElement("node2")); //$NON-NLS-1$
+ root.addChildElement(new MappingElement("node2")); //$NON-NLS-1$
+ return doc;
+ }
+
+
+ // has attributes and elements
+ private static MappingDocument exampleDoc4() {
+
+ MappingDocument doc = new MappingDocument(false);
+
+ MappingElement root = doc.addChildElement(new MappingElement("root")); //$NON-NLS-1$
+
+ root.addAttribute(new MappingAttribute("node6")); //$NON-NLS-1$
+ root.addStagingTable("xmltest.doc4.tm1.g1"); //$NON-NLS-1$
+
+ MappingElement node1 =root.addChildElement(new MappingElement("node1")); //$NON-NLS-1$
+ node1.addAttribute(new MappingAttribute("node2")); //$NON-NLS-1$
+
+ MappingElement node3 =root.addChildElement(new MappingElement("node3")); //$NON-NLS-1$
+ node3.addAttribute(new MappingAttribute("node4")); //$NON-NLS-1$
+
+ MappingElement node5 = node3.addChildElement(new MappingElement("node4")); //$NON-NLS-1$
+ MappingElement duplicateRoot = node5.addChildElement(new MappingElement("root")); //$NON-NLS-1$
+
+ duplicateRoot.addChildElement(new MappingElement("node6")); //$NON-NLS-1$
+ return doc;
+ }
+
+ // has a union in the mapping class
+ private static MappingDocument exampleDoc5() {
+ MappingDocument doc = new MappingDocument(false);
+ MappingElement root = doc.addChildElement(new MappingElement("root")); //$NON-NLS-1$
+
+ MappingElement node1 = root.addChildElement(new MappingElement("node1")); //$NON-NLS-1$
+ node1.addChildElement(new MappingElement("node2","xmltest.mc1.e1")); //$NON-NLS-1$ //$NON-NLS-2$
+ node1.setSource("xmltest.mc1"); //$NON-NLS-1$
+ node1.setMaxOccurrs(-1);
+ return doc;
+ }
+
+ // has two elements with common suffix, but not ambiguous
+ private static MappingDocument exampleDoc6() {
+ MappingDocument doc = new MappingDocument(false);
+ MappingElement root = doc.addChildElement(new MappingElement("root")); //$NON-NLS-1$
+
+ root.addChildElement(new MappingElement("node")); //$NON-NLS-1$
+ root.addChildElement(new MappingElement("thenode")); //$NON-NLS-1$
+ return doc;
+ }
+
+ public static VDBMetaData example1VDB() {
+ VDBMetaData vdb = new VDBMetaData();
+ vdb.setName("example1");
+ vdb.setVersion(1);
+ vdb.addModel(RealMetadataFactory.createModel("pm1", true));
+ vdb.addModel(RealMetadataFactory.createModel("pm2", true));
+ vdb.addModel(RealMetadataFactory.createModel("pm3", true));
+ vdb.addModel(RealMetadataFactory.createModel("pm4", true));
+ vdb.addModel(RealMetadataFactory.createModel("pm5", true));
+ vdb.addModel(RealMetadataFactory.createModel("pm6", true));
+ vdb.addModel(RealMetadataFactory.createModel("vm1", false));
+ vdb.addModel(RealMetadataFactory.createModel("vm2", false));
+ vdb.addModel(RealMetadataFactory.createModel("tm1", false));
+
+ return vdb;
+ }
+
+ public static VDBMetaData exampleBQTVDB() {
+ VDBMetaData vdb = new VDBMetaData();
+ vdb.setName("example1");
+ vdb.setVersion(1);
+ vdb.addModel(RealMetadataFactory.createModel("BQT1", true));
+ vdb.addModel(RealMetadataFactory.createModel("BQT2", true));
+ vdb.addModel(RealMetadataFactory.createModel("BQT3", true));
+ vdb.addModel(RealMetadataFactory.createModel("LOB", true));
+ vdb.addModel(RealMetadataFactory.createModel("VQT", false));
+ vdb.addModel(RealMetadataFactory.createModel("pm1", true));
+ vdb.addModel(RealMetadataFactory.createModel("pm2", true));
+ vdb.addModel(RealMetadataFactory.createModel("pm3", true));
+ vdb.addModel(RealMetadataFactory.createModel("pm4", true));
+
+ return vdb;
+ }
+
+ public static VDBMetaData exampleMultiBindingVDB() {
+ VDBMetaData vdb = new VDBMetaData();
+ vdb.setName("exampleMultiBinding");
+ vdb.setVersion(1);
+
+ ModelMetaData model = new ModelMetaData();
+ model.setName("MultiModel");
+ model.setModelType(Model.Type.PHYSICAL);
+ model.setVisible(true);
+
+ model.setSupportsMultiSourceBindings(true);
+ vdb.addModel(model);
+ vdb.addModel(RealMetadataFactory.createModel("Virt", false));
+
+ return vdb;
+ }
+
+ public static DQPWorkContext buildWorkContext(TransformationMetadata metadata) {
+ return buildWorkContext(metadata, metadata.getVdbMetaData());
+ }
+
+ public static DQPWorkContext buildWorkContext(QueryMetadataInterface metadata, VDBMetaData vdb) {
+ DQPWorkContext workContext = new DQPWorkContext();
+ SessionMetadata session = new SessionMetadata();
+ workContext.setSession(session);
+ session.setVDBName(vdb.getName());
+ session.setVDBVersion(vdb.getVersion());
+ session.setSessionId(String.valueOf(1));
+ session.setUserName("foo"); //$NON-NLS-1$
+ session.setVdb(vdb);
+ workContext.getVDB().addAttchment(QueryMetadataInterface.class, metadata);
+ if (metadata instanceof TransformationMetadata) {
+ workContext.getVDB().addAttchment(TransformationMetadata.class, (TransformationMetadata)metadata);
+ }
+ DQPWorkContext.setWorkContext(workContext);
+ return workContext;
+ }
+
+ public static ModelMetaData createModel(String name, boolean source) {
+ ModelMetaData model = new ModelMetaData();
+ model.setName(name);
+ if (source) {
+ model.setModelType(Model.Type.PHYSICAL);
+ }
+ else {
+ model.setModelType(Model.Type.VIRTUAL);
+ }
+ model.setVisible(true);
+ model.setSupportsMultiSourceBindings(false);
+ model.addSourceMapping(name, name, null);
+
+ return model;
+ }
+
+ public static TransformationMetadata exampleBitwise() {
+ MetadataStore store = new MetadataStore();
+ Schema phys = createPhysicalModel("phys", store); //$NON-NLS-1$
+ Table t = createPhysicalGroup("t", phys); //$NON-NLS-1$
+ createElements(t,
+ new String[] { "ID", "Name", "source_bits" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
+
+ Schema virt = createVirtualModel("virt", store); //$NON-NLS-1$
+ ColumnSet<Procedure> rs = createResultSet("rs", new String[] { "ID", "Name", "source_bits" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ QueryNode qn = new QueryNode("CREATE VIRTUAL PROCEDURE " //$NON-NLS-1$
+ + "BEGIN " //$NON-NLS-1$
+ + " DECLARE integer VARIABLES.BITS;" //$NON-NLS-1$
+ + " create local temporary table #temp (id integer, name string, bits integer);" //$NON-NLS-1$
+ + " LOOP ON (SELECT DISTINCT phys.t.ID, phys.t.Name FROM phys.t) AS idCursor" //$NON-NLS-1$
+ + " BEGIN" //$NON-NLS-1$
+ + " VARIABLES.BITS = 0;" //$NON-NLS-1$
+ + " LOOP ON (SELECT phys.t.source_bits FROM phys.t WHERE phys.t.ID = idCursor.id) AS bitsCursor" //$NON-NLS-1$
+ + " BEGIN" //$NON-NLS-1$
+ + " VARIABLES.BITS = bitor(VARIABLES.BITS, bitsCursor.source_bits);" //$NON-NLS-1$
+ + " END" //$NON-NLS-1$
+ + " SELECT idCursor.id, idCursor.name, VARIABLES.BITS INTO #temp;" //$NON-NLS-1$
+ + " END" //$NON-NLS-1$
+ + " SELECT ID, Name, #temp.BITS AS source_bits FROM #temp;" //$NON-NLS-1$
+ + "END"); //$NON-NLS-1$
+ Procedure proc = createVirtualProcedure("agg", virt, null, qn); //$NON-NLS-1$
+ proc.setResultSet(rs);
+
+ return createTransformationMetadata(store, "bitwise");
+ }
+
+ public static void setCardinality(String group, int cardinality, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException {
+ if (metadata instanceof TransformationMetadata) {
+ Table t = (Table)metadata.getGroupID(group);
+ t.setCardinality(cardinality);
+ } else {
+ throw new RuntimeException("unknown metadata"); //$NON-NLS-1$
+ }
+ }
+
+ public static TransformationMetadata exampleAggregatesCached() {
+ return CACHED_AGGREGATES;
+ }
+
+ public static TransformationMetadata example3() {
+ MetadataStore metadataStore = new MetadataStore();
+ // Create models
+ Schema pm1 = createPhysicalModel("pm1", metadataStore); //$NON-NLS-1$
+ Schema pm2 = createPhysicalModel("pm2", metadataStore); //$NON-NLS-1$
+ Schema pm3 = createPhysicalModel("pm3", metadataStore); //$NON-NLS-1$
+
+ // Create physical groups
+ Table pm1g1 = createPhysicalGroup("cat1.cat2.cat3.g1", pm1); //$NON-NLS-1$
+ Table pm1g2 = createPhysicalGroup("cat1.g2", pm1); //$NON-NLS-1$
+ Table pm1g3 = createPhysicalGroup("cat2.g3", pm1); //$NON-NLS-1$
+ Table pm2g1 = createPhysicalGroup("cat1.g1", pm2); //$NON-NLS-1$
+ Table pm2g2 = createPhysicalGroup("cat2.g2", pm2); //$NON-NLS-1$
+ Table pm2g3 = createPhysicalGroup("g3", pm2); //$NON-NLS-1$
+ Table pm2g4 = createPhysicalGroup("g4", pm3); //$NON-NLS-1$
+ Table pm2g5 = createPhysicalGroup("cat3.g1", pm2); //$NON-NLS-1$
+
+ // Create physical elements
+ createElements(pm1g1,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(pm1g2,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(pm1g3,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(pm2g1,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(pm2g2,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(pm2g3,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(pm2g4,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(pm2g5,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+
+ // Create the facade from the store
+ return createTransformationMetadata(metadataStore, "example3");
+ }
+
+ public static TransformationMetadata exampleUpdateProc(Table.TriggerEvent event, String procedure) {
+ MetadataStore metadataStore = new MetadataStore();
+ // Create models
+ Schema pm1 = createPhysicalModel("pm1", metadataStore); //$NON-NLS-1$
+ Schema pm2 = createPhysicalModel("pm2", metadataStore); //$NON-NLS-1$
+ Schema vm1 = createVirtualModel("vm1", metadataStore); //$NON-NLS-1$
+
+ // Create physical groups
+ Table pm1g1 = createPhysicalGroup("g1", pm1); //$NON-NLS-1$
+ Table pm1g2 = createPhysicalGroup("g2", pm1); //$NON-NLS-1$
+ Table pm2g1 = createPhysicalGroup("g1", pm2); //$NON-NLS-1$
+ Table pm2g2 = createPhysicalGroup("g2", pm2); //$NON-NLS-1$
+
+ // Create physical group elements
+ createElements(pm1g1,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(pm1g2,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(pm2g1,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(pm2g2,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+
+ // Create virtual groups
+ QueryNode vm1g1n1 = new QueryNode("SELECT * FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g1 = createUpdatableVirtualGroup("g1", vm1, vm1g1n1); //$NON-NLS-1$
+
+ QueryNode vm1g2n1 = new QueryNode("SELECT pm1.g2.e1, pm1.g2.e2, pm1.g2.e3 FROM pm1.g2"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g2 = createUpdatableVirtualGroup("g2", vm1, vm1g2n1); //$NON-NLS-1$
+
+ QueryNode vm1g3n1 = new QueryNode("SELECT CONCAT(e1, 'm') as x, (e2 +1) as y, 1 as e3, e4*50 as e4 FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g3 = createUpdatableVirtualGroup("g3", vm1, vm1g3n1); //$NON-NLS-1$
+
+ QueryNode vm1g4n1 = new QueryNode("SELECT * FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g4 = createUpdatableVirtualGroup("g4", vm1, vm1g4n1); //$NON-NLS-1$
+
+ // Create virtual elements
+ createElementsWithDefaults(vm1g1,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE },
+ new String[] { "xyz", "123", "true", "123.456"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ createElementsWithDefaults(vm1g2,
+ new String[] { "e1", "e2", "e3" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN },
+ new String[] { "abc", "456", "false"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ createElementsWithDefaults(vm1g3,
+ new String[] { "x", "y", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER , DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.DOUBLE },
+ new String[] { "mno", "789", "true", "789.012"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ createElementsWithDefaults(vm1g4,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE },
+ new String[] { "xyz", "123", "true", "123.456"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+
+ setInsteadOfTriggerDefinition(vm1g1, event, procedure);
+ setInsteadOfTriggerDefinition(vm1g2, event, procedure);
+ setInsteadOfTriggerDefinition(vm1g3, event, procedure);
+ setInsteadOfTriggerDefinition(vm1g4, event, procedure);
+
+ // Create the facade from the store
+ return createTransformationMetadata(metadataStore, "proc");
+ }
+
+ public static void setInsteadOfTriggerDefinition(Table view, TriggerEvent event, String proc) {
+ switch (event) {
+ case DELETE:
+ view.setDeletePlan(proc);
+ break;
+ case INSERT:
+ view.setInsertPlan(proc);
+ break;
+ case UPDATE:
+ view.setUpdatePlan(proc);
+ break;
+ }
+ }
+
+ public static TransformationMetadata exampleUpdateProc(TriggerEvent procedureType, String procedure1, String procedure2) {
+ MetadataStore metadataStore = new MetadataStore();
+ // Create models
+ Schema pm1 = createPhysicalModel("pm1", metadataStore); //$NON-NLS-1$
+ Schema pm2 = createPhysicalModel("pm2", metadataStore); //$NON-NLS-1$
+ Schema vm1 = createVirtualModel("vm1", metadataStore); //$NON-NLS-1$
+
+ // Create physical groups
+ Table pm1g1 = createPhysicalGroup("g1", pm1); //$NON-NLS-1$
+ Table pm1g2 = createPhysicalGroup("g2", pm1); //$NON-NLS-1$
+ Table pm2g1 = createPhysicalGroup("g1", pm2); //$NON-NLS-1$
+ Table pm2g2 = createPhysicalGroup("g2", pm2); //$NON-NLS-1$
+
+ // Create physical group elements
+ createElements(pm1g1,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(pm1g2,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(pm2g1,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(pm2g2,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+
+ // Create virtual groups
+ QueryNode vm1g1n1 = new QueryNode("SELECT * FROM vm1.g2"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g1 = createUpdatableVirtualGroup("g1", vm1, vm1g1n1); //$NON-NLS-1$
+
+ QueryNode vm1g2n1 = new QueryNode("SELECT pm1.g2.e1, pm1.g2.e2, pm1.g2.e3, pm1.g2.e4 FROM pm1.g2"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g2 = createUpdatableVirtualGroup("g2", vm1, vm1g2n1); //$NON-NLS-1$
+
+ // Create virtual elements
+ createElementsWithDefaults(vm1g1,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE },
+ new String[] { "xyz", "123", "true", "123.456"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ createElementsWithDefaults(vm1g2,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE },
+ new String[] { "abc", "456", "false", null}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ setInsteadOfTriggerDefinition(vm1g1, procedureType, procedure1);
+ setInsteadOfTriggerDefinition(vm1g2, procedureType, procedure2);
+
+ // Create the facade from the store
+ return createTransformationMetadata(metadataStore, "proc");
+ }
+
+ public static TransformationMetadata exampleBusObj() {
+ MetadataStore metadataStore = new MetadataStore();
+ // Create db2 tables
+ Schema db2Model = createPhysicalModel("db2model", metadataStore); //$NON-NLS-1$
+
+ Table db2Table = createPhysicalGroup("DB2_TABLE", db2Model); //$NON-NLS-1$
+ createElements(db2Table,
+ new String[] { "PRODUCT", "REGION", "SALES"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DOUBLE});
+
+ Table salesTable = createPhysicalGroup("SALES", db2Model); //$NON-NLS-1$
+ salesTable.setCardinality(1000000);
+ createElements(salesTable,
+ new String[] { "CITY", "MONTH", "SALES"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DOUBLE});
+
+ Table geographyTable2 = createPhysicalGroup("GEOGRAPHY2", db2Model); //$NON-NLS-1$
+ geographyTable2.setCardinality(1000);
+ List<Column> geographyElem2 = createElements(geographyTable2,
+ new String[] { "CITY", "REGION"}, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
+ List<Column> geoPkElem2 = new ArrayList<Column>();
+ geoPkElem2.add(geographyElem2.get(0));
+ createKey(KeyRecord.Type.Primary, "db2model.GEOGRAPHY2.GEOGRAPHY_PK", geographyTable2, geoPkElem2); //$NON-NLS-1$
+
+ Table db2Table2 = createPhysicalGroup("DB2TABLE", db2Model); //$NON-NLS-1$
+ createElements(db2Table2,
+ new String[] { "c0", "c1", "c2"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER});
+
+ // Create oracle tables
+ Schema oraModel = createPhysicalModel("oraclemodel", metadataStore); //$NON-NLS-1$
+
+ Table oraTable = createPhysicalGroup("Oracle_table", oraModel); //$NON-NLS-1$
+ createElements(oraTable,
+ new String[] { "COSTS", "REGION", "YEAR"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new String[] { DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
+
+ Table geographyTable = createPhysicalGroup("GEOGRAPHY", oraModel); //$NON-NLS-1$
+ geographyTable.setCardinality(1000);
+ List<Column> geographyElem = createElements(geographyTable,
+ new String[] { "CITY", "REGION"}, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
+ List<Column> geoPkElem = new ArrayList<Column>();
+ geoPkElem.add(geographyElem.get(0));
+ createKey(KeyRecord.Type.Primary, "oraclemodel.GEOGRAPHY.GEOGRAPHY_PK", geographyTable, geoPkElem); //$NON-NLS-1$
+
+ Table oraTable2 = createPhysicalGroup("OraTable", oraModel); //$NON-NLS-1$
+ createElements(oraTable2,
+ new String[] { "b0", "b1", "b2"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new String[] { DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
+
+ // Create sql server tables
+ Schema msModel = createPhysicalModel("msmodel", metadataStore); //$NON-NLS-1$
+
+ Table timeTable = createPhysicalGroup("TIME", msModel); //$NON-NLS-1$
+ timeTable.setCardinality(120);
+ List<Column> timeElem = createElements(timeTable,
+ new String[] { "MONTH", "YEAR"}, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
+ List<Column> timePkElem = new ArrayList<Column>();
+ timePkElem.add(timeElem.get(0));
+ createKey(KeyRecord.Type.Primary, "msmodel.TIME.TIME_PK", timeTable, timePkElem); //$NON-NLS-1$
+
+ Schema virtModel = createVirtualModel("logical", metadataStore); //$NON-NLS-1$
+ QueryNode n1 = new QueryNode("select sum(c0) as c0, c1, c2 from db2Table group by c1, c2"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table logicalTable1 = createVirtualGroup("logicalTable1", virtModel, n1); //$NON-NLS-1$
+ createElements(logicalTable1,
+ new String[] { "c0", "c1", "c2"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new String[] { DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER});
+
+ QueryNode n2 = new QueryNode("select sum(c0) as c0, c1, c2 from db2Table group by c1, c2"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table logicalTable2 = createVirtualGroup("logicalTable2", virtModel, n2); //$NON-NLS-1$
+ createElements(logicalTable2,
+ new String[] { "b0", "b1", "b2"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new String[] { DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER});
+
+ // Create the facade from the store
+ return createTransformationMetadata(metadataStore, "busObj");
+ }
+
+ public static TransformationMetadata exampleAggregates() {
+ MetadataStore store = new MetadataStore();
+ addAggregateTablesToModel("m1", store); //$NON-NLS-1$
+ addAggregateTablesToModel("m2", store); //$NON-NLS-1$
+
+ // Create the facade from the store
+ return createTransformationMetadata(store, "exampleAggregates");
+ }
+
+ public static void addAggregateTablesToModel(String modelName, MetadataStore metadataStore) {
+ // Create db2 tables
+ Schema model = createPhysicalModel(modelName, metadataStore);
+
+ Table orders = createPhysicalGroup("order", model); //$NON-NLS-1$
+ orders.setCardinality(1000000);
+ createElements(orders,
+ new String[] { "O_OrderID", "O_ProductID", "O_DealerID", "O_Amount", "O_Date"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BIG_DECIMAL, DataTypeManager.DefaultDataTypes.DATE });
+
+ Table products = createPhysicalGroup("product", model); //$NON-NLS-1$
+ products.setCardinality(1000);
+ createElements(products,
+ new String[] { "P_ProductID", "P_Overhead", "P_DivID"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BIG_DECIMAL, DataTypeManager.DefaultDataTypes.INTEGER});
+
+ Table divisions = createPhysicalGroup("division", model); //$NON-NLS-1$
+ divisions.setCardinality(100);
+ createElements(divisions,
+ new String[] { "V_DIVID", "V_SectorID"}, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER});
+
+ Table dealers = createPhysicalGroup("dealer", model); //$NON-NLS-1$
+ dealers.setCardinality(1000);
+ createElements(dealers,
+ new String[] { "D_DealerID", "D_State", "D_Address"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
+ }
+
+ /**
+ * Metadata for Multi-Binding models
+ * @return example
+ * @since 4.2
+ */
+ public static TransformationMetadata exampleMultiBinding() {
+ MetadataStore metadataStore = new MetadataStore();
+ Schema virtModel = createVirtualModel("Virt", metadataStore); //$NON-NLS-1$
+ Schema physModel = createPhysicalModel("MultiModel", metadataStore); //$NON-NLS-1$
+
+ Table physGroup = createPhysicalGroup("Phys", physModel); //$NON-NLS-1$
+ createElements(physGroup,
+ new String[] { "a", "b" }, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
+
+ QueryNode virtTrans = new QueryNode("SELECT * FROM MultiModel.Phys"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table virtGroup = createVirtualGroup("view", virtModel, virtTrans); //$NON-NLS-1$
+ createElements(virtGroup,
+ new String[] { "a", "b" }, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
+
+ ColumnSet<Procedure> rs2 = createResultSet("Virt.rs1", new String[] { "a", "b" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ProcedureParameter rs2p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ rs2p2.setNullType(org.teiid.metadata.BaseColumn.NullType.Nullable);
+ QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN\n" //$NON-NLS-1$ //$NON-NLS-2$
+ + "execute string 'SELECT a, b FROM MultiModel.Phys where SOURCE_NAME = Virt.sq1.in'; END"); //$NON-NLS-1$
+ Procedure sq1 = createVirtualProcedure("sq1", virtModel, Arrays.asList(rs2p2), sq2n1); //$NON-NLS-1$
+ sq1.setResultSet(rs2);
+
+ ColumnSet<Procedure> rs3 = createResultSet("MultiModel.rs1", new String[] { "a", "b" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ProcedureParameter rs3p2 = createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ ProcedureParameter rs3p3 = createParameter("source_name", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ rs3p3.setNullType(org.teiid.metadata.BaseColumn.NullType.Nullable);
+ Procedure sq2 = createStoredProcedure("proc", physModel, Arrays.asList(rs3p2, rs3p3));
+ sq2.setResultSet(rs3);
+ return createTransformationMetadata(metadataStore, "multiBinding");
+ }
+
+ /**
+ * set up metadata for virtual doc model of this basic structure:
+ * <pre>
+ *
+ * items
+ * --suppliers (many-to-many relationship between items and suppliers)
+ * --orders
+ * --employees (an employees works for a supplier and "specializes" in an item)
+ *
+ * </pre>
+ * @return
+ */
+ public static TransformationMetadata exampleCase3225() {
+ MetadataStore metadataStore = new MetadataStore();
+
+ // Create models
+ Schema stock = createPhysicalModel("stock", metadataStore); //$NON-NLS-1$
+ Schema xmltest = createVirtualModel("xmltest", metadataStore); //$NON-NLS-1$
+
+ // Create physical groups
+ Table items = createPhysicalGroup("items", stock); //$NON-NLS-1$
+ Table item_supplier = createPhysicalGroup("item_supplier", stock); //$NON-NLS-1$
+ Table suppliers = createPhysicalGroup("suppliers", stock); //$NON-NLS-1$
+ Table orders = createPhysicalGroup("orders", stock); //$NON-NLS-1$
+ Table employees = createPhysicalGroup("employees", stock); //$NON-NLS-1$
+
+ // Create physical elements
+ createElements(items,
+ new String[] { "itemNum", "itemName", "itemQuantity", "itemStatus" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
+
+ //many-to-many join table
+ createElements(item_supplier,
+ new String[] { "itemNum", "supplierNum" }, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
+
+ createElements(suppliers,
+ new String[] { "supplierNum", "supplierName", "supplierZipCode" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
+
+ createElements(orders,
+ new String[] { "orderNum", "itemFK", "supplierFK", "orderDate", "orderQty", "orderStatus" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING});
+
+ createElements(employees,
+ new String[] { "employeeNum", "supplierNumFK", "specializesInItemNum", "supervisorNum", "firstName", "lastName" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
+
+ // Create mapping classes - items doc
+ QueryNode rsQuery = new QueryNode("SELECT itemNum, itemName, itemQuantity, itemStatus FROM stock.items"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table rsItems = createVirtualGroup("items", xmltest, rsQuery); //$NON-NLS-1$
+
+ QueryNode rsQuery2 = new QueryNode("SELECT stock.suppliers.supplierNum, supplierName, supplierZipCode, stock.item_supplier.itemNum FROM stock.suppliers, stock.item_supplier WHERE stock.suppliers.supplierNum = stock.item_supplier.supplierNum AND stock.item_supplier.itemNum = ?"); //$NON-NLS-1$ //$NON-NLS-2$
+ rsQuery2.addBinding("xmltest.items.itemNum"); //$NON-NLS-1$
+ Table rsSuppliers = createVirtualGroup("suppliers", xmltest, rsQuery2); //$NON-NLS-1$
+
+ QueryNode rsQuery3 = new QueryNode("SELECT orderNum, orderDate, orderQty, orderStatus, itemFK, supplierFK FROM stock.orders WHERE itemFK = ? AND supplierFK = ?"); //$NON-NLS-1$ //$NON-NLS-2$
+ rsQuery3.addBinding("xmltest.suppliers.itemNum"); //$NON-NLS-1$
+ rsQuery3.addBinding("xmltest.suppliers.supplierNum"); //$NON-NLS-1$
+ Table rsOrders = createVirtualGroup("orders", xmltest, rsQuery3); //$NON-NLS-1$
+
+ QueryNode rsQuery4 = new QueryNode("SELECT employeeNum, firstName, lastName, supervisorNum, specializesInItemNum, supplierNumFK FROM stock.employees WHERE specializesInItemNum = ? AND supplierNumFK = ?"); //$NON-NLS-1$ //$NON-NLS-2$
+ rsQuery4.addBinding("xmltest.suppliers.itemNum"); //$NON-NLS-1$
+ rsQuery4.addBinding("xmltest.suppliers.supplierNum"); //$NON-NLS-1$
+ Table rsEmployees = createVirtualGroup("employees", xmltest, rsQuery4); //$NON-NLS-1$
+
+ // Create mapping classes elements - items doc
+ createElements(rsItems,
+ new String[] { "itemNum", "itemName", "itemQuantity", "itemStatus" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
+
+ createElements(rsSuppliers,
+ new String[] { "supplierNum", "supplierName", "supplierZipCode", "itemNum" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
+
+ createElements(rsOrders,
+ new String[] { "orderNum", "orderDate", "orderQty", "orderStatus", "itemFK", "supplierFK" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
+
+ createElements(rsEmployees,
+ new String[] { "employeeNum", "firstName", "lastName", "supervisorNum", "specializesInItemNum", "supplierNumFK" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
+
+ // MAPPING DOC ======================================================================
+ MappingDocument doc = new MappingDocument(true);
+ MappingElement root = doc.addChildElement(new MappingElement("Catalogs")); //$NON-NLS-1$
+
+ MappingElement cats = root.addChildElement(new MappingElement("Catalog")); //$NON-NLS-1$
+ MappingElement itemsA = cats.addChildElement(new MappingElement("Items")); //$NON-NLS-1$
+
+ MappingElement item = itemsA.addChildElement(new MappingElement("Item")); //$NON-NLS-1$
+ item.setSource("xmltest.items");//$NON-NLS-1$
+ item.setMaxOccurrs(-1);
+ item.addAttribute(new MappingAttribute("ItemID", "xmltest.items.itemNum")); //$NON-NLS-1$ //$NON-NLS-2$
+ item.addChildElement(new MappingElement("Name", "xmltest.items.itemName")); //$NON-NLS-1$ //$NON-NLS-2$
+ item.addChildElement(new MappingElement("Quantity", "xmltest.items.itemQuantity")); //$NON-NLS-1$ //$NON-NLS-2$
+
+ //NESTED STUFF======================================================================
+ MappingElement nestedWrapper = item.addChildElement(new MappingElement("Suppliers")); //$NON-NLS-1$
+ MappingElement supplier = nestedWrapper.addChildElement(new MappingElement("Supplier")); //$NON-NLS-1$
+ supplier.setSource("xmltest.suppliers");//$NON-NLS-1$
+ supplier.setMaxOccurrs(-1);
+ supplier.addAttribute(new MappingAttribute("SupplierID", "xmltest.suppliers.supplierNum")); //$NON-NLS-1$ //$NON-NLS-2$
+ supplier.addChildElement(new MappingElement("Name","xmltest.suppliers.supplierName")); //$NON-NLS-1$ //$NON-NLS-2$
+ supplier.addChildElement(new MappingElement("Zip", "xmltest.suppliers.supplierZipCode")); //$NON-NLS-1$ //$NON-NLS-2$
+
+ MappingElement ordersWrapper = supplier.addChildElement(new MappingElement("Orders")); //$NON-NLS-1$
+ MappingElement order = ordersWrapper.addChildElement(new MappingElement("Order")); //$NON-NLS-1$
+ order.setSource("xmltest.orders"); //$NON-NLS-1$
+ order.setMaxOccurrs(-1);
+ order.addAttribute(new MappingAttribute("OrderID", "xmltest.orders.orderNum")); //$NON-NLS-1$ //$NON-NLS-2$
+ order.addChildElement(new MappingElement("OrderDate", "xmltest.orders.orderDate")); //$NON-NLS-1$ //$NON-NLS-2$
+ order.addChildElement(new MappingElement("OrderQuantity", "xmltest.orders.orderQty")); //$NON-NLS-1$ //$NON-NLS-2$
+
+ order.addChildElement(new MappingElement("OrderStatus", "xmltest.orders.orderStatus")) //$NON-NLS-1$ //$NON-NLS-2$
+ .setMinOccurrs(0);
+ //NESTED STUFF======================================================================
+
+ MappingElement employeesWrapper = supplier.addChildElement(new MappingElement("Employees")); //$NON-NLS-1$
+ MappingElement employee = employeesWrapper.addChildElement(new MappingElement("Employee")); //$NON-NLS-1$
+ employee.setSource("xmltest.employees"); //$NON-NLS-1$
+ employee.setMaxOccurrs(-1);
+ employee.addAttribute(new MappingAttribute("EmployeeID", "xmltest.employees.employeeNum")); //$NON-NLS-1$ //$NON-NLS-2$
+ employee.addChildElement(new MappingElement("FirstName", "xmltest.employees.firstName")); //$NON-NLS-1$ //$NON-NLS-2$
+ employee.addChildElement(new MappingElement("LastName", "xmltest.employees.lastName")); //$NON-NLS-1$ //$NON-NLS-2$
+ employee.addAttribute(new MappingAttribute("SupervisorID", "xmltest.employees.supervisorNum")); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // END MAPPING DOC ======================================================================
+
+ // Create virtual docs and doc elements
+ Table itemsDoc = createXmlDocument("itemsDoc", xmltest, doc); //$NON-NLS-1$
+ createElements(itemsDoc,
+ new String[] { "Catalogs", //$NON-NLS-1$
+ "Catalogs.Catalog", //$NON-NLS-1$
+ "Catalogs.Catalog.items", //$NON-NLS-1$
+ "Catalogs.Catalog.items.item", //$NON-NLS-1$
+ "Catalogs.Catalog.items.item.@ItemID", //$NON-NLS-1$
+ "Catalogs.Catalog.items.item.Name", //$NON-NLS-1$
+ "Catalogs.Catalog.items.item.Quantity", //$NON-NLS-1$
+ "Catalogs.Catalog.items.item.Suppliers", //$NON-NLS-1$
+ "Catalogs.Catalog.items.item.Suppliers.Supplier", //$NON-NLS-1$
+ "Catalogs.Catalog.items.item.Suppliers.Supplier.@SupplierID", //$NON-NLS-1$
+ "Catalogs.Catalog.items.item.Suppliers.Supplier.Name", //$NON-NLS-1$
+ "Catalogs.Catalog.items.item.Suppliers.Supplier.Zip", //$NON-NLS-1$
+ "Catalogs.Catalog.items.item.Suppliers.Supplier.Orders", //$NON-NLS-1$
+ "Catalogs.Catalog.items.item.Suppliers.Supplier.Orders.Order", //$NON-NLS-1$
+ "Catalogs.Catalog.items.item.Suppliers.Supplier.Orders.Order.@OrderID", //$NON-NLS-1$
+ "Catalogs.Catalog.items.item.Suppliers.Supplier.Orders.Order.OrderDate", //$NON-NLS-1$
+ "Catalogs.Catalog.items.item.Suppliers.Supplier.Orders.Order.OrderQuantity", //$NON-NLS-1$
+ "Catalogs.Catalog.items.item.Suppliers.Supplier.Orders.Order.OrderStatus", //$NON-NLS-1$
+ "Catalogs.Catalog.items.item.Suppliers.Supplier.Employees", //$NON-NLS-1$
+ "Catalogs.Catalog.items.item.Suppliers.Supplier.Employees.Employee", //$NON-NLS-1$
+ "Catalogs.Catalog.items.item.Suppliers.Supplier.Employees.Employee.@EmployeeID", //$NON-NLS-1$
+ "Catalogs.Catalog.items.item.Suppliers.Supplier.Employees.Employee.FirstName", //$NON-NLS-1$
+ "Catalogs.Catalog.items.item.Suppliers.Supplier.Employees.Employee.LastName", //$NON-NLS-1$
+ "Catalogs.Catalog.items.item.Suppliers.Supplier.Employees.Employee.@SupervisorID", //$NON-NLS-1$
+
+ },
+ new String[] { DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.INTEGER,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ });
+
+ // Create mapping classes - baseball players employees doc
+ QueryNode playersNode = new QueryNode("SELECT stock.employees.employeeNum, firstName, lastName, supervisorNum FROM stock.employees WHERE specializesInItemNum is not null"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table rsPlayers = createVirtualGroup("players", xmltest, playersNode); //$NON-NLS-1$
+
+ QueryNode managersNode = new QueryNode("SELECT stock.employees.employeeNum, firstName, lastName, supervisorNum FROM stock.employees WHERE stock.employees.employeeNum = ?"); //$NON-NLS-1$ //$NON-NLS-2$
+ managersNode.addBinding("xmltest.players.supervisorNum"); //$NON-NLS-1$
+ Table rsManagers = createVirtualGroup("managers", xmltest, managersNode); //$NON-NLS-1$
+
+ // TODO what if elements in criteria weren't fully qualified? see defect 19541
+ QueryNode ownersNode = new QueryNode("SELECT stock.employees.employeeNum, firstName, lastName, supervisorNum FROM stock.employees WHERE stock.employees.employeeNum = ?"); //$NON-NLS-1$ //$NON-NLS-2$
+ ownersNode.addBinding("xmltest.managers.supervisorNum"); //$NON-NLS-1$
+ Table rsOwners = createVirtualGroup("owners", xmltest, ownersNode); //$NON-NLS-1$
+
+ // Create mapping classes elements - items doc
+ createElements(rsPlayers,
+ new String[] { "employeeNum", "firstName", "lastName", "supervisorNum" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
+
+ createElements(rsManagers,
+ new String[] { "employeeNum", "firstName", "lastName", "supervisorNum" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
+
+ createElements(rsOwners,
+ new String[] { "employeeNum", "firstName", "lastName", "supervisorNum" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING});
+
+
+
+ // MAPPING DOC - baseball players ======================================================================
+ MappingDocument doc2 = new MappingDocument(true);
+ MappingElement root2 = doc2.addChildElement(new MappingElement("BaseballPlayers")); //$NON-NLS-1$
+
+ MappingElement player = root2.addChildElement(new MappingElement("Player")); //$NON-NLS-1$
+ player.setSource("xmltest.players"); //$NON-NLS-1$
+ player.setMaxOccurrs(-1);
+ player.addAttribute(new MappingAttribute("PlayerID", "xmltest.players.employeeNum")); //$NON-NLS-1$ //$NON-NLS-2$
+ player.addChildElement(new MappingElement("FirstName", "xmltest.players.firstName")); //$NON-NLS-1$ //$NON-NLS-2$
+ player.addChildElement(new MappingElement("LastName", "xmltest.players.lastName")); //$NON-NLS-1$ //$NON-NLS-2$
+
+ MappingElement manager = player.addChildElement(new MappingElement("Manager")); //$NON-NLS-1$
+ manager.setSource("xmltest.managers");//$NON-NLS-1$
+ manager.setMaxOccurrs(-1);
+ manager.addAttribute(new MappingAttribute("ManagerID", "xmltest.managers.employeeNum")); //$NON-NLS-1$ //$NON-NLS-2$
+ manager.addChildElement(new MappingElement("FirstName", "xmltest.managers.firstName")); //$NON-NLS-1$ //$NON-NLS-2$
+ manager.addChildElement(new MappingElement("LastName", "xmltest.managers.lastName")); //$NON-NLS-1$ //$NON-NLS-2$
+
+ MappingElement owner = manager.addChildElement(new MappingElement("Owner")); //$NON-NLS-1$
+ owner.setSource("xmltest.owners"); //$NON-NLS-1$
+ owner.setMaxOccurrs(-1);
+ owner.addAttribute(new MappingAttribute("OwnerID", "xmltest.owners.employeeNum")); //$NON-NLS-1$ //$NON-NLS-2$
+ owner.addChildElement(new MappingElement("FirstName", "xmltest.owners.firstName")); //$NON-NLS-1$ //$NON-NLS-2$
+ owner.addChildElement(new MappingElement("LastName", "xmltest.owners.lastName")); //$NON-NLS-1$ //$NON-NLS-2$
+ // END MAPPING DOC ======================================================================
+
+ // Create virtual docs and doc elements
+ Table playersDoc = createXmlDocument("playersDoc", xmltest, doc2); //$NON-NLS-1$
+ createElements(playersDoc,
+ new String[] { "BaseballPlayers", //$NON-NLS-1$
+ "BaseballPlayers.Player", //$NON-NLS-1$
+ "BaseballPlayers.Player.@PlayerID", //$NON-NLS-1$
+ "BaseballPlayers.Player.FirstName", //$NON-NLS-1$
+ "BaseballPlayers.Player.LastName", //$NON-NLS-1$
+ "BaseballPlayers.Player.Manager", //$NON-NLS-1$
+ "BaseballPlayers.Player.Manager.@ManagerID", //$NON-NLS-1$
+ "BaseballPlayers.Player.Manager.FirstName", //$NON-NLS-1$
+ "BaseballPlayers.Player.Manager.LastName", //$NON-NLS-1$
+ "BaseballPlayers.Player.Manager.Owner", //$NON-NLS-1$
+ "BaseballPlayers.Player.Manager.Owner.@OwnerID", //$NON-NLS-1$
+ "BaseballPlayers.Player.Manager.Owner.FirstName", //$NON-NLS-1$
+ "BaseballPlayers.Player.Manager.Owner.LastName", //$NON-NLS-1$
+
+ },
+ new String[] { DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.STRING,
+ });
+ return createTransformationMetadata(metadataStore, "case3225");
+ }
+
+ /**
+ * This example is for testing static costing using cardinality information from
+ * metadata, as well as key information and maybe access patterns
+ */
+ public static TransformationMetadata example4() {
+ MetadataStore metadataStore = new MetadataStore();
+ // Create models - physical ones will support joins
+ Schema pm1 = createPhysicalModel("pm1", metadataStore); //$NON-NLS-1$
+ Schema pm2 = createPhysicalModel("pm2", metadataStore); //$NON-NLS-1$
+ Schema pm3 = createPhysicalModel("pm3", metadataStore); //$NON-NLS-1$
+ Schema pm4 = createPhysicalModel("pm4", metadataStore); //$NON-NLS-1$
+ Schema vm1 = createVirtualModel("vm1", metadataStore); //$NON-NLS-1$
+
+ // Create physical groups
+ Table pm1g1 = createPhysicalGroup("g1", pm1); //$NON-NLS-1$
+ Table pm1g2 = createPhysicalGroup("g2", pm1); //$NON-NLS-1$
+ Table pm1g3 = createPhysicalGroup("g3", pm1); //$NON-NLS-1$
+ Table pm2g1 = createPhysicalGroup("g1", pm2); //$NON-NLS-1$
+ Table pm2g2 = createPhysicalGroup("g2", pm2); //$NON-NLS-1$
+ Table pm2g3 = createPhysicalGroup("g3", pm2); //$NON-NLS-1$
+ Table pm3g1 = createPhysicalGroup("g1", pm3); //$NON-NLS-1$
+ Table pm3g2 = createPhysicalGroup("g2", pm3); //$NON-NLS-1$
+ Table pm3g3 = createPhysicalGroup("g3", pm3); //$NON-NLS-1$
+ Table pm4g1 = createPhysicalGroup("g1", pm4); //$NON-NLS-1$
+ Table pm4g2 = createPhysicalGroup("g2", pm4); //$NON-NLS-1$
+ // Add group cardinality metadata
+ pm1g1.setCardinality(10);
+ pm1g2.setCardinality(10);
+ pm1g3.setCardinality(10);
+ pm2g1.setCardinality(1000);
+ pm2g2.setCardinality(1000);
+ pm3g1.setCardinality(100000);
+ pm3g2.setCardinality(100000);
+ pm3g3.setCardinality(100000);
+ // leave pm4.g1 as unknown
+
+ // Create physical elements
+ List<Column> pm1g1e = createElements(pm1g1,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(pm1g2,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ List<Column> pm1g3e = createElements(pm1g3,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ List<Column> pm2g1e = createElements(pm2g1,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(pm2g2,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(pm2g3,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ List<Column> pm3g1e = createElements(pm3g1,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(pm3g2,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ List<Column> pm3g3e = createElements(pm3g3,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ List<Column> pm4g1e = createElements(pm4g1,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ List<Column> pm4g2e = createElements(pm4g2,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+
+ // Add key metadata
+ createKey(KeyRecord.Type.Primary, "pm1.g1.key1", pm1g1, pm1g1e.subList(0, 1)); //e1 //$NON-NLS-1$
+ createKey(KeyRecord.Type.Primary, "pm3.g1.key1", pm3g1, pm3g1e.subList(0, 1)); //e1 //$NON-NLS-1$
+ createKey(KeyRecord.Type.Primary, "pm3.g3.key1", pm3g3, pm3g3e.subList(0, 1)); //e1 //$NON-NLS-1$
+ KeyRecord pm4g1key1= createKey(KeyRecord.Type.Primary, "pm4.g1.key1", pm4g1, pm4g1e.subList(0, 2)); //e1, e2 //$NON-NLS-1$
+ createForeignKey("pm4.g2.fk", pm4g2, pm4g2e.subList(0, 2), pm4g1key1); //$NON-NLS-1$
+ // Add access pattern metadata
+ // Create access patterns - pm1
+ List<Column> elements = new ArrayList<Column>(1);
+ elements.add(pm1g1e.iterator().next());
+ createAccessPattern("pm1.g1.ap1", pm1g1, elements); //e1 //$NON-NLS-1$
+ elements = new ArrayList<Column>(2);
+ Iterator<Column> iter = pm1g3e.iterator();
+ elements.add(iter.next());
+ elements.add(iter.next());
+ createAccessPattern("pm1.g3.ap1", pm1g3, elements); //e1,e2 //$NON-NLS-1$
+ // Create access patterns - pm2
+ elements = new ArrayList<Column>(1);
+ elements.add(pm2g1e.iterator().next());
+ createAccessPattern("pm2.g1.ap1", pm2g1, elements); //e1 //$NON-NLS-1$
+
+ // Create virtual groups
+ QueryNode vm1g1n1 = new QueryNode("SELECT * FROM pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g1 = createUpdatableVirtualGroup("g1", vm1, vm1g1n1); //$NON-NLS-1$
+
+ QueryNode vm1g2n1 = new QueryNode("SELECT pm1.g2.e1, pm1.g2.e2, pm1.g2.e3 FROM pm1.g2"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g2 = createUpdatableVirtualGroup("g2", vm1, vm1g2n1); //$NON-NLS-1$
+
+ QueryNode vm1g3n1 = new QueryNode("SELECT pm1.g3.e1 AS x, pm1.g3.e2 AS y from pm1.g3"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g3 = createUpdatableVirtualGroup("g3", vm1, vm1g3n1); //$NON-NLS-1$
+
+ QueryNode vm1g4n1 = new QueryNode("SELECT distinct pm1.g2.e1 as ve1, pm1.g1.e1 as ve2 FROM pm1.g2 LEFT OUTER JOIN /* optional */ pm1.g1 on pm1.g1.e1 = pm1.g2.e1"); //$NON-NLS-1$ //$NON-NLS-2$
+ Table vm1g4 = createVirtualGroup("g4", vm1, vm1g4n1); //$NON-NLS-1$
+ createElements(vm1g4,
+ new String[] { "ve1", "ve2" }, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
+
+ // Create virtual elements
+ createElements(vm1g1,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(vm1g2,
+ new String[] { "e1", "e2", "e3", "e4" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BOOLEAN, DataTypeManager.DefaultDataTypes.DOUBLE });
+ createElements(vm1g3,
+ new String[] { "e1", "e2","x", "y" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
+
+ return createTransformationMetadata(metadataStore, "example4");
+ }
+
}
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/validator/TestUpdateValidator.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/validator/TestUpdateValidator.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/validator/TestUpdateValidator.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -180,7 +180,7 @@
// Stored queries
ColumnSet<Procedure> rs1 = RealMetadataFactory.createResultSet("rs1", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
QueryNode sq1n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1; END"); //$NON-NLS-1$ //$NON-NLS-2$
- Procedure sq1 = RealMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Collections.EMPTY_LIST, sq1n1); //$NON-NLS-1$
+ Procedure sq1 = RealMetadataFactory.createVirtualProcedure("sq1", pm1, Collections.EMPTY_LIST, sq1n1); //$NON-NLS-1$
sq1.setResultSet(rs1);
// Create the facade from the store
return RealMetadataFactory.createTransformationMetadata(metadataStore, "example");
Modified: branches/7.4.x/engine/src/test/java/org/teiid/query/validator/TestValidator.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/query/validator/TestValidator.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/engine/src/test/java/org/teiid/query/validator/TestValidator.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -28,7 +28,6 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -43,11 +42,21 @@
import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.types.DataTypeManager;
import org.teiid.dqp.internal.process.multisource.MultiSourceMetadataWrapper;
+import org.teiid.metadata.Column;
+import org.teiid.metadata.ColumnSet;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Procedure;
+import org.teiid.metadata.ProcedureParameter;
+import org.teiid.metadata.Schema;
+import org.teiid.metadata.Table;
+import org.teiid.metadata.BaseColumn.NullType;
+import org.teiid.metadata.Column.SearchType;
import org.teiid.query.analysis.AnalysisRecord;
import org.teiid.query.mapping.relational.QueryNode;
import org.teiid.query.mapping.xml.MappingDocument;
import org.teiid.query.mapping.xml.MappingElement;
import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.parser.QueryParser;
import org.teiid.query.resolver.QueryResolver;
import org.teiid.query.sql.LanguageObject;
@@ -55,58 +64,55 @@
import org.teiid.query.sql.lang.ProcedureContainer;
import org.teiid.query.sql.symbol.GroupSymbol;
import org.teiid.query.sql.visitor.SQLStringVisitor;
-import org.teiid.query.unittest.FakeMetadataFacade;
-import org.teiid.query.unittest.FakeMetadataFactory;
-import org.teiid.query.unittest.FakeMetadataObject;
-import org.teiid.query.unittest.FakeMetadataStore;
import org.teiid.query.unittest.RealMetadataFactory;
@SuppressWarnings("nls")
public class TestValidator {
- public static FakeMetadataFacade exampleMetadata() {
+ public static TransformationMetadata exampleMetadata() {
+ MetadataStore metadataStore = new MetadataStore();
// Create metadata objects
- FakeMetadataObject modelObj = FakeMetadataFactory.createPhysicalModel("test"); //$NON-NLS-1$
- FakeMetadataObject vModelObj2 = FakeMetadataFactory.createVirtualModel("vTest"); //$NON-NLS-1$
- FakeMetadataObject groupObj = FakeMetadataFactory.createPhysicalGroup("test.group", modelObj); //$NON-NLS-1$
- FakeMetadataObject elemObj0 = FakeMetadataFactory.createElement("test.group.e0", groupObj, DataTypeManager.DefaultDataTypes.INTEGER, 0); //$NON-NLS-1$
- elemObj0.putProperty(FakeMetadataObject.Props.NULL, Boolean.FALSE);
- FakeMetadataObject elemObj1 = FakeMetadataFactory.createElement("test.group.e1", groupObj, DataTypeManager.DefaultDataTypes.STRING, 1); //$NON-NLS-1$
- elemObj1.putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- FakeMetadataObject elemObj2 = FakeMetadataFactory.createElement("test.group.e2", groupObj, DataTypeManager.DefaultDataTypes.STRING, 2); //$NON-NLS-1$
- elemObj2.putProperty(FakeMetadataObject.Props.SEARCHABLE_COMPARE, Boolean.FALSE);
- FakeMetadataObject elemObj3 = FakeMetadataFactory.createElement("test.group.e3", groupObj, DataTypeManager.DefaultDataTypes.STRING, 3); //$NON-NLS-1$
- elemObj3.putProperty(FakeMetadataObject.Props.SEARCHABLE_LIKE, Boolean.FALSE);
+ Schema modelObj = RealMetadataFactory.createPhysicalModel("test", metadataStore); //$NON-NLS-1$
+ Schema vModelObj2 = RealMetadataFactory.createVirtualModel("vTest", metadataStore); //$NON-NLS-1$
+ Table groupObj = RealMetadataFactory.createPhysicalGroup("group", modelObj); //$NON-NLS-1$
+ Column elemObj0 = RealMetadataFactory.createElement("e0", groupObj, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ elemObj0.setNullType(NullType.No_Nulls);
+ Column elemObj1 = RealMetadataFactory.createElement("e1", groupObj, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ elemObj1.setSelectable(false);
+ Column elemObj2 = RealMetadataFactory.createElement("e2", groupObj, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ elemObj2.setSearchType(SearchType.Like_Only);
+ Column elemObj3 = RealMetadataFactory.createElement("e3", groupObj, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ elemObj3.setSearchType(SearchType.All_Except_Like);
- FakeMetadataObject group2Obj = FakeMetadataFactory.createPhysicalGroup("test.group2", modelObj); //$NON-NLS-1$
- FakeMetadataObject elemObj2_0 = FakeMetadataFactory.createElement("test.group2.e0", group2Obj, DataTypeManager.DefaultDataTypes.INTEGER, 0); //$NON-NLS-1$
- elemObj2_0.putProperty(FakeMetadataObject.Props.UPDATE, Boolean.FALSE);
- FakeMetadataObject elemObj2_1 = FakeMetadataFactory.createElement("test.group2.e1", group2Obj, DataTypeManager.DefaultDataTypes.STRING, 1); //$NON-NLS-1$
- FakeMetadataObject elemObj2_2 = FakeMetadataFactory.createElement("test.group2.e2", group2Obj, DataTypeManager.DefaultDataTypes.STRING, 2); //$NON-NLS-1$
- elemObj2_2.putProperty(FakeMetadataObject.Props.UPDATE, Boolean.FALSE);
+ Table group2Obj = RealMetadataFactory.createPhysicalGroup("group2", modelObj); //$NON-NLS-1$
+ Column elemObj2_0 = RealMetadataFactory.createElement("e0", group2Obj, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ elemObj2_0.setUpdatable(false);
+ RealMetadataFactory.createElement("e1", group2Obj, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ Column elemObj2_2 = RealMetadataFactory.createElement("e2", group2Obj, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ elemObj2_2.setUpdatable(false);
- FakeMetadataObject group3Obj = FakeMetadataFactory.createPhysicalGroup("test.group3", modelObj); //$NON-NLS-1$
- group3Obj.putProperty(FakeMetadataObject.Props.UPDATE, Boolean.FALSE);
- FakeMetadataObject elemObj3_0 = FakeMetadataFactory.createElement("test.group3.e0", group3Obj, DataTypeManager.DefaultDataTypes.INTEGER, 0); //$NON-NLS-1$
- FakeMetadataObject elemObj3_1 = FakeMetadataFactory.createElement("test.group3.e1", group3Obj, DataTypeManager.DefaultDataTypes.STRING, 1); //$NON-NLS-1$
- FakeMetadataObject elemObj3_2 = FakeMetadataFactory.createElement("test.group3.e2", group3Obj, DataTypeManager.DefaultDataTypes.STRING, 2); //$NON-NLS-1$
+ Table group3Obj = RealMetadataFactory.createPhysicalGroup("group3", modelObj); //$NON-NLS-1$
+ group3Obj.setSupportsUpdate(false);
+ RealMetadataFactory.createElement("e0", group3Obj, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ RealMetadataFactory.createElement("e1", group3Obj, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ RealMetadataFactory.createElement("e2", group3Obj, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
// Create virtual group & elements.
QueryNode vNode = new QueryNode("SELECT * FROM test.group WHERE e2 = 'x'"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vGroup = FakeMetadataFactory.createVirtualGroup("vTest.vGroup", vModelObj2, vNode); //$NON-NLS-1$
- List vGroupE = FakeMetadataFactory.createElements(vGroup,
+ Table vGroup = RealMetadataFactory.createVirtualGroup("vGroup", vModelObj2, vNode); //$NON-NLS-1$
+ RealMetadataFactory.createElements(vGroup,
new String[] { "e0", "e1", "e2", "e3" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
QueryNode vNode2 = new QueryNode("SELECT * FROM test.group"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vGroup2 = FakeMetadataFactory.createVirtualGroup("vTest.vMap", vModelObj2, vNode2); //$NON-NLS-1$
- List vGroupE2 = FakeMetadataFactory.createElements(vGroup2,
+ Table vGroup2 = RealMetadataFactory.createVirtualGroup("vMap", vModelObj2, vNode2); //$NON-NLS-1$
+ List<Column> vGroupE2 = RealMetadataFactory.createElements(vGroup2,
new String[] { "e0", "e1", "e2", "e3" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
new String[] { DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- ((FakeMetadataObject)vGroupE2.get(0)).putProperty(FakeMetadataObject.Props.NULL, Boolean.FALSE);
- ((FakeMetadataObject)vGroupE2.get(1)).putProperty(FakeMetadataObject.Props.SELECT, Boolean.FALSE);
- ((FakeMetadataObject)vGroupE2.get(2)).putProperty(FakeMetadataObject.Props.SEARCHABLE_COMPARE, Boolean.FALSE);
- ((FakeMetadataObject)vGroupE2.get(3)).putProperty(FakeMetadataObject.Props.SEARCHABLE_LIKE, Boolean.FALSE);
+ vGroupE2.get(0).setNullType(NullType.No_Nulls);
+ vGroupE2.get(1).setSelectable(false);
+ vGroupE2.get(2).setSearchType(SearchType.Like_Only);
+ vGroupE2.get(3).setSearchType(SearchType.All_Except_Like);
// Create virtual documents
MappingDocument doc = new MappingDocument(false);
@@ -114,81 +120,51 @@
MappingElement sourceNode = complexRoot.addChildElement(new MappingElement("a1")); //$NON-NLS-1$
sourceNode.setSource("test.group"); //$NON-NLS-1$
- sourceNode.addChildElement(new MappingElement("a2", "test.group.e1")); //$NON-NLS-1$ //$NON-NLS-2$
- sourceNode.addChildElement(new MappingElement("b2", "test.group.e2")); //$NON-NLS-1$ //$NON-NLS-2$
- sourceNode.addChildElement(new MappingElement("c2", "test.group.e3")); //$NON-NLS-1$ //$NON-NLS-2$
+ sourceNode.addChildElement(new MappingElement("a2", "e1")); //$NON-NLS-1$ //$NON-NLS-2$
+ sourceNode.addChildElement(new MappingElement("b2", "e2")); //$NON-NLS-1$ //$NON-NLS-2$
+ sourceNode.addChildElement(new MappingElement("c2", "e3")); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject docModel = FakeMetadataFactory.createVirtualModel("vm1"); //$NON-NLS-1$
- FakeMetadataObject doc1 = FakeMetadataFactory.createVirtualGroup("vm1.doc1", docModel, doc); //$NON-NLS-1$
- List docE1 = FakeMetadataFactory.createElements(doc1, new String[] { "a0", "a0.a1", "a0.a1.a2", "a0.a1.b2", "a0.a1.c2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ Schema docModel = RealMetadataFactory.createVirtualModel("vm1", metadataStore); //$NON-NLS-1$
+ Table doc1 = RealMetadataFactory.createXmlDocument("doc1", docModel, doc); //$NON-NLS-1$
+ RealMetadataFactory.createElements(doc1, new String[] { "a0", "a0.a1", "a0.a1.a2", "a0.a1.b2", "a0.a1.c2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
new String[] {DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
- // set up validator metadata
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(modelObj);
- store.addObject(groupObj);
- store.addObject(elemObj0);
- store.addObject(elemObj1);
- store.addObject(elemObj2);
- store.addObject(elemObj3);
- store.addObject(vGroup);
- store.addObjects(vGroupE);
- store.addObject(vGroup2);
- store.addObjects(vGroupE2);
- store.addObject(docModel);
- store.addObject(group2Obj);
- store.addObject(elemObj2_0);
- store.addObject(elemObj2_1);
- store.addObject(elemObj2_2);
- store.addObject(group3Obj);
- store.addObject(elemObj3_0);
- store.addObject(elemObj3_1);
- store.addObject(elemObj3_2);
- store.addObject(doc1);
- store.addObjects(docE1);
- return new FakeMetadataFacade(store);
+ return RealMetadataFactory.createTransformationMetadata(metadataStore, "example");
}
- public FakeMetadataFacade exampleMetadata1() {
+ public TransformationMetadata exampleMetadata1() {
+ MetadataStore metadataStore = new MetadataStore();
// Create metadata objects
- FakeMetadataObject modelObj = FakeMetadataFactory.createPhysicalModel("test"); //$NON-NLS-1$
- FakeMetadataObject groupObj = FakeMetadataFactory.createPhysicalGroup("test.group", modelObj); //$NON-NLS-1$
+ Schema modelObj = RealMetadataFactory.createPhysicalModel("test", metadataStore); //$NON-NLS-1$
+ Table groupObj = RealMetadataFactory.createPhysicalGroup("group", modelObj); //$NON-NLS-1$
- FakeMetadataObject elemObj0 = FakeMetadataFactory.createElement("test.group.e0", groupObj, DataTypeManager.DefaultDataTypes.INTEGER, 0); //$NON-NLS-1$
- FakeMetadataObject elemObj1 = FakeMetadataFactory.createElement("test.group.e1", groupObj, DataTypeManager.DefaultDataTypes.STRING, 1); //$NON-NLS-1$
- FakeMetadataObject elemObj2 = FakeMetadataFactory.createElement("test.group.e2", groupObj, DataTypeManager.DefaultDataTypes.STRING, 2); //$NON-NLS-1$
- FakeMetadataObject elemObj3 = FakeMetadataFactory.createElement("test.group.e3", groupObj, DataTypeManager.DefaultDataTypes.STRING, 3); //$NON-NLS-1$
+ Column elemObj0 = RealMetadataFactory.createElement("e0", groupObj, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ Column elemObj1 = RealMetadataFactory.createElement("e1", groupObj, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ Column elemObj2 = RealMetadataFactory.createElement("e2", groupObj, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ RealMetadataFactory.createElement("e3", groupObj, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
- elemObj0.putProperty(FakeMetadataObject.Props.NULL, Boolean.FALSE);
- elemObj0.putProperty(FakeMetadataObject.Props.DEFAULT_VALUE, Boolean.FALSE);
+ elemObj0.setNullType(NullType.No_Nulls);
- elemObj1.putProperty(FakeMetadataObject.Props.NULL, Boolean.TRUE);
- elemObj1.putProperty(FakeMetadataObject.Props.DEFAULT_VALUE, Boolean.TRUE);
+ elemObj1.setNullType(NullType.Nullable);
+ elemObj1.setDefaultValue(Boolean.TRUE.toString());
- elemObj2.putProperty(FakeMetadataObject.Props.NULL, Boolean.TRUE);
- elemObj2.putProperty(FakeMetadataObject.Props.DEFAULT_VALUE, Boolean.FALSE);
+ elemObj2.setNullType(NullType.Nullable);
+ elemObj2.setDefaultValue(Boolean.FALSE.toString());
- // set up validator metadata
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(modelObj);
- store.addObject(groupObj);
- store.addObject(elemObj0);
- store.addObject(elemObj1);
- store.addObject(elemObj2);
- store.addObject(elemObj3);
- return new FakeMetadataFacade(store);
+ return RealMetadataFactory.createTransformationMetadata(metadataStore, "example1");
}
/**
* Group has element with type object
- * @return FakeMetadataFacade
+ * @return QueryMetadataInterface
*/
- public static FakeMetadataFacade exampleMetadata2() {
+ public static TransformationMetadata exampleMetadata2() {
+ MetadataStore metadataStore = new MetadataStore();
// Create metadata objects
- FakeMetadataObject modelObj = FakeMetadataFactory.createPhysicalModel("test"); //$NON-NLS-1$
- FakeMetadataObject groupObj = FakeMetadataFactory.createPhysicalGroup("test.group", modelObj); //$NON-NLS-1$
+ Schema modelObj = RealMetadataFactory.createPhysicalModel("test", metadataStore); //$NON-NLS-1$
+ Table groupObj = RealMetadataFactory.createPhysicalGroup("group", modelObj); //$NON-NLS-1$
- List elements = FakeMetadataFactory.createElements(groupObj, new String[] {
+ RealMetadataFactory.createElements(groupObj, new String[] {
"e0", "e1", "e2", "e3", "e4", "e5" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
}, new String[] {
DataTypeManager.DefaultDataTypes.INTEGER,
@@ -199,83 +175,56 @@
DataTypeManager.DefaultDataTypes.XML,
});
- // set up validator metadata
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(modelObj);
- store.addObject(groupObj);
- store.addObjects(elements);
- return new FakeMetadataFacade(store);
+ return RealMetadataFactory.createTransformationMetadata(metadataStore, "example2");
}
- public static FakeMetadataFacade exampleMetadata3() {
+ public static TransformationMetadata exampleMetadata3() {
+ MetadataStore metadataStore = new MetadataStore();
// Create metadata objects
- FakeMetadataObject modelObj = FakeMetadataFactory.createPhysicalModel("test"); //$NON-NLS-1$
- FakeMetadataObject groupObj = FakeMetadataFactory.createPhysicalGroup("test.group", modelObj); //$NON-NLS-1$
+ Schema modelObj = RealMetadataFactory.createPhysicalModel("test", metadataStore); //$NON-NLS-1$
+ Table groupObj = RealMetadataFactory.createPhysicalGroup("group", modelObj); //$NON-NLS-1$
- FakeMetadataObject elemObj0 = FakeMetadataFactory.createElement("test.group.e0", groupObj, DataTypeManager.DefaultDataTypes.INTEGER, 0); //$NON-NLS-1$
- FakeMetadataObject elemObj1 = FakeMetadataFactory.createElement("test.group.e1", groupObj, DataTypeManager.DefaultDataTypes.STRING, 1); //$NON-NLS-1$
+ RealMetadataFactory.createElement("e0", groupObj, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ Column elemObj1 = RealMetadataFactory.createElement("e1", groupObj, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
- elemObj1.putProperty(FakeMetadataObject.Props.NULL, Boolean.FALSE);
- elemObj1.putProperty(FakeMetadataObject.Props.DEFAULT_VALUE, Boolean.FALSE);
- elemObj1.putProperty(FakeMetadataObject.Props.AUTO_INCREMENT, Boolean.TRUE);
- elemObj1.putProperty(FakeMetadataObject.Props.NAME_IN_SOURCE, "e1:SEQUENCE=MYSEQUENCE.nextVal"); //$NON-NLS-1$
+ elemObj1.setNullType(NullType.No_Nulls);
+ elemObj1.setDefaultValue(Boolean.FALSE.toString());
+ elemObj1.setAutoIncremented(true);
+ elemObj1.setNameInSource("e1:SEQUENCE=MYSEQUENCE.nextVal"); //$NON-NLS-1$
- // set up validator metadata
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(modelObj);
- store.addObject(groupObj);
- store.addObject(elemObj0);
- store.addObject(elemObj1);
- return new FakeMetadataFacade(store);
+ return RealMetadataFactory.createTransformationMetadata(metadataStore, "example3");
}
- public static FakeMetadataFacade exampleMetadata4() {
+ public static TransformationMetadata exampleMetadata4() {
+ MetadataStore metadataStore = new MetadataStore();
// Create metadata objects
- FakeMetadataObject modelObj = FakeMetadataFactory.createPhysicalModel("test"); //$NON-NLS-1$
- FakeMetadataObject groupObj = FakeMetadataFactory.createPhysicalGroup("test.group", modelObj); //$NON-NLS-1$
- FakeMetadataObject elemObj0 = FakeMetadataFactory.createElement("test.group.e0", groupObj, DataTypeManager.DefaultDataTypes.INTEGER, 0); //$NON-NLS-1$
- FakeMetadataObject elemObj1 = FakeMetadataFactory.createElement("test.group.e1", groupObj, DataTypeManager.DefaultDataTypes.STRING, 1); //$NON-NLS-1$
- FakeMetadataObject elemObj2 = FakeMetadataFactory.createElement("test.group.e2", groupObj, DataTypeManager.DefaultDataTypes.STRING, 2); //$NON-NLS-1$
- FakeMetadataObject vModelObj = FakeMetadataFactory.createVirtualModel("vTest"); //$NON-NLS-1$
+ Schema modelObj = RealMetadataFactory.createPhysicalModel("test", metadataStore); //$NON-NLS-1$
+ Table groupObj = RealMetadataFactory.createPhysicalGroup("group", modelObj); //$NON-NLS-1$
+ RealMetadataFactory.createElement("e0", groupObj, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ RealMetadataFactory.createElement("e1", groupObj, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ RealMetadataFactory.createElement("e2", groupObj, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ Schema vModelObj = RealMetadataFactory.createVirtualModel("vTest", metadataStore); //$NON-NLS-1$
QueryNode vNode = new QueryNode("SELECT * FROM test.group"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vGroupObj = FakeMetadataFactory.createVirtualGroup("vTest.vGroup", vModelObj, vNode); //$NON-NLS-1$
- FakeMetadataObject vElemObj0 = FakeMetadataFactory.createElement("vTest.vGroup.e0", vGroupObj, DataTypeManager.DefaultDataTypes.INTEGER, 0); //$NON-NLS-1$
- FakeMetadataObject vElemObj1 = FakeMetadataFactory.createElement("vTest.vGroup.e1", vGroupObj, DataTypeManager.DefaultDataTypes.STRING, 1); //$NON-NLS-1$
- FakeMetadataObject vElemObj2 = FakeMetadataFactory.createElement("vTest.vGroup.e2", vGroupObj, DataTypeManager.DefaultDataTypes.STRING, 2); //$NON-NLS-1$
- List elements = new ArrayList(1);
+ Table vGroupObj = RealMetadataFactory.createVirtualGroup("vGroup", vModelObj, vNode); //$NON-NLS-1$
+ Column vElemObj0 = RealMetadataFactory.createElement("e0", vGroupObj, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ Column vElemObj1 = RealMetadataFactory.createElement("e1", vGroupObj, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ RealMetadataFactory.createElement("e2", vGroupObj, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ List<Column> elements = new ArrayList<Column>(2);
elements.add(vElemObj0);
elements.add(vElemObj1);
- FakeMetadataObject vGroupAp1 = FakeMetadataFactory.createAccessPattern("vTest.vGroup.ap1", vGroupObj, elements); //e1 //$NON-NLS-1$
+ RealMetadataFactory.createAccessPattern("ap1", vGroupObj, elements); //e1 //$NON-NLS-1$
QueryNode vNode2 = new QueryNode("SELECT * FROM vTest.vGroup"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject vGroupObj2 = FakeMetadataFactory.createVirtualGroup("vTest.vGroup2", vModelObj, vNode2); //$NON-NLS-1$
- FakeMetadataObject vElemObj20 = FakeMetadataFactory.createElement("vTest.vGroup2.e0", vGroupObj2, DataTypeManager.DefaultDataTypes.INTEGER, 0); //$NON-NLS-1$
- FakeMetadataObject vElemObj21 = FakeMetadataFactory.createElement("vTest.vGroup2.e1", vGroupObj2, DataTypeManager.DefaultDataTypes.STRING, 1); //$NON-NLS-1$
- FakeMetadataObject vElemObj22 = FakeMetadataFactory.createElement("vTest.vGroup2.e2", vGroupObj2, DataTypeManager.DefaultDataTypes.STRING, 2); //$NON-NLS-1$
- elements = new ArrayList(1);
+ Table vGroupObj2 = RealMetadataFactory.createVirtualGroup("vGroup2", vModelObj, vNode2); //$NON-NLS-1$
+ Column vElemObj20 = RealMetadataFactory.createElement("e0", vGroupObj2, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
+ Column vElemObj21 = RealMetadataFactory.createElement("e1", vGroupObj2, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ RealMetadataFactory.createElement("e2", vGroupObj2, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ elements = new ArrayList<Column>(2);
elements.add(vElemObj20);
elements.add(vElemObj21);
- FakeMetadataObject vGroup2Ap1 = FakeMetadataFactory.createAccessPattern("vTest.vGroup2.ap1", vGroupObj2, elements); //e1 //$NON-NLS-1$
+ RealMetadataFactory.createAccessPattern("vTest.vGroup2.ap1", vGroupObj2, elements); //e1 //$NON-NLS-1$
- // set up validator metadata
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(modelObj);
- store.addObject(groupObj);
- store.addObject(elemObj0);
- store.addObject(elemObj1);
- store.addObject(elemObj2);
- store.addObject(vModelObj);
- store.addObject(vGroupObj);
- store.addObject(vElemObj0);
- store.addObject(vElemObj1);
- store.addObject(vElemObj2);
- store.addObject(vGroupAp1);
- store.addObject(vGroupObj2);
- store.addObject(vElemObj20);
- store.addObject(vElemObj21);
- store.addObject(vElemObj22);
- store.addObject(vGroup2Ap1);
- return new FakeMetadataFacade(store);
+ return RealMetadataFactory.createTransformationMetadata(metadataStore, "example4");
}
// ################################## TEST HELPERS ################################
@@ -326,15 +275,13 @@
private static void examineReport(Object command,
String[] expectedStringArray, ValidatorReport report) {
// Get invalid objects from report
- Collection actualObjs = new ArrayList();
+ Collection<LanguageObject> actualObjs = new ArrayList<LanguageObject>();
report.collectInvalidObjects(actualObjs);
// Compare expected and actual objects
- Set<String> expectedStrings = new HashSet(Arrays.asList(expectedStringArray));
+ Set<String> expectedStrings = new HashSet<String>(Arrays.asList(expectedStringArray));
Set<String> actualStrings = new HashSet<String>();
- Iterator objIter = actualObjs.iterator();
- while(objIter.hasNext()) {
- LanguageObject obj = (LanguageObject) objIter.next();
+ for (LanguageObject obj : actualObjs) {
actualStrings.add(SQLStringVisitor.getSQLString(obj));
}
@@ -347,9 +294,9 @@
}
}
- private void helpValidateProcedure(String procedure, String userUpdateStr, String procedureType) {
+ private void helpValidateProcedure(String procedure, String userUpdateStr, Table.TriggerEvent procedureType) {
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleUpdateProc(procedureType, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(procedureType, procedure);
try {
validateProcedure(userUpdateStr, metadata);
@@ -377,9 +324,9 @@
}
}
- private void helpFailProcedure(String procedure, String userUpdateStr, String procedureType) {
+ private void helpFailProcedure(String procedure, String userUpdateStr, Table.TriggerEvent procedureType) {
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleUpdateProc(procedureType, procedure);
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleUpdateProc(procedureType, procedure);
try {
validateProcedure(userUpdateStr, metadata);
@@ -394,7 +341,7 @@
@Test public void testSelectStarWhereNoElementsAreNotSelectable() {
- helpValidate("SELECT * FROM pm1.g5", new String[] {"SELECT * FROM pm1.g5"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT * FROM pm1.g5", new String[] {"SELECT * FROM pm1.g5"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testValidateSelect1() {
@@ -450,44 +397,44 @@
}
@Test public void testInvalidAggregate5() {
- helpValidate("SELECT e1 || 'x' frOM pm1.g1 GROUP BY e2 + 1", new String[] {"e1"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT e1 || 'x' frOM pm1.g1 GROUP BY e2 + 1", new String[] {"e1"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testInvalidAggregate6() {
- helpValidate("SELECT e2 + 1 frOM pm1.g1 GROUP BY e2 + 1 HAVING e1 || 'x' > 0", new String[] {"e1"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT e2 + 1 frOM pm1.g1 GROUP BY e2 + 1 HAVING e1 || 'x' > 0", new String[] {"e1"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testInvalidAggregate7() {
helpValidate("SELECT StringKey, SUM(length(StringKey || 'x')) + 1 AS x FROM BQT1.SmallA GROUP BY StringKey || 'x' HAVING space(MAX(length((StringKey || 'x') || 'y'))) = ' '", //$NON-NLS-1$
- new String[] {"StringKey"}, FakeMetadataFactory.exampleBQTCached() ); //$NON-NLS-1$
+ new String[] {"StringKey"}, RealMetadataFactory.exampleBQTCached() ); //$NON-NLS-1$
}
@Test public void testInvalidAggregate8() {
helpValidate("SELECT max(ObjectValue) FROM BQT1.SmallA GROUP BY StringKey", //$NON-NLS-1$
- new String[] {"MAX(ObjectValue)"}, FakeMetadataFactory.exampleBQTCached() ); //$NON-NLS-1$
+ new String[] {"MAX(ObjectValue)"}, RealMetadataFactory.exampleBQTCached() ); //$NON-NLS-1$
}
@Test public void testInvalidAggregate9() {
helpValidate("SELECT count(distinct ObjectValue) FROM BQT1.SmallA GROUP BY StringKey", //$NON-NLS-1$
- new String[] {"COUNT(DISTINCT ObjectValue)"}, FakeMetadataFactory.exampleBQTCached() ); //$NON-NLS-1$
+ new String[] {"COUNT(DISTINCT ObjectValue)"}, RealMetadataFactory.exampleBQTCached() ); //$NON-NLS-1$
}
@Test public void testInvalidAggregateIssue190644() {
- helpValidate("SELECT e3 + 1 from pm1.g1 GROUP BY e2 + 1 HAVING e2 + 1 = 5", new String[] {"e3"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT e3 + 1 from pm1.g1 GROUP BY e2 + 1 HAVING e2 + 1 = 5", new String[] {"e3"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testValidAggregate1() {
- helpValidate("SELECT (e2 + 1) * 2 frOM pm1.g1 GROUP BY e2 + 1", new String[] {}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpValidate("SELECT (e2 + 1) * 2 frOM pm1.g1 GROUP BY e2 + 1", new String[] {}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testValidAggregate2() {
- helpValidate("SELECT e2 + 1 frOM pm1.g1 GROUP BY e2 + 1", new String[] {}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpValidate("SELECT e2 + 1 frOM pm1.g1 GROUP BY e2 + 1", new String[] {}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testValidAggregate3() {
helpValidate("SELECT sum (IntKey), case when IntKey>=5000 then '5000 +' else '0-999' end " + //$NON-NLS-1$
"FROM BQT1.SmallA GROUP BY case when IntKey>=5000 then '5000 +' else '0-999' end", //$NON-NLS-1$
- new String[] {}, FakeMetadataFactory.exampleBQTCached());
+ new String[] {}, RealMetadataFactory.exampleBQTCached());
}
@Test public void testInvalidHaving1() {
helpValidate("SELECT e3 FROM test.group HAVING e3 > 0", new String[] {"e3"}, exampleMetadata()); //$NON-NLS-1$ //$NON-NLS-2$
@@ -506,23 +453,23 @@
}
@Test public void testValidateCaseInGroupBy() {
- helpValidate("SELECT SUM(e2) FROM pm1.g1 GROUP BY CASE e2 WHEN 0 THEN 1 ELSE 2 END", new String[] {}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpValidate("SELECT SUM(e2) FROM pm1.g1 GROUP BY CASE e2 WHEN 0 THEN 1 ELSE 2 END", new String[] {}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testValidateFunctionInGroupBy() {
- helpValidate("SELECT SUM(e2) FROM pm1.g1 GROUP BY (e2 + 1)", new String[] {}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpValidate("SELECT SUM(e2) FROM pm1.g1 GROUP BY (e2 + 1)", new String[] {}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testInvalidScalarSubqueryInGroupBy() {
- helpValidate("SELECT COUNT(*) FROM pm1.g1 GROUP BY (SELECT 1)", new String[] { "(SELECT 1)" }, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT COUNT(*) FROM pm1.g1 GROUP BY (SELECT 1)", new String[] { "(SELECT 1)" }, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testInvalidConstantInGroupBy() {
- helpValidate("SELECT COUNT(*) FROM pm1.g1 GROUP BY 1", new String[] { "1" }, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT COUNT(*) FROM pm1.g1 GROUP BY 1", new String[] { "1" }, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testInvalidReferenceInGroupBy() {
- helpValidate("SELECT COUNT(*) FROM pm1.g1 GROUP BY ?", new String[] { "?" }, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT COUNT(*) FROM pm1.g1 GROUP BY ?", new String[] { "?" }, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testValidateObjectType1() {
@@ -558,11 +505,11 @@
}
@Test public void testValidateIntersectAll() {
- helpValidate("SELECT e3 FROM pm1.g1 intersect all SELECT e3 FROM pm1.g1", new String[] {"SELECT e3 FROM pm1.g1 INTERSECT ALL SELECT e3 FROM pm1.g1"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT e3 FROM pm1.g1 intersect all SELECT e3 FROM pm1.g1", new String[] {"SELECT e3 FROM pm1.g1 INTERSECT ALL SELECT e3 FROM pm1.g1"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testValidateSetSelectInto() {
- helpValidate("SELECT e3 into #temp FROM pm1.g1 intersect all SELECT e3 FROM pm1.g1", new String[] {"SELECT e3 INTO #temp FROM pm1.g1 INTERSECT ALL SELECT e3 FROM pm1.g1"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT e3 into #temp FROM pm1.g1 intersect all SELECT e3 FROM pm1.g1", new String[] {"SELECT e3 INTO #temp FROM pm1.g1 INTERSECT ALL SELECT e3 FROM pm1.g1"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testInsert1() {
@@ -912,7 +859,7 @@
}
@Test public void testValidateSubquery3() {
- helpValidate("SELECT * FROM pm1.g1, (EXEC pm1.sq1( )) AS alias", new String[] {}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpValidate("SELECT * FROM pm1.g1, (EXEC pm1.sq1( )) AS alias", new String[] {}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testValidateUnionWithSubquery() {
@@ -948,7 +895,7 @@
}
@Test public void testValidateExec1() {
- helpValidate("EXEC pm1.sq1()", new String[] {}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpValidate("EXEC pm1.sq1()", new String[] {}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
// valid variable declared
@@ -962,7 +909,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpValidateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// validating criteria selector(on HAS CRITERIA), elements on it should be virtual group elements
@@ -979,7 +926,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpValidateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// validating Translate CRITERIA, elements on it should be virtual group elements
@@ -994,7 +941,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpValidateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// ROWS_UPDATED not assigned
@@ -1008,7 +955,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// validating AssignmentStatement, more than one project symbol on the
@@ -1024,7 +971,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// validating AssignmentStatement, more than one project symbol on the
@@ -1040,7 +987,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// TranslateCriteria on criteria of the if statement
@@ -1058,7 +1005,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpValidateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// INPUT ised in command
@@ -1073,7 +1020,7 @@
String userUpdateStr = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpValidateProcedure(procedure, userUpdateStr,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
@@ -1089,7 +1036,7 @@
String userQuery = "UPDATE vm1.g1 SET e1='x'"; //$NON-NLS-1$
helpFailProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
@@ -1106,7 +1053,7 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where e3= 1"; //$NON-NLS-1$
helpFailProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
@@ -1123,7 +1070,7 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where y like '%a' and e3= 1"; //$NON-NLS-1$
helpFailProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
@@ -1140,7 +1087,7 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where y= 1"; //$NON-NLS-1$
helpFailProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
@@ -1155,7 +1102,7 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where y= 1"; //$NON-NLS-1$
helpValidateProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
@@ -1170,7 +1117,7 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where y > 1"; //$NON-NLS-1$
helpFailProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
@@ -1185,7 +1132,7 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where e3 > 1"; //$NON-NLS-1$
helpValidateProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// virtual group elements used in procedure in if statement(TRANSLATE CRITERIA)
@@ -1200,7 +1147,7 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where y = 1"; //$NON-NLS-1$
helpValidateProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// using aggregate function within a procedure - defect #8394
@@ -1215,7 +1162,7 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where y = 1"; //$NON-NLS-1$
helpValidateProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
// assigning null values to known datatype variable
@@ -1230,7 +1177,7 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where y = 1"; //$NON-NLS-1$
helpValidateProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
@Test public void testDefect13643() {
@@ -1247,7 +1194,7 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where y = 1"; //$NON-NLS-1$
helpFailProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
@Test public void testValidHaving() {
@@ -1256,17 +1203,17 @@
"FROM bqt1.smalla " + //$NON-NLS-1$
"GROUP BY intnum " + //$NON-NLS-1$
"HAVING SUM(floatnum) > 1", //$NON-NLS-1$
- new String[] { }, FakeMetadataFactory.exampleBQTCached());
+ new String[] { }, RealMetadataFactory.exampleBQTCached());
}
@Test public void testValidHaving2() {
String sql = "SELECT intkey FROM bqt1.smalla WHERE intkey = 1 " + //$NON-NLS-1$
"GROUP BY intkey HAVING intkey = 1"; //$NON-NLS-1$
- helpValidate(sql, new String[] {}, FakeMetadataFactory.exampleBQTCached());
+ helpValidate(sql, new String[] {}, RealMetadataFactory.exampleBQTCached());
}
@Test public void testVirtualProcedure(){
- helpValidate("EXEC pm1.vsp1()", new String[] { }, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpValidate("EXEC pm1.vsp1()", new String[] { }, RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testSelectWithNoFrom() {
@@ -1283,7 +1230,7 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where y = 1"; //$NON-NLS-1$
helpValidateProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
/**
@@ -1300,7 +1247,7 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where y = 1"; //$NON-NLS-1$
helpFailProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
/**
@@ -1317,12 +1264,12 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where y = 1"; //$NON-NLS-1$
helpFailProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
@Test public void testSelectIntoPhysicalGroup() {
- helpValidate("SELECT e1, e2, e3, e4 INTO pm1.g1 FROM pm1.g2", new String[] { }, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpValidate("SELECT e1, e2, e3, e4 INTO pm1.g1 FROM pm1.g2", new String[] { }, RealMetadataFactory.example1Cached()); //$NON-NLS-1$
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
@@ -1333,7 +1280,7 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where y = 1"; //$NON-NLS-1$
helpValidateProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
@Test public void testSelectIntoPhysicalGroupNotUpdateable_Defect16857() {
@@ -1345,7 +1292,7 @@
}
@Test public void testInvalidSelectIntoTooManyElements() {
- helpValidate("SELECT e1, e2, e3, e4, 'val' INTO pm1.g1 FROM pm1.g2", new String[] {"SELECT e1, e2, e3, e4, 'val' INTO pm1.g1 FROM pm1.g2"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT e1, e2, e3, e4, 'val' INTO pm1.g1 FROM pm1.g2", new String[] {"SELECT e1, e2, e3, e4, 'val' INTO pm1.g1 FROM pm1.g2"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
@@ -1356,11 +1303,11 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where y = 1"; //$NON-NLS-1$
helpFailProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
@Test public void testInvalidSelectIntoTooFewElements() {
- helpValidate("SELECT e1, e2, e3 INTO pm1.g1 FROM pm1.g2", new String[] {"SELECT e1, e2, e3 INTO pm1.g1 FROM pm1.g2"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT e1, e2, e3 INTO pm1.g1 FROM pm1.g2", new String[] {"SELECT e1, e2, e3 INTO pm1.g1 FROM pm1.g2"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
@@ -1371,11 +1318,11 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where y = 1"; //$NON-NLS-1$
helpFailProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
@Test public void testInvalidSelectIntoIncorrectTypes() {
- helpValidate("SELECT e1, convert(e2, string), e3, e4 INTO pm1.g1 FROM pm1.g2", new String[] {"SELECT e1, convert(e2, string), e3, e4 INTO pm1.g1 FROM pm1.g2"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT e1, convert(e2, string), e3, e4 INTO pm1.g1 FROM pm1.g2", new String[] {"SELECT e1, convert(e2, string), e3, e4 INTO pm1.g1 FROM pm1.g2"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
@@ -1386,15 +1333,15 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where y = 1"; //$NON-NLS-1$
helpFailProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
@Test public void testSelectIntoWithStar() {
- helpResolve("SELECT * INTO pm1.g1 FROM pm1.g2", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpResolve("SELECT * INTO pm1.g1 FROM pm1.g2", RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testInvalidSelectIntoWithStar() {
- helpValidate("SELECT * INTO pm1.g1 FROM pm1.g2, pm1.g1", new String[] {"SELECT * INTO pm1.g1 FROM pm1.g2, pm1.g1"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT * INTO pm1.g1 FROM pm1.g2, pm1.g1", new String[] {"SELECT * INTO pm1.g1 FROM pm1.g2, pm1.g1"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
@@ -1405,11 +1352,11 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where y = 1"; //$NON-NLS-1$
helpFailProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
@Test public void testSelectIntoVirtualGroup() {
- helpValidate("SELECT e1, e2, e3, e4 INTO vm1.g1 FROM pm1.g2", new String[] {}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpValidate("SELECT e1, e2, e3, e4 INTO vm1.g1 FROM pm1.g2", new String[] {}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
@@ -1420,16 +1367,16 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where y = 1"; //$NON-NLS-1$
helpValidateProcedure(procedure, userQuery,
- FakeMetadataObject.Props.UPDATE_PROCEDURE);
+ Table.TriggerEvent.UPDATE);
}
@Test public void testVirtualProcedure2(){
- helpValidate("EXEC pm1.vsp13()", new String[] { }, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpValidate("EXEC pm1.vsp13()", new String[] { }, RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
//procedure that has another procedure in the transformation
@Test public void testVirtualProcedure3(){
- helpValidate("EXEC pm1.vsp27()", new String[] { }, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpValidate("EXEC pm1.vsp27()", new String[] { }, RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testNonEmbeddedSubcommand_defect11000() {
@@ -1438,13 +1385,13 @@
@Test public void testValidateObjectInComparison() throws Exception {
String sql = "SELECT IntKey FROM BQT1.SmallA WHERE ObjectValue = 5"; //$NON-NLS-1$
- ValidatorReport report = helpValidate(sql, new String[] {"ObjectValue = 5"}, FakeMetadataFactory.exampleBQTCached()); //$NON-NLS-1$
+ ValidatorReport report = helpValidate(sql, new String[] {"ObjectValue = 5"}, RealMetadataFactory.exampleBQTCached()); //$NON-NLS-1$
assertEquals("Expressions of type OBJECT, CLOB, BLOB, or XML cannot be used in comparison: ObjectValue = 5.", report.toString()); //$NON-NLS-1$
}
@Test public void testValidateAssignmentWithFunctionOnParameter_InServer() throws Exception{
String sql = "EXEC pm1.vsp36(5)"; //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
Command command = new QueryParser().parseCommand(sql);
QueryResolver.resolveCommand(command, metadata);
@@ -1455,7 +1402,7 @@
}
@Test public void testDefect9917() throws Exception{
- QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
String sql = "SELECT lookup('pm1.g1', 'e1a', 'e2', e2) AS x, lookup('pm1.g1', 'e4', 'e3', e3) AS y FROM pm1.g1"; //$NON-NLS-1$
Command command = new QueryParser().parseCommand(sql);
try{
@@ -1486,7 +1433,7 @@
}
@Test public void testDefect12107() throws Exception{
- QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
String sql = "SELECT SUM(DISTINCT lookup('pm1.g1', 'e2', 'e2', e2)) FROM pm1.g1"; //$NON-NLS-1$
Command command = helpResolve(sql, metadata);
sql = "SELECT SUM(DISTINCT lookup('pm1.g1', 'e3', 'e2', e2)) FROM pm1.g1"; //$NON-NLS-1$
@@ -1508,7 +1455,7 @@
@Test public void testValidateDynamicCommandWithNonTempGroup_InModeler() throws Exception{
// SQL is same as pm1.vsp36() in example1
String sql = "CREATE VIRTUAL PROCEDURE BEGIN execute string 'select ' || '1' as X integer into pm1.g3; END"; //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// Validate
ValidatorReport report = helpValidateInModeler("pm1.vsp36", sql, metadata); //$NON-NLS-1$
@@ -1518,7 +1465,7 @@
@Test public void testDynamicDupUsing() throws Exception {
String sql = "CREATE VIRTUAL PROCEDURE BEGIN execute string 'select ' || '1' as X integer into #temp using id=1, id=2; END"; //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// Validate
ValidatorReport report = helpValidateInModeler("pm1.vsp36", sql, metadata); //$NON-NLS-1$
@@ -1529,7 +1476,7 @@
@Test public void testValidateAssignmentWithFunctionOnParameter_InModeler() throws Exception{
// SQL is same as pm1.vsp36() in example1
String sql = "CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x; x = pm1.vsp36.param1 * 2; SELECT x; END"; //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// Validate
ValidatorReport report = helpValidateInModeler("pm1.vsp36", sql, metadata); //$NON-NLS-1$
@@ -1540,7 +1487,7 @@
String sql = "SELECT BQT1.SmallA.DateValue, BQT2.SmallB.ObjectValue FROM BQT1.SmallA, BQT2.SmallB " + //$NON-NLS-1$
"WHERE BQT1.SmallA.DateValue = BQT2.SmallB.DateValue AND BQT1.SmallA.ObjectValue = BQT2.SmallB.ObjectValue " + //$NON-NLS-1$
"AND BQT1.SmallA.IntKey < 30 AND BQT2.SmallB.IntKey < 30 ORDER BY BQT1.SmallA.DateValue"; //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
+ QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
// Validate
helpValidate(sql, new String[] {"BQT1.SmallA.ObjectValue = BQT2.SmallB.ObjectValue"}, metadata); //$NON-NLS-1$
@@ -1549,7 +1496,7 @@
@Test public void testDefect16772() throws Exception{
String sql = "CREATE VIRTUAL PROCEDURE BEGIN IF (pm1.vsp42.param1 > 0) SELECT 1 AS x; ELSE SELECT 0 AS x; END"; //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// Validate
ValidatorReport report = helpValidateInModeler("pm1.vsp42", sql, metadata); //$NON-NLS-1$
@@ -1558,7 +1505,7 @@
@Test public void testDefect14886() throws Exception{
String sql = "CREATE VIRTUAL PROCEDURE BEGIN END"; //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
Command command = new QueryParser().parseCommand(sql);
QueryResolver.resolveCommand(command, metadata);
@@ -1571,9 +1518,9 @@
@Test public void testDefect21389() throws Exception{
String sql = "CREATE VIRTUAL PROCEDURE BEGIN SELECT * INTO #temptable FROM pm1.g1; INSERT INTO #temptable (e1) VALUES ('a'); END"; //$NON-NLS-1$
- FakeMetadataFacade metadata = FakeMetadataFactory.example1();
- FakeMetadataObject e1 = metadata.getStore().findObject("pm1.g1.e1", FakeMetadataObject.ELEMENT); //$NON-NLS-1$
- e1.putProperty(FakeMetadataObject.Props.UPDATE, Boolean.FALSE);
+ TransformationMetadata metadata = RealMetadataFactory.example1();
+ Column c = metadata.getElementID("pm1.g1.e1"); //$NON-NLS-1$
+ c.setUpdatable(false);
Command command = new QueryParser().parseCommand(sql);
QueryResolver.resolveCommand(command, metadata);
@@ -1592,11 +1539,11 @@
}
@Test public void testInvalidLimit() {
- helpValidate("SELECT * FROM pm1.g1 LIMIT -5", new String[] {"LIMIT -5"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT * FROM pm1.g1 LIMIT -5", new String[] {"LIMIT -5"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testInvalidLimit_Offset() {
- helpValidate("SELECT * FROM pm1.g1 LIMIT -1, 100", new String[] {"LIMIT -1, 100"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT * FROM pm1.g1 LIMIT -1, 100", new String[] {"LIMIT -1, 100"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -1609,7 +1556,7 @@
*/
@Test public void testCase4237() {
- FakeMetadataFacade metadata = helpCreateCase4237VirtualProcedureMetadata();
+ QueryMetadataInterface metadata = helpCreateCase4237VirtualProcedureMetadata();
String sql = "CREATE VIRTUAL PROCEDURE BEGIN EXEC pm1.sp(vm1.sp.in1); END"; //$NON-NLS-1$
Command command = helpResolve(sql, new GroupSymbol("vm1.sp"), Command.TYPE_STORED_PROCEDURE, metadata);
@@ -1622,7 +1569,7 @@
*/
@Test public void testCase4237InlineView() {
- FakeMetadataFacade metadata = helpCreateCase4237VirtualProcedureMetadata();
+ QueryMetadataInterface metadata = helpCreateCase4237VirtualProcedureMetadata();
String sql = "CREATE VIRTUAL PROCEDURE BEGIN SELECT * FROM (EXEC pm1.sp(vm1.sp.in1)) AS FOO; END"; //$NON-NLS-1$
Command command = helpResolve(sql, new GroupSymbol("vm1.sp"), Command.TYPE_STORED_PROCEDURE, metadata);
@@ -1634,44 +1581,38 @@
* a virtual stored procedure which calls the physical one.
* @return
*/
- private FakeMetadataFacade helpCreateCase4237VirtualProcedureMetadata() {
- FakeMetadataObject physicalModel = FakeMetadataFactory.createPhysicalModel("pm1"); //$NON-NLS-1$
- FakeMetadataObject resultSet = FakeMetadataFactory.createResultSet("pm1.rs", physicalModel, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject returnParam = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, resultSet); //$NON-NLS-1$
- FakeMetadataObject inParam = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
- FakeMetadataObject storedProcedure = FakeMetadataFactory.createStoredProcedure("pm1.sp", physicalModel, Arrays.asList(new FakeMetadataObject[] { returnParam, inParam })); //$NON-NLS-1$ //$NON-NLS-2$
+ private TransformationMetadata helpCreateCase4237VirtualProcedureMetadata() {
+ MetadataStore metadataStore = new MetadataStore();
+ Schema physicalModel = RealMetadataFactory.createPhysicalModel("pm1", metadataStore); //$NON-NLS-1$
+ ColumnSet<Procedure> resultSet = RealMetadataFactory.createResultSet("pm1.rs", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ProcedureParameter inParam = RealMetadataFactory.createParameter("in", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
+ Procedure storedProcedure = RealMetadataFactory.createStoredProcedure("sp", physicalModel, Arrays.asList(inParam)); //$NON-NLS-1$ //$NON-NLS-2$
+ storedProcedure.setResultSet(resultSet);
- FakeMetadataObject virtualModel = FakeMetadataFactory.createVirtualModel("vm1"); //$NON-NLS-1$
- FakeMetadataObject virtualResultSet = FakeMetadataFactory.createResultSet("vm1.rs", physicalModel, new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FakeMetadataObject virtualReturnParam = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, virtualResultSet); //$NON-NLS-1$
- FakeMetadataObject virtualInParam = FakeMetadataFactory.createParameter("in1", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
+ Schema virtualModel = RealMetadataFactory.createVirtualModel("vm1", metadataStore); //$NON-NLS-1$
+ ColumnSet<Procedure> virtualResultSet = RealMetadataFactory.createResultSet("vm1.rs", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ProcedureParameter virtualInParam = RealMetadataFactory.createParameter("in1", ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING); //$NON-NLS-1$
QueryNode queryNode = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN EXEC pm1.sp(vm1.sp.in1); END"); //$NON-NLS-1$ //$NON-NLS-2$
- FakeMetadataObject virtualStoredProcedure = FakeMetadataFactory.createVirtualProcedure("vm1.sp", physicalModel, Arrays.asList(new FakeMetadataObject[] { virtualReturnParam, virtualInParam }), queryNode); //$NON-NLS-1$
-
- FakeMetadataStore store = new FakeMetadataStore();
- store.addObject(physicalModel);
- store.addObject(resultSet);
- store.addObject(storedProcedure);
- store.addObject(virtualModel);
- store.addObject(virtualResultSet);
- store.addObject(virtualStoredProcedure);
- return new FakeMetadataFacade(store);
+ Procedure virtualStoredProcedure = RealMetadataFactory.createVirtualProcedure("sp", virtualModel, Arrays.asList(virtualInParam), queryNode); //$NON-NLS-1$
+ virtualStoredProcedure.setResultSet(virtualResultSet);
+
+ return RealMetadataFactory.createTransformationMetadata(metadataStore, "case4237");
}
@Test public void testSelectIntoWithNull() {
- helpValidate("SELECT null, null, null, null INTO pm1.g1 FROM pm1.g2", new String[] {}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpValidate("SELECT null, null, null, null INTO pm1.g1 FROM pm1.g2", new String[] {}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testCreateWithNonSortablePrimaryKey() {
- QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
Command command = helpResolve("create local temporary table x (column1 string, column2 clob, primary key (column2))", metadata); //$NON-NLS-1$
- helpRunValidator(command, new String[] {"column2"}, FakeMetadataFactory.example1Cached());
+ helpRunValidator(command, new String[] {"column2"}, RealMetadataFactory.example1Cached());
}
@Test public void testDropNonTemporary() {
- QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
Command command = helpResolve("drop table pm1.g1", metadata); //$NON-NLS-1$
- helpRunValidator(command, new String[] {command.toString()}, FakeMetadataFactory.example1Cached());
+ helpRunValidator(command, new String[] {command.toString()}, RealMetadataFactory.example1Cached());
}
@Test public void testNestedContexts() {
@@ -1683,7 +1624,7 @@
}
@Test public void testInsertIntoVirtualWithQuery() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
Command command = helpResolve("insert into vm1.g1 select 1, 2, true, 3", metadata); //$NON-NLS-1$
ValidatorReport report = Validator.validate(command, metadata);
assertTrue(report.getItems().isEmpty());
@@ -1697,7 +1638,7 @@
.append("select column1 from x;\n") //$NON-NLS-1$
.append("END\n"); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// Validate
ValidatorReport report = helpValidateInModeler("pm1.vsp36", procedure.toString(), metadata); //$NON-NLS-1$
@@ -1711,7 +1652,7 @@
procedure += "select * from variables;\n"; //$NON-NLS-1$
procedure += "END\n"; //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
Command command = helpResolve(procedure, metadata);
helpRunValidator(command, new String[] {"variables"}, metadata); //$NON-NLS-1$
@@ -1758,12 +1699,12 @@
@Test public void testXpathValueValid_defect15088() {
String userSql = "SELECT xpathValue('<?xml version=\"1.0\" encoding=\"utf-8\" ?><a><b><c>test</c></b></a>', 'a/b/c')"; //$NON-NLS-1$
- helpValidate(userSql, new String[] {}, FakeMetadataFactory.exampleBQTCached());
+ helpValidate(userSql, new String[] {}, RealMetadataFactory.exampleBQTCached());
}
@Test public void testXpathValueInvalid_defect15088() throws Exception {
String userSql = "SELECT xpathValue('<?xml version=\"1.0\" encoding=\"utf-8\" ?><a><b><c>test</c></b></a>', '//*[local-name()=''bookName\"]')"; //$NON-NLS-1$
- helpValidate(userSql, new String[] {"xpathValue('<?xml version=\"1.0\" encoding=\"utf-8\" ?><a><b><c>test</c></b></a>', '//*[local-name()=''bookName\"]')"}, FakeMetadataFactory.exampleBQTCached());
+ helpValidate(userSql, new String[] {"xpathValue('<?xml version=\"1.0\" encoding=\"utf-8\" ?><a><b><c>test</c></b></a>', '//*[local-name()=''bookName\"]')"}, RealMetadataFactory.exampleBQTCached());
}
@Test public void testTextTableNegativeWidth() {
@@ -1779,84 +1720,84 @@
}
@Test public void testXMLNamespaces() {
- helpValidate("select xmlforest(xmlnamespaces(no default, default 'http://foo'), e1 as \"table\") from pm1.g1", new String[] {"XMLNAMESPACES(NO DEFAULT, DEFAULT 'http://foo')"}, FakeMetadataFactory.example1Cached());
+ helpValidate("select xmlforest(xmlnamespaces(no default, default 'http://foo'), e1 as \"table\") from pm1.g1", new String[] {"XMLNAMESPACES(NO DEFAULT, DEFAULT 'http://foo')"}, RealMetadataFactory.example1Cached());
}
@Test public void testXMLNamespacesReserved() {
- helpValidate("select xmlforest(xmlnamespaces('http://foo' as xmlns), e1 as \"table\") from pm1.g1", new String[] {"XMLNAMESPACES('http://foo' AS xmlns)"}, FakeMetadataFactory.example1Cached());
+ helpValidate("select xmlforest(xmlnamespaces('http://foo' as xmlns), e1 as \"table\") from pm1.g1", new String[] {"XMLNAMESPACES('http://foo' AS xmlns)"}, RealMetadataFactory.example1Cached());
}
@Test public void testXMLTablePassingMultipleContext() {
- helpValidate("select * from pm1.g1, xmltable('/' passing xmlparse(DOCUMENT '<a/>'), xmlparse(DOCUMENT '<b/>')) as x", new String[] {"XMLTABLE('/' PASSING XMLPARSE(DOCUMENT '<a/>'), XMLPARSE(DOCUMENT '<b/>')) AS x"}, FakeMetadataFactory.example1Cached());
+ helpValidate("select * from pm1.g1, xmltable('/' passing xmlparse(DOCUMENT '<a/>'), xmlparse(DOCUMENT '<b/>')) as x", new String[] {"XMLTABLE('/' PASSING XMLPARSE(DOCUMENT '<a/>'), XMLPARSE(DOCUMENT '<b/>')) AS x"}, RealMetadataFactory.example1Cached());
}
@Ignore("this is actually handled by saxon and will show up during resolving")
@Test public void testXMLTablePassingSameName() {
- helpValidate("select * from pm1.g1, xmltable('/' passing {x '<a/>'} as a, {x '<b/>'} as a) as x", new String[] {"xmltable('/' passing e1, e1 || 'x') as x"}, FakeMetadataFactory.example1Cached());
+ helpValidate("select * from pm1.g1, xmltable('/' passing {x '<a/>'} as a, {x '<b/>'} as a) as x", new String[] {"xmltable('/' passing e1, e1 || 'x') as x"}, RealMetadataFactory.example1Cached());
}
@Test public void testXMLTablePassingContextType() {
- helpValidate("select * from pm1.g1, xmltable('/' passing 2) as x", new String[] {"XMLTABLE('/' PASSING 2) AS x"}, FakeMetadataFactory.example1Cached());
+ helpValidate("select * from pm1.g1, xmltable('/' passing 2) as x", new String[] {"XMLTABLE('/' PASSING 2) AS x"}, RealMetadataFactory.example1Cached());
}
@Test public void testXMLTableMultipleOrdinals() {
- helpValidate("select * from pm1.g1, xmltable('/' passing XMLPARSE(DOCUMENT '<a/>') columns x for ordinality, y for ordinality) as x", new String[] {"XMLTABLE('/' PASSING XMLPARSE(DOCUMENT '<a/>') COLUMNS x FOR ORDINALITY, y FOR ORDINALITY) AS x"}, FakeMetadataFactory.example1Cached());
+ helpValidate("select * from pm1.g1, xmltable('/' passing XMLPARSE(DOCUMENT '<a/>') columns x for ordinality, y for ordinality) as x", new String[] {"XMLTABLE('/' PASSING XMLPARSE(DOCUMENT '<a/>') COLUMNS x FOR ORDINALITY, y FOR ORDINALITY) AS x"}, RealMetadataFactory.example1Cached());
}
@Test public void testXMLTableContextRequired() {
- helpValidate("select * from xmltable('/a/b' passing convert('<a/>', xml) as a columns x for ordinality, c integer path '.') as x", new String[] {"XMLTABLE('/a/b' PASSING convert('<a/>', xml) AS a COLUMNS x FOR ORDINALITY, c integer PATH '.') AS x"}, FakeMetadataFactory.example1Cached());
+ helpValidate("select * from xmltable('/a/b' passing convert('<a/>', xml) as a columns x for ordinality, c integer path '.') as x", new String[] {"XMLTABLE('/a/b' PASSING convert('<a/>', xml) AS a COLUMNS x FOR ORDINALITY, c integer PATH '.') AS x"}, RealMetadataFactory.example1Cached());
}
@Test public void testXMLQueryPassingContextType() {
- helpValidate("select xmlquery('/' passing 2)", new String[] {"XMLQUERY('/' PASSING 2)"}, FakeMetadataFactory.example1Cached());
+ helpValidate("select xmlquery('/' passing 2)", new String[] {"XMLQUERY('/' PASSING 2)"}, RealMetadataFactory.example1Cached());
}
@Test public void testQueryString() {
- helpValidate("select querystring('/', '1')", new String[] {"QUERYSTRING('/', '1')"}, FakeMetadataFactory.example1Cached());
+ helpValidate("select querystring('/', '1')", new String[] {"QUERYSTRING('/', '1')"}, RealMetadataFactory.example1Cached());
}
@Test public void testXmlNameValidation() throws Exception {
- helpValidate("select xmlelement(\":\")", new String[] {"XMLELEMENT(NAME \":\")"}, FakeMetadataFactory.example1Cached());
+ helpValidate("select xmlelement(\":\")", new String[] {"XMLELEMENT(NAME \":\")"}, RealMetadataFactory.example1Cached());
}
@Test public void testXmlParse() throws Exception {
- helpValidate("select xmlparse(content e2) from pm1.g1", new String[] {"XMLPARSE(CONTENT e2)"}, FakeMetadataFactory.example1Cached());
+ helpValidate("select xmlparse(content e2) from pm1.g1", new String[] {"XMLPARSE(CONTENT e2)"}, RealMetadataFactory.example1Cached());
}
@Test public void testDecode() throws Exception {
- helpValidate("select to_bytes(e1, '?') from pm1.g1", new String[] {"to_bytes(e1, '?')"}, FakeMetadataFactory.example1Cached());
+ helpValidate("select to_bytes(e1, '?') from pm1.g1", new String[] {"to_bytes(e1, '?')"}, RealMetadataFactory.example1Cached());
}
@Test public void testValidateXMLAGG() {
- helpValidate("SELECT XMLAGG(e1) from pm1.g1", new String[] {"XMLAGG(e1)"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT XMLAGG(e1) from pm1.g1", new String[] {"XMLAGG(e1)"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testValidateBooleanAgg() {
- helpValidate("SELECT EVERY(e1) from pm1.g1", new String[] {"EVERY(e1)"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT EVERY(e1) from pm1.g1", new String[] {"EVERY(e1)"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testValidateStatAgg() {
- helpValidate("SELECT stddev_pop(distinct e2) from pm1.g1", new String[] {"STDDEV_POP(DISTINCT e2)"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT stddev_pop(distinct e2) from pm1.g1", new String[] {"STDDEV_POP(DISTINCT e2)"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testValidateScalarSubqueryTooManyColumns() {
- helpValidate("SELECT e2, (SELECT e1, e2 FROM pm1.g1 WHERE e2 = '3') FROM pm1.g2", new String[] {"SELECT e1, e2 FROM pm1.g1 WHERE e2 = '3'"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT e2, (SELECT e1, e2 FROM pm1.g1 WHERE e2 = '3') FROM pm1.g2", new String[] {"SELECT e1, e2 FROM pm1.g1 WHERE e2 = '3'"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testInvalidIntoSubquery() {
- helpValidate("SELECT e2, (SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3') FROM pm1.g2", new String[] {"SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3'"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT e2, (SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3') FROM pm1.g2", new String[] {"SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3'"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testInvalidIntoSubquery1() {
- helpValidate("SELECT e2 FROM pm1.g2 WHERE EXISTS (SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3')", new String[] {"SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3'"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT e2 FROM pm1.g2 WHERE EXISTS (SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3')", new String[] {"SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3'"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testInvalidIntoSubquery2() {
- helpValidate("SELECT * FROM (SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3') x", new String[] {"SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3'"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT * FROM (SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3') x", new String[] {"SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3'"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testInvalidIntoSubquery3() {
- helpValidate("SELECT e2 FROM pm1.g2 WHERE e2 in (SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3')", new String[] {"SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3'"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpValidate("SELECT e2 FROM pm1.g2 WHERE e2 in (SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3')", new String[] {"SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3'"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testInvalidIntoSubquery4() throws Exception {
@@ -1865,7 +1806,7 @@
.append("loop on (SELECT e1, e2 INTO #x FROM pm1.g1 WHERE e2 = '3') as x\n") //$NON-NLS-1$
.append("BEGIN\nSELECT 1;\nEND\nSELECT 1\n;END\n"); //$NON-NLS-1$
- QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// Validate
ValidatorReport report = helpValidateInModeler("pm1.vsp36", procedure.toString(), metadata); //$NON-NLS-1$
@@ -1875,28 +1816,28 @@
@Test public void testDisallowUpdateOnMultisourceElement() throws Exception {
Set<String> models = new HashSet<String>();
models.add("pm1");
- ValidatorReport report = helpValidateInModeler("pm1.vsp36", "UPDATE PM1.G1 set SOURCE_NAME='blah'", new MultiSourceMetadataWrapper(FakeMetadataFactory.example1(), models)); //$NON-NLS-1$
+ ValidatorReport report = helpValidateInModeler("pm1.vsp36", "UPDATE PM1.G1 set SOURCE_NAME='blah'", new MultiSourceMetadataWrapper(RealMetadataFactory.example1(), models)); //$NON-NLS-1$
assertEquals(report.toString(), 1, report.getItems().size());
}
@Test public void testDisallowProjectIntoMultiSource() throws Exception {
Set<String> models = new HashSet<String>();
models.add("pm1");
- helpValidate("insert into pm1.g1 select * from pm1.g1", new String[] {"pm1.g1"}, new MultiSourceMetadataWrapper(FakeMetadataFactory.example1(), models)); //$NON-NLS-1$
+ helpValidate("insert into pm1.g1 select * from pm1.g1", new String[] {"pm1.g1"}, new MultiSourceMetadataWrapper(RealMetadataFactory.example1(), models)); //$NON-NLS-1$
}
@Test public void testTextAggEncoding() throws Exception {
- helpValidate("select textagg(for e1 encoding abc) from pm1.g1", new String[] {"TEXTAGG(FOR e1 ENCODING abc)"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpValidate("select textagg(for e1 encoding abc) from pm1.g1", new String[] {"TEXTAGG(FOR e1 ENCODING abc)"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testTextAggHeader() throws Exception {
- helpValidate("select textagg(for e1 || 1 HEADER) from pm1.g1", new String[] {"TEXTAGG(FOR (e1 || 1) HEADER)"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ helpValidate("select textagg(for e1 || 1 HEADER) from pm1.g1", new String[] {"TEXTAGG(FOR (e1 || 1) HEADER)"}, RealMetadataFactory.example1Cached()); //$NON-NLS-1$
}
@Test public void testMultiSourceProcValue() throws Exception {
Set<String> models = new HashSet<String>();
models.add("MultiModel");
- helpValidate("exec MultiModel.proc('a', (select 1))", new String[] {"MultiModel.proc.source_name"}, new MultiSourceMetadataWrapper(FakeMetadataFactory.exampleMultiBinding(), models)); //$NON-NLS-1$
+ helpValidate("exec MultiModel.proc('a', (select 1))", new String[] {"MultiModel.proc.source_name"}, new MultiSourceMetadataWrapper(RealMetadataFactory.exampleMultiBinding(), models)); //$NON-NLS-1$
}
}
Modified: branches/7.4.x/metadata/src/test/java/org/teiid/cdk/unittest/FakeTranslationFactory.java
===================================================================
--- branches/7.4.x/metadata/src/test/java/org/teiid/cdk/unittest/FakeTranslationFactory.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/metadata/src/test/java/org/teiid/cdk/unittest/FakeTranslationFactory.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -22,10 +22,18 @@
package org.teiid.cdk.unittest;
+import java.util.List;
+
import org.teiid.cdk.api.TranslationUtility;
-import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.metadata.Column;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Schema;
+import org.teiid.metadata.Table;
+import org.teiid.metadata.Column.SearchType;
+import org.teiid.query.unittest.RealMetadataFactory;
-
+@SuppressWarnings("nls")
public class FakeTranslationFactory {
private static FakeTranslationFactory instance = new FakeTranslationFactory();
@@ -35,15 +43,52 @@
}
public TranslationUtility getBQTTranslationUtility() {
- return new TranslationUtility(FakeMetadataFactory.exampleBQTCached());
+ return new TranslationUtility(RealMetadataFactory.exampleBQTCached());
}
public TranslationUtility getYahooTranslationUtility() {
- return new TranslationUtility(FakeMetadataFactory.exampleYahoo());
+ MetadataStore metadataStore = new MetadataStore();
+ // Create models
+ Schema yahoo = RealMetadataFactory.createPhysicalModel("Yahoo", metadataStore); //$NON-NLS-1$
+
+ // Create physical groups
+ Table quotes = RealMetadataFactory.createPhysicalGroup("Yahoo.QuoteServer", yahoo); //$NON-NLS-1$
+
+ // Create physical elements
+ String[] elemNames = new String[] {
+ "TickerSymbol", "LastTrade", //$NON-NLS-1$ //$NON-NLS-2$
+ "LastTradeDate", "LastTradeTime", //$NON-NLS-1$ //$NON-NLS-2$
+ "PercentageChange", "TickerSymbol2", //$NON-NLS-1$ //$NON-NLS-2$
+ "DaysHigh", "DaysLow", //$NON-NLS-1$ //$NON-NLS-2$
+ "TotalVolume" //$NON-NLS-1$
+ };
+ String[] elemTypes = new String[] {
+ DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.DOUBLE,
+ DataTypeManager.DefaultDataTypes.DATE, DataTypeManager.DefaultDataTypes.TIME,
+ DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.STRING,
+ DataTypeManager.DefaultDataTypes.DOUBLE, DataTypeManager.DefaultDataTypes.DOUBLE,
+ DataTypeManager.DefaultDataTypes.BIG_INTEGER
+ };
+
+ List<Column> cols = RealMetadataFactory.createElements(quotes, elemNames, elemTypes);
+
+ // Set name in source on each column
+ String[] nameInSource = new String[] {
+ "Symbol", "Last", "Date", "Time", "Change", "Symbol2", "High", "Low", "Volume"
+ };
+ for(int i=0; i<nameInSource.length; i++) {
+ cols.get(i).setNameInSource(nameInSource[i]);
+ }
+
+ // Set column-specific properties
+ cols.get(0).setSelectable(false);
+ cols.get(0).setSearchType(SearchType.Unsearchable);
+
+ return new TranslationUtility(RealMetadataFactory.createTransformationMetadata(metadataStore, "yahoo"));
}
public TranslationUtility getExampleTranslationUtility() {
- return new TranslationUtility(FakeMetadataFactory.example1Cached());
+ return new TranslationUtility(RealMetadataFactory.example1Cached());
}
}
Modified: branches/7.4.x/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java
===================================================================
--- branches/7.4.x/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java 2011-05-20 14:50:24 UTC (rev 3183)
+++ branches/7.4.x/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java 2011-05-20 14:54:26 UTC (rev 3184)
@@ -38,7 +38,6 @@
import org.teiid.query.parser.QueryParser;
import org.teiid.query.resolver.QueryResolver;
import org.teiid.query.sql.lang.Command;
-import org.teiid.query.unittest.FakeMetadataFactory;
import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.translator.ExecutionFactory;
@@ -50,7 +49,7 @@
vdbMetaData.setName(vdbName); //$NON-NLS-1$
vdbMetaData.setVersion(1);
for (Schema schema : metadataStore.getSchemas().values()) {
- vdbMetaData.addModel(FakeMetadataFactory.createModel(schema.getName(), schema.isPhysical()));
+ vdbMetaData.addModel(RealMetadataFactory.createModel(schema.getName(), schema.isPhysical()));
}
MetadataStoreGroup metaGroup = new MetadataStoreGroup();
metaGroup.addStore(metadataStore);
@@ -59,7 +58,7 @@
cmr.addConnectorManager("source", getConnectorManager("bqt1", "FakeTranslator", "FakeConnection", getFuncsOne()));
cmr.addConnectorManager("source2", getConnectorManager("bqt2", "FakeTranslator2", "FakeConnection2", getFuncsTwo()));
- CompositeVDB cvdb = new CompositeVDB(vdbMetaData, metaGroup, null, null, FakeMetadataFactory.SFM.getSystemFunctions(),cmr);
+ CompositeVDB cvdb = new CompositeVDB(vdbMetaData, metaGroup, null, null, RealMetadataFactory.SFM.getSystemFunctions(),cmr);
VDBMetaData vdb = cvdb.getVDB();
return vdb.getAttachment(TransformationMetadata.class);
}
13 years, 7 months
teiid SVN: r3183 - in branches/7.4.x: engine/src/main/java/org/teiid/query/metadata and 2 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-05-20 10:50:24 -0400 (Fri, 20 May 2011)
New Revision: 3183
Added:
branches/7.4.x/metadata/src/test/java/org/teiid/metadata/index/TestStagingTable.java
branches/7.4.x/metadata/src/test/resources/test.vdb
Modified:
branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/RuntimeMetadataImpl.java
branches/7.4.x/engine/src/main/java/org/teiid/query/metadata/CompositeMetadataStore.java
branches/7.4.x/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
Log:
TEIID-1597 fix for index metadata issues - not seen with fake metadata
Modified: branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/RuntimeMetadataImpl.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/RuntimeMetadataImpl.java 2011-05-20 14:46:55 UTC (rev 3182)
+++ branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/RuntimeMetadataImpl.java 2011-05-20 14:50:24 UTC (rev 3183)
@@ -79,7 +79,7 @@
}
public Table getGroup(Object groupId) throws QueryMetadataException, TeiidComponentException {
- if (!metadata.isVirtualGroup(groupId) && groupId instanceof Table) {
+ if (groupId instanceof Table && !metadata.isVirtualGroup(groupId)) {
return (Table)groupId;
}
return null;
Modified: branches/7.4.x/engine/src/main/java/org/teiid/query/metadata/CompositeMetadataStore.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/query/metadata/CompositeMetadataStore.java 2011-05-20 14:46:55 UTC (rev 3182)
+++ branches/7.4.x/engine/src/main/java/org/teiid/query/metadata/CompositeMetadataStore.java 2011-05-20 14:50:24 UTC (rev 3183)
@@ -146,7 +146,7 @@
public Collection<Table> getXMLTempGroups(Table tableRecord) {
ArrayList<Table> results = new ArrayList<Table>();
- String namePrefix = tableRecord.getFullName() + TransformationMetadata.DELIMITER_STRING;
+ String namePrefix = tableRecord.getName() + TransformationMetadata.DELIMITER_STRING;
for (Table table : tableRecord.getParent().getTables().values()) {
if (table.getTableType() == Type.XmlStagingTable && table.getName().startsWith(namePrefix)) {
results.add(table);
Modified: branches/7.4.x/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java 2011-05-20 14:46:55 UTC (rev 3182)
+++ branches/7.4.x/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java 2011-05-20 14:50:24 UTC (rev 3183)
@@ -269,6 +269,10 @@
return parent;
}
}
+ if(elementID instanceof ProcedureParameter) {
+ ProcedureParameter columnRecord = (ProcedureParameter) elementID;
+ return columnRecord.getParent();
+ }
throw createInvalidRecordTypeException(elementID);
}
Added: branches/7.4.x/metadata/src/test/java/org/teiid/metadata/index/TestStagingTable.java
===================================================================
--- branches/7.4.x/metadata/src/test/java/org/teiid/metadata/index/TestStagingTable.java (rev 0)
+++ branches/7.4.x/metadata/src/test/java/org/teiid/metadata/index/TestStagingTable.java 2011-05-20 14:50:24 UTC (rev 3183)
@@ -0,0 +1,40 @@
+/*
+ * 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.metadata.index;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.teiid.core.util.UnitTestUtil;
+import org.teiid.query.metadata.TransformationMetadata;
+
+@SuppressWarnings("nls")
+public class TestStagingTable {
+
+ @Test public void testStagingTables() throws Exception {
+ TransformationMetadata tm = VDBMetadataFactory.getVDBMetadata(UnitTestUtil.getTestDataPath() + "/test.vdb");
+
+ assertEquals(1, tm.getXMLTempGroups(tm.getGroupID("doc.newxmldocument")).size());
+ }
+
+}
Property changes on: branches/7.4.x/metadata/src/test/java/org/teiid/metadata/index/TestStagingTable.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/7.4.x/metadata/src/test/resources/test.vdb
===================================================================
(Binary files differ)
Property changes on: branches/7.4.x/metadata/src/test/resources/test.vdb
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
13 years, 7 months
teiid SVN: r3182 - branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-05-20 10:46:55 -0400 (Fri, 20 May 2011)
New Revision: 3182
Modified:
branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidationVisitor.java
Log:
TEIID-1595 added checks for implicit temp table create
Modified: branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidationVisitor.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidationVisitor.java 2011-05-19 19:15:52 UTC (rev 3181)
+++ branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidationVisitor.java 2011-05-20 14:46:55 UTC (rev 3182)
@@ -224,6 +224,10 @@
obj.getVariables(),
DataPolicy.PermissionType.CREATE,
Context.INSERT);
+
+ if (obj.getGroup().isTempTable()) {
+ validateTemp(Collections.singleton(obj.getGroup().getNonCorrelationName()), Arrays.asList(obj.getGroup()), Context.INSERT);
+ }
}
/**
@@ -270,6 +274,9 @@
Into intoObj = obj.getInto();
if ( intoObj != null ) {
GroupSymbol intoGroup = intoObj.getGroup();
+ if (intoGroup.isTempTable()) {
+ validateTemp(Collections.singleton(intoGroup.getNonCorrelationName()), Arrays.asList(intoGroup), Context.INSERT);
+ }
List<ElementSymbol> intoElements = null;
try {
intoElements = ResolverUtil.resolveElementsInGroup(intoGroup, getMetadata());
13 years, 7 months
teiid SVN: r3181 - branches/7.4.x/engine/src/main/java/org/teiid/query/metadata.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-05-19 15:15:52 -0400 (Thu, 19 May 2011)
New Revision: 3181
Modified:
branches/7.4.x/engine/src/main/java/org/teiid/query/metadata/CompositeMetadataStore.java
branches/7.4.x/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
Log:
TEIID-1593 fix for transformationmetadata hasprocedure
Modified: branches/7.4.x/engine/src/main/java/org/teiid/query/metadata/CompositeMetadataStore.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/query/metadata/CompositeMetadataStore.java 2011-05-18 20:11:01 UTC (rev 3180)
+++ branches/7.4.x/engine/src/main/java/org/teiid/query/metadata/CompositeMetadataStore.java 2011-05-19 19:15:52 UTC (rev 3181)
@@ -137,9 +137,6 @@
}
}
}
- if (result.isEmpty()) {
- throw new QueryMetadataException(name.substring(1)+TransformationMetadata.NOT_EXISTS_MESSAGE);
- }
return result;
}
Modified: branches/7.4.x/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java 2011-05-18 20:11:01 UTC (rev 3180)
+++ branches/7.4.x/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java 2011-05-19 19:15:52 UTC (rev 3181)
@@ -181,7 +181,7 @@
// I N T E R F A C E M E T H O D S
//==================================================================================
- public Object getElementID(final String elementName) throws TeiidComponentException, QueryMetadataException {
+ public Column getElementID(final String elementName) throws TeiidComponentException, QueryMetadataException {
int columnIndex = elementName.lastIndexOf(TransformationMetadata.DELIMITER_STRING);
if (columnIndex == -1) {
throw new QueryMetadataException(elementName+TransformationMetadata.NOT_EXISTS_MESSAGE);
@@ -299,7 +299,10 @@
Collection<StoredProcedureInfo> results = this.procedureCache.get(canonicalName);
if (results == null) {
- Collection<Procedure> procRecords = getMetadataStore().getStoredProcedure(canonicalName);
+ Collection<Procedure> procRecords = getMetadataStore().getStoredProcedure(canonicalName);
+ if (procRecords.isEmpty()) {
+ return null;
+ }
results = new ArrayList<StoredProcedureInfo>(procRecords.size());
for (Procedure procRecord : procRecords) {
String procedureFullName = procRecord.getFullName();
@@ -720,7 +723,7 @@
inputStream.close();
} catch(Exception e) {}
}
- return (MappingDocument)mappingDoc.clone();
+ return mappingDoc;
}
return null;
13 years, 7 months
teiid SVN: r3180 - in trunk/connectors/sandbox: coherence_connector and 15 other directories.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2011-05-18 16:11:01 -0400 (Wed, 18 May 2011)
New Revision: 3180
Added:
trunk/connectors/sandbox/coherence_connector/
trunk/connectors/sandbox/coherence_connector/lib/
trunk/connectors/sandbox/coherence_connector/pom.xml
trunk/connectors/sandbox/coherence_connector/readme.txt
trunk/connectors/sandbox/coherence_connector/src/
trunk/connectors/sandbox/coherence_connector/src/main/
trunk/connectors/sandbox/coherence_connector/src/main/java/
trunk/connectors/sandbox/coherence_connector/src/main/java/org/
trunk/connectors/sandbox/coherence_connector/src/main/java/org/teiid/
trunk/connectors/sandbox/coherence_connector/src/main/java/org/teiid/coherence/
trunk/connectors/sandbox/coherence_connector/src/main/java/org/teiid/coherence/connector/
trunk/connectors/sandbox/coherence_connector/src/main/java/org/teiid/coherence/connector/CoherenceConnection.java
trunk/connectors/sandbox/coherence_connector/src/main/java/org/teiid/coherence/connector/CoherenceConnectionImpl.java
trunk/connectors/sandbox/coherence_connector/src/main/java/org/teiid/coherence/connector/CoherenceManagedConnectionFactory.java
trunk/connectors/sandbox/coherence_translator/
trunk/connectors/sandbox/coherence_translator/pom.xml
trunk/connectors/sandbox/coherence_translator/readme.txt
trunk/connectors/sandbox/coherence_translator/src/
trunk/connectors/sandbox/coherence_translator/src/main/
trunk/connectors/sandbox/coherence_translator/src/main/java/
trunk/connectors/sandbox/coherence_translator/src/main/java/org/
trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/
trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/
trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/
trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/BaseID.java
trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/CoherenceExecution.java
trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/CoherenceExecutionFactory.java
trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/CoherenceVisitor.java
trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/Leg.java
trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/Trade.java
Log:
TEIID-1594 adding to the sandbox an example of accessing a Coherence cache
Added: trunk/connectors/sandbox/coherence_connector/pom.xml
===================================================================
--- trunk/connectors/sandbox/coherence_connector/pom.xml (rev 0)
+++ trunk/connectors/sandbox/coherence_connector/pom.xml 2011-05-18 20:11:01 UTC (rev 3180)
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>coherence_connector</artifactId>
+ <groupId>org.teiid.coherence.connector</groupId>
+ <name>Coherence Connector</name>
+ <version>0.1</version>
+ <packaging>rar</packaging>
+ <description>This connector reads data from Coherence.</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ <version>7.1.1.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ <version>7.1.1.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ <version>1.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>coherence</groupId>
+ <artifactId>coherence</artifactId>
+ <version>3.6.1</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/lib/coherence.jar</systemPath>
+ </dependency>
+
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <executions>
+ <execution>
+ <id>build_jar</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>deploy_jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <classifier>lib</classifier>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Property changes on: trunk/connectors/sandbox/coherence_connector/pom.xml
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added: svn:eol-style
+ LF
Added: trunk/connectors/sandbox/coherence_connector/readme.txt
===================================================================
--- trunk/connectors/sandbox/coherence_connector/readme.txt (rev 0)
+++ trunk/connectors/sandbox/coherence_connector/readme.txt 2011-05-18 20:11:01 UTC (rev 3180)
@@ -0,0 +1,27 @@
+connector readme
+
+The coherence_connector is an example of how an Oracle Coherence cache can be exposed for access by the coherence_translator.
+
+Setup:
+
+- add the coherence.jar to the coherence_connector/lib directory
+
+Coherence can be downloaded from: http://www.oracle.com/technetwork/middleware/coherence/downloads/index.html
+
+
+
+Build:
+
+run mvn clean install
+
+
+
+Deployment:
+
+deploy the following files to the jboss as server
+
+- copy target/coherence_connector-0.1.rar to server/<profile>/deploy/teiid directory
+- copy src/main/resources/coherence-ds.xml to server/<profile>/deploy directory
+- copy the coherence.jar to the <profile>/lib directory
+
+- see the coherence_translator for deployment
Property changes on: trunk/connectors/sandbox/coherence_connector/readme.txt
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added: svn:eol-style
+ LF
Added: trunk/connectors/sandbox/coherence_connector/src/main/java/org/teiid/coherence/connector/CoherenceConnection.java
===================================================================
--- trunk/connectors/sandbox/coherence_connector/src/main/java/org/teiid/coherence/connector/CoherenceConnection.java (rev 0)
+++ trunk/connectors/sandbox/coherence_connector/src/main/java/org/teiid/coherence/connector/CoherenceConnection.java 2011-05-18 20:11:01 UTC (rev 3180)
@@ -0,0 +1,13 @@
+package org.teiid.coherence.connector;
+
+import java.util.List;
+
+import javax.resource.ResourceException;
+
+
+public interface CoherenceConnection {
+
+ public List<Object> get(String criteria) throws ResourceException;
+
+
+}
Property changes on: trunk/connectors/sandbox/coherence_connector/src/main/java/org/teiid/coherence/connector/CoherenceConnection.java
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added: svn:eol-style
+ LF
Added: trunk/connectors/sandbox/coherence_connector/src/main/java/org/teiid/coherence/connector/CoherenceConnectionImpl.java
===================================================================
--- trunk/connectors/sandbox/coherence_connector/src/main/java/org/teiid/coherence/connector/CoherenceConnectionImpl.java (rev 0)
+++ trunk/connectors/sandbox/coherence_connector/src/main/java/org/teiid/coherence/connector/CoherenceConnectionImpl.java 2011-05-18 20:11:01 UTC (rev 3180)
@@ -0,0 +1,188 @@
+/*
+ * 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.coherence.connector;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.resource.ResourceException;
+
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.resource.spi.BasicConnection;
+
+import com.tangosol.net.CacheFactory;
+import com.tangosol.net.NamedCache;
+import com.tangosol.util.ConverterCollections;
+import com.tangosol.util.Filter;
+import com.tangosol.util.QueryHelper;
+
+/**
+ * Represents a connection to a Coherence data source.
+ */
+public class CoherenceConnectionImpl extends BasicConnection implements CoherenceConnection {
+
+ private NamedCache tradesCache = null;
+
+
+ public CoherenceConnectionImpl(CoherenceManagedConnectionFactory config) throws ResourceException {
+
+ tradesCache = CacheFactory.getCache(config.getCacheName());
+
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, "Coherence Connection has been newly created."); //$NON-NLS-1$
+ }
+
+ /**
+ * Close the connection, if a connection requires closing.
+ * (non-Javadoc)
+ */
+ @Override
+ public void close() {
+// LogManager.logDetail(LogConstants.CTX_CONNECTOR,"Coherence Connector has been closed."); //$NON-NLS-1$
+ }
+
+ /**
+ * Currently, this method always returns alive. We assume the connection is alive,
+ * and rely on proper timeout values to automatically clean up connections before
+ * any server-side timeout occurs. Rather than incur overhead by rebinding,
+ * we'll assume the connection is always alive, and throw an error when it is actually used,
+ * if the connection fails. This may be a more efficient way of handling failed connections,
+ * with the one tradeoff that stale connections will not be detected until execution time. In
+ * practice, there is no benefit to detecting stale connections before execution time.
+ *
+ * One possible extension is to implement a UnsolicitedNotificationListener.
+ * (non-Javadoc)
+ */
+ public boolean isAlive() {
+ LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Coherence Connection is alive."); //$NON-NLS-1$
+ return true;
+ }
+
+// original example getting the legs in a trade
+// public List<Leg> getLegs(List<Long> legIds) throws ResourceException {
+//
+// NamedCache tradesCache = CacheFactory.getCache("Trades");
+// Map legsMap = new HashMap();
+//
+// Leg leg = new Leg();
+// Set legsSet;
+// Map.Entry legsEntry;
+//
+// List<Leg> legs = new ArrayList<Leg>();
+//
+// Trade trade = null;
+// for (int i=1; i<=3; i++){
+// trade = (Trade)tradesCache.get(i);
+// legsMap = trade.getLegs();
+// legsSet = legsMap.entrySet();
+// Iterator k = legsSet.iterator();
+// while(k.hasNext()){
+// legsEntry = (Map.Entry)k.next();
+// leg = (Leg)legsEntry.getValue();
+// if (matchId(leg, legIds)) {
+//
+// System.out.print("Leg Id: " + leg.getId() + " , notional value: " + leg.getNotional() + "\n");
+// legs.add(leg);
+// }
+// }
+// }
+//
+// return legs;
+// }
+
+// private boolean matchId(BaseID baseID, List<Long> ids) {
+// Iterator<Long> it = ids.iterator();
+// while (it.hasNext()) {
+// Long id = it.next();
+// if (id.longValue() == baseID.getId()) return true;
+// }
+// return false;
+// }
+
+
+ // original example passing in ids to find
+// public List<Object> getTrades(List<Long> ids) throws ResourceException {
+//
+// List<Object> trades = new ArrayList();
+//
+// if (ids == null || ids.isEmpty()) {
+// trades.addAll(tradesCache.values());
+//
+// } else {
+//
+// String parm = null;
+// for (Iterator<Long> it = ids.iterator(); it.hasNext();) {
+// Long t = it.next();
+// if (parm != null) {
+// parm += ",";
+// }
+// parm = String.valueOf(t);
+//
+// }
+//
+// // filter wouldn't work until the long "L" indicater was added to
+// // the parm
+// // the examples showed using a float 7.0f
+// Filter filter = QueryHelper.createFilter("Id = " + parm + "l");
+//
+// Set mapResult = (Set) tradesCache.entrySet(filter);
+//
+// for (Iterator it = mapResult.iterator(); it.hasNext();) {
+// Map.Entry o = (Map.Entry) it.next();
+// trades.add(o.getValue());
+// }
+//
+// }
+//
+// return trades;
+//
+// }
+
+ public List<Object> get(String criteria) throws ResourceException {
+ List<Object> objects = null;
+ if (criteria == null || criteria.trim().length() == 0) {
+ objects = new ArrayList(tradesCache.size());
+ objects.addAll(tradesCache.values());
+ return objects;
+
+ }
+
+ objects = new ArrayList();
+ Filter filter = QueryHelper.createFilter(criteria);
+
+ Set<ConverterCollections.ConverterEntrySet> mapResult = (Set<ConverterCollections.ConverterEntrySet>) tradesCache
+ .entrySet(filter);
+
+ for (Iterator it = mapResult.iterator(); it.hasNext();) {
+ Map.Entry o = (Map.Entry) it.next();
+ objects.add(o.getValue());
+ }
+ return objects;
+
+ }
+
+
+}
Property changes on: trunk/connectors/sandbox/coherence_connector/src/main/java/org/teiid/coherence/connector/CoherenceConnectionImpl.java
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added: svn:eol-style
+ LF
Added: trunk/connectors/sandbox/coherence_connector/src/main/java/org/teiid/coherence/connector/CoherenceManagedConnectionFactory.java
===================================================================
--- trunk/connectors/sandbox/coherence_connector/src/main/java/org/teiid/coherence/connector/CoherenceManagedConnectionFactory.java (rev 0)
+++ trunk/connectors/sandbox/coherence_connector/src/main/java/org/teiid/coherence/connector/CoherenceManagedConnectionFactory.java 2011-05-18 20:11:01 UTC (rev 3180)
@@ -0,0 +1,56 @@
+/*
+ * 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.coherence.connector;
+
+import javax.resource.ResourceException;
+
+import org.teiid.resource.spi.BasicConnectionFactory;
+import org.teiid.resource.spi.BasicManagedConnectionFactory;
+
+public class CoherenceManagedConnectionFactory extends BasicManagedConnectionFactory {
+
+ private static final long serialVersionUID = -1832915223199053471L;
+
+ private String cacheName = "Trades";
+
+ @Override
+ public BasicConnectionFactory createConnectionFactory() throws ResourceException {
+ return new BasicConnectionFactory() {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public CoherenceConnectionImpl getConnection() throws ResourceException {
+ return new CoherenceConnectionImpl(CoherenceManagedConnectionFactory.this);
+ }
+ };
+ }
+
+ public String getCacheName() {
+ return cacheName;
+ }
+
+ public void setCacheName(String cachename) {
+ this.cacheName = cachename;
+ }
+
+}
Property changes on: trunk/connectors/sandbox/coherence_connector/src/main/java/org/teiid/coherence/connector/CoherenceManagedConnectionFactory.java
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added: svn:eol-style
+ LF
Added: trunk/connectors/sandbox/coherence_translator/pom.xml
===================================================================
--- trunk/connectors/sandbox/coherence_translator/pom.xml (rev 0)
+++ trunk/connectors/sandbox/coherence_translator/pom.xml 2011-05-18 20:11:01 UTC (rev 3180)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>coherence_translator</artifactId>
+ <groupId>org.teiid.coherence.translator</groupId>
+ <name>Coherence Translator</name>
+ <version>0.1</version>
+ <packaging>jar</packaging>
+ <description>This is the tranlator for a Coherence connector</description>
+
+ <dependencies>
+
+ <dependency>
+ <artifactId>coherence_connector</artifactId>
+ <groupId>org.teiid.coherence.connector</groupId>
+ <scope>compile</scope>
+ <classifier>lib</classifier>
+ <version>0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ <version>7.1.1.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ <version>7.1.1.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ <version>1.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>coherence</groupId>
+ <artifactId>coherence</artifactId>
+ <version>3.6.1</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../coherence_connector/lib/coherence.jar</systemPath>
+ </dependency>
+
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Property changes on: trunk/connectors/sandbox/coherence_translator/pom.xml
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added: svn:eol-style
+ LF
Added: trunk/connectors/sandbox/coherence_translator/readme.txt
===================================================================
--- trunk/connectors/sandbox/coherence_translator/readme.txt (rev 0)
+++ trunk/connectors/sandbox/coherence_translator/readme.txt 2011-05-18 20:11:01 UTC (rev 3180)
@@ -0,0 +1,43 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\margl1440\margr1440\vieww15400\viewh13820\viewkind0
+\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
+
+\f0\fs24 \cf0 translator readme\
+\
+The coherence_translator is very simple implementation of mapping a Coherence cache to relational sql request. This translator requires the deployment of the coherence_connector.\
+\
+This translator is coded to expect Trades and Legs to be in the cache. It was not generically implemented to handle any type of objects loaded into the cache. Feel free to rework it to make it better.\
+\
+\
+There is an example model (Coherence.xmi) and vdb (Coherence.vdb) that are located in the src/test/resources directory. These can be used as a example for modeling Coherence as a source.\
+\
+\
+BUILD:\
+---------\
+run mvn clean install\
+\
+\
+\
+DEPLOYMENT\
+--------------------\
+\
+setup \
+\
+ 1. see coherence_connector for deployment\
+ 2. deploy the Coherence.vdb from src/test/resources to the <profile>/deploy/ directory\
+ 3. copy the coherence_translator-0.1.jar to server/<profile>/deploy/teiid directory\
+ 4. restart server\
+\
+ NOTE: to preload a coherence cache with test data, build the coherence_translotr project, the junit tests will load the cache.\
+\
+ 5. use the teiid simpleclient example to run the following:\
+\
+ ./run.sh localhost 31000 Coherence "select * from trade"\
+\
+\
+Other notes:\
+- the coherence translator has the translator name of "coherence", which must match the translator defined in the vdb that's mapped to the Coherence source.\
+\
+}
\ No newline at end of file
Property changes on: trunk/connectors/sandbox/coherence_translator/readme.txt
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added: svn:eol-style
+ LF
Added: trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/BaseID.java
===================================================================
--- trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/BaseID.java (rev 0)
+++ trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/BaseID.java 2011-05-18 20:11:01 UTC (rev 3180)
@@ -0,0 +1,27 @@
+package org.teiid.coherence.translator;
+
+
+import java.io.Serializable;
+
+public abstract class BaseID implements Serializable {
+
+ private long id;
+
+ public BaseID() {
+ super();
+ }
+
+ public BaseID(long id) {
+ super();
+ this.id = id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+}
Property changes on: trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/BaseID.java
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added: svn:eol-style
+ LF
Added: trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/CoherenceExecution.java
===================================================================
--- trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/CoherenceExecution.java (rev 0)
+++ trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/CoherenceExecution.java 2011-05-18 20:11:01 UTC (rev 3180)
@@ -0,0 +1,153 @@
+/*
+ * ${license}
+ */
+package org.teiid.coherence.translator;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.resource.ResourceException;
+
+import org.teiid.coherence.connector.CoherenceConnection;
+import org.teiid.language.Select;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.metadata.RuntimeMetadata;
+import org.teiid.translator.DataNotAvailableException;
+import org.teiid.translator.ResultSetExecution;
+import org.teiid.translator.TranslatorException;
+
+
+
+/**
+ * Execution of a command. This may be select, update or procedure command.
+ */
+public class CoherenceExecution implements ResultSetExecution {
+
+ // Connector resources
+ private CoherenceExecutionFactory config;
+ private RuntimeMetadata metadata;
+ private Select query;
+ private List results;
+ private CoherenceConnection connection;
+
+ private Iterator resultsIt = null;
+
+ private List<Object> row;
+
+ public CoherenceExecution(Select query, RuntimeMetadata metadata, CoherenceConnection connection) {
+ this.metadata = metadata;
+ this.query = query;
+ this.connection = connection;
+ }
+
+ @Override
+ public void execute() throws TranslatorException {
+ // Log our command
+ LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Coherence executing command: " + query); //$NON-NLS-1$
+
+ // Build url
+ Map<String, List<Long>> targetArguments = translateQuery(query);
+
+ // Execute url to get results
+ this.results = executeQuery(targetArguments);
+ this.resultsIt = this.results.iterator();
+ }
+
+ private Map<String, List<Long>> translateQuery(Select query) throws TranslatorException {
+
+ CoherenceVisitor visitor = new CoherenceVisitor(metadata);
+ visitor.visitNode(query);
+
+ if(visitor.getException() != null) {
+ throw visitor.getException();
+ }
+ return visitor.getCriteria();
+
+ }
+
+ protected List executeQuery(Map<String, List<Long>> arguments)
+ throws TranslatorException {
+ List rows = new ArrayList();
+
+ String tablename = (String) arguments.keySet().iterator().next();
+ List<Long> args = arguments.get(tablename);
+
+ try {
+ String parm = null;
+ for (Iterator<Long> it = args.iterator(); it.hasNext();) {
+ Long t = it.next();
+ if (parm != null) {
+ parm += ",";
+ }
+ parm = String.valueOf(t + "l");
+
+ }
+
+ List<Object> trades = this.connection.get("Id in (" + parm + ")");
+ if (trades == null)
+ return rows;
+
+ List<Object> row = new ArrayList<Object>(trades.size());
+
+ for (Iterator<Object> it = trades.iterator(); it.hasNext();) {
+ Trade t = (Trade) it.next();
+
+ Map legsMap = t.getLegs();
+
+ Set legsSet = legsMap.entrySet();
+ Iterator k = legsSet.iterator();
+ while (k.hasNext()) {
+ Map.Entry legsEntry = (Map.Entry) k.next();
+ Leg leg = (Leg) legsEntry.getValue();
+
+ row = new ArrayList<Object>(3);
+
+ // the types loaded here must match @link{CoherenceExecutionFactory#getMetadata)
+ row.add(new Long(t.getId()));
+ row.add(new Long(leg.getId()));
+ row.add(new Double(leg.getNotional()));
+
+ rows.add(row);
+
+ }
+ }
+
+ return rows;
+
+ } catch (ResourceException re) {
+ re.printStackTrace();
+ }
+
+ return rows;
+ }
+
+
+
+
+ @Override
+ public List<?> next() throws TranslatorException, DataNotAvailableException {
+ // create and return one row at a time for your resultset.
+ if (resultsIt.hasNext()) {
+ return (List) resultsIt.next();
+ }
+
+ return null;
+ }
+
+
+ @Override
+ public void close() {
+ // TODO:cleanup your execution based resources here
+ }
+
+ @Override
+ public void cancel() throws TranslatorException {
+ //TODO: initiate the "abort" of execution
+ }
+
+
+}
Property changes on: trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/CoherenceExecution.java
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added: svn:eol-style
+ LF
Added: trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/CoherenceExecutionFactory.java
===================================================================
--- trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/CoherenceExecutionFactory.java (rev 0)
+++ trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/CoherenceExecutionFactory.java 2011-05-18 20:11:01 UTC (rev 3180)
@@ -0,0 +1,93 @@
+/*
+ * 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.coherence.translator;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import javax.resource.cci.ConnectionFactory;
+
+
+import org.teiid.coherence.connector.CoherenceConnection;
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.language.QueryExpression;
+import org.teiid.language.Select;
+import org.teiid.metadata.MetadataFactory;
+import org.teiid.metadata.RuntimeMetadata;
+import org.teiid.metadata.Table;
+import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.ExecutionFactory;
+import org.teiid.translator.ResultSetExecution;
+import org.teiid.translator.Translator;
+import org.teiid.translator.TranslatorException;
+
+
+@Translator(name="coherence", description="A translator for testing Coherence")
+public class CoherenceExecutionFactory extends ExecutionFactory<ConnectionFactory, CoherenceConnection> {
+
+
+ public static final int MAX_SET_SIZE = 100;
+
+ @Override
+ public void start() throws TranslatorException {
+ }
+
+ @Override
+ public ResultSetExecution createResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, CoherenceConnection connection)
+ throws TranslatorException {
+ return new CoherenceExecution((Select)command, metadata, connection);
+ }
+
+ public List getSupportedFunctions() {
+ return Collections.EMPTY_LIST;
+ }
+
+ public boolean supportsCompareCriteriaEquals() {
+ return true;
+ }
+
+ public boolean supportsInCriteria() {
+ return true;
+ }
+
+ public int getMaxInCriteriaSize() {
+ return MAX_SET_SIZE;
+ }
+
+ @Override
+ public boolean isSourceRequired() {
+ return false;
+ }
+
+ @Override
+ public void getMetadata(MetadataFactory metadataFactory,
+ CoherenceConnection conn) throws TranslatorException {
+ Table t = metadataFactory.addTable("Trade"); //$NON-NLS-1$
+ metadataFactory.addColumn("tradeid", DataTypeManager.DefaultDataTypes.LONG, t); //$NON-NLS-1$
+ metadataFactory.addColumn("legid", DataTypeManager.DefaultDataTypes.LONG, t); //$NON-NLS-1$
+ metadataFactory.addColumn("notational", DataTypeManager.DefaultDataTypes.DOUBLE, t); //$NON-NLS-1$
+ }
+
+
+}
Property changes on: trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/CoherenceExecutionFactory.java
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added: svn:eol-style
+ LF
Added: trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/CoherenceVisitor.java
===================================================================
--- trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/CoherenceVisitor.java (rev 0)
+++ trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/CoherenceVisitor.java 2011-05-18 20:11:01 UTC (rev 3180)
@@ -0,0 +1,121 @@
+/*
+ * 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.coherence.translator;
+
+import java.util.*;
+
+import org.teiid.language.*;
+import org.teiid.language.visitor.HierarchyVisitor;
+import org.teiid.metadata.RuntimeMetadata;
+import org.teiid.metadata.Table;
+import org.teiid.translator.TranslatorException;
+
+
+
+/**
+ */
+public class CoherenceVisitor extends HierarchyVisitor {
+
+ private String tableName = null;
+ private List<Long> ids = new ArrayList<Long>();
+ private RuntimeMetadata metadata;
+
+ private TranslatorException exception;
+
+ /**
+ *
+ */
+ public CoherenceVisitor(RuntimeMetadata metadata) {
+ super();
+ this.metadata = metadata;
+ }
+
+
+ public Map<String, List<Long>> getCriteria() {
+
+ Map<String, List<Long>> criteria = new HashMap<String, List<Long>>();
+ criteria.put(tableName, ids);
+
+ return criteria;
+ }
+
+ public TranslatorException getException() {
+ return this.exception;
+ }
+
+
+ public void visit(Select query) {
+ super.visit(query);
+ List<TableReference> tables = query.getFrom();
+ TableReference t = tables.get(0);
+ if(t instanceof NamedTable) {
+ Table group = ((NamedTable)t).getMetadataObject();
+ tableName = group.getName();
+ }
+
+ }
+
+
+ public void visit(Comparison obj) {
+ Expression expr = obj.getRightExpression();
+ addIdFromExpression(expr);
+ }
+
+ public void visit(In obj) {
+ List exprs = obj.getRightExpressions();
+ Iterator iter = exprs.iterator();
+ while(iter.hasNext()) {
+ Expression expr = (Expression) iter.next();
+ addIdFromExpression(expr);
+
+ }
+ }
+
+ private void addIdFromExpression(Expression expr) {
+ if(expr instanceof Literal) {
+ Long longparm = null;
+ Literal literal = (Literal) expr;
+ if(literal.getType() == String.class) {
+ String parm = (String) literal.getValue();
+
+ longparm = new Long(parm);
+
+ } else if (literal.getType() == Long.class) {
+ Object obj = literal.getValue();
+
+ longparm = ((Long)obj);
+
+
+ } else {
+ this.exception = new TranslatorException("CoherenceVisitor.Unexpected_type", literal.getType().getName()); //$NON-NLS-1$
+ }
+
+ ids.add(longparm);
+
+ } else {
+ this.exception = new TranslatorException("TickerCollectorVisitor.Unexpected_expression" + expr); //$NON-NLS-1$
+ }
+
+ }
+
+}
Property changes on: trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/CoherenceVisitor.java
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added: svn:eol-style
+ LF
Added: trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/Leg.java
===================================================================
--- trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/Leg.java (rev 0)
+++ trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/Leg.java 2011-05-18 20:11:01 UTC (rev 3180)
@@ -0,0 +1,28 @@
+package org.teiid.coherence.translator;
+
+import java.io.Serializable;
+
+
+public class Leg extends BaseID implements Serializable {
+
+ private static final long serialVersionUID = 7683272638393477962L;
+
+private double notional;
+
+ public Leg() {
+ super();
+ }
+
+ public Leg(long legId, double notional) {
+ super(legId);
+ this.notional = notional;
+ }
+
+ public void setNotional(double notional) {
+ this.notional = notional;
+ }
+
+ public double getNotional() {
+ return notional;
+ }
+}
Property changes on: trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/Leg.java
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added: svn:eol-style
+ LF
Added: trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/Trade.java
===================================================================
--- trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/Trade.java (rev 0)
+++ trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/Trade.java 2011-05-18 20:11:01 UTC (rev 3180)
@@ -0,0 +1,33 @@
+package org.teiid.coherence.translator;
+
+import java.io.Serializable;
+
+import java.util.Map;
+
+
+
+public class Trade extends BaseID implements Serializable {
+
+ private static final long serialVersionUID = 8611785625511714561L;
+
+private Map legs;
+
+ public Trade() {
+ super();
+ }
+
+ public Trade(long tradeId, Map legs) {
+ super(tradeId);
+ this.legs = legs;
+ }
+
+
+ public void setLegs(Map legs) {
+ this.legs = legs;
+ }
+
+ public Map getLegs() {
+ return legs;
+ }
+
+}
Property changes on: trunk/connectors/sandbox/coherence_translator/src/main/java/org/teiid/coherence/translator/Trade.java
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added: svn:eol-style
+ LF
13 years, 7 months
teiid SVN: r3179 - in branches/7.4.x: engine/src/main/java/org/teiid/query/processor/relational and 2 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-05-18 13:23:58 -0400 (Wed, 18 May 2011)
New Revision: 3179
Modified:
branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/events/jboss/JGroupsEventDistributor.java
branches/7.4.x/engine/src/main/java/org/teiid/query/processor/relational/SortNode.java
branches/7.4.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
Log:
TEIID-1592 corrections to ensure the eventdistributor is initialized correctly
Modified: branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/events/jboss/JGroupsEventDistributor.java
===================================================================
--- branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/events/jboss/JGroupsEventDistributor.java 2011-05-18 04:02:41 UTC (rev 3178)
+++ branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/events/jboss/JGroupsEventDistributor.java 2011-05-18 17:23:58 UTC (rev 3179)
@@ -45,6 +45,17 @@
public class JGroupsEventDistributor extends ReceiverAdapter implements Serializable {
+ private final class ProxyHandler implements InvocationHandler, Serializable {
+ private static final long serialVersionUID = 3879554695890338832L;
+
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable {
+ rpcDispatcher.callRemoteMethods(members, new MethodCall(method, args), GroupRequest.GET_NONE, 0);
+ return null;
+ }
+ }
+
private static final long serialVersionUID = -1140683411842561358L;
private transient JChannelFactory channelFactory;
@@ -107,15 +118,7 @@
channel = this.channelFactory.createMultiplexerChannel(this.multiplexerStack, null);
channel.connect(this.clusterName);
- proxyEventDistributor = (EventDistributor) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {EventDistributor.class}, new InvocationHandler() {
-
- @Override
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable {
- rpcDispatcher.callRemoteMethods(members, new MethodCall(method, args), GroupRequest.GET_NONE, 0);
- return null;
- }
- });
+ proxyEventDistributor = (EventDistributor) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {EventDistributor.class}, new ProxyHandler());
//wrap the local in a proxy to prevent unintended methods from being called
rpcDispatcher = new RpcDispatcher(channel, this, this, Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {EventDistributor.class}, new InvocationHandler() {
Modified: branches/7.4.x/engine/src/main/java/org/teiid/query/processor/relational/SortNode.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/query/processor/relational/SortNode.java 2011-05-18 04:02:41 UTC (rev 3178)
+++ branches/7.4.x/engine/src/main/java/org/teiid/query/processor/relational/SortNode.java 2011-05-18 17:23:58 UTC (rev 3179)
@@ -24,6 +24,7 @@
import static org.teiid.query.analysis.AnalysisRecord.*;
+import java.util.ArrayList;
import java.util.List;
import org.teiid.client.plan.PlanNode;
@@ -112,7 +113,10 @@
try {
while ((tuple = this.outputTs.nextTuple()) != null) {
//resize to remove unrelated columns
- addBatchRow(tuple.subList(0, this.getElements().size()));
+ if (this.getElements().size() < tuple.size()) {
+ tuple = new ArrayList<Object>(tuple.subList(0, this.getElements().size()));
+ }
+ addBatchRow(tuple);
if (this.isBatchFull()) {
return pullBatch();
}
Modified: branches/7.4.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2011-05-18 04:02:41 UTC (rev 3178)
+++ branches/7.4.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2011-05-18 17:23:58 UTC (rev 3179)
@@ -363,6 +363,7 @@
}
List<?> result = updateMatViewRow(globalStore, matTableName, tuple, delete);
if (result != null && eventDistributor != null) {
+ result = new ArrayList<Object>(result); //ensure the list is serializable
this.eventDistributor.updateMatViewRow(context.getVdbName(), context.getVdbVersion(), metadata.getName(metadata.getModelID(groupID)), metadata.getName(groupID), tuple, delete);
}
return CollectionTupleSource.createUpdateCountTupleSource(result != null ? 1 : 0);
Modified: branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-05-18 04:02:41 UTC (rev 3178)
+++ branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-05-18 17:23:58 UTC (rev 3179)
@@ -181,8 +181,8 @@
LogManager.logDetail(LogConstants.CTX_RUNTIME, ne, IntegrationPlugin.Util.getString("jndi_failed", new Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
}
}
+ this.dqpCore.setEventDistributor(this.eventDistributor);
this.dqpCore.start(this);
- this.dqpCore.getDataTierManager().setEventDistributor(this.eventDistributor);
// create the necessary services
createClientServices();
13 years, 7 months