[teiid-commits] teiid SVN: r3218 - in trunk: api/src/main/java/org/teiid and 97 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Sat Jun 4 21:32:16 EDT 2011


Author: shawkins
Date: 2011-06-04 21:32:10 -0400 (Sat, 04 Jun 2011)
New Revision: 3218

Added:
   trunk/client-jdk15/src/main/java/net/sf/retrotranslator/runtime/java/net/
   trunk/client-jdk15/src/main/java/net/sf/retrotranslator/runtime/java/net/_NetworkInterface.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLProjectionMinimizer.java
   trunk/engine/src/test/resources/text/cdm_dos_win.txt
   trunk/metadata/src/test/java/org/teiid/metadata/index/TestStagingTable.java
   trunk/metadata/src/test/resources/test.vdb
   trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestRelate.java
   trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestLocalConnections.java
   trunk/test-integration/common/src/test/resources/relate/
   trunk/test-integration/common/src/test/resources/relate/VehicleRentalsVDB.vdb
   trunk/test-integration/common/src/test/resources/relate/rentals.sql
   trunk/test-integration/common/src/test/resources/relate/test.zip
   trunk/test-integration/common/src/test/resources/relate/testCase3365.expected
   trunk/test-integration/common/src/test/resources/relate/testCase3365_compoundCritNestedTgt.expected
   trunk/test-integration/common/src/test/resources/relate/testCase3365_crit.expected
   trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrc.expected
   trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrcCombinationContext.expected
   trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrcContext.expected
   trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedTgt.expected
   trunk/test-integration/common/src/test/resources/relate/testSharesDoc.expected
   trunk/test-integration/common/src/test/resources/relate/testSharesDocEspaceQuestion3.expected
   trunk/test-integration/common/src/test/resources/relate/testSharesDocWithCritTgt.expected
   trunk/test-integration/common/src/test/resources/relate/testSharesDocWithCritTgtContext.expected
Removed:
   trunk/client-jdk15/src/main/java/net/sf/retrotranslator/runtime/java/net/_NetworkInterface.java
   trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleSpatialFunctions.java
   trunk/engine/src/main/java/org/teiid/query/processor/xml/JoinedWhileInstruction.java
   trunk/engine/src/test/java/org/teiid/query/unittest/FakeMetadataFacade.java
   trunk/engine/src/test/java/org/teiid/query/unittest/FakeMetadataFactory.java
   trunk/engine/src/test/java/org/teiid/query/unittest/FakeMetadataObject.java
   trunk/engine/src/test/java/org/teiid/query/unittest/FakeMetadataStore.java
   trunk/engine/src/test/resources/text/cdm_dos_win.txt
   trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestLocalConnections.java
   trunk/test-integration/common/src/test/resources/relate/VehicleRentalsVDB.vdb
   trunk/test-integration/common/src/test/resources/relate/rentals.sql
   trunk/test-integration/common/src/test/resources/relate/test.zip
   trunk/test-integration/common/src/test/resources/relate/testCase3365.expected
   trunk/test-integration/common/src/test/resources/relate/testCase3365_compoundCritNestedTgt.expected
   trunk/test-integration/common/src/test/resources/relate/testCase3365_crit.expected
   trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrc.expected
   trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrcCombinationContext.expected
   trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrcContext.expected
   trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedTgt.expected
   trunk/test-integration/common/src/test/resources/relate/testSharesDoc.expected
   trunk/test-integration/common/src/test/resources/relate/testSharesDocEspaceQuestion3.expected
   trunk/test-integration/common/src/test/resources/relate/testSharesDocWithCritTgt.expected
   trunk/test-integration/common/src/test/resources/relate/testSharesDocWithCritTgtContext.expected
Modified:
   trunk/api/pom.xml
   trunk/api/src/main/java/org/teiid/CommandContext.java
   trunk/api/src/main/java/org/teiid/logging/AuditMessage.java
   trunk/api/src/main/java/org/teiid/logging/LogManager.java
   trunk/api/src/main/java/org/teiid/logging/LogMessage.java
   trunk/api/src/main/java/org/teiid/metadata/Table.java
   trunk/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java
   trunk/api/src/main/java/org/teiid/translator/ExecutionContext.java
   trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java
   trunk/api/src/test/java/org/teiid/logging/TestLogManager.java
   trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
   trunk/build/kits/jboss-container/teiid-releasenotes.html
   trunk/cache-jbosscache/src/main/java/org/teiid/events/jboss/JGroupsEventDistributor.java
   trunk/client/src/main/java/org/teiid/adminapi/Session.java
   trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java
   trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java
   trunk/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java
   trunk/client/src/main/java/org/teiid/jdbc/EmbeddedProfile.java
   trunk/client/src/main/java/org/teiid/jdbc/JDBCURL.java
   trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java
   trunk/client/src/main/java/org/teiid/net/TeiidURL.java
   trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnectionFactory.java
   trunk/client/src/test/java/org/teiid/jdbc/TestStatement.java
   trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java
   trunk/common-core/src/main/java/org/teiid/core/util/PropertiesUtils.java
   trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
   trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/IngresExecutionFactory.java
   trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/intersyscache/InterSystemsCacheExecutionFactory.java
   trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/ModeShapeExecutionFactory.java
   trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java
   trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/teradata/TeradataExecutionFactory.java
   trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/TranslationHelper.java
   trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java
   trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/sqlserver/TestSqlServerConversionVisitor.java
   trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/teradata/TestTeradataTranslator.java
   trunk/connectors/translator-ldap/src/test/java/org/teiid/translator/ldap/TestIQueryToLdapSearchParser.java
   trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/SalesForceExecutionFactory.java
   trunk/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java
   trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml
   trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-extensions.xml
   trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/odbc.xml
   trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/ssl.xml
   trunk/documentation/developer-guide/src/main/docbook/en-US/content/logging.xml
   trunk/documentation/developer-guide/src/main/docbook/en-US/content/udf.xml
   trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml
   trunk/documentation/reference/src/main/docbook/en-US/content/sql_support.xml
   trunk/engine/src/main/java/org/teiid/common/buffer/BlockedException.java
   trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorManager.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorWorkItem.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/ExecutionContextImpl.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/RuntimeMetadataImpl.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/AbstractWorkItem.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidationVisitor.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidator.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataRoleAuthorizationValidator.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/PreparedStatementRequest.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
   trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java
   trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingAttribute.java
   trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingBaseNode.java
   trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingCriteriaNode.java
   trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingDocument.java
   trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingElement.java
   trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingNode.java
   trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingNodeConstants.java
   trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingOutputter.java
   trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingRecursiveElement.java
   trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingVisitor.java
   trunk/engine/src/main/java/org/teiid/query/mapping/xml/ResultSetInfo.java
   trunk/engine/src/main/java/org/teiid/query/metadata/CompositeMetadataStore.java
   trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataAdapter.java
   trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataID.java
   trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/capabilities/BasicSourceCapabilities.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/capabilities/SourceCapabilities.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/NodeConstants.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CapabilitiesUtil.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleChooseDependent.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleImplementJoinStrategy.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleMergeCriteria.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlaceAccess.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlanJoins.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/xml/ContextReplacerVisitor.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/xml/CriteriaPlanner.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/xml/MarkExcludeVisitor.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/xml/NameInSourceResolverVisitor.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/xml/SourceNodePlannerVisitor.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/xml/ValidateMappedCriteriaVisitor.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLNodeMappingVisitor.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanToProcessVisitor.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanner.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLQueryPlanner.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLStagaingQueryPlanner.java
   trunk/engine/src/main/java/org/teiid/query/parser/SQLParserUtil.java
   trunk/engine/src/main/java/org/teiid/query/processor/relational/AccessNode.java
   trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java
   trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentValueSource.java
   trunk/engine/src/main/java/org/teiid/query/processor/relational/EnhancedSortMergeJoinStrategy.java
   trunk/engine/src/main/java/org/teiid/query/processor/relational/JoinNode.java
   trunk/engine/src/main/java/org/teiid/query/processor/relational/ProjectIntoNode.java
   trunk/engine/src/main/java/org/teiid/query/processor/relational/SortNode.java
   trunk/engine/src/main/java/org/teiid/query/processor/relational/UnionAllNode.java
   trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLContext.java
   trunk/engine/src/main/java/org/teiid/query/resolver/command/InsertResolver.java
   trunk/engine/src/main/java/org/teiid/query/resolver/command/SimpleQueryResolver.java
   trunk/engine/src/main/java/org/teiid/query/resolver/command/XMLQueryResolver.java
   trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverUtil.java
   trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
   trunk/engine/src/main/java/org/teiid/query/sql/LanguageObject.java
   trunk/engine/src/main/java/org/teiid/query/sql/lang/ArrayTable.java
   trunk/engine/src/main/java/org/teiid/query/sql/lang/ExistsCriteria.java
   trunk/engine/src/main/java/org/teiid/query/sql/lang/FromClause.java
   trunk/engine/src/main/java/org/teiid/query/sql/lang/JoinPredicate.java
   trunk/engine/src/main/java/org/teiid/query/sql/lang/Select.java
   trunk/engine/src/main/java/org/teiid/query/sql/lang/SubqueryFromClause.java
   trunk/engine/src/main/java/org/teiid/query/sql/lang/TableFunctionReference.java
   trunk/engine/src/main/java/org/teiid/query/sql/lang/TextTable.java
   trunk/engine/src/main/java/org/teiid/query/sql/lang/UnaryFromClause.java
   trunk/engine/src/main/java/org/teiid/query/sql/lang/XMLTable.java
   trunk/engine/src/main/java/org/teiid/query/sql/util/ValueIteratorSource.java
   trunk/engine/src/main/java/org/teiid/query/sql/visitor/PredicateCollectorVisitor.java
   trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java
   trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
   trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java
   trunk/engine/src/main/java/org/teiid/security/Credentials.java
   trunk/engine/src/main/resources/org/teiid/query/i18n.properties
   trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestConnectorWorkItem.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestElementImpl.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestGroupImpl.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestInsertImpl.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestMetadataFactory.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TstLanguageBridgeFactory.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestAuthorizationValidationVisitor.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCallableStatement.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestConnectorCapabilitiesFinder.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestWorkItemState.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceElementReplacementVisitor.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceMetadataWrapper.java
   trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java
   trunk/engine/src/test/java/org/teiid/query/function/TestFunctionLibrary.java
   trunk/engine/src/test/java/org/teiid/query/function/TestFunctionTree.java
   trunk/engine/src/test/java/org/teiid/query/function/TestResolvedFunctions.java
   trunk/engine/src/test/java/org/teiid/query/mapping/xml/TestMappingElement.java
   trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestAccessPatterns.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestAnsiJoinPushdown.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestBatchedUpdatePlanner.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestExpressionsInGroupBy.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestInlineView.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestJoinOptimization.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestJoinPushdownRestrictions.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptionalJoins.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestPartitionedJoinPlanning.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestRuleMergeVirtual.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestRuleRaiseNull.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestRuleRemoveSorts.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestSortOptimization.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestStoredProcedurePlanning.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/proc/TestProcedurePlanner.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/relational/TestAliasGenerator.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCalculateCostUtil.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCapabilitiesUtil.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCriteriaCapabilityValidatorVisitor.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleAssignOutputElements.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleChooseDependent.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePlaceAccess.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePushSelectCriteria.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleValidateWhereAll.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestMarkExcludeVisitor.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestNameInSourceResolverVisitor.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLNodeMappingVisitor.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLPlanner.java
   trunk/engine/src/test/java/org/teiid/query/parser/TestOptionsAndHints.java
   trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java
   trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java
   trunk/engine/src/test/java/org/teiid/query/processor/FakeDataStore.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestJoinWithFunction.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestOptionalJoins.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestOrderByProcessing.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestSecurityFunctions.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestSetProcessing.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestTempTables.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestTextTable.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestVirtualDepJoin.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestWithClauseProcessing.java
   trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java
   trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
   trunk/engine/src/test/java/org/teiid/query/processor/relational/TestAccessNode.java
   trunk/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java
   trunk/engine/src/test/java/org/teiid/query/processor/relational/TestGroupingNode.java
   trunk/engine/src/test/java/org/teiid/query/processor/relational/TestJoinNode.java
   trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectNode.java
   trunk/engine/src/test/java/org/teiid/query/processor/relational/TestSelectNode.java
   trunk/engine/src/test/java/org/teiid/query/processor/xml/TestInstructions.java
   trunk/engine/src/test/java/org/teiid/query/processor/xml/TestSourceNodeGenaratorVisitor.java
   trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLPlanningEnhancements.java
   trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java
   trunk/engine/src/test/java/org/teiid/query/resolver/TestFunctionResolving.java
   trunk/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java
   trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java
   trunk/engine/src/test/java/org/teiid/query/resolver/TestXMLResolver.java
   trunk/engine/src/test/java/org/teiid/query/rewriter/TestOrderByRewrite.java
   trunk/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java
   trunk/engine/src/test/java/org/teiid/query/sql/util/TestElementSymbolOptimizer.java
   trunk/engine/src/test/java/org/teiid/query/sql/visitor/TestEvaluatableVisitor.java
   trunk/engine/src/test/java/org/teiid/query/sql/visitor/TestSQLStringVisitor.java
   trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
   trunk/engine/src/test/java/org/teiid/query/validator/TestUpdateValidator.java
   trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java
   trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
   trunk/metadata/src/test/java/org/teiid/cdk/api/TranslationUtility.java
   trunk/metadata/src/test/java/org/teiid/cdk/unittest/FakeTranslationFactory.java
   trunk/runtime/src/main/java/org/teiid/odbc/ODBCClientRemote.java
   trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
   trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
   trunk/runtime/src/main/java/org/teiid/services/TeiidLoginContext.java
   trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java
   trunk/runtime/src/main/java/org/teiid/transport/ODBCSocketListener.java
   trunk/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java
   trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
   trunk/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java
   trunk/test-integration/common/pom.xml
   trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestCrossSourceStarJoin.java
   trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java
   trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
   trunk/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java
Log:
forward merge of 7.4.1

Modified: trunk/api/pom.xml
===================================================================
--- trunk/api/pom.xml	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/api/pom.xml	2011-06-05 01:32:10 UTC (rev 3218)
@@ -7,8 +7,8 @@
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>teiid-api</artifactId>
-  <name>Teiid Translator API</name>
-  <description>API for creating Translators and other common extenders in Teiid</description>
+  <name>Teiid API</name>
+  <description>API for creating Translators and other extensions to Teiid</description>
   
   <dependencies>
     <dependency>
@@ -19,6 +19,12 @@
     
     <dependency>
       <groupId>org.jboss.teiid</groupId>
+      <artifactId>teiid-client</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.teiid</groupId>
       <artifactId>teiid-common-core</artifactId>
       <type>test-jar</type>
       <scope>test</scope>

Modified: trunk/api/src/main/java/org/teiid/CommandContext.java
===================================================================
--- trunk/api/src/main/java/org/teiid/CommandContext.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/api/src/main/java/org/teiid/CommandContext.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -22,35 +22,100 @@
 
 package org.teiid;
 
+import java.io.Serializable;
 import java.util.Properties;
 import java.util.TimeZone;
 
 import javax.security.auth.Subject;
 
+import org.teiid.adminapi.Session;
+
 /**
  * Context information for the currently executing command.
  * Can be used as an argument to UDFs.
  */
 public interface CommandContext {
 	
+	/**
+	 * Get the current user name
+	 * @return
+	 */
 	String getUserName();
 	
+	/**
+	 * Get the current vdb name
+	 * @return
+	 */
 	String getVdbName();
 	
+	/**
+	 * Get the current vdb version
+	 * @return
+	 */
 	int getVdbVersion();
 	
+	/**
+	 * Get the connection id
+	 * @return
+	 */
 	String getConnectionID();
 	
+	/**
+	 * Get the environment properties.  The returned properties are associated only with the currently executing command.
+	 * The only built-in key/value in the properties is the key "sessionid" with the same value as getConnectionID()
+	 * @return
+	 * @deprecated
+	 */
 	Properties getEnvironmentProperties();
 	
+	/**
+	 * Get the next random double value 
+	 * @return
+	 */
 	double getNextRand();
 	
+	/**
+	 * Sets the seed value and returns the next random double value.  
+	 * Additional calls to {@link #getNextRand()} will be based upon the seed value.
+	 * @param seed
+	 * @return
+	 */
 	double getNextRand(long seed);
 	
+	/**
+	 * Get the processor batch size set on the BufferManager
+	 * @return
+	 */
 	int getProcessorBatchSize();
 	
+	/**
+	 * Get the server {@link TimeZone}
+	 * @return
+	 */
 	TimeZone getServerTimeZone();
 	
+	/**
+	 * Get the current subject
+	 * @return
+	 */
 	Subject getSubject();
 
+	/**
+	 * Get the current session
+	 * @return
+	 */
+	Session getSession();
+
+	/**
+	 * Get the current command payload
+	 * @return may be null if the client did not set a payload
+	 */
+	Serializable getCommandPayload();
+
+	/**
+	 * Get the current request id 
+	 * @return
+	 */
+	String getRequestId();
+
 }

Modified: trunk/api/src/main/java/org/teiid/logging/AuditMessage.java
===================================================================
--- trunk/api/src/main/java/org/teiid/logging/AuditMessage.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/api/src/main/java/org/teiid/logging/AuditMessage.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -24,20 +24,22 @@
 
 import java.util.Arrays;
 
+import org.teiid.CommandContext;
+
 /**
  * Log format for auditing.
  */
 public class AuditMessage {
 	private String context;
 	private String activity;
-	private String principal;
-	private Object[] resources;
+	private String[] resources;
+	private CommandContext commandContext;
 
-	public AuditMessage(String context, String activity, String principal, String[] resources ) {
+	public AuditMessage(String context, String activity, String[] resources, CommandContext commandContext) {
 	    this.context = context;
 	    this.activity = activity;
-	    this.principal = principal;
 	    this.resources = resources;
+	    this.commandContext = commandContext;
 	}
 
     public String getContext() {
@@ -49,15 +51,20 @@
     }
 
     public String getPrincipal() {
-        return this.principal;
+        return this.commandContext.getUserName();
     }
 
-	public Object[] getResources() {
+	public String[] getResources() {
 		return this.resources;
 	}
-
+	
+	public CommandContext getCommandContext() {
+		return commandContext;
+	}
+	
 	public String toString() {
         StringBuffer msg = new StringBuffer();
+        msg.append( this.commandContext.getRequestId());
         msg.append(" ["); //$NON-NLS-1$
         msg.append( getPrincipal() );
         msg.append("] <"); //$NON-NLS-1$

Modified: trunk/api/src/main/java/org/teiid/logging/LogManager.java
===================================================================
--- trunk/api/src/main/java/org/teiid/logging/LogManager.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/api/src/main/java/org/teiid/logging/LogManager.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -351,6 +351,9 @@
 		if (!isMessageToBeRecorded(context, msgLevel)) {
 			return;
 		} 
+		if (message != null && message.getClass().isArray()) {
+			message = new LogMessage((Object[]) message);
+		}
     	logListener.log(msgLevel, context, e, message);
     }
 
@@ -383,7 +386,7 @@
 		if (msgParts == null || msgParts.length == 0 || !isMessageToBeRecorded(context, level)) {
 			return;
 		} 
-		logListener.log(level, context, new LogMessage(msgParts));
+		logListener.log(level, context, msgParts.length == 1? msgParts[0] : new LogMessage(msgParts));
     }
 
     


Property changes on: trunk/api/src/main/java/org/teiid/logging/LogManager.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Modified: trunk/api/src/main/java/org/teiid/logging/LogMessage.java
===================================================================
--- trunk/api/src/main/java/org/teiid/logging/LogMessage.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/api/src/main/java/org/teiid/logging/LogMessage.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -27,6 +27,8 @@
 
 public class LogMessage implements Serializable{
 
+	private static final long serialVersionUID = -134503344442009940L;
+	
 	private Object[] msgParts;
 
 	public LogMessage(Object[] msgParts) {

Modified: trunk/api/src/main/java/org/teiid/metadata/Table.java
===================================================================
--- trunk/api/src/main/java/org/teiid/metadata/Table.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/api/src/main/java/org/teiid/metadata/Table.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -23,8 +23,10 @@
 package org.teiid.metadata;
 
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 
 import org.teiid.core.types.DataTypeManager;
 import org.teiid.metadata.AbstractMetadataRecord.DataModifiable;
@@ -80,6 +82,8 @@
 	private transient long lastModified;
 	private transient long lastDataModification;
 	
+	private transient Map<Class<?>, Object> attachments;
+	
     public List<String> getBindings() {
 		return bindings;
 	}
@@ -333,4 +337,46 @@
 		this.updatePlanEnabled = updatePlanEnabled;
 	}
 	
+   /**
+    * Add attachment
+    *
+    * @param <T> the expected type
+    * @param attachment the attachment
+    * @param type the type
+    * @return any previous attachment
+    * @throws IllegalArgumentException for a null name, attachment or type
+    * @throws UnsupportedOperationException when not supported by the implementation
+    */	
+	synchronized public <T> T addAttchment(Class<T> type, T attachment) {
+      if (type == null)
+          throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
+      if (this.attachments == null) {
+    	  this.attachments = new HashMap<Class<?>, Object>();
+      }
+      Object result = this.attachments.put(type, attachment);
+      if (result == null)
+         return null;
+      return type.cast(result);
+	}
+	
+   /**
+    * Get attachment
+    * 
+    * @param <T> the expected type
+    * @param type the type
+    * @return the attachment or null if not present
+    * @throws IllegalArgumentException for a null name or type
+    */
+	synchronized public <T> T getAttachment(Class<T> type) {
+      if (type == null)
+          throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
+      if (this.attachments == null) {
+    	  return null;
+      }
+      Object result = this.attachments.get(type.getName());
+      if (result == null)
+         return null;
+      return type.cast(result);      
+   }
+	
 }
\ No newline at end of file


Property changes on: trunk/api/src/main/java/org/teiid/metadata/Table.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Modified: trunk/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java
===================================================================
--- trunk/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -111,9 +111,8 @@
 		return delegate.createUpdateExecution(command, executionContext,
 				metadata, connection);
 	}
-	@Override
-	public C getConnection(F factory) throws TranslatorException {
-		return delegate.getConnection(factory);
+	public C getConnection(F factory, ExecutionContext executionContext) throws TranslatorException {
+		return delegate.getConnection(factory, executionContext);
 	}
 	@Override
 	public NullOrder getDefaultNullOrder() {

Modified: trunk/api/src/main/java/org/teiid/translator/ExecutionContext.java
===================================================================
--- trunk/api/src/main/java/org/teiid/translator/ExecutionContext.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/api/src/main/java/org/teiid/translator/ExecutionContext.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -26,8 +26,10 @@
 
 import javax.security.auth.Subject;
 
+import org.teiid.adminapi.Session;
 
 
+
 /**
  * The security context provides information about the user context in which
  * this query is being run.
@@ -138,4 +140,10 @@
      * @return
      */
     boolean isTransactional();
+    
+    /**
+     * Get the current session.
+     * @return
+     */
+    Session getSession();
 }

Modified: trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java
===================================================================
--- trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -23,8 +23,8 @@
 package org.teiid.translator;
 
 import java.util.Collection;
-import java.util.Collections;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
 
 import javax.resource.ResourceException;
@@ -43,6 +43,7 @@
 import org.teiid.logging.LogConstants;
 import org.teiid.logging.LogManager;
 import org.teiid.metadata.FunctionMethod;
+import org.teiid.metadata.FunctionParameter;
 import org.teiid.metadata.MetadataFactory;
 import org.teiid.metadata.RuntimeMetadata;
 
@@ -108,6 +109,8 @@
 	private int maxInSize = DEFAULT_MAX_IN_CRITERIA_SIZE;
 	private int maxDependentInPredicates = DEFAULT_MAX_IN_CRITERIA_SIZE;
 	
+	private LinkedList<FunctionMethod> pushdownFunctionMethods = new LinkedList<FunctionMethod>();
+	
 	/**
 	 * Initialize the connector with supplied configuration
 	 */
@@ -134,8 +137,10 @@
 	 * The default implementation assumes a JCA {@link ConnectionFactory}.  Subclasses should override, if they use 
 	 * another type of connection factory.
 	 * 
+	 * @deprecated
+	 * @see #getConnection(Object, ExecutionContext)
 	 * @param factory
-	 * @return
+	 * @return a connection
 	 * @throws TranslatorException
 	 */
 	@SuppressWarnings("unchecked")
@@ -154,6 +159,22 @@
 	}
 	
 	/**
+	 * Return a connection object from the given connection factory.
+	 * 
+	 * The default implementation assumes a JCA {@link ConnectionFactory}.  Subclasses should override, if they use 
+	 * another type of connection factory or wish to use the {@link ExecutionContext}.  By default calls {@link #getConnection(Object)}
+	 * 
+	 * @param factory
+	 * @param executionContext null if this is a system request for a connection
+	 * @return a connection
+	 * @throws TranslatorException
+	 */
+	public C getConnection(F factory,
+			ExecutionContext executionContext) throws TranslatorException {
+		return getConnection(factory);
+	}
+
+	/**
 	 * Closes a connection object from the given connection factory.
 	 * 
 	 * The default implementation assumes a JCA {@link Connection}.  Subclasses should override, if they use 
@@ -651,10 +672,28 @@
     	return null;
     }
     
+    /**
+     * Get a list of {@link FunctionMethod}s that will be contributed to the SYS schema.  
+     * To avoid conflicts with system functions, the function name should contain a 
+     * qualifier - typically &lt;translator name&gt;.&lt;function name&gt; 
+     * @see ExecutionFactory#addPushDownFunction(String, String, FunctionParameter, FunctionParameter...)
+     * @return
+     */
     public List<FunctionMethod> getPushDownFunctions(){
-    	return Collections.emptyList();
+    	return pushdownFunctionMethods;
     }
     
+    protected FunctionMethod addPushDownFunction(String qualifier, String name, String returnType, String...paramTypes) {
+    	FunctionParameter[] params = new FunctionParameter[paramTypes.length];
+    	for (int i = 0; i < paramTypes.length; i++) {
+			params[i] = new FunctionParameter("param" + (i+1), paramTypes[i]); //$NON-NLS-1$
+		}
+    	FunctionMethod method = new FunctionMethod(qualifier + '.' + name, name, qualifier, params, new FunctionParameter("result", returnType)); //$NON-NLS-1$
+    	method.setNameInSource(name);
+    	pushdownFunctionMethods.add(method);
+    	return method;
+    }
+    
     /**
      * Get the integer value representing the number of values allowed in an IN criteria
      * in the WHERE clause of a query
@@ -821,4 +860,5 @@
     public boolean supportsCommonTableExpressions() {
     	return false;
     }
+
 }

Modified: trunk/api/src/test/java/org/teiid/logging/TestLogManager.java
===================================================================
--- trunk/api/src/test/java/org/teiid/logging/TestLogManager.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/api/src/test/java/org/teiid/logging/TestLogManager.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -41,7 +41,7 @@
  */
 public class TestLogManager extends TestCase {
 
-	String context = "SomeContext"; //$NON-NLS-1$
+	private static final String CONTEXT = "SomeContext"; //$NON-NLS-1$
 	
     /**
      * Constructor for TestLogManager.
@@ -54,7 +54,7 @@
 	@Override
 	protected void setUp() throws Exception {
     	ListLogger logger = new ListLogger();
-    	logger.setLogLevel(context, MessageLevel.DETAIL);
+    	logger.setLogLevel(CONTEXT, MessageLevel.DETAIL);
     	LogManager.logListener = logger;
 	}    
     
@@ -66,11 +66,11 @@
      * Test for boolean isMessageToBeRecorded(String, int)
      */
     public void testIsMessageToBeRecordedString() {
-    	assertTrue(LogManager.isMessageToBeRecorded(context, MessageLevel.CRITICAL) ); 
+    	assertTrue(LogManager.isMessageToBeRecorded(CONTEXT, MessageLevel.CRITICAL) ); 
     	
     	ListLogger cfg = (ListLogger)LogManager.logListener;
-        cfg.setLogLevel(context, MessageLevel.NONE);
-        assertFalse(LogManager.isMessageToBeRecorded(context, MessageLevel.CRITICAL) );
+        cfg.setLogLevel(CONTEXT, MessageLevel.NONE);
+        assertFalse(LogManager.isMessageToBeRecorded(CONTEXT, MessageLevel.CRITICAL) );
     }
 
     /**
@@ -78,7 +78,7 @@
      */
     public void testLogMessage() throws Exception {
     	ListLogger cfg = (ListLogger)LogManager.logListener;
-        cfg.setLogLevel(context, MessageLevel.INFO );
+        cfg.setLogLevel(CONTEXT, MessageLevel.INFO );
 
         List<String> sentMsgList = new ArrayList<String>();
         sentMsgList.add("A message 1"); //$NON-NLS-1$
@@ -88,12 +88,12 @@
         sentMsgList.add("A message 5"); //$NON-NLS-1$
         sentMsgList.add("A message 6"); //$NON-NLS-1$
 
-        for (Iterator iter = sentMsgList.iterator(); iter.hasNext();) {
-            String msg = (String) iter.next();
-            LogManager.logInfo(context, msg); 
+        for (Iterator<String> iter = sentMsgList.iterator(); iter.hasNext();) {
+            String msg = iter.next();
+            LogManager.logInfo(CONTEXT, msg); 
         }
         
-        List recevedMsgList = cfg.getLoggedMessages();
+        List<String> recevedMsgList = cfg.getLoggedMessages();
         assertEquals(sentMsgList.size(), recevedMsgList.size());
         assertEquals(sentMsgList, recevedMsgList);
     }
@@ -129,7 +129,7 @@
             return this.messages.size();
         }
 
-        public List getLoggedMessages() {
+        public List<String> getLoggedMessages() {
             return this.messages;
         }
     	

Modified: trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
--- trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml	2011-06-05 01:32:10 UTC (rev 3218)
@@ -229,7 +229,7 @@
     <bean name="OdbcSslConfiguration" class="org.teiid.transport.SSLConfiguration">
         <!-- can be one of disabled or enabled 
              disabled = no transport or message level security will be used
-             enabled = traffic will be secured using this configuration
+             enabled = traffic will be secured using this configuration if the client supports SSL
         -->
         <property name="mode">disabled</property>
         <property name="keystoreFilename">cert.keystore</property>

Modified: trunk/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- trunk/build/kits/jboss-container/teiid-releasenotes.html	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/build/kits/jboss-container/teiid-releasenotes.html	2011-06-05 01:32:10 UTC (rev 3218)
@@ -25,11 +25,17 @@
 	<LI><A HREF="#About">About JBoss</A> 
 </UL>
 <H2><A NAME="Highlights"></A>Highlights</H2>
-
+<UL>
+	<LI><B>Subquery optimization control</B> - added the DJ hint to indicate that a subquery should be the independent side of a dependent join.
+	<LI><B>MAKEIND Hint</B> - The MAKEIND hint can be used to indicate that the other side of the join should be made dependent.
+    <LI><B>ODBC SSL</B> - added support for SSL encrypted ODBC connections.
+	<LI><B>Reauthentication Statement</B> - SET SESSION AUTHORIZATION can now be used to perform a reauthentication via JDBC or ODBC.
+</UL>
 <h2><a name="Compatibility">Compatibility Issues</a></h2>
 <ul>
   <li>TRANSLATE/HAS CRITERIA has been deprecated.  An alternative approach to update procedures will be introduced in a subsequent version.
   <li>Support for named parameter syntax using param=value has been deprecated, since it is ambiguous with a comparison predicate boolean value expression.  param<b>=></b>value should be used instead.  
+  <li>Support for using the FROM clause post item hints MAKEDEP/MAKENOTDEP has been deprecated.  Use the pre item comment hint syntax instead, e.g. /*+ MAKEDEP */ tbl
 </ul>
 
 <h4>from 7.3</h4>

Modified: trunk/cache-jbosscache/src/main/java/org/teiid/events/jboss/JGroupsEventDistributor.java
===================================================================
--- trunk/cache-jbosscache/src/main/java/org/teiid/events/jboss/JGroupsEventDistributor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/cache-jbosscache/src/main/java/org/teiid/events/jboss/JGroupsEventDistributor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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;
@@ -45,9 +45,20 @@
 
 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;
+	private transient ChannelFactory channelFactory;
 	private String multiplexerStack;
 	private String clusterName;
 	private String jndiName;
@@ -60,7 +71,7 @@
 	private transient RpcDispatcher rpcDispatcher;
 	private transient Vector<Address> members;
 	
-	public JChannelFactory getChannelFactory() {
+	public ChannelFactory getChannelFactory() {
 		return channelFactory;
 	}
 	
@@ -88,7 +99,7 @@
 		return clusterName;
 	}
 	
-	public void setChannelFactory(JChannelFactory channelFactory) {
+	public void setChannelFactory(ChannelFactory channelFactory) {
 		this.channelFactory = channelFactory;
 	}
 	
@@ -104,18 +115,12 @@
 		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 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;
-			}
-		});
+		if (channel.getView() != null) {
+			viewAccepted(channel.getView());
+		}
+		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() {
 			


Property changes on: trunk/cache-jbosscache/src/main/java/org/teiid/events/jboss/JGroupsEventDistributor.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/events/jboss/JGroupsEventDistributor.java:3149-3217

Modified: trunk/client/src/main/java/org/teiid/adminapi/Session.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Session.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/client/src/main/java/org/teiid/adminapi/Session.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -24,12 +24,11 @@
 
 
 /**
- * A Session is a lasting connection between a client and a Teiid System.
+ * A Session represents a single connection between a client and the server.
  * 
- * A user may be allowed to have multiple sessions active simultaneously.
- * 
+ * A user is allowed to have multiple sessions active simultaneously.
  */
-public interface Session extends  AdminObject {
+public interface Session extends AdminObject {
     
     /**
      * Get the Last time Client has check to see if the server is still available
@@ -90,6 +89,12 @@
     public String getClientHostName();
     
     /**
+     * Get the client hardware (typically MAC) address. Note this value is reported from the client.
+     * @return the hardware address as a hex string or null if not available.
+     */
+    public String getClientHardwareAddress();
+    
+    /**
      * Get the time the {@link Session} was created.
      * @return
      */

Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -35,7 +35,10 @@
 
 /**
  * Add and delete properties also in the Mapper class for correct wrapping for profile service.
+ * 
  */
+/* TODO: it would probably be good to let ipAddress denote the connecting address 
+ and add clientIpAdress as the client reported value */
 @MetaMapping(SessionMetadataMapper.class)
 public class SessionMetadata extends AdminObjectImpl implements Session {
 
@@ -45,6 +48,7 @@
     private long createdTime;
     private String ipAddress;
     private String clientHostName;    
+    private String clientHardwareAddress;
     private String userName;
     private String vdbName;
     private int vdbVersion;
@@ -59,7 +63,7 @@
     private transient boolean embedded;
 
 	@Override
-	@ManagementProperty(description="Application assosiated with Session", readOnly=true)
+	@ManagementProperty(description="Application associated with Session", readOnly=true)
 	public String getApplicationName() {
 		return this.applicationName;
 	}
@@ -89,7 +93,7 @@
 	}
 
 	@Override
-	@ManagementProperty(description="IP address from where session is created", readOnly=true)
+	@ManagementProperty(description="IP address of session client", readOnly=true)
 	public String getIPAddress() {
 		return this.ipAddress;
 	}
@@ -119,7 +123,7 @@
 	}
 
 	@Override
-	@ManagementProperty(description="User name assosiated with session", readOnly=true)
+	@ManagementProperty(description="User name associated with session", readOnly=true)
 	public String getUserName() {
 		return this.userName;
 	}
@@ -129,7 +133,7 @@
 	}
 
 	@Override
-	@ManagementProperty(description="VDB name assosiated with session", readOnly=true)
+	@ManagementProperty(description="VDB name associated with session", readOnly=true)
 	public String getVDBName() {
 		return this.vdbName;
 	}
@@ -139,7 +143,7 @@
 	}
 
 	@Override
-	@ManagementProperty(description="VDB version name assosiated with session", readOnly=true)
+	@ManagementProperty(description="VDB version name associated with session", readOnly=true)
 	public int getVDBVersion() {
 		return this.vdbVersion;
 	}
@@ -168,6 +172,7 @@
     	str.append("; createdTime=").append(new Date(createdTime));
     	str.append("; applicationName=").append(applicationName);
     	str.append("; clientHostName=").append(clientHostName);
+    	str.append("; clientHardwareAddress=").append(clientHardwareAddress);
     	str.append("; IPAddress=").append(ipAddress);
     	str.append("; securityDomain=").append(securityDomain); 
     	str.append("; lastPingTime=").append(new Date(lastPingTime));
@@ -218,4 +223,14 @@
 		return embedded;
 	}
 	
+	@Override
+	@ManagementProperty(description="Hardware address reported by the client", readOnly=true)
+	public String getClientHardwareAddress() {
+		return this.clientHardwareAddress;
+	}
+	
+	public void setClientHardwareAddress(String clientHardwareAddress) {
+		this.clientHardwareAddress = clientHardwareAddress;
+	}
+	
 }

Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -43,6 +43,7 @@
 	private static final String LAST_PING_TIME = "lastPingTime"; //$NON-NLS-1$
 	private static final String IP_ADDRESS = "IPAddress"; //$NON-NLS-1$
 	private static final String CLIENT_HOST_NAME = "clientHostName"; //$NON-NLS-1$
+	private static final String CLIENT_MAC = "clientMAC"; //$NON-NLS-1$
 	private static final String CREATED_TIME = "createdTime"; //$NON-NLS-1$
 	private static final String APPLICATION_NAME = "applicationName"; //$NON-NLS-1$
 	private static final MutableCompositeMetaType metaType;
@@ -60,6 +61,7 @@
 		metaType.addItem(VDB_NAME, VDB_NAME, SimpleMetaType.STRING);
 		metaType.addItem(VDB_VERSION, VDB_VERSION, SimpleMetaType.INTEGER_PRIMITIVE);
 		metaType.addItem(SECURITY_DOMAIN, SECURITY_DOMAIN, SimpleMetaType.STRING);
+		metaType.addItem(CLIENT_MAC, CLIENT_MAC, SimpleMetaType.STRING);
 		metaType.freeze();
 	}
 	
@@ -91,7 +93,7 @@
 			session.set(VDB_NAME,SimpleValueSupport.wrap(object.getVDBName()));
 			session.set(VDB_VERSION, SimpleValueSupport.wrap(object.getVDBVersion()));
 			session.set(SECURITY_DOMAIN, SimpleValueSupport.wrap(object.getSecurityDomain()));
-			
+			session.set(CLIENT_MAC, SimpleValueSupport.wrap(object.getSecurityDomain()));
 			return session;
 		}
 		throw new IllegalArgumentException("Cannot convert session " + object); //$NON-NLS-1$
@@ -116,6 +118,7 @@
 			session.setVDBName((String) metaValueFactory.unwrap(compositeValue.get(VDB_NAME)));
 			session.setVDBVersion((Integer) metaValueFactory.unwrap(compositeValue.get(VDB_VERSION)));
 			session.setSecurityDomain((String) metaValueFactory.unwrap(compositeValue.get(SECURITY_DOMAIN)));
+			session.setClientHardwareAddress((String) metaValueFactory.unwrap(compositeValue.get(CLIENT_MAC)));
 			return session;
 		}
 		throw new IllegalStateException("Unable to unwrap session " + metaValue); //$NON-NLS-1$

Modified: trunk/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -972,6 +972,21 @@
 		throw SqlUtil.createFeatureNotSupportedException();
 	}
 	
+	Object setPassword(Object newPassword) {
+		if (newPassword != null) {
+			return this.connectionProps.put(TeiidURL.CONNECTION.PASSWORD, newPassword);
+		} 
+		return this.connectionProps.remove(TeiidURL.CONNECTION.PASSWORD);
+	}
+	
+	String getPassword() {
+		Object result = this.connectionProps.get(TeiidURL.CONNECTION.PASSWORD);
+		if (result == null) {
+			return null;
+		}
+		return result.toString();
+	}
+	
 	@Override
 	public void changeUser(String userName, String newPassword)
 			throws SQLException {
@@ -983,11 +998,7 @@
 		} else {
 			oldName = this.connectionProps.remove(TeiidURL.CONNECTION.USER_NAME);
 		}
-		if (newPassword != null) {
-			oldPassword = this.connectionProps.put(TeiidURL.CONNECTION.PASSWORD, newPassword);
-		} else {
-			oldPassword = this.connectionProps.remove(TeiidURL.CONNECTION.PASSWORD);
-		}
+		oldPassword = setPassword(newPassword);
 		boolean success = false;
 		try {
 			this.serverConn.authenticate();
@@ -1003,11 +1014,7 @@
 				} else {
 					this.connectionProps.remove(TeiidURL.CONNECTION.USER_NAME);
 				}
-				if (oldPassword != null) {
-					this.connectionProps.put(TeiidURL.CONNECTION.PASSWORD, oldPassword);
-				} else {
-					this.connectionProps.remove(TeiidURL.CONNECTION.PASSWORD);
-				}
+				setPassword(oldPassword);
 			}
 		}
 	}


Property changes on: trunk/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java:3149-3217

Modified: trunk/client/src/main/java/org/teiid/jdbc/EmbeddedProfile.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/EmbeddedProfile.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/client/src/main/java/org/teiid/jdbc/EmbeddedProfile.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -28,6 +28,7 @@
 
 import org.teiid.core.TeiidException;
 import org.teiid.core.TeiidRuntimeException;
+import org.teiid.core.util.PropertiesUtils;
 import org.teiid.core.util.ReflectionHelper;
 import org.teiid.net.CommunicationException;
 import org.teiid.net.ConnectionException;
@@ -36,7 +37,9 @@
 
 public class EmbeddedProfile implements ConnectionProfile {
 	
-    /**
+    public static final String USE_CALLING_THREAD = "useCallingThread"; //$NON-NLS-1$
+
+	/**
      * This method tries to make a connection to the given URL. This class
      * will return a null if this is not the right driver to connect to the given URL.
      * @param The URL used to establish a connection.
@@ -61,7 +64,7 @@
 
 	protected ServerConnection createServerConnection(Properties info)
 			throws TeiidException {
-		return (ServerConnection)ReflectionHelper.create("org.teiid.transport.LocalServerConnection", Arrays.asList(info, true), Thread.currentThread().getContextClassLoader()); //$NON-NLS-1$
+		return (ServerConnection)ReflectionHelper.create("org.teiid.transport.LocalServerConnection", Arrays.asList(info, PropertiesUtils.getBooleanProperty(info, USE_CALLING_THREAD, true)), Thread.currentThread().getContextClassLoader()); //$NON-NLS-1$
 	}
     
 }


Property changes on: trunk/client/src/main/java/org/teiid/jdbc/EmbeddedProfile.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/client/src/main/java/org/teiid/jdbc/EmbeddedProfile.java:3149-3217

Modified: trunk/client/src/main/java/org/teiid/jdbc/JDBCURL.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/JDBCURL.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/client/src/main/java/org/teiid/jdbc/JDBCURL.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -57,6 +57,7 @@
             ExecutionProperties.PROP_FETCH_SIZE,
             ExecutionProperties.PROP_XML_FORMAT,
             ExecutionProperties.PROP_XML_VALIDATION,
+            EmbeddedProfile.USE_CALLING_THREAD,
             ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS)));
     
     public static final Set<String> KNOWN_PROPERTIES = getKnownProperties();


Property changes on: trunk/client/src/main/java/org/teiid/jdbc/JDBCURL.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/client/src/main/java/org/teiid/jdbc/JDBCURL.java:3149-3217

Modified: trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -66,6 +66,7 @@
 import org.teiid.core.util.SqlUtil;
 import org.teiid.core.util.StringUtil;
 import org.teiid.jdbc.CancellationTimer.CancelTask;
+import org.teiid.net.TeiidURL;
 
 
 public class StatementImpl extends WrapperImpl implements TeiidStatement {
@@ -163,7 +164,7 @@
     protected Map outParamIndexMap = new HashMap();
     
     private static Pattern TRANSACTION_STATEMENT = Pattern.compile("\\s*(commit|rollback|(start\\s+transaction))\\s*;?", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
-    private static Pattern SET_STATEMENT = Pattern.compile("\\s*set\\s+(\\w+)\\s*([^;]*);?", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
+    private static Pattern SET_STATEMENT = Pattern.compile("\\s*set\\s+((?:session authorization)|(?:\\w+))\\s+(?:([a-zA-Z](?:\\w|_)*)|((?:'[^']*')+));?", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
     private static Pattern SHOW_STATEMENT = Pattern.compile("\\s*show\\s+(\\w*);?", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
     /**
      * Factory Constructor 
@@ -429,8 +430,19 @@
         		}
         		String key = match.group(1);
         		String value = match.group(2);
-        		if (ExecutionProperties.NEWINSTANCE.equalsIgnoreCase(key) && Boolean.valueOf(value)) {
-        			this.getMMConnection().getServerConnection().cleanUp();
+        		if (value == null) {
+        			value = match.group(3);
+        			value = StringUtil.replaceAll(value, "''", "'"); //$NON-NLS-1$ //$NON-NLS-2$
+        			value = value.substring(1, value.length() - 1);
+        		}
+        		if ("SESSION AUTHORIZATION".equalsIgnoreCase(key)) { //$NON-NLS-1$
+        			this.getMMConnection().changeUser(value, this.getMMConnection().getPassword());
+        		} else if (key.equalsIgnoreCase(TeiidURL.CONNECTION.PASSWORD)) {
+        			this.getMMConnection().setPassword(value);
+        		} else if (ExecutionProperties.NEWINSTANCE.equalsIgnoreCase(key)) {
+        			if (Boolean.valueOf(value)) {
+        				this.getMMConnection().getServerConnection().cleanUp();
+        			}
         		} else {
         			JDBCURL.addNormalizedProperty(key, value, this.driverConnection.getExecutionProperties());
         		}
@@ -533,7 +545,6 @@
         }
         
         final RequestMessage reqMessage = createRequestMessage(commands, isBatchedCommand, resultsMode);
-        reqMessage.setSync(synch);
     	ResultsFuture<ResultsMessage> pendingResult = execute(reqMessage, synch);
     	final ResultsFuture<Boolean> result = new ResultsFuture<Boolean>();
     	pendingResult.addCompletionListener(new ResultsFuture.CompletionListener<ResultsMessage>() {
@@ -581,7 +592,8 @@
         reqMsg.setFetchSize(this.fetchSize);
         reqMsg.setRowLimit(this.maxRows);
         reqMsg.setTransactionIsolation(this.driverConnection.getTransactionIsolation());
-
+        String useCallingThread = getExecutionProperty(EmbeddedProfile.USE_CALLING_THREAD);
+        reqMsg.setSync(synch && (useCallingThread == null || Boolean.valueOf(useCallingThread)));
         // Get connection properties and set them onto request message
         copyPropertiesToRequest(reqMsg);
 
@@ -641,7 +653,7 @@
             	updateCounts[i] = (Integer)results[i].get(0);
             }
             if (logger.isLoggable(Level.FINER)) {
-            	logger.fine(JDBCPlugin.Util.getString("Recieved update counts: " + Arrays.toString(updateCounts))); //$NON-NLS-1$
+            	logger.finer("Recieved update counts: " + Arrays.toString(updateCounts)); //$NON-NLS-1$
             }
             // In update scenarios close the statement implicitly
             try {


Property changes on: trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java:3149-3217

Modified: trunk/client/src/main/java/org/teiid/net/TeiidURL.java
===================================================================
--- trunk/client/src/main/java/org/teiid/net/TeiidURL.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/client/src/main/java/org/teiid/net/TeiidURL.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -51,6 +51,7 @@
 	public static interface CONNECTION {
 		public static final String CLIENT_IP_ADDRESS = "clientIpAddress"; //$NON-NLS-1$
 		public static final String CLIENT_HOSTNAME = "clientHostName"; //$NON-NLS-1$
+		public static final String CLIENT_MAC = "clientMAC"; //$NON-NLS-1$
 		/**
 		 * If true, will automatically select a new server instance after a communication exception.
 		 * @since 5.6

Modified: trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnectionFactory.java
===================================================================
--- trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnectionFactory.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnectionFactory.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -30,6 +30,8 @@
 import java.lang.reflect.Proxy;
 import java.net.InetAddress;
 import java.net.MalformedURLException;
+import java.net.NetworkInterface;
+import java.net.SocketException;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -323,8 +325,19 @@
 			InetAddress addr = InetAddress.getLocalHost();
 			connectionProperties.put(TeiidURL.CONNECTION.CLIENT_IP_ADDRESS, addr.getHostAddress());
 			connectionProperties.put(TeiidURL.CONNECTION.CLIENT_HOSTNAME, addr.getCanonicalHostName());
+			NetworkInterface ni = NetworkInterface.getByInetAddress(addr);
+			if (ni != null && ni.getHardwareAddress() != null) {
+				StringBuilder sb = new StringBuilder();
+				for (byte b : ni.getHardwareAddress()) {
+					sb.append(PropertiesUtils.toHex(b >> 4));
+					sb.append(PropertiesUtils.toHex(b));
+				}
+				connectionProperties.put(TeiidURL.CONNECTION.CLIENT_MAC, sb.toString());
+			}
         } catch (UnknownHostException err1) {
         	connectionProperties.put(TeiidURL.CONNECTION.CLIENT_IP_ADDRESS, "UnknownClientAddress"); //$NON-NLS-1$
+        } catch (SocketException e) {
+        	
         }
 	}
 


Property changes on: trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnectionFactory.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/client/src/main/java/org/teiid/net/socket/SocketServerConnectionFactory.java:3149-3217

Modified: trunk/client/src/test/java/org/teiid/jdbc/TestStatement.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestStatement.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestStatement.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -62,8 +62,20 @@
 		StatementImpl statement = new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
 		assertFalse(statement.execute("set foo bar")); //$NON-NLS-1$
 		assertEquals("bar", p.get("foo")); //$NON-NLS-1$ //$NON-NLS-2$
+		
+		assertFalse(statement.execute("set foo 'b''ar'")); //$NON-NLS-1$
+		assertEquals("b'ar", p.get("foo")); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 	
+	@Test public void testSetAuthorizationStatement() throws Exception {
+		ConnectionImpl conn = Mockito.mock(ConnectionImpl.class);
+		Properties p = new Properties();
+		Mockito.stub(conn.getExecutionProperties()).toReturn(p);
+		StatementImpl statement = new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+		assertFalse(statement.execute("set session authorization bar")); //$NON-NLS-1$
+		Mockito.verify(conn).changeUser("bar", null);
+	}
+	
 	@Test public void testPropertiesOverride() throws Exception {
 		ConnectionImpl conn = Mockito.mock(ConnectionImpl.class);
 		Properties p = new Properties();


Property changes on: trunk/client/src/test/java/org/teiid/jdbc/TestStatement.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/client/src/test/java/org/teiid/jdbc/TestStatement.java:3149-3217

Modified: trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -135,7 +135,7 @@
     @Test public void testGetPropertyInfo1() throws Exception {        
         DriverPropertyInfo info[] = drv.getPropertyInfo("jdbc:teiid:vdb at mm://localhost:12345;applicationName=x", null); //$NON-NLS-1$
 
-        assertEquals(19, info.length);
+        assertEquals(20, info.length);
         assertEquals(false, info[0].required);
         assertEquals("ApplicationName", info[0].name); //$NON-NLS-1$
         assertEquals("x", info[0].value); //$NON-NLS-1$


Property changes on: trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java:3149-3217

Deleted: trunk/client-jdk15/src/main/java/net/sf/retrotranslator/runtime/java/net/_NetworkInterface.java
===================================================================
--- branches/7.4.x/client-jdk15/src/main/java/net/sf/retrotranslator/runtime/java/net/_NetworkInterface.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/client-jdk15/src/main/java/net/sf/retrotranslator/runtime/java/net/_NetworkInterface.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -1,35 +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 net.sf.retrotranslator.runtime.java.net;
-
-import java.net.NetworkInterface;
-import java.net.SocketException;
-
-public class _NetworkInterface {
-	
-	@SuppressWarnings("unused")
-	public static byte[] getHardwareAddress(NetworkInterface ni) throws SocketException {
-		return null;
-	}
-
-}

Copied: trunk/client-jdk15/src/main/java/net/sf/retrotranslator/runtime/java/net/_NetworkInterface.java (from rev 3217, branches/7.4.x/client-jdk15/src/main/java/net/sf/retrotranslator/runtime/java/net/_NetworkInterface.java)
===================================================================
--- trunk/client-jdk15/src/main/java/net/sf/retrotranslator/runtime/java/net/_NetworkInterface.java	                        (rev 0)
+++ trunk/client-jdk15/src/main/java/net/sf/retrotranslator/runtime/java/net/_NetworkInterface.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -0,0 +1,35 @@
+/*
+ * 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 net.sf.retrotranslator.runtime.java.net;
+
+import java.net.NetworkInterface;
+import java.net.SocketException;
+
+public class _NetworkInterface {
+	
+	@SuppressWarnings("unused")
+	public static byte[] getHardwareAddress(NetworkInterface ni) throws SocketException {
+		return null;
+	}
+
+}

Modified: trunk/common-core/src/main/java/org/teiid/core/util/PropertiesUtils.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/util/PropertiesUtils.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/common-core/src/main/java/org/teiid/core/util/PropertiesUtils.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -716,7 +716,7 @@
      * Convert a nibble to a hex character
      * @param   nibble  the nibble to convert.
      */
-    private static char toHex(int nibble) {
+    public static char toHex(int nibble) {
     return hexDigit[(nibble & 0xF)];
     }
 

Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -41,6 +41,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.TimeZone;
+import java.util.TreeMap;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.sql.DataSource;
@@ -144,7 +145,7 @@
     	}
     };
     
-    private Map<String, FunctionModifier> functionModifiers = new HashMap<String, FunctionModifier>();
+    private Map<String, FunctionModifier> functionModifiers = new TreeMap<String, FunctionModifier>(String.CASE_INSENSITIVE_ORDER);
 	
 	private boolean useBindVariables = true;
 	private String databaseTimeZone;
@@ -511,9 +512,18 @@
     	if (obj instanceof Function) {
     		Function function = (Function)obj;
     		if (functionModifiers != null) {
-    			FunctionModifier modifier = functionModifiers.get(function.getName().toLowerCase());
-    			if (modifier != null) {
-    				parts = modifier.translate(function);
+    			String name = function.getName();
+    			while (true) {
+	    			FunctionModifier modifier = functionModifiers.get(name);
+	    			if (modifier != null) {
+	    				parts = modifier.translate(function);
+	    				break;
+	    			}
+	    			int index = name.indexOf('.');
+	    			if (index < 0 || index == name.length() - 1) {
+	    				break;
+	    			}
+    				name = name.substring(index + 1);
     			}
     		}
     	} else if (obj instanceof Command) {
@@ -553,7 +563,7 @@
     }
     
     /**
-     * Return a map of function name in lower case to FunctionModifier.
+     * Return a map of function name to FunctionModifier.
      * @return Map of function name to FunctionModifier.
      */
     public Map<String, FunctionModifier> getFunctionModifiers() {
@@ -566,7 +576,7 @@
      * @param modifier
      */
     public void registerFunctionModifier(String name, FunctionModifier modifier) {
-    	this.functionModifiers.put(name.toLowerCase(), modifier);
+    	this.functionModifiers.put(name, modifier);
     }
     
     /**


Property changes on: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/IngresExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/IngresExecutionFactory.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/IngresExecutionFactory.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -21,6 +21,8 @@
  */
 package org.teiid.translator.jdbc.ingres;
 
+import static org.teiid.translator.TypeFacility.RUNTIME_NAMES.*;
+
 import java.sql.Date;
 import java.sql.Time;
 import java.sql.Timestamp;
@@ -28,10 +30,7 @@
 import java.util.Arrays;
 import java.util.List;
 
-import org.teiid.core.types.DataTypeManager;
 import org.teiid.language.Limit;
-import org.teiid.metadata.FunctionMethod;
-import org.teiid.metadata.FunctionParameter;
 import org.teiid.translator.ExecutionContext;
 import org.teiid.translator.SourceSystemFunctions;
 import org.teiid.translator.Translator;
@@ -40,7 +39,6 @@
 import org.teiid.translator.jdbc.ConvertModifier;
 import org.teiid.translator.jdbc.FunctionModifier;
 import org.teiid.translator.jdbc.JDBCExecutionFactory;
-
 @Translator(name="ingres", description="A translator for Ingres Databases")
 public class IngresExecutionFactory extends JDBCExecutionFactory {
 	
@@ -78,7 +76,45 @@
         registerFunctionModifier(SourceSystemFunctions.RAND, new AliasModifier("random")); //$NON-NLS-1$
         registerFunctionModifier(SourceSystemFunctions.UCASE, new AliasModifier("uppercase")); //$NON-NLS-1$
         registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new AliasModifier("day")); //$NON-NLS-1$
-        registerFunctionModifier(SourceSystemFunctions.LOCATE, new LocateFunctionModifier(getLanguageFactory())); 		
+        registerFunctionModifier(SourceSystemFunctions.LOCATE, new LocateFunctionModifier(getLanguageFactory())); 	
+        
+        addPushDownFunction(INGRES, "bit_add", INTEGER, INTEGER, INTEGER); //$NON-NLS-1$
+        addPushDownFunction(INGRES, "bit_length", INTEGER, INTEGER); //$NON-NLS-1$
+        addPushDownFunction(INGRES, "character_length", STRING, INTEGER); //$NON-NLS-1$
+        addPushDownFunction(INGRES, "charextract", CHAR, STRING, INTEGER); //$NON-NLS-1$
+
+			// uses ingres date??
+			//supportedFunctions.add("date_trunc");		
+			//supportedFunctions.add("dow");		
+			//supportedFunctions.add("extract");
+        addPushDownFunction(INGRES, "gmt_timestamp", STRING, INTEGER); //$NON-NLS-1$
+        addPushDownFunction(INGRES, "hash", INTEGER, STRING); //$NON-NLS-1$
+        addPushDownFunction(INGRES, "hex", STRING, STRING); //$NON-NLS-1$
+
+        	// do not have byte[] type
+			//supportedFunctions.add("intextract");
+
+        addPushDownFunction(INGRES, "ln", DOUBLE, DOUBLE); //$NON-NLS-1$
+			
+			// see lowercase
+			// supportedFunctions.add("lower");
+			// supportedFunctions.add("upper");
+
+        addPushDownFunction(INGRES, "octet_length", INTEGER, STRING); //$NON-NLS-1$
+        addPushDownFunction(INGRES, "randomf", FLOAT); //$NON-NLS-1$
+        addPushDownFunction(INGRES, "session_user", STRING); //$NON-NLS-1$
+        addPushDownFunction(INGRES, "size", INTEGER, STRING); //$NON-NLS-1$
+        addPushDownFunction(INGRES, "squeeze", STRING, STRING); //$NON-NLS-1$
+        addPushDownFunction(INGRES, "soundex", STRING, STRING); //$NON-NLS-1$
+        addPushDownFunction(INGRES, "unhex", STRING, STRING); //$NON-NLS-1$
+        addPushDownFunction(INGRES, "usercode", STRING); //$NON-NLS-1$
+        addPushDownFunction(INGRES, "username", STRING); //$NON-NLS-1$
+			// ignore
+			// supportedFunctions.add("uuid_create");
+			// supportedFunctions.add("uuid_compare");
+			// supportedFunctions.add("uuid_from_char");
+			// supportedFunctions.add("uuid_to_char");
+
 	}
 	
     @Override
@@ -123,122 +159,6 @@
     }
     
     @Override
-    public List<FunctionMethod> getPushDownFunctions(){
-    	List<FunctionMethod> pushdownFunctions = new ArrayList<FunctionMethod>();
-    
-		pushdownFunctions.add(new FunctionMethod(INGRES + '.' + "bit_add", "bit_add", INGRES, //$NON-NLS-1$ //$NON-NLS-2$
-            new FunctionParameter[] {
-                new FunctionParameter("integer1", DataTypeManager.DefaultDataTypes.INTEGER, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("integer2", DataTypeManager.DefaultDataTypes.INTEGER, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-		
-		pushdownFunctions.add(new FunctionMethod(INGRES + '.' + "bit_length", "bit_length", INGRES, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("integer1", DataTypeManager.DefaultDataTypes.INTEGER, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$    		
-		
-		pushdownFunctions.add(new FunctionMethod(INGRES + '.' + "character_length", "character_length", INGRES, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$  
-
-		pushdownFunctions.add(new FunctionMethod(INGRES + '.' + "charextract", "charextract", INGRES, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-	                new FunctionParameter("integer1", DataTypeManager.DefaultDataTypes.INTEGER, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.CHAR, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-		
-		// uses ingres date??
-		//supportedFunctions.add("date_trunc");		
-		//supportedFunctions.add("dow");		
-		//supportedFunctions.add("extract");
-
-		pushdownFunctions.add(new FunctionMethod(INGRES + '.' + "gmt_timestamp", "gmt_timestamp", INGRES, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.INTEGER, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$  
-
-		pushdownFunctions.add(new FunctionMethod(INGRES + '.' + "hash", "hash", INGRES,//$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$				
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$  
-		
-		pushdownFunctions.add(new FunctionMethod(INGRES + '.' + "hex", "hex", INGRES, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$    		
-
-		// do not have byte[] type
-		//supportedFunctions.add("intextract");
-		
-		pushdownFunctions.add(new FunctionMethod(INGRES + '.' + "ln", "ln", INGRES, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("float1", DataTypeManager.DefaultDataTypes.DOUBLE, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.DOUBLE, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-		
-		// see lowercase
-		// supportedFunctions.add("lower");
-		// supportedFunctions.add("upper");
-		
-		pushdownFunctions.add(new FunctionMethod(INGRES + '.' + "octet_length", "octet_length", INGRES, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-		
-		pushdownFunctions.add(new FunctionMethod(INGRES + '.' + "pad", "pad", INGRES, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-		
-		pushdownFunctions.add(new FunctionMethod(INGRES + '.' + "pad", "pad", INGRES, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-	                new FunctionParameter("string2", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-	                new FunctionParameter("integer1", DataTypeManager.DefaultDataTypes.INTEGER, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-		
-		pushdownFunctions.add(new FunctionMethod(INGRES + '.' + "randomf", "randomf", INGRES, null,//$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.FLOAT, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$  
-
-		pushdownFunctions.add(new FunctionMethod(INGRES + '.' + "session_user", "session_user", INGRES, null,//$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$  
-
-		pushdownFunctions.add(new FunctionMethod(INGRES + '.' + "size", "size", INGRES, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-
-		pushdownFunctions.add(new FunctionMethod(INGRES + '.' + "squeeze", "squeeze", INGRES, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-
-		pushdownFunctions.add(new FunctionMethod(INGRES + '.' + "soundex", "soundex", INGRES, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-
-		pushdownFunctions.add(new FunctionMethod(INGRES + '.' + "unhex", "unhex", INGRES, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$    		
-
-		pushdownFunctions.add(new FunctionMethod(INGRES + '.' + "usercode", "usercode", INGRES, null,//$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$  
-
-		pushdownFunctions.add(new FunctionMethod(INGRES + '.' + "username", "username", INGRES, null,//$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$  
-		
-		// ignore
-		// supportedFunctions.add("uuid_create");
-		// supportedFunctions.add("uuid_compare");
-		// supportedFunctions.add("uuid_from_char");
-		// supportedFunctions.add("uuid_to_char");
-		
-    	return pushdownFunctions;
-    }
-
-    @Override
     public boolean supportsRowLimit() {
     	return true;
     }

Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/intersyscache/InterSystemsCacheExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/intersyscache/InterSystemsCacheExecutionFactory.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/intersyscache/InterSystemsCacheExecutionFactory.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -21,6 +21,8 @@
  */
 package org.teiid.translator.jdbc.intersyscache;
 
+import static org.teiid.translator.TypeFacility.RUNTIME_NAMES.*;
+
 import java.sql.Date;
 import java.sql.Time;
 import java.sql.Timestamp;
@@ -28,10 +30,7 @@
 import java.util.Arrays;
 import java.util.List;
 
-import org.teiid.core.types.DataTypeManager;
 import org.teiid.language.Function;
-import org.teiid.metadata.FunctionMethod;
-import org.teiid.metadata.FunctionParameter;
 import org.teiid.translator.SourceSystemFunctions;
 import org.teiid.translator.Translator;
 import org.teiid.translator.TranslatorException;
@@ -111,6 +110,18 @@
 				return null;
 			}
 		});
+        
+        addPushDownFunction(INTER_CACHE, "CHARACTER_LENGTH", INTEGER, STRING); //$NON-NLS-1$
+        addPushDownFunction(INTER_CACHE, "CHAR_LENGTH", INTEGER, STRING); //$NON-NLS-1$
+        addPushDownFunction(INTER_CACHE, "CHARINDEX", INTEGER, STRING, STRING); //$NON-NLS-1$
+        addPushDownFunction(INTER_CACHE, "CHARINDEX", INTEGER, STRING, STRING, INTEGER); //$NON-NLS-1$
+        addPushDownFunction(INTER_CACHE, "INSTR", INTEGER, STRING, STRING); //$NON-NLS-1$			
+        addPushDownFunction(INTER_CACHE, "INSTR", INTEGER, STRING, STRING, INTEGER); //$NON-NLS-1$
+        addPushDownFunction(INTER_CACHE, "IS_NUMERIC", INTEGER, STRING); //$NON-NLS-1$			
+        addPushDownFunction(INTER_CACHE, "REPLICATE", STRING, STRING, INTEGER); //$NON-NLS-1$					
+        addPushDownFunction(INTER_CACHE, "REVERSE", STRING, STRING); //$NON-NLS-1$			
+        addPushDownFunction(INTER_CACHE, "STUFF", STRING, STRING, STRING, INTEGER, STRING); //$NON-NLS-1$			
+        addPushDownFunction(INTER_CACHE, "TRIM", STRING, STRING); //$NON-NLS-1$			
 	}
 	
     @Override
@@ -179,80 +190,6 @@
     }
     
     @Override
-    public List<FunctionMethod> getPushDownFunctions(){
-    	        
-    	List<FunctionMethod> pushdownFunctions = new ArrayList<FunctionMethod>();
-    
-		pushdownFunctions.add(new FunctionMethod(INTER_CACHE + '.' + "CHARACTER_LENGTH", "CHARACTER_LENGTH", INTER_CACHE, //$NON-NLS-1$ //$NON-NLS-2$
-            new FunctionParameter[] {
-                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-
-		pushdownFunctions.add(new FunctionMethod(INTER_CACHE + '.' + "CHAR_LENGTH", "CHAR_LENGTH", INTER_CACHE, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-		
-		pushdownFunctions.add(new FunctionMethod(INTER_CACHE + '.' + "CHARINDEX", "CHARINDEX", INTER_CACHE, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("string2", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-		
-		pushdownFunctions.add(new FunctionMethod(INTER_CACHE + '.' + "CHARINDEX", "CHARINDEX", INTER_CACHE, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("string2", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("integer1", DataTypeManager.DefaultDataTypes.INTEGER, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$    		
-		
-		pushdownFunctions.add(new FunctionMethod(INTER_CACHE + '.' + "INSTR", "INSTR", INTER_CACHE, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("string2", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-		
-		pushdownFunctions.add(new FunctionMethod(INTER_CACHE + '.' + "INSTR", "INSTR", INTER_CACHE, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("string2", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("integer1", DataTypeManager.DefaultDataTypes.INTEGER, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$    		
-		
-		pushdownFunctions.add(new FunctionMethod(INTER_CACHE + '.' + "IS_NUMERIC", "IS_NUMERIC", INTER_CACHE, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-				
-		pushdownFunctions.add(new FunctionMethod(INTER_CACHE + '.' + "REPLICATE", "REPLICATE", INTER_CACHE, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("integer1", DataTypeManager.DefaultDataTypes.INTEGER, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$    		
-		
-		pushdownFunctions.add(new FunctionMethod(INTER_CACHE + '.' + "REVERSE", "REVERSE", INTER_CACHE, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-		
-		pushdownFunctions.add(new FunctionMethod(INTER_CACHE + '.' + "STUFF", "STUFF", INTER_CACHE, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("integer1", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("integer2", DataTypeManager.DefaultDataTypes.INTEGER, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("string2", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$  		
-		
-		pushdownFunctions.add(new FunctionMethod(INTER_CACHE + '.' + "TRIM", "TRIM", INTER_CACHE, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-		
-    	return pushdownFunctions;
-    }
-
-    
-    @Override
     public String translateLiteralDate(Date dateValue) {
         return "to_date('" + formatDateValue(dateValue) + "', 'yyyy-mm-dd')"; //$NON-NLS-1$//$NON-NLS-2$
     }

Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/ModeShapeExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/ModeShapeExecutionFactory.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/ModeShapeExecutionFactory.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -22,6 +22,8 @@
 
 package org.teiid.translator.jdbc.modeshape;
 
+import static org.teiid.translator.TypeFacility.RUNTIME_NAMES.*;
+
 import java.sql.Date;
 import java.sql.Time;
 import java.sql.Timestamp;
@@ -29,7 +31,6 @@
 import java.util.Arrays;
 import java.util.List;
 
-import org.teiid.core.types.DataTypeManager;
 import org.teiid.language.Comparison;
 import org.teiid.language.Function;
 import org.teiid.language.LanguageObject;
@@ -38,8 +39,6 @@
 import org.teiid.language.Comparison.Operator;
 import org.teiid.logging.LogConstants;
 import org.teiid.logging.LogManager;
-import org.teiid.metadata.FunctionMethod;
-import org.teiid.metadata.FunctionParameter;
 import org.teiid.translator.ExecutionContext;
 import org.teiid.translator.SourceSystemFunctions;
 import org.teiid.translator.Translator;
@@ -47,7 +46,6 @@
 import org.teiid.translator.TypeFacility;
 import org.teiid.translator.jdbc.AliasModifier;
 import org.teiid.translator.jdbc.JDBCExecutionFactory;
-
 /** 
  * Translator class for accessing the ModeShape JCR repository.  
  */
@@ -79,6 +77,12 @@
 		registerFunctionModifier(JCR_REFERENCE, new IdentifierFunctionModifier()); 
 		registerFunctionModifier(JCR_CONTAINS, new IdentifierFunctionModifier());
 		
+		addPushDownFunction(JCR, JCR_ISCHILDNODE, BOOLEAN, STRING, STRING);
+		addPushDownFunction(JCR, JCR_ISDESCENDANTNODE, BOOLEAN, STRING, STRING);
+		addPushDownFunction(JCR, JCR_ISSAMENODE, BOOLEAN, STRING, STRING);
+		addPushDownFunction(JCR, JCR_CONTAINS, BOOLEAN, STRING, STRING);
+		addPushDownFunction(JCR, JCR_REFERENCE, BOOLEAN, STRING);
+		
     	LogManager.logTrace(LogConstants.CTX_CONNECTOR, "ModeShape Translator Started"); //$NON-NLS-1$
      }    
     
@@ -112,42 +116,7 @@
 		return supportedFunctions;
     }
     
-    
     @Override
-    public List<FunctionMethod> getPushDownFunctions(){
-    	List<FunctionMethod> pushdownFunctions = new ArrayList<FunctionMethod>();
-		pushdownFunctions.add(new FunctionMethod(JCR + '.' + JCR_ISCHILDNODE, JCR_ISCHILDNODE, JCR, 
-            new FunctionParameter[] {
-				new FunctionParameter("path1", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("path2", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.BOOLEAN, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-		
-		pushdownFunctions.add(new FunctionMethod(JCR + '.' + JCR_ISDESCENDANTNODE, JCR_ISDESCENDANTNODE, JCR, 
-                new FunctionParameter[] {
-				new FunctionParameter("path1", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("path2", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("result", DataTypeManager.DefaultDataTypes.BOOLEAN, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-
-		pushdownFunctions.add(new FunctionMethod(JCR + '.' + JCR_ISSAMENODE, JCR_ISSAMENODE, JCR, 
-                new FunctionParameter[] {
-					new FunctionParameter("path1", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("path2", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("result", DataTypeManager.DefaultDataTypes.BOOLEAN, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-		
-		pushdownFunctions.add(new FunctionMethod(JCR + '.' + JCR_CONTAINS, JCR_CONTAINS, JCR, 
-                new FunctionParameter[] {
-                    new FunctionParameter("selectorOrProperty", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("searchExpr", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("result", DataTypeManager.DefaultDataTypes.BOOLEAN, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-		
-		pushdownFunctions.add(new FunctionMethod(JCR + '.' + JCR_REFERENCE, JCR_REFERENCE, JCR, 
-                new FunctionParameter[] {
-                    new FunctionParameter("selectorOrProperty", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("result", DataTypeManager.DefaultDataTypes.BOOLEAN, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-    	return pushdownFunctions;    	
-    }    
-    
-    @Override
     public List<?> translate(LanguageObject obj, ExecutionContext context) {
     	if (obj instanceof Comparison) {
     		Comparison compare = (Comparison)obj;

Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -22,8 +22,10 @@
 
 /*
  */
-package org.teiid.translator.jdbc.oracle;
+package org.teiid.translator.jdbc.oracle;
 
+import static org.teiid.translator.TypeFacility.RUNTIME_NAMES.*;
+
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
 import java.sql.Timestamp;
@@ -49,7 +51,6 @@
 import org.teiid.language.SetQuery.Operation;
 import org.teiid.language.visitor.CollectorVisitor;
 import org.teiid.metadata.Column;
-import org.teiid.metadata.FunctionMethod;
 import org.teiid.translator.ExecutionContext;
 import org.teiid.translator.SourceSystemFunctions;
 import org.teiid.translator.Translator;
@@ -75,6 +76,15 @@
     public final static String DUAL = "DUAL"; //$NON-NLS-1$
     public final static String ROWNUM = "ROWNUM"; //$NON-NLS-1$
     public final static String SEQUENCE = ":SEQUENCE="; //$NON-NLS-1$
+	/*
+	 * Spatial Functions
+	 */
+	public static final String RELATE = "sdo_relate"; //$NON-NLS-1$
+	public static final String NEAREST_NEIGHBOR = "sdo_nn"; //$NON-NLS-1$
+	public static final String FILTER = "sdo_filter"; //$NON-NLS-1$
+	public static final String WITHIN_DISTANCE = "sdo_within_distance"; //$NON-NLS-1$
+	public static final String NEAREST_NEIGHBOR_DISTANCE = "sdo_nn_distance"; //$NON-NLS-1$
+	public static final String ORACLE_SDO = "Oracle-SDO"; //$NON-NLS-1$
     
     public void start() throws TranslatorException {
         super.start();
@@ -112,10 +122,10 @@
 		});
         
         //spatial functions
-        registerFunctionModifier(OracleSpatialFunctions.RELATE, new OracleSpatialFunctionModifier());
-        registerFunctionModifier(OracleSpatialFunctions.NEAREST_NEIGHBOR, new OracleSpatialFunctionModifier());
-        registerFunctionModifier(OracleSpatialFunctions.FILTER, new OracleSpatialFunctionModifier());
-        registerFunctionModifier(OracleSpatialFunctions.WITHIN_DISTANCE, new OracleSpatialFunctionModifier());
+        registerFunctionModifier(OracleExecutionFactory.RELATE, new OracleSpatialFunctionModifier());
+        registerFunctionModifier(OracleExecutionFactory.NEAREST_NEIGHBOR, new OracleSpatialFunctionModifier());
+        registerFunctionModifier(OracleExecutionFactory.FILTER, new OracleSpatialFunctionModifier());
+        registerFunctionModifier(OracleExecutionFactory.WITHIN_DISTANCE, new OracleSpatialFunctionModifier());
         
         //add in type conversion
         ConvertModifier convertModifier = new ConvertModifier();
@@ -171,6 +181,21 @@
     	convertModifier.addNumericBooleanConversions();
     	convertModifier.setWideningNumericImplicit(true);
     	registerFunctionModifier(SourceSystemFunctions.CONVERT, convertModifier);
+    	
+    	addPushDownFunction(ORACLE_SDO, RELATE, STRING, STRING, STRING, STRING);
+    	addPushDownFunction(ORACLE_SDO, RELATE, STRING, OBJECT, OBJECT, STRING);
+    	addPushDownFunction(ORACLE_SDO, RELATE, STRING, STRING, OBJECT, STRING);
+    	addPushDownFunction(ORACLE_SDO, RELATE, STRING, OBJECT, STRING, STRING);
+    	addPushDownFunction(ORACLE_SDO, NEAREST_NEIGHBOR, STRING, STRING, OBJECT, STRING, INTEGER);
+    	addPushDownFunction(ORACLE_SDO, NEAREST_NEIGHBOR, STRING, OBJECT, OBJECT, STRING, INTEGER);
+    	addPushDownFunction(ORACLE_SDO, NEAREST_NEIGHBOR, STRING, OBJECT, STRING, STRING, INTEGER);
+    	addPushDownFunction(ORACLE_SDO, NEAREST_NEIGHBOR_DISTANCE, INTEGER, INTEGER);
+    	addPushDownFunction(ORACLE_SDO, WITHIN_DISTANCE, STRING, OBJECT, OBJECT, STRING);
+    	addPushDownFunction(ORACLE_SDO, WITHIN_DISTANCE, STRING, STRING, OBJECT, STRING);
+    	addPushDownFunction(ORACLE_SDO, WITHIN_DISTANCE, STRING, OBJECT, STRING, STRING);
+    	addPushDownFunction(ORACLE_SDO, FILTER, STRING, OBJECT, STRING, STRING);
+    	addPushDownFunction(ORACLE_SDO, FILTER, STRING, OBJECT, OBJECT, STRING);
+    	addPushDownFunction(ORACLE_SDO, FILTER, STRING, STRING, OBJECT, STRING);
     }
     
     public void handleInsertSequences(Insert insert) throws TranslatorException {
@@ -327,7 +352,7 @@
 	        // If so, the ORDERED hint is added, if not, it isn't
 	        Collection<Function> col = CollectorVisitor.collectObjects(Function.class, command);
 	        for (Function func : col) {
-	            if (func.getName().equalsIgnoreCase(OracleSpatialFunctions.RELATE)) {
+	            if (func.getName().equalsIgnoreCase(OracleExecutionFactory.RELATE)) {
 	                return comment + "/*+ ORDERED */ "; //$NON-NLS-1$
 	            }
 	        }
@@ -456,16 +481,15 @@
         supportedFunctions.add("IFNULL"); //$NON-NLS-1$
         supportedFunctions.add("NVL");      //$NON-NLS-1$ 
         supportedFunctions.add("COALESCE"); //$NON-NLS-1$
-        
+        supportedFunctions.add(RELATE);
+        supportedFunctions.add(NEAREST_NEIGHBOR);
+        supportedFunctions.add(NEAREST_NEIGHBOR_DISTANCE);
+        supportedFunctions.add(WITHIN_DISTANCE);
+        supportedFunctions.add(FILTER);
         return supportedFunctions;
     }
     
     @Override
-    public List<FunctionMethod> getPushDownFunctions(){
-    	return OracleSpatialFunctions.getOracleSpatialFunctions();
-    }
-    
-    @Override
     public String translateLiteralTimestamp(Timestamp timestampValue) {
     	if (timestampValue.getNanos() == 0) {
     		String val = formatDateValue(timestampValue);

Deleted: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleSpatialFunctions.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleSpatialFunctions.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleSpatialFunctions.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -1,149 +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.translator.jdbc.oracle;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.teiid.core.types.DataTypeManager;
-import org.teiid.metadata.FunctionMethod;
-import org.teiid.metadata.FunctionParameter;
-
-public class OracleSpatialFunctions {
-	
-	/*
-	 * Spatial Functions
-	 */
-	public static final String RELATE = "sdo_relate"; //$NON-NLS-1$
-	public static final String NEAREST_NEIGHBOR = "sdo_nn"; //$NON-NLS-1$
-	public static final String FILTER = "sdo_filter"; //$NON-NLS-1$
-	public static final String WITHIN_DISTANCE = "sdo_within_distance"; //$NON-NLS-1$
-	public static final String NEAREST_NEIGHBOR_DISTANCE = "sdo_nn_distance"; //$NON-NLS-1$
-	public static final String ORACLE_SDO = "Oracle-SDO"; //$NON-NLS-1$
-	
-
-    public static List<FunctionMethod> getOracleSpatialFunctions(){
-    	    	
-    	List<FunctionMethod> spatialFuncs = new ArrayList<FunctionMethod>();
-    	
-    	spatialFuncs.add(new FunctionMethod(ORACLE_SDO + '.' + RELATE, RELATE, ORACLE_SDO,   
-                new FunctionParameter[] {
-                    new FunctionParameter("GEOM1", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("GEOM2", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("PARAMS", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-
-    	spatialFuncs.add(new FunctionMethod(ORACLE_SDO + '.' + RELATE, RELATE, ORACLE_SDO, 
-                new FunctionParameter[] {
-                    new FunctionParameter("GEOM1", DataTypeManager.DefaultDataTypes.OBJECT, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("GEOM2", DataTypeManager.DefaultDataTypes.OBJECT, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("PARAMS", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-    	
-    	spatialFuncs.add(new FunctionMethod(ORACLE_SDO + '.' + RELATE, RELATE, ORACLE_SDO,  
-                new FunctionParameter[] {
-                    new FunctionParameter("GEOM1", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("GEOM2", DataTypeManager.DefaultDataTypes.OBJECT, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("PARAMS", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-
-    	spatialFuncs.add(new FunctionMethod(ORACLE_SDO + '.' + RELATE, RELATE, ORACLE_SDO, 
-                new FunctionParameter[] {
-                    new FunctionParameter("GEOM1", DataTypeManager.DefaultDataTypes.OBJECT, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("GEOM2", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("PARAMS", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-    	
-    	spatialFuncs.add(new FunctionMethod(ORACLE_SDO + '.' + NEAREST_NEIGHBOR, NEAREST_NEIGHBOR, ORACLE_SDO,   
-                new FunctionParameter[] {
-                    new FunctionParameter("GEOM1", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("GEOM2", DataTypeManager.DefaultDataTypes.OBJECT, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("PARAMS", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("NUMBER", DataTypeManager.DefaultDataTypes.INTEGER, "") }, //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-    	
-    	spatialFuncs.add(new FunctionMethod(ORACLE_SDO + '.' + NEAREST_NEIGHBOR, NEAREST_NEIGHBOR, ORACLE_SDO,  
-                new FunctionParameter[] {
-                    new FunctionParameter("GEOM1", DataTypeManager.DefaultDataTypes.OBJECT, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("GEOM2", DataTypeManager.DefaultDataTypes.OBJECT, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("PARAMS", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("NUMBER", DataTypeManager.DefaultDataTypes.INTEGER, "") }, //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$    	
-
-    	spatialFuncs.add(new FunctionMethod(ORACLE_SDO + '.' + NEAREST_NEIGHBOR, NEAREST_NEIGHBOR, ORACLE_SDO,  
-                new FunctionParameter[] {
-                    new FunctionParameter("GEOM1", DataTypeManager.DefaultDataTypes.OBJECT, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("GEOM2", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("PARAMS", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("NUMBER", DataTypeManager.DefaultDataTypes.INTEGER, "") }, //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$    	
-    	
-    	spatialFuncs.add(new FunctionMethod(ORACLE_SDO + '.' + NEAREST_NEIGHBOR_DISTANCE, NEAREST_NEIGHBOR_DISTANCE, ORACLE_SDO,  
-                new FunctionParameter[] {
-                    new FunctionParameter("NUMBER", DataTypeManager.DefaultDataTypes.INTEGER, "") }, //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$  
-    	    	
-    	spatialFuncs.add(new FunctionMethod(ORACLE_SDO + '.' + WITHIN_DISTANCE, WITHIN_DISTANCE, ORACLE_SDO, 
-                new FunctionParameter[] {
-                    new FunctionParameter("GEOM1", DataTypeManager.DefaultDataTypes.OBJECT, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("GEOM2", DataTypeManager.DefaultDataTypes.OBJECT, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("PARAMS", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-    	
-    	spatialFuncs.add(new FunctionMethod(ORACLE_SDO + '.' + WITHIN_DISTANCE, WITHIN_DISTANCE, ORACLE_SDO,   
-                new FunctionParameter[] {
-                    new FunctionParameter("GEOM1", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("GEOM2", DataTypeManager.DefaultDataTypes.OBJECT, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("PARAMS", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$    	
-    	
-    	spatialFuncs.add(new FunctionMethod(ORACLE_SDO + '.' + WITHIN_DISTANCE, WITHIN_DISTANCE, ORACLE_SDO,  
-                new FunctionParameter[] {
-                    new FunctionParameter("GEOM1", DataTypeManager.DefaultDataTypes.OBJECT, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("GEOM2", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("PARAMS", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-    	
-    	spatialFuncs.add(new FunctionMethod(ORACLE_SDO + '.' + FILTER, FILTER, ORACLE_SDO,   
-                new FunctionParameter[] {
-                    new FunctionParameter("GEOM1", DataTypeManager.DefaultDataTypes.OBJECT, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("GEOM2", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("PARAMS", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-    	
-    	spatialFuncs.add(new FunctionMethod(ORACLE_SDO + '.' + FILTER, FILTER, ORACLE_SDO,  
-                new FunctionParameter[] {
-                    new FunctionParameter("GEOM1", DataTypeManager.DefaultDataTypes.OBJECT, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("GEOM2", DataTypeManager.DefaultDataTypes.OBJECT, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("PARAMS", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$    
-    	
-    	spatialFuncs.add(new FunctionMethod(ORACLE_SDO + '.' + FILTER, FILTER, ORACLE_SDO,   
-                new FunctionParameter[] {
-                    new FunctionParameter("GEOM1", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("GEOM2", DataTypeManager.DefaultDataTypes.OBJECT, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("PARAMS", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$      	
-    	
-    	return spatialFuncs;
-    }
-}

Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/teradata/TeradataExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/teradata/TeradataExecutionFactory.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/teradata/TeradataExecutionFactory.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -22,6 +22,8 @@
 
 package org.teiid.translator.jdbc.teradata;
 
+import static org.teiid.translator.TypeFacility.RUNTIME_NAMES.*;
+
 import java.sql.Date;
 import java.sql.Time;
 import java.sql.Timestamp;
@@ -29,14 +31,11 @@
 import java.util.Arrays;
 import java.util.List;
 
-import org.teiid.core.types.DataTypeManager;
 import org.teiid.language.ColumnReference;
 import org.teiid.language.Expression;
 import org.teiid.language.Function;
 import org.teiid.language.LanguageFactory;
 import org.teiid.language.Literal;
-import org.teiid.metadata.FunctionMethod;
-import org.teiid.metadata.FunctionParameter;
 import org.teiid.translator.SourceSystemFunctions;
 import org.teiid.translator.Translator;
 import org.teiid.translator.TranslatorException;
@@ -69,33 +68,60 @@
 		convert.addTypeMapping("double precision", FunctionModifier.DOUBLE); //$NON-NLS-1$
 		convert.addTypeMapping("numeric(18,0)", FunctionModifier.BIGINTEGER); //$NON-NLS-1$
 		convert.addTypeMapping("char(1)", FunctionModifier.CHAR); //$NON-NLS-1$
-    	convert.addConvert(FunctionModifier.INTEGER, FunctionModifier.STRING, new ImplicitConvertModifier());
-    	convert.addConvert(FunctionModifier.BIGDECIMAL, FunctionModifier.STRING, new ImplicitConvertModifier());
-    	convert.addConvert(FunctionModifier.BIGINTEGER, FunctionModifier.STRING, new ImplicitConvertModifier());
-    	convert.addConvert(FunctionModifier.FLOAT, FunctionModifier.STRING, new ImplicitConvertModifier());
-    	convert.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.STRING, new ImplicitConvertModifier());
-    	convert.addConvert(FunctionModifier.LONG, FunctionModifier.STRING, new ImplicitConvertModifier());
-    	convert.addConvert(FunctionModifier.SHORT, FunctionModifier.STRING, new ImplicitConvertModifier());
-    	convert.addConvert(FunctionModifier.DOUBLE, FunctionModifier.STRING, new ImplicitConvertModifier());
-    	convert.addConvert(FunctionModifier.BYTE, FunctionModifier.STRING, new ImplicitConvertModifier());
-    	convert.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.TIME, new TimeModifier("TIME")); //$NON-NLS-1$
-    	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.TIME, new CastModifier("TIME")); //$NON-NLS-1$
+    	convert.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.DATE,  new CastModifier("DATE")); //$NON-NLS-1$ 
+    	convert.addConvert(FunctionModifier.TIME, FunctionModifier.TIMESTAMP, new CastModifier("TIMESTAMP")); //$NON-NLS-1$
+    	convert.addConvert(FunctionModifier.DATE, FunctionModifier.TIMESTAMP,  new CastModifier("TIMESTAMP")); //$NON-NLS-1$
+
+    	convert.addConvert(FunctionModifier.STRING, FunctionModifier.INTEGER, new CastModifier("integer")); //$NON-NLS-1$
+    	convert.addConvert(FunctionModifier.STRING, FunctionModifier.BIGDECIMAL, new CastModifier("decimal(37,5)"));//$NON-NLS-1$
+    	convert.addConvert(FunctionModifier.STRING, FunctionModifier.BIGINTEGER, new CastModifier("numeric(18,0)"));//$NON-NLS-1$
+    	convert.addConvert(FunctionModifier.STRING, FunctionModifier.FLOAT, new CastModifier("float"));//$NON-NLS-1$
+    	convert.addConvert(FunctionModifier.STRING, FunctionModifier.BOOLEAN, new CastModifier("byteint"));//$NON-NLS-1$
+    	convert.addConvert(FunctionModifier.STRING, FunctionModifier.LONG, new CastModifier("numeric(18,0)"));//$NON-NLS-1$
+    	convert.addConvert(FunctionModifier.STRING, FunctionModifier.SHORT, new CastModifier("smallint"));//$NON-NLS-1$
+    	convert.addConvert(FunctionModifier.STRING, FunctionModifier.DOUBLE, new CastModifier("double precision"));//$NON-NLS-1$
+    	convert.addConvert(FunctionModifier.STRING, FunctionModifier.BYTE, new CastModifier("byteint")); //$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 +143,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() {
@@ -131,7 +165,48 @@
 			public List<?> translate(Function function) {
 				return Arrays.asList(function.getParameters().get(0), " MOD ", function.getParameters().get(1)); //$NON-NLS-1$
 			}
+		});  
+        
+        addPushDownFunction(TERADATA, "COSH", FLOAT, FLOAT); //$NON-NLS-1$
+        addPushDownFunction(TERADATA, "TANH", FLOAT, FLOAT); //$NON-NLS-1$
+        addPushDownFunction(TERADATA, "ACOSH", FLOAT, FLOAT); //$NON-NLS-1$
+        addPushDownFunction(TERADATA, "ASINH", FLOAT, FLOAT); //$NON-NLS-1$
+        addPushDownFunction(TERADATA, "ATANH", FLOAT, FLOAT); //$NON-NLS-1$
+        addPushDownFunction(TERADATA, "CHAR2HEXINT", STRING, STRING); //$NON-NLS-1$
+        addPushDownFunction(TERADATA, "INDEX", INTEGER, STRING, STRING); //$NON-NLS-1$
+        addPushDownFunction(TERADATA, "BYTES", INTEGER, STRING); //$NON-NLS-1$
+        addPushDownFunction(TERADATA, "OCTET_LENGTH", INTEGER, STRING); //$NON-NLS-1$
+        addPushDownFunction(TERADATA, "HASHAMP", INTEGER, STRING); //$NON-NLS-1$
+        addPushDownFunction(TERADATA, "HASHBAKAMP", INTEGER, STRING); //$NON-NLS-1$
+        addPushDownFunction(TERADATA, "HASHBUCKET", INTEGER, STRING); //$NON-NLS-1$
+        addPushDownFunction(TERADATA, "HASHROW", INTEGER, STRING); //$NON-NLS-1$
+        addPushDownFunction(TERADATA, "NULLIFZERO", BIG_DECIMAL, BIG_DECIMAL); //$NON-NLS-1$        
+        addPushDownFunction(TERADATA, "ZEROIFNULL", BIG_DECIMAL, BIG_DECIMAL); //$NON-NLS-1$
+        registerFunctionModifier(SourceSystemFunctions.COT, new FunctionModifier() {
+			@Override
+			public List<?> translate(Function function) {
+				function.setName(SourceSystemFunctions.TAN);
+				return Arrays.asList(getLanguageFactory().createFunction(SourceSystemFunctions.DIVIDE_OP, new Expression[] {new Literal(1, TypeFacility.RUNTIME_TYPES.INTEGER), function}, TypeFacility.RUNTIME_TYPES.DOUBLE));
+			}
 		});        
+        registerFunctionModifier(SourceSystemFunctions.LTRIM, new FunctionModifier() {
+			@Override
+			public List<?> translate(Function function) {
+				return Arrays.asList("TRIM(LEADING FROM ", function.getParameters().get(0), ")"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		}); 
+        registerFunctionModifier(SourceSystemFunctions.RTRIM, new FunctionModifier() {
+			@Override
+			public List<?> translate(Function function) {
+				return Arrays.asList("TRIM(TRAILING FROM ", function.getParameters().get(0), ")"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		}); 
+        registerFunctionModifier(SourceSystemFunctions.MOD, new FunctionModifier() {
+			@Override
+			public List<?> translate(Function function) {
+				return Arrays.asList(function.getParameters().get(0), " MOD ", function.getParameters().get(1)); //$NON-NLS-1$
+			}
+		});        
 	}
 
 	@Override
@@ -163,7 +238,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);
@@ -178,106 +252,13 @@
         supportedFunctions.add(SourceSystemFunctions.SQRT);
         supportedFunctions.add(SourceSystemFunctions.SUBSTRING);
         supportedFunctions.add(SourceSystemFunctions.TAN);
-        supportedFunctions.add("||"); //$NON-NLS-1$
-        supportedFunctions.add("**"); //$NON-NLS-1$
         supportedFunctions.add(SourceSystemFunctions.UCASE);
         supportedFunctions.add(SourceSystemFunctions.YEAR);
 
         return supportedFunctions;
     }
     
-    
     @Override
-    public List<FunctionMethod> getPushDownFunctions(){
-    	        
-    	List<FunctionMethod> pushdownFunctions = new ArrayList<FunctionMethod>();
-    
-		pushdownFunctions.add(new FunctionMethod(TERADATA + '.' + "COSH", "COSH", TERADATA, //$NON-NLS-1$ //$NON-NLS-2$
-            new FunctionParameter[] {
-                new FunctionParameter("float", DataTypeManager.DefaultDataTypes.FLOAT, "Hyperbolic Cos")}, //$NON-NLS-1$ //$NON-NLS-2$
-            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.FLOAT, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-
-		pushdownFunctions.add(new FunctionMethod(TERADATA + '.' + "SINH", "SINH", TERADATA, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("float", DataTypeManager.DefaultDataTypes.FLOAT, "Hyperbolic Sin")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.FLOAT, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-
-		pushdownFunctions.add(new FunctionMethod(TERADATA + '.' + "TANH", "TANH", TERADATA, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("float", DataTypeManager.DefaultDataTypes.FLOAT, "Hyperbolic Tanh")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.FLOAT, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-
-		pushdownFunctions.add(new FunctionMethod(TERADATA + '.' + "ACOSH", "ACOSH", TERADATA, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("float", DataTypeManager.DefaultDataTypes.FLOAT, "Hyperbolic ArcCos")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.FLOAT, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-		
-		pushdownFunctions.add(new FunctionMethod(TERADATA + '.' + "ASINH", "ASINH", TERADATA, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("float", DataTypeManager.DefaultDataTypes.FLOAT, "Hyperbolic ArcSin")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.FLOAT, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-
-		pushdownFunctions.add(new FunctionMethod(TERADATA + '.' + "ATANH", "ATANH", TERADATA, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("float", DataTypeManager.DefaultDataTypes.FLOAT, "Hyperbolic ArcTan")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.FLOAT, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-				
-		pushdownFunctions.add(new FunctionMethod(TERADATA + '.' + "CHAR2HEXINT", "CHAR2HEXINT", TERADATA, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("string", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-		
-		pushdownFunctions.add(new FunctionMethod(TERADATA + '.' + "INDEX", "INDEX", TERADATA, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("string1", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-	                new FunctionParameter("String2", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-
-		pushdownFunctions.add(new FunctionMethod(TERADATA + '.' + "BYTES", "BYTES", TERADATA, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("String2", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-
-		pushdownFunctions.add(new FunctionMethod(TERADATA + '.' + "OCTET_LENGTH", "OCTET_LENGTH", TERADATA, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("String2", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-
-		pushdownFunctions.add(new FunctionMethod(TERADATA + '.' + "HASHAMP", "HASHAMP", TERADATA, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("String2", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-
-		pushdownFunctions.add(new FunctionMethod(TERADATA + '.' + "HASHBAKAMP", "HASHBAKAMP", TERADATA, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("String2", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-
-		pushdownFunctions.add(new FunctionMethod(TERADATA + '.' + "HASHBUCKET", "HASHBUCKET", TERADATA, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("String2", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-
-		pushdownFunctions.add(new FunctionMethod(TERADATA + '.' + "HASHROW", "HASHROW", TERADATA, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("String2", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-		
-		pushdownFunctions.add(new FunctionMethod(TERADATA + '.' + "NULLIFZERO", "NULLIFZERO", TERADATA, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("integer", DataTypeManager.DefaultDataTypes.BIG_DECIMAL, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.BIG_DECIMAL, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-		
-		pushdownFunctions.add(new FunctionMethod(TERADATA + '.' + "ZEROIFNULL", "ZEROIFNULL", TERADATA, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter[] {
-	                new FunctionParameter("integer", DataTypeManager.DefaultDataTypes.BIG_DECIMAL, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-	            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.BIG_DECIMAL, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$		
-		
-		return pushdownFunctions;		
-    }    
-    
-    
-    @Override
     public String translateLiteralDate(Date dateValue) {
         return "cast('" + formatDateValue(dateValue) + "' AS DATE FORMAT 'yyyy-mm-dd')"; //$NON-NLS-1$//$NON-NLS-2$
     }
@@ -349,41 +330,63 @@
 		
     	@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("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$	    		
+    		}
+    		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$ 
     }
@@ -399,17 +402,9 @@
 		}
 	}
     
-    public static class ImplicitConvertModifier extends FunctionModifier {
-		@Override
-		public List<?> translate(Function function) {
-			return Arrays.asList(function.getParameters().get(0));
-		}
-	}
-    
-    
-    public static class TimeModifier extends FunctionModifier {
+    public static class CastModifier extends FunctionModifier {
     	private String target;
-    	public TimeModifier(String target) {
+    	public CastModifier(String target) {
     		this.target = target;
     	}
 		@Override
@@ -418,10 +413,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 +432,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 +471,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,9 +485,28 @@
             	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;
         }
     }    
+    
+    public static class UpperOrLowerModifier extends FunctionModifier {
+    	String funcName;
+    	ConvertModifier convertModifier;
+    	public UpperOrLowerModifier(String name, ConvertModifier converModifier) {
+    		this.funcName = name;
+    		this.convertModifier = converModifier;
+    	}
+    	@Override
+		public List<?> translate(Function function) {
+			Expression expr = function.getParameters().get(0);
+			ArrayList target = new ArrayList();
+			target.add(this.funcName);
+			target.add("("); //$NON-NLS-1$
+			target.addAll(expressionToString(expr, this.convertModifier));
+			target.add(")"); //$NON-NLS-1$
+			return target;
+		}
+	}    
 }

Modified: trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/TranslationHelper.java
===================================================================
--- trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/TranslationHelper.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/TranslationHelper.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -36,6 +36,7 @@
 import org.mockito.Mockito;
 import org.teiid.cdk.api.TranslationUtility;
 import org.teiid.cdk.unittest.FakeTranslationFactory;
+import org.teiid.core.CoreConstants;
 import org.teiid.core.TeiidRuntimeException;
 import org.teiid.language.Command;
 import org.teiid.metadata.FunctionMethod;
@@ -72,7 +73,7 @@
 	public static void loadUDFs(String udf, TranslationUtility util) {
 		try {
 			Collection <FunctionMethod> methods = FunctionMetadataReader.loadFunctionMethods(TranslationHelper.class.getResource(udf).openStream());
-			util.setUDF(methods);
+			util.addUDF("foo", methods); //$NON-NLS-1$
 		} catch (IOException e) {
 			throw new TeiidRuntimeException("failed to load UDF"); //$NON-NLS-1$
 		} catch (JAXBException e) {
@@ -83,8 +84,11 @@
     public static Command helpTranslate(String vdbFileName, String udf, List<FunctionMethod> pushdowns, String sql) {
     	TranslationUtility util =  getTranslationUtility(vdbFileName, null);   
     	
-    	Collection <FunctionMethod> methods = new ArrayList<FunctionMethod>();
+    	if (pushdowns != null) {
+    		util.addUDF(CoreConstants.SYSTEM_MODEL, pushdowns);
+    	}
     	if (udf != null) {
+        	Collection <FunctionMethod> methods = new ArrayList<FunctionMethod>();
     		try {
 				methods.addAll(FunctionMetadataReader.loadFunctionMethods(TranslationHelper.class.getResource(udf).openStream()));
 			} catch (JAXBException e) {
@@ -92,11 +96,8 @@
 			} catch (IOException e) {
 				throw new TeiidRuntimeException("failed to load UDF"); //$NON-NLS-1$
 			}
+			util.addUDF("foo", methods); //$NON-NLS-1$
     	}
-    	if (pushdowns != null) {
-    		methods.addAll(pushdowns);
-    	}
-    	util.setUDF(methods);
     	return util.parseCommand(sql);
     }    
 


Property changes on: trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/TranslationHelper.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Modified: trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java
===================================================================
--- trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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;
@@ -395,7 +394,15 @@
                 input, output, 
                 TRANSLATOR);
     }
+    
+    @Test public void test_sdo_within_distance_pushdownfunction() throws Exception {
+        String input = "SELECT INTKEY FROM BQT1.SMALLA WHERE sdo_within_distance(OBJECTVALUE, 'SDO_GEOMETRY(2001, 8307, MDSYS.SDO_POINT_TYPE(90.0, -45.0, NULL), NULL, NULL)', 'DISTANCE=25.0 UNIT=NAUT_MILE') = true"; //$NON-NLS-1$
+        String output = "SELECT SmallA.IntKey FROM SmallA WHERE sdo_within_distance(SmallA.ObjectValue, SDO_GEOMETRY(2001, 8307, MDSYS.SDO_POINT_TYPE(90.0, -45.0, NULL), NULL, NULL), 'DISTANCE=25.0 UNIT=NAUT_MILE') = 'true'";  //$NON-NLS-1$
 
+        TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, input, output, 
+                TRANSLATOR);
+    }
+
     /**
      * Test a query which uses 
      * <code>sdo_within_distance(String literal, Object element, String literal) 
@@ -536,7 +543,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 +610,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 +729,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 +740,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 +749,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 +757,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 +778,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: trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/sqlserver/TestSqlServerConversionVisitor.java
===================================================================
--- trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/sqlserver/TestSqlServerConversionVisitor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/sqlserver/TestSqlServerConversionVisitor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/teradata/TestTeradataTranslator.java
===================================================================
--- trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/teradata/TestTeradataTranslator.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/teradata/TestTeradataTranslator.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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);    	
     }    
     
@@ -100,17 +112,21 @@
     
     
     @Test public void testByteToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "string", "1"); 
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "string", "cast(1 AS varchar(4000))"); 
     }
     
     @Test public void testByte2ToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)-1), Byte.class), "string", "-1"); 
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)-1), Byte.class), "string", "cast(-1 AS varchar(4000))"); 
     }
     
     @Test public void testDoubleToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.0), Double.class), "string", "1.0"); 
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.0), Double.class), "string", "cast(1.0 AS varchar(4000))"); 
     }    
     
+    @Test public void testStringToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("1.0", String.class), "double", "cast('1.0' AS double precision)"); 
+    }      
+    
 	@Test public void testInDecompose() throws Exception {
     	Expression left = LANG_FACTORY.createLiteral("1", String.class);
     	List<Expression> right = new ArrayList<Expression>();
@@ -178,7 +194,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 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);		
+	}	
 }

Modified: trunk/connectors/translator-ldap/src/test/java/org/teiid/translator/ldap/TestIQueryToLdapSearchParser.java
===================================================================
--- trunk/connectors/translator-ldap/src/test/java/org/teiid/translator/ldap/TestIQueryToLdapSearchParser.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/connectors/translator-ldap/src/test/java/org/teiid/translator/ldap/TestIQueryToLdapSearchParser.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/SalesForceExecutionFactory.java
===================================================================
--- trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/SalesForceExecutionFactory.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/SalesForceExecutionFactory.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -22,7 +22,9 @@
 
 package org.teiid.translator.salesforce;
 
+import static org.teiid.translator.TypeFacility.RUNTIME_NAMES.*;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
@@ -88,7 +90,9 @@
 	@Override
 	public void start() throws TranslatorException {
 		super.start();
-		LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Started"); //$NON-NLS-1$
+		addPushDownFunction(SALESFORCE, INCLUDES, BOOLEAN, STRING, STRING);
+		addPushDownFunction(SALESFORCE, EXCLUDES, BOOLEAN, STRING, STRING);
+		LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Salesforce ExecutionFactory Started"); //$NON-NLS-1$
 	}
 
 
@@ -124,28 +128,11 @@
 	}	
 	
     @Override
-    public List getSupportedFunctions() {
-        return Collections.EMPTY_LIST;
+    public List<String> getSupportedFunctions() {
+        return Arrays.asList(INCLUDES, EXCLUDES);
     }
     
     @Override
-    public List<FunctionMethod> getPushDownFunctions(){
-    	List<FunctionMethod> pushdownFunctions = new ArrayList<FunctionMethod>();
-		pushdownFunctions.add(new FunctionMethod(SALESFORCE + '.' +INCLUDES, INCLUDES, SALESFORCE, 
-            new FunctionParameter[] {
-                new FunctionParameter("columnName", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("param", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-            new FunctionParameter("result", DataTypeManager.DefaultDataTypes.BOOLEAN, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$
-		
-		pushdownFunctions.add(new FunctionMethod(SALESFORCE + '.' + EXCLUDES, EXCLUDES, SALESFORCE, 
-                new FunctionParameter[] {
-                    new FunctionParameter("columnName", DataTypeManager.DefaultDataTypes.STRING, ""), //$NON-NLS-1$ //$NON-NLS-2$
-                    new FunctionParameter("param", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-                new FunctionParameter("result", DataTypeManager.DefaultDataTypes.BOOLEAN, "") ) ); //$NON-NLS-1$ //$NON-NLS-2$    		
-    	return pushdownFunctions;    	
-    }
-
-    @Override
     public boolean supportsCompareCriteriaEquals() {
         return true;
     }

Modified: trunk/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java
===================================================================
--- trunk/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml
===================================================================
--- trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml	2011-06-05 01:32:10 UTC (rev 3218)
@@ -223,7 +223,16 @@
                         to create session. Teiid also verifies that the same user is using this connection during the life of the connection.
                         if it finds a different security context on the calling thread, it switches the identity on the connection,
                         if the new user is also eligible to log in to Teiid otherwise connection fails to execute.</entry>
-                    </row>                     
+                    </row>
+                    <row id="useCallingThread">
+                        <entry>
+                            <code>useCallingThread</code>
+                        </entry>
+                        <entry>
+                            <code>boolean</code>
+                        </entry>
+                        <entry>Only applies to "local" connections. When this option is set to "true" (the default), then the calling thread will be used to process the query.  If false, then an engine thread will be used.</entry>
+                    </row>                        
                     <row>
                     	<entry>
                             <code>QueryTimeout</code>
@@ -458,7 +467,8 @@
            there is a way to make connections that by-pass making a socket based JDBC connection.
            You can use slightly modified data source configuration to make a "local" connection, where the JDBC API will lookup a local Teiid runtime in the same VM.</para>
            <warning><para>Since DataSources start before before Teiid VDBs are deployed, leave the min pool size of local connections as the default of 0.  Otherwise errors will occur on the startup of the Teiid DataSource.</para></warning>
-           <note><para>Local connections use their calling thread to perform processing operations rather than using an engine thread while the calling thread is blocked.</para></note>
+           <note><para>Be default local connections use their calling thread to perform processing operations rather than using an engine thread while the calling thread is blocked.
+            To disable this behavior set the connection property useCallingThreads=false.</para></note>
            <example>
            <title>Local data source</title>
            <programlisting><![CDATA[<datasources>
@@ -541,7 +551,7 @@
         	The Teiid driver/DataSource should then typically be configured to just use the single host/port of your load balancer.</para>
         </section>
     </section>
-    <section>
+    <section id="reauthentication">
     	<title>Reauthentication</title>
     	<para>Teiid connections (defined by the <code>org.teiid.jdbc.TeiidConnection</code> interface) support the changeUser method to reauthenticate a given connection.  
     	If the reauthentication is successful the current connection my be used with the given identity.  

Modified: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-extensions.xml
===================================================================
--- trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-extensions.xml	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-extensions.xml	2011-06-05 01:32:10 UTC (rev 3218)
@@ -185,7 +185,7 @@
             <para>SET Syntax:
             </para>
             <listitem>
-                <para>SET parameter value
+                <para>SET (parameter|SESSION AUTHORIZATION) value
                 </para>
             </listitem>
         </itemizedlist>
@@ -193,10 +193,10 @@
             <para>Syntax Rules:
             </para>
             <listitem>
-                <para>Both parameter and value must be simple literals - they cannot contain spaces.</para>
+                <para>The parameter must be a non-quoted identifier - it cannot contain spaces.</para>
             </listitem>
             <listitem>
-                <para>The value is also not treated as an expression and will not be evaluated prior to being set as the parameter value.</para>
+                <para>The value may be either a non-quoted identifier or a quoted string literal value.</para>
             </listitem>
         </itemizedlist>
         <para>The SET statement is most commonly used to control planning and execution.</para>
@@ -208,7 +208,6 @@
                 <para>SET NOEXEC (ON|OFF)</para>
             </listitem>
         </itemizedlist>        
-        
         <example id="plan_debug">
         	<title>Enabling Plan Debug</title>
         	<programlisting>Statement s = connection.createStatement();
@@ -222,6 +221,16 @@
 String debugLog = planRs.getString("DEBUG_LOG"); 
         	</programlisting>
         </example>
+        <para>The SET statement may also be used to control authorization.  
+        A SET SESSION AUTHORIZATION statement will perform a <xref linkend="reauthentication"/> given the credentials currently set on the connection.
+        The connection credentials may be changed by issuing a SET PASSWORD statement.  A SET PASSWORD statement does not perform a reauthentication.</para>
+        <example>
+        	<title>Changing Session Authorization</title>
+        	<programlisting>Statement s = connection.createStatement();
+s.execute("SET PASSWORD 'someval'");
+s.execute("SET SESSION AUTHORIZATION 'newuser'");
+        	</programlisting>
+        </example>
        </section>
 
        <section id="show_statement">

Modified: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/odbc.xml
===================================================================
--- trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/odbc.xml	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/odbc.xml	2011-06-05 01:32:10 UTC (rev 3218)
@@ -23,6 +23,11 @@
      <para>Before an application can use ODBC, you must first install the ODBC driver on same machine that 
      the application is running on and then create Data Source Name (DSN) that represents a connection profile for your Teiid VDB.
      </para>
+     
+     <warning><para>Teiid currently only supports plain text passward authentication for ODBC.  
+     If the client/server are not configured to use SSL, the password will be sent in plain text over the network.  
+     If you need secure passwords in transit and are not using SSL, then consider installing a security domain 
+     that will accept safe password values from the client (for example encrypted or hashed).</para></warning>
 
     <section id="install">
         <title>Installing the ODBC Driver Client</title>
@@ -145,7 +150,6 @@
                     listenes for ODBC requests on port 35432</para>
                     <para>In the <emphasis>User Name</emphasis> and <emphasis>Password</emphasis> edit boxes, supply the user name and password
                     for the Teiid runtime access.</para>
-                    <para>Leave <emphasis>SSL Mode</emphasis> to disabled. SSL connections are currently not supported.</para>
                     <para>Provide any description about the data source in the <emphasis>Description</emphasis> field.</para>
                 </listitem>
                 

Modified: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/ssl.xml
===================================================================
--- trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/ssl.xml	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/ssl.xml	2011-06-05 01:32:10 UTC (rev 3218)
@@ -13,13 +13,13 @@
     <section id="default_security">
         <title>Default Security</title>
         
-        <para>If you are using a socket connection, then you may need to secure the channel more completely.</para>
-    
-        <para>By default all sensitive (non-data) messages between client and server 
+        <para>By default all JDBC/Admin sensitive (non-data) messages between client and server 
         are encrypted using a <ulink url="http://en.wikipedia.org/wiki/Diffie-Hellman_key_exchange">Diffy-Hellman</ulink> 
         key that is negotiated per connection. This 
         encryption is controlled by <code>clientEncryptionEnabled</code> property in <code>JdbcSslConfiguration</code> and 
         <code>AdminSslConfiguration</code> sections in the &jboss-beans; file.</para>
+        
+        <para>If you are using a socket connection, then you may need to secure the channel more completely - especially if using ODBC, which currently only supports plain text authentication.</para>
     </section>
     
     <section id="ssl_modes">

Modified: trunk/documentation/developer-guide/src/main/docbook/en-US/content/logging.xml
===================================================================
--- trunk/documentation/developer-guide/src/main/docbook/en-US/content/logging.xml	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/documentation/developer-guide/src/main/docbook/en-US/content/logging.xml	2011-06-05 01:32:10 UTC (rev 3218)
@@ -33,19 +33,67 @@
             <title>Command Logging API</title>
             <para>
                 If you want to build a custom appender for command logging that will have access to 
-                log4j "LoggingEvents" to the "COMMAND_LOG" context, it will have a message that is an instance of
-                <code>org.teiid.logging.CommandLogMessage</code> defined in the <code>teiid-api-&versionNumber;.jar</code> 
-                use these class in your development. The CommmdLogMessage include information about vdb, session, command-sql etc.
+                log4j "LoggingEvents" to the "COMMAND_LOG" context, the appender will receive a message that is an instance of
+                <code>org.teiid.logging.CommandLogMessage</code>.  The relevant Teiid classes are defined in the <code>teiid-api-&versionNumber;.jar</code>. 
+                The CommmdLogMessage includes information about vdb, session, command sql, etc.  CommandLogMessages are logged at the DEBUG level.
             </para>
+            <example>
+				<title>Sample CommandLogMessage Usage</title>
+				<programlisting language="Java" role="JAVA"><![CDATA[package org.something;
+import org.apache.log4j.AppenderSkeleton;
+import org.apache.log4j.spi.LoggingEvent;
+import org.teiid.logging.*;
+
+public class CustomAppender extends AppenderSkeleton 
+{
+  
+  protected void append(LoggingEvent event) {
+    if (event.getMessage() instanceof CommandLogMessage) {
+      CommandLogMessage clMessage = (CommandLogMessage)event.getMessage();
+      String sql = clMessage.getSql();
+      ...
+      //log to a database, trigger an email, etc.
+    }
+    ...
+  }
+  
+  ...
+  
+}]]></programlisting>
+			</example>
         </section>
         
         <section id="audit_logging">
             <title>Audit Logging API</title>
             <para>If you want to build a custom appender for command logging that will have access to 
-                log4j "LoggingEvents" to the "AUDIT_LOG" context, it will have a message that is an instance of
-                <code>org.teiid.logging.AuditMessage</code> defined in the <code>teiid-api-&versionNumber;.jar</code> 
-                use this class in your development. AuditMessage include  information about user, the action, and the
-                target(s) of the action.</para>                            
+                log4j "LoggingEvents" to the "org.teiid.AUDIT_LOG" context, the appender will receive a message that is an instance of
+                <code>org.teiid.logging.AuditMessage</code>.  The relevant Teiid classes are defined in the <code>teiid-api-&versionNumber;.jar</code>. The <code>AuditMessage</code> includes information about user, the action, and the
+                target(s) of the action.  AuditMessages are logged at the DEBUG level.
+            </para>                            
+            <example>
+				<title>Sample AuditMessage Usage</title>
+				<programlisting language="Java" role="JAVA"><![CDATA[package org.something;
+import org.apache.log4j.AppenderSkeleton;
+import org.apache.log4j.spi.LoggingEvent;
+import org.teiid.logging.*;
+
+public class CustomAppender extends AppenderSkeleton 
+{
+  
+  protected void append(LoggingEvent event) {
+    if (event.getMessage() instanceof AuditMessage) {
+      AuditMessage auditMessage = (AuditMessage)event.getMessage();
+      String activity = auditMessage.getActivity();
+      ...
+      //log to a database, trigger an email, etc.
+    }
+    ...
+  }
+  
+  ...
+  
+}]]></programlisting>
+			</example>
         </section>
 	</section>
 </chapter>
\ No newline at end of file

Modified: trunk/documentation/developer-guide/src/main/docbook/en-US/content/udf.xml
===================================================================
--- trunk/documentation/developer-guide/src/main/docbook/en-US/content/udf.xml	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/documentation/developer-guide/src/main/docbook/en-US/content/udf.xml	2011-06-05 01:32:10 UTC (rev 3218)
@@ -161,7 +161,7 @@
 				<para>Code Requirements</para>
 				<listitem>
 					<para>The java class containing the function method must be defined
-						public.
+						public.  <note><para>As many UDF methods as you want can be declared on the same class.</para></note>
             </para>
 				</listitem>
 				<listitem>
@@ -184,7 +184,7 @@
 			</itemizedlist>
 			<para>You may optionally add an additional <code>org.teiid.CommandContext</code> argument as the first parameter.  
 			The <code>CommandContext</code> interface provides access to information about the current command, such as the executing user, Subject, the vdb, the session id, etc.  
-			This <code>CommandContext</code> parameter does not need to be delared in the function metadata.</para>
+			This <code>CommandContext</code> parameter should not be delared in the function metadata.</para>
 			<example>
 				<title>Sample code</title>
 				<programlisting language="Java" role="JAVA"><![CDATA[package org.something;
@@ -207,6 +207,23 @@
    }
 }]]></programlisting>
 			</example>
+			<example>
+				<title>Sample CommandContext Usage</title>
+				<programlisting language="Java" role="JAVA"><![CDATA[package org.something;
+
+public class SessionInfo 
+{
+   /**
+   * @param context 
+   * @return the created Timestamp 
+   */
+   public static Timestamp sessionCreated(CommandContext context)
+   {
+      return new Timestamp(context.getSession().getCreatedTime());
+   }
+}]]></programlisting>
+            <para>The corresponding UDF would be declared as Timestamp sessionCreated().</para>
+			</example>
 		</section>
 		<section>
 			<title>Post Code Activities</title>

Modified: trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml	2011-06-05 01:32:10 UTC (rev 3218)
@@ -172,19 +172,30 @@
         by the query planner based on <xref linkend='access_patterns'/>, hints, and
         costing information.</para>
       <para>
-        Teiid supports the MAKEDEP and MAKENOTDEP hints. Theses are
-        can be placed in either the
+        Teiid supports hints to control dependent join behavior: 
+        <itemizedlist>
+          <listitem>
+            <para>MAKEIND - indicates that the clause should be the independent side of a depedent join.</para>
+          </listitem>
+          <listitem>
+            <para>MAKEDEP - indicates that the clause should be the dependent side of a join.</para>
+          </listitem>
+          <listitem>
+            <para>MAKENOTDEP - prevents the clause from being the dependent side of a join.</para>
+          </listitem>
+        </itemizedlist>
+        Theses can be placed in either the
         <link linkend="option_clause">OPTION clause</link>
         or directly in the
         <link linkend="from_clause">FROM clause</link>
-        . As long as all <xref linkend='access_patterns'/> can be met, the MAKEDEP and
-        MAKENOTDEP hints override any use of costing information.
+        . As long as all <xref linkend='access_patterns'/> can be met, the MAKEIND, MAKEDEP, and
+        MAKENOTDEP hints override any use of costing information.  MAKENOTDEP supersedes the other hints.
       </para>
       <tip>
-        <para> The MAKEDEP hint should only be used if the proper query
+        <para> The MAKEDEP/MAKEIND hint should only be used if the proper query
           plan is not chosen by default. You should ensure that your
           costing information is representative of the actual source
-          cardinality. An inappropriate MAKEDEP hint can force an
+          cardinality. An inappropriate MAKEDEP/MAKEIND hint can force an
           inefficient join structure and may result in many source
           queries.</para>
       </tip>
@@ -332,14 +343,19 @@
 				This will only happen if the affected table has a primary key.  If it does not, then an exception will be thrown.</para>
 		</listitem>
 		<listitem>
-			<para>WHERE or HAVING clause IN and EXISTs predicates can take the MJ (merge join) or NO_UNNEST (no unnest) hints appearing just before the subquery.  
-			The MJ hint directs the optimizer to use a traditional, semijoin, or antisemijoin merge join if possible.  
-			The NO_UNNEST hint, which supercedes the MJ hint, will direct the optimizer to leave the subquery in place.
+			<para>WHERE or HAVING clause IN and EXISTs predicates can take the MJ (merge join), DJ (dependent join), or NO_UNNEST (no unnest) hints appearing just before the subquery.  
+			The MJ hint directs the optimizer to use a traditional, semijoin, or antisemijoin merge join if possible.
+			The DJ is the same as the MJ hint, but additional directs the optimizer to use the subquery as the independent side of a dependent join if possible.
+			The NO_UNNEST hint, which supercedes the other hints, will direct the optimizer to leave the subquery in place.
 			<example>
 				<title>Merge Join Hint Usage</title>
 				<programlisting language="SQL">SELECT col1 from tbl where col2 IN /*+ MJ */ (SELECT col1 FROM tbl2)</programlisting>
 			</example>
 			<example>
+				<title>Dependent Join Hint Usage</title>
+				<programlisting language="SQL">SELECT col1 from tbl where col2 IN /*+ DJ */ (SELECT col1 FROM tbl2)</programlisting>
+			</example>
+			<example>
 				<title>No Unnest Hint Usage</title>
 				<programlisting language="SQL">SELECT col1 from tbl where col2 IN /*+ NO_UNNEST */ (SELECT col1 FROM tbl2)</programlisting>
 			</example>

Modified: trunk/documentation/reference/src/main/docbook/en-US/content/sql_support.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/sql_support.xml	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/sql_support.xml	2011-06-05 01:32:10 UTC (rev 3218)
@@ -697,8 +697,9 @@
         <listitem><para>FROM table1 CROSS JOIN table2</para></listitem>
         <listitem><para>FROM (subquery) [AS] alias</para></listitem>
         <listitem><para>FROM <link linkend="nested_table">TABLE(subquery)</link> [AS] alias</para></listitem>
-        <listitem><para>FROM table1 JOIN table2 MAKEDEP ON join-criteria</para></listitem>
-        <listitem><para>FROM table1 JOIN table2 MAKENOTDEP ON join-criteria</para></listitem>
+        <listitem><para>FROM table1 JOIN /*+ MAKEDEP */ table2 ON join-criteria</para></listitem>
+        <listitem><para>FROM table1 JOIN /*+ MAKENOTDEP */ table2 ON join-criteria</para></listitem>
+        <listitem><para>FROM /*+ MAKEIND */ table1 JOIN table2 ON join-criteria</para></listitem>
         <listitem><para>FROM table1 left outer join <link linkend="optional_join">/*+ optional */</link> table2 ON join-criteria</para></listitem>
         <listitem><para>FROM <link linkend="texttable">TEXTTABLE...</link></para></listitem>
         <listitem><para>FROM <link linkend="xmltable">XMLTABLE...</link></para></listitem>
@@ -708,11 +709,12 @@
       <note>
         <title>DEP Hints</title>
         <para>
-          MAKEDEP and MAKENOTDEP are hints used to control
+          MAKEIND, MAKEDEP, and MAKENOTDEP are hints used to control
           <link linkend="dependent_joins">dependent join</link>
           behavior. They should only be used in situations where the optimizer
           does not choose the most optimal plan based upon query structure,
-          metadata, and costing information.
+          metadata, and costing information.  The hints may appear in a comment that proceeds the from clause.  
+          The hints can be specified against any from clause, not just a named table.
         </para>
       </note>
       <section id="nested_table">

Modified: trunk/engine/src/main/java/org/teiid/common/buffer/BlockedException.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/BlockedException.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/BlockedException.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -23,6 +23,9 @@
 package org.teiid.common.buffer;
 
 import org.teiid.core.TeiidComponentException;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.logging.MessageLevel;
 
 /**
  * This exception is thrown if the buffer manager blocks waiting on input during
@@ -40,4 +43,11 @@
         super();
     }
     
+    public static BlockedException block(Object... msg) {
+    	if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.DETAIL)) {
+    		LogManager.logDetail(LogConstants.CTX_BUFFER_MGR, msg);
+    	}
+    	return INSTANCE;
+    }
+    
 }


Property changes on: trunk/engine/src/main/java/org/teiid/common/buffer/BlockedException.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/main/java/org/teiid/common/buffer/BlockedException.java:3149-3217

Modified: trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -318,7 +318,7 @@
 				if(isFinal) {
 		            return null;
 		        } 
-		        throw BlockedException.INSTANCE;
+		        throw BlockedException.block("Blocking on non-final TupleBuffer", tupleSourceID); //$NON-NLS-1$
 			}
 			
 			@Override


Property changes on: trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java:3149-3217

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorManager.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorManager.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -113,7 +113,7 @@
     public MetadataStore getMetadata(String modelName, Map<String, Datatype> datatypes, Properties importProperties) throws TranslatorException {
 		MetadataFactory factory = new MetadataFactory(modelName, datatypes, importProperties);
 		Object connectionFactory = getConnectionFactory();
-		Object connection = executionFactory.getConnection(connectionFactory);
+		Object connection = executionFactory.getConnection(connectionFactory, null);
 		Object unwrapped = null;
 		
 		if (connection instanceof WrappedConnection) {

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorWorkItem.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorWorkItem.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -100,6 +100,7 @@
                 );
         this.securityContext.setUser(requestMsg.getWorkContext().getSubject());
         this.securityContext.setBatchSize(this.requestMsg.getFetchSize());
+        this.securityContext.setSession(requestMsg.getWorkContext().getSession());
         
         this.connector = manager.getExecutionFactory();
     	VDBMetaData vdb = requestMsg.getWorkContext().getVDB();
@@ -195,7 +196,7 @@
     	LogManager.logDetail(LogConstants.CTX_CONNECTOR, new Object[] {this.requestMsg.getAtomicRequestID(), "Processing NEW request:", this.requestMsg.getCommand()}); //$NON-NLS-1$                                     
     	try {
 	    	this.connectionFactory = this.manager.getConnectionFactory();
-	        this.connection = this.connector.getConnection(this.connectionFactory);
+	        this.connection = this.connector.getConnection(this.connectionFactory, securityContext);
 
 	        Object unwrapped = null;
 			if (connection instanceof WrappedConnection) {

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/ExecutionContextImpl.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/ExecutionContextImpl.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/ExecutionContextImpl.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -30,6 +30,7 @@
 
 import javax.security.auth.Subject;
 
+import org.teiid.adminapi.Session;
 import org.teiid.common.buffer.BufferManager;
 import org.teiid.core.util.HashCodeUtil;
 import org.teiid.translator.ExecutionContext;
@@ -64,6 +65,7 @@
     
     private int batchSize = BufferManager.DEFAULT_CONNECTOR_BATCH_SIZE;
 	private List<Exception> warnings = new LinkedList<Exception>();
+	private Session session;
     
     public ExecutionContextImpl(String vdbName, int vdbVersion,  Serializable executionPayload, 
                                 String originalConnectionID, String connectorName, String requestId, String partId, String execCount) {
@@ -204,4 +206,13 @@
 		warnings.clear();
 		return result;
 	}
+	
+	@Override
+	public Session getSession() {
+		return this.session;
+	}
+	
+	public void setSession(Session session) {
+		this.session = session;
+	}
 }

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -31,6 +31,7 @@
 import org.teiid.api.exception.query.QueryMetadataException;
 import org.teiid.client.metadata.ParameterInfo;
 import org.teiid.common.buffer.TupleSource;
+import org.teiid.core.CoreConstants;
 import org.teiid.core.TeiidComponentException;
 import org.teiid.core.TeiidException;
 import org.teiid.core.TeiidRuntimeException;
@@ -70,8 +71,8 @@
 import org.teiid.language.SubqueryComparison.Quantifier;
 import org.teiid.metadata.Procedure;
 import org.teiid.metadata.ProcedureParameter;
+import org.teiid.metadata.FunctionMethod.PushDown;
 import org.teiid.query.metadata.QueryMetadataInterface;
-import org.teiid.query.metadata.TempMetadataID;
 import org.teiid.query.sql.lang.BatchedUpdateCommand;
 import org.teiid.query.sql.lang.Command;
 import org.teiid.query.sql.lang.CompareCriteria;
@@ -506,8 +507,15 @@
         String name = function.getName();
         if (function.getFunctionDescriptor() != null) {
         	name = function.getFunctionDescriptor().getName();
+        	//check for translator pushdown functions, and use the name in source if possible
+        	if (function.getFunctionDescriptor().getPushdown() == PushDown.MUST_PUSHDOWN 
+        			&& function.getFunctionDescriptor().getSchema().equalsIgnoreCase(CoreConstants.SYSTEM_MODEL)
+        			&& function.getFunctionDescriptor().getMethod().getNameInSource() != null) {
+        		name = function.getFunctionDescriptor().getMethod().getNameInSource();
+        	}
+        } else {
+        	name = SingleElementSymbol.getShortName(name);
         }
-        name = SingleElementSymbol.getShortName(name);
 
         //if there is any ambiguity in the function name it will be up to the translator logic to check the 
         //metadata
@@ -557,9 +565,7 @@
 
         Object mid = symbol.getMetadataID();
         
-        if(! (mid instanceof TempMetadataID)) { 
-            element.setMetadataObject(metadataFactory.getElement(mid));
-        }
+        element.setMetadataObject(metadataFactory.getElement(mid));
         return element;
     }
 
@@ -717,9 +723,6 @@
         }
         fullGroup = removeSchemaName(fullGroup);
         NamedTable group = new NamedTable(fullGroup, alias, null);
-		if (symbol.getMetadataID() instanceof TempMetadataID) {
-			return group;
-		}
         try {
 			group.setMetadataObject(metadataFactory.getGroup(symbol.getMetadataID()));
 		} catch (QueryMetadataException e) {

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/RuntimeMetadataImpl.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/RuntimeMetadataImpl.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/RuntimeMetadataImpl.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/main/java/org/teiid/dqp/internal/process/AbstractWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/AbstractWorkItem.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/AbstractWorkItem.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -43,10 +43,10 @@
     
     private ThreadState threadState = ThreadState.MORE_WORK;
     private volatile boolean isProcessing;
-    private boolean useCallingThread;
+    private Thread callingThread;
     
-    public AbstractWorkItem(boolean useCallingThread) {
-    	this.useCallingThread = useCallingThread;
+    public AbstractWorkItem(Thread callingThread) {
+    	this.callingThread = callingThread;
     }
     
     public void run() {
@@ -99,14 +99,14 @@
 	    		if (isDoneProcessing()) {
 	    			logTrace("done processing - ignoring more"); //$NON-NLS-1$
 	        		this.threadState = ThreadState.DONE;
-	        	} else if (!this.useCallingThread) {
+	        	} else if (this.callingThread == null) {
         			resumeProcessing();
 	        	}
 	    		break;
     		default:
     			throw new IllegalStateException("Should not END on " + this.threadState); //$NON-NLS-1$
     	}
-    	return useCallingThread;
+    	return this.callingThread != null;
     }
     
     protected boolean isIdle() {
@@ -127,11 +127,11 @@
 	    		break;
 	    	case IDLE:
 	    		this.threadState = ThreadState.MORE_WORK;
-        		if (this.useCallingThread) {
-        			if (isProcessing) {
+        		if (this.callingThread != null) {
+        			if (this.callingThread == Thread.currentThread()) {
+        				run(); //restart with the calling thread
+        			} else {
         				this.notifyAll(); //notify the waiting caller
-        			} else {
-        				run(); //restart with the calling thread
         			}
         		} else {
         			resumeProcessing();
@@ -152,17 +152,17 @@
     protected abstract void process();
 
 	protected boolean pauseProcessing() {
-		if (useCallingThread && !shouldPause()) {
+		if (this.callingThread != null && !shouldPause()) {
 			return false;
 		}
-		while (useCallingThread && this.getThreadState() == ThreadState.IDLE) {
+		while (this.callingThread != null && this.getThreadState() == ThreadState.IDLE) {
 			try {
 				this.wait(); //the lock should already be held
 			} catch (InterruptedException e) {
 				interrupted(e);
 			}
 		}
-		return useCallingThread;
+		return this.callingThread != null;
 	}
 	
 	/**


Property changes on: trunk/engine/src/main/java/org/teiid/dqp/internal/process/AbstractWorkItem.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidationVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidationVisitor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidationVisitor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -34,6 +34,7 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.teiid.CommandContext;
 import org.teiid.adminapi.DataPolicy;
 import org.teiid.adminapi.DataPolicy.PermissionType;
 import org.teiid.adminapi.impl.DataPolicyMetadata;
@@ -86,13 +87,13 @@
     }
     
     private HashMap<String, DataPolicy> allowedPolicies;
-    private String userName;
     private boolean allowCreateTemporaryTablesDefault = true;
     private boolean allowFunctionCallsByDefault = true;
+    private CommandContext commandContext;
 
-    public AuthorizationValidationVisitor(HashMap<String, DataPolicy> policies, String user) {
+    public AuthorizationValidationVisitor(HashMap<String, DataPolicy> policies, CommandContext commandContext) {
         this.allowedPolicies = policies;
-        this.userName = user;
+        this.commandContext = commandContext;
     }
     
     public void setAllowCreateTemporaryTablesDefault(
@@ -150,7 +151,7 @@
     	logResult(resources, context, allowed);
     	if (!allowed) {
 		    handleValidationError(
-			        QueryPlugin.Util.getString("ERR.018.005.0095", userName, "CREATE_TEMPORARY_TABLES"), //$NON-NLS-1$  //$NON-NLS-2$
+			        QueryPlugin.Util.getString("ERR.018.005.0095", commandContext.getUserName(), "CREATE_TEMPORARY_TABLES"), //$NON-NLS-1$  //$NON-NLS-2$
 			        symbols);
     	}
 	}
@@ -158,7 +159,7 @@
 	private void logRequest(Set<String> resources, Context context) {
 		if (LogManager.isMessageToBeRecorded(LogConstants.CTX_AUDITLOGGING, MessageLevel.DETAIL)) {
 	        // Audit - request
-	    	AuditMessage msg = new AuditMessage(context.name(), "getInaccessibleResources-request", this.userName, resources.toArray(new String[resources.size()])); //$NON-NLS-1$
+	    	AuditMessage msg = new AuditMessage(context.name(), "getInaccessibleResources-request", resources.toArray(new String[resources.size()]), commandContext); //$NON-NLS-1$
 	    	LogManager.logDetail(LogConstants.CTX_AUDITLOGGING, msg);
         }
 	}
@@ -224,6 +225,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 +275,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());
@@ -367,7 +375,7 @@
 	    // is not authorized in the exception message
 	    
 	    handleValidationError(
-	        QueryPlugin.Util.getString("ERR.018.005.0095", userName, actionCode), //$NON-NLS-1$                    
+	        QueryPlugin.Util.getString("ERR.018.005.0095", commandContext.getUserName(), actionCode), //$NON-NLS-1$                    
 	        inaccessibleSymbols);
 	}
 
@@ -402,10 +410,10 @@
 			boolean granted) {
 		if (LogManager.isMessageToBeRecorded(LogConstants.CTX_AUDITLOGGING, MessageLevel.DETAIL)) {
 	        if (granted) {
-	        	AuditMessage msg = new AuditMessage(context.name(), "getInaccessibleResources-granted all", this.userName, resources.toArray(new String[resources.size()])); //$NON-NLS-1$
+	        	AuditMessage msg = new AuditMessage(context.name(), "getInaccessibleResources-granted all", resources.toArray(new String[resources.size()]), commandContext); //$NON-NLS-1$
 	        	LogManager.logDetail(LogConstants.CTX_AUDITLOGGING, msg);
 	        } else {
-	        	AuditMessage msg = new AuditMessage(context.name(), "getInaccessibleResources-denied", this.userName, resources.toArray(new String[resources.size()])); //$NON-NLS-1$
+	        	AuditMessage msg = new AuditMessage(context.name(), "getInaccessibleResources-denied", resources.toArray(new String[resources.size()]), commandContext); //$NON-NLS-1$
 	        	LogManager.logDetail(LogConstants.CTX_AUDITLOGGING, msg);
 	        }
 		}

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidator.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidator.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -26,6 +26,7 @@
 import org.teiid.core.TeiidComponentException;
 import org.teiid.query.metadata.QueryMetadataInterface;
 import org.teiid.query.sql.lang.Command;
+import org.teiid.query.util.CommandContext;
 
 /**
  * Defines a validator that checks for proper authorization.  
@@ -33,7 +34,7 @@
 public interface AuthorizationValidator {
 	
 	void validate(Command command, QueryMetadataInterface metadata,
-			DQPWorkContext workContext) throws QueryValidatorException, TeiidComponentException;
+			DQPWorkContext workContext, CommandContext commandContext) throws QueryValidatorException, TeiidComponentException;
 	
 	boolean hasRole(String roleName, DQPWorkContext workContext);
 }

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -25,7 +25,6 @@
 import org.teiid.cache.CacheConfiguration;
 import org.teiid.client.RequestMessage;
 import org.teiid.core.util.ApplicationInfo;
-import org.teiid.metadata.MetadataRepository;
 
 
 public class DQPConfiguration{
@@ -228,10 +227,6 @@
 		this.authorizationValidator = authorizationValidator;
 	}
 	
-	public MetadataRepository getMetadataRepository() {
-		return null;
-	}
-	
 	public CacheConfiguration getPreparedPlanCacheConfig() {
 		return preparedPlanCacheConfig;
 	}

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataRoleAuthorizationValidator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataRoleAuthorizationValidator.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataRoleAuthorizationValidator.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -26,6 +26,7 @@
 import org.teiid.core.TeiidComponentException;
 import org.teiid.query.metadata.QueryMetadataInterface;
 import org.teiid.query.sql.lang.Command;
+import org.teiid.query.util.CommandContext;
 
 /**
  * The default Teiid authorization validator
@@ -44,9 +45,9 @@
 	}
 
 	@Override
-	public void validate(Command command, QueryMetadataInterface metadata, DQPWorkContext workContext) throws QueryValidatorException, TeiidComponentException {
+	public void validate(Command command, QueryMetadataInterface metadata, DQPWorkContext workContext, CommandContext commandContext) throws QueryValidatorException, TeiidComponentException {
 		if (useEntitlements && !workContext.getVDB().getDataPolicies().isEmpty()) {
-			AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(workContext.getAllowedDataPolicies(), workContext.getUserName());
+			AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(workContext.getAllowedDataPolicies(), commandContext);
 			visitor.setAllowCreateTemporaryTablesDefault(allowCreateTemporaryTablesByDefault);
 			visitor.setAllowFunctionCallsByDefault(allowFunctionCallsByDefault);
 			Request.validateWithVisitor(visitor, metadata, command);

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -57,6 +57,8 @@
 import org.teiid.dqp.message.AtomicRequestMessage;
 import org.teiid.dqp.message.AtomicResultsMessage;
 import org.teiid.events.EventDistributor;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
 import org.teiid.metadata.Table;
 import org.teiid.query.function.source.XMLSystemFunctions;
 import org.teiid.query.processor.relational.RelationalNodeUtil;
@@ -244,7 +246,7 @@
 							workItem.moreWork();
     					}
     				}, 10, e.getRetryDelay());
-    				throw BlockedException.INSTANCE;
+    				throw BlockedException.block(aqr.getAtomicRequestID(), "Blocking on DataNotAvailableException"); //$NON-NLS-1$
     			} 
     			receiveResults(results);
     		}
@@ -295,7 +297,7 @@
 			addWork();
 		}
 		if (!futureResult.isDone()) {
-			throw BlockedException.INSTANCE;
+			throw BlockedException.block(aqr.getAtomicRequestID(), "Blocking on source query"); //$NON-NLS-1$
 		}
 		FutureWork<AtomicResultsMessage> currentResults = futureResult;
 		futureResult = null;
@@ -409,7 +411,7 @@
 		if (exception.getCause() instanceof TeiidProcessingException) {
 			throw (TeiidProcessingException)exception.getCause();
 		}
-		throw new TeiidProcessingException(exception);
+		throw new TeiidProcessingException(exception, this.getConnectorName() + ": " + exception.getMessage()); //$NON-NLS-1$
 	}
 
 	void receiveResults(AtomicResultsMessage response) {


Property changes on: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/PreparedStatementRequest.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/PreparedStatementRequest.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/PreparedStatementRequest.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -158,8 +158,6 @@
             processPlan = cachedPlan.clone();
             //already in cache. obtain the values from cache
             analysisRecord = prepPlan.getAnalysisRecord();
-            
-            createCommandContext();
         }
         
         if (requestMsg.isBatchedUpdate()) {


Property changes on: trunk/engine/src/main/java/org/teiid/dqp/internal/process/PreparedStatementRequest.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -205,9 +205,9 @@
         this.metadata = tma;
     }
     
-    protected void createCommandContext() throws QueryValidatorException {
-    	boolean returnsResultSet = userCommand.returnsResultSet();
-    	this.returnsUpdateCount = !(userCommand instanceof StoredProcedure) && !returnsResultSet;
+    protected void createCommandContext(Command command) throws QueryValidatorException {
+    	boolean returnsResultSet = command.returnsResultSet();
+    	this.returnsUpdateCount = !(command instanceof StoredProcedure) && !returnsResultSet;
     	if ((this.requestMsg.getResultsMode() == ResultsMode.UPDATECOUNT && !returnsUpdateCount) 
     			|| (this.requestMsg.getResultsMode() == ResultsMode.RESULTSET && !returnsResultSet)) {
         	throw new QueryValidatorException(QueryPlugin.Util.getString(this.requestMsg.getResultsMode()==ResultsMode.RESULTSET?"Request.no_result_set":"Request.result_set")); //$NON-NLS-1$ //$NON-NLS-2$
@@ -252,6 +252,8 @@
         context.setResultSetCacheEnabled(this.resultSetCacheEnabled);
         context.setUserRequestSourceConcurrency(this.userRequestConcurrency);
         context.setSubject(workContext.getSubject());
+        this.context.setSession(workContext.getSession());
+        this.context.setRequestId(this.requestId);
     }
     
     @Override
@@ -381,11 +383,9 @@
         this.analysisRecord = new AnalysisRecord(requestMsg.getShowPlan() != ShowPlan.OFF, requestMsg.getShowPlan() == ShowPlan.DEBUG);
                 
         resolveCommand(command);
-        
+
         validateAccess(userCommand);
         
-        createCommandContext();
-
         Collection<GroupSymbol> groups = GroupCollectorVisitor.getGroups(command, true);
         for (GroupSymbol groupSymbol : groups) {
 			if (groupSymbol.isTempTable()) {
@@ -464,7 +464,8 @@
 	}
 
 	protected void validateAccess(Command command) throws QueryValidatorException, TeiidComponentException {
-		this.authorizationValidator.validate(command, metadata, workContext);
+		createCommandContext(command);
+		this.authorizationValidator.validate(command, metadata, workContext, context);
 	}
 	
 }


Property changes on: trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -162,7 +162,7 @@
     private long processingTimestamp = System.currentTimeMillis();
     
     public RequestWorkItem(DQPCore dqpCore, RequestMessage requestMsg, Request request, ResultsReceiver<ResultsMessage> receiver, RequestID requestID, DQPWorkContext workContext) {
-    	super(workContext.useCallingThread() || requestMsg.isSync());
+    	super(workContext.useCallingThread() || requestMsg.isSync() ? Thread.currentThread() : null);
         this.requestMsg = requestMsg;
         this.requestID = requestID;
         this.processorTimeslice = dqpCore.getProcessorTimeSlice();
@@ -450,7 +450,7 @@
 							&& !batch.getTerminationFlag() 
 							&& this.getTupleBuffer().getManagedRowCount() >= 20 * this.getTupleBuffer().getBatchSize()) {
 						//requestMore will trigger more processing
-						throw BlockedException.INSTANCE;
+						throw BlockedException.block(requestID, "Blocking due to full results buffer."); //$NON-NLS-1$
 					}
 				}
 			}


Property changes on: trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Modified: trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -109,6 +109,7 @@
 import org.teiid.query.sql.symbol.XMLNamespaces.NamespaceItem;
 import org.teiid.query.sql.util.ValueIterator;
 import org.teiid.query.sql.util.ValueIteratorSource;
+import org.teiid.query.sql.util.VariableContext;
 import org.teiid.query.util.CommandContext;
 import org.teiid.query.xquery.saxon.SaxonXQueryExpression;
 import org.teiid.query.xquery.saxon.SaxonXQueryExpression.Result;
@@ -427,7 +428,8 @@
         	valueIter = new CollectionValueIterator(((SetCriteria)criteria).getValues());
         } else if (criteria instanceof DependentSetCriteria){
         	ContextReference ref = (ContextReference)criteria;
-    		ValueIteratorSource vis = (ValueIteratorSource)getContext(criteria).getVariableContext().getGlobalValue(ref.getContextSymbol());
+        	VariableContext vc = getContext(criteria).getVariableContext();
+    		ValueIteratorSource vis = (ValueIteratorSource)vc.getGlobalValue(ref.getContextSymbol());
     		Set<Object> values;
     		try {
     			values = vis.getCachedSet(ref.getValueExpression());
@@ -437,6 +439,7 @@
         	if (values != null) {
         		return values.contains(leftValue);
         	}
+    		vis.setUnused(true);
         	//there are too many values to justify a linear search or holding
         	//them in memory
         	return true;


Property changes on: trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Modified: trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingAttribute.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingAttribute.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingAttribute.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -26,15 +26,12 @@
 
 
 /** 
- * A Mapping node which denotes a attribuite node.
+ * A Mapping node which denotes a attribute node.
  */
 public class MappingAttribute extends MappingNode {
     // Element symbol in the resultset source
     ElementSymbol symbol;
     
-    // Position of the element in the resultset source
-    int position = -1;  
-
     // namespace of the attribute
     Namespace namespace;
     

Modified: trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingBaseNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingBaseNode.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingBaseNode.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -23,7 +23,6 @@
 package org.teiid.query.mapping.xml;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 
 import org.teiid.core.TeiidRuntimeException;
@@ -205,11 +204,11 @@
         return false;
     }
     
-    public List getStagingTables() {
-        return (List)getProperty(MappingNodeConstants.Properties.TEMP_GROUP_NAMES);
+    public List<String> getStagingTables() {
+        return (List<String>)getProperty(MappingNodeConstants.Properties.TEMP_GROUP_NAMES);
     }
     
-    public void setStagingTables(List tables) {
+    public void setStagingTables(List<String> tables) {
         if (tables != null) {
             setProperty(MappingNodeConstants.Properties.TEMP_GROUP_NAMES, tables);
         }
@@ -222,9 +221,9 @@
         if (tablename == null) {
             return;
         }
-        List tables = getStagingTables();
-        if (tables == null || tables == Collections.EMPTY_LIST) {
-            tables = new ArrayList();
+        List<String> tables = getStagingTables();
+        if (tables == null || tables.isEmpty()) {
+            tables = new ArrayList<String>();
         }
         tables.add(tablename);
         setProperty(MappingNodeConstants.Properties.TEMP_GROUP_NAMES, tables);

Modified: trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingCriteriaNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingCriteriaNode.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingCriteriaNode.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -22,8 +22,6 @@
 
 package org.teiid.query.mapping.xml;
 
-import java.util.List;
-
 import org.teiid.query.sql.lang.Criteria;
 
 
@@ -34,7 +32,6 @@
  */
 public class MappingCriteriaNode extends MappingBaseNode{
     boolean defalt;
-    List criteriaGroups;
     Criteria criteriaNode;
     
     public MappingCriteriaNode(String criteria, boolean defalt) {
@@ -87,23 +84,6 @@
         return this.criteriaNode;
     }
     
-    /**
-     * Groups that are referenced inthe criteria string. This is set by ValidateMappedCriteriaVisitor
-     * class during the preplan.
-     * @param criteriaGroups
-     */
-    public void setGroupsInCriteria(List criteriaGroups) {
-        this.criteriaGroups = criteriaGroups;
-    }
-
-    /**
-     * @deprecated - may not be needed
-     * @return
-     */
-    public List getGroupsInCriteria() {
-        return this.criteriaGroups;
-    }
-    
     /** 
      * @see org.teiid.query.mapping.xml.MappingNode#isExcluded()
      */

Modified: trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingDocument.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingDocument.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingDocument.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -22,11 +22,6 @@
 
 package org.teiid.query.mapping.xml;
 
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
 import org.teiid.core.TeiidRuntimeException;
 import org.teiid.query.QueryPlugin;
 
@@ -160,26 +155,10 @@
     /** 
      * @see org.teiid.query.mapping.xml.MappingNode#clone()
      */
-    public Object clone() {
-        // I found this as cheap way of cloneing for now fast, may be we will
-        // do all the object cloneing later..
-        try {
-            MappingOutputter out = new MappingOutputter();
-            StringWriter stream = new StringWriter();
-            out.write(this, new PrintWriter(stream));
-            MappingLoader loader = new MappingLoader();
-            MappingDocument doc =  loader.loadDocument(new ByteArrayInputStream(stream.toString().getBytes()));
-
-            // Copy the values of the instance variables.
-            doc.formatted = this.formatted;
-            doc.encoding = this.encoding;
-            doc.name = this.name;
-            
-            return doc;
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        } catch(MappingException e) {
-            throw new RuntimeException(e);
-        }
-    }    
+    public MappingDocument clone() {
+		MappingDocument clone = (MappingDocument) super.clone();
+		clone.root = (MappingBaseNode) clone.getChildren().iterator().next();
+		return clone;
+    }  
+    
 }

Modified: trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingElement.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingElement.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingElement.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -39,9 +39,6 @@
     // Element symbol in the resultset source
     ElementSymbol symbol;
     
-    // Position of the element in the resultset source
-    int position = -1;  
-    
     Namespace namespace;
     
     public MappingElement(String name) {

Modified: trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingNode.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingNode.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -31,6 +31,7 @@
 import java.util.List;
 import java.util.Map;
 
+import org.teiid.core.TeiidRuntimeException;
 import org.teiid.query.QueryPlugin;
 import org.teiid.query.sql.symbol.ElementSymbol;
 
@@ -42,14 +43,16 @@
  */
 public abstract class MappingNode implements Cloneable, Serializable {
 
-    /** The parent of this node, null if root. */
+	private static final long serialVersionUID = 6761829541871178451L;
+
+	/** The parent of this node, null if root. */
     private MappingNode parent;
 
     /** Child nodes, usually just 1 or 2, but occasionally more */
-    private LinkedList children = new LinkedList();
+    private List<MappingNode> children = new LinkedList<MappingNode>();
 
     /** node properties, as defined in NodeConstants.Properties. */
-    private Map nodeProperties;
+    private Map<MappingNodeConstants.Properties, Object> nodeProperties;
 
     /** default constructor */
     public MappingNode(){
@@ -89,8 +92,8 @@
             }
         }
         
-        for (Iterator i = root.getChildren().iterator(); i.hasNext();) {
-            MappingNode child = (MappingNode)i.next();
+        for (Iterator<MappingNode> i = root.getChildren().iterator(); i.hasNext();) {
+            MappingNode child = i.next();
             MappingNode found = findNode(child, partialName);
             if (found != null) {
                 return found;
@@ -104,7 +107,7 @@
      * Set the parent of this node.  This method is restricted, as
      * it should be called only when {@link #addChild adding a child node}
      */
-    private void setParent( MappingNode parent ) {
+    void setParent( MappingNode parent ) {
         this.parent = parent;
     }
 
@@ -112,7 +115,7 @@
      * Get the children contained by this node, or an empty List
      * @return children; if no children, return empty List (never null)
      */
-    public List getChildren(){
+    public List<MappingNode> getChildren(){
         return this.children;
     }
 
@@ -120,11 +123,11 @@
      * Get all children of this node of a specified target node type.  The value
      * of node type should be one of {@link #ATTRIBUTE} or {@link #ELEMENT}.
      */
-    public List getChildren( String type ) {
-        List subset = new ArrayList();
-        Iterator iter = children.iterator();
+    public List<MappingNode> getChildren( String type ) {
+        List<MappingNode> subset = new ArrayList<MappingNode>();
+        Iterator<MappingNode> iter = children.iterator();
         while ( iter.hasNext() ) {
-            MappingNode node = (MappingNode)iter.next();
+            MappingNode node = iter.next();
             if ( node.getProperty(MappingNodeConstants.Properties.NODE_TYPE).equals(type) ) {
                 subset.add( node );
             }
@@ -132,11 +135,11 @@
         return subset;
     }
     
-    public List getNodeChildren() {
-        List subset = new ArrayList();
-        Iterator iter = children.iterator();
+    public List<MappingNode> getNodeChildren() {
+        List<MappingNode> subset = new ArrayList<MappingNode>();
+        Iterator<MappingNode> iter = children.iterator();
         while ( iter.hasNext() ) {
-            MappingNode node = (MappingNode)iter.next();
+            MappingNode node = iter.next();
             if ( !node.getProperty(MappingNodeConstants.Properties.NODE_TYPE).equals(MappingNodeConstants.ATTRIBUTE) ) {
                 subset.add( node );
             }
@@ -162,7 +165,7 @@
      * @param propertyID Integer property key
      * @return Object value
      */
-    public Object getProperty(Integer propertyID) {
+    public Object getProperty(MappingNodeConstants.Properties propertyID) {
         Object value = null;
         if(nodeProperties != null) {
             value = nodeProperties.get(propertyID);
@@ -180,11 +183,11 @@
      * @param propertyID Integer property key
      * @param value Object property value
      */
-    void setProperty(Integer propertyID, Object value) {
+    void setProperty(MappingNodeConstants.Properties propertyID, Object value) {
         if (value != null){
             // Get the default for the property ...
             final Object defaultValue = MappingNodeConstants.Defaults.DEFAULT_VALUES.get(propertyID);
-            final Map props = getNodeProperties();      // props is never null
+            final Map<MappingNodeConstants.Properties, Object> props = getNodeProperties();      // props is never null
             if ( !value.equals(defaultValue) ) {        // we know value is not null
                 // Set the value only if different than the default; note that the 'getProperty'
                 // method is returning the default if there isn't a value
@@ -197,7 +200,7 @@
         }
     }
 
-    void removeProperty(Integer propertyID) {
+    void removeProperty(MappingNodeConstants.Properties propertyID) {
         getNodeProperties().remove(propertyID);
     }
     
@@ -209,9 +212,9 @@
      * object.
      * @see #getProperties
      */
-    public Map getNodeProperties(){
+    public Map<MappingNodeConstants.Properties, Object> getNodeProperties(){
         if(nodeProperties == null) {
-            nodeProperties = new HashMap();
+            nodeProperties = new HashMap<MappingNodeConstants.Properties, Object>();
         }
         return nodeProperties;
     }
@@ -318,9 +321,9 @@
         str.append(node.getNodeProperties());
         str.append("\n"); //$NON-NLS-1$
 
-        Iterator i = node.getChildren().iterator();
+        Iterator<MappingNode> i = node.getChildren().iterator();
         while (i.hasNext()){
-            buildTreeString((MappingNode)i.next(), str, tabLevel);
+            buildTreeString(i.next(), str, tabLevel);
         }
     }
 
@@ -345,7 +348,7 @@
      * {@link MappingNodeConstants#SEARCH_DOWN} or {@link MappingNodeConstants#SEARCH_DOWN_BREADTH_FIRST}
      * @return MappingNode first node found that has the indicated property and value, or null if none found
      */
-    static MappingNode findFirstNodeWithProperty(Integer propertyKey, Object value, MappingNode node, int searchDirection) {
+    static MappingNode findFirstNodeWithProperty(MappingNodeConstants.Properties propertyKey, Object value, MappingNode node, int searchDirection) {
         return findFirstNodeWithPropertyValue(propertyKey, value, false, node, searchDirection);
     }
     
@@ -365,11 +368,11 @@
      * {@link MappingNodeConstants#SEARCH_DOWN} or {@link MappingNodeConstants#SEARCH_DOWN_BREADTH_FIRST}
      * @return MappingNode first node found that has the indicated property and value, or null if none found
      */
-    static MappingNode findFirstNodeWithPropertyString(Integer propertyKey, String value, MappingNode node, int searchDirection) {
+    static MappingNode findFirstNodeWithPropertyString(MappingNodeConstants.Properties propertyKey, String value, MappingNode node, int searchDirection) {
         return findFirstNodeWithPropertyValue(propertyKey, value, true, node, searchDirection);
     }
 
-    private static MappingNode findFirstNodeWithPropertyValue(Integer propertyKey, Object value, boolean isStringValue, MappingNode node, int searchDirection) {
+    private static MappingNode findFirstNodeWithPropertyValue(MappingNodeConstants.Properties propertyKey, Object value, boolean isStringValue, MappingNode node, int searchDirection) {
         
         if (node == null || propertyKey == null){
             return null;
@@ -389,11 +392,11 @@
         }
     }
 
-    private static MappingNode traverseDownForFirstNodeWithPropertyString(Integer propertyKey, Object value, boolean isStringValue, MappingNode node, boolean breadthFirst) {
+    private static MappingNode traverseDownForFirstNodeWithPropertyString(MappingNodeConstants.Properties propertyKey, Object value, boolean isStringValue, MappingNode node, boolean breadthFirst) {
         if (breadthFirst) {
-            Iterator children = node.getChildren().iterator();
+            Iterator<MappingNode> children = node.getChildren().iterator();
             while (children.hasNext()){
-                MappingNode child = (MappingNode)children.next();
+                MappingNode child = children.next();
                 if (checkThisNodeForPropertyValue(propertyKey, value, isStringValue, child)){
                     return child;
                 }
@@ -404,9 +407,9 @@
             }
         }
         
-        Iterator children = node.getChildren().iterator();
+        Iterator<MappingNode> children = node.getChildren().iterator();
         while (children.hasNext()){
-            MappingNode child = (MappingNode)children.next();
+            MappingNode child = children.next();
             
             //recursive call to this method
             MappingNode result = traverseDownForFirstNodeWithPropertyString(propertyKey, value, isStringValue, child, breadthFirst);
@@ -418,7 +421,7 @@
         return null;
     }
     
-    private static boolean checkThisNodeForPropertyValue(Integer propertyKey, Object value, boolean isStringValue, MappingNode node) {
+    private static boolean checkThisNodeForPropertyValue(MappingNodeConstants.Properties propertyKey, Object value, boolean isStringValue, MappingNode node) {
         Object thisValue = node.getProperty(propertyKey);
         if (thisValue != null){
             if (value == null){
@@ -434,7 +437,7 @@
         return false;
     }
 
-    private static MappingNode traverseUpForFirstNodeWithPropertyString(Integer propertyKey, Object value, boolean isStringValue, MappingNode node) {
+    private static MappingNode traverseUpForFirstNodeWithPropertyString(MappingNodeConstants.Properties propertyKey, Object value, boolean isStringValue, MappingNode node) {
         while (node != null){
             if (checkThisNodeForPropertyValue(propertyKey, value, isStringValue, node)){
                 return node;
@@ -477,4 +480,22 @@
     public String getNameInSource() {
         return null;        
     }    
+    
+    public MappingNode clone() {
+    	try {
+			MappingNode clone = (MappingNode) super.clone();
+			clone.children = new ArrayList<MappingNode>(children);
+			for (int i = 0; i < clone.children.size(); i++) {
+				clone.children.set(i, clone.children.get(i).clone());
+				clone.children.get(i).setParent(clone);
+			}
+			return clone;
+		} catch (CloneNotSupportedException e) {
+			throw new TeiidRuntimeException(e);
+		}
+    }
+    
+    public ElementSymbol getElementSymbol() {
+    	return null;
+    }
 }

Modified: trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingNodeConstants.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingNodeConstants.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingNodeConstants.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -151,18 +151,17 @@
      * Property names for type-specific node properties.  Values will be of
      * type String unless otherwise specified.
      */
-    public static final class Properties {
-        private Properties() { }
+    public enum Properties {
         
         /** The basic name of this node. Will be the element or attribute tag name. */
-        public static final Integer NAME = new Integer(0);
+        NAME,
 
         /** 
          * The namespace prefix, which indicates the namespace for this node. 
          * The namespace must be declared either at this node or an ancestor
          * node; use the {@link #NAMESPACE_DECLARATIONS} property.
          */
-        public static final Integer NAMESPACE_PREFIX = new Integer(1);
+        NAMESPACE_PREFIX,
 
         /** 
          * <p>This property allows for one or more namespace declarations
@@ -182,42 +181,42 @@
          * <pre>&lt;shipDate xsi:nil="true"/&gt;</pre>
          * </p>
          */
-        public static final Integer NAMESPACE_DECLARATIONS = new Integer(2);
+        NAMESPACE_DECLARATIONS,
        
         /**
          * The target node type.  Can take on one of the values {@link #ATTRIBUTE}
          * or {@link #ELEMENT}.
          */        
-        public static final Integer NODE_TYPE = new Integer(4);  // Values: ATTRIBUTE|ELEMENT
+        NODE_TYPE,  // Values: ATTRIBUTE|ELEMENT
 
         /** 
          * <p>The minimum number of times this node must occur in a document.</p>
          * <p>Type: <code>java.lang.Integer</code></p>
          */
-        public static final Integer CARDINALITY_MIN_BOUND = new Integer(5);
+        CARDINALITY_MIN_BOUND,
 
         /** 
          * <p>The maximum number of times this node may occur in a document.</p>
          * <p>Type: <code>java.lang.Integer</code></p>
          */
-        public static final Integer CARDINALITY_MAX_BOUND = new Integer(6);
+        CARDINALITY_MAX_BOUND,
 
         /**
          * An optional constraint that applies for the node.  If a constraint is
          * defined, the input tuple to the node will be compared to the constraint.
          * The node will be processed only if the constraint is satisfied.
          */
-        public static final Integer CRITERIA = new Integer(7);
+        CRITERIA,
         
         /**
          * This property represents a default value for an XML node
          */
-        public static final Integer DEFAULT_VALUE = new Integer(8);
+        DEFAULT_VALUE,
 
         /**
          * This property represents a fixed value for an XML node
          */
-        public static final Integer FIXED_VALUE = new Integer(11);
+        FIXED_VALUE,
 
         /**
          * <p>Value will be of type Boolean.  Indicates that the node is nillable, 
@@ -226,11 +225,11 @@
          * indicates when the element has null content.</p>
          * 
          * <p><b>Note:</b> This property may only be set to true if this node
-         * is an element (i.e. the {@link #NODE_TYPE} property must have 
+         * is an element (i.e. the {@link #NODETYPE} property must have 
          * a value of {@link #ELEMENT}), although this constraint is not
          * enforced anywhere in the MappingNode framework.</p>
          */
-        public static final Integer IS_NILLABLE = new Integer(9);
+        IS_NILLABLE,
 
         /**
          * <p>This node will be completely ignored, not output, not
@@ -238,11 +237,11 @@
          * <p>Type: <code>java.lang.Boolean</code></p>
          * <p>Default: {@link MappingNodeConstants.Defaults#DEFAULT_IS_EXCLUDED}</p>
          */
-        public static final Integer IS_EXCLUDED = new Integer(10);
+        IS_EXCLUDED,
 
 
         /** The name of the result being returned by this node */
-        public static final Integer RESULT_SET_NAME = new Integer(20);
+        RESULT_SET_NAME,
 
         /** 
          * The name(s) of the temporary group(s) to be materialized at this 
@@ -250,18 +249,18 @@
          * <p>Type: <code>java.util.List</code> of </code>java.lang.String</code>
          * <p>Default: {@link MappingNodeConstants.Defaults#DEFAULT_TEMP_GROUP_NAMES}</p>
          */
-        public static final Integer TEMP_GROUP_NAMES = new Integer(23);
+        TEMP_GROUP_NAMES,
 
         /** The symbol from a result set that maps to this node. */
-        public static final Integer ELEMENT_NAME = new Integer(30);
+        ELEMENT_NAME,
 
 		/** The temporary property to mark whether this node should be included. */
-		public static final Integer IS_INCLUDED = new Integer(15);
+		IS_INCLUDED,
 
         /**
          * The text for a comment.
          */
-        public static final Integer COMMENT_TEXT = new Integer(16);
+        COMMENT_TEXT,
         
         /** 
          * Indicates that the element or attribute is to be considered optional,
@@ -271,7 +270,7 @@
          * <p>Type: <code>java.lang.Boolean</code> 
          * <p>Default: {@link MappingNodeConstants.Defaults#DEFAULT_IS_OPTIONAL}</p>
          */
-        public static final Integer IS_OPTIONAL = new Integer(22);
+        IS_OPTIONAL,
         
         /**
          * <p>Indicates the level of text normalization that will be applied
@@ -279,7 +278,7 @@
          * <p>Type: <code>java.lang.String</code></p>
          * <p>Default: {@link MappingNodeConstants.Defaults#DEFAULT_NORMALIZE_TEXT}</p>
          */
-        public static final Integer NORMALIZE_TEXT = new Integer(24);
+        NORMALIZE_TEXT,
         
         /**
          * Specifies the design-time base built-in type for the virtual document node.
@@ -288,7 +287,7 @@
          * is used to determine special translations from the runtime value to the expected
          * XML schema output value string.  
          */
-        public static final Integer BUILT_IN_TYPE = new Integer(25);
+        BUILT_IN_TYPE,
         
         // ========================================================================
         // CHOICE NODE RELATED PROPERTIES
@@ -300,7 +299,7 @@
          * <p>Type: <code>java.lang.Boolean</code></p>
          * <p>Default: {@link MappingNodeConstants.Defaults#DEFAULT_IS_DEFAULT_CHOICE}</p>
          */
-        public static final Integer IS_DEFAULT_CHOICE = new Integer(40);
+        IS_DEFAULT_CHOICE,
         
         /**
          * <p>This property of a choice node indicates that, by 
@@ -313,7 +312,7 @@
          * <p>Type: <code>java.lang.Boolean</code></p>
          * <p>Default: {@link MappingNodeConstants.Defaults#DEFAULT_EXCEPTION_ON_DEFAULT}</p>
          */
-        public static final Integer EXCEPTION_ON_DEFAULT = new Integer(42);
+        EXCEPTION_ON_DEFAULT,
 
         // ========================================================================
         // RECURSI0N RELATED PROPERTIES
@@ -324,7 +323,7 @@
          * <p>Type: <code>java.lang.Boolean</code></p>
          * <p>Default: {@link MappingNodeConstants.Defaults#DEFAULT_IS_RECURSIVE}</p>
          */
-        public static final Integer IS_RECURSIVE = new Integer(59);
+        IS_RECURSIVE,
 
         /**
          * The criteria of a node representing the root of a recursive
@@ -332,7 +331,7 @@
          * recursion should terminate.  i.e. "resultSetName.employeeName = 'Jones'"
          * @see #RECURSION_LIMIT
          */
-        public static final Integer RECURSION_CRITERIA = new Integer(50);
+        RECURSION_CRITERIA,
 
         /**
          * The recursion limit of a recursive XML fragment - if the 
@@ -343,7 +342,7 @@
          * <p>Default: {@link MappingNodeConstants.Defaults#DEFAULT_RECURSION_LIMIT}</p>
          * @see #EXCEPTION_ON_RECURSION_LIMIT
          */
-        public static final Integer RECURSION_LIMIT = new Integer(51);
+        RECURSION_LIMIT,
 
         /**
          * If recursion is terminated due to the safeguard {@link #RECURSION_LIMIT} being
@@ -353,7 +352,7 @@
          * @see #RECURSION_CRITERIA
          * @see #RECURSION_LIMIT
          */
-        public static final Integer EXCEPTION_ON_RECURSION_LIMIT = new Integer(52);
+        EXCEPTION_ON_RECURSION_LIMIT,
 
         /**
          * This property should be set on each document node at which a recursive
@@ -363,14 +362,14 @@
          * document).
          * <p>Type: <code>java.lang.String</code></p>
          */
-        public static final Integer RECURSION_ROOT_MAPPING_CLASS = new Integer(53);
+        RECURSION_ROOT_MAPPING_CLASS,
         
         /**
          * Indicates if the node is the root of a recursive XML fragment or not.
          * <p>Type: <code>java.lang.Boolean</code></p>
          * <p>Default: {@link MappingNodeConstants.Defaults#DEFAULT_IS_RECURSIVE_ROOT}</p>
          */
-        public static final Integer IS_RECURSIVE_ROOT = new Integer(54);
+        IS_RECURSIVE_ROOT,
         
         // ==================================================================================
         // DOCUMENT PROPERTIES (read from root node only, applicable to document as a whole)
@@ -381,7 +380,7 @@
          * set at the root MappingNode of the document.</p>
          * <p>Default: {@link MappingNodeConstants.Defaults#DEFAULT_DOCUMENT_ENCODING}</p>
          */
-        public static final Integer DOCUMENT_ENCODING = new Integer(80);
+        DOCUMENT_ENCODING,
         
         /**
          * <p>Indicates whether the document will be outputted as a compressed
@@ -391,14 +390,14 @@
          * <p>Type: <code>java.lang.Boolean</code></p>
          * <p>Default: {@link MappingNodeConstants.Defaults#DEFAULT_FORMATTED_DOCUMENT}</p>
          */
-        public static final Integer FORMATTED_DOCUMENT = new Integer(81);
+        FORMATTED_DOCUMENT,
         
         /**
          * A property to mark to implicity include a node which needs to be 
          * added to result document. The implicit nodes are such nodes which
          * define the encoding information and type defination information.
          */
-        public static final Integer ALWAYS_INCLUDE = new Integer(82); 
+        ALWAYS_INCLUDE, 
         
         /**
          * In the case of the recursive mapping element nodes, the source nodes
@@ -406,13 +405,13 @@
          * (i.e. mapping class in recurive node) is alias to the source node which is
          * above the recursive node.
          */
-        public static final Integer ALIAS_RESULT_SET_NAME = new Integer(83);
+        ALIAS_RESULT_SET_NAME,
      
         /**
          * Result Set Info object which contains the query and the plan for
          * the source node.
          */
-        public static final Integer RESULT_SET_INFO = new Integer(84);        
+        RESULT_SET_INFO,        
     }
 
     // =========================================================================
@@ -487,11 +486,11 @@
          * manner.  Some tags are left out that the MappingOutputter 
          * handles separately.
          */
-        static final List OUTPUTTER_PROPERTY_TAGS;
+        static final List<String> OUTPUTTER_PROPERTY_TAGS;
         
         // Initialize static variables...
         static {
-            List temp = Arrays.asList( new String[]{
+            List<String> temp = Arrays.asList( new String[]{
                 MappingNodeConstants.Tags.NAME, 
                 MappingNodeConstants.Tags.NODE_TYPE, 
                 MappingNodeConstants.Tags.NAMESPACE_PREFIX, 
@@ -535,7 +534,7 @@
      * defined in {@link Properties}
      * @see getPropertyString
      */
-    public static final Integer getPropertyInteger(String property) {
+    public static final MappingNodeConstants.Properties getProperty(String property) {
         if(property.equals(Tags.NAME)) return Properties.NAME;
         else if (property.equals(Tags.NAMESPACE_PREFIX)) return Properties.NAMESPACE_PREFIX;
         else if (property.equals(Tags.NODE_TYPE)) return Properties.NODE_TYPE;
@@ -626,7 +625,7 @@
          * {@link MappingNodeConstants.Properties}.  The {@link MappingNode} class will return
          * these values if none are defined, for each property.
          */
-        public static final Map DEFAULT_VALUES;
+        public static final Map<Properties, Object> DEFAULT_VALUES;
         
         /** The default minimum bound of the cardinality of a node. */
         public static final Integer DEFAULT_CARDINALITY_MINIMUM_BOUND = new Integer(1);
@@ -695,7 +694,7 @@
         public static final Boolean DEFAULT_FORMATTED_DOCUMENT = Boolean.FALSE;
 
         static{
-            HashMap temp = new HashMap();
+            HashMap<Properties, Object> temp = new HashMap<Properties, Object>();
             temp.put(Properties.CARDINALITY_MIN_BOUND, DEFAULT_CARDINALITY_MINIMUM_BOUND);
             temp.put(Properties.CARDINALITY_MAX_BOUND, DEFAULT_CARDINALITY_MAXIMUM_BOUND);
             temp.put(Properties.NODE_TYPE, DEFAULT_NODE_TYPE);

Modified: trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingOutputter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingOutputter.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingOutputter.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -129,10 +129,10 @@
      * @throws XMLStreamException 
      */
     void addElementProperties(Map properties ) throws XMLStreamException {
-        Iterator propNames = MappingNodeConstants.Tags.OUTPUTTER_PROPERTY_TAGS.iterator();
+        Iterator<String> propNames = MappingNodeConstants.Tags.OUTPUTTER_PROPERTY_TAGS.iterator();
         while ( propNames.hasNext() ) {
-            String propName = (String)propNames.next();
-            Integer propKey = MappingNodeConstants.getPropertyInteger(propName);
+            String propName = propNames.next();
+            MappingNodeConstants.Properties propKey = MappingNodeConstants.getProperty(propName);
             if ( properties.containsKey(propKey) ) {
                 Object value = properties.get(propKey);
                 addElementProperty( propName, value );

Modified: trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingRecursiveElement.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingRecursiveElement.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingRecursiveElement.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -22,8 +22,6 @@
 
 package org.teiid.query.mapping.xml;
 
-import java.util.List;
-
 import org.teiid.query.sql.lang.Criteria;
 
 
@@ -34,7 +32,6 @@
  * upto given depth limit. 
  */
 public class MappingRecursiveElement extends MappingElement {
-    List criteriaGroups;
     Criteria criteriaNode;    
     
     public MappingRecursiveElement(String name, String mappingClass) {
@@ -114,19 +111,6 @@
     }
    
     /**
-     * Groups that are referenced inthe criteria string. This is set by ValidateMappedCriteriaVisitor
-     * class during the preplan.
-     * @param criteriaGroups
-     */
-    public void setGroupsInCriteria(List criteriaGroups) {
-        this.criteriaGroups = criteriaGroups;
-    }
-
-    public List getGroupsInCriteria() {
-        return this.criteriaGroups;
-    }    
-    
-    /**
      * This is parsed and resolved criteria node based on the criteria string. This is set by
      * ValidateMappedCriteriaVisitor class during pre planning.
      * @param node

Modified: trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingVisitor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/mapping/xml/MappingVisitor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -40,6 +40,9 @@
         return abort;
     }    
     
+    /**
+	 * @param node  
+	 */
     public void visit(MappingNode node) {}
     
     public void visit(MappingDocument doc) {
@@ -80,14 +83,14 @@
      */
     protected void walkChildNodes(MappingNode element) {
 
-        List children = element.getNodeChildren();
-        for(Iterator i=children.iterator(); i.hasNext();) {
+        List<MappingNode> children = element.getNodeChildren();
+        for(Iterator<MappingNode> i=children.iterator(); i.hasNext();) {
             
             if (shouldAbort()) {
                 break;
             }
             
-            MappingNode node = (MappingNode)i.next();            
+            MappingNode node = i.next();            
             node.acceptVisitor(this);
         }
     }    

Modified: trunk/engine/src/main/java/org/teiid/query/mapping/xml/ResultSetInfo.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/mapping/xml/ResultSetInfo.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/mapping/xml/ResultSetInfo.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -23,7 +23,6 @@
 package org.teiid.query.mapping.xml;
 
 import java.util.HashSet;
-import java.util.List;
 import java.util.Set;
 
 import org.teiid.query.processor.ProcessorPlan;
@@ -45,9 +44,6 @@
     // The result set command
     private Command rsCommand;
     
-    // The bound references for this result set: List<Reference>
-    private List boundReferences;
-
     // The processor plan output for the result set 
     private ProcessorPlan rsPlan;
     
@@ -61,15 +57,13 @@
     
     private Criteria criteria;
     
-    private Set criteriaResultSets = new HashSet();
+    private Set<MappingSourceNode> criteriaResultSets = new HashSet<MappingSourceNode>();
     
     private boolean criteriaRaised = false;
     
     private boolean stagedResult = false;
     
     //joined source node state
-    private boolean joinedWithParent = false;
-    private boolean joinRoot = false;
     private int mappingClassNumber = 0;
     private ElementSymbol mappingClassSymbol;
     
@@ -131,11 +125,11 @@
         this.orderBy = orderBy;
     }
     
-    public Set getCriteriaResultSets() {
+    public Set<MappingSourceNode> getCriteriaResultSets() {
         return this.criteriaResultSets;
     }
 
-    public void addToCriteriaResultSets(Set criteriaResultSets) {
+    public void addToCriteriaResultSets(Set<MappingSourceNode> criteriaResultSets) {
         this.criteriaResultSets.addAll(criteriaResultSets);
     }    
     
@@ -150,13 +144,10 @@
     public Object clone() {
         ResultSetInfo clone = new ResultSetInfo(this.resultSetName, this.stagedResult);
         clone.rsPlan = this.rsPlan;
-        clone.boundReferences = this.boundReferences;
         clone.userRowLimit = this.userRowLimit;
         clone.exceptionOnRowLimit = this.exceptionOnRowLimit;
         clone.rsCommand = (Command)this.rsCommand.clone();
         clone.criteriaRaised = this.criteriaRaised;
-        clone.joinedWithParent = this.joinedWithParent;
-        clone.joinRoot = this.joinRoot;
         clone.mappingClassNumber = this.mappingClassNumber;
         clone.mappingClassSymbol = this.mappingClassSymbol;
         return clone;
@@ -166,22 +157,6 @@
         return resultSetName + ", resultSetObject " + rsCommand; //$NON-NLS-1$
     }
 
-    public boolean isJoinedWithParent() {
-        return this.joinedWithParent;
-    }
-
-    public void setJoinedWithParent(boolean joinedWithParent) {
-        this.joinedWithParent = joinedWithParent;
-    }
-
-    public boolean isJoinRoot() {
-        return this.joinRoot;
-    }
-
-    public void setJoinRoot(boolean joinRoot) {
-        this.joinRoot = joinRoot;
-    }
-
     public int getMappingClassNumber() {
         return this.mappingClassNumber;
     }

Modified: trunk/engine/src/main/java/org/teiid/query/metadata/CompositeMetadataStore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/CompositeMetadataStore.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/CompositeMetadataStore.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -137,9 +137,6 @@
 				}
 			}
 		}
-		if (result.isEmpty()) {
-	        throw new QueryMetadataException(name.substring(1)+TransformationMetadata.NOT_EXISTS_MESSAGE);
-		}
 		return result;
 	}
 
@@ -149,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: trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataAdapter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataAdapter.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataAdapter.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -33,9 +33,11 @@
 import org.teiid.api.exception.query.QueryMetadataException;
 import org.teiid.core.TeiidComponentException;
 import org.teiid.core.types.DataTypeManager;
+import org.teiid.core.util.StringUtil;
 import org.teiid.query.QueryPlugin;
 import org.teiid.query.mapping.relational.QueryNode;
 import org.teiid.query.mapping.xml.MappingNode;
+import org.teiid.query.metadata.TempMetadataID.Type;
 
 
 /**
@@ -154,6 +156,19 @@
         throw new QueryMetadataException(msg);
     }
 
+    @Override
+    public Collection getGroupsForPartialName(String partialGroupName)
+    		throws TeiidComponentException, QueryMetadataException {
+    	Collection groups = super.getGroupsForPartialName(partialGroupName);
+    	ArrayList<String> allGroups = new ArrayList<String>(groups);
+    	for (String name : tempStore.getData().keySet()) {
+    		if (StringUtil.endsWithIgnoreCase(name, partialGroupName) 
+    				&& (name.length() == partialGroupName.length() || (name.length() > partialGroupName.length() && name.charAt(name.length() - partialGroupName.length() - 1) == '.'))) {
+    			allGroups.add(name);
+    		}
+    	}
+    	return allGroups;
+    }
 
     public Object getModelID(Object groupOrElementID)
         throws TeiidComponentException, QueryMetadataException {
@@ -483,7 +498,7 @@
         throws TeiidComponentException, QueryMetadataException {
 
         if(groupID instanceof TempMetadataID) {
-            return false;
+            return ((TempMetadataID)groupID).getMetadataType() == Type.XML;
         }
         return this.actualMetadata.isXMLGroup(groupID);
     }

Modified: trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataID.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataID.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataID.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -93,7 +93,8 @@
 	public enum Type {
 		VIRTUAL,
 		TEMP,
-		SCALAR
+		SCALAR,
+		XML
 	}
 	
     private String ID;      // never null, upper cased fully-qualified string

Modified: trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -181,14 +181,14 @@
     //                     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);
 		}
 		Table table = this.store.findGroup(elementName.substring(0, columnIndex).toUpperCase());
 		String shortElementName = elementName.substring(columnIndex + 1);
-		for (Column column : (List<Column>)getElementIDsInGroupID(table)) {
+		for (Column column : getElementIDsInGroupID(table)) {
 			if (column.getName().equalsIgnoreCase(shortElementName)) {
 				return column;
 			}
@@ -256,7 +256,7 @@
         return metadataRecord.getName();
     }
 
-    public List getElementIDsInGroupID(final Object groupID) throws TeiidComponentException, QueryMetadataException {
+    public List<Column> getElementIDsInGroupID(final Object groupID) throws TeiidComponentException, QueryMetadataException {
     	ArgCheck.isInstanceOf(Table.class, groupID);
     	return ((Table)groupID).getColumns();
     }
@@ -269,6 +269,10 @@
             	return parent;
             }
         } 
+        if(elementID instanceof ProcedureParameter) {
+        	ProcedureParameter columnRecord = (ProcedureParameter) elementID;
+            return columnRecord.getParent();
+        }
         throw createInvalidRecordTypeException(elementID);
     }
     
@@ -299,7 +303,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();
@@ -703,13 +710,19 @@
         ArgCheck.isInstanceOf(Table.class, groupID);
 
         Table tableRecord = (Table) groupID;
+        
+        MappingDocument mappingDoc = tableRecord.getAttachment(MappingDocument.class);
+        
+        if (mappingDoc != null) {
+        	return mappingDoc;
+        }
+        
 		final String groupName = tableRecord.getFullName();
         if(tableRecord.isVirtual()) {
-            // get mappin transform
+            // get mapping transform
             String document = tableRecord.getSelectTransformation();            
             InputStream inputStream = new ByteArrayInputStream(document.getBytes());
             MappingLoader reader = new MappingLoader();
-            MappingDocument mappingDoc = null;
             try{
                 mappingDoc = reader.loadDocument(inputStream);
                 mappingDoc.setName(groupName);
@@ -720,7 +733,8 @@
 					inputStream.close();
             	} catch(Exception e) {}
             }
-            return (MappingDocument)mappingDoc.clone();
+            tableRecord.addAttchment(MappingDocument.class, mappingDoc);
+            return mappingDoc;
         }
 
         return null;
@@ -750,14 +764,14 @@
     /**
      * @see org.teiid.query.metadata.QueryMetadataInterface#getXMLTempGroups(java.lang.Object)
      */
-    public Collection getXMLTempGroups(final Object groupID) throws TeiidComponentException, QueryMetadataException {
+    public Collection<Table> getXMLTempGroups(final Object groupID) throws TeiidComponentException, QueryMetadataException {
         ArgCheck.isInstanceOf(Table.class, groupID);
         Table tableRecord = (Table) groupID;
 
         if(tableRecord.getTableType() == Table.Type.Document) {
             return this.store.getXMLTempGroups(tableRecord);
         }
-        return Collections.EMPTY_SET;
+        return Collections.emptySet();
     }
 
     public int getCardinality(final Object groupID) throws TeiidComponentException, QueryMetadataException {

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/capabilities/BasicSourceCapabilities.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/capabilities/BasicSourceCapabilities.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/capabilities/BasicSourceCapabilities.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -29,10 +29,12 @@
  */
 public class BasicSourceCapabilities implements SourceCapabilities, Serializable {
 
-    private Scope scope = Scope.SCOPE_GLOBAL;
-    private Map capabilityMap = new HashMap();
-    private Map functionMap = new HashMap();
-    private Map propertyMap = new HashMap();
+	private static final long serialVersionUID = -1779069588746365579L;
+	
+	private Scope scope = Scope.SCOPE_GLOBAL;
+    private Map<Capability, Boolean> capabilityMap = new HashMap<Capability, Boolean>();
+    private Map<String, Boolean> functionMap = new TreeMap<String, Boolean>(String.CASE_INSENSITIVE_ORDER);
+    private Map<Capability, Object> propertyMap = new HashMap<Capability, Object>();
 
     /**
      * Construct a basic capabilities object.
@@ -41,12 +43,12 @@
     }
 
     public boolean supportsCapability(Capability capability) {
-        Boolean supports = (Boolean) capabilityMap.get(capability);
+        Boolean supports = capabilityMap.get(capability);
         return (supports == null) ? false : supports.booleanValue();
     }
 
     public boolean supportsFunction(String functionName) {
-        Boolean supports = (Boolean) functionMap.get(functionName);
+        Boolean supports = functionMap.get(functionName);
         return (supports == null) ? false : supports.booleanValue();
     }
     

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/capabilities/SourceCapabilities.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/capabilities/SourceCapabilities.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/capabilities/SourceCapabilities.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -354,8 +354,7 @@
      * used if the capability FUNCTION is true.
      * 
      * @param functionName
-     *            The function that may be supported (see MetaMatrix documentation for further definition of the functions and
-     *            their parameters.)
+     *            The function that may be supported
      * @return True if function is supported.
      */
     public boolean supportsFunction(String functionName);

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -238,7 +238,9 @@
                 if(stype == JoinStrategyType.MERGE || stype == JoinStrategyType.ENHANCED_SORT) {
                 	MergeJoinStrategy mjStrategy = null;
                 	if (stype.equals(JoinStrategyType.ENHANCED_SORT)) { 
-                		mjStrategy = new EnhancedSortMergeJoinStrategy(leftSort, (SortOption)node.getProperty(NodeConstants.Info.SORT_RIGHT));
+                		EnhancedSortMergeJoinStrategy esmjStrategy = new EnhancedSortMergeJoinStrategy(leftSort, (SortOption)node.getProperty(NodeConstants.Info.SORT_RIGHT));
+                		esmjStrategy.setSemiDep(node.hasBooleanProperty(Info.IS_SEMI_DEP));
+                		mjStrategy = esmjStrategy;
                 	} else {
                 		mjStrategy = new MergeJoinStrategy(leftSort, (SortOption)node.getProperty(NodeConstants.Info.SORT_RIGHT), false);
                 	}
@@ -341,7 +343,10 @@
 	                    }
                     }
                     aNode.setCommand(command);
-                    aNode.setModelName(getRoutingName(node));
+                    if (!aNode.isShouldEvaluate()) {
+                    	aNode.minimizeProject(command);
+                    }
+                    setRoutingName(aNode, node);
                 }
                 break;
 
@@ -540,7 +545,7 @@
         return processNode;
     }
 
-	private String getRoutingName(PlanNode node)
+	private void setRoutingName(AccessNode accessNode, PlanNode node)
 		throws QueryPlannerException, TeiidComponentException {
 
 		// Look up connector binding name
@@ -558,7 +563,8 @@
 				}
 			}
 			String cbName = metadata.getFullName(modelID);
-			return cbName;
+			accessNode.setModelName(cbName);
+			accessNode.setModelId(modelID);
 		} catch(QueryMetadataException e) {
             throw new QueryPlannerException(e, QueryPlugin.Util.getString("ERR.015.004.0009")); //$NON-NLS-1$
 		}


Property changes on: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java:3149-3217

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -63,6 +63,7 @@
 import org.teiid.query.optimizer.relational.rules.RuleConstants;
 import org.teiid.query.optimizer.relational.rules.RuleMergeCriteria;
 import org.teiid.query.processor.ProcessorPlan;
+import org.teiid.query.processor.relational.AccessNode;
 import org.teiid.query.processor.relational.RelationalPlan;
 import org.teiid.query.processor.relational.JoinNode.JoinStrategyType;
 import org.teiid.query.resolver.ProcedureContainerResolver;
@@ -177,11 +178,12 @@
 	        		Command subCommand = with.getCommand();
 	                ProcessorPlan procPlan = QueryOptimizer.optimizePlan(subCommand, metadata, idGenerator, capFinder, analysisRecord, context);
 	                subCommand.setProcessorPlan(procPlan);
-	                QueryCommand withCommand = CriteriaCapabilityValidatorVisitor.getQueryCommand(procPlan);
-	                if (withCommand != null && supportsWithPushdown) {
-	                	modelID = CriteriaCapabilityValidatorVisitor.validateCommandPushdown(modelID, metadata, capFinder, withCommand);
+	                AccessNode aNode = CriteriaCapabilityValidatorVisitor.getAccessNode(procPlan);
+	                if (aNode != null && supportsWithPushdown) {
+	                	modelID = CriteriaCapabilityValidatorVisitor.validateCommandPushdown(modelID, metadata, capFinder, aNode);
 	            	}
-	                if (modelID == null) {
+                	QueryCommand withCommand = CriteriaCapabilityValidatorVisitor.getQueryCommand(aNode);
+	                if (modelID == null || withCommand == null) {
 	                	supportsWithPushdown = false;
 	                } else {
 	                	if (pushDownWith == null) {
@@ -226,9 +228,10 @@
 
         RelationalPlan result = planToProcessConverter.convert(plan);
         if (withList != null && supportsWithPushdown) {
-        	QueryCommand queryCommand = CriteriaCapabilityValidatorVisitor.getQueryCommand(result);
-        	if (queryCommand != null) { 
-				if (CriteriaCapabilityValidatorVisitor.validateCommandPushdown(modelID, metadata, capFinder, queryCommand) == null) {
+            AccessNode aNode = CriteriaCapabilityValidatorVisitor.getAccessNode(result);
+        	if (aNode != null) { 
+        		QueryCommand queryCommand = CriteriaCapabilityValidatorVisitor.getQueryCommand(aNode);
+				if (queryCommand == null || CriteriaCapabilityValidatorVisitor.validateCommandPushdown(modelID, metadata, capFinder, aNode) == null) {
 					supportsWithPushdown = false;
 				} else {
 					queryCommand.setWith(pushDownWith);
@@ -753,16 +756,16 @@
      * Merges the from clause into a single join predicate if there are more than 1 from clauses
      */
     private static FromClause mergeClauseTrees(From from) {
-        List clauses = from.getClauses();
+        List<FromClause> clauses = from.getClauses();
         
         while (clauses.size() > 1) {
-            FromClause first = (FromClause)from.getClauses().remove(0);
-            FromClause second = (FromClause)from.getClauses().remove(0);
+            FromClause first = from.getClauses().remove(0);
+            FromClause second = from.getClauses().remove(0);
             JoinPredicate jp = new JoinPredicate(first, second, JoinType.JOIN_CROSS);
             clauses.add(0, jp);
         }
         
-        return (FromClause)clauses.get(0);
+        return clauses.get(0);
     }
     
     /**
@@ -864,6 +867,8 @@
             tt.setCorrelatedReferences(getCorrelatedReferences(parent, node, tt));
             node.addGroup(group);
             parent.addLastChild(node);
+        } else {
+        	throw new AssertionError("Unknown Type"); //$NON-NLS-1$
         }
         
         if (clause.isOptional()) {
@@ -876,6 +881,9 @@
         } else if (clause.isMakeNotDep()) {
             node.setProperty(NodeConstants.Info.MAKE_NOT_DEP, Boolean.TRUE);
         }
+        if (clause.isMakeInd()) {
+        	node.setProperty(NodeConstants.Info.MAKE_IND, Boolean.TRUE);
+        }
     }
 
 	public static Object getTrackableGroup(GroupSymbol group, QueryMetadataInterface metadata)


Property changes on: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java:3149-3217

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/NodeConstants.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/NodeConstants.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/NodeConstants.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -95,6 +95,7 @@
         IS_OPTIONAL,          // Boolean
         IS_LEFT_DISTINCT, 	// Boolean
         IS_RIGHT_DISTINCT, 	// Boolean
+        IS_SEMI_DEP,		// Boolean
 
         // Project node properties
         PROJECT_COLS,       // List <SingleElementSymbol>
@@ -119,13 +120,14 @@
         SYMBOL_MAP,         // SymbolMap
         PARTITION_INFO,		// Map<ElementSymbol, List<Set<Constant>>> - it will only be consistent in the initial stages of planning
         VIRTUAL_COMMAND,    // Command
-        MAKE_DEP,           // ??? List of Groups ???
+        MAKE_DEP,           // Boolean
         PROCESSOR_PLAN,     // ProcessorPlan for non-relational sub plan
         NESTED_COMMAND,     // Command for nested processor plan
         TABLE_FUNCTION,     // Table Function
         CORRELATED_REFERENCES,  // SymbolMap
-        MAKE_NOT_DEP,       // Source should not be dependent
+        MAKE_NOT_DEP,       // Boolean
         INLINE_VIEW,        // If the source node represents an inline view
+        MAKE_IND,
         
         // Group node properties
         GROUP_COLS,         // List <SingleElementSymbol>

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CapabilitiesUtil.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CapabilitiesUtil.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CapabilitiesUtil.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -209,14 +209,14 @@
         }
         
         //capabilities check is only valid for non-schema scoped functions
-        //technically the other functions are scoped to SYS, but that's 
+        //technically the other functions are scoped to SYS or their function model, but that's 
         //not formally part of their metadata yet
         Schema schema = function.getFunctionDescriptor().getMethod().getParent();
         if (schema == null) {
             // Find capabilities
             SourceCapabilities caps = getCapabilities(modelID, metadata, capFinder);
 
-            if (!caps.supportsFunction(function.getFunctionDescriptor().getName().toLowerCase())) {
+            if (!caps.supportsFunction(function.getFunctionDescriptor().getName())) {
                 return false;
             }
         } else if (!schema.getFullName().equalsIgnoreCase(metadata.getFullName(modelID))) {
@@ -225,7 +225,7 @@
         
         //special check to ensure that special conversions are not pushed down (this can be removed after we support type based function pushdown)            
         if (FunctionLibrary.isConvert(function)) {
-            Class fromType = function.getArg(0).getType();
+            Class<?> fromType = function.getArg(0).getType();
             //object or clob to anything cannot be pushed down
             if (DataTypeManager.DefaultDataClasses.OBJECT.equals(fromType) 
                             || DataTypeManager.DefaultDataClasses.CLOB.equals(fromType)

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -23,7 +23,6 @@
 package org.teiid.query.optimizer.relational.rules;
 
 import java.util.Arrays;
-import java.util.Collection;
 
 import org.teiid.api.exception.query.QueryMetadataException;
 import org.teiid.core.TeiidComponentException;
@@ -61,8 +60,9 @@
 import org.teiid.query.sql.navigator.PostOrderNavigator;
 import org.teiid.query.sql.symbol.AggregateSymbol;
 import org.teiid.query.sql.symbol.CaseExpression;
+import org.teiid.query.sql.symbol.Constant;
+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.sql.symbol.QueryString;
 import org.teiid.query.sql.symbol.ScalarSubquery;
 import org.teiid.query.sql.symbol.SearchedCaseExpression;
@@ -77,7 +77,6 @@
 import org.teiid.query.sql.util.SymbolMap;
 import org.teiid.query.sql.visitor.EvaluatableVisitor;
 import org.teiid.query.sql.visitor.FunctionCollectorVisitor;
-import org.teiid.query.sql.visitor.GroupCollectorVisitor;
 
 
 /**
@@ -464,17 +463,17 @@
      * @return
      * @throws TeiidComponentException
      */
-    public static Object validateSubqueryPushdown(SubqueryContainer subqueryContainer, Object critNodeModelID, 
+    public static Object validateSubqueryPushdown(SubqueryContainer<?> subqueryContainer, Object critNodeModelID, 
     		QueryMetadataInterface metadata, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord) throws TeiidComponentException {
     	ProcessorPlan plan = subqueryContainer.getCommand().getProcessorPlan();
     	if (plan != null) {
-    		QueryCommand queryCommand = getQueryCommand(plan);
+    		AccessNode aNode = getAccessNode(plan);
     		
-    		if (queryCommand == null) {
+    		if (aNode == null) {
     			return null;
     		}
     		
-    		critNodeModelID = validateCommandPushdown(critNodeModelID, metadata, capFinder,	queryCommand);  
+    		critNodeModelID = validateCommandPushdown(critNodeModelID, metadata, capFinder,	aNode);  
     	}
     	if (critNodeModelID == null) {
     		return null;
@@ -502,20 +501,13 @@
 
 	public static Object validateCommandPushdown(Object critNodeModelID,
 			QueryMetadataInterface metadata, CapabilitiesFinder capFinder,
-			QueryCommand queryCommand) throws TeiidComponentException {
+			AccessNode aNode) throws TeiidComponentException {
 		// Check that query in access node is for the same model as current node
 		try {                
-		    Collection<GroupSymbol> subQueryGroups = GroupCollectorVisitor.getGroupsIgnoreInlineViews(queryCommand, false);
-		    if(subQueryGroups.size() == 0) {
-		        // No FROM?
-		        return null;
-		    }
-		    GroupSymbol subQueryGroup = subQueryGroups.iterator().next();
-
-		    Object modelID = subQueryGroup.getModelMetadataId();
-		    if (modelID == null) {
-		    	modelID = metadata.getModelID(subQueryGroup.getMetadataID());
-		    }
+			if (!(aNode.getCommand() instanceof QueryCommand)) {
+				return null;
+			}
+		    Object modelID = aNode.getModelId();
 		    if (critNodeModelID == null) {
 		    	critNodeModelID = modelID;
 		    } else if(!CapabilitiesUtil.isSameConnector(critNodeModelID, modelID, metadata, capFinder)) {
@@ -527,7 +519,7 @@
 		return critNodeModelID;
 	}
 
-	public static QueryCommand getQueryCommand(ProcessorPlan plan) {
+	public static AccessNode getAccessNode(ProcessorPlan plan) {
 		if(!(plan instanceof RelationalPlan)) {
 		    return null;
 		}
@@ -545,17 +537,27 @@
 			accessNode = ln.getChildren()[0];
 		}
 		
-		if (! (accessNode instanceof AccessNode) || accessNode.getChildren()[0] != null) {
+		if (! (accessNode instanceof AccessNode)) {
 			return null;
 		}
-		
-		// Check that command in access node is a query
-		Command command = ((AccessNode)accessNode).getCommand();
-		if(command == null || !(command instanceof QueryCommand) || ((command instanceof Query) && ((Query)command).getIsXML())) {
+		return (AccessNode)accessNode;
+	}
+	
+	public static QueryCommand getQueryCommand(AccessNode aNode) {
+		if (aNode == null) {
+			return null;
+		}
+		Command command = aNode.getCommand();
+		if(!(command instanceof QueryCommand)) {
 		    return null;
 		}
 		
 		QueryCommand queryCommand = (QueryCommand)command;
+		if (aNode.getProjection() != null && aNode.getProjection().length > 0) {
+			Query newCommand = (Query)queryCommand.clone();
+			newCommand.getSelect().setSymbols(aNode.getOriginalSelect());
+			return newCommand;
+		}
 		return queryCommand;
 	}
         

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleChooseDependent.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleChooseDependent.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleChooseDependent.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -253,6 +253,16 @@
         		analysisRecord.println("Making access node dependent due to hint: "+ sourceNode2.nodeToString());                     //$NON-NLS-1$
         	}
             return rootNode2;
+        } else if (sourceNode1.hasBooleanProperty(NodeConstants.Info.MAKE_IND) && sourceNode2 != null) {
+        	if (analysisRecord.recordDebug()) {
+        		analysisRecord.println("Making access node dependent due to hint: "+ sourceNode2.nodeToString());                     //$NON-NLS-1$
+        	}
+        	return rootNode2;
+        } else if (sourceNode2 != null && sourceNode2.hasBooleanProperty(NodeConstants.Info.MAKE_IND)) {
+        	if (analysisRecord.recordDebug()) {
+        		analysisRecord.println("Making access node dependent due to hint: "+ sourceNode1.nodeToString());                     //$NON-NLS-1$
+        	}
+        	return rootNode1;
         }
         
         return null;

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -24,6 +24,7 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashSet;
 import java.util.LinkedHashSet;
 import java.util.LinkedList;
 import java.util.List;
@@ -45,6 +46,7 @@
 import org.teiid.query.optimizer.relational.plantree.PlanNode;
 import org.teiid.query.optimizer.relational.plantree.NodeConstants.Info;
 import org.teiid.query.processor.ProcessorPlan;
+import org.teiid.query.processor.relational.AccessNode;
 import org.teiid.query.processor.relational.RelationalPlan;
 import org.teiid.query.resolver.util.ResolverUtil;
 import org.teiid.query.rewriter.QueryRewriter;
@@ -171,9 +173,11 @@
 		 */
 		if (queryCommand instanceof SetQuery) {
 			((SetQuery)queryCommand).setAll(false);
-		} else if (!NewCalculateCostUtil.usesKey(accessNode, queryCommand.getProjectedSymbols(), metadata) && CapabilitiesUtil.supports(Capability.QUERY_SELECT_DISTINCT, RuleRaiseAccess.getModelIDFromAccess(accessNode, metadata), metadata, capFinder)) {
+		} else if (CapabilitiesUtil.supports(Capability.QUERY_SELECT_DISTINCT, RuleRaiseAccess.getModelIDFromAccess(accessNode, metadata), metadata, capFinder)) {
 			Query query = (Query)queryCommand;
-			if (!QueryRewriter.isDistinctWithGroupBy(query)) {
+			HashSet<GroupSymbol> keyPreservingGroups = new HashSet<GroupSymbol>();
+			ResolverUtil.findKeyPreserved(query, keyPreservingGroups, metadata);
+			if (!QueryRewriter.isDistinctWithGroupBy(query) && !NewCalculateCostUtil.usesKey(query.getSelect().getProjectedSymbols(), keyPreservingGroups, metadata, true)) {
 				((Query)queryCommand).getSelect().setDistinct(true);
 			}
 		}
@@ -405,7 +409,8 @@
 
 	public static void prepareSubquery(SubqueryContainer container) {
 		RelationalPlan subqueryPlan = (RelationalPlan)container.getCommand().getProcessorPlan();
-		QueryCommand command = CriteriaCapabilityValidatorVisitor.getQueryCommand(subqueryPlan);
+		AccessNode aNode = CriteriaCapabilityValidatorVisitor.getAccessNode(subqueryPlan);
+		QueryCommand command = CriteriaCapabilityValidatorVisitor.getQueryCommand(aNode);
 		if (command == null) {
 			return;
 		}

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleImplementJoinStrategy.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleImplementJoinStrategy.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleImplementJoinStrategy.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -24,6 +24,7 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
@@ -116,6 +117,7 @@
 
             List<SingleElementSymbol> leftExpressions = (List<SingleElementSymbol>) joinNode.getProperty(NodeConstants.Info.LEFT_EXPRESSIONS);
             List<SingleElementSymbol> rightExpressions = (List<SingleElementSymbol>) joinNode.getProperty(NodeConstants.Info.RIGHT_EXPRESSIONS);
+            int origExpressionCount = leftExpressions.size();
 
             //check index information on each side
             //TODO: don't do null order compensation - in fact we should check what the order actually is, but we don't have that metadata
@@ -152,7 +154,7 @@
 						toCriteria.add(j);
 					}
 				}
-        		List<Criteria> joinCriteria = (List<Criteria>) joinNode.getProperty(Info.JOIN_CRITERIA);
+        		List<Criteria> joinCriteria = (List<Criteria>) joinNode.getProperty(Info.NON_EQUI_JOIN_CRITERIA);
         		for (int index : toCriteria) {
 					SingleElementSymbol lses = leftExpressions.get(index);
 					SingleElementSymbol rses = rightExpressions.get(index);
@@ -163,17 +165,32 @@
 						joinNode.setProperty(Info.JOIN_TYPE, JoinType.JOIN_INNER);
 					}
 				}
-        		joinNode.setProperty(Info.JOIN_CRITERIA, joinCriteria);
+        		joinNode.setProperty(Info.NON_EQUI_JOIN_CRITERIA, joinCriteria);
         		leftExpressions = RelationalNode.projectTuple(reorder, leftExpressions);
             	rightExpressions = RelationalNode.projectTuple(reorder, rightExpressions);
             	joinNode.setProperty(NodeConstants.Info.LEFT_EXPRESSIONS, leftExpressions);
             	joinNode.setProperty(NodeConstants.Info.RIGHT_EXPRESSIONS, rightExpressions);
             }
-            
+
+            Set<SingleElementSymbol> outputSymbols = new LinkedHashSet<SingleElementSymbol>((List<SingleElementSymbol>)joinNode.getProperty(NodeConstants.Info.OUTPUT_COLS));
+
 			boolean pushedLeft = insertSort(joinNode.getFirstChild(), leftExpressions, joinNode, metadata, capabilitiesFinder, pushLeft);	
-			insertSort(joinNode.getLastChild(), rightExpressions, joinNode, metadata, capabilitiesFinder, pushRight);
-        	
-        	if (joinNode.getProperty(NodeConstants.Info.JOIN_TYPE) == JoinType.JOIN_INNER && (!pushRight || !pushedLeft)) {
+			
+	        if (origExpressionCount == 1 
+	        		&& joinNode.getProperty(NodeConstants.Info.JOIN_TYPE) == JoinType.JOIN_INNER 
+	        		&& joinNode.getProperty(NodeConstants.Info.DEPENDENT_VALUE_SOURCE) != null
+	        		&& !joinNode.hasCollectionProperty(Info.NON_EQUI_JOIN_CRITERIA)) {
+	        	Collection<SingleElementSymbol> output = (Collection<SingleElementSymbol>) joinNode.getProperty(NodeConstants.Info.OUTPUT_COLS);
+	        	Collection<GroupSymbol> groups = GroupsUsedByElementsVisitor.getGroups(output);
+	        	if (Collections.disjoint(groups, FrameUtil.findJoinSourceNode(joinNode.getFirstChild()).getGroups())) {
+	        		pushRight = false;
+	        		joinNode.setProperty(Info.IS_SEMI_DEP, Boolean.TRUE);
+	        	}
+			}
+
+			boolean pushedRight = insertSort(joinNode.getLastChild(), rightExpressions, joinNode, metadata, capabilitiesFinder, pushRight);
+			
+        	if (joinNode.getProperty(NodeConstants.Info.JOIN_TYPE) == JoinType.JOIN_INNER && (!pushedRight || !pushedLeft)) {
         		joinNode.setProperty(NodeConstants.Info.JOIN_STRATEGY, JoinStrategyType.ENHANCED_SORT);
         	}
         }
@@ -207,8 +224,20 @@
                 
         PlanNode sortNode = createSortNode(new ArrayList<SingleElementSymbol>(orderSymbols), outputSymbols);
         
+        boolean distinct = false;
+        if (sourceNode.getType() == NodeConstants.Types.SOURCE && outputSymbols.size() == expressions.size() && outputSymbols.containsAll(expressions)) {
+        	PlanNode setOp = NodeEditor.findNodePreOrder(sourceNode.getFirstChild(), NodeConstants.Types.SET_OP, NodeConstants.Types.SOURCE);
+        	if (setOp != null) {
+        		if (setOp.hasBooleanProperty(NodeConstants.Info.USE_ALL)) {
+        			distinct = true;
+        		}
+        	} else if (NodeEditor.findNodePreOrder(sourceNode.getFirstChild(), NodeConstants.Types.DUP_REMOVE, NodeConstants.Types.PROJECT) != null) {
+	        	distinct = true;
+	        }
+        }
+        
         if (sourceNode.getType() == NodeConstants.Types.ACCESS) {
-        	if (NewCalculateCostUtil.usesKey(sourceNode, expressions, metadata)) {
+        	if (distinct || NewCalculateCostUtil.usesKey(sourceNode, expressions, metadata)) {
                 joinNode.setProperty(joinNode.getFirstChild() == childNode ? NodeConstants.Info.IS_LEFT_DISTINCT : NodeConstants.Info.IS_RIGHT_DISTINCT, true);
         	}
 	        if (attemptPush && RuleRaiseAccess.canRaiseOverSort(sourceNode, metadata, capFinder, sortNode, null, false)) {
@@ -221,6 +250,10 @@
 	        }
         }
         
+        if (distinct) {
+            joinNode.setProperty(joinNode.getFirstChild() == childNode ? NodeConstants.Info.IS_LEFT_DISTINCT : NodeConstants.Info.IS_RIGHT_DISTINCT, true);
+    	}
+        
         joinNode.setProperty(joinNode.getFirstChild() == childNode ? NodeConstants.Info.SORT_LEFT : NodeConstants.Info.SORT_RIGHT, SortOption.SORT);
         
         if (needsCorrection) {

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleMergeCriteria.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleMergeCriteria.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleMergeCriteria.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -131,6 +131,7 @@
 		public Class<?> type;
 		public boolean mergeJoin;
 		public boolean madeDistinct;
+		public boolean makeInd;
 	}
 
 	private IDGenerator idGenerator;
@@ -363,6 +364,7 @@
 			result.not ^= ssc.isNegated();
 			result.type = crit.getClass();
 			result.mergeJoin = ssc.getSubqueryHint().isMergeJoin();
+			result.makeInd = ssc.getSubqueryHint().isDepJoin();
 			if (!UNNEST && !result.mergeJoin) {
 				return result;
 			}

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlaceAccess.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlaceAccess.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlaceAccess.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -286,6 +286,10 @@
         if (hint != null) {
             copyTo.setProperty(NodeConstants.Info.MAKE_NOT_DEP, hint);
         }
+        hint = node.getProperty(NodeConstants.Info.MAKE_IND);
+        if (hint != null) {
+            copyTo.setProperty(NodeConstants.Info.MAKE_IND, hint);
+        }
     }
 
     /**

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlanJoins.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlanJoins.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlanJoins.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -466,7 +466,7 @@
                 }
                 JoinType jt = (JoinType)root.getProperty(NodeConstants.Info.JOIN_TYPE);
                 
-                boolean treatJoinAsSource = jt.isOuter() || root.getProperty(NodeConstants.Info.ACCESS_PATTERNS) != null || root.hasProperty(NodeConstants.Info.MAKE_DEP);
+                boolean treatJoinAsSource = jt.isOuter() || root.getProperty(NodeConstants.Info.ACCESS_PATTERNS) != null || root.hasProperty(NodeConstants.Info.MAKE_DEP) || root.hasProperty(NodeConstants.Info.MAKE_IND);
                 
                 if (treatJoinAsSource) {
                     currentRegion.addJoinSourceNode(root);

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -29,6 +29,7 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.LinkedList;
 import java.util.List;
@@ -294,7 +295,7 @@
 			if (first) {
 				first = false;
 				QueryRewriter.makeSelectUnique(allSymbols, false);
-				symbols = allSymbols.getSymbols();
+				symbols = allSymbols.getProjectedSymbols();
 			}
 			projectPlanNode.setProperty(NodeConstants.Info.PROJECT_COLS, allSymbols.getSymbols());
 		    projectPlanNode.addGroups(view.getGroups());
@@ -403,7 +404,7 @@
         if (groupingExpressions != null) {
         	newGroupingExpressions = new HashSet<SingleElementSymbol>();
         	for (SingleElementSymbol singleElementSymbol : groupingExpressions) {
-				newGroupingExpressions.add((SingleElementSymbol)symbolMap.getKeys().get(virtualElements.indexOf(singleElementSymbol)).clone());
+				newGroupingExpressions.add(symbolMap.getKeys().get(virtualElements.indexOf(singleElementSymbol)).clone());
 			}
         }
 
@@ -540,20 +541,19 @@
         }
         Map<PlanNode, List<SingleElementSymbol>> groupingMap = createNodeMapping(groupNode, groupingExpressions, false);
 
-        Set<PlanNode> possibleTargetNodes = new HashSet<PlanNode>(aggregateMap.keySet());
+        Set<PlanNode> possibleTargetNodes = new LinkedHashSet<PlanNode>(aggregateMap.keySet());
         possibleTargetNodes.addAll(groupingMap.keySet());
 
         for (PlanNode planNode : possibleTargetNodes) {
             Set<SingleElementSymbol> stagedGroupingSymbols = new LinkedHashSet<SingleElementSymbol>();
             List<AggregateSymbol> aggregates = aggregateMap.get(planNode);
-            List<SingleElementSymbol> groupBy = groupingMap.get(planNode);
 
             if (!canPush(groupNode, stagedGroupingSymbols, planNode)) {
                 continue;
             }
 
-            if (groupBy != null) {
-                stagedGroupingSymbols.addAll(groupBy);
+            if (groupingExpressions != null) {
+            	filterJoinColumns(stagedGroupingSymbols, planNode.getGroups(), groupingExpressions);
             }
 
             collectSymbolsFromOtherAggregates(allAggregates, aggregates, planNode, stagedGroupingSymbols);
@@ -715,7 +715,7 @@
 
     private <T extends SingleElementSymbol> Map<PlanNode, List<T>> createNodeMapping(PlanNode groupNode,
                                                                        Collection<T> expressions, boolean aggs) {
-        Map<PlanNode, List<T>> result = new HashMap<PlanNode, List<T>>();
+        Map<PlanNode, List<T>> result = new LinkedHashMap<PlanNode, List<T>>();
         if (expressions == null) {
             return result;
         }

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -764,15 +764,8 @@
 		newAccess.addGroups(leftAccess.getGroups());
         
         // Combine hints if necessary
-        Object leftHint = leftAccess.getProperty(NodeConstants.Info.MAKE_DEP);
-        if(leftHint != null) {
-            newAccess.setProperty(NodeConstants.Info.MAKE_DEP, leftHint);
-        } else {
-            Object rightHint = rightAccess.getProperty(NodeConstants.Info.MAKE_DEP);
-            if(rightHint != null) {
-                newAccess.setProperty(NodeConstants.Info.MAKE_DEP, rightHint);
-            }    
-        }
+        combineHint(leftAccess, rightAccess, newAccess, NodeConstants.Info.MAKE_DEP);
+        combineHint(leftAccess, rightAccess, newAccess, NodeConstants.Info.MAKE_IND);
         RulePlaceAccess.copyDependentHints(leftAccess, newAccess);
         RulePlaceAccess.copyDependentHints(rightAccess, newAccess);
         RulePlaceAccess.copyDependentHints(joinNode, newAccess);
@@ -786,6 +779,19 @@
         return newAccess;
 	}
 
+	private static void combineHint(PlanNode leftAccess, PlanNode rightAccess,
+			PlanNode newAccess, NodeConstants.Info info) {
+		Object leftHint = leftAccess.getProperty(info);
+        if(leftHint != null) {
+            newAccess.setProperty(info, leftHint);
+        } else {
+            Object rightHint = rightAccess.getProperty(info);
+            if(rightHint != null) {
+                newAccess.setProperty(info, rightHint);
+            }    
+        }
+	}
+
     /**
      * Get modelID for Access node and cache the result in the Access node.
      * @param accessNode Access node

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/ContextReplacerVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/ContextReplacerVisitor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/ContextReplacerVisitor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -41,7 +41,7 @@
  */
 class ContextReplacerVisitor extends ExpressionMappingVisitor {
     
-    private Collection contextFunctions = new LinkedList(); //contains Function objects
+    private Collection<Function> contextFunctions = new LinkedList<Function>(); //contains Function objects
     
     /**
      * Construct a new visitor
@@ -55,7 +55,7 @@
      * which were stripped out of the language object by this visitor
      * @return Collection of Function
      */
-    Collection getContextFunctions(){
+    Collection<Function> getContextFunctions(){
         return this.contextFunctions;
     }
     
@@ -78,9 +78,9 @@
      * Helper to quickly replace 'context'
      * @param obj Language object
      */
-    static final Collection replaceContextFunctions(LanguageObject obj) {
+    static final Collection<Function> replaceContextFunctions(LanguageObject obj) {
         if (obj == null){
-            return Collections.EMPTY_SET;
+            return Collections.emptySet();
         }
         ContextReplacerVisitor visitor = new ContextReplacerVisitor();
         PreOrderNavigator.doVisit(obj, visitor);

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/CriteriaPlanner.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/CriteriaPlanner.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/CriteriaPlanner.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -64,9 +64,9 @@
     static void placeUserCriteria(Criteria criteria, XMLPlannerEnvironment planEnv)
         throws QueryPlannerException, QueryMetadataException, TeiidComponentException {
         
-        for (Iterator conjunctIter = Criteria.separateCriteriaByAnd(criteria).iterator(); conjunctIter.hasNext();) {
+        for (Iterator<Criteria> conjunctIter = Criteria.separateCriteriaByAnd(criteria).iterator(); conjunctIter.hasNext();) {
         
-            Criteria conjunct = (Criteria) conjunctIter.next();
+            Criteria conjunct = conjunctIter.next();
             
             if (planStagingTableCriteria(conjunct, planEnv)) {
                 continue;
@@ -79,11 +79,10 @@
             
             MappingNode context = null;
             
-            Collection contextFunctions = ContextReplacerVisitor.replaceContextFunctions(conjunct);
+            Collection<Function> contextFunctions = ContextReplacerVisitor.replaceContextFunctions(conjunct);
             if (!contextFunctions.isEmpty()) {
                 //ensure that every part of the conjunct is to the same context
-                for (Iterator i = contextFunctions.iterator(); i.hasNext();) {
-                    Function contextFunction = (Function)i.next();
+            	for (Function contextFunction : contextFunctions) {
                     MappingNode otherContext = getContext(planEnv, contextFunction);
                     if (context == null) {
                         context = otherContext;
@@ -102,7 +101,7 @@
                 context = planEnv.mappingDoc;
             }
             
-            Set sourceNodes = collectSourceNodesInConjunct(conjunct, context, planEnv.mappingDoc);
+            Set<MappingSourceNode> sourceNodes = collectSourceNodesInConjunct(conjunct, context, planEnv.mappingDoc);
 
             //TODO: this can be replaced with method on the source node?
             MappingSourceNode criteriaRs = findRootResultSetNode(context, sourceNodes, criteria);
@@ -118,23 +117,21 @@
     /** 
      * This method collects all the MappingSourceNode(s) at or below the context given.
      */
-    private static Set collectSourceNodesInConjunct(Criteria conjunct, MappingNode context, MappingDocument mappingDoc)
+    private static Set<MappingSourceNode> collectSourceNodesInConjunct(Criteria conjunct, MappingNode context, MappingDocument mappingDoc)
         throws QueryPlannerException {
         
-        Collection elements = ElementCollectorVisitor.getElements(conjunct, true);
-        Set resultSets = new HashSet();
+        Collection<ElementSymbol> elements = ElementCollectorVisitor.getElements(conjunct, true);
+        Set<MappingSourceNode> resultSets = new HashSet<MappingSourceNode>();
         
         String contextFullName = context.getFullyQualifiedName().toUpperCase();
         
         //validate that each element's group is under the current context or is in the direct parentage
-        for (Iterator i = elements.iterator(); i.hasNext();) {
-            ElementSymbol elementSymbol = (ElementSymbol)i.next();
-            
+        for (ElementSymbol elementSymbol : elements) {
             String elementFullName = elementSymbol.getCanonicalName();
             
             MappingNode node = MappingNode.findNode(mappingDoc, elementFullName);
             
-            MappingNode elementRsNode = node.getSourceNode(); 
+            MappingSourceNode elementRsNode = node.getSourceNode(); 
             if (elementRsNode == null) {
                 throw new QueryPlannerException(QueryPlugin.Util.getString("CriteriaPlanner.invalid_element", elementSymbol)); //$NON-NLS-1$
             }
@@ -158,20 +155,16 @@
         return resultSets;
     }
 
-    private static MappingSourceNode findRootResultSetNode(MappingNode context, Set resultSets, Criteria criteria) 
+    private static MappingSourceNode findRootResultSetNode(MappingNode context, Set<MappingSourceNode> resultSets, Criteria criteria) 
         throws QueryPlannerException {
         
         if (context instanceof MappingSourceNode) {
             return (MappingSourceNode)context;
         }
 
-        Set criteriaResultSets = new HashSet();
+        Set<MappingNode> criteriaResultSets = new HashSet<MappingNode>();
         // if the context node is not the root node then we need to find the root source node from list.
-        for (Iterator i = resultSets.iterator(); i.hasNext();) {
-
-            // these are actually source nodes.
-            MappingNode node = (MappingNode)i.next();
-   
+        for (MappingNode node : resultSets) {
             MappingNode root = node;
             
             while (node != null) {
@@ -288,14 +281,13 @@
     static String getStagingTableForConjunct(Criteria conjunct, QueryMetadataInterface metadata)
         throws QueryPlannerException, QueryMetadataException, TeiidComponentException {
 
-        Collection elements = ElementCollectorVisitor.getElements(conjunct, true);
+        Collection<ElementSymbol> elements = ElementCollectorVisitor.getElements(conjunct, true);
 
         boolean first = true;
         String resultSet = null;
         
         // Check each remaining element to make sure it matches
-        for(Iterator elemIter = elements.iterator(); elemIter.hasNext();) {
-            ElementSymbol element = (ElementSymbol) elemIter.next();
+        for (ElementSymbol element : elements) {
             GroupSymbol group = element.getGroupSymbol();
             //assumes that all non-xml group elements are temp elements
             boolean hasTempElement = !metadata.isXMLGroup(group.getMetadataID());
@@ -314,7 +306,7 @@
         }
         
         if (resultSet != null) {
-            Collection functions = ContextReplacerVisitor.replaceContextFunctions(conjunct);
+            Collection<Function> functions = ContextReplacerVisitor.replaceContextFunctions(conjunct);
             if (!functions.isEmpty()) {
                 throw new QueryPlannerException(QueryPlugin.Util.getString("CriteriaPlanner.staging_context")); //$NON-NLS-1$
             }

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/MarkExcludeVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/MarkExcludeVisitor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/MarkExcludeVisitor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -40,13 +40,13 @@
 
 
 /** 
- * This vistor marks all the nodes in the Mapping Document to 
+ * This visitor marks all the nodes in the Mapping Document to 
  * "exclude".
  */
 public class MarkExcludeVisitor extends MappingVisitor{
-    HashSet keepNodes;
+    HashSet<String> keepNodes;
     
-    public MarkExcludeVisitor(HashSet keppNodes) {
+    public MarkExcludeVisitor(HashSet<String> keppNodes) {
         this.keepNodes = keppNodes;
     }
 
@@ -132,7 +132,7 @@
         }
     }
         
-    public static MappingDocument markExcludedNodes(MappingDocument doc, HashSet keepNodes) {
+    public static MappingDocument markExcludedNodes(MappingDocument doc, HashSet<String> keepNodes) {
         MarkExcludeVisitor visitor = new MarkExcludeVisitor(keepNodes);
         doc.acceptVisitor(new Navigator(true, visitor));
         return doc;

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/NameInSourceResolverVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/NameInSourceResolverVisitor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/NameInSourceResolverVisitor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -61,12 +61,12 @@
         
         Map symbols = element.getSymbolMap();
         
-        List elements = new LinkedList();
+        List<ElementSymbol> elements = new LinkedList<ElementSymbol>();
         
         for (Iterator i = symbols.values().iterator(); i.hasNext();) {
             Object symbol = i.next();
             if (symbol instanceof ElementSymbol) {
-                elements.add(symbol);
+                elements.add((ElementSymbol)symbol);
             }
         }
         

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/SourceNodePlannerVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/SourceNodePlannerVisitor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/SourceNodePlannerVisitor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -125,7 +125,7 @@
             // root source nodes do not have any inputset criteria on them; so there is no use in
             // going through the raising the criteria.
             // if the original query is not a select.. we are out of luck. we can expand on this later
-            // versions. make ure bindings are only to parent.
+            // versions. make sure bindings are only to parent.
             if (parent == null || !canRaiseInputset(command, bindings) || !areBindingsOnlyToNode(modifiedNode, parent)) {
                 return;
             }
@@ -229,7 +229,7 @@
         throws QueryMetadataException, TeiidComponentException, QueryPlannerException {
         
         // get elements in the old group
-        List elements = ResolverUtil.resolveElementsInGroup(oldSymbol, planEnv.getGlobalMetadata());
+        List<ElementSymbol> elements = ResolverUtil.resolveElementsInGroup(oldSymbol, planEnv.getGlobalMetadata());
         
         TempMetadataStore store = planEnv.getGlobalMetadata().getMetadataStore();
         
@@ -280,7 +280,7 @@
         }
     }
     
-    private boolean canRaiseInputset(Command command, Collection<ElementSymbol> bindings) throws TeiidComponentException {
+    private boolean canRaiseInputset(Command command, Collection<ElementSymbol> bindings) {
         // check to see if this is query.
         if (!(command instanceof Query)) {
             return false;
@@ -311,14 +311,13 @@
      * @param criteria - criteria on which the elements need to modified
      * @return true if converted; false otherwise
      */
-    private boolean convertCriteria(GroupSymbol newGroupSymbol, Query transformationQuery, Criteria criteria, TempMetadataAdapter metadata, Map symbolMap) 
-        throws QueryMetadataException, TeiidComponentException {
+    private boolean convertCriteria(GroupSymbol newGroupSymbol, Query transformationQuery, Criteria criteria, TempMetadataAdapter metadata, Map symbolMap) {
         
         String groupName = newGroupSymbol.getName();
         Collection<ElementSymbol> elementsInCriteria = ElementCollectorVisitor.getElements(criteria, true);
-        Map mappedElements = new HashMap();
+        Map<ElementSymbol, ElementSymbol> mappedElements = new HashMap<ElementSymbol, ElementSymbol>();
 
-        List projectedSymbols = transformationQuery.getProjectedSymbols();
+        List<SingleElementSymbol> projectedSymbols = transformationQuery.getProjectedSymbols();
         
         boolean addedProjectedSymbol = false;
         
@@ -383,10 +382,8 @@
      * If the element has alias wrapping, then return the matching alias element.
      * @return matched alias symbol; null otherwise.
      */
-    private AliasSymbol getMachingAlias(List elementsInGroup, ElementSymbol symbol) {
-        
-        for(Iterator i = elementsInGroup.iterator(); i.hasNext();) {
-            final SingleElementSymbol element = (SingleElementSymbol)i.next();
+    private AliasSymbol getMachingAlias(List<SingleElementSymbol> elementsInGroup, ElementSymbol symbol) {
+    	for (SingleElementSymbol element : elementsInGroup) {
             if (element instanceof AliasSymbol) {
                 AliasSymbol alias = (AliasSymbol)element;
                 if (alias.getSymbol().equals(symbol)) {
@@ -421,14 +418,14 @@
                  */
                 @Override
                 protected void walkChildNodes(MappingNode element) {
-                    List children = new ArrayList(element.getNodeChildren());
-                    for(Iterator i=children.iterator(); i.hasNext();) {
+                    List<MappingNode> children = new ArrayList<MappingNode>(element.getNodeChildren());
+                    for(Iterator<MappingNode> i=children.iterator(); i.hasNext();) {
                         
                         if (shouldAbort()) {
                             break;
                         }
                         
-                        MappingNode node = (MappingNode)i.next();            
+                        MappingNode node = i.next();            
                         node.acceptVisitor(this);
                     }
                 }

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/ValidateMappedCriteriaVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/ValidateMappedCriteriaVisitor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/ValidateMappedCriteriaVisitor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -22,10 +22,6 @@
 
 package org.teiid.query.optimizer.xml;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 
 import org.teiid.api.exception.query.QueryMetadataException;
@@ -40,8 +36,6 @@
 import org.teiid.query.parser.QueryParser;
 import org.teiid.query.resolver.util.ResolverVisitor;
 import org.teiid.query.sql.lang.Criteria;
-import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.visitor.GroupsUsedByElementsVisitor;
 import org.teiid.query.sql.visitor.StaticSymbolMappingVisitor;
 
 
@@ -60,9 +54,7 @@
         Map symbolMap = element.getSourceNode().buildFullSymbolMap();
         Criteria criteria = resolveCriteria(criteriaStr, symbolMap);
         if (criteria != null) {
-            List groupNames = getCriteriaGroups(criteria);
             element.setCriteriaNode(criteria);
-            element.setGroupsInCriteria(groupNames);
         }
     }
 
@@ -71,9 +63,7 @@
         Map symbolMap = element.getSourceNode().buildFullSymbolMap();
         Criteria criteria = resolveCriteria(criteriaStr, symbolMap);
         if (criteria != null) {
-            List groupNames = getCriteriaGroups(criteria);
             element.setCriteriaNode(criteria);
-            element.setGroupsInCriteria(groupNames);
         }
     }
 
@@ -91,17 +81,6 @@
         return null;
     }
     
-    private static List getCriteriaGroups(Criteria criteria) {
-        Collection criteriaGroups = GroupsUsedByElementsVisitor.getGroups(criteria);
-        List names = new ArrayList(criteriaGroups.size());
-        Iterator iter = criteriaGroups.iterator();
-        while(iter.hasNext()) {
-            names.add( ((GroupSymbol)iter.next()).getName().toUpperCase() );
-        }
-        return names;
-    }     
-    
-    
     public static void validateAndCollectCriteriaElements(MappingDocument doc, XMLPlannerEnvironment planEnv) 
         throws QueryPlannerException, QueryMetadataException, TeiidComponentException {
         

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLNodeMappingVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLNodeMappingVisitor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLNodeMappingVisitor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -26,15 +26,18 @@
 
 import org.teiid.api.exception.query.QueryPlannerException;
 import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidException;
 import org.teiid.core.TeiidRuntimeException;
 import org.teiid.query.QueryPlugin;
 import org.teiid.query.mapping.xml.MappingDocument;
 import org.teiid.query.mapping.xml.MappingNode;
+import org.teiid.query.mapping.xml.MappingSourceNode;
 import org.teiid.query.metadata.QueryMetadataInterface;
 import org.teiid.query.sql.LanguageObject;
 import org.teiid.query.sql.lang.Criteria;
-import org.teiid.query.sql.navigator.PreOrderNavigator;
+import org.teiid.query.sql.navigator.PreOrPostOrderNavigator;
 import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.GroupSymbol;
 import org.teiid.query.sql.symbol.Symbol;
 import org.teiid.query.sql.visitor.AbstractSymbolMappingVisitor;
 
@@ -58,33 +61,54 @@
         this.metadata = metadata;
     }
     
+    @Override
+    protected boolean createAliases() {
+    	return false; //xml style selects do not have aliases
+    }
+    
     /**
      * @see AbstractSymbolMappingVisitor#getMappedSymbol(Symbol)
      */
     protected Symbol getMappedSymbol(Symbol symbol) {
-    	if(!(symbol instanceof ElementSymbol)) {
-    		return null;
-    	}
-
-		// Lookup full path to mapping node from symbol
-		ElementSymbol element = (ElementSymbol) symbol;
-        
         try {
-            String path = metadata.getFullName(element.getMetadataID()).toUpperCase();
-		
+        	Object metadataId = null;
+        	Object groupId = null;
+	    	if (symbol instanceof GroupSymbol) {
+	    		GroupSymbol groupSymbol = (GroupSymbol)symbol;
+	    		metadataId = groupSymbol.getMetadataID();
+	    		groupId = metadataId;
+	    	} else {
+				ElementSymbol element = (ElementSymbol) symbol;
+				metadataId = element.getMetadataID();
+				groupId = element.getGroupSymbol().getMetadataID();
+	    	}
+	    	boolean xml = metadata.isXMLGroup(groupId);
+	    	if (!xml) {
+    			return symbol;
+	    	}
+	    	String path = metadata.getFullName(metadataId).toUpperCase();
+	
     		// Find mapping node for specified path
-    		MappingNode elementNode = MappingNode.findNode(rootNode, path); 
-    		if(elementNode == null) { 
+    		MappingNode node = MappingNode.findNode(rootNode, path); 
+    		if(node == null) { 
     			return null;
     		}
-    		
+    		MappingSourceNode msn = node.getSourceNode();
+			if (msn == null) {
+				return null;
+			}
+    		if (symbol instanceof GroupSymbol) {
+    			GroupSymbol gs = msn.getMappedSymbol(new GroupSymbol(msn.getResultName()));
+    			return gs;
+    		} 
     		// Construct a new element node based on mapping node reference
-    		String symbolName = elementNode.getNameInSource();
+    		String symbolName = node.getNameInSource();
     		if (symbolName == null){
     			return null;
     		}
-			return elementNode.getSourceNode().getMappedSymbol(new ElementSymbol(symbolName));
-        } catch (TeiidComponentException err) {
+			ElementSymbol es = msn.getMappedSymbol(new ElementSymbol(symbolName));
+			return es;
+        } catch (TeiidException err) {
             throw new TeiidRuntimeException(err);
         } 
     }
@@ -100,17 +124,15 @@
      */
     public static Criteria convertCriteria(Criteria simpleCrit, MappingDocument rootNode, QueryMetadataInterface metadata)
     throws QueryPlannerException, TeiidComponentException{
-        return (Criteria)convertObject(simpleCrit, rootNode, metadata);
+        return convertObject((Criteria)simpleCrit.clone(), rootNode, metadata, true);
     }
 
-    public static LanguageObject convertObject(LanguageObject object, MappingDocument rootNode, QueryMetadataInterface metadata)
+    public static <T extends LanguageObject> T convertObject(T object, MappingDocument rootNode, QueryMetadataInterface metadata, boolean deep)
     throws QueryPlannerException, TeiidComponentException{
-        LanguageObject copy = (LanguageObject)object.clone();
-
         //Don't want to do deep visiting
         XMLNodeMappingVisitor mappingVisitor = new XMLNodeMappingVisitor(rootNode, metadata);
         try {
-            PreOrderNavigator.doVisit(copy, mappingVisitor);
+            PreOrPostOrderNavigator.doVisit(object, mappingVisitor, PreOrPostOrderNavigator.POST_ORDER, deep);
         } catch (TeiidRuntimeException e) {
             Throwable child = e.getChild();
             
@@ -126,7 +148,7 @@
             throw new QueryPlannerException("ERR.015.004.0046", QueryPlugin.Util.getString("ERR.015.004.0046", new Object[] {unmappedSymbols, object})); //$NON-NLS-1$ //$NON-NLS-2$
         }
 
-        return copy;
+        return object;
     }
         
 }

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanToProcessVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanToProcessVisitor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanToProcessVisitor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -22,7 +22,6 @@
 
 package org.teiid.query.optimizer.xml;
 
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Stack;
@@ -53,7 +52,6 @@
 import org.teiid.query.processor.xml.ExecStagingTableInstruction;
 import org.teiid.query.processor.xml.IfInstruction;
 import org.teiid.query.processor.xml.InitializeDocumentInstruction;
-import org.teiid.query.processor.xml.JoinedWhileInstruction;
 import org.teiid.query.processor.xml.MoveCursorInstruction;
 import org.teiid.query.processor.xml.MoveDocInstruction;
 import org.teiid.query.processor.xml.ProcessorInstruction;
@@ -69,7 +67,7 @@
  */
 public class XMLPlanToProcessVisitor implements MappingInterceptor {
     
-    Stack programStack = new Stack(); 
+    Stack<Program> programStack = new Stack<Program>(); 
     XMLPlannerEnvironment planEnv;
     Program originalProgram ;
     Program cleanupProgram  = new Program();
@@ -85,14 +83,14 @@
     
     public void end(MappingDocument doc, Map context) {
         // remove the current program from the stack; we no longer need this
-        originalProgram=(Program)this.programStack.pop();
+        originalProgram=this.programStack.pop();
         
         // cleanup program will have instructions to unload the staging table.
         originalProgram.addInstructions(cleanupProgram);
     }
         
     public void start(MappingAttribute attribute, Map context){
-        Program currentProgram = (Program)this.programStack.peek();
+        Program currentProgram = this.programStack.peek();
         ProcessorInstruction tagInst = TagBuilderVisitor.buildTag(attribute);
         if (tagInst != null) {
             currentProgram.addInstruction(tagInst);
@@ -103,7 +101,7 @@
     }
     
     public void start(MappingCommentNode comment, Map context){
-        Program currentProgram = (Program)this.programStack.peek();
+        Program currentProgram = this.programStack.peek();
         ProcessorInstruction tagInst = TagBuilderVisitor.buildTag(comment);
         if (tagInst != null) {
             currentProgram.addInstruction(tagInst);
@@ -138,7 +136,7 @@
         // process the node as others (if see we have not done anything for this node yet..)
         commonStart(choice, context);
 
-        Program currentProgram = (Program)this.programStack.peek();        
+        Program currentProgram = this.programStack.peek();        
         currentProgram.addInstruction(ifInst);        
     }
     
@@ -197,10 +195,10 @@
 
     private void endRootRecursive(MappingBaseNode node, Map context) {
         // add the recursive program to the main program.
-        Program recursiveProgram = (Program)programStack.pop();
+        Program recursiveProgram = programStack.pop();
         
         // this is the main program
-        Program currentProgram = (Program)this.programStack.peek();
+        Program currentProgram = this.programStack.peek();
         currentProgram.addInstructions(recursiveProgram);
         context.remove(node.getRecursionId());
         
@@ -215,7 +213,7 @@
     
     public void start(MappingElement element, Map context){
         //commonStart(element, context);
-        Program currentProgram = (Program)programStack.peek();
+        Program currentProgram = programStack.peek();
         
         // if we are dealing with multiple documents
         startFragment(currentProgram, element);
@@ -228,13 +226,13 @@
         // If there are more children under this node move the cursor down
         if (!element.getChildren().isEmpty()) {
             // update the program pointer 
-            currentProgram = (Program)programStack.peek();
+            currentProgram = programStack.peek();
             currentProgram.addInstruction(new MoveDocInstruction(MoveDocInstruction.DOWN));
         }
     }
 
     public void end(MappingElement element, Map context){
-        Program currentProgram = (Program)this.programStack.peek();
+        Program currentProgram = this.programStack.peek();
         
         // If there were more children under this node move the cursor up        
         if (!element.getChildren().isEmpty()) {
@@ -244,33 +242,20 @@
         commonEnd(element, context);
         
         // update the program pointer
-        currentProgram = (Program)programStack.peek();            
+        currentProgram = programStack.peek();            
         
         // if we are dealing with multiple documents                        
         endFragment(currentProgram, element);        
     }
    
     public void start(MappingSourceNode node, Map context) {
-        Program currentProgram = (Program)programStack.peek();
+        Program currentProgram = programStack.peek();
         
         commonStart(node, context);
         
         String source = node.getActualResultSetName();
         ResultSetInfo info= node.getResultSetInfo();
         
-        if (info.isJoinedWithParent()) {
-            //create a dependent while loop
-            JoinedWhileInstruction whileInst = new JoinedWhileInstruction(source, new Integer(info.getMappingClassNumber()),
-                                                                          info.getMappingClassSymbol(), node.getResultName());
-            currentProgram.addInstruction(whileInst);
-            
-            Program childProgram = new Program();
-            whileInst.setBlockProgram(childProgram);
-            
-            programStack.push(childProgram);
-            return;
-        }
-        
         // Add instruction to execute relational query
         ExecSqlInstruction sqlInst = new ExecSqlInstruction(source, info);
         currentProgram.addInstruction(sqlInst);
@@ -301,15 +286,13 @@
     }
     
     public void end(MappingSourceNode node, Map context) {
-        Program currentProgram = (Program)programStack.peek();        
+        Program currentProgram = programStack.peek();        
         
         String source = node.getActualResultSetName();  
         ResultSetInfo info= node.getResultSetInfo();
         
-        if (!info.isJoinRoot()) {
-            // move to next row.
-            currentProgram.addInstruction(new MoveCursorInstruction(source));
-        }
+        // move to next row.
+        currentProgram.addInstruction(new MoveCursorInstruction(source));
 
         // Since each element with a source started a new program; 
         // since now we are done with children, we need to pop to current program                                    
@@ -343,15 +326,14 @@
             startRootRecursive(node, context);
         }
         
-        List stagingTables = node.getStagingTables();
-        for (final Iterator i = stagingTables.iterator(); i.hasNext();) {
-            final String table = (String)i.next();
-            Program currentProgram = (Program)programStack.peek();
+        List<String> stagingTables = node.getStagingTables();
+        for (String table : stagingTables) {
+            Program currentProgram = programStack.peek();
 
             // load staging
             currentProgram.addInstruction(new ExecStagingTableInstruction(table, planEnv.getStagingTableResultsInfo(table)));
             
-            // unload sttaging
+            // unload staging
             String unloadName = planEnv.unLoadResultName(table);
             cleanupProgram.addInstruction(new ExecStagingTableInstruction(unloadName, planEnv.getStagingTableResultsInfo(unloadName)));
         } // for
@@ -365,7 +347,7 @@
     }
     
     public void start(final MappingRecursiveElement element, Map context){
-        Program currentProgram = (Program)programStack.peek();
+        Program currentProgram = programStack.peek();
         
         // if we are dealing with multiple documents
         startFragment(currentProgram, element);
@@ -385,7 +367,7 @@
     }   
     
     public void end(final MappingRecursiveElement element, Map context){
-        Program currentProgram = (Program)programStack.peek();        
+        Program currentProgram = programStack.peek();        
 
         // if we are dealing with multiple documents                        
         endFragment(currentProgram, element);                

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanner.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanner.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanner.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -57,6 +57,7 @@
 import org.teiid.query.sql.symbol.ElementSymbol;
 import org.teiid.query.sql.symbol.GroupSymbol;
 import org.teiid.query.sql.symbol.SelectSymbol;
+import org.teiid.query.sql.symbol.SingleElementSymbol;
 import org.teiid.query.sql.visitor.ElementCollectorVisitor;
 import org.teiid.query.util.CommandContext;
 
@@ -110,7 +111,7 @@
         GroupSymbol group = xmlQuery.getFrom().getGroups().iterator().next();
 
         MappingDocument doc = (MappingDocument)metadata.getMappingNode(group.getMetadataID());
-        doc = (MappingDocument)doc.clone();
+        doc = doc.clone();
         
         // make a copy of the document
         planEnv.mappingDoc = doc;
@@ -200,24 +201,28 @@
         if (debug) {
             debugDocumentInfo("After Exclude", planEnv); //$NON-NLS-1$
         }
+
+        //Resolve all the "elements" against the result sets
+        NameInSourceResolverVisitor.resolveElements(planEnv.mappingDoc, planEnv);
         
+        //Validate and resolve the criteria specified on the mapping nodes.
+        ValidateMappedCriteriaVisitor.validateAndCollectCriteriaElements(planEnv.mappingDoc, planEnv);
+
+        XMLProjectionMinimizer.minimizeProjection(planEnv);
+        
+        if (debug) {
+            debugDocumentInfo("After Projection Minimization", planEnv); //$NON-NLS-1$
+        }
+        
         // Autostage queries. try to auto-stage the planned queries
         // removal of this step should not affect overall processing
         XMLStagaingQueryPlanner.stageQueries(planEnv.mappingDoc, planEnv);
         
-        //JoinSourceNodes.joinSourceNodes(planEnv.mappingDoc, planEnv);
-        
         //Plan the various relational result sets
         XMLQueryPlanner.optimizeQueries(planEnv.mappingDoc, planEnv);
         
 		//Handle nillable nodes
         planEnv.mappingDoc = HandleNillableVisitor.execute(planEnv.mappingDoc);
-        
-        //Resolve all the "elements" aginst the result sets
-        NameInSourceResolverVisitor.resolveElements(planEnv.mappingDoc, planEnv);
-        
-        //Validate and resolve the criteria specified on the mapping nodes.
-        ValidateMappedCriteriaVisitor.validateAndCollectCriteriaElements(planEnv.mappingDoc, planEnv);
 	}
     
     static void removeExcluded(MappingNode node) {
@@ -247,10 +252,9 @@
         }
         
         // Get all the valid nodes to be marked as included.
-        Collection validElements = ElementCollectorVisitor.getElements(select, true);
-        HashSet elements = new HashSet(validElements.size());
-        for (final Iterator i = validElements.iterator(); i.hasNext();) {
-            final ElementSymbol element = (ElementSymbol)i.next();
+        Collection<ElementSymbol> validElements = ElementCollectorVisitor.getElements(select, true);
+        HashSet<String> elements = new HashSet<String>(validElements.size());
+        for (ElementSymbol element : validElements) {
             elements.add(element.getCanonicalName());
         }
         
@@ -277,8 +281,8 @@
             return;
         }
         
-        List elements = orderBy.getSortKeys();
-		List types = orderBy.getTypes();
+        List<SingleElementSymbol> elements = orderBy.getSortKeys();
+		List<Boolean> types = orderBy.getTypes();
 
 		for (int i = 0; i< elements.size(); i++) {
 			ElementSymbol elemSymbol = (ElementSymbol) elements.get(i);
@@ -301,7 +305,7 @@
                 by = new OrderBy();
             }
             ElementSymbol mappedSymbol = (ElementSymbol)sourceNode.getSymbolMap().get(new ElementSymbol(elementNode.getNameInSource()));
-            by.addVariable((ElementSymbol)mappedSymbol.clone(), ((Boolean)types.get(i)).booleanValue());
+            by.addVariable(mappedSymbol.clone(), ((Boolean)types.get(i)).booleanValue());
             rs.setOrderBy(by);
 		}
 	}

Copied: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLProjectionMinimizer.java (from rev 3217, branches/7.4.x/engine/src/main/java/org/teiid/query/optimizer/xml/XMLProjectionMinimizer.java)
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLProjectionMinimizer.java	                        (rev 0)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLProjectionMinimizer.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -0,0 +1,201 @@
+/*
+ * 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.optimizer.xml;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+
+import org.teiid.core.TeiidException;
+import org.teiid.core.TeiidRuntimeException;
+import org.teiid.query.mapping.relational.QueryNode;
+import org.teiid.query.mapping.xml.MappingAttribute;
+import org.teiid.query.mapping.xml.MappingCriteriaNode;
+import org.teiid.query.mapping.xml.MappingElement;
+import org.teiid.query.mapping.xml.MappingNode;
+import org.teiid.query.mapping.xml.MappingRecursiveElement;
+import org.teiid.query.mapping.xml.MappingSourceNode;
+import org.teiid.query.mapping.xml.MappingVisitor;
+import org.teiid.query.mapping.xml.Navigator;
+import org.teiid.query.mapping.xml.ResultSetInfo;
+import org.teiid.query.resolver.util.ResolverUtil;
+import org.teiid.query.sql.LanguageObject;
+import org.teiid.query.sql.lang.Criteria;
+import org.teiid.query.sql.lang.Query;
+import org.teiid.query.sql.lang.Select;
+import org.teiid.query.sql.symbol.Constant;
+import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.ExpressionSymbol;
+import org.teiid.query.sql.symbol.GroupSymbol;
+import org.teiid.query.sql.symbol.SelectSymbol;
+import org.teiid.query.sql.visitor.ElementCollectorVisitor;
+import org.teiid.query.sql.visitor.ExpressionMappingVisitor;
+
+public class XMLProjectionMinimizer {
+
+	/**
+	 * Implements projection minimization through two passes over the document
+	 */
+	static void minimizeProjection(final XMLPlannerEnvironment planEnv) {
+	    final HashMap<MappingSourceNode, LinkedHashSet<ElementSymbol>> neededElements = new HashMap<MappingSourceNode, LinkedHashSet<ElementSymbol>>();
+	    
+	    //collect included elements
+	    MappingVisitor visitor = new Navigator(true, new MappingVisitor() {
+	    	@Override
+	    	public void visit(MappingAttribute attribute) {
+	    		collectElementSymbol(attribute);
+	    	}
+	
+			private void collectElementSymbol(MappingNode node) {
+				if (node.isExcluded() || node.getElementSymbol() == null) {
+	    			return;
+	    		}
+	    		MappingSourceNode msn = node.getSourceNode();
+	    		ElementSymbol es = node.getElementSymbol();
+	    		collectElementSymbol(msn, es);
+			}
+	
+			private void collectElementSymbol(
+					MappingSourceNode msn, ElementSymbol es) {
+				msn = getActualSourceNode(msn);
+				LinkedHashSet<ElementSymbol> elems = neededElements.get(msn);
+	    		if (elems == null) {
+	    			elems = new LinkedHashSet<ElementSymbol>();
+	    			neededElements.put(msn, elems);
+	    		}
+	    		elems.add(es);
+			}
+	    	
+	    	@Override
+	    	public void visit(MappingElement element) {
+	    		collectElementSymbol(element);
+	    	}
+	    	
+	    	@Override
+	    	public void visit(MappingSourceNode element) {
+	    		try {
+	        		QueryNode node = QueryUtil.getQueryNode(element.getResultName(), planEnv.getGlobalMetadata());
+	                            
+	                Collection<ElementSymbol> bindings = QueryUtil.getBindingElements(node);
+	                MappingSourceNode parent = element.getParentSourceNode();
+	                collectElementSymbols(element, bindings, parent);
+	    		} catch (TeiidException e) {
+	    			throw new TeiidRuntimeException(e);
+	    		}
+	    	}
+	
+			private void collectElementSymbols(
+					MappingSourceNode element,
+					Collection<ElementSymbol> bindings, MappingSourceNode parent) {
+				for (ElementSymbol elementSymbol : bindings) {
+					if (element != null) {
+						elementSymbol = element.getMappedSymbol(elementSymbol);
+					}
+					while (parent != null) {
+						if (parent.getActualResultSetName().equalsIgnoreCase(elementSymbol.getGroupSymbol().getNonCorrelationName())) {
+							collectElementSymbol(parent, elementSymbol);
+							break;
+						}
+						parent = parent.getParentSourceNode();
+					}
+				}
+			}
+	    	
+	    	@Override
+	    	public void visit(MappingCriteriaNode element) {
+	    		Criteria crit = element.getCriteriaNode();
+	    		if (crit == null) {
+	    			return;
+	    		}
+	    		collectElementSymbols(null, ElementCollectorVisitor.getElements(crit, true), element.getSourceNode());
+	    	}
+	    	
+	    	@Override
+	    	public void visit(MappingRecursiveElement element) {
+	    		Criteria crit = element.getCriteriaNode();
+	    		if (crit == null) {
+	    			return;
+	    		}
+	    		collectElementSymbols(null, ElementCollectorVisitor.getElements(crit, true), element.getSourceNode());
+	    	}
+	
+	    });
+	    planEnv.mappingDoc.acceptVisitor(visitor);
+	    
+	    visitor = new Navigator(true, new MappingVisitor() {
+	    	@Override
+	    	public void visit(MappingSourceNode element) {
+	    		try {
+	        		ResultSetInfo rsInfo = element.getResultSetInfo();
+	        		Query rsQuery = (Query)rsInfo.getCommand();
+	        		if (rsQuery.getSelect().isDistinct()) {
+	        			return;
+	        		}
+	        		LinkedHashSet<ElementSymbol> elements = neededElements.get(element);
+	        		if (elements != null) {
+	            		rsQuery.setSelect(new Select(LanguageObject.Util.deepClone(elements, ElementSymbol.class)));
+	        		} else {
+	        			String alias = element.getAliasResultName();
+	        			if (alias == null) {
+	        				rsQuery.setSelect(new Select(Arrays.asList(new ExpressionSymbol("foo", new Constant(1))))); //$NON-NLS-1$
+	        			} else {
+	        				MappingSourceNode actual = getActualSourceNode(element);
+	        				elements = neededElements.get(actual);
+	        				if (elements != null) {
+								Map reverseMap = QueryUtil.createSymbolMap(new GroupSymbol(element.getAliasResultName()), 
+										rsInfo.getResultSetName(),
+										ResolverUtil.resolveElementsInGroup(QueryUtil.createResolvedGroup(element.getAliasResultName(), planEnv.getGlobalMetadata()), planEnv.getGlobalMetadata()));
+								Select select = new Select(new ArrayList<SelectSymbol>(elements));
+								ExpressionMappingVisitor.mapExpressions(select, reverseMap);
+								rsQuery.setSelect(select);
+							}
+	        			}
+	        		}
+	    		} catch (TeiidException e) {
+	    			throw new TeiidRuntimeException(e);
+	    		}
+	    	}
+
+	    });
+	    planEnv.mappingDoc.acceptVisitor(visitor);
+	}
+	
+	private static MappingSourceNode getActualSourceNode(MappingSourceNode element) {
+		if (element.getAliasResultName() == null) {
+			return element;
+		}
+		String actual = element.getActualResultSetName();
+		MappingSourceNode parent = element.getParentSourceNode();
+		while (parent != null) {
+			if (parent.getActualResultSetName().equalsIgnoreCase(actual) ) {
+				return parent;
+			}
+			parent = parent.getParentSourceNode();
+		}
+		return null;
+	}
+
+}

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLQueryPlanner.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLQueryPlanner.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLQueryPlanner.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -68,17 +68,39 @@
 import org.teiid.query.sql.lang.Limit;
 import org.teiid.query.sql.lang.Query;
 import org.teiid.query.sql.lang.QueryCommand;
+import org.teiid.query.sql.lang.SubqueryContainer;
 import org.teiid.query.sql.lang.SubqueryFromClause;
 import org.teiid.query.sql.lang.UnaryFromClause;
 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.sql.symbol.Reference;
+import org.teiid.query.sql.visitor.ElementCollectorVisitor;
+import org.teiid.query.sql.visitor.GroupsUsedByElementsVisitor;
+import org.teiid.query.sql.visitor.PredicateCollectorVisitor;
 import org.teiid.query.sql.visitor.StaticSymbolMappingVisitor;
 
 
 public class XMLQueryPlanner {
 
-    static void prePlanQueries(MappingDocument doc, final XMLPlannerEnvironment planEnv) 
+    private static final class MappingSourceNodeFinder extends MappingVisitor {
+		private final GroupSymbol gs;
+		MappingSourceNode msn;
+
+		private MappingSourceNodeFinder(GroupSymbol gs) {
+			this.gs = gs;
+		}
+
+		@Override
+		public void visit(MappingSourceNode element) {
+			if (element.getAliasResultName() == null && element.getResultSetInfo().getResultSetName().equalsIgnoreCase(gs.getNonCorrelationName())) {
+				msn = element;
+				setAbort(true);
+			}
+		}
+	}
+
+	static void prePlanQueries(MappingDocument doc, final XMLPlannerEnvironment planEnv) 
         throws QueryPlannerException, QueryMetadataException, TeiidComponentException {
         
         MappingVisitor queryPlanVisitor = new MappingVisitor() {
@@ -86,10 +108,8 @@
             public void visit(MappingBaseNode baseNode) {
                 try {
                     // first if there are any explicit staging tables plan them first 
-                    List stagingTables = baseNode.getStagingTables();
-                    for (final Iterator i = stagingTables.iterator(); i.hasNext();) {
-                        
-                        final String tableName = (String)i.next();
+                    List<String> stagingTables = baseNode.getStagingTables();
+                    for (String tableName : stagingTables) {
                         planStagingTable(tableName, planEnv);    
                     }
                     
@@ -116,10 +136,6 @@
                 try {
                     ResultSetInfo rsInfo = sourceNode.getResultSetInfo();
                 
-                    if (rsInfo.isJoinedWithParent()) {
-                        return;
-                    }
-                    
                     Query command = (Query)rsInfo.getCommand();
                     
                     prepareQuery(sourceNode, planEnv, command);
@@ -159,7 +175,7 @@
         }
     }
     
-    static void planQueries(MappingSourceNode sourceNode, XMLPlannerEnvironment planEnv) 
+    static void planQueries(final MappingSourceNode sourceNode, XMLPlannerEnvironment planEnv) 
         throws QueryPlannerException, QueryMetadataException, TeiidComponentException {
 
         ResultSetInfo rsInfo = sourceNode.getResultSetInfo();
@@ -188,8 +204,6 @@
             rsQuery.setLimit(new Limit(null, new Constant(new Integer(limit))));
         }
         
-        //prepareQuery(sourceNode, planEnv, rsQuery);
-        
         // this query is not eligible for staging; proceed normally.
         rsInfo.setCommand(rsQuery);            
     }
@@ -206,15 +220,15 @@
     static void prepareQuery(MappingSourceNode sourceNode, XMLPlannerEnvironment planEnv, QueryCommand rsQuery) 
         throws TeiidComponentException, QueryResolverException {
         
-        Collection externalGroups = getExternalGroups(sourceNode);
+        Collection<GroupSymbol> externalGroups = getExternalGroups(sourceNode);
         
         rsQuery.setExternalGroupContexts(new GroupContext(null, externalGroups));
         
 		QueryResolver.resolveCommand(rsQuery, planEnv.getGlobalMetadata());
     }
     
-    private static Collection getExternalGroups(MappingSourceNode sourceNode) {
-        Collection externalGroups = new HashSet();
+    private static Collection<GroupSymbol> getExternalGroups(MappingSourceNode sourceNode) {
+        Collection<GroupSymbol> externalGroups = new HashSet<GroupSymbol>();
 
         MappingSourceNode parentSource = sourceNode.getParentSourceNode();
         while (parentSource != null) {
@@ -228,14 +242,14 @@
     /**
      * The Criteria Source nodes are source nodes underneath the context Node.  
      */
-    private static boolean getResultSets(MappingSourceNode contextNode, Set criteriaSourceNodes, LinkedHashSet allResultSets)  {
+    private static boolean getResultSets(MappingSourceNode contextNode, Set<MappingSourceNode> criteriaSourceNodes, LinkedHashSet<MappingSourceNode> allResultSets)  {
         
         boolean singleParentage = true;
 
-        for (Iterator i = criteriaSourceNodes.iterator(); i.hasNext();) {
-            MappingSourceNode node = (MappingSourceNode)i.next();
+        for (Iterator<MappingSourceNode> i = criteriaSourceNodes.iterator(); i.hasNext();) {
+            MappingSourceNode node = i.next();
 
-            List rsStack = getResultSetStack(contextNode, node);
+            List<MappingSourceNode> rsStack = getResultSetStack(contextNode, node);
             
             if (allResultSets.containsAll(rsStack)) {
                 continue;
@@ -249,12 +263,12 @@
         return singleParentage;
     }
     
-    private static LinkedList getResultSetStack(MappingSourceNode contextNode, MappingBaseNode node) {
-        LinkedList rsStack = new LinkedList();
+    private static LinkedList<MappingSourceNode> getResultSetStack(MappingSourceNode contextNode, MappingBaseNode node) {
+        LinkedList<MappingSourceNode> rsStack = new LinkedList<MappingSourceNode>();
         
         while (node != null && node != contextNode) {
             if (node instanceof MappingSourceNode) {
-                rsStack.add(0, node);
+                rsStack.add(0, (MappingSourceNode)node);
             }
             node = node.getParentNode();
         }
@@ -270,7 +284,7 @@
         
         // this list of all the source nodes below the context, which are directly ro indirectly 
         // involved in the criteria
-        LinkedHashSet resultSets = new LinkedHashSet();
+        LinkedHashSet<MappingSourceNode> resultSets = new LinkedHashSet<MappingSourceNode>();
         
         boolean singleParentage = getResultSets(contextNode, rsInfo.getCriteriaResultSets(), resultSets);
         
@@ -312,7 +326,7 @@
                 joinCriteria = (Criteria)joinCriteria.clone();
                 
                 //update the from clause
-                FromClause clause = (FromClause)currentQuery.getFrom().getClauses().remove(0);
+                FromClause clause = currentQuery.getFrom().getClauses().remove(0);
                 
                 JoinPredicate join = null;
                 
@@ -371,15 +385,87 @@
             GroupSymbol groupSymbol = QueryUtil.createResolvedGroup(rsInfo.getResultSetName(), planEnv.getGlobalMetadata());
             planEnv.addQueryNodeToMetadata(groupSymbol.getMetadataID(), modifiedNode);
         } 
+        
+        for (Criteria crit : PredicateCollectorVisitor.getPredicates(userCrit)) {
+        	handleXmlSubqueries(planEnv, crit);
+        }
     }
 
+	private static void handleXmlSubqueries(XMLPlannerEnvironment planEnv,
+			Criteria userCrit) throws QueryPlannerException {
+		if (!(userCrit instanceof SubqueryContainer<?>)) {
+			return;
+		}
+    	SubqueryContainer<?> subquery = (SubqueryContainer<?>)userCrit;
+    	if (!(subquery.getCommand() instanceof Query)) {
+    		return;
+    	}
+		Query q = (Query)subquery.getCommand();
+		if (q.getFrom() == null || q.getCriteria() == null) {
+			return;
+		}
+		List<GroupSymbol> groups = q.getFrom().getGroups();
+		if (groups.size() != 1) {
+			return;
+		}
+		final GroupSymbol gs = groups.get(0);
+		LinkedHashSet<GroupSymbol> allGroups = new LinkedHashSet<GroupSymbol>();
+		allGroups.add(gs);
+		//TODO: this group should have been marked as xml, or could attempt this step prior to place user criteria
+		if (planEnv.getGlobalMetadata().getMetadataStore().getTempGroupID(gs.getNonCorrelationName().toUpperCase()) == null) {
+			return;
+		}
+		MappingSourceNode parentMsn = findMappingSourceNode(planEnv, gs);
+		for (Criteria crit : PredicateCollectorVisitor.getPredicates(q.getCriteria())) {
+			Collection<ElementSymbol> elems = ElementCollectorVisitor.getElements(crit, false);
+			Collection<GroupSymbol> critGroups = new LinkedList<GroupSymbol>();
+			for (ElementSymbol elementSymbol : elems) {
+				if (!elementSymbol.isExternalReference()) {
+					critGroups.add(elementSymbol.getGroupSymbol());
+				}
+			}
+			for (GroupSymbol groupSymbol : critGroups) {
+				if (allGroups.contains(groupSymbol)) {
+					continue;
+				}
+				MappingSourceNode childMsn = findMappingSourceNode(planEnv, groupSymbol);
+				while (childMsn != parentMsn) {
+					if (childMsn == null) {
+						throw new QueryPlannerException(QueryPlugin.Util.getString("XMLQueryPlanner.invalid_relationship", crit, parentMsn)); //$NON-NLS-1$
+					}
+					if (!childMsn.getResultSetInfo().isCriteriaRaised()) {
+						throw new QueryPlannerException(QueryPlugin.Util.getString("XMLQueryPlanner.non_simple_relationship", crit, childMsn)); //$NON-NLS-1$
+					}
+					Query parentQuery = (Query)childMsn.getResultSetInfo().getCommand();
+					if (parentQuery.getCriteria() != null 
+							&& allGroups.addAll(GroupsUsedByElementsVisitor.getGroups(parentQuery.getCriteria()))) {
+						q.setCriteria(Criteria.combineCriteria(q.getCriteria(), (Criteria) parentQuery.getCriteria().clone()));
+					}
+					childMsn = childMsn.getParentSourceNode();
+				}
+			}
+			q.getFrom().getClauses().clear();
+			for (GroupSymbol groupSymbol : allGroups) {
+				q.getFrom().addClause(new UnaryFromClause(groupSymbol));
+			}
+			handleXmlSubqueries(planEnv, crit);
+		}
+	}
+
+	private static MappingSourceNode findMappingSourceNode(
+			XMLPlannerEnvironment planEnv, final GroupSymbol gs) {
+		MappingSourceNodeFinder finder = new MappingSourceNodeFinder(gs);
+		planEnv.mappingDoc.acceptVisitor(new Navigator(true, finder));
+		return finder.msn;
+	}
+
     private static void updateSymbolMap(Map symbolMap, String oldGroup, final String newGroup, QueryMetadataInterface metadata) 
         throws QueryResolverException,QueryMetadataException,TeiidComponentException {
         
         GroupSymbol oldGroupSymbol = new GroupSymbol(oldGroup);
         ResolverUtil.resolveGroup(oldGroupSymbol, metadata);
         
-        HashSet projectedElements = new HashSet(ResolverUtil.resolveElementsInGroup(oldGroupSymbol, metadata));
+        HashSet<ElementSymbol> projectedElements = new HashSet<ElementSymbol>(ResolverUtil.resolveElementsInGroup(oldGroupSymbol, metadata));
         
         symbolMap.putAll(QueryUtil.createSymbolMap(oldGroupSymbol, newGroup, projectedElements));
     }
@@ -482,11 +568,11 @@
         rsInfo.setCommand(cmd);
         rsInfo.setPlan(plan);
         
-        //set the carinality on the temp group.
+        //set the cardinality on the temp group.
         TempMetadataID intoGroupID = (TempMetadataID)intoGroupSymbol.getMetadataID();
         intoGroupID.setCardinality(cardinality);
         
-        // add the meterialization hook for the staged table to original one.
+        // add the materialization hook for the staged table to original one.
         //GroupSymbol groupSymbol = (GroupSymbol)query.getFrom().getGroups().get(0);
         planEnv.addStagingTable(srcGroup.getMetadataID(), intoGroupID);
         

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLStagaingQueryPlanner.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLStagaingQueryPlanner.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/xml/XMLStagaingQueryPlanner.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -134,7 +134,7 @@
         //check for already staged queries
         if (groups.size() == 1) {
             GroupSymbol group = groups.iterator().next();
-            group = QueryUtil.createResolvedGroup((GroupSymbol)group.clone(), planEnv.getGlobalMetadata());
+            group = QueryUtil.createResolvedGroup(group.clone(), planEnv.getGlobalMetadata());
             if (planEnv.isStagingTable(group.getMetadataID()) && stagableQuery.getCriteria() == null) {
                 return false;
             }

Modified: trunk/engine/src/main/java/org/teiid/query/parser/SQLParserUtil.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/parser/SQLParserUtil.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/parser/SQLParserUtil.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -172,7 +172,13 @@
         for (int i = 0; i < parts.length; i++) {
             if (parts[i].equalsIgnoreCase(Option.OPTIONAL)) {
                 fromClause.setOptional(true);
-            }        
+            } else if (parts[i].equalsIgnoreCase(Option.MAKEDEP)) {
+                fromClause.setMakeDep(true);
+            } else if (parts[i].equalsIgnoreCase(Option.MAKENOTDEP)) {
+                fromClause.setMakeNotDep(true);
+            } else if (parts[i].equalsIgnoreCase(FromClause.MAKEIND)) {
+                fromClause.setMakeInd(true);
+            }       
         }
     }
     
@@ -184,6 +190,8 @@
                 hint.setMergeJoin(true);
             } else if (parts[i].equalsIgnoreCase(SubqueryHint.NOUNNEST)) {
             	hint.setNoUnnest(true);
+            } else if (parts[i].equalsIgnoreCase(SubqueryHint.DJ)) {
+                hint.setDepJoin(true);
             }
         }
     	return hint;

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/AccessNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/AccessNode.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/AccessNode.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -26,6 +26,8 @@
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.List;
 
 import org.teiid.api.exception.query.QueryValidatorException;
@@ -43,6 +45,13 @@
 import org.teiid.query.processor.ProcessorDataManager;
 import org.teiid.query.rewriter.QueryRewriter;
 import org.teiid.query.sql.lang.Command;
+import org.teiid.query.sql.lang.Query;
+import org.teiid.query.sql.lang.Select;
+import org.teiid.query.sql.symbol.Constant;
+import org.teiid.query.sql.symbol.Expression;
+import org.teiid.query.sql.symbol.SelectSymbol;
+import org.teiid.query.sql.symbol.SingleElementSymbol;
+import org.teiid.query.sql.util.SymbolMap;
 import org.teiid.query.util.CommandContext;
 
 
@@ -63,6 +72,10 @@
     private int reserved;
     private int schemaSize;
     
+    private Object[] projection;
+    private List<SelectSymbol> originalSelect;
+	private Object modelId;
+    
     protected AccessNode() {
 		super();
 	}
@@ -93,6 +106,14 @@
     public Command getCommand() {
         return this.command;
     }
+    
+    public void setModelId(Object id) {
+    	this.modelId = id;
+    }
+    
+    public Object getModelId() {
+    	return this.modelId;
+    }
 
 	public void setModelName(String name) {
 		this.modelName = name;
@@ -136,7 +157,64 @@
 			//We hardcode an upper limit on currency because these commands have potentially large in-memory value sets
         } while (!processCommandsIndividually() && hasNextCommand() && this.tupleSources.size() < Math.min(MAX_CONCURRENT, this.getContext().getUserRequestSourceConcurrency()));
 	}
+	
+	public boolean isShouldEvaluate() {
+		return shouldEvaluate;
+	}
 
+	public void minimizeProject(Command atomicCommand) {
+		if (!(atomicCommand instanceof Query)) {
+			return;
+		}
+		Query query = (Query)atomicCommand;
+		Select select = query.getSelect();
+		List<SelectSymbol> symbols = select.getSymbols();
+		if (symbols.size() == 1) {
+			return;
+		}
+		boolean shouldProject = false;
+		LinkedHashMap<Expression, Integer> uniqueSymbols = new LinkedHashMap<Expression, Integer>();
+		projection = new Object[symbols.size()];
+		this.originalSelect = new ArrayList<SelectSymbol>(query.getSelect().getSymbols());
+		int i = 0;
+		int j = 0;
+		for (Iterator<SelectSymbol> iter = symbols.iterator(); iter.hasNext(); ) {
+			SingleElementSymbol ss = (SingleElementSymbol) iter.next();
+			Expression ex = SymbolMap.getExpression(ss);
+			if (ex instanceof Constant) {
+				projection[i] = ex;
+				if (iter.hasNext() || j!=0) {
+					iter.remove();
+					shouldProject = true;
+				} else {
+					projection[i] = j++;
+				}
+			} else {
+				Integer index = uniqueSymbols.get(ex);
+				if (index == null) {
+					uniqueSymbols.put(ex, j);
+					index = j++;
+				} else {
+					iter.remove();
+					shouldProject = true;
+				}
+				projection[i] = index;
+			}
+			i++;
+		}
+		if (!shouldProject) {
+			this.projection = new Object[0];
+		}
+	}
+	
+	public List<SelectSymbol> getOriginalSelect() {
+		return originalSelect;
+	}
+	
+	public Object[] getProjection() {
+		return projection;
+	}
+
 	static void rewriteAndEvaluate(Command atomicCommand, Evaluator eval, CommandContext context, QueryMetadataInterface metadata)
 			throws TeiidProcessingException, TeiidComponentException {
 		try {
@@ -183,6 +261,17 @@
 	        		
 	        		while ((tuple = tupleSource.nextTuple()) != null) {
 	                    returnedRows = true;
+	                    if (this.projection != null && this.projection.length > 0) {
+	                    	List<Object> newTuple = new ArrayList<Object>(this.projection.length);
+	                    	for (Object object : this.projection) {
+								if (object instanceof Integer) {
+									newTuple.add(tuple.get((Integer)object));
+								} else {
+									newTuple.add(((Constant)object).getValue());
+								}
+							}
+	                    	tuple = newTuple;
+	                    }
 	                    addBatchRow(tuple);
 	                    
 	                    if (isBatchFull()) {
@@ -217,7 +306,7 @@
         	}
         	
         	if (!this.tupleSources.isEmpty()) {
-        		throw BlockedException.INSTANCE;
+        		throw BlockedException.block(getContext().getRequestId(), "Blocking on source request(s)."); //$NON-NLS-1$
         	}
         }
         
@@ -246,6 +335,10 @@
 
 	private void registerRequest(Command atomicCommand)
 			throws TeiidComponentException, TeiidProcessingException {
+		if (shouldEvaluate) {
+			projection = null;
+			minimizeProject(atomicCommand);
+		}
 		int limit = -1;
 		if (getParent() instanceof LimitNode) {
 			LimitNode parent = (LimitNode)getParent();
@@ -295,8 +388,13 @@
 	protected void copy(AccessNode source, AccessNode target){
 		super.copy(source, target);
 		target.modelName = source.modelName;
+		target.modelId = source.modelId;
 		target.connectorBindingId = source.connectorBindingId;
 		target.shouldEvaluate = source.shouldEvaluate;
+		if (!source.shouldEvaluate) {
+			target.projection = source.projection;
+			target.originalSelect = source.originalSelect;
+		}
 		target.command = source.command;
 	}
 

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -87,18 +87,21 @@
         public void sort() throws BlockedException,
                    TeiidComponentException, TeiidProcessingException {
             if (dvs == null) {
-            	//TODO: detect if we're already distinct
-            	if (sortUtility == null) {
-            		List<Expression> sortSymbols = new ArrayList<Expression>(dependentSetStates.size());
-	                List<Boolean> sortDirection = new ArrayList<Boolean>(sortSymbols.size());
-	                for (int i = 0; i < dependentSetStates.size(); i++) {
-	                    sortDirection.add(Boolean.valueOf(OrderBy.ASC));
-	                    sortSymbols.add(dependentSetStates.get(i).valueExpression);
-	                }
-	                DependentValueSource originalVs = (DependentValueSource)dependentNode.getContext().getVariableContext().getGlobalValue(valueSource);
-	                this.sortUtility = new SortUtility(originalVs.getTupleBuffer().createIndexedTupleSource(), sortSymbols, sortDirection, Mode.DUP_REMOVE, dependentNode.getBufferManager(), dependentNode.getConnectionID(), originalVs.getTupleBuffer().getSchema());
-            	}
-            	dvs = new DependentValueSource(sortUtility.sort());
+                DependentValueSource originalVs = (DependentValueSource)dependentNode.getContext().getVariableContext().getGlobalValue(valueSource);
+                if (!originalVs.isDistinct()) {
+	            	if (sortUtility == null) {
+	            		List<Expression> sortSymbols = new ArrayList<Expression>(dependentSetStates.size());
+		                List<Boolean> sortDirection = new ArrayList<Boolean>(sortSymbols.size());
+		                for (int i = 0; i < dependentSetStates.size(); i++) {
+		                    sortDirection.add(Boolean.valueOf(OrderBy.ASC));
+		                    sortSymbols.add(dependentSetStates.get(i).valueExpression);
+		                }
+		                this.sortUtility = new SortUtility(originalVs.getTupleBuffer().createIndexedTupleSource(), sortSymbols, sortDirection, Mode.DUP_REMOVE, dependentNode.getBufferManager(), dependentNode.getConnectionID(), originalVs.getTupleBuffer().getSchema());
+	            	}
+	            	dvs = new DependentValueSource(sortUtility.sort());
+                } else {
+                	dvs = originalVs;
+                }
             	for (SetState setState : dependentSetStates) {
                     setState.valueIterator = dvs.getValueIterator(setState.valueExpression);
                     if (setState.maxNdv > 0 && setState.maxNdv < dvs.getTupleBuffer().getRowCount()) {
@@ -363,8 +366,10 @@
         return hasNextCommand;
     }
     
-    public Criteria replaceDependentCriteria(AbstractSetCriteria crit, SetState state) {
+    public Criteria replaceDependentCriteria(AbstractSetCriteria crit, SetState state) throws TeiidComponentException {
     	if (state.overMax) {
+            DependentValueSource originalVs = (DependentValueSource)dependentNode.getContext().getVariableContext().getGlobalValue(((DependentSetCriteria)crit).getContextSymbol());
+            originalVs.setUnused(true);
     		return QueryRewriter.TRUE_CRITERIA;
     	}
     	if (state.replacement.isEmpty()) {

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentValueSource.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentValueSource.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentValueSource.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -48,6 +48,8 @@
 
     private TupleBuffer buffer;
     private Map<Expression, Set<Object>> cachedSets;
+    private boolean unused; //TODO: use this value instead of the context
+    private boolean distinct;
     
     public DependentValueSource(TupleBuffer tupleSourceID) {
         this.buffer = tupleSourceID;
@@ -105,5 +107,23 @@
     	}
     	return result;
     }
+    
+    @Override
+    public boolean isUnused() {
+		return unused;
+	}
+    
+    @Override
+    public void setUnused(boolean unused) {
+		this.unused = unused;
+	}
+    
+    public boolean isDistinct() {
+		return distinct;
+	}
+    
+    public void setDistinct(boolean distinct) {
+		this.distinct = distinct;
+	}
            
 }

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/EnhancedSortMergeJoinStrategy.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/EnhancedSortMergeJoinStrategy.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/EnhancedSortMergeJoinStrategy.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -55,6 +55,8 @@
  */
 public class EnhancedSortMergeJoinStrategy extends MergeJoinStrategy {
 	
+	private boolean semiDep;
+	
 	private TupleSource currentSource;
 	private SourceState sortedSource;
 	private SourceState notSortedSource;
@@ -65,6 +67,7 @@
 	private int[] reverseIndexes;
 	private List<?> sortedTuple;
 	private boolean repeatedMerge;
+	private boolean validSemiDep;
 	
 	/**
 	 * Number of index batches we'll allow to marked as prefers memory regardless of buffer space
@@ -224,6 +227,17 @@
         	this.sortedSource = this.leftSource;
         	this.notSortedSource = this.rightSource;
 
+    		if (semiDep && this.leftSource.isDistinct()) {
+    			this.rightSource.getTupleBuffer();
+    			if (!this.joinNode.getDependentValueSource().isUnused()) {
+    				//sort is not needed
+    				this.processingSortRight = SortOption.NOT_SORTED;
+    				this.validSemiDep = true;
+    				//TODO: this requires full buffering and performs an unnecessary projection
+    				return;
+    			}
+        	}
+
         	if (!repeatedMerge) {
         		createIndex(this.leftSource, this.processingSortLeft == SortOption.ALREADY_SORTED);
         	} else {
@@ -295,6 +309,12 @@
 	    		if (currentTuple == null) {
 	    			return;
 	    		}
+	    		if (validSemiDep) {
+	    			List<?> tuple = this.currentTuple;
+	    			this.currentTuple = null;
+	    			this.joinNode.addBatchRow(outputTuple(this.leftSource.getOuterVals(), tuple));
+	    			continue;
+	    		}
 	        	List<?> key = RelationalNode.projectTuple(this.notSortedSource.getExpressionIndexes(), this.currentTuple);
 	        	tb = new TupleBrowser(this.index, new CollectionTupleSource(Arrays.asList(key).iterator()), OrderBy.ASC);
 	    	}
@@ -319,12 +339,18 @@
     
     @Override
     public EnhancedSortMergeJoinStrategy clone() {
-    	return new EnhancedSortMergeJoinStrategy(this.sortLeft, this.sortRight);
+    	EnhancedSortMergeJoinStrategy clone = new EnhancedSortMergeJoinStrategy(this.sortLeft, this.sortRight);
+    	clone.semiDep = this.semiDep;
+    	return clone;
     }
     
     @Override
     public String getName() {
-    	return "ENHANCED SORT JOIN"; //$NON-NLS-1$
+    	return "ENHANCED SORT JOIN" + (semiDep?" [SEMI]":""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 
     }
+    
+    public void setSemiDep(boolean semiDep) {
+		this.semiDep = semiDep;
+	}
        	
 }

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/JoinNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/JoinNode.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/JoinNode.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -75,6 +75,8 @@
     private Map combinedElementMap;
     private int[] projectionIndexes;
     
+    private DependentValueSource dvs;
+    
     public JoinNode(int nodeID) {
         super(nodeID);
     }
@@ -182,7 +184,9 @@
             this.joinStrategy.loadLeft();
             if (isDependent()) { 
                 TupleBuffer buffer = this.joinStrategy.leftSource.getTupleBuffer();
-                this.getContext().getVariableContext().setGlobalValue(this.dependentValueSource, new DependentValueSource(buffer));
+                dvs = new DependentValueSource(buffer);
+                dvs.setDistinct(this.joinStrategy.leftSource.isDistinct());
+                this.getContext().getVariableContext().setGlobalValue(this.dependentValueSource, dvs);
             }
             state = State.LOAD_RIGHT;
         }
@@ -270,13 +274,24 @@
         this.dependentValueSource = dependentValueSource;
     }
     
+    public String getDependentValueSourceName() {
+		return dependentValueSource;
+	}
+    
     public void closeDirect() {
         super.closeDirect();
         joinStrategy.close();
         if (this.getContext() != null && this.dependentValueSource != null) {
         	this.getContext().getVariableContext().setGlobalValue(this.dependentValueSource, null);
         }
+        this.dvs = null;
     }
+    
+    @Override
+    public void reset() {
+    	super.reset();
+    	this.dvs = null;
+    }
 
     public JoinType getJoinType() {
         return this.joinType;
@@ -310,5 +325,9 @@
         	throw BATCH_AVILABLE;
         }
     }
+    
+    public DependentValueSource getDependentValueSource() {
+		return dvs;
+	}
 
 }

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/ProjectIntoNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/ProjectIntoNode.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/ProjectIntoNode.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -222,7 +222,7 @@
     	}
         // RESPONSE_PROCESSING: process tuple sources
         if (tupleSourcesProcessed < requestsRegistered) {
-            throw BlockedException.INSTANCE;
+        	throw BlockedException.block(getContext().getRequestId(), "Blocking on insert update count"); //$NON-NLS-1$
         }
                 
     }

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/SortNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/SortNode.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/SortNode.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/main/java/org/teiid/query/processor/relational/UnionAllNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/UnionAllNode.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/UnionAllNode.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -129,7 +129,7 @@
             
         } else if(activeSources > 0) {
             // Didn't get a batch but there are active sources so we are blocked
-            throw BlockedException.INSTANCE;
+        	throw BlockedException.block(getContext().getRequestId(), "Blocking on union source."); //$NON-NLS-1$
         } else {
             // No batch and no active sources - return empty termination batch (should never happen but just in case)
             outputBatch = new TupleBatch(outputRow, Collections.EMPTY_LIST);

Deleted: trunk/engine/src/main/java/org/teiid/query/processor/xml/JoinedWhileInstruction.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/xml/JoinedWhileInstruction.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/processor/xml/JoinedWhileInstruction.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -1,145 +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.processor.xml;
-
-import java.util.List;
-import java.util.Map;
-
-import org.teiid.client.plan.PlanNode;
-import org.teiid.common.buffer.BlockedException;
-import org.teiid.core.TeiidComponentException;
-import org.teiid.core.TeiidProcessingException;
-import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.sql.util.VariableContext;
-
-
-/**
- * Loop instruction on the result set execute before this instruction.
- */
-public class JoinedWhileInstruction extends WhileInstruction {
-
-    private Integer mappingClassNumber;
-    private ElementSymbol mappingClassSymbol;
-    private String originalResultSet;
-
-    /**
-     * Constructor for WhileInstruction.
-     */
-    public JoinedWhileInstruction(String rsName,
-                                  Integer mappingClassNumber,
-                                  ElementSymbol mappingClassSymbol, String originalResultSet) {
-        super(rsName);
-        this.mappingClassNumber = mappingClassNumber;
-        this.mappingClassSymbol = mappingClassSymbol;
-        this.originalResultSet = originalResultSet;
-    }
-
-    /**
-     * @see ProcessorInstruction#process(ProcessorEnvironment)
-     */
-    public XMLContext process(XMLProcessorEnvironment env,
-                              XMLContext context) throws BlockedException,
-                                                 TeiidComponentException,
-                                                 TeiidProcessingException {
-
-        List values = context.getCurrentRow(getResultSetName());
-
-        if (values == null) {
-            env.incrementCurrentProgramCounter();
-            return context;
-        }
-
-        List outputElements = context.getOutputElements(getResultSetName());
-
-        int index = outputElements.indexOf(mappingClassSymbol);
-
-        Object value = values.get(index);
-
-        VariableContext varContext = context.getVariableContext();
-
-        // move on to the next row and don't push the program
-        if (value == null) {
-            if (Boolean.TRUE.equals(getFirst(varContext))) {
-                context.getNextRow(getResultSetName());                
-            }
-            setFirst(varContext, Boolean.TRUE);
-            env.incrementCurrentProgramCounter();
-            return context;
-        }
-
-        boolean canConsume = true;
-
-        // TODO: this is very inefficient. each root should check only its values and pass that value through the context
-        // TODO: likewise the context update below should also only involve the columns from this context
-        if (!Boolean.TRUE.equals(getFirst(varContext))) {
-            Map previousValues = getPreviousValues(varContext); 
-
-            if (previousValues != null) {
-                for (int i = 0; i < index - 1 && canConsume; i++) {
-                    Object previousValue = previousValues.get(outputElements.get(i));
-                    Object currentValue = values.get(i);
-                    if (previousValue != null) {
-                        if (!previousValue.equals(currentValue)) {
-                            canConsume = false;
-                        }
-                    } else if (currentValue != null) {
-                        canConsume = false;
-                    }
-                }
-            }
-        }
-        
-        // consume this row only if the parent values are the same
-        if (value.equals(mappingClassNumber) && canConsume) {
-            //it is not necessary to push the values back into the context here
-            setPreviousValues(varContext, context.getReferenceValues());
-            
-            pushProgram(env, context, values);
-            
-            setFirst(varContext, Boolean.FALSE);
-        } else {
-            setFirst(varContext, Boolean.TRUE);
-            
-            env.incrementCurrentProgramCounter();
-            return context;
-        }
-
-        return context;
-    }
-    
-    Boolean getFirst(VariableContext varContext) {
-        return (Boolean)varContext.getValue(new ElementSymbol("$" + getResultSetName() + "$" + originalResultSet + "$first")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    void setFirst(VariableContext varContext, Boolean value) {
-        varContext.setValue(new ElementSymbol("$" + getResultSetName()  + "$" + originalResultSet + "$first"), value); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public String toString() {
-        return "JOINED " + originalResultSet + " " + super.toString(); //$NON-NLS-1$ //$NON-NLS-2$ 
-    }
-
-    public PlanNode getDescriptionProperties() {
-        return new PlanNode("JOINED LOOP"); //$NON-NLS-1$ 
-    }
-}

Modified: trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLContext.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLContext.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLContext.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -43,12 +43,12 @@
 class XMLContext {
 
     // map between variables and their values
-    Map resultsMap = new HashMap();
+    Map<String, PlanExecutor> resultsMap = new HashMap<String, PlanExecutor>();
     
     // reference to the parent variable context
     XMLContext parentContext;
     
-    Map executorMap = new HashMap();
+    Map<String, PlanExecutor> executorMap = new HashMap<String, PlanExecutor>();
     
     VariableContext variableContext = new VariableContext();
     
@@ -56,14 +56,12 @@
      * Constructor for VariableContext.
      */
     public XMLContext() {
-        this.resultsMap = new HashMap();
     }
     
     /**
      * Constructor for VariableContext.
      */
     public XMLContext(XMLContext parent) {
-        this.resultsMap = new HashMap();
         this.parentContext = parent;
         this.variableContext.setParentContext(parent.variableContext);
     }
@@ -77,8 +75,8 @@
      * @param aliasResultName
      * @return
      */
-    public List getCurrentRow(String aliasResultName) throws TeiidComponentException, TeiidProcessingException {
-        PlanExecutor executor = (PlanExecutor)this.resultsMap.get(aliasResultName);
+    public List<?> getCurrentRow(String aliasResultName) throws TeiidComponentException, TeiidProcessingException {
+        PlanExecutor executor = this.resultsMap.get(aliasResultName);
         if (executor == null) {
             if (this.parentContext != null) {
                 return this.parentContext.getCurrentRow(aliasResultName);
@@ -94,8 +92,8 @@
      * @return
      * @throws TeiidComponentException
      */
-    public List getNextRow(String aliasResultName) throws TeiidComponentException, TeiidProcessingException {
-        PlanExecutor executor = (PlanExecutor)this.resultsMap.get(aliasResultName);
+    public List<?> getNextRow(String aliasResultName) throws TeiidComponentException, TeiidProcessingException {
+        PlanExecutor executor = this.resultsMap.get(aliasResultName);
         if (executor == null) {
             if (this.parentContext != null) {
                 return this.parentContext.getNextRow(aliasResultName);
@@ -119,7 +117,7 @@
      * as there may be another resultset with same name. (recursive condition) 
      */
     public void removeResultSet(String resultName) throws TeiidComponentException {
-        PlanExecutor executor = (PlanExecutor)this.resultsMap.remove(resultName);
+        PlanExecutor executor = this.resultsMap.remove(resultName);
         if (executor != null) {
             executor.close();
         }
@@ -132,8 +130,8 @@
      * @return
      * @throws TeiidComponentException
      */
-    public List getOutputElements(String resultName) throws TeiidComponentException {
-        PlanExecutor executor = (PlanExecutor)this.resultsMap.get(resultName);
+    public List<?> getOutputElements(String resultName) throws TeiidComponentException {
+        PlanExecutor executor = this.resultsMap.get(resultName);
         if (executor == null) {
             if (this.parentContext != null) {
                 return this.parentContext.getOutputElements(resultName);
@@ -160,7 +158,7 @@
      * @return
      */
     public PlanExecutor getResultExecutor(String resultName) {
-        return (PlanExecutor)this.executorMap.get(resultName);
+        return this.executorMap.get(resultName);
     }
 
     /**
@@ -186,10 +184,13 @@
     
 
     void setVariableValues(String resultSetName,
-                                   List row) throws TeiidComponentException {
+                                   List<?> row) throws TeiidComponentException {
         List elements = getOutputElements(resultSetName);
         
         for (int index = 0; index < elements.size(); index++) {
+        	if (!(elements.get(index) instanceof ElementSymbol)) {
+        		continue;
+        	}
             ElementSymbol symbol = (ElementSymbol)elements.get(index);
             variableContext.setValue(new ElementSymbol(resultSetName + ElementSymbol.SEPARATOR + symbol.getShortName()), row.get(index));
         }

Modified: trunk/engine/src/main/java/org/teiid/query/resolver/command/InsertResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/command/InsertResolver.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/command/InsertResolver.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -135,7 +135,7 @@
         	List<Reference> references = new ArrayList<Reference>(insert.getVariables().size());
         	for (int i = 0; i < insert.getVariables().size(); i++) {
         		Reference ref = new Reference(i);
-        		ref.setType(((ElementSymbol)insert.getVariables().get(i)).getType());
+        		ref.setType(insert.getVariables().get(i).getType());
 				references.add(ref);
 			}
         	insert.setValues(references);
@@ -198,7 +198,7 @@
                     //TODO: a special case here is a projected literal
                     throw new QueryResolverException(QueryPlugin.Util.getString("InsertResolver.cant_convert_query_type", new Object[] {expression, expression.getType().getName(), element, element.getType().getName()})); //$NON-NLS-1$
                 }
-            } else if (element.getType() == null && expression.getType() != null && !usingQuery)  {
+            } else if (element.getType() == null && expression.getType() != null)  {
                 element.setType(expression.getType());
                 newValues.add(expression);
             } else {

Modified: trunk/engine/src/main/java/org/teiid/query/resolver/command/SimpleQueryResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/command/SimpleQueryResolver.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/command/SimpleQueryResolver.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -127,7 +127,7 @@
         	ResolverUtil.resolveOrderBy(query.getOrderBy(), query, metadata);
         }
         
-        List symbols = query.getSelect().getProjectedSymbols();
+        List<SingleElementSymbol> symbols = query.getSelect().getProjectedSymbols();
         
         if (query.getInto() != null) {
             GroupSymbol symbol = query.getInto().getGroup();
@@ -281,7 +281,7 @@
             // Look for elements that are not selectable and remove them
             for (ElementSymbol element : elements) {
                 if(metadata.elementSupports(element.getMetadataID(), SupportConstants.Element.SELECT)) {
-                    element = (ElementSymbol)element.clone();
+                    element = element.clone();
                     element.setGroupSymbol(group);
                 	result.add(element);
                 }
@@ -368,6 +368,9 @@
 			}
         }
         
+        /**
+		 * @param tfr  
+		 */
         public LinkedHashSet<GroupSymbol> preTableFunctionReference(TableFunctionReference tfr) {
         	LinkedHashSet<GroupSymbol> saved = new LinkedHashSet<GroupSymbol>(this.currentGroups);
         	if (allowImplicit) {
@@ -571,7 +574,7 @@
                 
         public void visit(From obj) {
             assert currentGroups.isEmpty();
-            for (FromClause clause : (List<FromClause>)obj.getClauses()) {
+            for (FromClause clause : obj.getClauses()) {
 				checkImplicit(clause);
 			}
             super.visit(obj);

Modified: trunk/engine/src/main/java/org/teiid/query/resolver/command/XMLQueryResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/command/XMLQueryResolver.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/command/XMLQueryResolver.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -25,26 +25,38 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
+import java.util.TreeMap;
 
 import org.teiid.api.exception.query.QueryMetadataException;
 import org.teiid.api.exception.query.QueryResolverException;
 import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidRuntimeException;
 import org.teiid.core.util.StringUtil;
 import org.teiid.query.QueryPlugin;
+import org.teiid.query.mapping.xml.MappingAttribute;
+import org.teiid.query.mapping.xml.MappingBaseNode;
+import org.teiid.query.mapping.xml.MappingDocument;
+import org.teiid.query.mapping.xml.MappingElement;
+import org.teiid.query.mapping.xml.MappingVisitor;
+import org.teiid.query.mapping.xml.Navigator;
 import org.teiid.query.metadata.QueryMetadataInterface;
 import org.teiid.query.metadata.TempMetadataAdapter;
+import org.teiid.query.metadata.TempMetadataStore;
+import org.teiid.query.metadata.TempMetadataID.Type;
 import org.teiid.query.resolver.CommandResolver;
 import org.teiid.query.resolver.QueryResolver;
 import org.teiid.query.resolver.util.ResolverUtil;
 import org.teiid.query.resolver.util.ResolverVisitor;
+import org.teiid.query.sql.LanguageObject;
 import org.teiid.query.sql.lang.Command;
 import org.teiid.query.sql.lang.Criteria;
 import org.teiid.query.sql.lang.GroupContext;
 import org.teiid.query.sql.lang.OrderBy;
 import org.teiid.query.sql.lang.Query;
 import org.teiid.query.sql.lang.Select;
+import org.teiid.query.sql.lang.SubqueryContainer;
 import org.teiid.query.sql.symbol.AliasSymbol;
 import org.teiid.query.sql.symbol.AllInGroupSymbol;
 import org.teiid.query.sql.symbol.AllSymbol;
@@ -52,59 +64,204 @@
 import org.teiid.query.sql.symbol.ExpressionSymbol;
 import org.teiid.query.sql.symbol.GroupSymbol;
 import org.teiid.query.sql.symbol.SelectSymbol;
-import org.teiid.query.sql.visitor.CommandCollectorVisitor;
 import org.teiid.query.sql.visitor.ElementCollectorVisitor;
 import org.teiid.query.sql.visitor.GroupCollectorVisitor;
+import org.teiid.query.sql.visitor.ValueIteratorProviderCollectorVisitor;
 
 
 /**
  */
 public class XMLQueryResolver implements CommandResolver {
+	
+	private final class SubSelectVisitor extends MappingVisitor {
+		private final List<ElementSymbol> selectElems;
+		private final ResolvingNode root;
+		private final String mc;
+		private String source;
 
-    /**
+		private SubSelectVisitor(List<ElementSymbol> selectElems,
+				ResolvingNode root, String mc) {
+			this.selectElems = selectElems;
+			this.root = root;
+			this.mc = mc;
+		}
+
+		@Override
+		public void visit(MappingBaseNode baseNode) {
+			if (baseNode.getSource() != null && baseNode.getFullyQualifiedName().equalsIgnoreCase(mc)) {
+				source = baseNode.getSource();
+			}
+		}
+
+		@Override
+		public void visit(MappingElement element) {
+			visit((MappingBaseNode)element);
+			String nis = element.getNameInSource();
+			getMappingClassColumn(nis, element.getFullyQualifiedName());
+		}
+
+		private void getMappingClassColumn(String nis, String fqn) {
+			if (nis == null || source == null) {
+				return;
+			}
+			String name = nis.substring(0, nis.lastIndexOf('.'));
+			if (source.equalsIgnoreCase(name)) {
+				selectElems.add(root.find(fqn));
+			}
+		}
+
+		@Override
+		public void visit(MappingAttribute attribute) {
+			getMappingClassColumn(attribute.getNameInSource(), attribute.getFullyQualifiedName());
+		}
+	}
+
+	private static final class ResolvingNode {
+		ElementSymbol elementSymbol;
+		TreeMap<String, ResolvingNode> children = new TreeMap<String, ResolvingNode>(String.CASE_INSENSITIVE_ORDER);
+		
+		public void add(String name, ElementSymbol symbol) {
+			if (name == null) {
+				this.elementSymbol = symbol;
+				return;
+			}
+			int index = name.lastIndexOf('.');
+			String childName = name;
+			if (index >= 0) {
+				childName = name.substring(0, index);
+				name = name.substring(index + 1, name.length());
+			} else {
+				childName = null;
+			}
+			ResolvingNode child = children.get(name);
+			if (child == null) {
+				child = new ResolvingNode();
+				children.put(name, child);
+			}
+			child.add(childName, symbol);
+		}
+		
+		public <T extends Collection<ElementSymbol>> T values(T values) {
+			if (elementSymbol != null) {
+				values.add(elementSymbol);
+			}
+			for (ResolvingNode node : children.values()) {
+				node.values(values);
+			}
+			return values;
+		}
+		
+		public ElementSymbol find(String name) {
+			int index = name.lastIndexOf('.');
+			String part = name;
+			if (index > 0) {
+				part = name.substring(index + 1, name.length());
+				name = name.substring(0, index);
+			} else {
+				name = null;
+			}
+			ResolvingNode r = children.get(part);
+			if (r == null) {
+				return null;
+			}
+			if (name == null) {
+				return r.elementSymbol;
+			}
+			return r.find(name);
+		}
+		
+		public void addAll(Collection<ElementSymbol> elems) {
+			for (ElementSymbol es : elems) {
+				this.add(es.getName(), es);
+			}
+		}
+		
+		public List<ElementSymbol> values() {
+			return values(new LinkedList<ElementSymbol>());
+		}
+	}
+
+	/**
      * @see org.teiid.query.resolver.CommandResolver#resolveCommand(org.teiid.query.sql.lang.Command, TempMetadataAdapter, boolean)
      */
 	public void resolveCommand(Command command, TempMetadataAdapter metadata, boolean resolveNullLiterals)
 		throws QueryMetadataException, QueryResolverException, TeiidComponentException {
+		resolveCommand((Query)command, null, metadata);
+	}
 
-		Query query = (Query) command;
-
+	public void resolveCommand(Query query, GroupSymbol docGroup, TempMetadataAdapter metadata)
+	throws QueryMetadataException, QueryResolverException, TeiidComponentException {
 		// set isXML flag
-		query.setIsXML(true);
+		query.setIsXML(docGroup == null);
 
 		// get the group on this query
 		Collection<GroupSymbol> groups = GroupCollectorVisitor.getGroups(query, true);
 		GroupSymbol group = groups.iterator().next();
 
+		boolean subQuery = true;
+		if (docGroup == null) {
+			docGroup = group;
+			subQuery = false;
+		}
+		
+		if (subQuery && group.getDefinition() != null) {
+			throw new QueryResolverException(QueryPlugin.Util.getString("XMLQueryResolver.aliased_subquery", group)); //$NON-NLS-1$
+		}
+
 		//external groups
         GroupContext externalGroups = query.getExternalGroupContexts();
 
 		// valid elements for select
-		List<ElementSymbol> validSelectElems = getElementsInDocument(group, metadata);
-		resolveXMLSelect(query, group, validSelectElems, metadata);
+        List<ElementSymbol> validElems = ResolverUtil.resolveElementsInGroup(docGroup, metadata);
+        final ResolvingNode root = new ResolvingNode();
+        ResolvingNode selectRoot = root;
+        if (subQuery) {
+        	validElems = getElementsUnderNode(group.getMetadataID(), validElems, metadata);
+        }
+        root.addAll(validElems);
+		if (subQuery) {
+        	//the select can only be to the mapping class itself
+        	MappingDocument doc = (MappingDocument) metadata.getMappingNode(docGroup.getMetadataID());
+    		final String mc = group.getNonCorrelationName();
+    		List<ElementSymbol> selectElems = new LinkedList<ElementSymbol>();
+            doc.acceptVisitor(new Navigator(true, new SubSelectVisitor(selectElems, root, mc)));
+			selectRoot = new ResolvingNode();
+			selectRoot.addAll(selectElems);
+        }
+		
+		resolveXMLSelect(subQuery, query, group, selectRoot, metadata);
 
 		// valid elements for criteria and order by
-		Collection<ElementSymbol> validCriteriaElements = collectValidCriteriaElements(group, metadata);
+		root.addAll(collectTempElements(group, metadata));
 
 		Criteria crit = query.getCriteria();
 		OrderBy orderBy = query.getOrderBy();
-        
-        List<Command> commands = CommandCollectorVisitor.getCommands(query);
-        for (Command subCommand : commands) {
-            QueryResolver.setChildMetadata(subCommand, command);
-            
-            QueryResolver.resolveCommand(subCommand, metadata.getMetadata());
-        }
-        
+		
 		if(crit != null) {
-			resolveXMLCriteria(crit, externalGroups, validCriteriaElements, metadata);
+	        List<SubqueryContainer> commands = ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(crit);
+	        if (!commands.isEmpty()) {
+	        	TempMetadataAdapter tma = new TempMetadataAdapter(metadata, new TempMetadataStore());
+	        	if (!subQuery) {
+	        		addPseudoSubqueryGroups(tma, group, docGroup);
+	        	}
+		        for (SubqueryContainer subCommand : commands) {
+		            QueryResolver.setChildMetadata(subCommand.getCommand(), query);
+		            if (subCommand.getCommand() instanceof Query && QueryResolver.isXMLQuery((Query)subCommand.getCommand(), tma)) {
+		            	resolveCommand((Query)subCommand.getCommand(), docGroup, tma);
+		            } else {
+		            	QueryResolver.resolveCommand(subCommand.getCommand(), metadata.getMetadata());
+		            }
+		        }
+	        }
+
+			resolveXMLCriteria(crit, externalGroups, root, metadata);
 			// Resolve functions in current query
 			ResolverVisitor.resolveLanguageObject(crit, metadata);
 		}
 
 		// resolve any orderby specified on the query
 		if(orderBy != null) {
-			resolveXMLOrderBy(orderBy, externalGroups, validCriteriaElements, metadata);
+			resolveXMLOrderBy(orderBy, externalGroups, root, metadata);
 		}
         
         //we throw exceptions in these cases, since the clauses will not be resolved
@@ -117,6 +274,34 @@
         }	
     }
 
+	private void addPseudoSubqueryGroups(final TempMetadataAdapter metadata,
+			GroupSymbol group, GroupSymbol docGroup)
+			throws TeiidComponentException, QueryMetadataException {
+		/*
+		 * The next section of resolving logic adds in pseduo groups that can be used
+		 * in subqueries
+		 */
+		MappingDocument doc = (MappingDocument) metadata.getMappingNode(docGroup.getMetadataID());
+		
+		final String prefix = group.getNonCorrelationName() + ElementSymbol.SEPARATOR;
+
+        doc.acceptVisitor(new Navigator(true, new MappingVisitor() {
+        	@Override
+        	public void visit(MappingBaseNode baseNode) {
+        		if (baseNode.getSource() == null) {
+        			return;
+        		}
+        		if (StringUtil.startsWithIgnoreCase(baseNode.getFullyQualifiedName(), prefix)) {
+        			try {
+						ResolverUtil.addTempGroup(metadata, new GroupSymbol(baseNode.getFullyQualifiedName()), Collections.EMPTY_LIST, false).setMetadataType(Type.XML);
+					} catch (QueryResolverException e) {
+						throw new TeiidRuntimeException(e);
+					}
+        		}
+        	}
+        }));
+	}
+
     /**
      * Method resolveXMLSelect.
      * @param select Select clause in user command
@@ -128,7 +313,7 @@
      * @throws QueryMetadataException if resolving fails
      * @throws TeiidComponentException if resolving fails
      */
-	void resolveXMLSelect(Query query, GroupSymbol group, List<ElementSymbol> validElements, QueryMetadataInterface metadata)
+	void resolveXMLSelect(boolean subquery, Query query, GroupSymbol group, ResolvingNode validElements, QueryMetadataInterface metadata)
 		throws QueryMetadataException, TeiidComponentException, QueryResolverException {
         
         GroupContext externalGroups = null;
@@ -153,13 +338,13 @@
 				// There are other cases of "xml", such as, element name = "xml",
 				// but those are ok because those will be resolved later as normal elements
 				String symbolName = ss.getName();
-				if(symbolName.equalsIgnoreCase("xml") || symbolName.equalsIgnoreCase(group.getName() + ".xml")) { //$NON-NLS-1$ //$NON-NLS-2$
+				if(!subquery && (symbolName.equalsIgnoreCase("xml") || symbolName.equalsIgnoreCase(group.getName() + ".xml"))) { //$NON-NLS-1$ //$NON-NLS-2$
 					if(elements.size() != 1) {
 						throw new QueryResolverException(QueryPlugin.Util.getString("XMLQueryResolver.xml_only_valid_alone")); //$NON-NLS-1$
 					}
 					select.clearSymbols();
                     AllSymbol all = new AllSymbol();
-                    all.setElementSymbols(validElements);
+                    all.setElementSymbols(validElements.values());
 					select.addSymbol(all);
 					query.setSelect(select);
 					return;
@@ -177,7 +362,7 @@
                 if(elementPart.equalsIgnoreCase(group.getName())) {
                     select.clearSymbols();
                     AllSymbol all = new AllSymbol();
-                    all.setElementSymbols(validElements);
+                    all.setElementSymbols(validElements.values());
                     select.addSymbol(all);
                     query.setSelect(select);
                 } else {
@@ -186,12 +371,12 @@
                     resolveElement(elementSymbol, validElements, externalGroups, metadata);
 
                     // now find all the elements under this node and set as elements.
-                    List<ElementSymbol> elementsInNode = getElementsUnderNode(elementSymbol, validElements, metadata);
+                    List<ElementSymbol> elementsInNode = getElementsUnderNode(elementSymbol.getMetadataID(), validElements.values(), metadata);
                     ((AllInGroupSymbol)ss).setElementSymbols(elementsInNode);
                 }
 			} else if (ss instanceof AllSymbol) {
                 AllSymbol all =  (AllSymbol)ss;
-                all.setElementSymbols(validElements);
+                all.setElementSymbols(validElements.values());
 				return;
 			} else if (ss instanceof ExpressionSymbol) {
                 throw new QueryResolverException(QueryPlugin.Util.getString("XMLQueryResolver.no_expressions_in_select")); //$NON-NLS-1$
@@ -202,30 +387,12 @@
 		}
 	}
         
-    /**
-     * Collect all fully-qualified valid elements.  These can then be used to
-     * validate elements used in the query.  It's easier to look up the valid
-     * elements because the user is allow to used any partially-qualified name,
-     * which makes the logic for doing lookups essentially impossible with the
-     * existing metadata interface.
-     * @param group Document group
-     * @param metadata Metadata interface
-     * @return Collection of ElementSymbol for each possible valid element
-     * @throws QueryMetadataException
-     * @throws TeiidComponentException
-     * @throws QueryResolverException
-     */
-    public static Collection<ElementSymbol> collectValidCriteriaElements(GroupSymbol group, QueryMetadataInterface metadata)
-        throws QueryMetadataException, TeiidComponentException, QueryResolverException {
-
-        // Get all groups and elements
-        List<ElementSymbol> validElements = getElementsInDocument(group, metadata);
-
+    public static Collection<ElementSymbol> collectTempElements(GroupSymbol group, QueryMetadataInterface metadata)
+        throws QueryMetadataException, TeiidComponentException {
+    	ArrayList<ElementSymbol> validElements = new ArrayList<ElementSymbol>();
         // Create GroupSymbol for temp groups and add to groups
-        Collection tempGroups = metadata.getXMLTempGroups(group.getMetadataID());
-        Iterator tempGroupIter = tempGroups.iterator();
-        while(tempGroupIter.hasNext()) {
-            Object tempGroupID = tempGroupIter.next();
+        Collection<?> tempGroups = metadata.getXMLTempGroups(group.getMetadataID());
+        for (Object tempGroupID : tempGroups) {
             String name = metadata.getFullName(tempGroupID);
             GroupSymbol tempGroup = new GroupSymbol(name);
             tempGroup.setMetadataID(tempGroupID);
@@ -235,7 +402,6 @@
         return validElements;
     }
 
-
     /**
      * <p> Resolve the criteria specified on the XML query. The elements specified on the criteria should
      * be present on one of the mapping node objects passed to this method, or else be an element on a
@@ -255,7 +421,7 @@
      * @param metadata QueryMetadataInterface the metadata(for resolving criteria on temp groups)
      * @throws QueryResolverException if any of the above fail conditions are met
      */
-    public static void resolveXMLCriteria(Criteria criteria,GroupContext externalGroups, Collection<ElementSymbol> validElements, QueryMetadataInterface metadata)
+    public static void resolveXMLCriteria(LanguageObject criteria,GroupContext externalGroups, ResolvingNode validElements, QueryMetadataInterface metadata)
         throws QueryMetadataException, TeiidComponentException, QueryResolverException {
 
         // Walk through each element in criteria and check against valid elements
@@ -278,7 +444,7 @@
      * @throws QueryMetadataException if resolving fails
      * @throws TeiidComponentException if resolving fails
      */
-    static void resolveXMLOrderBy(OrderBy orderBy, GroupContext externalGroups, Collection<ElementSymbol> validElements, QueryMetadataInterface metadata)
+    static void resolveXMLOrderBy(OrderBy orderBy, GroupContext externalGroups, ResolvingNode validElements, QueryMetadataInterface metadata)
         throws QueryMetadataException, TeiidComponentException, QueryResolverException {
 
         // Walk through each element in OrderBy clause and check against valid elements
@@ -298,107 +464,69 @@
 	 * @throws QueryMetadataException
 	 * @throws TeiidComponentException
 	 */
-    static void resolveElement(ElementSymbol elem, Collection<ElementSymbol> validElements, GroupContext externalGroups, QueryMetadataInterface metadata)
+    static void resolveElement(ElementSymbol elem, ResolvingNode validElements, GroupContext externalGroups, QueryMetadataInterface metadata)
         throws QueryResolverException, QueryMetadataException, TeiidComponentException {
         
         // Get exact matching name
-        String critElemName = elem.getName();
-        String critElemNameSuffix = "." + elem.getCanonicalName(); //$NON-NLS-1$
+        String partialName = elem.getName();
+        String fullName = partialName;
 
-        // Prepare results
-        ElementSymbol exactMatch = null;
-        List<ElementSymbol> partialMatches = new ArrayList<ElementSymbol>(2);     // anything over 1 is an error and should be rare
+        ResolvingNode current = validElements;
+    	String part = partialName;
+        for (int i = 0; partialName != null; i++) {
+        	int index = partialName.lastIndexOf('.');
+        	if (index < 0) {
+        		part = partialName;
+        		partialName = null;
+        	} else {
+        		part = partialName.substring(index + 1, partialName.length());
+        		partialName = partialName.substring(0, index);
+        	}
+			current = current.children.get(part);
+			if (current == null) {
+				if (i == 0 && part.charAt(0) != '@') {
+					//handle attribute case
+					part = '@' + part;
+					current = validElements.children.get(part);
+					if (current != null) {
+						continue;
+					}
+				}
+				try {
+	                ResolverVisitor.resolveLanguageObject(elem, Collections.EMPTY_LIST, externalGroups, metadata);
+	                return;
+	            } catch (QueryResolverException e) {
+	                throw new QueryResolverException(e, "ERR.015.008.0019", QueryPlugin.Util.getString("ERR.015.008.0019", fullName)); //$NON-NLS-1$ //$NON-NLS-2$
+	            }
+			}
+		}
 
-        //List of XML attributes that might match the criteria element,
-        //if the criteria is specified without the optional "@" sign
-        List<ElementSymbol> attributeMatches = new ArrayList<ElementSymbol>(2);
+        List<ElementSymbol> partialMatches = current.values();
 
-        // look up name based on ID match - will work for uuid version
-        try {
+        if (partialMatches.size() != 1) {
+        	// Found multiple matches
+            throw new QueryResolverException("ERR.015.008.0020", QueryPlugin.Util.getString("ERR.015.008.0020", fullName)); //$NON-NLS-1$ //$NON-NLS-2$
+        } 
 
-            Object elementID = metadata.getElementID(critElemName);
-
-            if(elementID != null) {
-                critElemName = metadata.getFullName(elementID);
-            }
-        } catch(QueryMetadataException e) {
-            //e.printStackTrace();
-            // ignore and go on
-        }
-
-        // Walk through each valid element looking for a match
-        for (ElementSymbol currentElem : validElements) {
-            // Look for exact match
-            if(currentElem.getName().equalsIgnoreCase(critElemName)) {
-                exactMatch = currentElem;
-                break;
-            }
-
-            if(currentElem.getName().toUpperCase().endsWith(critElemNameSuffix)) {
-                partialMatches.add(currentElem);
-            } else {
-                // The criteria element might be referring to an
-                // XML attribute, but might not have the optional
-                // "@" sign
-                String currentElemName = currentElem.getName();
-                int atSignIndex = currentElemName.indexOf("@"); //$NON-NLS-1$
-                if (atSignIndex != -1){
-                    currentElemName = StringUtil.replace(currentElemName, "@", ""); //$NON-NLS-1$ //$NON-NLS-2$
-                    if(currentElemName.equalsIgnoreCase(critElemName)) {
-                        attributeMatches.add(currentElem);
-                    } else {
-                        currentElemName = currentElemName.toUpperCase();
-                        if(currentElemName.endsWith(critElemNameSuffix)) {
-                            attributeMatches.add(currentElem);
-                        }
-                    }
-                }
-            }
-        }
-
-        // Check for single partial match
-        if(exactMatch == null){
-            if (partialMatches.size() == 1) {
-                exactMatch = partialMatches.get(0);
-            } else if (partialMatches.size() == 0 && attributeMatches.size() == 1){
-                exactMatch = attributeMatches.get(0);
-            }
-        }
-
-        if(exactMatch != null) {
-            String name = elem.getOutputName();
-            // Resolve based on exact match
-            elem.setShortName(exactMatch.getShortName());
-            elem.setShortCanonicalName(exactMatch.getShortCanonicalName());
-            elem.setMetadataID(exactMatch.getMetadataID());
-            elem.setType(exactMatch.getType());
-            elem.setGroupSymbol(exactMatch.getGroupSymbol());
-            elem.setOutputName(name);
-        } else if(partialMatches.size() == 0 && attributeMatches.size() == 0){
-            try {
-                ResolverVisitor.resolveLanguageObject(elem, Collections.EMPTY_LIST, externalGroups, metadata);
-            } catch (QueryResolverException e) {
-                throw new QueryResolverException(e, "ERR.015.008.0019", QueryPlugin.Util.getString("ERR.015.008.0019", critElemName)); //$NON-NLS-1$ //$NON-NLS-2$
-            }
-        } else {
-            // Found multiple matches
-            throw new QueryResolverException("ERR.015.008.0020", QueryPlugin.Util.getString("ERR.015.008.0020", critElemName)); //$NON-NLS-1$ //$NON-NLS-2$
-        }
+        ElementSymbol exactMatch = partialMatches.get(0);
+        String name = elem.getOutputName();
+        // Resolve based on exact match
+        elem.setShortName(exactMatch.getShortName());
+        elem.setShortCanonicalName(exactMatch.getShortCanonicalName());
+        elem.setMetadataID(exactMatch.getMetadataID());
+        elem.setType(exactMatch.getType());
+        elem.setGroupSymbol(exactMatch.getGroupSymbol());
+        elem.setOutputName(name);
     }
 
-    static List<ElementSymbol> getElementsInDocument(GroupSymbol group, QueryMetadataInterface metadata)
-        throws QueryMetadataException, TeiidComponentException {
-        return ResolverUtil.resolveElementsInGroup(group, metadata);
-    }
-    
-    static List<ElementSymbol> getElementsUnderNode(ElementSymbol node, List<ElementSymbol> validElements, QueryMetadataInterface metadata) 
+    static List<ElementSymbol> getElementsUnderNode(Object mid, Collection<ElementSymbol> validElements, QueryMetadataInterface metadata) 
         throws TeiidComponentException, QueryMetadataException {
         
         List<ElementSymbol> elements = new ArrayList<ElementSymbol>();
-        String nodeName = metadata.getFullName(node.getMetadataID());
+        String nodeName = metadata.getFullName(mid);
         for (ElementSymbol validElement : validElements) {
             String qualifiedName = validElement.getName();
-            if (qualifiedName.equals(nodeName) || qualifiedName.startsWith(nodeName+ElementSymbol.SEPARATOR)) {
+            if (StringUtil.startsWithIgnoreCase(qualifiedName, nodeName) && (qualifiedName.length() == nodeName.length() || qualifiedName.charAt(nodeName.length()) == '.')) {
                 elements.add(validElement);
             }
         }

Modified: trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverUtil.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverUtil.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverUtil.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -938,7 +938,7 @@
 			return;
 		}
 		if (query.getFrom().getClauses().size() == 1) {
-			findKeyPreserved((FromClause)query.getFrom().getClauses().get(0), keyPreservingGroups, metadata);
+			findKeyPreserved(query.getFrom().getClauses().get(0), keyPreservingGroups, metadata);
 			return;
 		}
 		//non-ansi join

Modified: trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -64,7 +64,6 @@
 import org.teiid.query.metadata.TempMetadataAdapter;
 import org.teiid.query.metadata.TempMetadataID;
 import org.teiid.query.metadata.TempMetadataStore;
-import org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil;
 import org.teiid.query.optimizer.relational.rules.RuleMergeCriteria;
 import org.teiid.query.optimizer.relational.rules.RulePlaceAccess;
 import org.teiid.query.optimizer.relational.rules.RuleMergeCriteria.PlannedResult;
@@ -634,7 +633,7 @@
         }
         
         if (from != null && !query.getIsXML()) {
-        	writeSubqueriesAsJoins(query);
+        	rewriteSubqueriesAsJoins(query);
         }
 
         query = rewriteGroupBy(query);
@@ -667,7 +666,7 @@
         return query;
     }
 
-	private void writeSubqueriesAsJoins(Query query)
+	private void rewriteSubqueriesAsJoins(Query query)
 			throws TeiidComponentException, QueryMetadataException,
 			QueryResolverException {
 		if (query.getCriteria() == null) {
@@ -704,16 +703,6 @@
 			if (!rmc.planQuery(groups, requiresDistinct, plannedResult)) {
 				continue;
 			}
-			if (requiresDistinct) {
-				//check for key preservation
-				HashSet<GroupSymbol> keyPreservingGroups = new HashSet<GroupSymbol>();
-				ResolverUtil.findKeyPreserved(query, keyPreservingGroups, metadata);
-				if (NewCalculateCostUtil.usesKey(plannedResult.leftExpressions, keyPreservingGroups, metadata, true) && plannedResult.madeDistinct) {
-					//if key perserved then the semi-join will remain in-tact without make the other query distinct
-					plannedResult.madeDistinct = false;
-					plannedResult.query.getSelect().setDistinct(false);
-				}
-			}
 			crits.remove();
 			
 			GroupSymbol viewName = RulePlaceAccess.recontextSymbol(new GroupSymbol("X"), names); //$NON-NLS-1$
@@ -722,9 +711,9 @@
 			Query q = createInlineViewQuery(viewName, plannedResult.query, metadata, plannedResult.query.getSelect().getProjectedSymbols());
 			
 			Iterator<SingleElementSymbol> iter = q.getSelect().getProjectedSymbols().iterator();
-		    HashMap<Expression, SingleElementSymbol> expressionMap = new HashMap<Expression, SingleElementSymbol>();
+		    HashMap<Expression, Expression> expressionMap = new HashMap<Expression, Expression>();
 		    for (SingleElementSymbol symbol : plannedResult.query.getSelect().getProjectedSymbols()) {
-		        expressionMap.put(SymbolMap.getExpression(symbol), iter.next());
+		        expressionMap.put(SymbolMap.getExpression(symbol), SymbolMap.getExpression(iter.next()));
 		    }
 			for (int i = 0; i < plannedResult.leftExpressions.size(); i++) {
 				plannedResult.nonEquiJoinCriteria.add(new CompareCriteria(SymbolMap.getExpression((Expression)plannedResult.leftExpressions.get(i)), CompareCriteria.EQ, (Expression)plannedResult.rightExpressions.get(i)));
@@ -732,7 +721,11 @@
 			Criteria mappedCriteria = Criteria.combineCriteria(plannedResult.nonEquiJoinCriteria);
 			ExpressionMappingVisitor.mapExpressions(mappedCriteria, expressionMap);
 			query.setCriteria(Criteria.combineCriteria(query.getCriteria(), mappedCriteria));
-		    query.getFrom().addClause((FromClause) q.getFrom().getClauses().get(0));
+			FromClause clause = q.getFrom().getClauses().get(0);
+			if (plannedResult.makeInd) {
+				clause.setMakeInd(true);
+			}
+		    query.getFrom().addClause(clause);
 		    query.getTemporaryMetadata().putAll(q.getTemporaryMetadata());
 			//transform the query into an inner join 
 		}
@@ -1589,26 +1582,29 @@
      */
     private Criteria rewriteCriteria(SubqueryCompareCriteria criteria) throws TeiidComponentException, TeiidProcessingException{
     	
-    	if (criteria.getCommand().getProcessorPlan() == null && criteria.getPredicateQuantifier() != SubqueryCompareCriteria.ALL) {
-    		if (criteria.getOperator() == CompareCriteria.EQ || criteria.getOperator() == CompareCriteria.NE) {
+    	if (criteria.getCommand().getProcessorPlan() == null) {
+    		if ((criteria.getOperator() == CompareCriteria.EQ && criteria.getPredicateQuantifier() != SubqueryCompareCriteria.ALL)
+    				|| (criteria.getOperator() == CompareCriteria.NE && criteria.getPredicateQuantifier() == SubqueryCompareCriteria.ALL)) {
     			SubquerySetCriteria result = new SubquerySetCriteria(criteria.getLeftExpression(), criteria.getCommand());
     			result.setNegated(criteria.getOperator() == CompareCriteria.NE);
     			return rewriteCriteria(result);
     		}
-    		CompareCriteria cc = new CompareCriteria();
-    		cc.setLeftExpression(criteria.getLeftExpression());
-    		Query q = createInlineViewQuery(new GroupSymbol("X"), criteria.getCommand(), metadata, criteria.getCommand().getProjectedSymbols()); //$NON-NLS-1$
-    		SingleElementSymbol ses = q.getProjectedSymbols().get(0);
-    		Expression expr = SymbolMap.getExpression(ses);
-    		q.getSelect().clearSymbols();
-    		AggregateSymbol.Type type = Type.MAX;
-    		if (criteria.getOperator() == CompareCriteria.GT || criteria.getOperator() == CompareCriteria.GE) {
-    			type = Type.MIN;
+    		if (criteria.getPredicateQuantifier() != SubqueryCompareCriteria.ALL && criteria.getOperator() != CompareCriteria.EQ && criteria.getOperator() != CompareCriteria.NE) {
+	    		CompareCriteria cc = new CompareCriteria();
+	    		cc.setLeftExpression(criteria.getLeftExpression());
+	    		Query q = createInlineViewQuery(new GroupSymbol("X"), criteria.getCommand(), metadata, criteria.getCommand().getProjectedSymbols()); //$NON-NLS-1$
+	    		SingleElementSymbol ses = q.getProjectedSymbols().get(0);
+	    		Expression expr = SymbolMap.getExpression(ses);
+	    		q.getSelect().clearSymbols();
+	    		AggregateSymbol.Type type = Type.MAX;
+	    		if (criteria.getOperator() == CompareCriteria.GT || criteria.getOperator() == CompareCriteria.GE) {
+	    			type = Type.MIN;
+	    		}
+	    		q.getSelect().addSymbol(new AggregateSymbol(ses.getName(), type.name(), false, expr));
+	    		cc.setRightExpression(new ScalarSubquery(q));
+				cc.setOperator(criteria.getOperator());
+	    		return rewriteCriteria(cc);
     		}
-    		q.getSelect().addSymbol(new AggregateSymbol(ses.getName(), type.name(), false, expr));
-    		cc.setRightExpression(new ScalarSubquery(q));
-			cc.setOperator(criteria.getOperator());
-    		return rewriteCriteria(cc);
     	}
 
         Expression leftExpr = rewriteExpressionDirect(criteria.getLeftExpression());

Modified: trunk/engine/src/main/java/org/teiid/query/sql/LanguageObject.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/LanguageObject.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/sql/LanguageObject.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -23,7 +23,7 @@
 package org.teiid.query.sql;
 
 import java.util.ArrayList;
-import java.util.List;
+import java.util.Collection;
 
 /**
  * This is the primary interface for all language objects.  It extends a few 
@@ -47,7 +47,7 @@
     
     public static class Util {
 
-		public static <S extends LanguageObject, T extends S> ArrayList<S> deepClone(List<T> collection, Class<S> type) {
+		public static <S extends LanguageObject, T extends S> ArrayList<S> deepClone(Collection<T> collection, Class<S> type) {
 			if (collection == null) {
 				return null;
 			}


Property changes on: trunk/engine/src/main/java/org/teiid/query/sql/LanguageObject.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/main/java/org/teiid/query/sql/LanguageObject.java:3149-3217

Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/ArrayTable.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/ArrayTable.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/ArrayTable.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -59,7 +59,7 @@
 	}
 
 	@Override
-	public ArrayTable clone() {
+	protected ArrayTable cloneDirect() {
 		ArrayTable clone = new ArrayTable();
 		this.copy(clone);
 		clone.setArrayValue((Expression)this.arrayValue.clone());

Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/ExistsCriteria.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/ExistsCriteria.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/ExistsCriteria.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -43,9 +43,11 @@
 	public static class SubqueryHint {
 		public static String MJ = "MJ"; //$NON-NLS-1$
 		public static String NOUNNEST = "NO_UNNEST"; //$NON-NLS-1$
+		public static String DJ = "DJ"; //$NON-NLS-1$
 
 		private boolean mergeJoin;
 	    private boolean noUnnest;
+	    private boolean depJoin;
 	    
 	    public void setMergeJoin(boolean semiJoin) {
 			this.mergeJoin = semiJoin;
@@ -63,6 +65,15 @@
 			return noUnnest;
 		}
 	    
+	    public void setDepJoin(boolean depJoin) {
+			this.depJoin = depJoin;
+			this.mergeJoin = true;
+		}
+	    
+	    public boolean isDepJoin() {
+			return depJoin;
+		}
+	    
 		@Override
 		public boolean equals(Object obj) {
 			if (this == obj) {
@@ -72,13 +83,16 @@
 				return false;
 			}
 			SubqueryHint other = (SubqueryHint) obj;
-			return mergeJoin == other.mergeJoin && noUnnest == other.noUnnest;
+			return mergeJoin == other.mergeJoin 
+			&& noUnnest == other.noUnnest 
+			&& depJoin == other.depJoin;
 		}
 		
 		public SubqueryHint clone() {
 			SubqueryHint clone = new SubqueryHint();
 			clone.mergeJoin = this.mergeJoin;
 			clone.noUnnest = this.noUnnest;
+			clone.depJoin = this.depJoin;
 			return clone;
 		}
 		

Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/FromClause.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/FromClause.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/FromClause.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -26,6 +26,7 @@
 
 import org.teiid.query.sql.LanguageObject;
 import org.teiid.query.sql.LanguageVisitor;
+import org.teiid.query.sql.symbol.GroupSymbol;
 import org.teiid.query.sql.visitor.SQLStringVisitor;
 
 
@@ -37,9 +38,13 @@
  * and may contain criteria.
  */
 public abstract class FromClause implements LanguageObject {
+	
+	public static String MAKEIND = "MAKEIND"; //$NON-NLS-1$
+	
     private boolean optional;
     private boolean makeDep;
     private boolean makeNotDep;
+    private boolean makeInd;
 
     public boolean isOptional() {
         return optional;
@@ -49,9 +54,26 @@
         this.optional = optional;
     }
     
+    public boolean isMakeInd() {
+		return makeInd;
+	}
+    
+    public void setMakeInd(boolean makeInd) {
+		this.makeInd = makeInd;
+	}
+    
     public abstract void acceptVisitor(LanguageVisitor visitor);
-    public abstract void collectGroups(Collection groups);
-    public abstract Object clone();
+    public abstract void collectGroups(Collection<GroupSymbol> groups);
+    protected abstract FromClause cloneDirect();
+    
+    public FromClause clone() {
+    	FromClause clone = cloneDirect();
+    	clone.makeDep = makeDep;
+    	clone.makeInd = makeInd;
+    	clone.makeNotDep = makeNotDep;
+    	clone.optional = optional;
+    	return clone;
+    }
 
     public boolean isMakeDep() {
         return this.makeDep;
@@ -70,7 +92,7 @@
     }
     
     public boolean hasHint() {
-        return optional || makeDep || makeNotDep;
+        return optional || makeDep || makeNotDep || makeInd;
     }
     
     public boolean equals(Object obj) {
@@ -86,7 +108,8 @@
 
         return other.isOptional() == this.isOptional()
                && other.isMakeDep() == this.isMakeDep()
-               && other.isMakeNotDep() == this.isMakeNotDep();
+               && other.isMakeNotDep() == this.isMakeNotDep()
+        	   && other.isMakeInd() == this.isMakeInd();
     }
     
     @Override

Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/JoinPredicate.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/JoinPredicate.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/JoinPredicate.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -30,6 +30,7 @@
 import org.teiid.core.util.EquivalenceUtil;
 import org.teiid.core.util.HashCodeUtil;
 import org.teiid.query.sql.LanguageVisitor;
+import org.teiid.query.sql.symbol.GroupSymbol;
 
 
 /**
@@ -165,7 +166,7 @@
      * Collect all GroupSymbols for this from clause.
      * @param groups Groups to add to
      */
-    public void collectGroups(Collection groups) {
+    public void collectGroups(Collection<GroupSymbol> groups) {
         if(this.leftClause != null) { 
             this.leftClause.collectGroups(groups);
         } 
@@ -223,15 +224,15 @@
 	 * Return deep clone for object
 	 * @return Deep clone
 	 */
-	public Object clone() {
+	protected FromClause cloneDirect() {
 	    FromClause copyLeft = null;
 	    if(this.leftClause != null) { 
-	        copyLeft = (FromClause) this.leftClause.clone();
+	        copyLeft = this.leftClause.clone();
 	    }	
 
 	    FromClause copyRight = null;
 	    if(this.rightClause != null) { 
-	        copyRight = (FromClause) this.rightClause.clone();
+	        copyRight = this.rightClause.clone();
 	    }	
 	    
 		List copyCrits = null;
@@ -245,9 +246,6 @@
 		}
 	    	    
         JoinPredicate clonedJoinPredicate = new JoinPredicate(copyLeft, copyRight, this.joinType, copyCrits);
-        clonedJoinPredicate.setOptional(this.isOptional());
-        clonedJoinPredicate.setMakeDep(this.isMakeDep());
-        clonedJoinPredicate.setMakeNotDep(this.isMakeNotDep());
         return clonedJoinPredicate;
 	}
 

Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/Select.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/Select.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/Select.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -24,17 +24,14 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.List;
 
 import org.teiid.core.util.EquivalenceUtil;
 import org.teiid.core.util.HashCodeUtil;
 import org.teiid.query.sql.LanguageObject;
 import org.teiid.query.sql.LanguageVisitor;
-import org.teiid.query.sql.symbol.AllInGroupSymbol;
 import org.teiid.query.sql.symbol.AllSymbol;
 import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.sql.symbol.GroupSymbol;
 import org.teiid.query.sql.symbol.MultipleElementSymbol;
 import org.teiid.query.sql.symbol.SelectSymbol;
 import org.teiid.query.sql.symbol.SingleElementSymbol;
@@ -48,7 +45,7 @@
 public class Select implements LanguageObject {
 
     /** The set of symbols for the data elements to be selected. */
-    private List symbols;     // List<SelectSymbols>
+    private List<SelectSymbol> symbols;
 
     /** Flag for whether duplicate removal should be performed on the results */
     private boolean distinct;
@@ -61,15 +58,15 @@
      * Constructs a default instance of this class.
      */
     public Select() {
-        symbols = new ArrayList();
+        symbols = new ArrayList<SelectSymbol>();
     }
 
     /**
      * Constructs an instance of this class from an ordered set of symbols.
      * @param symbols The ordered list of symbols
      */
-    public Select( List symbols ) {
-        this.symbols = new ArrayList( symbols );
+    public Select( List<? extends SelectSymbol> symbols ) {
+        this.symbols = new ArrayList<SelectSymbol>( symbols );
     }
 
     // =========================================================================
@@ -95,7 +92,7 @@
      * Returns an ordered list of the symbols in the select.
      * @param Get list of SelectSymbol in SELECT
      */
-    public List getSymbols() {
+    public List<SelectSymbol> getSymbols() {
         return symbols;
     }
     
@@ -103,8 +100,8 @@
      * Sets an ordered list of the symbols in the select.
      * @param symbols list of SelectSymbol in SELECT
      */
-    public void setSymbols(List symbols) {
-        this.symbols = symbols;
+    public void setSymbols(List<? extends SelectSymbol> symbols) {
+        this.symbols = new ArrayList<SelectSymbol>(symbols);
     }    
 
     /**
@@ -113,7 +110,7 @@
      * @return The variable identifier at the index
      */
     public SelectSymbol getSymbol( int index ) {
-        return (SelectSymbol) symbols.get(index);
+        return symbols.get(index);
     }
 
     /**
@@ -130,9 +127,9 @@
      * Adds a new collection of symbols to the list of symbols.
      * @param symbols Collection of SelectSymbols
      */
-    public void addSymbols( Collection symbols) {
+    public void addSymbols( Collection<? extends SelectSymbol> toAdd) {
     	if(symbols != null) {
-	        this.symbols.addAll(symbols);
+	        this.symbols.addAll(toAdd);
         }
     }
     
@@ -152,38 +149,6 @@
         return symbols.contains(symbol);
     }
 
-    /**
-     * Check is the element symbol is being selected by this
-     * select clause.  This includes checking for select start
-     * and select group.star for the group of this element symbol.
-     * ElementSymbol is assumed to be fully resolved.
-     * @param elementSymbol fully resolved ElementSymbol
-     * @return whether this select will select the element symbol
-     */
-    public boolean isElementBeingSelected(ElementSymbol elementSymbol){
-        boolean isBeingSelected = this.containsSymbol(elementSymbol);
-        if (!isBeingSelected){
-            GroupSymbol g = elementSymbol.getGroupSymbol();
-            String groupDotStarName = g.getName() + ".*"; //$NON-NLS-1$
-            Iterator i = this.getSymbols().iterator();
-            while (i.hasNext()) {
-                Object selectSymbol = i.next();
-                if (selectSymbol instanceof AllSymbol){
-                    isBeingSelected = true;
-                    break;
-                } else if (selectSymbol instanceof AllInGroupSymbol){
-                    AllInGroupSymbol aigSymbol = (AllInGroupSymbol)selectSymbol;
-                    if (aigSymbol.getName().equalsIgnoreCase(groupDotStarName)){
-                        isBeingSelected = true;
-                        break;
-                    }
-                }
-            }
-        }
-        return isBeingSelected;
-    }
-    
-
 	/**
 	 * Set whether select is distinct.
 	 * @param isDistinct True if SELECT is distinct
@@ -212,9 +177,7 @@
 	 */
 	public List<SingleElementSymbol> getProjectedSymbols() { 
 		ArrayList<SingleElementSymbol> projectedSymbols = new ArrayList<SingleElementSymbol>();
-		Iterator iter = symbols.iterator();
-		while(iter.hasNext()) {
-			SelectSymbol symbol = (SelectSymbol) iter.next();
+		for (SelectSymbol symbol : symbols) {
 			if(symbol instanceof SingleElementSymbol) { 
 				projectedSymbols.add((SingleElementSymbol)symbol);
 			} else {
@@ -236,15 +199,7 @@
 	 * @return Deep clone
 	 */
 	public Object clone() {
-	    List thisSymbols = getSymbols();
-	    List copySymbols = new ArrayList(thisSymbols.size());
-	    Iterator iter = thisSymbols.iterator();
-	    while(iter.hasNext()) {
-	    	SelectSymbol ss = (SelectSymbol) iter.next();
-	    	copySymbols.add(ss.clone());    
-	    }
-	    	    
-		Select copy = new Select(copySymbols);
+		Select copy = new Select(LanguageObject.Util.deepClone(this.symbols, SelectSymbol.class));
 		copy.setDistinct( isDistinct() );
 		return copy;
 	}

Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/SubqueryFromClause.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/SubqueryFromClause.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/SubqueryFromClause.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -159,16 +159,13 @@
 	 * Get deep clone of object
 	 * @return Deep copy of the object
 	 */
-	public Object clone() {
+	public FromClause cloneDirect() {
         Command commandCopy = null;        
         if(this.command != null) {
             commandCopy = (Command) this.command.clone();
         }
         
-        SubqueryFromClause clause = new SubqueryFromClause((GroupSymbol)this.symbol.clone(), commandCopy);
-        clause.setOptional(this.isOptional());
-        clause.setMakeDep(this.isMakeDep());
-        clause.setMakeNotDep(this.isMakeNotDep());
+        SubqueryFromClause clause = new SubqueryFromClause(this.symbol.clone(), commandCopy);
         clause.setTable(this.isTable());
         return clause;
 	}

Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/TableFunctionReference.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/TableFunctionReference.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/TableFunctionReference.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -83,7 +83,7 @@
 		public ProjectedColumn copyTo(ProjectedColumn copy) {
 			copy.name = this.name;
 			copy.type = this.type;
-			copy.symbol = (ElementSymbol)this.symbol.clone();
+			copy.symbol = this.symbol.clone();
 			return copy;
 		}
 		
@@ -101,14 +101,14 @@
 	}
     
 	public void copy(TableFunctionReference copy) {
-		copy.symbol = (GroupSymbol)this.symbol.clone();
+		copy.symbol = this.symbol.clone();
 		if (correlatedReferences != null) {
 			copy.correlatedReferences = correlatedReferences.clone();
 		}
 	}
 
 	@Override
-	public void collectGroups(Collection groups) {
+	public void collectGroups(Collection<GroupSymbol> groups) {
 		groups.add(getGroupSymbol());
 	}
 	

Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/TextTable.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/TextTable.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/TextTable.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -155,7 +155,7 @@
 	}
 
 	@Override
-	public TextTable clone() {
+	protected TextTable cloneDirect() {
 		TextTable clone = new TextTable();
 		this.copy(clone);
 		clone.setDelimiter(this.delimiter);

Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/UnaryFromClause.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/UnaryFromClause.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/UnaryFromClause.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -74,7 +74,7 @@
      * Collect all GroupSymbols for this from clause.
      * @param groups Groups to add to
      */
-    public void collectGroups(Collection groups) {
+    public void collectGroups(Collection<GroupSymbol> groups) {
         groups.add(this.group);    
     }
 	
@@ -121,15 +121,12 @@
 	 * Get deep clone of object
 	 * @return Deep copy of the object
 	 */
-	public Object clone() {
+	public FromClause cloneDirect() {
 	    GroupSymbol copyGroup = null;
 	    if(this.group != null) { 
-	        copyGroup = (GroupSymbol) this.group.clone();
+	        copyGroup = this.group.clone();
 	    }
         UnaryFromClause clonedUnaryFromClause = new UnaryFromClause(copyGroup);
-        clonedUnaryFromClause.setOptional(this.isOptional());
-        clonedUnaryFromClause.setMakeDep(this.isMakeDep());
-        clonedUnaryFromClause.setMakeNotDep(this.isMakeNotDep());
         if (this.expandedCommand != null) {
         	clonedUnaryFromClause.setExpandedCommand((Command)this.expandedCommand.clone());
         }

Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/XMLTable.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/XMLTable.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/XMLTable.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -2,7 +2,6 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.List;
 
 import net.sf.saxon.sxpath.XPathExpression;
@@ -170,7 +169,7 @@
 	}
 
 	@Override
-	public XMLTable clone() {
+	protected XMLTable cloneDirect() {
 		XMLTable clone = new XMLTable();
 		this.copy(clone);
 		for (XMLColumn column : columns) {
@@ -195,11 +194,6 @@
 	}
 
 	@Override
-	public void collectGroups(Collection groups) {
-		groups.add(getGroupSymbol());
-	}
-	
-	@Override
 	public boolean equals(Object obj) {
 		if (obj == this) {
 			return true;

Modified: trunk/engine/src/main/java/org/teiid/query/sql/util/ValueIteratorSource.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/util/ValueIteratorSource.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/sql/util/ValueIteratorSource.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -50,5 +50,9 @@
     ValueIterator getValueIterator(Expression valueExpression) throws TeiidComponentException;
     
     Set<Object> getCachedSet(Expression valueExpression) throws TeiidComponentException, TeiidProcessingException;
-    
+
+	void setUnused(boolean unused);
+
+	boolean isUnused();
+
 }

Modified: trunk/engine/src/main/java/org/teiid/query/sql/visitor/PredicateCollectorVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/visitor/PredicateCollectorVisitor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/sql/visitor/PredicateCollectorVisitor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -45,14 +45,14 @@
  */
 public class PredicateCollectorVisitor extends LanguageVisitor {
 
-    private Collection predicates;
+    private Collection<Criteria> predicates;
 
     /**
      * Construct a new visitor with the default collection type, which is a
      * {@link java.util.ArrayList}.
      */
     public PredicateCollectorVisitor() {
-        this.predicates = new ArrayList();
+        this.predicates = new ArrayList<Criteria>();
     }
 
     /**
@@ -136,7 +136,7 @@
      * Get a collection of predicates discovered while visiting.
      * @return Collection of {@link org.teiid.query.sql.lang.PredicateCriteria} subclasses.
      */
-    public Collection getPredicates() {
+    public Collection<Criteria> getPredicates() {
         return this.predicates;
     }
 
@@ -144,7 +144,7 @@
      * Helper to quickly get the predicates from obj
      * @param obj Language object
      */
-    public static final Collection getPredicates(LanguageObject obj) {
+    public static final Collection<Criteria> getPredicates(LanguageObject obj) {
         PredicateCollectorVisitor visitor = new PredicateCollectorVisitor();
         if(obj != null) {
             PreOrderNavigator.doVisit(obj, visitor);

Modified: trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -447,7 +447,7 @@
     }
 
     public void visit( JoinPredicate obj ) {
-        addOptionComment(obj);
+        addHintComment(obj);
 
         if (obj.hasHint()) {
             append("(");//$NON-NLS-1$
@@ -506,29 +506,31 @@
         if (obj.hasHint()) {
             append(")"); //$NON-NLS-1$
         }
-        addFromClasueDepOptions(obj);
     }
 
-    private void addFromClasueDepOptions( FromClause obj ) {
-        if (obj.isMakeDep()) {
+    private void addHintComment( FromClause obj ) {
+    	if (obj.hasHint()) {
+    		append(BEGIN_HINT);
             append(SPACE);
-            append(Option.MAKEDEP);
-        }
-        if (obj.isMakeNotDep()) {
-            append(SPACE);
-            append(Option.MAKENOTDEP);
-        }
-    }
-
-    private void addOptionComment( FromClause obj ) {
-        if (obj.isOptional()) {
-            append(BEGIN_HINT);
-            append(SPACE);
-            append(Option.OPTIONAL);
-            append(SPACE);
+            if (obj.isOptional()) {
+                append(Option.OPTIONAL);
+                append(SPACE);
+            }
+            if (obj.isMakeDep()) {
+                append(Option.MAKEDEP);
+                append(SPACE);
+            }
+            if (obj.isMakeNotDep()) {
+                append(Option.MAKENOTDEP);
+                append(SPACE);
+            }
+            if (obj.isMakeInd()) {
+                append(FromClause.MAKEIND);
+                append(SPACE);
+            }
             append(END_HINT);
             append(SPACE);
-        }
+    	}
     }
 
     public void visit( JoinType obj ) {
@@ -1046,7 +1048,7 @@
     }
 
     public void visit( SubqueryFromClause obj ) {
-        addOptionComment(obj);
+        addHintComment(obj);
         if (obj.isTable()) {
             append(TABLE);
         }
@@ -1055,7 +1057,6 @@
         append(")");//$NON-NLS-1$
         append(" AS ");//$NON-NLS-1$
         append(obj.getOutputName());
-        addFromClasueDepOptions(obj);
     }
 
     public void visit( SubquerySetCriteria obj ) {
@@ -1076,9 +1077,8 @@
     }
 
     public void visit( UnaryFromClause obj ) {
-        addOptionComment(obj);
+        addHintComment(obj);
         visitNode(obj.getGroup());
-        addFromClasueDepOptions(obj);
     }
 
     public void visit( Update obj ) {
@@ -1569,6 +1569,13 @@
             append(SubqueryHint.NOUNNEST);
             append(SPACE);
             append(END_HINT);
+    	} else if (hint.isDepJoin()) {
+    		append(SPACE);
+        	append(BEGIN_HINT);
+            append(SPACE);
+            append(SubqueryHint.DJ);
+            append(SPACE);
+            append(END_HINT);
         } else if (hint.isMergeJoin()) {
             append(SPACE);
         	append(BEGIN_HINT);
@@ -1711,6 +1718,7 @@
 
     @Override
     public void visit( TextTable obj ) {
+        addHintComment(obj);
         append("TEXTTABLE("); //$NON-NLS-1$
         visitNode(obj.getFile());
         append(SPACE);
@@ -1771,6 +1779,7 @@
 
     @Override
     public void visit( XMLTable obj ) {
+        addHintComment(obj);
         append("XMLTABLE("); //$NON-NLS-1$
         if (obj.getNamespaces() != null) {
             visitNode(obj.getNamespaces());
@@ -1936,6 +1945,7 @@
     
     @Override
     public void visit(ArrayTable obj) {
+        addHintComment(obj);
     	append("ARRAYTABLE("); //$NON-NLS-1$
         visitNode(obj.getArrayValue());
         append(SPACE);

Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -33,6 +33,7 @@
 
 import javax.security.auth.Subject;
 
+import org.teiid.adminapi.Session;
 import org.teiid.api.exception.query.QueryProcessingException;
 import org.teiid.common.buffer.BufferManager;
 import org.teiid.core.TeiidComponentException;
@@ -40,6 +41,7 @@
 import org.teiid.dqp.internal.process.PreparedPlan;
 import org.teiid.dqp.internal.process.SessionAwareCache;
 import org.teiid.dqp.internal.process.SessionAwareCache.CacheID;
+import org.teiid.dqp.message.RequestID;
 import org.teiid.metadata.FunctionMethod.Determinism;
 import org.teiid.query.QueryPlugin;
 import org.teiid.query.eval.SecurityFunctionEvaluator;
@@ -117,6 +119,10 @@
 	    private int userRequestSourceConcurrency;
 	    private Subject subject;
 	    private HashSet<Object> dataObjects;
+
+		public Session session;
+
+		public RequestID requestId;
 	}
 	
 	private GlobalState globalState = new GlobalState();
@@ -567,4 +573,22 @@
 		this.dataObjects = dataObjectsAccessed;
 	}
 	
+	@Override
+	public Session getSession() {
+		return this.globalState.session;
+	}
+	
+	public void setSession(Session session) {
+		this.globalState.session = session;
+	}
+	
+	@Override
+	public String getRequestId() {
+		return this.globalState.requestId != null ? this.globalState.requestId.toString() : null;
+	}
+	
+	public void setRequestId(RequestID requestId) {
+		this.globalState.requestId = requestId;
+	}
+	
 }

Modified: trunk/engine/src/main/java/org/teiid/security/Credentials.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/security/Credentials.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/java/org/teiid/security/Credentials.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -26,7 +26,9 @@
 
 public class Credentials implements Serializable {
     
-    private char[] credentials = null;
+	private static final long serialVersionUID = 7453114713211221240L;
+	
+	private char[] credentials = null;
     
     /**
      * Construct a new PasswordCredentials 

Modified: trunk/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/org/teiid/query/i18n.properties	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/main/resources/org/teiid/query/i18n.properties	2011-06-05 01:32:10 UTC (rev 3218)
@@ -131,6 +131,7 @@
 ERR.015.008.0068= Could not find a common type to which all {0} expressions can be implicitly converted: {1}
 ERR.015.008.0070= Aliased Select Symbols are not valid in XML Queries.
 XMLQueryResolver.no_expressions_in_select=Expressions cannot be selected by XML Queries
+XMLQueryResolver.aliased_subquery=Aliased subquery contexts are not allowed: {0}
 
 # sql (010)
 ERR.015.010.0001= Invalid compare operator: {0}
@@ -697,7 +698,7 @@
 XMLQueryResolver.xml_only_valid_alone=If any symbol in SELECT clause is ''xml'' or group.''xml'' , then no other element is allowed.
 ResolveVariablesVisitor.datatype_for_the_expression_not_resolvable=The datatype for the expression was not resolvable.
 TempTableResolver.unqualified_name_required=Cannot create temporary table "{0}". Local temporary tables must be created with unqualified names.
-TempTableResolver.table_already_exists=Cannot create temporary table "{0}". A table with the same name already exists.
+TempTableResolver.table_already_exists=Cannot create temporary table "{0}". An object with the same name already exists.
 ValidationVisitor.drop_of_nontemptable=Cannot drop a non temporary table "{0}".							
 ValidationVisitor.orderby_expression_xml=XML queries cannot order by an expression.
 ValidationVisitor.text_table_invalid_width=For a fixed width text table, all columns must have width set.
@@ -779,6 +780,9 @@
 TempTableStore.table_doesnt_exist_error=Temporary table "{0}" does not exist.
 
 XMLQueryPlanner.cannot_plan=Cannot create a query for MappingClass with user criteria {0}
+XMLQueryPlanner.invalid_relationship=Conjunct "{0}" has no relationship with target context {1}.
+XMLQueryPlanner.non_simple_relationship=Conjunct "{0}" has a non-simple relationship to its parent through context {1}.
+
 CriteriaPlanner.staging_context=Staging table criteria cannot contian context functions
 CriteriaPlanner.multiple_staging=Staging table criteria {0} was not specified against a single staging table
 CriteriaPlanner.invalid_context=Element {0} is not in the scope of the context {1}

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestConnectorWorkItem.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestConnectorWorkItem.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestConnectorWorkItem.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestElementImpl.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestElementImpl.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestElementImpl.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestGroupImpl.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestGroupImpl.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestGroupImpl.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestInsertImpl.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestInsertImpl.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestInsertImpl.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestMetadataFactory.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestMetadataFactory.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestMetadataFactory.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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;
+ at 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: trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TstLanguageBridgeFactory.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TstLanguageBridgeFactory.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TstLanguageBridgeFactory.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestAuthorizationValidationVisitor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestAuthorizationValidationVisitor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestAuthorizationValidationVisitor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -29,29 +29,27 @@
 import java.util.HashSet;
 import java.util.Set;
 
+import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.teiid.adminapi.DataPolicy;
 import org.teiid.adminapi.DataPolicy.PermissionType;
 import org.teiid.adminapi.impl.DataPolicyMetadata;
+import org.teiid.adminapi.impl.SessionMetadata;
 import org.teiid.adminapi.impl.VDBMetaData;
 import org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData;
 import org.teiid.api.exception.query.QueryParserException;
 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.util.CommandContext;
 import org.teiid.query.validator.Validator;
 import org.teiid.query.validator.ValidatorFailure;
 import org.teiid.query.validator.ValidatorReport;
@@ -60,6 +58,11 @@
 public class TestAuthorizationValidationVisitor {
 
     public static final String CONN_ID = "connID"; //$NON-NLS-1$
+    private static CommandContext context = new CommandContext();
+    
+    @BeforeClass public static void oneTimeSetup() {
+    	context.setSession(new SessionMetadata());
+    }
 
     PermissionMetaData addResource(PermissionType type, boolean flag, String resource) {
     	PermissionMetaData p = new PermissionMetaData();
@@ -133,7 +136,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 +156,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;
     }
@@ -174,7 +180,7 @@
         HashMap<String, DataPolicy> policies = new HashMap<String, DataPolicy>();
         policies.put(policy.getName(), policy);
         
-        AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(policies, "test"); //$NON-NLS-1$
+        AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(policies, context); //$NON-NLS-1$
         visitor.setAllowFunctionCallsByDefault(false);
         ValidatorReport report = Validator.validate(command, metadata, visitor);
         if(report.hasItems()) {
@@ -199,133 +205,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$
+		AuthorizationValidationVisitor mvvv = new AuthorizationValidationVisitor(new HashMap<String, DataPolicy>(), context); //$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: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCallableStatement.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCallableStatement.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCallableStatement.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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());
 	}
 
 }


Property changes on: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCallableStatement.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestConnectorCapabilitiesFinder.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestConnectorCapabilitiesFinder.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestConnectorCapabilitiesFinder.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -22,11 +22,11 @@
 
 package org.teiid.dqp.internal.process;
 
+import static org.junit.Assert.*;
+
 import java.util.ArrayList;
-import java.util.List;
 
-import junit.framework.TestCase;
-
+import org.junit.Test;
 import org.mockito.Mockito;
 import org.teiid.adminapi.impl.ModelMetaData;
 import org.teiid.adminapi.impl.VDBMetaData;
@@ -34,26 +34,18 @@
 import org.teiid.dqp.internal.datamgr.CapabilitiesConverter;
 import org.teiid.dqp.internal.datamgr.ConnectorManager;
 import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
-import org.teiid.metadata.FunctionMethod;
-import org.teiid.metadata.FunctionParameter;
 import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
 import org.teiid.query.optimizer.capabilities.SourceCapabilities;
 import org.teiid.translator.ExecutionFactory;
+import org.teiid.translator.TranslatorException;
 
 
 /**
  */
-public class TestConnectorCapabilitiesFinder extends TestCase {
+ at SuppressWarnings("nls")
+public class TestConnectorCapabilitiesFinder {
 
-    /**
-     * Constructor for TestConnectorCapabilitiesFinder.
-     * @param name
-     */
-    public TestConnectorCapabilitiesFinder(String name) {
-        super(name);
-    }
-
-    public void testFind() throws Exception {
+    @Test public void testFind() throws Exception {
         String modelName = "model"; //$NON-NLS-1$
         String functionName = "fakeFunction"; //$NON-NLS-1$
         
@@ -84,19 +76,17 @@
     }
 
     
-    public void testPushdownFunctionSupport() throws Exception {
+    @Test public void testPushdownFunctionSupport() throws Exception {
     	ExecutionFactory<Object, Object> ef  = new ExecutionFactory<Object, Object>(){
-    	    public List<FunctionMethod> getPushDownFunctions(){
-    	    	ArrayList<FunctionMethod> list = new ArrayList<FunctionMethod>();
-    	    	list.add(new FunctionMethod("ns.func", "function", "misc",   //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    	                new FunctionParameter[] {
-    	                new FunctionParameter("param", DataTypeManager.DefaultDataTypes.STRING, "")}, //$NON-NLS-1$ //$NON-NLS-2$
-    	                new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, "" ) )); //$NON-NLS-1$ //$NON-NLS-2$    	    	
-    	    	return list;
-    	    }    		
+    		
+    		@Override
+    		public void start() throws TranslatorException {
+    			super.start();
+    			addPushDownFunction("ns", "func", DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING);
+    		}
     	};
-    	
+    	ef.start();
     	BasicSourceCapabilities bsc = CapabilitiesConverter.convertCapabilities(ef, "conn"); //$NON-NLS-1$
-        assertEquals("Did not get expected capabilities", true, bsc.supportsFunction("ns.func")); //$NON-NLS-1$ //$NON-NLS-2$
+        assertTrue("Did not get expected capabilities", bsc.supportsFunction("ns.func")); //$NON-NLS-1$ //$NON-NLS-2$
     }
 }

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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$
 


Property changes on: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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());


Property changes on: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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;
+	}
 }


Property changes on: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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());
     }
     
 }


Property changes on: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -30,6 +30,7 @@
 import org.teiid.client.RequestMessage;
 import org.teiid.client.RequestMessage.StatementType;
 import org.teiid.common.buffer.BufferManager;
+import org.teiid.common.buffer.BufferManagerFactory;
 import org.teiid.core.TeiidComponentException;
 import org.teiid.core.TeiidProcessingException;
 import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
@@ -41,7 +42,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,16 +71,16 @@
      * @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.initialize(message, BufferManagerFactory.getStandaloneBufferManager(), null,new FakeTransactionService(), TEMP_TABLE_STORE, workContext, null); 
         request.initMetadata();
         request.setAuthorizationValidator(new DataRoleAuthorizationValidator(true, true, true));
         request.validateAccess(command);
@@ -94,12 +95,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 +111,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 +148,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());


Property changes on: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestWorkItemState.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestWorkItemState.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestWorkItemState.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -25,10 +25,20 @@
 import static org.junit.Assert.*;
 
 import org.junit.Test;
+import org.teiid.dqp.internal.process.AbstractWorkItem.ThreadState;
 
 
 public class TestWorkItemState {
 	
+	private final class WorkItemRunner implements Runnable {
+		TestWorkItem workItem;
+
+		@Override
+		public void run() {
+			workItem.run();
+		}
+	}
+
 	private class TestWorkItem extends AbstractWorkItem {
 
 		private boolean isDone;
@@ -40,7 +50,11 @@
 		}
 		
 		private TestWorkItem(boolean done, boolean callMoreWork) {
-			super(false);
+			this(done, callMoreWork, null);
+		}
+		
+		private TestWorkItem(boolean done, boolean callMoreWork, Thread callingThread) {
+			super(callingThread);
 			this.isDone = done;
 			this.callMoreWork = callMoreWork;
 		}
@@ -152,5 +166,27 @@
     		
     	}
     }
+    
+    @Test public void testUsingCallingThreadIdle() throws Exception {
+    	WorkItemRunner r = new WorkItemRunner();
+    	Thread t = new Thread(r);
+    	final TestWorkItem item = new TestWorkItem(false, false, t) {
+    		@Override
+    		protected boolean shouldPause() {
+    			return true;
+    		}
+    	};
+    	r.workItem = item;
+    	t.start();
+		for (int i = 0; i < 10 && item.getThreadState() != ThreadState.IDLE; i++) {
+			Thread.sleep(100);
+		}
+		if (item.getThreadState() != ThreadState.IDLE) {
+			fail();
+		}
+		item.moreWork();
+		//if we don't return from this call, that means that this thread has been hijacked -
+		//we should instead use t.
+    }
         
 }


Property changes on: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestWorkItemState.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceElementReplacementVisitor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceElementReplacementVisitor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceElementReplacementVisitor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceMetadataWrapper.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceMetadataWrapper.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceMetadataWrapper.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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());
     }
 
 }


Property changes on: trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Modified: trunk/engine/src/test/java/org/teiid/query/function/TestFunctionLibrary.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/function/TestFunctionLibrary.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/function/TestFunctionLibrary.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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$ 


Property changes on: trunk/engine/src/test/java/org/teiid/query/function/TestFunctionLibrary.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/function/TestFunctionLibrary.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/function/TestFunctionTree.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/function/TestFunctionTree.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/function/TestFunctionTree.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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() {


Property changes on: trunk/engine/src/test/java/org/teiid/query/function/TestFunctionTree.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/function/TestFunctionTree.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/function/TestResolvedFunctions.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/function/TestResolvedFunctions.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/function/TestResolvedFunctions.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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);
     }
     


Property changes on: trunk/engine/src/test/java/org/teiid/query/function/TestResolvedFunctions.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/function/TestResolvedFunctions.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/mapping/xml/TestMappingElement.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/mapping/xml/TestMappingElement.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/mapping/xml/TestMappingElement.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -232,7 +232,7 @@
     public void testAddNullStagingTable() {        
         MappingElement element = new MappingElement("Test"); //$NON-NLS-1$
         element.addStagingTable(null);
-        List stagingTables = element.getStagingTables();
+        List<String> stagingTables = element.getStagingTables();
         assertTrue(stagingTables.isEmpty());
     } 
 }

Modified: trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/optimizer/TestAccessPatterns.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestAccessPatterns.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestAccessPatterns.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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[] {


Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestAccessPatterns.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestAccessPatterns.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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$
@@ -236,7 +235,7 @@
         ProcessorPlan plan = TestOptimizer.helpPlan(sql,  
                                       metadata,
                                       null, getAggregatesFinder(),
-                                      new String[] {"SELECT g_0.p_productid AS c_0 FROM m2.product AS g_0 WHERE g_0.p_divid = 100 ORDER BY c_0", "SELECT g_0.o_productid AS c_0, g_0.o_dealerid AS c_1, SUM(g_0.o_amount) AS c_2 FROM m1.\"order\" AS g_0, m1.dealer AS g_1 WHERE (g_0.o_dealerid = g_1.d_dealerid) AND (g_1.d_state = 'CA') AND (g_0.o_productid IN (<dependent values>)) GROUP BY g_0.o_productid, g_0.o_dealerid ORDER BY c_0"},  //$NON-NLS-1$ //$NON-NLS-2$
+                                      new String[] {"SELECT g_0.p_productid AS c_0 FROM m2.product AS g_0 WHERE g_0.p_divid = 100 ORDER BY c_0", "SELECT g_0.o_productid, g_0.o_dealerid, SUM(g_0.o_amount) FROM m1.\"order\" AS g_0, m1.dealer AS g_1 WHERE (g_0.o_dealerid = g_1.d_dealerid) AND (g_1.d_state = 'CA') AND (g_0.o_productid IN (<dependent values>)) GROUP BY g_0.o_productid, g_0.o_dealerid"},  //$NON-NLS-1$ //$NON-NLS-2$
                                                     TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING );
 
         TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -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$
@@ -266,7 +265,7 @@
         ProcessorPlan plan = TestOptimizer.helpPlan(sql,  
                                       metadata,
                                       null, getAggregatesFinder(),
-                                      new String[] {"SELECT g_0.p_productid AS c_0 FROM m2.product AS g_0 WHERE g_0.p_divid = 100 ORDER BY c_0", "SELECT g_0.o_productid AS c_0, g_0.o_dealerid AS c_1, MAX(g_0.o_amount) AS c_2, SUM(g_0.o_amount) AS c_3 FROM m1.\"order\" AS g_0, m1.dealer AS g_1 WHERE (g_0.o_dealerid = g_1.d_dealerid) AND (g_1.d_state = 'CA') AND (g_0.o_productid IN (<dependent values>)) GROUP BY g_0.o_productid, g_0.o_dealerid ORDER BY c_0"},  //$NON-NLS-1$ //$NON-NLS-2$
+                                      new String[] {"SELECT g_0.p_productid AS c_0 FROM m2.product AS g_0 WHERE g_0.p_divid = 100 ORDER BY c_0", "SELECT g_0.o_productid, g_0.o_dealerid, MAX(g_0.o_amount), SUM(g_0.o_amount) FROM m1.\"order\" AS g_0, m1.dealer AS g_1 WHERE (g_0.o_dealerid = g_1.d_dealerid) AND (g_1.d_state = 'CA') AND (g_0.o_productid IN (<dependent values>)) GROUP BY g_0.o_productid, g_0.o_dealerid"},  //$NON-NLS-1$ //$NON-NLS-2$
                                                     TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING );
 
         TestOptimizer.checkNodeTypes(plan, new int[] {
@@ -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 );


Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestAnsiJoinPushdown.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestAnsiJoinPushdown.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestAnsiJoinPushdown.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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$


Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestAnsiJoinPushdown.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestAnsiJoinPushdown.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestBatchedUpdatePlanner.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestBatchedUpdatePlanner.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestBatchedUpdatePlanner.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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++) {


Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestBatchedUpdatePlanner.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestBatchedUpdatePlanner.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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");


Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestExpressionsInGroupBy.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestExpressionsInGroupBy.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestExpressionsInGroupBy.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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 );


Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestExpressionsInGroupBy.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestExpressionsInGroupBy.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestInlineView.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestInlineView.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestInlineView.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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$


Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestInlineView.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestInlineView.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestJoinOptimization.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestJoinOptimization.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestJoinOptimization.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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, null 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"}); 
 


Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestJoinOptimization.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestJoinOptimization.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestJoinPushdownRestrictions.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestJoinPushdownRestrictions.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestJoinPushdownRestrictions.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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$   
 	}
 	


Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestJoinPushdownRestrictions.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestJoinPushdownRestrictions.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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


Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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$
   	}
 
@@ -936,16 +856,16 @@
     
     @Test public void testPushCriteriaThroughUnion11() {
         helpPlan("select * from vm1.u8 where const = 's3' or e1 is null", example1(), //$NON-NLS-1$
-            new String[] { "SELECT 's3', e1 FROM pm1.g3", //$NON-NLS-1$
-                            "SELECT 's2', e1 FROM pm1.g2 WHERE e1 IS NULL", //$NON-NLS-1$
-                            "SELECT 's1', e1 FROM pm1.g1 WHERE e1 IS NULL" } );     //$NON-NLS-1$
+            new String[] { "SELECT e1 FROM pm1.g3", //$NON-NLS-1$
+                            "SELECT e1 FROM pm1.g2 WHERE e1 IS NULL", //$NON-NLS-1$
+                            "SELECT e1 FROM pm1.g1 WHERE e1 IS NULL" } );     //$NON-NLS-1$
     }
 
     @Test public void testPushCriteriaThroughUnion12() {
         helpPlan("select * from vm1.u8 where const = 's1' or e1 is null", example1(), //$NON-NLS-1$
-            new String[] { "SELECT 's3', e1 FROM pm1.g3 WHERE e1 IS NULL", //$NON-NLS-1$
-                            "SELECT 's2', e1 FROM pm1.g2 WHERE e1 IS NULL", //$NON-NLS-1$
-                            "SELECT 's1', e1 FROM pm1.g1" } );     //$NON-NLS-1$
+            new String[] { "SELECT e1 FROM pm1.g3 WHERE e1 IS NULL", //$NON-NLS-1$
+                            "SELECT e1 FROM pm1.g2 WHERE e1 IS NULL", //$NON-NLS-1$
+                            "SELECT e1 FROM pm1.g1" } );     //$NON-NLS-1$
     }
 
     /** defect #4997 */
@@ -1096,8 +1016,8 @@
     
     @Test public void testDefect6425_1() {
         helpPlan("select * from vm1.u9", example1(), //$NON-NLS-1$
-            new String[] { "SELECT e1, e1 FROM pm1.g1", //$NON-NLS-1$
-                            "SELECT e1, e1 FROM pm1.g2" } );     //$NON-NLS-1$
+            new String[] { "SELECT e1 FROM pm1.g1", //$NON-NLS-1$
+                            "SELECT e1 FROM pm1.g2" } );     //$NON-NLS-1$
     }
 
     @Test public void testDefect6425_2() {
@@ -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,10 +3387,10 @@
 
     // 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, IntKey FROM BQT1.SmallA WHERE IntKey = 0"  }); //$NON-NLS-1$ 
+                "SELECT IntKey FROM BQT1.SmallA WHERE IntKey = 0"  }); //$NON-NLS-1$ 
 
         checkNodeTypes(plan, new int[] {
             2,      // Access
@@ -3529,10 +3412,10 @@
 
     // 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, IntKey FROM BQT1.SmallA WHERE IntKey = 0"  }); //$NON-NLS-1$ 
+                "SELECT IntKey FROM BQT1.SmallA WHERE IntKey = 0"  }); //$NON-NLS-1$ 
 
         checkNodeTypes(plan, new int[] {
             2,      // Access
@@ -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,14 +5285,14 @@
         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$
 
         ProcessorPlan plan = helpPlan(sql,  
                                       metadata,
                                       null, capFinder,
-                                      new String[] {"SELECT g_0.intkey, g_0.intkey FROM bqt1.smalla AS g_0 ORDER BY g_0.intkey"},  //$NON-NLS-1$
+                                      new String[] {"SELECT g_0.intkey FROM bqt1.smalla AS g_0 ORDER BY g_0.intkey"},  //$NON-NLS-1$
                                       ComparisonMode.EXACT_COMMAND_STRING );
 
         checkNodeTypes(plan, FULL_PUSHDOWN);
@@ -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,14 +5547,14 @@
         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$ 
          
         helpPlan(sql,  
                                       metadata, 
                                       null, capFinder, 
-                                      new String[] {"SELECT '1', g_0.intkey, '2', g_1.IntKey FROM bqt2.smalla AS g_0, bqt2.smalla AS g_1 WHERE g_0.intkey = g_1.IntKey"},  //$NON-NLS-1$ 
+                                      new String[] {"SELECT g_0.intkey, g_1.IntKey FROM bqt2.smalla AS g_0, bqt2.smalla AS g_1 WHERE g_0.intkey = g_1.IntKey"},  //$NON-NLS-1$ 
                                       ComparisonMode.EXACT_COMMAND_STRING ); 
              
     } 
@@ -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,
@@ -6020,16 +5901,12 @@
         helpTestCase2430and2507(sql, expected);
     }     
 
-    /*
-     * If expressionsymbol comparison would ignore expression names then this should just select a single column,
-     * but for now it will select 2.
-     */
     @Test public void testCase2430E() {
         String sql = "SELECT CONCAT(bqt1.smalla.stringKey, bqt1.smalla.stringNum) as c1234567890123456789012345678901234567890, " + //$NON-NLS-1$
                      "CONCAT(bqt1.smalla.stringKey, bqt1.smalla.stringNum) AS EXPR FROM bqt1.smalla ORDER BY c1234567890123456789012345678901234567890, EXPR "; //$NON-NLS-1$
 
-        String expected = "SELECT CONCAT(bqt1.smalla.stringKey, bqt1.smalla.stringNum) AS c1234567890123456789012345678901234567890, CONCAT(bqt1.smalla.stringKey, bqt1.smalla.stringNum) " + //$NON-NLS-1$
-                     "FROM bqt1.smalla ORDER BY c1234567890123456789012345678901234567890"; //$NON-NLS-1$
+        String expected = "SELECT CONCAT(bqt1.smalla.stringKey, bqt1.smalla.stringNum) AS c_0 " + //$NON-NLS-1$
+                     "FROM bqt1.smalla ORDER BY c_0"; //$NON-NLS-1$
         helpTestCase2430and2507(sql, expected);
     }     
     
@@ -6037,8 +5914,8 @@
         String sql = "SELECT CONCAT(bqt1.smalla.stringKey, bqt1.smalla.stringNum) as c1234567890123456789012345678901234567890, " + //$NON-NLS-1$
                      "CONCAT(bqt1.smalla.stringKey, bqt1.smalla.stringNum) AS EXPR FROM bqt1.smalla ORDER BY c1234567890123456789012345678901234567890"; //$NON-NLS-1$
 
-        String expected = "SELECT CONCAT(bqt1.smalla.stringKey, bqt1.smalla.stringNum) AS c1234567890123456789012345678901234567890, CONCAT(bqt1.smalla.stringKey, bqt1.smalla.stringNum) " + //$NON-NLS-1$
-                     "FROM bqt1.smalla ORDER BY c1234567890123456789012345678901234567890"; //$NON-NLS-1$
+        String expected = "SELECT CONCAT(bqt1.smalla.stringKey, bqt1.smalla.stringNum) AS c_0 " + //$NON-NLS-1$
+                     "FROM bqt1.smalla ORDER BY c_0"; //$NON-NLS-1$
         helpTestCase2430and2507(sql, expected);
     }  
     
@@ -6058,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,
@@ -6088,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[] {
@@ -6125,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$
@@ -6156,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$
@@ -6174,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$
         
@@ -6210,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$ 
          
@@ -6228,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$
@@ -6263,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$
@@ -6293,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
@@ -6307,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
@@ -6323,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
@@ -6344,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$
         
@@ -6384,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();
@@ -6432,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$
         
@@ -6450,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); 
@@ -6464,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); 
@@ -6480,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[] {
@@ -6504,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[] {});
     }
     
     /**
@@ -6517,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$
     }
 
@@ -6538,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);
     }
@@ -6562,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);
     }
@@ -6587,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);
     }
@@ -6612,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[] {});
     }
          
     /**
@@ -6637,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[] {});
     }
 
     /**
@@ -6657,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$
     }
          
     /**
@@ -6679,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$
 
@@ -6706,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$
     }
     


Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptionalJoins.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptionalJoins.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptionalJoins.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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[] { 


Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptionalJoins.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestOptionalJoins.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestPartitionedJoinPlanning.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestPartitionedJoinPlanning.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestPartitionedJoinPlanning.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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;
 
-
+ at 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,


Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestPartitionedJoinPlanning.java
___________________________________________________________________
Modified: svn:mergeinfo
   - 
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestPartitionedJoinPlanning.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestRuleMergeVirtual.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestRuleMergeVirtual.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestRuleMergeVirtual.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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,16 +84,16 @@
     
     @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, 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$
+                                          "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$
     
         TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);                                    
     }
     
     @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$
     


Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestRuleMergeVirtual.java
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestRuleMergeVirtual.java:3149-3171
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestRuleMergeVirtual.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestRuleRaiseNull.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestRuleRaiseNull.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestRuleRaiseNull.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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,8 +67,8 @@
 
         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(),
-                                      new String[] {"SELECT intkey, null, intnum FROM bqt1.smalla WHERE intkey = 1"} ); //$NON-NLS-1$
+        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,15 +106,15 @@
 
         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,  
-                                                    new String[]{"SELECT null, bqt1.smalla.intkey FROM bqt1.smalla"}, true); //$NON-NLS-1$
+        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);
     }
     
     @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,8 +132,8 @@
     @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(),  
-                                                    new String[]{"SELECT 1, intkey FROM bqt1.smallb", "SELECT IntNum, null FROM bqt1.smalla"}); //$NON-NLS-1$ //$NON-NLS-2$
+        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
             0,      // DependentAccess
@@ -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,15 +163,15 @@
     @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(),  
-                                                    new String[]{"SELECT 1, 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$
+        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);
     }
     
     @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
@@ -201,12 +201,12 @@
     
     @Test public void testPushCriteriaThroughUnion9() {
         TestOptimizer.helpPlan("select * from vm1.u8 where const = 's1'", TestOptimizer.example1(), //$NON-NLS-1$
-            new String[] { "SELECT 's1', e1 FROM pm1.g1" } );     //$NON-NLS-1$
+            new String[] { "SELECT e1 FROM pm1.g1" } );     //$NON-NLS-1$
     }
 
     @Test public void testPushCriteriaThroughUnion10() {
         TestOptimizer.helpPlan("select * from vm1.u8 where const = 's3'", TestOptimizer.example1(), //$NON-NLS-1$
-            new String[] { "SELECT 's3', e1 FROM pm1.g3" } );     //$NON-NLS-1$
+            new String[] { "SELECT e1 FROM pm1.g3" } );     //$NON-NLS-1$
     }
     
     @Test public void testRaiseNullWithOuterJoinAndHaving() {
@@ -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);
     }


Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestRuleRaiseNull.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestRuleRaiseNull.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestRuleRemoveSorts.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestRuleRemoveSorts.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestRuleRemoveSorts.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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);                                    


Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestRuleRemoveSorts.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestRuleRemoveSorts.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestSortOptimization.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestSortOptimization.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestSortOptimization.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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$
     }
 


Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestSortOptimization.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestSortOptimization.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestStoredProcedurePlanning.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestStoredProcedurePlanning.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestStoredProcedurePlanning.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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


Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestStoredProcedurePlanning.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestStoredProcedurePlanning.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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,70 @@
      * 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 distinct pm1.g1.e1 || 1 FROM pm1.g1)", "SELECT e1 FROM pm3.g1, (SELECT DISTINCT concat(pm1.g1.e1, '1') AS EXPR FROM pm1.g1) AS X__1 WHERE pm3.g1.e1 = X__1.EXPR", RealMetadataFactory.example4());
     }
-    
+
+    @Test public void testSubqueryRewriteToJoin2a() 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 DISTINCT 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 +816,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 +829,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 +837,35 @@
      * @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 testRewriteSubqueryCompare() throws Exception {
+    	TestQueryRewriter.helpTestRewriteCommand("select e1 from pm1.g1 where e1 <> ANY (select e1 from pm1.g1)", "SELECT e1 FROM pm1.g1 WHERE e1 <> SOME (SELECT e1 FROM pm1.g1)", RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+    
+    @Test public void testRewriteSubqueryCompare1() throws Exception {
+    	TestQueryRewriter.helpTestRewriteCommand("select e1 from pm1.g1 where e1 <> ALL (select e1 from pm1.g1)", "SELECT e1 FROM pm1.g1 WHERE e1 NOT IN (SELECT e1 FROM pm1.g1)", RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    @Test public void testRewriteSubqueryCompare2() throws Exception {
+    	TestQueryRewriter.helpTestRewriteCommand("select e1 from pm1.g1 where e1 = ANY (select e1 from pm1.g1)", "SELECT e1 FROM pm1.g1 WHERE e1 IN (SELECT e1 FROM pm1.g1)", RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+    
+    @Test public void testRewriteSubqueryCompare3() throws Exception {
+    	TestQueryRewriter.helpTestRewriteCommand("select e1 from pm1.g1 where e1 = ALL (select e1 from pm1.g1)", "SELECT e1 FROM pm1.g1 WHERE e1 = ALL (SELECT e1 FROM pm1.g1)", RealMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
     @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 +890,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 +914,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 +936,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 +962,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 +988,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 +1020,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 +1030,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


Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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)",


Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/proc/TestProcedurePlanner.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/proc/TestProcedurePlanner.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/proc/TestProcedurePlanner.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/optimizer/relational/TestAliasGenerator.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/relational/TestAliasGenerator.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/relational/TestAliasGenerator.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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());
     }


Property changes on: trunk/engine/src/test/java/org/teiid/query/optimizer/relational/TestAliasGenerator.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/optimizer/relational/TestAliasGenerator.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCalculateCostUtil.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCalculateCostUtil.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCalculateCostUtil.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCapabilitiesUtil.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCapabilitiesUtil.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCapabilitiesUtil.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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 {
+ at 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: trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCriteriaCapabilityValidatorVisitor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCriteriaCapabilityValidatorVisitor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCriteriaCapabilityValidatorVisitor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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.*;
 
-
 /**
  */
+ at 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: trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleAssignOutputElements.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleAssignOutputElements.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleAssignOutputElements.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -22,30 +22,23 @@
 
 package org.teiid.query.optimizer.relational.rules;
 
-import org.teiid.query.optimizer.relational.plantree.*;
-import org.teiid.query.optimizer.relational.rules.RuleAssignOutputElements;
-import org.teiid.query.sql.lang.SetQuery.Operation;
+import static org.junit.Assert.*;
 
-import junit.framework.*;
-
+import org.junit.Test;
+import org.teiid.query.optimizer.relational.plantree.NodeConstants;
+import org.teiid.query.optimizer.relational.plantree.NodeFactory;
+import org.teiid.query.optimizer.relational.plantree.PlanNode;
+import org.teiid.query.sql.lang.SetQuery.Operation;
 /**
  */
-public class TestRuleAssignOutputElements extends TestCase {
+public class TestRuleAssignOutputElements {
 
-    /**
-     * Constructor for TestRuleAssignOutputElements.
-     * @param arg0
-     */
-    public TestRuleAssignOutputElements(String arg0) {
-        super(arg0);
-    }
-
     public void helpTestIsUnionNoAll(PlanNode node, boolean expected) {
         boolean actual = RuleAssignOutputElements.hasDupRemoval(node);
         assertEquals("Got incorrect answer finding no all union", expected, actual); //$NON-NLS-1$
     }
 
-    public void testFindNoAllUnion1() {
+    @Test public void testFindNoAllUnion1() {
         PlanNode projNode = NodeFactory.getNewNode(NodeConstants.Types.PROJECT);        
         PlanNode accessNode = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);        
         projNode.addLastChild(accessNode);
@@ -53,7 +46,7 @@
         helpTestIsUnionNoAll(projNode, false);
     }    
 
-    public void testFindNoAllUnion2() {
+    @Test public void testFindNoAllUnion2() {
         PlanNode unionNode = NodeFactory.getNewNode(NodeConstants.Types.SET_OP);
         unionNode.setProperty(NodeConstants.Info.SET_OPERATION, Operation.UNION);
         unionNode.setProperty(NodeConstants.Info.USE_ALL, Boolean.TRUE);
@@ -70,7 +63,7 @@
         helpTestIsUnionNoAll(unionNode, false);
     }    
     
-    public void testFindNoAllUnion3() {
+    @Test public void testFindNoAllUnion3() {
         PlanNode unionNode = NodeFactory.getNewNode(NodeConstants.Types.SET_OP);
         unionNode.setProperty(NodeConstants.Info.SET_OPERATION, Operation.UNION);
         unionNode.setProperty(NodeConstants.Info.USE_ALL, Boolean.FALSE);
@@ -87,7 +80,7 @@
         helpTestIsUnionNoAll(unionNode, true);
     }    
 
-    public void testFindNoAllUnion4() {
+    @Test public void testFindNoAllUnion4() {
         PlanNode unionNode1 = NodeFactory.getNewNode(NodeConstants.Types.SET_OP);
         unionNode1.setProperty(NodeConstants.Info.SET_OPERATION, Operation.UNION);
         unionNode1.setProperty(NodeConstants.Info.USE_ALL, Boolean.TRUE);

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleChooseDependent.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleChooseDependent.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleChooseDependent.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePlaceAccess.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePlaceAccess.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePlaceAccess.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePushSelectCriteria.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePushSelectCriteria.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePushSelectCriteria.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleValidateWhereAll.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleValidateWhereAll.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleValidateWhereAll.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestMarkExcludeVisitor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestMarkExcludeVisitor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestMarkExcludeVisitor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -26,33 +26,32 @@
 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);
-        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(); 
+        MappingDocument doc = docOrig.clone(); 
         
         doc = XMLPlanner.preMarkExcluded(query, doc);       
         XMLPlanner.removeExcluded(doc);

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestNameInSourceResolverVisitor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestNameInSourceResolverVisitor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestNameInSourceResolverVisitor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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,14 +56,14 @@
     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(); 
+        MappingDocument doc = docOrig.clone(); 
 
         XMLPlannerEnvironment env = new XMLPlannerEnvironment(metadata);
         env.mappingDoc = doc;

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLNodeMappingVisitor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLNodeMappingVisitor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLNodeMappingVisitor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLPlanner.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLPlanner.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLPlanner.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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;
+ at 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. at 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. at 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. at 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: trunk/engine/src/test/java/org/teiid/query/parser/TestOptionsAndHints.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/parser/TestOptionsAndHints.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/parser/TestOptionsAndHints.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -93,7 +93,7 @@
         query.setFrom(from);
         query.setCriteria(crit);
         TestParser.helpTest("Select a From db.g1 MAKENOTDEP, db.g2 AS c MAKENOTDEP WHERE a = b",  //$NON-NLS-1$
-                 "SELECT a FROM db.g1 MAKENOTDEP, db.g2 AS c MAKENOTDEP WHERE a = b",  //$NON-NLS-1$
+                 "SELECT a FROM /*+ MAKENOTDEP */ db.g1, /*+ MAKENOTDEP */ db.g2 AS c WHERE a = b",  //$NON-NLS-1$
                  query);
     }
 
@@ -118,7 +118,7 @@
         query.setSelect(select);
         query.setFrom(from);
         TestParser.helpTest("Select a From db.g1 JOIN db.g2 MAKEDEP ON a = b",  //$NON-NLS-1$
-                 "SELECT a FROM db.g1 INNER JOIN db.g2 MAKEDEP ON a = b",  //$NON-NLS-1$
+                 "SELECT a FROM db.g1 INNER JOIN /*+ MAKEDEP */ db.g2 ON a = b",  //$NON-NLS-1$
                  query);
     } 
     
@@ -143,7 +143,7 @@
         query.setSelect(select);
         query.setFrom(from);
         TestParser.helpTest("Select a From db.g1 MAKEDEP JOIN db.g2 ON a = b",  //$NON-NLS-1$
-                 "SELECT a FROM db.g1 MAKEDEP INNER JOIN db.g2 ON a = b",  //$NON-NLS-1$
+                 "SELECT a FROM /*+ MAKEDEP */ db.g1 INNER JOIN db.g2 ON a = b",  //$NON-NLS-1$
                  query);
     }
 
@@ -174,7 +174,7 @@
         query.setSelect(select);
         query.setFrom(from);
         TestParser.helpTest("Select a From (db.g1 MAKEDEP JOIN db.g2 ON a = b) LEFT OUTER JOIN db.g3 MAKEDEP ON a = c",  //$NON-NLS-1$
-                 "SELECT a FROM (db.g1 MAKEDEP INNER JOIN db.g2 ON a = b) LEFT OUTER JOIN db.g3 MAKEDEP ON a = c",  //$NON-NLS-1$
+                 "SELECT a FROM (/*+ MAKEDEP */ db.g1 INNER JOIN db.g2 ON a = b) LEFT OUTER JOIN /*+ MAKEDEP */ db.g3 ON a = c",  //$NON-NLS-1$
                  query);
     }
 
@@ -203,7 +203,7 @@
         query.setFrom(from);
         query.setCriteria(crit);
         TestParser.helpTest("Select a From db.g1 MAKEDEP, db.g2 AS c MAKEDEP WHERE a = b",  //$NON-NLS-1$
-                 "SELECT a FROM db.g1 MAKEDEP, db.g2 AS c MAKEDEP WHERE a = b",  //$NON-NLS-1$
+                 "SELECT a FROM /*+ MAKEDEP */ db.g1, /*+ MAKEDEP */ db.g2 AS c WHERE a = b",  //$NON-NLS-1$
                  query);
     }
 
@@ -237,7 +237,7 @@
         query.setSelect(select);
         query.setFrom(from);
         TestParser.helpTest("Select a From db.g1 JOIN db.g2 MAKENOTDEP ON a = b",  //$NON-NLS-1$
-                 "SELECT a FROM db.g1 INNER JOIN db.g2 MAKENOTDEP ON a = b",  //$NON-NLS-1$
+                 "SELECT a FROM db.g1 INNER JOIN /*+ MAKENOTDEP */ db.g2 ON a = b",  //$NON-NLS-1$
                  query);
     } 
     
@@ -262,7 +262,7 @@
         query.setSelect(select);
         query.setFrom(from);
         TestParser.helpTest("Select a From db.g1 MAKENOTDEP JOIN db.g2 ON a = b",  //$NON-NLS-1$
-                 "SELECT a FROM db.g1 MAKENOTDEP INNER JOIN db.g2 ON a = b",  //$NON-NLS-1$
+                 "SELECT a FROM /*+ MAKENOTDEP */ db.g1 INNER JOIN db.g2 ON a = b",  //$NON-NLS-1$
                  query);
     }
 
@@ -293,7 +293,7 @@
         query.setSelect(select);
         query.setFrom(from);
         TestParser.helpTest("Select a From (db.g1 MAKENOTDEP JOIN db.g2 ON a = b) LEFT OUTER JOIN db.g3 MAKENOTDEP ON a = c",  //$NON-NLS-1$
-                 "SELECT a FROM (db.g1 MAKENOTDEP INNER JOIN db.g2 ON a = b) LEFT OUTER JOIN db.g3 MAKENOTDEP ON a = c",  //$NON-NLS-1$
+                 "SELECT a FROM (/*+ MAKENOTDEP */ db.g1 INNER JOIN db.g2 ON a = b) LEFT OUTER JOIN /*+ MAKENOTDEP */ db.g3 ON a = c",  //$NON-NLS-1$
                  query);
     }
 
@@ -308,11 +308,11 @@
         From from = new From(Arrays.asList(predicate));
         predicate.getLeftClause().setMakeNotDep(true);
         predicate.getRightClause().setMakeDep(true);
-        Select select = new Select(Arrays.asList(new Object[] {x, y}));
+        Select select = new Select(Arrays.asList(x, y));
         
         Query query = new Query(select, from, null, null, null, null, null);
         TestParser.helpTest("Select a.x, b.y From a MAKENOTDEP INNER JOIN b MAKEDEP ON a.x = func(b.y)",  //$NON-NLS-1$
-                 "SELECT a.x, b.y FROM a MAKENOTDEP INNER JOIN b MAKEDEP ON a.x = func(b.y)",  //$NON-NLS-1$
+                 "SELECT a.x, b.y FROM /*+ MAKENOTDEP */ a INNER JOIN /*+ MAKEDEP */ b ON a.x = func(b.y)",  //$NON-NLS-1$
                  query);
     }
 
@@ -996,7 +996,7 @@
         option.addDependentGroup("a"); //$NON-NLS-1$
         option.addNotDependentGroup("b"); //$NON-NLS-1$
         
-        Select select = new Select(Arrays.asList(new Object[] {x, y}));
+        Select select = new Select(Arrays.asList(x, y));
         
         Criteria criteria = new CompareCriteria(x, CompareCriteria.EQ, y);
         Query query = new Query(select, from, criteria, null, null, null, option);
@@ -1030,7 +1030,7 @@
         query.setSelect(select);
         query.setFrom(from);
         TestParser.helpTest("Select a From (db.g1 JOIN db.g2 ON a = b) makedep LEFT OUTER JOIN db.g3 ON a = c",  //$NON-NLS-1$
-                 "SELECT a FROM (db.g1 INNER JOIN db.g2 ON a = b) MAKEDEP LEFT OUTER JOIN db.g3 ON a = c",  //$NON-NLS-1$
+                 "SELECT a FROM /*+ MAKEDEP */ (db.g1 INNER JOIN db.g2 ON a = b) LEFT OUTER JOIN db.g3 ON a = c",  //$NON-NLS-1$
                  query);
         
         //ensure that the new string form is parsable

Modified: trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -6436,7 +6436,7 @@
     
     @Test public void testLimit() {
         Query query = new Query();
-        Select select = new Select(Arrays.asList(new Object[] {new AllSymbol()}));
+        Select select = new Select(Arrays.asList(new AllSymbol()));
         From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a")))); //$NON-NLS-1$
         query.setSelect(select);
         query.setFrom(from);
@@ -6446,7 +6446,7 @@
     
     @Test public void testLimitWithOffset() {
         Query query = new Query();
-        Select select = new Select(Arrays.asList(new Object[] {new AllSymbol()}));
+        Select select = new Select(Arrays.asList(new AllSymbol()));
         From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a")))); //$NON-NLS-1$
         query.setSelect(select);
         query.setFrom(from);
@@ -6456,7 +6456,7 @@
     
     @Test public void testLimitWithReferences1() {
         Query query = new Query();
-        Select select = new Select(Arrays.asList(new Object[] {new AllSymbol()}));
+        Select select = new Select(Arrays.asList(new AllSymbol()));
         From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a")))); //$NON-NLS-1$
         query.setSelect(select);
         query.setFrom(from);
@@ -6466,7 +6466,7 @@
     
     @Test public void testLimitWithReferences2() {
         Query query = new Query();
-        Select select = new Select(Arrays.asList(new Object[] {new AllSymbol()}));
+        Select select = new Select(Arrays.asList(new AllSymbol()));
         From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a")))); //$NON-NLS-1$
         query.setSelect(select);
         query.setFrom(from);
@@ -6476,7 +6476,7 @@
     
     @Test public void testLimitWithReferences3() {
         Query query = new Query();
-        Select select = new Select(Arrays.asList(new Object[] {new AllSymbol()}));
+        Select select = new Select(Arrays.asList(new AllSymbol()));
         From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a")))); //$NON-NLS-1$
         query.setSelect(select);
         query.setFrom(from);
@@ -6618,9 +6618,9 @@
         String expected = "CREATE PROCEDURE\nBEGIN\nIF(x > 1)\nBEGIN\nSELECT 1;\nEND\nIF(x > 1)\nBEGIN\nSELECT 1;\nEND\nELSE\nBEGIN\nSELECT 1;\nEND\nEND"; //$NON-NLS-1$
         
         Query query = new Query();
-        query.setSelect(new Select(Arrays.asList(new Object[] {new ExpressionSymbol("expr", new Constant(new Integer(1)))}))); //$NON-NLS-1$
+        query.setSelect(new Select(Arrays.asList(new ExpressionSymbol("expr", new Constant(1))))); //$NON-NLS-1$
         CommandStatement commandStmt = new CommandStatement(query);
-        CompareCriteria criteria = new CompareCriteria(new ElementSymbol("x"), CompareCriteria.GT, new Constant(new Integer(1))); //$NON-NLS-1$
+        CompareCriteria criteria = new CompareCriteria(new ElementSymbol("x"), CompareCriteria.GT, new Constant(1)); //$NON-NLS-1$
         Block block = new Block();
         block.addStatement(commandStmt);
         IfStatement ifStmt = new IfStatement(criteria, block);
@@ -6648,7 +6648,7 @@
         Function convert = new Function("convert", new Expression[] {new Constant(null), new Constant("blob")}); //$NON-NLS-1$ //$NON-NLS-2$
         Function convert1 = new Function("convert", new Expression[] {new Constant(null), new Constant("clob")}); //$NON-NLS-1$ //$NON-NLS-2$
         Function convert2 = new Function("convert", new Expression[] {new Constant(null), new Constant("xml")}); //$NON-NLS-1$ //$NON-NLS-2$
-        Select select = new Select(Arrays.asList(new Object[] {new ExpressionSymbol("expr", convert), new ExpressionSymbol("expr1", convert1), new ExpressionSymbol("expr2", convert2)})); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        Select select = new Select(Arrays.asList(new ExpressionSymbol("expr", convert), new ExpressionSymbol("expr1", convert1), new ExpressionSymbol("expr2", convert2))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         Query query = new Query();
         query.setSelect(select);
         

Modified: trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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


Property changes on: trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/processor/FakeDataStore.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/FakeDataStore.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/FakeDataStore.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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[] {


Property changes on: trunk/engine/src/test/java/org/teiid/query/processor/FakeDataStore.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/FakeDataStore.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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;
 
- at SuppressWarnings("nls")
+ at SuppressWarnings({"nls", "unchecked"})
 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,13 +213,12 @@
         sampleData1(dataManager);
         
         // Plan query
-        ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+        ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
         
         // Run query
         helpProcess(plan, dataManager, expected);
     }
     
-    @SuppressWarnings("unchecked")
 	@Test public void testAggregatePushdown() {
     	Command command = helpParse("select e1, count(e2), max(e2) from (select e1, e2, e3 from pm1.g1 union all select e1, e2, e3 from pm1.g2 union all select e1, e2, e3 from pm2.g1) z group by e1"); //$NON-NLS-1$
     	
@@ -243,7 +242,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 +273,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 +291,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 +314,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 +329,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,9 +344,33 @@
         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 testJira1621() throws Exception {
+		// Create query
+		String sql = "SELECT sum(t2.e4) as s, max(t1.e1 || t2.e1) FROM pm1.g1 as t1, pm1.g2 as t2, pm1.g3 as t3 WHERE t1.e1 = coalesce(t2.e1, 'b') AND t2.e2 = t3.e2 GROUP BY t2.e2, t2.e3, t3.e2 ORDER BY s"; //$NON-NLS-1$
 
+		// Create expected results
+		List[] expected = new List[] {
+				Arrays.asList(null, "cc"),
+				Arrays.asList(0.0, "bb"),
+				Arrays.asList(1.0, null),
+				Arrays.asList(2.0, "aa"),
+				Arrays.asList(7.0, "aa")
+		};
+
+		// Construct data manager with data
+		FakeDataManager dataManager = new FakeDataManager();
+		sampleData1(dataManager);
+
+		// Plan query
+		ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached());
+
+		// Run query
+		helpProcess(plan, dataManager, expected);
+	}
+
 }


Property changes on: trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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();
@@ -854,4 +839,56 @@
         		new HashSet<String>(dataManager.getQueries()));
     }
     
+    @Test public void testDjHint() { 
+        // Create query 
+        String sql = "SELECT pm1.g1.e1 FROM pm1.g1 WHERE e1 IN /*+ DJ */ (select e1 from pm2.g1) order by pm1.g1.e1"; //$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$
+            Arrays.asList(new Object[] { "b" }), //$NON-NLS-1$
+            Arrays.asList(new Object[] { "c" }) //$NON-NLS-1$
+        };    
+        
+        // Construct data manager with data
+        FakeDataManager dataManager = new FakeDataManager();
+        TestProcessor.sampleData1(dataManager);
+        
+        // Plan query
+        ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
+        TestOptimizer.checkDependentJoinCount(plan, 1);
+
+        // Run query
+        TestProcessor.helpProcess(plan, dataManager, expected);
+    }
+    
+    @Test public void testMakeIndHint() { 
+        // Create query 
+        String sql = "SELECT pm1.g1.e1 FROM /*+ MAKEIND */ pm1.g1, pm2.g1 WHERE pm1.g1.e1 = pm2.g1.e1 AND pm1.g1.e2=pm2.g1.e2 order by pm1.g1.e1"; //$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$
+            Arrays.asList(new Object[] { "a" }), //$NON-NLS-1$
+            Arrays.asList(new Object[] { "a" }), //$NON-NLS-1$
+            Arrays.asList(new Object[] { "b" }), //$NON-NLS-1$
+            Arrays.asList(new Object[] { "c" }) //$NON-NLS-1$
+        };    
+        
+        // Construct data manager with data
+        FakeDataManager dataManager = new FakeDataManager();
+        TestProcessor.sampleData1(dataManager);
+        
+        // Plan query
+        ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached());
+        TestOptimizer.checkDependentJoinCount(plan, 1);
+
+        // Run query
+        TestProcessor.helpProcess(plan, dataManager, expected);
+    }
+    
 }


Property changes on: trunk/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java:3149-3171
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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;
 
-
+ at 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);


Property changes on: trunk/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestJoinWithFunction.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestJoinWithFunction.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestJoinWithFunction.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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);


Property changes on: trunk/engine/src/test/java/org/teiid/query/processor/TestJoinWithFunction.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestJoinWithFunction.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestOptionalJoins.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestOptionalJoins.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestOptionalJoins.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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);


Property changes on: trunk/engine/src/test/java/org/teiid/query/processor/TestOptionalJoins.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestOptionalJoins.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestOrderByProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestOrderByProcessing.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestOrderByProcessing.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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);
         


Property changes on: trunk/engine/src/test/java/org/teiid/query/processor/TestOrderByProcessing.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestOrderByProcessing.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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;
 
-
+ at 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);
     }


Property changes on: trunk/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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$
@@ -7277,7 +7133,10 @@
         };
 
         HardcodedDataManager manager = new HardcodedDataManager();
-        manager.addData("SELECT 'a', pm1.g1.e1 FROM pm1.g1", expected); //$NON-NLS-1$ 
+        manager.addData("SELECT pm1.g1.e1 FROM pm1.g1", new List[] {
+                Arrays.asList("b"), //$NON-NLS-1$ //$NON-NLS-2$
+                Arrays.asList("c") //$NON-NLS-1$ //$NON-NLS-2$
+            }); //$NON-NLS-1$ 
         
         processPreparedStatement("select ?, e1 from pm1.g1", expected, manager, capFinder,
 				metadata, Arrays.asList("a")); 
@@ -7298,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);
@@ -7320,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);          
     }
     
@@ -7338,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$
@@ -7369,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());
         
@@ -7392,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);
     }
@@ -7416,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);
     }
@@ -7432,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);
     }
@@ -7451,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);
     }
@@ -7471,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);
     }
@@ -7492,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);
     }
@@ -7507,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);
@@ -7540,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);
@@ -7564,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);
@@ -7598,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);
     }
@@ -7613,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);
     }
@@ -7628,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);
     }
@@ -7643,10 +7502,37 @@
         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);
     }
     
+    
+    @Test public void testDupSelect() throws Exception {
+    	String sql = "select e1, e1 from pm1.g1";
+        
+    	HardcodedDataManager dataManager = new HardcodedDataManager();
+    	
+    	dataManager.addData("SELECT g_0.e1 FROM pm1.g1 AS g_0", new List[] {Arrays.asList(1)});
+        
+        ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached(), TestOptimizer.getGenericFinder());
+        
+        helpProcess(plan, dataManager, new List[] {Arrays.asList(1, 1)});
+    }
+    
+    @Test public void testDupSelect1() throws Exception {
+    	String sql = "select 1, 2 from pm1.g1";
+        
+    	HardcodedDataManager dataManager = new HardcodedDataManager();
+    	
+    	dataManager.addData("SELECT 2 FROM pm1.g1 AS g_0", new List[] {Arrays.asList(2)});
+        
+        ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached(), TestOptimizer.getGenericFinder());
+        
+        helpProcess(plan, dataManager, new List[] {Arrays.asList(1, 2)});
+    }
+    
     private static final boolean DEBUG = false;
 }


Property changes on: trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java:3149-3171
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestProcessor.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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);
 	}


Property changes on: trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestSecurityFunctions.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestSecurityFunctions.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestSecurityFunctions.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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);


Property changes on: trunk/engine/src/test/java/org/teiid/query/processor/TestSecurityFunctions.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestSecurityFunctions.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestSetProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestSetProcessing.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestSetProcessing.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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, 1 FROM pm1.g2 AS g_0", "SELECT g_0.e1, g_0.e2 FROM pm1.g2 AS g_0", "SELECT 'a', 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}),


Property changes on: trunk/engine/src/test/java/org/teiid/query/processor/TestSetProcessing.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestSetProcessing.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestTempTables.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestTempTables.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestTempTables.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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);
@@ -312,7 +312,10 @@
 	@Test public void testUnneededMergePredicate() throws Exception {
 		execute("create local temporary table x (e1 string, e2 integer, primary key (e1))", new List[] {Arrays.asList(0)}); //$NON-NLS-1$
 		execute("create local temporary table x1 (e1 string, e2 integer)", new List[] {Arrays.asList(0)}); //$NON-NLS-1$
-		TestOptimizer.helpPlan("select x.e1 from x, x1 where x.e2 = x1.e2 and x.e1 = x1.e1", this.metadata, new String[] {"SELECT x.e2, x.e1 FROM x ORDER BY x.e1", "SELECT x1.e2, x1.e1 FROM x1 ORDER BY x1.e1"}, ComparisonMode.EXACT_COMMAND_STRING);
+		TestOptimizer.helpPlan("select x.e1 from x makenotdep, x1 makenotdep where x.e2 = x1.e2 and x.e1 = x1.e1", this.metadata, new String[] {"SELECT x.e2, x.e1 FROM x ORDER BY x.e1", "SELECT x1.e2, x1.e1 FROM x1 ORDER BY x1.e1"}, ComparisonMode.EXACT_COMMAND_STRING);
+		execute("insert into x (e2, e1) values (2, 'b')", new List[] {Arrays.asList(1)}); //$NON-NLS-1$
+		execute("insert into x1 (e2, e1) values (3, 'b')", new List[] {Arrays.asList(1)}); //$NON-NLS-1$
+		execute("select x.e1 from x makenotdep, x1 makenotdep where x.e2 = x1.e2 and x.e1 = x1.e1", new List[0]); //$NON-NLS-1$
 	}
 	
 	private void sampleTable() throws Exception {


Property changes on: trunk/engine/src/test/java/org/teiid/query/processor/TestTempTables.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestTempTables.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestTextTable.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestTextTable.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestTextTable.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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))));
     }
 	
 }


Property changes on: trunk/engine/src/test/java/org/teiid/query/processor/TestTextTable.java
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestTextTable.java:3149-3171
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestTextTable.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestVirtualDepJoin.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestVirtualDepJoin.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestVirtualDepJoin.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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;
 
-
+ at 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); 
          


Property changes on: trunk/engine/src/test/java/org/teiid/query/processor/TestVirtualDepJoin.java
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestVirtualDepJoin.java:3149-3171
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestVirtualDepJoin.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestWithClauseProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestWithClauseProcessing.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestWithClauseProcessing.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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,22 @@
 	    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 {
+		 FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+        BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
+        caps.setCapabilitySupport(Capability.COMMON_TABLE_EXPRESSIONS, true);
+        caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_SELFJOIN, true);
+        capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+       
+	    String sql = "with a (x, y) as (select 1, 2 from pm1.g1) SELECT a.x from a, a z"; //$NON-NLS-1$
+	    
+	    FakeDataManager dataManager = new FakeDataManager();
+	    sampleData1(dataManager);
+	    
+	    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);
+	}
 
 }


Property changes on: trunk/engine/src/test/java/org/teiid/query/processor/TestWithClauseProcessing.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/TestWithClauseProcessing.java:3149-3217

Modified: trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/processor/relational/TestAccessNode.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/TestAccessNode.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestAccessNode.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/processor/relational/TestGroupingNode.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/TestGroupingNode.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestGroupingNode.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/processor/relational/TestJoinNode.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/TestJoinNode.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestJoinNode.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectNode.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectNode.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectNode.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/processor/relational/TestSelectNode.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/TestSelectNode.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestSelectNode.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/processor/xml/TestInstructions.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/xml/TestInstructions.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/xml/TestInstructions.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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;
 
-
 /**
  */
+ at 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: trunk/engine/src/test/java/org/teiid/query/processor/xml/TestSourceNodeGenaratorVisitor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/xml/TestSourceNodeGenaratorVisitor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/xml/TestSourceNodeGenaratorVisitor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -82,7 +82,7 @@
         MappingSourceNode source = (MappingSourceNode)root;
         assertEquals("licenseSource", source.getResultName()); //$NON-NLS-1$
         
-        List list = source.getStagingTables();
+        List<String> list = source.getStagingTables();
         assertEquals(2, list.size());
 
         assertEquals("testTempGroup1", list.get(0)); //$NON-NLS-1$
@@ -128,7 +128,7 @@
         assertTrue(node instanceof MappingElement);
         MappingElement element = (MappingElement)node;
 
-        List list = element.getStagingTables();
+        List<String> list = element.getStagingTables();
         assertEquals(1, list.size());
         assertEquals("testTempGroup1", list.get(0)); //$NON-NLS-1$
         
@@ -137,7 +137,7 @@
         assertEquals(1, element.getMinOccurence());
         assertEquals(1, element.getMaxOccurence());
         
-        MappingNode node1 = (MappingNode)element.getNodeChildren().get(0);
+        MappingNode node1 = element.getNodeChildren().get(0);
         assertTrue(node1 instanceof MappingSourceNode);
         
         MappingSourceNode source = (MappingSourceNode)node1;        
@@ -149,7 +149,7 @@
         
         // make sure source's child is mapping element and mapping element's source
         // is above source        
-        node1 = (MappingNode)source.getNodeChildren().get(0);
+        node1 = source.getNodeChildren().get(0);
         assertTrue(node instanceof MappingElement);
         element = (MappingElement)node1;
         assertEquals("childNode", element.getName()); //$NON-NLS-1$
@@ -194,14 +194,14 @@
         MappingSourceNode source = (MappingSourceNode)node;
         assertEquals("parentNodeSource", source.getSource()); //$NON-NLS-1$
         
-        node = (MappingNode)source.getNodeChildren().get(0);
+        node = source.getNodeChildren().get(0);
         assertTrue(node instanceof MappingElement);        
         MappingElement element = (MappingElement)node;
         assertEquals("parentNode", element.getName()); //$NON-NLS-1$
         assertTrue(element.isRootRecursiveNode());
         assertFalse(element.isRecursive());
         
-        node = (MappingNode)element.getNodeChildren().get(0);
+        node = element.getNodeChildren().get(0);
         assertTrue(node instanceof MappingElement);        
         element = (MappingElement)node;
         assertEquals("childNode", element.getName()); //$NON-NLS-1$
@@ -213,7 +213,7 @@
         assertEquals("ddd", attribute.getDefaultValue()); //$NON-NLS-1$
         assertEquals("fff", attribute.getValue()); //$NON-NLS-1$
         
-        node = (MappingNode)element.getNodeChildren().get(0);
+        node = element.getNodeChildren().get(0);
         assertTrue(node instanceof MappingRecursiveElement);        
         MappingRecursiveElement recursive = (MappingRecursiveElement)node;
         assertEquals("recursivenodename", recursive.getName()); //$NON-NLS-1$
@@ -254,7 +254,7 @@
         assertEquals("parentSource", source.getSource()); //$NON-NLS-1$
         
         // parent element
-        node = (MappingNode)source.getNodeChildren().get(0);
+        node = source.getNodeChildren().get(0);
         assertTrue(node instanceof MappingElement);        
         MappingElement element = (MappingElement)node;
         assertEquals("parentNode", element.getName()); //$NON-NLS-1$
@@ -262,12 +262,12 @@
         assertFalse(element.isRecursive());
         
         // recursive source
-        node = (MappingNode)element.getNodeChildren().get(0);
+        node = element.getNodeChildren().get(0);
         source = (MappingSourceNode)node;
         assertEquals("childSource", source.getSource()); //$NON-NLS-1$
         assertEquals("parentSource", source.getAliasResultName()); //$NON-NLS-1$
         
-        node = (MappingNode)source.getNodeChildren().get(0);
+        node = source.getNodeChildren().get(0);
         assertTrue(node instanceof MappingRecursiveElement);        
         MappingRecursiveElement relement = (MappingRecursiveElement)node;
         

Modified: trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLPlanningEnhancements.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLPlanningEnhancements.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLPlanningEnhancements.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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;
 
-
+ at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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: trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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;
 
 
@@ -87,7 +90,59 @@
  */
 @SuppressWarnings("nls")
 public class TestXMLProcessor {
-    private static final boolean DEBUG = false;
+    private static final String CARDS_MANAGER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +  //$NON-NLS-1$
+	            "<BaseballPlayers>\r\n" + //$NON-NLS-1$
+	            "   <Player PlayerID=\"1001\">\r\n" + //$NON-NLS-1$
+	            "      <FirstName>Albert</FirstName>\r\n" + //$NON-NLS-1$
+	            "      <LastName>Pujols</LastName>\r\n" + //$NON-NLS-1$
+	            "      <Manager ManagerID=\"1004\">\r\n" + //$NON-NLS-1$
+	            "         <FirstName>Tony</FirstName>\r\n" + //$NON-NLS-1$
+	            "         <LastName>LaRussa</LastName>\r\n" + //$NON-NLS-1$
+	            "         <Owner OwnerID=\"1009\">\r\n" + //$NON-NLS-1$
+	            "            <FirstName>Bill</FirstName>\r\n" + //$NON-NLS-1$
+	            "            <LastName>DeWitt</LastName>\r\n" + //$NON-NLS-1$
+	            "         </Owner>\r\n" + //$NON-NLS-1$
+	            "      </Manager>\r\n" + //$NON-NLS-1$
+	            "   </Player>\r\n" + //$NON-NLS-1$
+	            "   <Player PlayerID=\"1002\">\r\n" + //$NON-NLS-1$
+	            "      <FirstName>Jim</FirstName>\r\n" + //$NON-NLS-1$
+	            "      <LastName>Edmunds</LastName>\r\n" + //$NON-NLS-1$
+	            "      <Manager ManagerID=\"1004\">\r\n" + //$NON-NLS-1$
+	            "         <FirstName>Tony</FirstName>\r\n" + //$NON-NLS-1$
+	            "         <LastName>LaRussa</LastName>\r\n" + //$NON-NLS-1$
+	            "         <Owner OwnerID=\"1009\">\r\n" + //$NON-NLS-1$
+	            "            <FirstName>Bill</FirstName>\r\n" + //$NON-NLS-1$
+	            "            <LastName>DeWitt</LastName>\r\n" + //$NON-NLS-1$
+	            "         </Owner>\r\n" + //$NON-NLS-1$
+	            "      </Manager>\r\n" + //$NON-NLS-1$
+	            "   </Player>\r\n" + //$NON-NLS-1$
+	            "   <Player PlayerID=\"1003\">\r\n" + //$NON-NLS-1$
+	            "      <FirstName>David</FirstName>\r\n" + //$NON-NLS-1$
+	            "      <LastName>Eckstein</LastName>\r\n" + //$NON-NLS-1$
+	            "      <Manager ManagerID=\"1004\">\r\n" + //$NON-NLS-1$
+	            "         <FirstName>Tony</FirstName>\r\n" + //$NON-NLS-1$
+	            "         <LastName>LaRussa</LastName>\r\n" + //$NON-NLS-1$
+	            "         <Owner OwnerID=\"1009\">\r\n" + //$NON-NLS-1$
+	            "            <FirstName>Bill</FirstName>\r\n" + //$NON-NLS-1$
+	            "            <LastName>DeWitt</LastName>\r\n" + //$NON-NLS-1$
+	            "         </Owner>\r\n" + //$NON-NLS-1$
+	            "      </Manager>\r\n" + //$NON-NLS-1$
+	            "   </Player>\r\n" + //$NON-NLS-1$
+	            "   <Player PlayerID=\"1005\">\r\n" + //$NON-NLS-1$
+	            "      <FirstName>Derrek</FirstName>\r\n" + //$NON-NLS-1$
+	            "      <LastName>Lee</LastName>\r\n" + //$NON-NLS-1$
+	            "   </Player>\r\n" + //$NON-NLS-1$
+	            "   <Player PlayerID=\"1006\">\r\n" + //$NON-NLS-1$
+	            "      <FirstName>Corey</FirstName>\r\n" + //$NON-NLS-1$
+	            "      <LastName>Patterson</LastName>\r\n" + //$NON-NLS-1$
+	            "   </Player>\r\n" + //$NON-NLS-1$
+	            "   <Player PlayerID=\"1008\">\r\n" + //$NON-NLS-1$
+	            "      <FirstName>Carlos</FirstName>\r\n" + //$NON-NLS-1$
+	            "      <LastName>Zambrano</LastName>\r\n" + //$NON-NLS-1$
+	            "   </Player>\r\n" + //$NON-NLS-1$
+	            "</BaseballPlayers>\r\n\r\n";
+
+	private static final boolean DEBUG = false;
     
     /**
      * Construct some fake metadata.  Basic conceptual tree is:
@@ -103,47 +158,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 +208,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 +252,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 +282,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 +297,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 +310,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 +321,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 +348,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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem. at ItemID", "Catalogs.Catalog.items.DiscontinuedItem.Name", "Catalogs.Catalog.items.DiscontinuedItem.Quantity", "Catalogs.Catalog.items.StatusUnknown", "Catalogs.Catalog.items.StatusUnknown. at 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. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem. at ItemID", "Catalogs.Catalog.items.DiscontinuedItem.Name", "Catalogs.Catalog.items.DiscontinuedItem.Quantity", "Catalogs.Catalog.items.StatusUnknown", "Catalogs.Catalog.items.StatusUnknown. at 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. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem. at 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. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem. at 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. at fixed", "FixedValueTest.wrapper. at key", "FixedValueTest.wrapper. at 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. at fixed", "FixedValueTest.wrapper. at key", "FixedValueTest.wrapper. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at ItemID", "Item.Name", "Item.Quantity", "Item.Suppliers", "Item.Suppliers.Supplier", "Item.Suppliers.Supplier. at 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. at ItemID", "Item.Name", "Item.Quantity", "Item.Suppliers", "Item.Suppliers.Supplier", "Item.Suppliers.Supplier. at 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 +481,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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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 +575,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. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem. at ItemID", "Catalogs.Catalog.items.DiscontinuedItem.Name", "Catalogs.Catalog.items.DiscontinuedItem.Quantity", "Catalogs.Catalog.items.StatusUnknown", "Catalogs.Catalog.items.StatusUnknown. at 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. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem. at ItemID", "Catalogs.Catalog.items.DiscontinuedItem.Name", "Catalogs.Catalog.items.DiscontinuedItem.Quantity", "Catalogs.Catalog.items.StatusUnknown", "Catalogs.Catalog.items.StatusUnknown. at 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. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem. at ItemID", "Catalogs.Catalog.items.DiscontinuedItem.Name", "Catalogs.Catalog.items.DiscontinuedItem.Quantity", "Catalogs.Catalog.items.StatusUnknown", "Catalogs.Catalog.items.StatusUnknown. at 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. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem. at ItemID", "Catalogs.Catalog.items.DiscontinuedItem.Name", "Catalogs.Catalog.items.DiscontinuedItem.Quantity", "Catalogs.Catalog.items.StatusUnknown", "Catalogs.Catalog.items.StatusUnknown. at 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. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem. at ItemID", "Catalogs.Catalog.items.DiscontinuedItem.Name", "Catalogs.Catalog.items.DiscontinuedItem.Quantity", "Catalogs.Catalog.items.StatusUnknown", "Catalogs.Catalog.items.StatusUnknown. at 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. at ItemID", "Catalogs.Catalog.items.item.Name", "Catalogs.Catalog.items.item.Quantity", "Catalogs.Catalog.items.DiscontinuedItem", "Catalogs.Catalog.items.DiscontinuedItem. at ItemID", "Catalogs.Catalog.items.DiscontinuedItem.Name", "Catalogs.Catalog.items.DiscontinuedItem.Quantity", "Catalogs.Catalog.items.StatusUnknown", "Catalogs.Catalog.items.StatusUnknown. at 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 +647,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. at 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. at 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. at 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. at 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. at 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. at 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 +873,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 +893,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 +925,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 +958,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 +983,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 +1007,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 +1050,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 +1091,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 +1114,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 +1130,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 +1150,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 +1171,7 @@
     /** 
      * DEFECT 8373
      */
-    private static Object createXMLPlan_defect8373b() {
+    private static MappingDocument createXMLPlan_defect8373b() {
         
         MappingDocument doc = new MappingDocument(true);
         
@@ -1367,7 +1190,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 +1231,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 +1268,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 +1312,7 @@
     }
 
     // for doc 9b - test temp group w/ bindings
-    private static MappingNode createXMLPlanNested2b() {
+    private static MappingDocument createXMLPlanNested2b() {
         
         MappingDocument doc = new MappingDocument(true);
         
@@ -1538,12 +1361,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 +1424,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 +1447,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 +1457,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 +1490,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 +1555,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 +1578,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 +1641,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 +1683,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 +1719,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 +1759,7 @@
      * Method createXMLPlanNested.
      * @return MappingNode root of mapping doc
      */
-    private static MappingNode createXMLPlanMultipleDocs() {
+    private static MappingDocument createXMLPlanMultipleDocs() {
 
         MappingDocument doc = new MappingDocument(true);
         
@@ -1966,7 +1787,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 +1818,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 +1848,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 +1880,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 +1909,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 +2012,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 +2027,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 +2051,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 +2082,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 +2331,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 +2366,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 +2427,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 +2449,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 +2520,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 +2541,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 +2566,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 +2593,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 +2620,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 +2647,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 +2674,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 +2701,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 +2766,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 +2831,7 @@
     }      
     
     @Test public void testOrderBy4() throws Exception {
-        FakeMetadataFacade metadata = exampleMetadataCached();
+        QueryMetadataInterface metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         
         String expectedDoc = 
@@ -3261,7 +2851,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 +2878,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 +2986,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 +3064,7 @@
 
     /*    
     @Test public void testOrderBy9() throws Exception {
-        FakeMetadataFacade metadata = exampleMetadata();
+        QueryMetadataInterface metadata = exampleMetadata();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         String expectedDoc = "";
           
@@ -3487,7 +3077,7 @@
     */
   
     @Test public void testOrderBy10() throws Exception {
-        FakeMetadataFacade metadata = exampleMetadataCached();
+        QueryMetadataInterface metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         
         String expectedDoc = 
@@ -3511,13 +3101,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 +3135,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 +3242,7 @@
     }   
      
     @Test public void testOrderBy15() throws Exception {
-        FakeMetadataFacade metadata = exampleMetadataCached();
+        QueryMetadataInterface metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         
         String expectedDoc = 
@@ -3681,7 +3271,7 @@
 
     /** test null elements*/
     @Test public void testOrderBy17() throws Exception {
-        FakeMetadataFacade metadata = exampleMetadataCached();
+        QueryMetadataInterface metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerWithNulls(metadata);
         
         String expectedDoc = 
@@ -3710,7 +3300,7 @@
     
     /**  test duplicate elements*/
     @Test public void testOrderBy18() throws Exception {
-        FakeMetadataFacade metadata = exampleMetadataCached();
+        QueryMetadataInterface metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerWithDuplicates(metadata);
         
         String expectedDoc = 
@@ -3739,7 +3329,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 +3357,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 +3415,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 +3431,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 +3439,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 +3652,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 +3663,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 +3750,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 +3831,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 +3912,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 +3998,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 +4009,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 +4017,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 +4074,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 +4134,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 +4184,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 +4240,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 +4289,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 +4336,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 +4389,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 +4482,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 +4490,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 +4498,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 +4584,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 +4592,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 +4600,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 +4621,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 +4644,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 +4694,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 +4710,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 +4722,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 +4761,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 +4800,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 +4816,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 +4832,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 +4868,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 +4957,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 +5001,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 +5079,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 +5121,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 +5151,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 +5230,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 +5253,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 +5276,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 +5295,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 +5322,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 +5351,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 +5378,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 +5405,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 +5432,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 +5459,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 +5492,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 +5531,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 +5553,7 @@
     }
 
     @Test public void testAttributeBug() throws Exception {
-        FakeMetadataFacade metadata = exampleMetadataCached();
+        QueryMetadataInterface metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManager(metadata);
 
         String expectedDoc = 
@@ -5989,7 +5577,7 @@
     }
 
     @Test public void testMultipleDocs() throws Exception {
-        FakeMetadataFacade metadata = exampleMetadataCached();
+        QueryMetadataInterface metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
 
         String expectedDoc1 = 
@@ -6056,7 +5644,7 @@
     }
 
     @Test public void testRecursive() throws Exception {
-        FakeMetadataFacade metadata = exampleMetadataCached();
+        QueryMetadataInterface metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
 
         String expectedDoc = 
@@ -6141,7 +5729,7 @@
     }
 
     @Test public void testRecursiveA() throws Exception {
-        FakeMetadataFacade metadata = exampleMetadataCached();
+        QueryMetadataInterface metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
 
         String expectedDoc = 
@@ -6239,7 +5827,7 @@
      * @throws Exception
      */
     @Test public void testRecursive2() throws Exception {
-        FakeMetadataFacade metadata = exampleMetadataCached();
+        QueryMetadataInterface metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
 
         String expectedDoc = 
@@ -6301,7 +5889,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 +5951,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 +5960,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 +6011,7 @@
      * @throws Exception
      */
     @Test public void testRecursiveWithStagingTable_defect15607() throws Exception {
-        FakeMetadataFacade metadata = exampleMetadataCached();
+        QueryMetadataInterface metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
 
         String expectedDoc = 
@@ -6490,7 +6078,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 +6154,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 +6206,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 +6258,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 +6394,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 +6418,7 @@
     }
      
     @Test public void testSelectElement2() throws Exception {
-        FakeMetadataFacade metadata = exampleMetadataCached();
+        QueryMetadataInterface metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         
         String expectedDoc = 
@@ -6907,7 +6495,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 +6572,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 +6602,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 +6622,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 +6707,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 +6735,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 +6763,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 +6791,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 +6820,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 +6856,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 +6889,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 +6917,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 +6970,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 +6992,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 +7046,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 +7099,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 +7153,7 @@
 
     /**  CSE query 0 */
     @Test public void testSelectElement17() throws Exception {
-        FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+        QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
 
         String expectedDoc = 
@@ -7666,7 +7254,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 +7299,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 +7345,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 +7378,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 +7408,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 +7495,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 +7558,7 @@
     
     /**  CSE query 5 */
     @Test public void testSelectElement22() throws Exception {
-        FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+        QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
 
         String expectedDoc = 
@@ -8029,7 +7617,7 @@
     
     /**  CSE query 5a */
     @Test public void testSelectElement22a() throws Exception {
-        FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+        QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
 
         String expectedDoc = 
@@ -8085,7 +7673,7 @@
     
     /**  CSE query 6 */
     @Test public void testSelectElement23() throws Exception {
-        FakeMetadataFacade metadata = exampleMetadataNestedWithSibling();
+        QueryMetadataInterface metadata = exampleMetadataNestedWithSibling();
         FakeDataManager dataMgr = exampleDataManagerNestedWithSibling(metadata);
 
         String expectedDoc = 
@@ -8127,7 +7715,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 +7754,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 +7794,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 +7855,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 +7896,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 +7963,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 +8027,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 +8094,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 +8122,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 +8146,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 +8172,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 +8203,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 +8228,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 +8249,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 +8313,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 +8370,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 +8475,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 +8491,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 +8507,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 +8520,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 +8533,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 +8548,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 +8597,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 +8608,7 @@
      * jhTODO
      */
     @Test public void testNillableOptional() throws Exception {
-        FakeMetadataFacade metadata = exampleMetadataCached();
+        QueryMetadataInterface metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         
         String expectedDoc = 
@@ -9039,7 +8627,7 @@
      * jhTODO
      */
     @Test public void testNillableNonOptional() throws Exception {
-        FakeMetadataFacade metadata = exampleMetadataCached();
+        QueryMetadataInterface metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerNested(metadata);
         
         String expectedDoc = 
@@ -9061,7 +8649,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 +8711,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 +8719,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 +8740,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 +8755,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 +8786,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 +8813,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 +8840,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 +8867,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 +8894,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 +8921,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 +8986,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 +9051,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 +9116,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 +9182,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 +9249,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 +9314,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 +9329,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 +9344,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 +9359,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 +9373,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 +9444,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 +9478,7 @@
      * whole fragment
      */        
     @Test public void testWithSOAPEncodingNoRows() throws Exception {
-        FakeMetadataFacade metadata = exampleMetadataSoap1();
+        QueryMetadataInterface metadata = exampleMetadataSoap1();
         FakeDataManager dataMgr = exampleDataManagerForSoap1(metadata, true);
          
         String expectedDoc = 
@@ -9917,7 +9504,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 +9544,7 @@
     
     @Test public void testDefect8373() throws Exception{
         
-        FakeMetadataFacade metadata = exampleMetadataCached();
+        QueryMetadataInterface metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerWithNulls(metadata);
          
         String expectedDoc = 
@@ -9998,7 +9585,7 @@
 
     @Test public void testDefect8373a() throws Exception{
         
-        FakeMetadataFacade metadata = exampleMetadataCached();
+        QueryMetadataInterface metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerWithNulls(metadata);
          
         String expectedDoc = 
@@ -10039,7 +9626,7 @@
 
     @Test public void testDefect8373b() throws Exception{
         
-        FakeMetadataFacade metadata = exampleMetadataCached();
+        QueryMetadataInterface metadata = exampleMetadataCached();
         FakeDataManager dataMgr = exampleDataManagerWithNulls(metadata);
          
         String expectedDoc = 
@@ -10079,7 +9666,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 +9690,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 +9721,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 +9748,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 +9775,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 +9803,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 +9837,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 +9904,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 +9971,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 +10037,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 +10092,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 +10101,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 +10156,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 +10165,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 +10196,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 +10204,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 +10248,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 +10303,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 +10312,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 +10321,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 +10330,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 +10339,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 +10348,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 +10402,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 +10441,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 +10479,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 +10520,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 +10610,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 +10684,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 +11002,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. at supervisorID='1004' and order.orderquantity > 1", CASE_3225_WITH_CRITERIA_EXPECTED_DOC, metadata, dataMgr);         //$NON-NLS-1$
     }    
@@ -11499,7 +11024,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. at supervisorID='1004'", CASE_3225_WITH_CRITERIA_EXPECTED_DOC, metadata, dataMgr);         //$NON-NLS-1$
     }      
@@ -11511,7 +11036,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 +11056,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 +11148,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,70 +11203,25 @@
      */
     @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$
-            "<BaseballPlayers>\r\n" + //$NON-NLS-1$
-            "   <Player PlayerID=\"1001\">\r\n" + //$NON-NLS-1$
-            "      <FirstName>Albert</FirstName>\r\n" + //$NON-NLS-1$
-            "      <LastName>Pujols</LastName>\r\n" + //$NON-NLS-1$
-            "      <Manager ManagerID=\"1004\">\r\n" + //$NON-NLS-1$
-            "         <FirstName>Tony</FirstName>\r\n" + //$NON-NLS-1$
-            "         <LastName>LaRussa</LastName>\r\n" + //$NON-NLS-1$
-            "         <Owner OwnerID=\"1009\">\r\n" + //$NON-NLS-1$
-            "            <FirstName>Bill</FirstName>\r\n" + //$NON-NLS-1$
-            "            <LastName>DeWitt</LastName>\r\n" + //$NON-NLS-1$
-            "         </Owner>\r\n" + //$NON-NLS-1$
-            "      </Manager>\r\n" + //$NON-NLS-1$
-            "   </Player>\r\n" + //$NON-NLS-1$
-            "   <Player PlayerID=\"1002\">\r\n" + //$NON-NLS-1$
-            "      <FirstName>Jim</FirstName>\r\n" + //$NON-NLS-1$
-            "      <LastName>Edmunds</LastName>\r\n" + //$NON-NLS-1$
-            "      <Manager ManagerID=\"1004\">\r\n" + //$NON-NLS-1$
-            "         <FirstName>Tony</FirstName>\r\n" + //$NON-NLS-1$
-            "         <LastName>LaRussa</LastName>\r\n" + //$NON-NLS-1$
-            "         <Owner OwnerID=\"1009\">\r\n" + //$NON-NLS-1$
-            "            <FirstName>Bill</FirstName>\r\n" + //$NON-NLS-1$
-            "            <LastName>DeWitt</LastName>\r\n" + //$NON-NLS-1$
-            "         </Owner>\r\n" + //$NON-NLS-1$
-            "      </Manager>\r\n" + //$NON-NLS-1$
-            "   </Player>\r\n" + //$NON-NLS-1$
-            "   <Player PlayerID=\"1003\">\r\n" + //$NON-NLS-1$
-            "      <FirstName>David</FirstName>\r\n" + //$NON-NLS-1$
-            "      <LastName>Eckstein</LastName>\r\n" + //$NON-NLS-1$
-            "      <Manager ManagerID=\"1004\">\r\n" + //$NON-NLS-1$
-            "         <FirstName>Tony</FirstName>\r\n" + //$NON-NLS-1$
-            "         <LastName>LaRussa</LastName>\r\n" + //$NON-NLS-1$
-            "         <Owner OwnerID=\"1009\">\r\n" + //$NON-NLS-1$
-            "            <FirstName>Bill</FirstName>\r\n" + //$NON-NLS-1$
-            "            <LastName>DeWitt</LastName>\r\n" + //$NON-NLS-1$
-            "         </Owner>\r\n" + //$NON-NLS-1$
-            "      </Manager>\r\n" + //$NON-NLS-1$
-            "   </Player>\r\n" + //$NON-NLS-1$
-            "   <Player PlayerID=\"1005\">\r\n" + //$NON-NLS-1$
-            "      <FirstName>Derrek</FirstName>\r\n" + //$NON-NLS-1$
-            "      <LastName>Lee</LastName>\r\n" + //$NON-NLS-1$
-            "   </Player>\r\n" + //$NON-NLS-1$
-            "   <Player PlayerID=\"1006\">\r\n" + //$NON-NLS-1$
-            "      <FirstName>Corey</FirstName>\r\n" + //$NON-NLS-1$
-            "      <LastName>Patterson</LastName>\r\n" + //$NON-NLS-1$
-            "   </Player>\r\n" + //$NON-NLS-1$
-            "   <Player PlayerID=\"1008\">\r\n" + //$NON-NLS-1$
-            "      <FirstName>Carlos</FirstName>\r\n" + //$NON-NLS-1$
-            "      <LastName>Zambrano</LastName>\r\n" + //$NON-NLS-1$
-            "   </Player>\r\n" + //$NON-NLS-1$
-            "</BaseballPlayers>\r\n\r\n"; //$NON-NLS-1$
         
-        helpTestProcess("select * from xmltest.playersDoc where context(manager, owner. at ownerid) = '1009'", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
+        helpTestProcess("select * from xmltest.playersDoc where context(manager, owner. at ownerid) = '1009'", CARDS_MANAGER, metadata, dataMgr);         //$NON-NLS-1$
         
     }    
     
+    @Test public void testBaseballPlayersPseudoGroup() throws Exception {
+        QueryMetadataInterface metadata = RealMetadataFactory.exampleCase3225();
+        FakeDataManager dataMgr = exampleDataManagerCase3225(metadata);
+
+    	helpTestProcess("select * from xmltest.playersDoc where context(manager, manager.firstname) > ALL (select firstname from BaseballPlayers.player)", CARDS_MANAGER, metadata, dataMgr);         //$NON-NLS-1$
+    }
+    
     /**
      * 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 +11243,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 +11288,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: trunk/engine/src/test/java/org/teiid/query/resolver/TestFunctionResolving.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/resolver/TestFunctionResolving.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/resolver/TestFunctionResolving.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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\". An object 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: trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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 {
@@ -2357,7 +2352,7 @@
 
     @Test public void testCreateAlreadyExists() {
         String sql = "CREATE LOCAL TEMPORARY TABLE g1 (column1 string)"; //$NON-NLS-1$
-        helpResolveException(sql, "Cannot create temporary table \"g1\". A table with the same name already exists."); //$NON-NLS-1$
+        helpResolveException(sql, "Cannot create temporary table \"g1\". An object with the same name already exists."); //$NON-NLS-1$
     }
 
     @Test public void testCreateImplicitName() {
@@ -2367,7 +2362,7 @@
     }
     
     @Test public void testCreateInProc() throws Exception{
-        helpResolveException("CREATE VIRTUAL PROCEDURE BEGIN create local temporary table g1(c1 string); end", "Cannot create temporary table \"g1\". A table with the same name already exists.");//$NON-NLS-1$ //$NON-NLS-2$
+        helpResolveException("CREATE VIRTUAL PROCEDURE BEGIN create local temporary table g1(c1 string); end", "Cannot create temporary table \"g1\". An object with the same name already exists.");//$NON-NLS-1$ //$NON-NLS-2$
     }
     
     //this was the old virt.agg procedure.  It was defined in such a way that relied on the scope leak of #temp
@@ -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$
     }
     
@@ -2627,6 +2618,11 @@
         helpResolveException(sql, "Cannot convert insert query expression projected symbol '3' of type java.lang.Integer to insert column 'pm1.g1.e3' of type java.lang.Boolean"); //$NON-NLS-1$
     }
     
+    @Test public void testInsertWithQueryImplicitWithColumns() {
+        String sql = "Insert into #X (x) select 1 as x"; //$NON-NLS-1$
+        helpResolve(sql); //$NON-NLS-1$
+    }
+    
     @Test public void testInsertWithQueryImplicitWithoutColumns() {
         String sql = "Insert into #X select 1 as x, 2 as y, 3 as z"; //$NON-NLS-1$
         helpResolve(sql); //$NON-NLS-1$
@@ -2670,11 +2666,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 +2698,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 +2714,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 +2776,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 +2785,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 +2926,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: trunk/engine/src/test/java/org/teiid/query/resolver/TestXMLResolver.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/resolver/TestXMLResolver.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/resolver/TestXMLResolver.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -22,8 +22,9 @@
 
 package org.teiid.query.resolver;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.*;
 
+import org.junit.Test;
 import org.teiid.query.parser.QueryParser;
 import org.teiid.query.resolver.util.ResolverUtil;
 import org.teiid.query.sql.lang.Command;
@@ -35,26 +36,26 @@
 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 class TestXMLResolver {
     
     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() {
+    @Test public void testXMLCriteriaShortElement() {
         CompareCriteria expected = new CompareCriteria();
         GroupSymbol gs = new GroupSymbol("xmltest.doc1"); //$NON-NLS-1$
         ElementSymbol es = new ElementSymbol("root.node1", null, gs); //$NON-NLS-1$
@@ -67,7 +68,7 @@
         assertEquals("Did not match expected criteria", expected, actual);     //$NON-NLS-1$
     }   
 
-    public void testXMLCriteriaLongElement1() {
+    @Test public void testXMLCriteriaLongElement1() {
         CompareCriteria expected = new CompareCriteria();
         GroupSymbol gs = new GroupSymbol("xmltest.doc1"); //$NON-NLS-1$
         ElementSymbol es = new ElementSymbol("root.node1", null, gs); //$NON-NLS-1$
@@ -81,7 +82,7 @@
         assertEquals("Did not match expected criteria", expected, actual);     //$NON-NLS-1$
     }
     
-    public void testXMLCriteriaLongElement2() {
+    @Test public void testXMLCriteriaLongElement2() {
         CompareCriteria expected1 = new CompareCriteria();
         GroupSymbol gs = new GroupSymbol("xmltest.doc4"); //$NON-NLS-1$
         ElementSymbol es1 = new ElementSymbol("root.node1", null, gs); //$NON-NLS-1$
@@ -94,7 +95,7 @@
         assertEquals("Did not match expected criteria", expected1, actual); //$NON-NLS-1$
     }
     
-    public void testXMLCriteriaLongElement3() {
+    @Test public void testXMLCriteriaLongElement3() {
         GroupSymbol gs = new GroupSymbol("xmltest.doc4"); //$NON-NLS-1$
         CompareCriteria expected2 = new CompareCriteria();
         ElementSymbol es2 = new ElementSymbol("root.node1. at node2", null, gs); //$NON-NLS-1$
@@ -108,7 +109,7 @@
         assertEquals("Did not match expected criteria", expected2, actual); //$NON-NLS-1$
     }
         
-    public void testXMLCriteriaLongElement4() {
+    @Test public void testXMLCriteriaLongElement4() {
         GroupSymbol gs = new GroupSymbol("xmltest.doc4"); //$NON-NLS-1$
         CompareCriteria expected3 = new CompareCriteria();
         ElementSymbol es3 = new ElementSymbol("root.node3", null, gs); //$NON-NLS-1$
@@ -121,76 +122,76 @@
         assertEquals("Did not match expected criteria", expected3, actual);                 //$NON-NLS-1$
     }
     
-    public void testXMLCriteriaLongElement5() {
+    @Test public void testXMLCriteriaLongElement5() {
         helpResolve("select * from xmltest.doc4 where root.node1 = 'yyz'"); //$NON-NLS-1$
     }
     
-    public void testXMLCriteriaLongElement6() {
+    @Test public void testXMLCriteriaLongElement6() {
         helpResolve("select * from xmltest.doc4 where root.node1. at node2 = 'yyz'"); //$NON-NLS-1$
     } 
 
-    public void testXMLCriteriaLongElement7() {    
+    @Test public void testXMLCriteriaLongElement7() {    
         helpResolve("select * from xmltest.doc4 where root.node3 = 'yyz'"); //$NON-NLS-1$
     }
     
-    public void testXMLCriteriaLongElement8() {    
+    @Test public void testXMLCriteriaLongElement8() {    
         helpResolve("select * from xmltest.doc4 where node3 = 'yyz'");         //$NON-NLS-1$
     }
     
-    public void testXMLCriteriaLongElementFail1() {    
+    @Test public void testXMLCriteriaLongElementFail1() {    
         helpResolveException("select * from xmltest.doc4 where node3.node1.node2 = 'xyz'"); //$NON-NLS-1$
     }
     
-    public void testXMLCriteriaLongElementFail2() {    
+    @Test public void testXMLCriteriaLongElementFail2() {    
         helpResolveException("select * from xmltest.doc4 where root.node1.node2.node3 = 'xyz'"); //$NON-NLS-1$
     }
     
-    public void testXMLCriteriaLongElementFail3() {    
+    @Test public void testXMLCriteriaLongElementFail3() {    
         helpResolveException("select * from xmltest.doc4 where root.node1.node3 = 'xyz'"); //$NON-NLS-1$
     }
     
-    public void testXMLCriteriaLongElementFail4() {    
+    @Test public void testXMLCriteriaLongElementFail4() {    
         helpResolveException("select * from xmltest.doc4 where node2.node1.node2 = 'xyz'");                              //$NON-NLS-1$
     }
     
-    public void testXMLCriteriaTempElement1() {
+    @Test public void testXMLCriteriaTempElement1() {
         helpResolve("select * from xmltest.doc4 where tm1.g1.e1 = 'x'"); //$NON-NLS-1$
     } 
     
-    public void testXMLCriteriaTempElement2() {
+    @Test public void testXMLCriteriaTempElement2() {
         helpResolve("select * from xmltest.doc4 where root.node1. at node2 = 'yyz' and tm1.g1.e2 = 'y'"); //$NON-NLS-1$
     }
     
-    public void testXMLCriteriaTempElement3() {
+    @Test public void testXMLCriteriaTempElement3() {
         helpResolve("select * from xmltest.doc4 where tm1.g1.e1 = 'x' and tm1.g1.e2 = 'y'"); //$NON-NLS-1$
     }
 
-    public void testXMLCriteriaTempElementFail1() {    
+    @Test public void testXMLCriteriaTempElementFail1() {    
         helpResolveException("select * from xmltest.doc4 where tm1.g2.e1 = 'xyz'"); //$NON-NLS-1$
     } 
     
-    public void testXMLCriteriaTempElementFail2() {
+    @Test public void testXMLCriteriaTempElementFail2() {
         helpResolveException("select * from xmltest.doc4 where root.node1.node2.node3 = 'xyz' and e1 = 'x'"); //$NON-NLS-1$
     }
     
-    public void testXMLCriteriaTempElementFail3() {
+    @Test public void testXMLCriteriaTempElementFail3() {
         helpResolveException("select * from xmltest.doc4 where e3 = 'xyz' and tm1.g2.e4='m'"); //$NON-NLS-1$
     }
 
     //tests ambiguously-named elements in both root temp group and document
-    public void testXMLAmbiguousName1() {
+    @Test public void testXMLAmbiguousName1() {
         helpResolve("select * from xmltest.doc4 where root.node1 is null"); //$NON-NLS-1$
     }
     
-    public void testXMLAmbiguousName2() {
+    @Test public void testXMLAmbiguousName2() {
         helpResolve("select * from xmltest.doc4 where tm1.g1.node1 = 'yyz'"); //$NON-NLS-1$
     }
     
-    public void testXMLAmbiguousName3() {
+    @Test public void testXMLAmbiguousName3() {
         helpResolveException("select * from xmltest.doc4 where node1 = 'yyz'"); //$NON-NLS-1$
     }    
 
-    public void testXMLCriteriaLongElementInAnonymous() {                  
+    @Test public void testXMLCriteriaLongElementInAnonymous() {                  
         CompareCriteria expected = new CompareCriteria();
         GroupSymbol gs = new GroupSymbol("xmltest.doc2"); //$NON-NLS-1$
         ElementSymbol es = new ElementSymbol("root.node1.node3", null, gs); //$NON-NLS-1$
@@ -203,7 +204,7 @@
         assertEquals("Did not match expected criteria", expected, actual);     //$NON-NLS-1$
     }    
 
-    public void testXMLAmbiguousShortName() {                  
+    @Test public void testXMLAmbiguousShortName() {                  
         CompareCriteria expected = new CompareCriteria();
         ElementSymbol es = new ElementSymbol("node2"); //$NON-NLS-1$
         GroupSymbol gs = new GroupSymbol("doc3"); //$NON-NLS-1$
@@ -218,95 +219,95 @@
     /**
      * defect 9745
      */
-    public void testXMLAttributeInCriteria() {
+    @Test public void testXMLAttributeInCriteria() {
         helpResolve("select * from xmltest.doc4 where root.node1. at node2 = 'x'"); //$NON-NLS-1$
     }
 
     /**
      * defect 9745
      */
-    public void testXMLAttributeInCriteria2() {
+    @Test public void testXMLAttributeInCriteria2() {
         helpResolve("select * from xmltest.doc4 where root.node1.node2 = 'x'"); //$NON-NLS-1$
     }
 
     /**
      * defect 9745
      */
-    public void testXMLAttributeInCriteria3() {
+    @Test public void testXMLAttributeInCriteria3() {
         helpResolve("select * from xmltest.doc4 where node2 = 'x'"); //$NON-NLS-1$
     }
 
-    public void testXMLAttributeElementAmbiguity1() {
+    @Test public void testXMLAttributeElementAmbiguity1() {
         helpResolve("select * from xmltest.doc4 where root.node3.node4 = 'x'"); //$NON-NLS-1$
     }
     
-    public void testXMLAttributeElementAmbiguity2() {        
+    @Test public void testXMLAttributeElementAmbiguity2() {        
         helpResolve("select * from xmltest.doc4 where root.node3. at node4 = 'x'"); //$NON-NLS-1$
     }
     
-    public void testXMLAttributeElementAmbiguity3() {
+    @Test public void testXMLAttributeElementAmbiguity3() {
         helpResolve("select * from xmltest.doc4 where root.node3.node4 = 'x' and root.node3. at node4='y'"); //$NON-NLS-1$
     }       
 
     /*
      * This should resolve to the XML element root.node3.root.node6
      */
-    public void testXMLAttributeElementAmbiguity4() {
+    @Test public void testXMLAttributeElementAmbiguity4() {
         helpResolve("select * from xmltest.doc4 where root.node6 = 'x'"); //$NON-NLS-1$
     }       
 
     /*
      * This should resolve to the XML attribute root. at node6
      */
-    public void testXMLAttributeElementAmbiguity5() {
+    @Test public void testXMLAttributeElementAmbiguity5() {
         helpResolve("select * from xmltest.doc4 where root. at node6 = 'x'"); //$NON-NLS-1$
     }       
 
-    public void testXMLAttributeFullPath() {
+    @Test public void testXMLAttributeFullPath() {
         helpResolve("select * from xmltest.doc4 where xmltest.doc4.root. at node6 = 'x'"); //$NON-NLS-1$
     }       
     
-    public void testXMLCriteriaLongElementWithGroup1() {
+    @Test public void testXMLCriteriaLongElementWithGroup1() {
         helpResolve("select * from xmltest.doc4 where xmltest.doc4.root.node1 = 'yyz'"); //$NON-NLS-1$
     }
     
-    public void testXMLCriteriaLongElementWithGroup2() {
+    @Test public void testXMLCriteriaLongElementWithGroup2() {
         helpResolve("select * from xmltest.doc4 where xmltest.doc4.root.node1. at node2 = 'yyz'"); //$NON-NLS-1$
     } 
 
-    public void testXMLCriteriaLongElementWithGroup3() {    
+    @Test public void testXMLCriteriaLongElementWithGroup3() {    
         helpResolve("select * from xmltest.doc4 where xmltest.doc4.root.node3 = 'yyz'"); //$NON-NLS-1$
     }
 
-    /*public void testXMLElementPotentialAmbiguous() {    
+    /*@Test public void testXMLElementPotentialAmbiguous() {    
         helpResolve("select * from xmltest.doc6 where node = 'yyz'");
     }*/
 
-    public void testXMLSelect() {        
+    @Test public void testXMLSelect() {        
         helpResolve("select root.node3. at node4 from xmltest.doc4"); //$NON-NLS-1$
     }        
 
-    public void testXMLSelect2() {        
+    @Test public void testXMLSelect2() {        
         helpResolve("select root.node3.node4 from xmltest.doc4"); //$NON-NLS-1$
     }        
 
-    public void testXMLSelect3() {        
+    @Test public void testXMLSelect3() {        
         helpResolve("select root. at node6 from xmltest.doc4"); //$NON-NLS-1$
     }    
 
-    public void testXMLSelect4() {        
+    @Test public void testXMLSelect4() {        
         helpResolve("select root.node6 from xmltest.doc4"); //$NON-NLS-1$
     }    
 
-    public void testXMLSelect5() {        
+    @Test public void testXMLSelect5() {        
         helpResolve("select node2 from xmltest.doc4"); //$NON-NLS-1$
     }
     
-    public void testDEFECT_19771() {
+    @Test public void testDEFECT_19771() {
         helpResolveException("select node2 AS NODE2 from xmltest.doc4"); //$NON-NLS-1$
     }
         
-    public void testContext() {                  
+    @Test public void testContext() {                  
         GroupSymbol gs1 = new GroupSymbol("xmltest.doc1"); //$NON-NLS-1$
         ElementSymbol es1 = new ElementSymbol("root.node1.node2.node3", null, gs1); //$NON-NLS-1$
         ElementSymbol es2 = new ElementSymbol("root.node1", null, gs1); //$NON-NLS-1$
@@ -324,7 +325,7 @@
         assertEquals("Did not match expected criteria", expected, actual);         //$NON-NLS-1$
     }    
 
-    public void testRowLimit() {                  
+    @Test public void testRowLimit() {                  
     	GroupSymbol gs1 = new GroupSymbol("xmltest.doc1"); //$NON-NLS-1$
         ElementSymbol es1 = new ElementSymbol("root.node1.node2.node3", null, gs1); //$NON-NLS-1$
         es1.setGroupSymbol(gs1);
@@ -342,7 +343,7 @@
         assertEquals("Did not match expected criteria", expected, actual);         //$NON-NLS-1$
     }    
 
-    public void testRowLimitException() {                  
+    @Test public void testRowLimitException() {                  
     	GroupSymbol gs1 = new GroupSymbol("xmltest.doc1"); //$NON-NLS-1$
         ElementSymbol es1 = new ElementSymbol("root.node1.node2.node3", null, gs1); //$NON-NLS-1$
         Expression[] exprs = new Expression[]{es1};
@@ -359,23 +360,23 @@
         assertEquals("Did not match expected criteria", expected, actual);         //$NON-NLS-1$
     }     
     
-    public void testXMLQueryFail1() {
+    @Test public void testXMLQueryFail1() {
         helpResolveException("SELECT DISTINCT * FROM vm1.doc1"); //$NON-NLS-1$
     }
 
-    public void testXMLQueryFail2() {
+    @Test public void testXMLQueryFail2() {
         helpResolveException("SELECT a2 FROM vm1.doc1"); //$NON-NLS-1$
     }
 
-    public void testXMLQueryFail3() {
+    @Test public void testXMLQueryFail3() {
         helpResolveException("SELECT * FROM vm1.doc1, vm1.doc2"); //$NON-NLS-1$
     }
     
-    public void testXMLWithOrderBy1() {
+    @Test public void testXMLWithOrderBy1() {
         helpResolveException("select * from xmltest.doc4 order by node1");             //$NON-NLS-1$
     }
     
-    public void testConversionInXML() {
+    @Test public void testConversionInXML() {
         // Expected left expression
     	GroupSymbol gs1 = new GroupSymbol("xmltest.doc1"); //$NON-NLS-1$
         ElementSymbol es1 = new ElementSymbol("root.node1", null, gs1); //$NON-NLS-1$
@@ -397,7 +398,7 @@
         assertNotNull("Failed to resolve function", actualRightExpr.getFunctionDescriptor()); //$NON-NLS-1$
     }
 
-    public void testXMLWithSelect1() throws Exception {
+    @Test public void testXMLWithSelect1() throws Exception {
         CompareCriteria expected = new CompareCriteria();
         GroupSymbol gs = new GroupSymbol("xmltest.doc1"); //$NON-NLS-1$
         ElementSymbol es = new ElementSymbol("root.node1", null, gs); //$NON-NLS-1$
@@ -405,16 +406,16 @@
         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$
     } 
     
-    public void testXMLWithSelect1a() {
+    @Test public void testXMLWithSelect1a() {
         helpResolveException("select 'a' from xmltest.doc1 where node1 = 'yyz'", "Expressions cannot be selected by XML Queries"); //$NON-NLS-1$ //$NON-NLS-2$
     } 
 
-    public void testXMLWithSelect2() {
+    @Test public void testXMLWithSelect2() {
         CompareCriteria expected = new CompareCriteria();
         GroupSymbol gs = new GroupSymbol("xmltest.doc1"); //$NON-NLS-1$
         ElementSymbol es = new ElementSymbol("root.node1", null, gs); //$NON-NLS-1$

Modified: trunk/engine/src/test/java/org/teiid/query/rewriter/TestOrderByRewrite.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/rewriter/TestOrderByRewrite.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/rewriter/TestOrderByRewrite.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/sql/util/TestElementSymbolOptimizer.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/sql/util/TestElementSymbolOptimizer.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/sql/util/TestElementSymbolOptimizer.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/sql/visitor/TestEvaluatableVisitor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/sql/visitor/TestEvaluatableVisitor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/sql/visitor/TestEvaluatableVisitor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/sql/visitor/TestSQLStringVisitor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/sql/visitor/TestSQLStringVisitor.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/sql/visitor/TestSQLStringVisitor.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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 {
@@ -1851,7 +1851,7 @@
 
     public void testLimit() {
         Query query = new Query();
-        Select select = new Select(Arrays.asList(new Object[] {new AllSymbol()}));
+        Select select = new Select(Arrays.asList(new AllSymbol()));
         From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a")))); //$NON-NLS-1$
         query.setSelect(select);
         query.setFrom(from);
@@ -1861,7 +1861,7 @@
     
     public void testLimitWithOffset() {
         Query query = new Query();
-        Select select = new Select(Arrays.asList(new Object[] {new AllSymbol()}));
+        Select select = new Select(Arrays.asList(new AllSymbol()));
         From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a")))); //$NON-NLS-1$
         query.setSelect(select);
         query.setFrom(from);
@@ -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: trunk/engine/src/test/java/org/teiid/query/unittest/FakeMetadataFacade.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/unittest/FakeMetadataFacade.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/unittest/FakeMetadataFacade.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/unittest/FakeMetadataFactory.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/unittest/FakeMetadataFactory.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/unittest/FakeMetadataFactory.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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;
-
- at 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. at node6", "root.node1", "root.node1. at node2", "root.node3", "root.node3. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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. at 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: trunk/engine/src/test/java/org/teiid/query/unittest/FakeMetadataObject.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/unittest/FakeMetadataObject.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/unittest/FakeMetadataObject.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/unittest/FakeMetadataStore.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/unittest/FakeMetadataStore.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/unittest/FakeMetadataStore.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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. at node6", "root.node1", "root.node1. at node2", "root.node3", "root.node3. at 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. at 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. at 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. at 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. at 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. at 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("player", 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.player.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.player"); //$NON-NLS-1$
+	    player.setMaxOccurrs(-1);
+	    player.addAttribute(new MappingAttribute("PlayerID", "xmltest.player.employeeNum")); //$NON-NLS-1$ //$NON-NLS-2$
+	    player.addChildElement(new MappingElement("FirstName", "xmltest.player.firstName")); //$NON-NLS-1$ //$NON-NLS-2$
+	    player.addChildElement(new MappingElement("LastName", "xmltest.player.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. at 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. at 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. at 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: trunk/engine/src/test/java/org/teiid/query/validator/TestUpdateValidator.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/validator/TestUpdateValidator.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/validator/TestUpdateValidator.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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: trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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);
@@ -118,77 +124,47 @@
         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$
         
-    	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$
     }
 
 }

Deleted: trunk/engine/src/test/resources/text/cdm_dos_win.txt
===================================================================
--- trunk/engine/src/test/resources/text/cdm_dos_win.txt	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/engine/src/test/resources/text/cdm_dos_win.txt	2011-06-05 01:32:10 UTC (rev 3218)
@@ -1,52 +0,0 @@
- 000183USD07/26/200107/26/2004                                               000183        USD      07/26/2001                     07/26/2004                              10000000.00 Summit       195205NY                 0.005450             0.000000 MCREDCLN     
- 000184USD07/26/200107/26/2004                                               000184        USD      07/26/2001                     07/26/2004                              10000000.00 Summit       195219NY                 0.005450             0.000000 NYBDUMMY     
- 000185USD07/26/200107/26/2004                                               000185        USD      07/26/2001                     07/26/2004                              10000000.00 Summit       195233NY                 0.009700             0.000000 MCREDCLN     
- 000186USD07/26/200107/26/2004                                               000186        USD      07/26/2001                     07/26/2004                              10000000.00 Summit       195234NY                 0.009700             0.000000 NYBDUMMY     
- 000258AUSD12/12/200209/15/2005                                              000258        USD      12/12/2002                     09/15/2005                              10000000.00 Summit       247299N                  0.011500             0.000000 DCC2         
- 000259AUSD01/17/200303/20/2005                                              000259        USD      01/17/2003                     03/20/2005                              10000000.00 Summit       247300N                  0.011000             0.000000 DCC2         
- 000273USD04/25/200307/07/2006                                               000273        USD      04/25/2003                     07/07/2006                               5000000.00 Summit       258123NY                 0.008000             0.000000 LTINV        
- 000276AUSD05/10/200306/20/2008                                              000276        USD      05/10/2003                     06/20/2008                              10000000.00 Summit       260100N                  0.033000             0.000000 DCC2         
- 000277AUSD05/10/200306/20/2008                                              000277        USD      05/10/2003                     06/20/2008                               5000000.00 Summit       260101N                  0.006500             0.000000 DCC2         
- 000278AUSD05/13/200306/20/2008                                              000278        USD      05/13/2003                     06/20/2008                               5000000.00 Summit       260102N                  0.033000             0.000000 DCC2         
- 000279AUSD05/14/200306/20/2008                                              000279        USD      05/14/2003                     06/20/2008                               5000000.00 Summit       260131N                  0.033000             0.000000 DCC2         
- 000280USD06/11/200307/07/2006                                               000280        USD      06/11/2003                     07/07/2006                               5000000.00 Summit       264602NY                 0.008900             0.000000 LTINV        
- 000289AUSD07/03/200309/20/2008                                              000289        USD      07/03/2003                     09/20/2008                               5000000.00 Summit       265496NY                 0.004400             0.000000 LTINV        
- 000292USD07/19/200309/20/2008                                               000292        USD      07/19/2003                     09/20/2008                               5000000.00 Summit       271005NY                 0.005000             0.000000 LTINV        
- 000350USD01/28/200403/20/2009                                               000350        USD      01/28/2004                     03/20/2009                              10000000.00 Summit       314996N                  0.005200             0.000000 DCC2         
- 000354USD03/10/200403/10/2007                                               000354        USD      03/10/2004                     03/10/2007                               9324082.77 Summit       318622NY                 0.037500             0.000000 LTTRSCDS     
- 000357USD03/16/200403/16/2007                                               000357        USD      03/16/2004                     03/16/2007                               9924050.62 Summit       318638NY                 0.030000             0.000000 LTTRSCDS     
- 000359USD03/09/200403/09/2007                                               000359        USD      03/09/2004                     03/09/2007                               9329349.59 Summit       318641NY                 0.027500             0.000000 LTTRSCDS     
- 000360USD03/18/200403/18/2007                                               000360        USD      03/18/2004                     03/18/2007                                232935.47 Summit       318642NY                 0.032500             0.000000 LTTRSCDS     
- 000352USD04/08/200404/08/2007                                               000352        USD      04/08/2004                     04/08/2007                               9788013.59 Summit       318643NY                 0.032500             0.000000 LTTRSCDS     
- 000353USD03/04/200403/04/2007                                               000353        USD      03/04/2004                     03/04/2007                                809831.58 Summit       318644NY                 0.032500             0.000000 LTTRSCDS     
- 000353USD03/04/200403/04/2007                                               000353        USD      03/04/2004                     03/04/2007                                705882.35 Summit       325357NY                 0.032500             0.000000 LTTRSCDS     
- 000353USD03/04/200403/04/2007                                               000353        USD      03/04/2004                     03/04/2007                                156623.38 Summit       325358NY                 0.032500             0.000000 LTTRSCDS     
- 000353USD03/04/200403/04/2007                                               000353        USD      03/04/2004                     03/04/2007                                278643.02 Summit       325363NY                 0.032500             0.000000 LTTRSCDS     
- 000353USD03/04/200403/04/2007                                               000353        USD      03/04/2004                     03/04/2007                                711809.48 Summit       325364NY                 0.032500             0.000000 LTTRSCDS     
- 000359USD03/09/200403/09/2007                                               000359        USD      03/09/2004                     03/09/2007                                 76890.25 Summit       325366NY                 0.027500             0.000000 LTTRSCDS     
- 000360USD03/18/200403/18/2007                                               000360        USD      03/18/2004                     03/18/2007                               1049811.00 Summit       329001NY                 0.032500             0.000000 LTTRSCDS     
- 000360USD03/18/200403/18/2007                                               000360        USD      03/18/2004                     03/18/2007                                414407.12 Summit       329002NY                 0.032500             0.000000 LTTRSCDS     
- 000360USD03/18/200403/18/2007                                               000360        USD      03/18/2004                     03/18/2007                               1204408.30 Summit       329003NY                 0.032500             0.000000 LTTRSCDS     
- 000360USD03/18/200403/18/2007                                               000360        USD      03/18/2004                     03/18/2007                               1058626.60 Summit       329004NY                 0.032500             0.000000 LTTRSCDS     
- 000362USD04/12/200404/12/2007                                               000362        USD      04/12/2004                     04/12/2007                                194934.82 Summit       331567NY                 0.040000             0.000000 LTTRSCDS     
- 000362USD04/12/200404/12/2007                                               000362        USD      04/12/2004                     04/12/2007                                131062.23 Summit       335678NY                 0.040000             0.000000 LTTRSCDS     
- 000362USD04/12/200404/12/2007                                               000362        USD      04/12/2004                     04/12/2007                               1094136.66 Summit       335679NY                 0.040000             0.000000 LTTRSCDS     
- 000362USD04/12/200404/12/2007                                               000362        USD      04/12/2004                     04/12/2007                               2785075.14 Summit       335680NY                 0.040000             0.000000 LTTRSCDS     
- 000362USD04/12/200404/12/2007                                               000362        USD      04/12/2004                     04/12/2007                               2785075.14 Summit       335681NY                 0.040000             0.000000 LTTRSCDS     
- 000362USD04/12/200404/12/2007                                               000362        USD      04/12/2004                     04/12/2007                               2984009.08 Summit       335682NY                 0.040000             0.000000 LTTRSCDS     
- 000363USD05/03/200405/03/2007                                               000363        USD      05/03/2004                     05/03/2007                              10000000.00 Summit       338242NY                 0.025000             0.000000 LTTRSCDS     
- 000364USD05/17/200405/17/2007                                               000364        USD      05/17/2004                     05/17/2007                               5000000.00 Summit       338820NY                 0.032500             0.000000 LTTRSCDS     
- 000365USD05/07/200406/20/2009                                               000365        USD      05/07/2004                     06/20/2009                               5000000.00 Summit       340411N                  0.004800             0.000000 DCC2         
- 000099USD12/06/199912/06/2004                                               000099        USD      12/06/1999                     12/06/2004                             200000000.00 Summit       340805NY                 0.000000             0.000000 PCTRSCDS     
- 000129USD04/03/200010/01/2008                                               000129        USD      04/03/2000                     10/01/2008                             200000000.00 Summit       340834NY                 0.000000             0.000000 PCTRSCDS     
- 000148USD09/12/200012/19/2005                                               000148        USD      09/12/2000                     12/19/2005                                573667.12 Summit       340844NY                 0.000000             0.000000 PCTRSCDS     
- 000149USD09/12/200012/19/2005                                               000149        USD      09/12/2000                     12/19/2005                               2118155.52 Summit       340847NY                 0.000000             0.000000 PCTRSCDS     
- 000150USD09/12/200012/19/2005                                               000150        USD      09/12/2000                     12/19/2005                               4986491.88 Summit       340848NY                 0.000000             0.000000 PCTRSCDS     
- 000366USD05/06/200405/06/2007                                               000366        USD      05/06/2004                     05/06/2007                               3058823.53 Summit       341369NY                 0.030000             0.000000 LTTRSCDS     
- 000367USD05/06/200405/06/2007                                               000367        USD      05/06/2004                     05/06/2007                               6941176.47 Summit       341377NY                 0.030000             0.000000 LTTRSCDS     
- 000213USD02/11/200202/11/2007                                               000213        USD      02/11/2002                     02/11/2007                               8000000.00 Summit       343117NY                 0.056500             0.000000 CNA2         
- 000272USD03/05/200301/31/2005                                               000272        USD      03/05/2003                     01/31/2005                              28000000.00 Summit       343123NY                 0.006000             0.000000 CNA2         
- 000333USD11/13/200311/20/2004                                               000333        USD      11/13/2003                     11/20/2004                              25000000.00 Summit       343151NY                 0.003800             0.000000 CNA2         
- 000368USD05/24/200405/24/2007                                               000368        USD      05/24/2004                     05/24/2007                              10000000.00 Summit       343169NY                 0.025000             0.000000 LTTRSCDS     
- 000168USD12/18/200001/31/2006                                               000168        USD      12/18/2000                     01/31/2006                             672096851.46 Summit       344846NY                 0.000000             0.000000 ASGCGD       
- 000369USD05/20/200405/20/2007                                               000369        USD      05/20/2004                     05/20/2007                              10000000.00 Summit       344851NY                 0.032500             0.000000 LTTRSCDS     

Copied: trunk/engine/src/test/resources/text/cdm_dos_win.txt (from rev 3216, branches/7.4.x/engine/src/test/resources/text/cdm_dos_win.txt)
===================================================================
--- trunk/engine/src/test/resources/text/cdm_dos_win.txt	                        (rev 0)
+++ trunk/engine/src/test/resources/text/cdm_dos_win.txt	2011-06-05 01:32:10 UTC (rev 3218)
@@ -0,0 +1,52 @@
+ 000183USD07/26/200107/26/2004                                               000183        USD      07/26/2001                     07/26/2004                              10000000.00 Summit       195205NY                 0.005450             0.000000 MCREDCLN     
+ 000184USD07/26/200107/26/2004                                               000184        USD      07/26/2001                     07/26/2004                              10000000.00 Summit       195219NY                 0.005450             0.000000 NYBDUMMY     
+ 000185USD07/26/200107/26/2004                                               000185        USD      07/26/2001                     07/26/2004                              10000000.00 Summit       195233NY                 0.009700             0.000000 MCREDCLN     
+ 000186USD07/26/200107/26/2004                                               000186        USD      07/26/2001                     07/26/2004                              10000000.00 Summit       195234NY                 0.009700             0.000000 NYBDUMMY     
+ 000258AUSD12/12/200209/15/2005                                              000258        USD      12/12/2002                     09/15/2005                              10000000.00 Summit       247299N                  0.011500             0.000000 DCC2         
+ 000259AUSD01/17/200303/20/2005                                              000259        USD      01/17/2003                     03/20/2005                              10000000.00 Summit       247300N                  0.011000             0.000000 DCC2         
+ 000273USD04/25/200307/07/2006                                               000273        USD      04/25/2003                     07/07/2006                               5000000.00 Summit       258123NY                 0.008000             0.000000 LTINV        
+ 000276AUSD05/10/200306/20/2008                                              000276        USD      05/10/2003                     06/20/2008                              10000000.00 Summit       260100N                  0.033000             0.000000 DCC2         
+ 000277AUSD05/10/200306/20/2008                                              000277        USD      05/10/2003                     06/20/2008                               5000000.00 Summit       260101N                  0.006500             0.000000 DCC2         
+ 000278AUSD05/13/200306/20/2008                                              000278        USD      05/13/2003                     06/20/2008                               5000000.00 Summit       260102N                  0.033000             0.000000 DCC2         
+ 000279AUSD05/14/200306/20/2008                                              000279        USD      05/14/2003                     06/20/2008                               5000000.00 Summit       260131N                  0.033000             0.000000 DCC2         
+ 000280USD06/11/200307/07/2006                                               000280        USD      06/11/2003                     07/07/2006                               5000000.00 Summit       264602NY                 0.008900             0.000000 LTINV        
+ 000289AUSD07/03/200309/20/2008                                              000289        USD      07/03/2003                     09/20/2008                               5000000.00 Summit       265496NY                 0.004400             0.000000 LTINV        
+ 000292USD07/19/200309/20/2008                                               000292        USD      07/19/2003                     09/20/2008                               5000000.00 Summit       271005NY                 0.005000             0.000000 LTINV        
+ 000350USD01/28/200403/20/2009                                               000350        USD      01/28/2004                     03/20/2009                              10000000.00 Summit       314996N                  0.005200             0.000000 DCC2         
+ 000354USD03/10/200403/10/2007                                               000354        USD      03/10/2004                     03/10/2007                               9324082.77 Summit       318622NY                 0.037500             0.000000 LTTRSCDS     
+ 000357USD03/16/200403/16/2007                                               000357        USD      03/16/2004                     03/16/2007                               9924050.62 Summit       318638NY                 0.030000             0.000000 LTTRSCDS     
+ 000359USD03/09/200403/09/2007                                               000359        USD      03/09/2004                     03/09/2007                               9329349.59 Summit       318641NY                 0.027500             0.000000 LTTRSCDS     
+ 000360USD03/18/200403/18/2007                                               000360        USD      03/18/2004                     03/18/2007                                232935.47 Summit       318642NY                 0.032500             0.000000 LTTRSCDS     
+ 000352USD04/08/200404/08/2007                                               000352        USD      04/08/2004                     04/08/2007                               9788013.59 Summit       318643NY                 0.032500             0.000000 LTTRSCDS     
+ 000353USD03/04/200403/04/2007                                               000353        USD      03/04/2004                     03/04/2007                                809831.58 Summit       318644NY                 0.032500             0.000000 LTTRSCDS     
+ 000353USD03/04/200403/04/2007                                               000353        USD      03/04/2004                     03/04/2007                                705882.35 Summit       325357NY                 0.032500             0.000000 LTTRSCDS     
+ 000353USD03/04/200403/04/2007                                               000353        USD      03/04/2004                     03/04/2007                                156623.38 Summit       325358NY                 0.032500             0.000000 LTTRSCDS     
+ 000353USD03/04/200403/04/2007                                               000353        USD      03/04/2004                     03/04/2007                                278643.02 Summit       325363NY                 0.032500             0.000000 LTTRSCDS     
+ 000353USD03/04/200403/04/2007                                               000353        USD      03/04/2004                     03/04/2007                                711809.48 Summit       325364NY                 0.032500             0.000000 LTTRSCDS     
+ 000359USD03/09/200403/09/2007                                               000359        USD      03/09/2004                     03/09/2007                                 76890.25 Summit       325366NY                 0.027500             0.000000 LTTRSCDS     
+ 000360USD03/18/200403/18/2007                                               000360        USD      03/18/2004                     03/18/2007                               1049811.00 Summit       329001NY                 0.032500             0.000000 LTTRSCDS     
+ 000360USD03/18/200403/18/2007                                               000360        USD      03/18/2004                     03/18/2007                                414407.12 Summit       329002NY                 0.032500             0.000000 LTTRSCDS     
+ 000360USD03/18/200403/18/2007                                               000360        USD      03/18/2004                     03/18/2007                               1204408.30 Summit       329003NY                 0.032500             0.000000 LTTRSCDS     
+ 000360USD03/18/200403/18/2007                                               000360        USD      03/18/2004                     03/18/2007                               1058626.60 Summit       329004NY                 0.032500             0.000000 LTTRSCDS     
+ 000362USD04/12/200404/12/2007                                               000362        USD      04/12/2004                     04/12/2007                                194934.82 Summit       331567NY                 0.040000             0.000000 LTTRSCDS     
+ 000362USD04/12/200404/12/2007                                               000362        USD      04/12/2004                     04/12/2007                                131062.23 Summit       335678NY                 0.040000             0.000000 LTTRSCDS     
+ 000362USD04/12/200404/12/2007                                               000362        USD      04/12/2004                     04/12/2007                               1094136.66 Summit       335679NY                 0.040000             0.000000 LTTRSCDS     
+ 000362USD04/12/200404/12/2007                                               000362        USD      04/12/2004                     04/12/2007                               2785075.14 Summit       335680NY                 0.040000             0.000000 LTTRSCDS     
+ 000362USD04/12/200404/12/2007                                               000362        USD      04/12/2004                     04/12/2007                               2785075.14 Summit       335681NY                 0.040000             0.000000 LTTRSCDS     
+ 000362USD04/12/200404/12/2007                                               000362        USD      04/12/2004                     04/12/2007                               2984009.08 Summit       335682NY                 0.040000             0.000000 LTTRSCDS     
+ 000363USD05/03/200405/03/2007                                               000363        USD      05/03/2004                     05/03/2007                              10000000.00 Summit       338242NY                 0.025000             0.000000 LTTRSCDS     
+ 000364USD05/17/200405/17/2007                                               000364        USD      05/17/2004                     05/17/2007                               5000000.00 Summit       338820NY                 0.032500             0.000000 LTTRSCDS     
+ 000365USD05/07/200406/20/2009                                               000365        USD      05/07/2004                     06/20/2009                               5000000.00 Summit       340411N                  0.004800             0.000000 DCC2         
+ 000099USD12/06/199912/06/2004                                               000099        USD      12/06/1999                     12/06/2004                             200000000.00 Summit       340805NY                 0.000000             0.000000 PCTRSCDS     
+ 000129USD04/03/200010/01/2008                                               000129        USD      04/03/2000                     10/01/2008                             200000000.00 Summit       340834NY                 0.000000             0.000000 PCTRSCDS     
+ 000148USD09/12/200012/19/2005                                               000148        USD      09/12/2000                     12/19/2005                                573667.12 Summit       340844NY                 0.000000             0.000000 PCTRSCDS     
+ 000149USD09/12/200012/19/2005                                               000149        USD      09/12/2000                     12/19/2005                               2118155.52 Summit       340847NY                 0.000000             0.000000 PCTRSCDS     
+ 000150USD09/12/200012/19/2005                                               000150        USD      09/12/2000                     12/19/2005                               4986491.88 Summit       340848NY                 0.000000             0.000000 PCTRSCDS     
+ 000366USD05/06/200405/06/2007                                               000366        USD      05/06/2004                     05/06/2007                               3058823.53 Summit       341369NY                 0.030000             0.000000 LTTRSCDS     
+ 000367USD05/06/200405/06/2007                                               000367        USD      05/06/2004                     05/06/2007                               6941176.47 Summit       341377NY                 0.030000             0.000000 LTTRSCDS     
+ 000213USD02/11/200202/11/2007                                               000213        USD      02/11/2002                     02/11/2007                               8000000.00 Summit       343117NY                 0.056500             0.000000 CNA2         
+ 000272USD03/05/200301/31/2005                                               000272        USD      03/05/2003                     01/31/2005                              28000000.00 Summit       343123NY                 0.006000             0.000000 CNA2         
+ 000333USD11/13/200311/20/2004                                               000333        USD      11/13/2003                     11/20/2004                              25000000.00 Summit       343151NY                 0.003800             0.000000 CNA2         
+ 000368USD05/24/200405/24/2007                                               000368        USD      05/24/2004                     05/24/2007                              10000000.00 Summit       343169NY                 0.025000             0.000000 LTTRSCDS     
+ 000168USD12/18/200001/31/2006                                               000168        USD      12/18/2000                     01/31/2006                             672096851.46 Summit       344846NY                 0.000000             0.000000 ASGCGD       
+ 000369USD05/20/200405/20/2007                                               000369        USD      05/20/2004                     05/20/2007                              10000000.00 Summit       344851NY                 0.032500             0.000000 LTTRSCDS     


Property changes on: trunk/engine/src/test/resources/text/cdm_dos_win.txt
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:mergeinfo
   + /branches/7.4.x/engine/src/test/resources/text/cdm_dos_win.txt:3149-3217

Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -22,6 +22,7 @@
 package org.teiid.jboss.deployers;
 
 import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
@@ -105,7 +106,6 @@
 import org.teiid.metadata.AbstractMetadataRecord;
 import org.teiid.metadata.Column;
 import org.teiid.metadata.ColumnStats;
-import org.teiid.metadata.MetadataRepository;
 import org.teiid.metadata.Procedure;
 import org.teiid.metadata.Schema;
 import org.teiid.metadata.Table;
@@ -152,6 +152,7 @@
 
 	private String eventDistributorName;
 	private transient EventDistributor eventDistributor;
+	private transient EventDistributor eventDistributorProxy;
 	
     public RuntimeEngineDeployer() {
 		// TODO: this does not belong here
@@ -181,8 +182,21 @@
 				LogManager.logDetail(LogConstants.CTX_RUNTIME, ne, IntegrationPlugin.Util.getString("jndi_failed", new Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
 			}
 		}
+		this.dqpCore.setMetadataRepository(this.vdbRepository.getMetadataRepository());
+		this.dqpCore.setEventDistributor(this.eventDistributor);
 		this.dqpCore.start(this);
-		this.dqpCore.getDataTierManager().setEventDistributor(this.eventDistributor);		
+		this.eventDistributorProxy = (EventDistributor)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {EventDistributor.class}, new InvocationHandler() {
+			
+			@Override
+			public Object invoke(Object proxy, Method method, Object[] args)
+					throws Throwable {
+				method.invoke(RuntimeEngineDeployer.this, args);
+				if (eventDistributor != null) {
+					method.invoke(eventDistributor, args);
+				}
+				return null;
+			}
+		});
     	// create the necessary services
     	createClientServices();
     	
@@ -684,7 +698,7 @@
 		}
 		long ts = System.currentTimeMillis();
 		for (String name:objectNames) {
-			Table table = s.getTables().get(name);
+			Table table = s.getTables().get(name.toUpperCase());
 			if (table == null) {
 				continue;
 			}
@@ -799,14 +813,7 @@
 	
 	@Override
 	public EventDistributor getEventDistributor() {
-		if (this.eventDistributor != null) { 
-			return eventDistributor;
-		}
-		return this;
+		return this.eventDistributorProxy;
 	}
 	
-	@Override
-	public MetadataRepository getMetadataRepository() {
-		return this.vdbRepository.getMetadataRepository();
-	}
 }

Modified: trunk/metadata/src/test/java/org/teiid/cdk/api/TranslationUtility.java
===================================================================
--- trunk/metadata/src/test/java/org/teiid/cdk/api/TranslationUtility.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/metadata/src/test/java/org/teiid/cdk/api/TranslationUtility.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -24,7 +24,9 @@
 
 import java.io.IOException;
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 
 import org.teiid.cdk.CommandBuilder;
 import org.teiid.dqp.internal.datamgr.RuntimeMetadataImpl;
@@ -53,25 +55,36 @@
 public class TranslationUtility {
     
     private QueryMetadataInterface metadata;
+    private FunctionLibrary functionLibrary;
 
     /**
      * Construct a utility instance with a given vdb file.  
      * @param vdbFile The .vdb file name representing metadata for the connector
      */
     public TranslationUtility(String vdbFile) {
-        metadata = VDBMetadataFactory.getVDBMetadata(vdbFile);     
+        initWrapper(VDBMetadataFactory.getVDBMetadata(vdbFile));
     }
+
+	private void initWrapper(QueryMetadataInterface acutalMetadata) {
+		functionLibrary = acutalMetadata.getFunctionLibrary();
+		metadata = new BasicQueryMetadataWrapper(acutalMetadata) {
+        	@Override
+        	public FunctionLibrary getFunctionLibrary() {
+        		return functionLibrary;
+        	}
+        };
+	}
     
     public TranslationUtility(URL url) {
         try {
-			metadata = VDBMetadataFactory.getVDBMetadata(url, null);
+    		initWrapper(VDBMetadataFactory.getVDBMetadata(url, null));
 		} catch (IOException e) {
 			throw new RuntimeException(e);
 		}     
     }
     
     public TranslationUtility(QueryMetadataInterface metadata) {
-    	this.metadata = metadata;
+    	initWrapper(metadata);
     }
     
     public Command parseCommand(String sql, boolean generateAliases, boolean supportsGroupAliases) {
@@ -98,14 +111,13 @@
     public RuntimeMetadata createRuntimeMetadata() {
         return new RuntimeMetadataImpl(metadata);
     }
+    
+    private List<FunctionTree> functions = new ArrayList<FunctionTree>();
+    
+    public void addUDF(String schema, Collection<FunctionMethod> methods) {
+    	this.functions.add(new FunctionTree(schema, new UDFSource(methods)));
+		SystemFunctionManager sfm = new SystemFunctionManager();
+		functionLibrary = new FunctionLibrary(sfm.getSystemFunctions(), this.functions.toArray(new FunctionTree[this.functions.size()]));
+    }
 
-	public void setUDF(final Collection<FunctionMethod> methods) {
-		this.metadata = new BasicQueryMetadataWrapper(this.metadata) {
-			@Override
-			public FunctionLibrary getFunctionLibrary() {
-				SystemFunctionManager sfm = new SystemFunctionManager();
-				return new FunctionLibrary(sfm.getSystemFunctions(), new FunctionTree("foo", new UDFSource(methods)));  //$NON-NLS-1$
-			}
-		};
-	}
 }

Modified: trunk/metadata/src/test/java/org/teiid/cdk/unittest/FakeTranslationFactory.java
===================================================================
--- trunk/metadata/src/test/java/org/teiid/cdk/unittest/FakeTranslationFactory.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/metadata/src/test/java/org/teiid/cdk/unittest/FakeTranslationFactory.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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;
 
-
+ at 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());
 	}
 	
 }

Copied: trunk/metadata/src/test/java/org/teiid/metadata/index/TestStagingTable.java (from rev 3217, branches/7.4.x/metadata/src/test/java/org/teiid/metadata/index/TestStagingTable.java)
===================================================================
--- trunk/metadata/src/test/java/org/teiid/metadata/index/TestStagingTable.java	                        (rev 0)
+++ trunk/metadata/src/test/java/org/teiid/metadata/index/TestStagingTable.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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;
+
+ at 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());
+	}
+	
+}

Copied: trunk/metadata/src/test/resources/test.vdb (from rev 3217, branches/7.4.x/metadata/src/test/resources/test.vdb)
===================================================================
(Binary files differ)

Modified: trunk/runtime/src/main/java/org/teiid/odbc/ODBCClientRemote.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/odbc/ODBCClientRemote.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/runtime/src/main/java/org/teiid/odbc/ODBCClientRemote.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -85,7 +85,7 @@
 	void functionCallResponse(byte[] data);
 	void functionCallResponse(int data);
 	
-	void sslDenied();
+	void sendSslResponse();
 	
 	// unimplemented backend messages
 	

Modified: trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -637,7 +637,7 @@
 	
 	@Override
 	public void sslRequest() {
-		this.client.sslDenied();
+		this.client.sendSslResponse();
 	}
 	
 	private void setEncoding() {

Modified: trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -185,6 +185,7 @@
         newSession.setApplicationName(applicationName);
         newSession.setClientHostName(properties.getProperty(TeiidURL.CONNECTION.CLIENT_HOSTNAME));
         newSession.setIPAddress(properties.getProperty(TeiidURL.CONNECTION.CLIENT_IP_ADDRESS));
+        newSession.setClientHardwareAddress(properties.getProperty(TeiidURL.CONNECTION.CLIENT_MAC));
         newSession.setSecurityDomain(securityDomain);
         if (vdb != null) {
 	        newSession.setVDBName(vdb.getName());
@@ -195,7 +196,7 @@
         newSession.setLoginContext(loginContext);
         newSession.setSecurityContext(securityContext);
         newSession.setVdb(vdb);
-        LogManager.logDetail(LogConstants.CTX_SECURITY, new Object[] {"Logon successful for \"", userName, "\" - created SessionID \"", newSession.getSessionToken().getSessionID(), "\"" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        LogManager.logDetail(LogConstants.CTX_SECURITY, new Object[] {"Logon successful, created", newSession }); //$NON-NLS-1$ 
         this.sessionCache.put(newSession.getSessionId(), newSession);
         return newSession;
 	}

Modified: trunk/runtime/src/main/java/org/teiid/services/TeiidLoginContext.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/services/TeiidLoginContext.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/runtime/src/main/java/org/teiid/services/TeiidLoginContext.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -118,7 +118,6 @@
 				this.loginContext.login();
 				this.userName = baseUsername+AT+domain;
 				this.securitydomain = domain;
-				LogManager.logDetail(LogConstants.CTX_SECURITY, new Object[] {"Logon successful for \"", username, "\""}); //$NON-NLS-1$ //$NON-NLS-2$
 				return;
 			} catch (LoginException e) {
 				LogManager.logDetail(LogConstants.CTX_SECURITY,e, e.getMessage()); 

Modified: trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -60,7 +60,7 @@
 	public LogonResult logon(Properties connProps) throws LogonException,
 			ComponentNotFoundException {
 		DQPWorkContext workContext = DQPWorkContext.getWorkContext();
-		SessionToken oldToken = workContext.getSessionToken();
+		String oldSessionId = workContext.getSessionId();
         String applicationName = connProps.getProperty(TeiidURL.CONNECTION.APP_NAME);
         // user may be null if using trustedToken to log on
         String user = connProps.getProperty(TeiidURL.CONNECTION.USER_NAME, CoreConstants.DEFAULT_ANON_USERNAME);
@@ -78,9 +78,9 @@
 	        if (DQPWorkContext.getWorkContext().getClientAddress() == null) {
 				sessionInfo.setEmbedded(true);
 	        }
-	        if (oldToken != null) {
+	        if (oldSessionId != null) {
 	        	try {
-					this.service.closeSession(oldToken.getSessionID());
+					this.service.closeSession(oldSessionId);
 				} catch (InvalidSessionException e) {
 				}
 	        }

Modified: trunk/runtime/src/main/java/org/teiid/transport/ODBCSocketListener.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/ODBCSocketListener.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/runtime/src/main/java/org/teiid/transport/ODBCSocketListener.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -23,11 +23,8 @@
 
 import java.util.Properties;
 
-import javax.net.ssl.SSLEngine;
-
 import org.jboss.netty.channel.ChannelPipeline;
 import org.jboss.netty.channel.DefaultChannelPipeline;
-import org.jboss.netty.handler.ssl.SslHandler;
 import org.teiid.common.buffer.StorageManager;
 import org.teiid.core.TeiidException;
 import org.teiid.jdbc.EmbeddedProfile;
@@ -66,12 +63,8 @@
 			public ChannelPipeline getPipeline() throws Exception {
 				ChannelPipeline pipeline = new DefaultChannelPipeline();
 
-				SSLEngine engine = config.getServerSSLEngine();
-			    if (engine != null) {
-			        pipeline.addLast("ssl", new SslHandler(engine)); //$NON-NLS-1$
-			    }
 			    pipeline.addLast("odbcFrontendProtocol", new PgFrontendProtocol(1 << 20)); //$NON-NLS-1$
-			    pipeline.addLast("odbcBackendProtocol", new PgBackendProtocol(maxLobSize)); //$NON-NLS-1$
+			    pipeline.addLast("odbcBackendProtocol", new PgBackendProtocol(maxLobSize, config)); //$NON-NLS-1$
 			    pipeline.addLast("handler", this); //$NON-NLS-1$
 			    return pipeline;
 			}			

Modified: trunk/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -28,6 +28,7 @@
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.nio.charset.Charset;
+import java.security.GeneralSecurityException;
 import java.sql.Blob;
 import java.sql.Clob;
 import java.sql.ParameterMetaData;
@@ -41,13 +42,18 @@
 import java.util.List;
 import java.util.Properties;
 
+import javax.net.ssl.SSLEngine;
+
 import org.jboss.netty.buffer.ChannelBuffer;
 import org.jboss.netty.buffer.ChannelBuffers;
 import org.jboss.netty.channel.ChannelDownstreamHandler;
 import org.jboss.netty.channel.ChannelEvent;
+import org.jboss.netty.channel.ChannelFuture;
+import org.jboss.netty.channel.ChannelFutureListener;
 import org.jboss.netty.channel.ChannelHandlerContext;
 import org.jboss.netty.channel.Channels;
 import org.jboss.netty.channel.MessageEvent;
+import org.jboss.netty.handler.ssl.SslHandler;
 import org.teiid.client.util.ResultsFuture;
 import org.teiid.core.util.ObjectConverterUtil;
 import org.teiid.core.util.ReaderInputStream;
@@ -59,6 +65,7 @@
 import org.teiid.logging.LogManager;
 import org.teiid.net.socket.ServiceInvocationStruct;
 import org.teiid.odbc.ODBCClientRemote;
+import org.teiid.runtime.RuntimePlugin;
 import org.teiid.transport.pg.PGbytea;
 
 /**
@@ -68,7 +75,25 @@
 @SuppressWarnings("nls")
 public class PgBackendProtocol implements ChannelDownstreamHandler, ODBCClientRemote {
 	
-    private final class ResultsWorkItem implements Runnable {
+    private final class SSLEnabler implements ChannelFutureListener {
+    	
+    	private SSLEngine engine;
+    	
+		public SSLEnabler(SSLEngine engine) {
+			this.engine = engine;
+		}
+
+		@Override
+		public void operationComplete(ChannelFuture future) throws Exception {
+			if (future.isSuccess()) {
+				SslHandler handler = new SslHandler(engine);
+				future.getChannel().getPipeline().addFirst("sslHandler", handler);
+				handler.handshake();
+			}
+		}
+	}
+
+	private final class ResultsWorkItem implements Runnable {
 		private final List<PgColInfo> cols;
 		private final String sql;
 		private final ResultSetImpl rs;
@@ -164,8 +189,11 @@
     
 	private volatile ResultsFuture<Boolean> nextFuture;
 
-    public PgBackendProtocol(int maxLobSize) {
+	private SSLConfiguration config;
+
+    public PgBackendProtocol(int maxLobSize, SSLConfiguration config) {
     	this.maxLobSize = maxLobSize;
+    	this.config = config;
     }
     
 	@Override
@@ -550,10 +578,23 @@
 	}	
 	
 	@Override
-	public void sslDenied() {
+	public void sendSslResponse() {
+		SSLEngine engine = null;
+		try {
+			engine = config.getServerSSLEngine();
+		} catch (IOException e) {
+			LogManager.logError(LogConstants.CTX_ODBC, e, RuntimePlugin.Util.getString("PgBackendProtocol.ssl_error"));
+		} catch (GeneralSecurityException e) {
+			LogManager.logError(LogConstants.CTX_ODBC, e, RuntimePlugin.Util.getString("PgBackendProtocol.ssl_error"));
+		}
 		ChannelBuffer buffer = ChannelBuffers.directBuffer(1);
-		buffer.writeByte('N');
-		Channels.write(this.ctx, this.message.getFuture(), buffer, this.message.getRemoteAddress());		
+		if (engine == null) {
+			buffer.writeByte('N');
+		} else {
+			this.message.getFuture().addListener(new SSLEnabler(engine));
+			buffer.writeByte('S');
+		}
+		Channels.write(this.ctx, this.message.getFuture(), buffer, this.message.getRemoteAddress());
 	}
 	
 	private void sendErrorResponse(Throwable t) throws IOException {

Modified: trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
===================================================================
--- trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties	2011-06-05 01:32:10 UTC (rev 3218)
@@ -91,4 +91,6 @@
 metadata_loaded=VDB {0}.{1} model {2} metadata is currently being loaded.
 ambigious_name=Ambiguous VDB name specified. Only single occurrence of the "." is allowed in the VDB name. Also, when version based vdb name is specified, then a separate "version" connection option is not allowed:{0}.{1} 
 lo_not_supported=LO functions are not supported
-SSLConfiguration.no_anonymous=The anonymous cipher suite TLS_DH_anon_WITH_AES_128_CBC_SHA is not available.  Please change the transport to be non-SSL or use non-anonymous SSL.
\ No newline at end of file
+SSLConfiguration.no_anonymous=The anonymous cipher suite TLS_DH_anon_WITH_AES_128_CBC_SHA is not available.  Please change the transport to be non-SSL or use non-anonymous SSL.
+
+PgBackendProtocol.ssl_error=Could not initialize ODBC SSL.  non-SSL connections will still be allowed.
\ No newline at end of file

Modified: trunk/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java
===================================================================
--- trunk/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -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);
 	}

Modified: trunk/test-integration/common/pom.xml
===================================================================
--- trunk/test-integration/common/pom.xml	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/test-integration/common/pom.xml	2011-06-05 01:32:10 UTC (rev 3218)
@@ -15,6 +15,11 @@
 			<artifactId>postgresql</artifactId>
 			<version>8.3-606.jdbc3</version>
 		</dependency>
+		<dependency>
+  			<groupId>com.h2database</groupId>
+  			<artifactId>h2</artifactId>
+  			<version>1.2.147</version>
+		</dependency>
 	</dependencies>
      
 </project>
\ No newline at end of file

Modified: trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestCrossSourceStarJoin.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestCrossSourceStarJoin.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestCrossSourceStarJoin.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -44,7 +44,7 @@
 @SuppressWarnings("nls")
 public class TestCrossSourceStarJoin {
 	
-    @Test public void testCrossSourceStartJoin() throws Exception {
+    @Test public void testCrossSourceStarJoin() throws Exception {
         String sql = "select p.Description, sum(AMOUNT) from s3 p, s2 c, s1 b, o1 f " +
         		"where p.PRODUCTID = f.PRODUCT and c.CurrencyCode = f.CURRENCY and b.BOOKID = f.BOOK and b.Name = 'xyz' and c.Name = 'abc' Group by p.Description";
         
@@ -106,7 +106,7 @@
         		"SELECT g_0.CurrencyCode AS c_0 FROM sybase.s2 AS g_0 WHERE g_0.Name = 'abc' ORDER BY c_0", 
         		"SELECT g_0.BOOKID AS c_0 FROM sybase.s1 AS g_0 WHERE g_0.Name = 'xyz' ORDER BY c_0", 
         		"SELECT g_0.PRODUCTID AS c_0, g_0.Description AS c_1 FROM sybase.s3 AS g_0 ORDER BY c_0", 
-        		"SELECT g_0.BOOK AS c_0, g_0.CURRENCY AS c_1, g_0.PRODUCT AS c_2, SUM(g_0.AMOUNT) AS c_3 FROM oracle.o1 AS g_0 WHERE (g_0.BOOK IN (<dependent values>)) AND (g_0.CURRENCY IN (<dependent values>)) AND (g_0.PRODUCT IN (<dependent values>)) GROUP BY g_0.BOOK, g_0.CURRENCY, g_0.PRODUCT ORDER BY c_0 NULLS FIRST"
+        		"SELECT g_0.BOOK, g_0.CURRENCY, g_0.PRODUCT, SUM(g_0.AMOUNT) FROM oracle.o1 AS g_0 WHERE (g_0.BOOK IN (<dependent values>)) AND (g_0.CURRENCY IN (<dependent values>)) AND (g_0.PRODUCT IN (<dependent values>)) GROUP BY g_0.BOOK, g_0.CURRENCY, g_0.PRODUCT"
         }, finder, ComparisonMode.EXACT_COMMAND_STRING);
         
         //test that aggregate will not be staged
@@ -115,7 +115,7 @@
         		"SELECT g_0.CurrencyCode AS c_0 FROM sybase.s2 AS g_0 WHERE g_0.Name = 'abc' ORDER BY c_0", 
         		"SELECT g_0.BOOKID AS c_0 FROM sybase.s1 AS g_0 WHERE g_0.Name = 'xyz' ORDER BY c_0", 
         		"SELECT g_0.PRODUCTID AS c_0, g_0.Description AS c_1 FROM sybase.s3 AS g_0 ORDER BY c_0", 
-        		"SELECT g_0.BOOK AS c_0, g_0.CURRENCY AS c_1, g_0.PRODUCT AS c_2, g_0.AMOUNT AS c_3 FROM oracle.o1 AS g_0 WHERE (g_0.BOOK IN (<dependent values>)) AND (g_0.CURRENCY IN (<dependent values>)) AND (g_0.PRODUCT IN (<dependent values>)) ORDER BY c_0 NULLS FIRST"
+        		"SELECT g_0.BOOK, g_0.CURRENCY, g_0.PRODUCT, g_0.AMOUNT FROM oracle.o1 AS g_0 WHERE (g_0.BOOK IN (<dependent values>)) AND (g_0.CURRENCY IN (<dependent values>)) AND (g_0.PRODUCT IN (<dependent values>))"
         }, finder, ComparisonMode.EXACT_COMMAND_STRING);
     } 
 

Copied: trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestRelate.java (from rev 3217, branches/7.4.x/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestRelate.java)
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestRelate.java	                        (rev 0)
+++ trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestRelate.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -0,0 +1,413 @@
+/*
+ * 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.dqp.internal.process;
+
+import static org.junit.Assert.*;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.SQLXML;
+import java.sql.Statement;
+import java.util.logging.ConsoleHandler;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.sql.DataSource;
+
+import org.h2.jdbcx.JdbcConnectionPool;
+import org.h2.jdbcx.JdbcDataSource;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.teiid.core.util.UnitTestUtil;
+import org.teiid.dqp.internal.datamgr.ConnectorManager;
+import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
+import org.teiid.jdbc.FakeServer;
+import org.teiid.translator.ExecutionFactory;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.jdbc.h2.H2ExecutionFactory;
+ at SuppressWarnings("nls")
+public class TestRelate {
+
+	private static boolean writeResults = false;
+	private static boolean DEBUG = false;
+	private static FakeServer server;
+    
+    @BeforeClass public static void oneTimeSetUp() throws Exception {
+    	//DQPConfiguration config = new DQPConfiguration();
+    	//config.setUserRequestSourceConcurrency(1);
+    	server = new FakeServer();
+    	JdbcDataSource h2ds = new JdbcDataSource();
+    	h2ds.setURL("jdbc:h2:zip:src/test/resources/relate/test.zip!/test");
+    	final DataSource ds = JdbcConnectionPool.create(h2ds);
+		ExecutionFactory h2 = new H2ExecutionFactory();
+		h2.start();
+		ConnectorManagerRepository cmr = new ConnectorManagerRepository();
+		ConnectorManager cm = new ConnectorManager("source", "bar") {
+			@Override
+			protected Object getConnectionFactory() throws TranslatorException {
+				return ds;
+			}
+		};
+		cm.setExecutionFactory(h2);
+		cmr.addConnectorManager("source", cm);
+		server.setConnectorManagerRepository(cmr);
+		server.deployVDB("VehicleRentalsVDB", UnitTestUtil.getTestDataPath()+"/relate/VehicleRentalsVDB.vdb");
+		if (DEBUG) {
+	    	Logger logger = Logger.getLogger("org.teiid");
+	    	logger.setLevel(Level.FINER);
+	    	ConsoleHandler handler = new ConsoleHandler();
+	    	handler.setLevel(Level.FINER);
+	    	logger.addHandler(handler);
+    	}
+    }
+    
+	private void compareResults(SQLXML[] docs)
+	throws SQLException, IOException {
+		StackTraceElement ste = new Exception().getStackTrace()[1];
+    	String testName = ste.getMethodName();
+    	testName = "relate/" + testName; //$NON-NLS-1$
+        File actual = new File(UnitTestUtil.getTestDataPath() + "/" +testName+".expected"); //$NON-NLS-1$ //$NON-NLS-2$
+        if (writeResults) {
+	        PrintWriter writer = new PrintWriter(actual);
+			for (SQLXML xml : docs) {
+				writer.write(xml.getString());
+				writer.write('\n');
+			}
+			writer.close();
+			return;
+        }
+        BufferedReader br = new BufferedReader(new FileReader(actual));
+		for (int i = 0; i < docs.length; i++) {
+			assertEquals(br.readLine(), docs[i].getString());
+		}
+	}
+
+    @Test public void testCase3365() throws Exception{
+    	SQLXML[] docs = relate(false, null, null, null, 
+    			"rentals.rentsVehicle", "rentals.company", "rentals.vehicle", 
+    			"rentals.company.companyId", "'*:rentals/*:company/@companyID'", "STRING", "rentals.rentsVehicle.companyId", 
+    			"rentals.rentsVehicle.vehicleId", "'*:rentals/*:rentsVehicle/@vehicleID'", "STRING", "rentals.vehicle.vehicleId", 
+    			"VehicleRentalsDoc.rentalsDocumentWithLocation",
+    			null, 
+    			null, 
+    			null, 
+    			null, 
+    			null, null, null, 
+    			null, null, null);
+    	compareResults(docs);
+    }
+    
+    @Test public void testCase3365_crit() throws Exception{
+    	SQLXML[] docs = relate(false, null, null, null, 
+    			"rentals.rentsVehicle", "rentals.company", "rentals.vehicle", 
+    			"rentals.company.companyId", "'*:rentals/*:company/@companyID'", "STRING", "rentals.rentsVehicle.companyId", 
+    			"rentals.rentsVehicle.vehicleId", "'*:rentals/*:rentsVehicle/@vehicleID'", "STRING", "rentals.vehicle.vehicleId", 
+    			"VehicleRentalsDoc.rentalsDocumentWithLocation",
+    			null, 
+    			"company.companyid = 'CID1'", 
+    			null, 
+    			null, 
+    			null, null, null, 
+    			null, null, null);
+    	compareResults(docs);
+    }
+    
+    @Test public void testCase3365_critNestedSrc() throws Exception {
+    	SQLXML[] docs = relate(false, null, null, null, 
+    			"rentals.rentsVehicle", "rentals.company", "rentals.vehicle", 
+    			"rentals.company.companyId", "'*:rentals/*:company/@companyID'", "STRING", "rentals.rentsVehicle.companyId", 
+    			"rentals.rentsVehicle.vehicleId", "'*:rentals/*:rentsVehicle/@vehicleID'", "STRING", "rentals.vehicle.vehicleId", 
+    			"VehicleRentalsDoc.rentalsDocumentWithLocation",
+    			null, 
+    			"location = 'Pittsburgh'", 
+    			null, 
+    			null, 
+    			null, null, null, 
+    			null, null, null);
+    	compareResults(docs);
+    }
+    
+    @Test public void testCase3365_critNestedSrcContext() throws Exception {
+    	SQLXML[] docs = relate(false, null, null, null, 
+    			"rentals.rentsVehicle", "rentals.company", "rentals.vehicle", 
+    			"rentals.company.companyId", "'*:rentals/*:company/@companyID'", "STRING", "rentals.rentsVehicle.companyId", 
+    			"rentals.rentsVehicle.vehicleId", "'*:rentals/*:rentsVehicle/@vehicleID'", "STRING", "rentals.vehicle.vehicleId", 
+    			"VehicleRentalsDoc.rentalsDocumentWithLocation",
+    			null, 
+    			null, 
+    			null, 
+    			null, 
+    			null, "context(location, location) = 'Pittsburgh'", null, 
+    			null, null, null);
+    	compareResults(docs);
+    }
+    
+    @Test public void testCase3365_critNestedSrcCombinationContext() throws Exception {
+    	SQLXML[] docs = relate(false, null, null, null, 
+    			"rentals.rentsVehicle", "rentals.company", "rentals.vehicle", 
+    			"rentals.company.companyId", "'*:rentals/*:company/@companyID'", "STRING", "rentals.rentsVehicle.companyId", 
+    			"rentals.rentsVehicle.vehicleId", "'*:rentals/*:rentsVehicle/@vehicleID'", "STRING", "rentals.vehicle.vehicleId", 
+    			"VehicleRentalsDoc.rentalsDocumentWithLocation",
+    			null, 
+    			"location = 'Pittsburgh'", 
+    			null, 
+    			null, 
+    			null, "context(location, location) = 'Pittsburgh'", null, 
+    			null, null, null);
+    	compareResults(docs);
+    }
+    
+    @Test public void testCase3365_critNestedTgt() throws Exception {
+    	SQLXML[] docs = relate(false, null, null, null, 
+    			"rentals.rentsVehicle", "rentals.company", "rentals.vehicle", 
+    			"rentals.company.companyId", "'*:rentals/*:company/@companyID'", "STRING", "rentals.rentsVehicle.companyId", 
+    			"rentals.rentsVehicle.vehicleId", "'*:rentals/*:rentsVehicle/@vehicleID'", "STRING", "rentals.vehicle.vehicleId", 
+    			"VehicleRentalsDoc.rentalsDocumentWithLocation",
+    			null, 
+    			null, 
+    			"color = 'Black'", 
+    			null, 
+    			null, null, null, 
+    			null, null, null);
+    	compareResults(docs);
+    }
+    
+    @Test public void testCase3365_compoundCritNestedTgt() throws Exception {
+    	SQLXML[] docs = relate(false, null, null, null, 
+    			"rentals.rentsVehicle", "rentals.company", "rentals.vehicle", 
+    			"rentals.company.companyId", "'*:rentals/*:company/@companyID'", "STRING", "rentals.rentsVehicle.companyId", 
+    			"rentals.rentsVehicle.vehicleId", "'*:rentals/*:rentsVehicle/@vehicleID'", "STRING", "rentals.vehicle.vehicleId", 
+    			"VehicleRentalsDoc.rentalsDocumentWithLocation",
+    			null, 
+    			null, 
+    			"color='Black' or color='Puce'", 
+    			null, 
+    			null, null, null, 
+    			null, null, null);
+    	compareResults(docs);
+    }
+    
+    @Test public void testSharesDoc() throws Exception {
+    	SQLXML[] docs = relate(true, null, null, null, 
+    			"rentals.hasSharingAgreement", "rentals.company", "rentals.company", 
+    			"rentals.company.companyId", "'*:rentals/*:company/@companyID'", "STRING", "rentals.hasSharingAgreement.primaryPartyID", 
+    			"rentals.hasSharingAgreement.secondaryPartyID", "'*:rentals/*:hasSharingAgreement/@secondaryPartyID'", "STRING", "rentals.company.companyId", 
+    			"VehicleRentalsDoc.companiesDocument",
+    			null, 
+    			null, 
+    			null, 
+    			null, 
+    			null, null, null, 
+    			null, null, null);
+    	compareResults(docs);
+    }
+    
+    @Test public void testSharesDocWithCritTgt() throws Exception {
+    	SQLXML[] docs = relate(true, null, null, null, 
+    			"rentals.hasSharingAgreement", "rentals.company", "rentals.company", 
+    			"rentals.company.companyId", "'*:rentals/*:company/@companyID'", "STRING", "rentals.hasSharingAgreement.primaryPartyID", 
+    			"rentals.hasSharingAgreement.secondaryPartyID", "'*:rentals/*:hasSharingAgreement/@secondaryPartyID'", "STRING", "rentals.company.companyId", 
+    			"VehicleRentalsDoc.companiesDocument",
+    			null, 
+    			null, 
+    			"rentals.company.name like 'B%'", 
+    			null, 
+    			null, null, null, 
+    			null, null, null);
+    	compareResults(docs);
+    }
+    
+    @Test public void testSharesDocWithCritTgtContext() throws Exception {
+    	SQLXML[] docs = relate(true, null, null, null, 
+    			"rentals.hasSharingAgreement", "rentals.company", "rentals.company", 
+    			"rentals.company.companyId", "'*:rentals/*:company/@companyID'", "STRING", "rentals.hasSharingAgreement.primaryPartyID", 
+    			"rentals.hasSharingAgreement.secondaryPartyID", "'*:rentals/*:hasSharingAgreement/@secondaryPartyID'", "STRING", "rentals.company.companyId", 
+    			"VehicleRentalsDoc.companiesDocument",
+    			null, 
+    			null, 
+    			"rentals.company.name like 'B%'", 
+    			"rentals.company.name like 'B%'", 
+    			null, null, null, 
+    			null, null, null);
+    	compareResults(docs);
+    }
+    
+    @Test public void testSharesDocEspaceQuestion3() throws Exception {
+    	SQLXML[] docs = relate(true, null, null, null, 
+    			"rentals.hasSharingAgreement", "rentals.company", "rentals.company", 
+    			"rentals.company.companyId", "'*:rentals/*:company/@companyID'", "STRING", "rentals.hasSharingAgreement.primaryPartyID", 
+    			"rentals.hasSharingAgreement.secondaryPartyID", "'*:rentals/*:hasSharingAgreement/@secondaryPartyID'", "STRING", "rentals.company.companyId", 
+    			"VehicleRentalsDoc.companiesDocument",
+    			null, 
+    			"company.locations.location = 'Pittsburgh'", 
+    			null, 
+    			null, 
+    			null, null, null, 
+    			null, null, null);
+    	compareResults(docs);
+    }
+    
+    public SQLXML[] relate(
+    		//distinct is only meaningful for self-relationships
+    		boolean distinct,
+    		//select args to limit the xml projection
+    		//there is an assumption that the source/relationship select must project key values
+    		String relationshipSelect, String sourceSelect, String targetSelect,  
+    		//relevant contexts, the same as expected by the legacy relate function
+    		String relationshipContext, String sourceContext, String targetContext, 
+    		//break down of the relationship predicates
+    		String sourceKey, 
+     		  String sourceKeyPath,
+    		  String sourceKeyType,
+    		  String sourceFKey,
+    		String targetFKey, 
+    		String targetFKeyPath,
+    		  String targetFKeyType,
+    		  String targetKey,
+    		//target document
+    		String xmlDocument,
+    		//explicit/implicit relationship context criteria - should not use the context function 
+    		String relationshipCriteria,
+    		//relateSource/implicit/explicit source context criteria - should not use the context function
+    		String relateSourceCriteria, 
+    		//relateTarget criteria - should not use the context function
+    		String relateTargetCriteria, 
+    		//relateTarget context criteria - should not use the context function
+    		String relateTargetContextCriteria,
+    		//subcontext criteria, logically applied after the relate operation - should use context function(s), and should not be specified against a root context
+    		String relationshipContextCriteria,
+    		String sourceContextCriteria,
+    		String targetContextCriteria,
+    		//order bys
+    		String relationshipOrderBy,
+    		String sourceOrderBy,
+    		String targetOrderBy
+    		) throws Exception {
+    	if (sourceSelect == null) {
+    		sourceSelect = sourceContext + ".*";
+    	}
+    	if (relationshipSelect == null) {
+    		relationshipSelect = relationshipContext + ".*";
+    	}
+    	if (targetSelect == null) {
+    		targetSelect = targetContext + ".*";
+    	}
+    	Connection conn = server.createConnection("jdbc:teiid:VehicleRentalsVDB"); //$NON-NLS-1$
+    	if (DEBUG) {
+    		conn.createStatement().execute("SET SHOWPLAN DEBUG");
+    	}
+    	SQLXML[] result = new SQLXML[3];
+    	//source query
+    	String query = String.format("SELECT %s FROM %s WHERE CONTEXT(%s, %s) IN (SELECT %s FROM %s WHERE %s IN (SELECT %s FROM %s", sourceSelect, xmlDocument, sourceContext, sourceKey, sourceFKey, relationshipContext, targetFKey, targetKey, targetContext);
+    	if (relateTargetCriteria != null) {
+    		query += (" WHERE " + relateTargetCriteria);
+    	}
+    	query += "))";
+    	if (relateSourceCriteria != null) {
+    		query += String.format(" AND (CONTEXT(%s, %s) = null OR %s)", sourceContext, sourceKey, relateSourceCriteria);
+    	}
+    	if (relationshipCriteria != null) {
+    		query += String.format(" AND CONTEXT(%s, %s) IN (SELECT %s FROM %s WHERE AND %s)", sourceContext, sourceKey, sourceFKey, relationshipContext, relationshipCriteria);
+    	}
+    	if (sourceContextCriteria != null) {
+    		query += (" AND " + sourceContextCriteria);
+    	}
+    	if (sourceOrderBy != null) {
+    		query += (" ORDER BY " + sourceOrderBy);
+    	}
+    	PreparedStatement sourcePs = conn.prepareStatement(query);
+    	ResultSet sourceRs = sourcePs.executeQuery();
+    	sourceRs.next();
+    	SQLXML sourceXml = sourceRs.getSQLXML(1);
+    	result[0] = sourceXml;
+    	
+    	Statement ddlStmt = conn.createStatement();
+    	
+    	ddlStmt.execute("CREATE LOCAL TEMPORARY TABLE #st_source (source_key STRING, PRIMARY KEY (source_key))");
+    	//source key extraction
+    	String sourceStagingQuery = String.format("INSERT INTO #st_source (source_key) SELECT DISTINCT source_key FROM XMLTABLE(%s PASSING cast(? AS xml) COLUMNS source_key %s PATH '.') x", sourceKeyPath, sourceKeyType);
+    	PreparedStatement ps = conn.prepareStatement(sourceStagingQuery);
+    	ps.setSQLXML(1, sourceXml);
+    	ps.execute();
+    	ps.close();
+    	
+    	//relationship query
+    	String relQuery = String.format("SELECT %s FROM %s WHERE CONTEXT(%s, %s) IN /*+ DJ */ (SELECT source_key from #st_source) AND CONTEXT(%s, %s) IN (SELECT %s FROM %s", relationshipSelect, xmlDocument, relationshipContext, sourceFKey, relationshipContext, targetFKey, targetKey, targetContext);
+    	if (relateTargetContextCriteria != null) {
+    		relQuery += (" WHERE " + relateTargetContextCriteria);
+    	}
+    	relQuery += ")";
+    	if (relationshipCriteria != null) {
+    		relQuery += String.format(" AND (CONTEXT(%s, %s) = null OR %s)", relationshipContext, sourceFKey, relationshipCriteria);
+    	}
+    	if (relationshipContextCriteria != null) {
+    		relQuery += (" AND " + relationshipContextCriteria);
+    	}
+    	if (relationshipOrderBy != null) {
+    		relQuery += (" ORDER BY " + relationshipOrderBy);
+    	}
+    	PreparedStatement relStmt = conn.prepareStatement(relQuery);
+    	ResultSet relRs = relStmt.executeQuery();
+    	relRs.next();
+    	SQLXML relXml = relRs.getSQLXML(1);
+    	result[1] = relXml;
+    	
+    	ddlStmt.execute("CREATE LOCAL TEMPORARY TABLE #st_rel (target_key STRING, PRIMARY KEY (target_key))");
+    	//target key extraction
+    	String relStagingQuery = String.format("INSERT INTO #st_rel (target_key) SELECT DISTINCT target_key FROM XMLTABLE(%s PASSING cast(? AS xml) COLUMNS target_key %s PATH '.') x", targetFKeyPath, targetFKeyType);
+    	PreparedStatement psRel = conn.prepareStatement(relStagingQuery);
+    	psRel.setSQLXML(1, relXml);
+    	psRel.execute();
+    	psRel.close();
+    	
+    	//target query
+    	String targetQuery = String.format("SELECT %s FROM %s WHERE CONTEXT(%s, %s) IN /*+ DJ */ (SELECT target_key FROM #st_rel", targetSelect, xmlDocument, targetContext, targetKey);
+    	if (distinct && targetContext.equalsIgnoreCase(sourceContext)) {
+    		targetQuery += " EXCEPT SELECT source_key FROM #st_source";
+    	}
+    	targetQuery += ")";
+    	if (targetContextCriteria != null) {
+    		targetQuery += (" AND " + targetContextCriteria);
+    	}
+    	if (targetOrderBy != null) {
+    		targetQuery += (" ORDER BY " + targetOrderBy);
+    	}
+    	PreparedStatement targetStmt = conn.prepareStatement(targetQuery);
+    	ResultSet taretRs = targetStmt.executeQuery();
+    	taretRs.next();
+    	SQLXML targetXml = taretRs.getSQLXML(1);
+    	result[2] = targetXml;
+    	
+    	ddlStmt.execute("drop table #st_source");
+    	ddlStmt.execute("drop table #st_rel");
+    	
+    	return result;
+    }
+    
+}

Modified: trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -74,18 +74,14 @@
         Timestamp ts = new Timestamp(-2106305630000l);
         ts.setNanos(3000000);
         
-        dataMgr.addData("SELECT g_0.\"timestamp\", g_0.\"double\", g_0.\"float\", convert(g_0.\"double\", biginteger), convert(g_0.\"double\", biginteger), convert(g_0.\"date\", timestamp), convert(g_0.\"double\", biginteger), convert(g_0.\"date\", timestamp), '1' FROM sample.RUNTIMEVALUE AS g_0", //$NON-NLS-1$ 
+        dataMgr.addData("SELECT g_0.\"timestamp\", g_0.\"double\", g_0.\"float\", convert(g_0.\"double\", biginteger), convert(g_0.\"date\", timestamp) FROM sample.RUNTIMEVALUE AS g_0", //$NON-NLS-1$ 
                         
                         new List[] { Arrays.asList(new Object[] { 
                             ts, 
                             new Double(Double.NEGATIVE_INFINITY), 
                             new Float(Float.POSITIVE_INFINITY), 
                             new BigInteger("100"), //$NON-NLS-1$
-                            new BigInteger("100"), //$NON-NLS-1$
                             ts, 
-                            new BigInteger("100"), //$NON-NLS-1$
-                            ts,
-                            "1" //$NON-NLS-1$
                                                    })});
         
         

Modified: trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -72,6 +72,10 @@
 	private boolean useCallingThread = true;
 	
 	public FakeServer() {
+		this(new DQPConfiguration());
+	}
+	
+	public FakeServer(DQPConfiguration config) {
 		this.logon = new LogonImpl(sessionService, null);
 		
 		this.repo.setSystemStore(VDBMetadataFactory.getSystem());
@@ -92,7 +96,6 @@
         	}
         });
         
-        DQPConfiguration config = new DQPConfiguration();
         config.setResultsetCacheConfig(new CacheConfiguration(Policy.LRU, 60, 250, "resultsetcache")); //$NON-NLS-1$
         this.dqp.setCacheFactory(new DefaultCacheFactory());
         this.dqp.start(config);
@@ -102,6 +105,10 @@
         registerClientService(DQP.class, dqp, null);
 	}
 	
+	public void setConnectorManagerRepository(ConnectorManagerRepository cmr) {
+		this.cmr = cmr;
+	}
+	
 	public void stop() {
 		this.dqp.stop();
 	}

Deleted: trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestLocalConnections.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestLocalConnections.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestLocalConnections.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -1,139 +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.jdbc;
-
-import static org.junit.Assert.*;
-
-import java.lang.Thread.UncaughtExceptionHandler;
-import java.sql.Connection;
-import java.sql.Statement;
-import java.util.LinkedHashMap;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.jboss.netty.handler.timeout.TimeoutException;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.teiid.core.types.DataTypeManager;
-import org.teiid.metadata.FunctionMethod;
-import org.teiid.metadata.FunctionParameter;
-import org.teiid.metadata.MetadataStore;
-import org.teiid.metadata.Schema;
-import org.teiid.metadata.FunctionMethod.PushDown;
-import org.teiid.query.function.metadata.FunctionCategoryConstants;
-import org.teiid.query.metadata.TransformationMetadata.Resource;
-
- at SuppressWarnings("nls")
-public class TestLocalConnections {
-	
-	private final class SimpleUncaughtExceptionHandler implements
-			UncaughtExceptionHandler {
-		Throwable t;
-
-		@Override
-		public void uncaughtException(Thread arg0, Throwable arg1) {
-			t = arg1;
-		}
-	}
-
-	static ReentrantLock lock = new ReentrantLock();
-	static Condition waiting = lock.newCondition();
-	static Condition wait = lock.newCondition();
-	
-	public static int blocking() throws InterruptedException {
-		lock.lock();
-		try {
-			waiting.signal();
-			if (!wait.await(2, TimeUnit.SECONDS)) {
-				throw new TimeoutException();
-			}
-		} finally {
-			lock.unlock();
-		}
-		return 1;
-	}
-
-	static FakeServer server = new FakeServer();
-	
-	@BeforeClass public static void oneTimeSetup() {
-    	server.setUseCallingThread(true);
-    	MetadataStore ms = new MetadataStore();
-    	Schema s = new Schema();
-    	s.setName("test");
-    	FunctionMethod function = new FunctionMethod("foo", null, FunctionCategoryConstants.MISCELLANEOUS, PushDown.CANNOT_PUSHDOWN, TestLocalConnections.class.getName(), "blocking", new FunctionParameter[0], new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER), true, FunctionMethod.Determinism.NONDETERMINISTIC);
-    	s.addFunction(function);
-    	ms.addSchema(s);
-    	server.deployVDB("test", ms, new LinkedHashMap<String, Resource>());
-	}
-	
-	@AfterClass public static void oneTimeTearDown() {
-		server.stop();
-	}
-	
-	@Test public void testConcurrentExection() throws Throwable {
-    	
-    	Thread t = new Thread() {
-    		
-    		public void run() {
-    			try {
-	    	    	Connection c = server.createConnection("jdbc:teiid:test");
-	    	    	
-	    	    	Statement s = c.createStatement();
-	    	    	s.execute("select foo()");
-    			} catch (Exception e) {
-    				throw new RuntimeException(e);
-    			}
-    		}
-    	};
-    	SimpleUncaughtExceptionHandler handler = new SimpleUncaughtExceptionHandler();
-    	t.setUncaughtExceptionHandler(handler);
-    	t.start();
-    	
-    	lock.lock();
-    	try {
-    		waiting.await();
-    	} finally {
-    		lock.unlock();
-    	}
-    	Connection c = server.createConnection("jdbc:teiid:test");
-    	Statement s = c.createStatement();
-    	s.execute("select * from tables");
-    	
-    	lock.lock();
-    	try {
-    		wait.signal();
-    	} finally {
-    		lock.unlock();
-		}
-    	t.join(2000);
-    	if (t.isAlive()) {
-    		fail();
-    	}
-    	if (handler.t != null) {
-    		throw handler.t;
-    	}
-	}
-	
-}

Copied: trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestLocalConnections.java (from rev 3216, branches/7.4.x/test-integration/common/src/test/java/org/teiid/jdbc/TestLocalConnections.java)
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestLocalConnections.java	                        (rev 0)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestLocalConnections.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -0,0 +1,139 @@
+/*
+ * 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.jdbc;
+
+import static org.junit.Assert.*;
+
+import java.lang.Thread.UncaughtExceptionHandler;
+import java.sql.Connection;
+import java.sql.Statement;
+import java.util.LinkedHashMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.jboss.netty.handler.timeout.TimeoutException;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.metadata.FunctionMethod;
+import org.teiid.metadata.FunctionParameter;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Schema;
+import org.teiid.metadata.FunctionMethod.PushDown;
+import org.teiid.query.function.metadata.FunctionCategoryConstants;
+import org.teiid.query.metadata.TransformationMetadata.Resource;
+
+ at SuppressWarnings("nls")
+public class TestLocalConnections {
+	
+	private final class SimpleUncaughtExceptionHandler implements
+			UncaughtExceptionHandler {
+		Throwable t;
+
+		@Override
+		public void uncaughtException(Thread arg0, Throwable arg1) {
+			t = arg1;
+		}
+	}
+
+	static ReentrantLock lock = new ReentrantLock();
+	static Condition waiting = lock.newCondition();
+	static Condition wait = lock.newCondition();
+	
+	public static int blocking() throws InterruptedException {
+		lock.lock();
+		try {
+			waiting.signal();
+			if (!wait.await(2, TimeUnit.SECONDS)) {
+				throw new TimeoutException();
+			}
+		} finally {
+			lock.unlock();
+		}
+		return 1;
+	}
+
+	static FakeServer server = new FakeServer();
+	
+	@BeforeClass public static void oneTimeSetup() {
+    	server.setUseCallingThread(true);
+    	MetadataStore ms = new MetadataStore();
+    	Schema s = new Schema();
+    	s.setName("test");
+    	FunctionMethod function = new FunctionMethod("foo", null, FunctionCategoryConstants.MISCELLANEOUS, PushDown.CANNOT_PUSHDOWN, TestLocalConnections.class.getName(), "blocking", new FunctionParameter[0], new FunctionParameter("result", DataTypeManager.DefaultDataTypes.INTEGER), true, FunctionMethod.Determinism.NONDETERMINISTIC);
+    	s.addFunction(function);
+    	ms.addSchema(s);
+    	server.deployVDB("test", ms, new LinkedHashMap<String, Resource>());
+	}
+	
+	@AfterClass public static void oneTimeTearDown() {
+		server.stop();
+	}
+	
+	@Test public void testConcurrentExection() throws Throwable {
+    	
+    	Thread t = new Thread() {
+    		
+    		public void run() {
+    			try {
+	    	    	Connection c = server.createConnection("jdbc:teiid:test");
+	    	    	
+	    	    	Statement s = c.createStatement();
+	    	    	s.execute("select foo()");
+    			} catch (Exception e) {
+    				throw new RuntimeException(e);
+    			}
+    		}
+    	};
+    	SimpleUncaughtExceptionHandler handler = new SimpleUncaughtExceptionHandler();
+    	t.setUncaughtExceptionHandler(handler);
+    	t.start();
+    	
+    	lock.lock();
+    	try {
+    		waiting.await();
+    	} finally {
+    		lock.unlock();
+    	}
+    	Connection c = server.createConnection("jdbc:teiid:test");
+    	Statement s = c.createStatement();
+    	s.execute("select * from tables");
+    	
+    	lock.lock();
+    	try {
+    		wait.signal();
+    	} finally {
+    		lock.unlock();
+		}
+    	t.join(2000);
+    	if (t.isAlive()) {
+    		fail();
+    	}
+    	if (handler.t != null) {
+    		throw handler.t;
+    	}
+	}
+	
+}

Modified: trunk/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java	2011-06-05 01:32:10 UTC (rev 3218)
@@ -24,8 +24,13 @@
 
 import static org.junit.Assert.*;
 
+import java.io.IOException;
+import java.net.InetAddress;
 import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.UnknownHostException;
 import java.nio.charset.Charset;
+import java.security.NoSuchAlgorithmException;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -33,6 +38,10 @@
 import java.sql.Statement;
 import java.util.Properties;
 
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocket;
+import javax.net.ssl.SSLSocketFactory;
+
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -44,37 +53,107 @@
 import org.teiid.jdbc.FakeServer;
 import org.teiid.jdbc.TeiidDriver;
 import org.teiid.jdbc.TestMMDatabaseMetaData;
+import org.teiid.net.socket.SocketUtil;
 
 @SuppressWarnings("nls")
 public class TestODBCSocketTransport {
-
-	static InetSocketAddress addr;
-	static ODBCSocketListener odbcTransport;
 	
-	@BeforeClass public static void oneTimeSetup() throws Exception {
-		SocketConfiguration config = new SocketConfiguration();
-		config.setSSLConfiguration(new SSLConfiguration());
-		addr = new InetSocketAddress(0);
-		config.setBindAddress(addr.getHostName());
-		config.setPortNumber(0);
-		odbcTransport = new ODBCSocketListener(config, BufferManagerFactory.getStandaloneBufferManager(), 0, 100000);
+public static class AnonSSLSocketFactory extends SSLSocketFactory {
 		
-		FakeServer server = new FakeServer();
-		server.setUseCallingThread(false);
-		server.deployVDB("parts", UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
+		private SSLSocketFactory sslSocketFactory;
 		
-		TeiidDriver driver = new TeiidDriver();
-		driver.setEmbeddedProfile(server);
-		odbcTransport.setDriver(driver);
+		public AnonSSLSocketFactory() {
+			try {
+				sslSocketFactory = SSLContext.getDefault().getSocketFactory();
+			} catch (NoSuchAlgorithmException e) {
+				throw new RuntimeException();
+			}			
+		}
+
+		public Socket createSocket() throws IOException {
+			return sslSocketFactory.createSocket();
+		}
+
+		public Socket createSocket(InetAddress address, int port,
+				InetAddress localAddress, int localPort) throws IOException {
+			return sslSocketFactory.createSocket(address, port, localAddress,
+					localPort);
+		}
+
+		public Socket createSocket(InetAddress host, int port)
+				throws IOException {
+			return sslSocketFactory.createSocket(host, port);
+		}
+
+		public Socket createSocket(Socket s, String host, int port,
+				boolean autoClose) throws IOException {
+			SSLSocket socket = (SSLSocket)sslSocketFactory.createSocket(s, host, port, autoClose);
+			SocketUtil.addCipherSuite(socket, SocketUtil.ANON_CIPHER_SUITE);
+			return socket;
+		}
+
+		public Socket createSocket(String host, int port,
+				InetAddress localHost, int localPort) throws IOException,
+				UnknownHostException {
+			return sslSocketFactory.createSocket(host, port, localHost,
+					localPort);
+		}
+
+		public Socket createSocket(String host, int port) throws IOException,
+				UnknownHostException {
+			return sslSocketFactory.createSocket(host, port);
+		}
+
+		public String[] getDefaultCipherSuites() {
+			return sslSocketFactory.getDefaultCipherSuites();
+		}
+
+		public String[] getSupportedCipherSuites() {
+			return sslSocketFactory.getSupportedCipherSuites();
+		}
 		
 	}
 	
-	@AfterClass public static void oneTimeTearDown() throws Exception {
-		if (odbcTransport != null) {
+	static class FakeOdbcServer {
+		InetSocketAddress addr;
+		ODBCSocketListener odbcTransport;
+		
+		public void start() throws Exception {
+			SocketConfiguration config = new SocketConfiguration();
+			SSLConfiguration sslConfig = new SSLConfiguration();
+			sslConfig.setMode(SSLConfiguration.ENABLED);
+			sslConfig.setAuthenticationMode(SSLConfiguration.ANONYMOUS);
+			config.setSSLConfiguration(sslConfig);
+			addr = new InetSocketAddress(0);
+			config.setBindAddress(addr.getHostName());
+			config.setPortNumber(0);
+			odbcTransport = new ODBCSocketListener(config, BufferManagerFactory.getStandaloneBufferManager(), 0, 100000);
+			
+			FakeServer server = new FakeServer();
+			server.setUseCallingThread(false);
+			server.deployVDB("parts", UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
+			
+			TeiidDriver driver = new TeiidDriver();
+			driver.setEmbeddedProfile(server);
+			odbcTransport.setDriver(driver);
+		}
+		
+		public void stop() {
 			odbcTransport.stop();
 		}
+		
 	}
 	
+	private static FakeOdbcServer odbcServer = new FakeOdbcServer();
+	
+	@BeforeClass public static void oneTimeSetup() throws Exception {
+		odbcServer.start();
+	}
+	
+	@AfterClass public static void oneTimeTearDown() throws Exception {
+		odbcServer.stop();
+	}
+	
 	Connection conn;
 	
 	@Before public void setUp() throws Exception {
@@ -82,7 +161,7 @@
 		Properties p = new Properties();
 		p.setProperty("user", "testuser");
 		p.setProperty("password", "testpassword");
-		conn = d.connect("jdbc:postgresql://"+addr.getHostName()+":" +odbcTransport.getPort()+"/parts", p);
+		conn = d.connect("jdbc:postgresql://"+odbcServer.addr.getHostName()+":" +odbcServer.odbcTransport.getPort()+"/parts", p);
 	}
 	
 	@After public void tearDown() throws Exception {
@@ -181,4 +260,18 @@
 		ResultSet rs = stmt.executeQuery("select has_function_privilege(100, 'foo')");
 		rs.next();
 	}
+	
+	@Test public void testSelectSsl() throws Exception {
+		conn.close();
+		Driver d = new Driver();
+		Properties p = new Properties();
+		p.setProperty("user", "testuser");
+		p.setProperty("password", "testpassword");
+		p.setProperty("ssl", "true");
+		p.setProperty("sslfactory", AnonSSLSocketFactory.class.getName());
+		conn = d.connect("jdbc:postgresql://"+odbcServer.addr.getHostName()+":" +odbcServer.odbcTransport.getPort()+"/parts", p);
+		Statement s = conn.createStatement();
+		assertTrue(s.execute("select * from tables order by name"));
+		TestMMDatabaseMetaData.compareResultSet("TestODBCSocketTransport/testSelect", s.getResultSet());
+	}
 }


Property changes on: trunk/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/7.4.x/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java:3149-3217

Deleted: trunk/test-integration/common/src/test/resources/relate/VehicleRentalsVDB.vdb
===================================================================
(Binary files differ)

Copied: trunk/test-integration/common/src/test/resources/relate/VehicleRentalsVDB.vdb (from rev 3217, branches/7.4.x/test-integration/common/src/test/resources/relate/VehicleRentalsVDB.vdb)
===================================================================
(Binary files differ)

Deleted: trunk/test-integration/common/src/test/resources/relate/rentals.sql
===================================================================
--- branches/7.4.x/test-integration/common/src/test/resources/relate/rentals.sql	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/test-integration/common/src/test/resources/relate/rentals.sql	2011-06-05 01:32:10 UTC (rev 3218)
@@ -1,347 +0,0 @@
-CREATE TABLE "ACCESSORIES"
-(
-   COMMONNAME varchar(40),
-   UUID varchar(36),
-   QUUID varchar(36),
-   ACCID varchar(10),
-   TYPE varchar(40),
-   MODEL varchar(15),
-   VERSION varchar(15)
-);
-CREATE TABLE "COLORS"
-(
-   COLORID varchar(10) primary key,
-   NAME varchar(42),
-   VEHICLEID varchar(10)
-);
-create index colors_vid_idx on colors (vehicleid);
-
-CREATE TABLE "COMPANIES"
-(
-   COMMONNAME varchar(40),
-   UUID varchar(36),
-   QUUID varchar(36),
-   COMPANYID varchar(10) primary key,
-   FULLNAME varchar(40),
-   CLASSIFICATION varchar(15)
-);
-CREATE TABLE "LOCATIONS"
-(
-   LOCATIONID varchar(10),
-   NAME varchar(42),
-   COMPANYID varchar(10)
-);
-CREATE TABLE "REL_COMP_ACC"
-(
-   COMMONNAME varchar(40),
-   UUID varchar(36),
-   QUUID varchar(36),
-   NATURE varchar(15),
-   SUBJECTTYPE varchar(40),
-   TARGETTYPE varchar(40),
-   COMPANYID varchar(10) NOT NULL,
-   ACCESSORYID varchar(10) NOT NULL,
-   QUANTITYAUTH int,
-   QUANTITYAVAIL int
-);
-CREATE TABLE "REL_COMP_SHARE"
-(
-   COMMONNAME varchar(40),
-   UUID varchar(36),
-   QUUID varchar(36),
-   NATURE varchar(15),
-   SUBJECTTYPE varchar(40),
-   TARGETTYPE varchar(40),
-   PRIMARYID varchar(10),
-   SECONDARYID varchar(10),
-   SINCE numeric(10,0)
-);
-CREATE TABLE "REL_COMP_SUBSID"
-(
-   COMMONNAME varchar(40),
-   UUID varchar(36),
-   QUUID varchar(36),
-   NATURE varchar(15),
-   SUBJECTTYPE varchar(40),
-   TARGETTYPE varchar(40),
-   COMPANYID varchar(10),
-   SUBSIDIARYID varchar(10),
-   PERCENTOWNS numeric(10,0)
-);
-CREATE TABLE "REL_COMP_VEH"
-(
-   COMMONNAME varchar(40),
-   UUID varchar(36),
-   QUUID varchar(36),
-   NATURE varchar(15),
-   SUBJECTTYPE varchar(40),
-   TARGETTYPE varchar(40),
-   COMPANYID varchar(10) NOT NULL,
-   VEHICLEID varchar(10) NOT NULL,
-   QUANTITYAUTH int,
-   QUANTITYAVAIL int
-);
-CREATE TABLE "REL_VEH_ACC"
-(
-   COMMONNAME varchar(40),
-   UUID varchar(36),
-   QUUID varchar(36),
-   NATURE varchar(15),
-   SUBJECTTYPE varchar(40),
-   TARGETTYPE varchar(40),
-   VEHICLEID varchar(10) NOT NULL,
-   ACCESSORYID varchar(10) NOT NULL,
-   QUANTITYAUTH int,
-   QUANTITYAVAIL int
-);
-CREATE TABLE "RENTAL_PRODUCTS"
-(
-   PRODUCTID varchar(10) NOT NULL,
-   DURATION varchar(42),
-   VEHICLEID varchar(10),
-   COMPANYID varchar(10)
-);
-CREATE TABLE "VEHICLES"
-(
-   COMMONNAME varchar(40),
-   UUID varchar(36),
-   QUUID varchar(36),
-   VEHICLEID varchar(10) primary key,
-   STYLE varchar(40),
-   MAKE varchar(15),
-   MODEL varchar(15),
-   MODELYEAR int
-);
-
-INSERT INTO "ACCESSORIES" (COMMONNAME,UUID,QUUID,ACCID,TYPE,MODEL,VERSION) VALUES ('Emerson NV-5000','AUUID2','AQUUID2','AID2','GPS','Emerson','NV-5000');
-
-INSERT INTO "ACCESSORIES" (COMMONNAME,UUID,QUUID,ACCID,TYPE,MODEL,VERSION) VALUES ('Garmin Street Pilot','AUUID1','AQUUID1','AID1','GPS','Garmin','Street Pilot');
-
-INSERT INTO "ACCESSORIES" (COMMONNAME,UUID,QUUID,ACCID,TYPE,MODEL,VERSION) VALUES ('Gvox A0102','AUUID5','AQUUID5','AID5','DVD','Gvox','A0102');
-
-INSERT INTO "ACCESSORIES" (COMMONNAME,UUID,QUUID,ACCID,TYPE,MODEL,VERSION) VALUES ('Gvox A0201','AUUID4','AQUUID4','AID4','DVD','Gvox','A0201');
-
-INSERT INTO "ACCESSORIES" (COMMONNAME,UUID,QUUID,ACCID,TYPE,MODEL,VERSION) VALUES ('Pioneer AVIC-N2','AUUID6','AQUUID6','AID6','Navigation','Pioneer','AVIC-N2');
-
-INSERT INTO "ACCESSORIES" (COMMONNAME,UUID,QUUID,ACCID,TYPE,MODEL,VERSION) VALUES ('Pioneer CD-VC60','AUUID8','AQUUID8','AID8','Voice Guidance','Pioneer','CD-VC60');
-
-INSERT INTO "ACCESSORIES" (COMMONNAME,UUID,QUUID,ACCID,TYPE,MODEL,VERSION) VALUES ('Pyle PLDVD65IN','AUUID3','AQUUID3','AID3','DVD','Pyle','PLDVD65IN');
-
-INSERT INTO "ACCESSORIES" (COMMONNAME,UUID,QUUID,ACCID,TYPE,MODEL,VERSION) VALUES ('Sanyo NV-E700','AUUID7','AQUUID7','AID7','Navigation','Sanyo','NV-E700');
-
-
-
-INSERT INTO "COLORS" (COLORID,NAME,VEHICLEID) VALUES ('C1','Red','VID1');
-
-INSERT INTO "COLORS" (COLORID,NAME,VEHICLEID) VALUES ('C2','Black','VID1');
-
-INSERT INTO "COLORS" (COLORID,NAME,VEHICLEID) VALUES ('C3','Puce','VID2');
-
-INSERT INTO "COLORS" (COLORID,NAME,VEHICLEID) VALUES ('C4','Red','VID3');
-
-INSERT INTO "COLORS" (COLORID,NAME,VEHICLEID) VALUES ('C5','Black','VID4');
-
-
-
-INSERT INTO "COMPANIES" (COMMONNAME,UUID,QUUID,COMPANYID,FULLNAME,CLASSIFICATION) VALUES ('Avian','CUUID1','CQUUID1','CID1','Avian Rentals, Inc.','Consumer');
-
-INSERT INTO "COMPANIES" (COMMONNAME,UUID,QUUID,COMPANYID,FULLNAME,CLASSIFICATION) VALUES ('Budge','CUUID3','CQUUID3','CID3','Budge, Inc.','Wholesale');
-
-INSERT INTO "COMPANIES" (COMMONNAME,UUID,QUUID,COMPANYID,FULLNAME,CLASSIFICATION) VALUES ('Entertwine','CUUID2','CQUUID2','CID2','Entertwine Rent A Car, Inc.','Consumer');
-
-INSERT INTO "COMPANIES" (COMMONNAME,UUID,QUUID,COMPANYID,FULLNAME,CLASSIFICATION) VALUES ('Gigahertz','CUUID4','CQUUID4','CID4','Gigahertz, Inc.','Consumer');
-
-INSERT INTO "COMPANIES" (COMMONNAME,UUID,QUUID,COMPANYID,FULLNAME,CLASSIFICATION) VALUES ('Peso','CUUID5','CQUUID5','CID5','Peso, Inc.','Consumer');
-
-INSERT INTO "COMPANIES" (COMMONNAME,UUID,QUUID,COMPANYID,FULLNAME,CLASSIFICATION) VALUES ('Wholefleet','CUUID6','CQUUID6','CID6','Wholefleet, Inc.','Wholesale');
-
-
-
-INSERT INTO "LOCATIONS" (LOCATIONID,NAME,COMPANYID) VALUES ('LOC1','Pittsburgh','CID1');
-
-INSERT INTO "LOCATIONS" (LOCATIONID,NAME,COMPANYID) VALUES ('LOC2','Moosejaw','CID2');
-
-INSERT INTO "LOCATIONS" (LOCATIONID,NAME,COMPANYID) VALUES ('LOC3','Keokuk','CID1');
-
-
-
-INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA11','CAUUID11','CAQUUID11','offers','Company','Accessory','CID1','AID1',1,1);
-
-INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA12','CAUUID12','CAQUUID12','offers','Company','Accessory','CID1','AID2',1,1);
-
-INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA13','CAUUID13','CAQUUID13','offers','Company','Accessory','CID1','AID3',1,1);
-
-INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA14','CAUUID14','CAQUUID14','offers','Company','Accessory','CID1','AID4',1,1);
-
-INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA15','CAUUID15','CAQUUID15','offers','Company','Accessory','CID1','AID5',1,1);
-
-INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA16','CAUUID16','CAQUUID16','offers','Company','Accessory','CID1','AID6',1,1);
-
-INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA21','CAUUID21','CAQUUID21','offers','Company','Accessory','CID2','AID1',1,1);
-
-INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA22','CAUUID22','CAQUUID22','offers','Company','Accessory','CID2','AID2',1,1);
-
-INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA23','CAUUID23','CAQUUID23','offers','Company','Accessory','CID2','AID3',1,1);
-
-INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA33','CAUUID33','CAQUUID33','offers','Company','Accessory','CID3','AID3',1,1);
-
-INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA61','CAUUID61','CAQUUID61','offers','Company','Accessory','CID6','AID1',1,1);
-
-INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA62','CAUUID62','CAQUUID62','offers','Company','Accessory','CID6','AID2',1,1);
-
-INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA63','CAUUID63','CAQUUID63','offers','Company','Accessory','CID6','AID3',1,1);
-
-INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA64','CAUUID64','CAQUUID64','offers','Company','Accessory','CID6','AID4',1,1);
-
-INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA65','CAUUID65','CAQUUID65','offers','Company','Accessory','CID6','AID5',1,1);
-
-INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA66','CAUUID66','CAQUUID66','offers','Company','Accessory','CID6','AID6',1,1);
-
-INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA67','CAUUID67','CAQUUID67','offers','Company','Accessory','CID6','AID7',1,1);
-
-INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA68','CAUUID68','CAQUUID68','offers','Company','Accessory','CID6','AID8',1,1);
-
-
-
-INSERT INTO "REL_COMP_SHARE" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,PRIMARYID,SECONDARYID,SINCE) VALUES ('RCC12','CCUUID12','CCQUUID12','sharesWith','Company','Company','CID1','CID2',1985);
-
-INSERT INTO "REL_COMP_SHARE" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,PRIMARYID,SECONDARYID,SINCE) VALUES ('RCC13','CCUUID13','CCQUUID13','sharesWith','Company','Company','CID1','CID3',1995);
-
-INSERT INTO "REL_COMP_SHARE" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,PRIMARYID,SECONDARYID,SINCE) VALUES ('RCC14','CCUUID14','CCQUUID14','sharesWith','Company','Company','CID1','CID4',2005);
-
-INSERT INTO "REL_COMP_SHARE" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,PRIMARYID,SECONDARYID,SINCE) VALUES ('RCC34','CCUUID34','CCQUUID34','sharesWith','Company','Company','CID3','CID4',2001);
-
-INSERT INTO "REL_COMP_SHARE" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,PRIMARYID,SECONDARYID,SINCE) VALUES ('RCC54','CCUUID54','CCQUUID54','sharesWith','Company','Company','CID5','CID4',1999);
-
-INSERT INTO "REL_COMP_SHARE" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,PRIMARYID,SECONDARYID,SINCE) VALUES ('RCC64','CCUUID64','CCQUUID64','sharesWith','Company','Company','CID6','CID4',1995);
-
-
-
-INSERT INTO "REL_COMP_SUBSID" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,SUBSIDIARYID,PERCENTOWNS) VALUES ('RCS12','CSUUID12','CSQUUID12','owns','Company','Subsidiary','CID1','CID2',10);
-
-INSERT INTO "REL_COMP_SUBSID" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,SUBSIDIARYID,PERCENTOWNS) VALUES ('RCS13','CSUUID13','CSQUUID13','owns','Company','Subsidiary','CID1','CID3',50);
-
-INSERT INTO "REL_COMP_SUBSID" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,SUBSIDIARYID,PERCENTOWNS) VALUES ('RCS43','CSUUID43','CSQUUID43','owns','Company','Subsidiary','CID4','CID3',10);
-
-INSERT INTO "REL_COMP_SUBSID" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,SUBSIDIARYID,PERCENTOWNS) VALUES ('RCS56','CSUUID56','CSQUUID56','owns','Company','Subsidiary','CID5','CID6',100);
-
-
-
-INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV11','CVUUID11','CVQUUID11','rents','Company','Vehicle','CID1','VID1',10,2);
-
-INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV12','CVUUID12','CVQUUID12','rents','Company','Vehicle','CID1','VID2',2,2);
-
-INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV13','CVUUID13','CVQUUID13','rents','Company','Vehicle','CID1','VID3',2,0);
-
-INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV14','CVUUID14','CVQUUID14','rents','Company','Vehicle','CID1','VID4',2,1);
-
-INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV21','CVUUID21','CVQUUID21','rents','Company','Vehicle','CID2','VID1',5,3);
-
-INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV22','CVUUID22','CVQUUID22','rents','Company','Vehicle','CID2','VID2',2,1);
-
-INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV32','CVUUID32','CVQUUID32','rents','Company','Vehicle','CID3','VID2',1,1);
-
-INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV47','CVUUID47','CVQUUID47','rents','Company','Vehicle','CID4','VID7',1,1);
-
-INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV61','CVUUID61','CVQUUID61','rents','Company','Vehicle','CID6','VID1',1,1);
-
-INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV62','CVUUID62','CVQUUID62','rents','Company','Vehicle','CID6','VID2',2,2);
-
-INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV63','CVUUID63','CVQUUID63','rents','Company','Vehicle','CID6','VID3',3,3);
-
-INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV64','CVUUID64','CVQUUID64','rents','Company','Vehicle','CID6','VID4',4,4);
-
-INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV65','CVUUID65','CVQUUID65','rents','Company','Vehicle','CID6','VID5',5,5);
-
-INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV66','CVUUID66','CVQUUID66','rents','Company','Vehicle','CID6','VID6',6,6);
-
-INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV67','CVUUID67','CVQUUID67','rents','Company','Vehicle','CID6','VID7',7,7);
-
-INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV68','CVUUID68','CVQUUID68','rents','Company','Vehicle','CID6','VID8',8,8);
-
-INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV69','CVUUID69','CVQUUID69','rents','Company','Vehicle','CID6','VID9',9,9);
-
-
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA11','VAUUID11','VAQUUID11','has','Vehicle','Accessory','VID1','AID1',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA12','VAUUID12','VAQUUID12','has','Vehicle','Accessory','VID1','AID2',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA13','VAUUID13','VAQUUID13','has','Vehicle','Accessory','VID1','AID3',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA23','VAUUID23','VAQUUID23','has','Vehicle','Accessory','VID2','AID3',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA34','VAUUID34','VAQUUID34','has','Vehicle','Accessory','VID3','AID4',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA35','VAUUID35','VAQUUID35','has','Vehicle','Accessory','VID3','AID5',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA41','VAUUID41','VAQUUID41','has','Vehicle','Accessory','VID4','AID1',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA45','VAUUID45','VAQUUID45','has','Vehicle','Accessory','VID4','AID5',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA46','VAUUID46','VAQUUID46','has','Vehicle','Accessory','VID4','AID6',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA51','VAUUID51','VAQUUID51','has','Vehicle','Accessory','VID5','AID1',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA53','VAUUID53','VAQUUID53','has','Vehicle','Accessory','VID5','AID3',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA55','VAUUID55','VAQUUID55','has','Vehicle','Accessory','VID5','AID5',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA57','VAUUID57','VAQUUID57','has','Vehicle','Accessory','VID5','AID7',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA62','VAUUID62','VAQUUID62','has','Vehicle','Accessory','VID6','AID2',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA64','VAUUID64','VAQUUID64','has','Vehicle','Accessory','VID6','AID4',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA66','VAUUID66','VAQUUID66','has','Vehicle','Accessory','VID6','AID6',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA68','VAUUID68','VAQUUID68','has','Vehicle','Accessory','VID6','AID8',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA88','VAUUID88','VAQUUID88','has','Vehicle','Accessory','VID8','AID8',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA91','VAUUID91','VAQUUID91','has','Vehicle','Accessory','VID9','AID1',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA92','VAUUID92','VAQUUID92','has','Vehicle','Accessory','VID9','AID2',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA93','VAUUID93','VAQUUID93','has','Vehicle','Accessory','VID9','AID3',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA94','VAUUID94','VAQUUID94','has','Vehicle','Accessory','VID9','AID4',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA95','VAUUID95','VAQUUID95','has','Vehicle','Accessory','VID9','AID5',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA96','VAUUID96','VAQUUID96','has','Vehicle','Accessory','VID9','AID6',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA97','VAUUID97','VAQUUID97','has','Vehicle','Accessory','VID9','AID7',1,1);
-
-INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA98','VAUUID98','VAQUUID98','has','Vehicle','Accessory','VID9','AID8',1,1);
-
-
-
-INSERT INTO "RENTAL_PRODUCTS" (PRODUCTID,DURATION,VEHICLEID,COMPANYID) VALUES ('P1','Hourly','VID1','CID1');
-
-INSERT INTO "RENTAL_PRODUCTS" (PRODUCTID,DURATION,VEHICLEID,COMPANYID) VALUES ('P2','Daily','VID1','CID1');
-
-INSERT INTO "RENTAL_PRODUCTS" (PRODUCTID,DURATION,VEHICLEID,COMPANYID) VALUES ('P3','Weekly','VID1','CID1');
-
-INSERT INTO "RENTAL_PRODUCTS" (PRODUCTID,DURATION,VEHICLEID,COMPANYID) VALUES ('P4','Weekly','VID2','CID1');
-
-
-
-INSERT INTO "VEHICLES" (COMMONNAME,UUID,QUUID,VEHICLEID,STYLE,MAKE,MODEL,MODELYEAR) VALUES ('Chevy Tahoe 2005','VUUID3','VQUUID3','VID3','Utility','Chevrolet','Tahoe',2005);
-
-INSERT INTO "VEHICLES" (COMMONNAME,UUID,QUUID,VEHICLEID,STYLE,MAKE,MODEL,MODELYEAR) VALUES ('Ford F150 2004','VUUID2','VQUUID2','VID2','Utility','Ford','F150',2004);
-
-INSERT INTO "VEHICLES" (COMMONNAME,UUID,QUUID,VEHICLEID,STYLE,MAKE,MODEL,MODELYEAR) VALUES ('Ford F150 2005','VUUID1','VQUUID1','VID1','Utility','Ford','F150',2005);
-
-INSERT INTO "VEHICLES" (COMMONNAME,UUID,QUUID,VEHICLEID,STYLE,MAKE,MODEL,MODELYEAR) VALUES ('Ford Windstar 2004','VUUID5','VQUUID5','VID5','Minivan','Ford','Windstar',2004);
-
-INSERT INTO "VEHICLES" (COMMONNAME,UUID,QUUID,VEHICLEID,STYLE,MAKE,MODEL,MODELYEAR) VALUES ('Ford Windstar 2005','VUUID4','VQUUID4','VID4','Minivan','Ford','Windstar',2005);
-
-INSERT INTO "VEHICLES" (COMMONNAME,UUID,QUUID,VEHICLEID,STYLE,MAKE,MODEL,MODELYEAR) VALUES ('Honda Pilot 2005','VUUID9','VQUUID9','VID9','SUV','Honda','Pilot',2005);
-
-INSERT INTO "VEHICLES" (COMMONNAME,UUID,QUUID,VEHICLEID,STYLE,MAKE,MODEL,MODELYEAR) VALUES ('Nissan Quest 2004','VUUID7','VQUUID7','VID7','Minivan','Nissan','Quest',2004);
-
-INSERT INTO "VEHICLES" (COMMONNAME,UUID,QUUID,VEHICLEID,STYLE,MAKE,MODEL,MODELYEAR) VALUES ('Nissan Quest 2005','VUUID6','VQUUID6','VID6','Minivan','Nissan','Quest',2005);
-
-INSERT INTO "VEHICLES" (COMMONNAME,UUID,QUUID,VEHICLEID,STYLE,MAKE,MODEL,MODELYEAR) VALUES ('Toyota Sienna 2004','VUUID8','VQUUID8','VID8','Minivan','Toyota','Sienna',2004);
-

Copied: trunk/test-integration/common/src/test/resources/relate/rentals.sql (from rev 3217, branches/7.4.x/test-integration/common/src/test/resources/relate/rentals.sql)
===================================================================
--- trunk/test-integration/common/src/test/resources/relate/rentals.sql	                        (rev 0)
+++ trunk/test-integration/common/src/test/resources/relate/rentals.sql	2011-06-05 01:32:10 UTC (rev 3218)
@@ -0,0 +1,347 @@
+CREATE TABLE "ACCESSORIES"
+(
+   COMMONNAME varchar(40),
+   UUID varchar(36),
+   QUUID varchar(36),
+   ACCID varchar(10),
+   TYPE varchar(40),
+   MODEL varchar(15),
+   VERSION varchar(15)
+);
+CREATE TABLE "COLORS"
+(
+   COLORID varchar(10) primary key,
+   NAME varchar(42),
+   VEHICLEID varchar(10)
+);
+create index colors_vid_idx on colors (vehicleid);
+
+CREATE TABLE "COMPANIES"
+(
+   COMMONNAME varchar(40),
+   UUID varchar(36),
+   QUUID varchar(36),
+   COMPANYID varchar(10) primary key,
+   FULLNAME varchar(40),
+   CLASSIFICATION varchar(15)
+);
+CREATE TABLE "LOCATIONS"
+(
+   LOCATIONID varchar(10),
+   NAME varchar(42),
+   COMPANYID varchar(10)
+);
+CREATE TABLE "REL_COMP_ACC"
+(
+   COMMONNAME varchar(40),
+   UUID varchar(36),
+   QUUID varchar(36),
+   NATURE varchar(15),
+   SUBJECTTYPE varchar(40),
+   TARGETTYPE varchar(40),
+   COMPANYID varchar(10) NOT NULL,
+   ACCESSORYID varchar(10) NOT NULL,
+   QUANTITYAUTH int,
+   QUANTITYAVAIL int
+);
+CREATE TABLE "REL_COMP_SHARE"
+(
+   COMMONNAME varchar(40),
+   UUID varchar(36),
+   QUUID varchar(36),
+   NATURE varchar(15),
+   SUBJECTTYPE varchar(40),
+   TARGETTYPE varchar(40),
+   PRIMARYID varchar(10),
+   SECONDARYID varchar(10),
+   SINCE numeric(10,0)
+);
+CREATE TABLE "REL_COMP_SUBSID"
+(
+   COMMONNAME varchar(40),
+   UUID varchar(36),
+   QUUID varchar(36),
+   NATURE varchar(15),
+   SUBJECTTYPE varchar(40),
+   TARGETTYPE varchar(40),
+   COMPANYID varchar(10),
+   SUBSIDIARYID varchar(10),
+   PERCENTOWNS numeric(10,0)
+);
+CREATE TABLE "REL_COMP_VEH"
+(
+   COMMONNAME varchar(40),
+   UUID varchar(36),
+   QUUID varchar(36),
+   NATURE varchar(15),
+   SUBJECTTYPE varchar(40),
+   TARGETTYPE varchar(40),
+   COMPANYID varchar(10) NOT NULL,
+   VEHICLEID varchar(10) NOT NULL,
+   QUANTITYAUTH int,
+   QUANTITYAVAIL int
+);
+CREATE TABLE "REL_VEH_ACC"
+(
+   COMMONNAME varchar(40),
+   UUID varchar(36),
+   QUUID varchar(36),
+   NATURE varchar(15),
+   SUBJECTTYPE varchar(40),
+   TARGETTYPE varchar(40),
+   VEHICLEID varchar(10) NOT NULL,
+   ACCESSORYID varchar(10) NOT NULL,
+   QUANTITYAUTH int,
+   QUANTITYAVAIL int
+);
+CREATE TABLE "RENTAL_PRODUCTS"
+(
+   PRODUCTID varchar(10) NOT NULL,
+   DURATION varchar(42),
+   VEHICLEID varchar(10),
+   COMPANYID varchar(10)
+);
+CREATE TABLE "VEHICLES"
+(
+   COMMONNAME varchar(40),
+   UUID varchar(36),
+   QUUID varchar(36),
+   VEHICLEID varchar(10) primary key,
+   STYLE varchar(40),
+   MAKE varchar(15),
+   MODEL varchar(15),
+   MODELYEAR int
+);
+
+INSERT INTO "ACCESSORIES" (COMMONNAME,UUID,QUUID,ACCID,TYPE,MODEL,VERSION) VALUES ('Emerson NV-5000','AUUID2','AQUUID2','AID2','GPS','Emerson','NV-5000');
+
+INSERT INTO "ACCESSORIES" (COMMONNAME,UUID,QUUID,ACCID,TYPE,MODEL,VERSION) VALUES ('Garmin Street Pilot','AUUID1','AQUUID1','AID1','GPS','Garmin','Street Pilot');
+
+INSERT INTO "ACCESSORIES" (COMMONNAME,UUID,QUUID,ACCID,TYPE,MODEL,VERSION) VALUES ('Gvox A0102','AUUID5','AQUUID5','AID5','DVD','Gvox','A0102');
+
+INSERT INTO "ACCESSORIES" (COMMONNAME,UUID,QUUID,ACCID,TYPE,MODEL,VERSION) VALUES ('Gvox A0201','AUUID4','AQUUID4','AID4','DVD','Gvox','A0201');
+
+INSERT INTO "ACCESSORIES" (COMMONNAME,UUID,QUUID,ACCID,TYPE,MODEL,VERSION) VALUES ('Pioneer AVIC-N2','AUUID6','AQUUID6','AID6','Navigation','Pioneer','AVIC-N2');
+
+INSERT INTO "ACCESSORIES" (COMMONNAME,UUID,QUUID,ACCID,TYPE,MODEL,VERSION) VALUES ('Pioneer CD-VC60','AUUID8','AQUUID8','AID8','Voice Guidance','Pioneer','CD-VC60');
+
+INSERT INTO "ACCESSORIES" (COMMONNAME,UUID,QUUID,ACCID,TYPE,MODEL,VERSION) VALUES ('Pyle PLDVD65IN','AUUID3','AQUUID3','AID3','DVD','Pyle','PLDVD65IN');
+
+INSERT INTO "ACCESSORIES" (COMMONNAME,UUID,QUUID,ACCID,TYPE,MODEL,VERSION) VALUES ('Sanyo NV-E700','AUUID7','AQUUID7','AID7','Navigation','Sanyo','NV-E700');
+
+
+
+INSERT INTO "COLORS" (COLORID,NAME,VEHICLEID) VALUES ('C1','Red','VID1');
+
+INSERT INTO "COLORS" (COLORID,NAME,VEHICLEID) VALUES ('C2','Black','VID1');
+
+INSERT INTO "COLORS" (COLORID,NAME,VEHICLEID) VALUES ('C3','Puce','VID2');
+
+INSERT INTO "COLORS" (COLORID,NAME,VEHICLEID) VALUES ('C4','Red','VID3');
+
+INSERT INTO "COLORS" (COLORID,NAME,VEHICLEID) VALUES ('C5','Black','VID4');
+
+
+
+INSERT INTO "COMPANIES" (COMMONNAME,UUID,QUUID,COMPANYID,FULLNAME,CLASSIFICATION) VALUES ('Avian','CUUID1','CQUUID1','CID1','Avian Rentals, Inc.','Consumer');
+
+INSERT INTO "COMPANIES" (COMMONNAME,UUID,QUUID,COMPANYID,FULLNAME,CLASSIFICATION) VALUES ('Budge','CUUID3','CQUUID3','CID3','Budge, Inc.','Wholesale');
+
+INSERT INTO "COMPANIES" (COMMONNAME,UUID,QUUID,COMPANYID,FULLNAME,CLASSIFICATION) VALUES ('Entertwine','CUUID2','CQUUID2','CID2','Entertwine Rent A Car, Inc.','Consumer');
+
+INSERT INTO "COMPANIES" (COMMONNAME,UUID,QUUID,COMPANYID,FULLNAME,CLASSIFICATION) VALUES ('Gigahertz','CUUID4','CQUUID4','CID4','Gigahertz, Inc.','Consumer');
+
+INSERT INTO "COMPANIES" (COMMONNAME,UUID,QUUID,COMPANYID,FULLNAME,CLASSIFICATION) VALUES ('Peso','CUUID5','CQUUID5','CID5','Peso, Inc.','Consumer');
+
+INSERT INTO "COMPANIES" (COMMONNAME,UUID,QUUID,COMPANYID,FULLNAME,CLASSIFICATION) VALUES ('Wholefleet','CUUID6','CQUUID6','CID6','Wholefleet, Inc.','Wholesale');
+
+
+
+INSERT INTO "LOCATIONS" (LOCATIONID,NAME,COMPANYID) VALUES ('LOC1','Pittsburgh','CID1');
+
+INSERT INTO "LOCATIONS" (LOCATIONID,NAME,COMPANYID) VALUES ('LOC2','Moosejaw','CID2');
+
+INSERT INTO "LOCATIONS" (LOCATIONID,NAME,COMPANYID) VALUES ('LOC3','Keokuk','CID1');
+
+
+
+INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA11','CAUUID11','CAQUUID11','offers','Company','Accessory','CID1','AID1',1,1);
+
+INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA12','CAUUID12','CAQUUID12','offers','Company','Accessory','CID1','AID2',1,1);
+
+INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA13','CAUUID13','CAQUUID13','offers','Company','Accessory','CID1','AID3',1,1);
+
+INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA14','CAUUID14','CAQUUID14','offers','Company','Accessory','CID1','AID4',1,1);
+
+INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA15','CAUUID15','CAQUUID15','offers','Company','Accessory','CID1','AID5',1,1);
+
+INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA16','CAUUID16','CAQUUID16','offers','Company','Accessory','CID1','AID6',1,1);
+
+INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA21','CAUUID21','CAQUUID21','offers','Company','Accessory','CID2','AID1',1,1);
+
+INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA22','CAUUID22','CAQUUID22','offers','Company','Accessory','CID2','AID2',1,1);
+
+INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA23','CAUUID23','CAQUUID23','offers','Company','Accessory','CID2','AID3',1,1);
+
+INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA33','CAUUID33','CAQUUID33','offers','Company','Accessory','CID3','AID3',1,1);
+
+INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA61','CAUUID61','CAQUUID61','offers','Company','Accessory','CID6','AID1',1,1);
+
+INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA62','CAUUID62','CAQUUID62','offers','Company','Accessory','CID6','AID2',1,1);
+
+INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA63','CAUUID63','CAQUUID63','offers','Company','Accessory','CID6','AID3',1,1);
+
+INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA64','CAUUID64','CAQUUID64','offers','Company','Accessory','CID6','AID4',1,1);
+
+INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA65','CAUUID65','CAQUUID65','offers','Company','Accessory','CID6','AID5',1,1);
+
+INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA66','CAUUID66','CAQUUID66','offers','Company','Accessory','CID6','AID6',1,1);
+
+INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA67','CAUUID67','CAQUUID67','offers','Company','Accessory','CID6','AID7',1,1);
+
+INSERT INTO "REL_COMP_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCA68','CAUUID68','CAQUUID68','offers','Company','Accessory','CID6','AID8',1,1);
+
+
+
+INSERT INTO "REL_COMP_SHARE" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,PRIMARYID,SECONDARYID,SINCE) VALUES ('RCC12','CCUUID12','CCQUUID12','sharesWith','Company','Company','CID1','CID2',1985);
+
+INSERT INTO "REL_COMP_SHARE" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,PRIMARYID,SECONDARYID,SINCE) VALUES ('RCC13','CCUUID13','CCQUUID13','sharesWith','Company','Company','CID1','CID3',1995);
+
+INSERT INTO "REL_COMP_SHARE" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,PRIMARYID,SECONDARYID,SINCE) VALUES ('RCC14','CCUUID14','CCQUUID14','sharesWith','Company','Company','CID1','CID4',2005);
+
+INSERT INTO "REL_COMP_SHARE" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,PRIMARYID,SECONDARYID,SINCE) VALUES ('RCC34','CCUUID34','CCQUUID34','sharesWith','Company','Company','CID3','CID4',2001);
+
+INSERT INTO "REL_COMP_SHARE" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,PRIMARYID,SECONDARYID,SINCE) VALUES ('RCC54','CCUUID54','CCQUUID54','sharesWith','Company','Company','CID5','CID4',1999);
+
+INSERT INTO "REL_COMP_SHARE" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,PRIMARYID,SECONDARYID,SINCE) VALUES ('RCC64','CCUUID64','CCQUUID64','sharesWith','Company','Company','CID6','CID4',1995);
+
+
+
+INSERT INTO "REL_COMP_SUBSID" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,SUBSIDIARYID,PERCENTOWNS) VALUES ('RCS12','CSUUID12','CSQUUID12','owns','Company','Subsidiary','CID1','CID2',10);
+
+INSERT INTO "REL_COMP_SUBSID" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,SUBSIDIARYID,PERCENTOWNS) VALUES ('RCS13','CSUUID13','CSQUUID13','owns','Company','Subsidiary','CID1','CID3',50);
+
+INSERT INTO "REL_COMP_SUBSID" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,SUBSIDIARYID,PERCENTOWNS) VALUES ('RCS43','CSUUID43','CSQUUID43','owns','Company','Subsidiary','CID4','CID3',10);
+
+INSERT INTO "REL_COMP_SUBSID" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,SUBSIDIARYID,PERCENTOWNS) VALUES ('RCS56','CSUUID56','CSQUUID56','owns','Company','Subsidiary','CID5','CID6',100);
+
+
+
+INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV11','CVUUID11','CVQUUID11','rents','Company','Vehicle','CID1','VID1',10,2);
+
+INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV12','CVUUID12','CVQUUID12','rents','Company','Vehicle','CID1','VID2',2,2);
+
+INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV13','CVUUID13','CVQUUID13','rents','Company','Vehicle','CID1','VID3',2,0);
+
+INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV14','CVUUID14','CVQUUID14','rents','Company','Vehicle','CID1','VID4',2,1);
+
+INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV21','CVUUID21','CVQUUID21','rents','Company','Vehicle','CID2','VID1',5,3);
+
+INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV22','CVUUID22','CVQUUID22','rents','Company','Vehicle','CID2','VID2',2,1);
+
+INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV32','CVUUID32','CVQUUID32','rents','Company','Vehicle','CID3','VID2',1,1);
+
+INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV47','CVUUID47','CVQUUID47','rents','Company','Vehicle','CID4','VID7',1,1);
+
+INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV61','CVUUID61','CVQUUID61','rents','Company','Vehicle','CID6','VID1',1,1);
+
+INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV62','CVUUID62','CVQUUID62','rents','Company','Vehicle','CID6','VID2',2,2);
+
+INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV63','CVUUID63','CVQUUID63','rents','Company','Vehicle','CID6','VID3',3,3);
+
+INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV64','CVUUID64','CVQUUID64','rents','Company','Vehicle','CID6','VID4',4,4);
+
+INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV65','CVUUID65','CVQUUID65','rents','Company','Vehicle','CID6','VID5',5,5);
+
+INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV66','CVUUID66','CVQUUID66','rents','Company','Vehicle','CID6','VID6',6,6);
+
+INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV67','CVUUID67','CVQUUID67','rents','Company','Vehicle','CID6','VID7',7,7);
+
+INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV68','CVUUID68','CVQUUID68','rents','Company','Vehicle','CID6','VID8',8,8);
+
+INSERT INTO "REL_COMP_VEH" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,COMPANYID,VEHICLEID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RCV69','CVUUID69','CVQUUID69','rents','Company','Vehicle','CID6','VID9',9,9);
+
+
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA11','VAUUID11','VAQUUID11','has','Vehicle','Accessory','VID1','AID1',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA12','VAUUID12','VAQUUID12','has','Vehicle','Accessory','VID1','AID2',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA13','VAUUID13','VAQUUID13','has','Vehicle','Accessory','VID1','AID3',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA23','VAUUID23','VAQUUID23','has','Vehicle','Accessory','VID2','AID3',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA34','VAUUID34','VAQUUID34','has','Vehicle','Accessory','VID3','AID4',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA35','VAUUID35','VAQUUID35','has','Vehicle','Accessory','VID3','AID5',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA41','VAUUID41','VAQUUID41','has','Vehicle','Accessory','VID4','AID1',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA45','VAUUID45','VAQUUID45','has','Vehicle','Accessory','VID4','AID5',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA46','VAUUID46','VAQUUID46','has','Vehicle','Accessory','VID4','AID6',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA51','VAUUID51','VAQUUID51','has','Vehicle','Accessory','VID5','AID1',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA53','VAUUID53','VAQUUID53','has','Vehicle','Accessory','VID5','AID3',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA55','VAUUID55','VAQUUID55','has','Vehicle','Accessory','VID5','AID5',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA57','VAUUID57','VAQUUID57','has','Vehicle','Accessory','VID5','AID7',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA62','VAUUID62','VAQUUID62','has','Vehicle','Accessory','VID6','AID2',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA64','VAUUID64','VAQUUID64','has','Vehicle','Accessory','VID6','AID4',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA66','VAUUID66','VAQUUID66','has','Vehicle','Accessory','VID6','AID6',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA68','VAUUID68','VAQUUID68','has','Vehicle','Accessory','VID6','AID8',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA88','VAUUID88','VAQUUID88','has','Vehicle','Accessory','VID8','AID8',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA91','VAUUID91','VAQUUID91','has','Vehicle','Accessory','VID9','AID1',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA92','VAUUID92','VAQUUID92','has','Vehicle','Accessory','VID9','AID2',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA93','VAUUID93','VAQUUID93','has','Vehicle','Accessory','VID9','AID3',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA94','VAUUID94','VAQUUID94','has','Vehicle','Accessory','VID9','AID4',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA95','VAUUID95','VAQUUID95','has','Vehicle','Accessory','VID9','AID5',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA96','VAUUID96','VAQUUID96','has','Vehicle','Accessory','VID9','AID6',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA97','VAUUID97','VAQUUID97','has','Vehicle','Accessory','VID9','AID7',1,1);
+
+INSERT INTO "REL_VEH_ACC" (COMMONNAME,UUID,QUUID,NATURE,SUBJECTTYPE,TARGETTYPE,VEHICLEID,ACCESSORYID,QUANTITYAUTH,QUANTITYAVAIL) VALUES ('RVA98','VAUUID98','VAQUUID98','has','Vehicle','Accessory','VID9','AID8',1,1);
+
+
+
+INSERT INTO "RENTAL_PRODUCTS" (PRODUCTID,DURATION,VEHICLEID,COMPANYID) VALUES ('P1','Hourly','VID1','CID1');
+
+INSERT INTO "RENTAL_PRODUCTS" (PRODUCTID,DURATION,VEHICLEID,COMPANYID) VALUES ('P2','Daily','VID1','CID1');
+
+INSERT INTO "RENTAL_PRODUCTS" (PRODUCTID,DURATION,VEHICLEID,COMPANYID) VALUES ('P3','Weekly','VID1','CID1');
+
+INSERT INTO "RENTAL_PRODUCTS" (PRODUCTID,DURATION,VEHICLEID,COMPANYID) VALUES ('P4','Weekly','VID2','CID1');
+
+
+
+INSERT INTO "VEHICLES" (COMMONNAME,UUID,QUUID,VEHICLEID,STYLE,MAKE,MODEL,MODELYEAR) VALUES ('Chevy Tahoe 2005','VUUID3','VQUUID3','VID3','Utility','Chevrolet','Tahoe',2005);
+
+INSERT INTO "VEHICLES" (COMMONNAME,UUID,QUUID,VEHICLEID,STYLE,MAKE,MODEL,MODELYEAR) VALUES ('Ford F150 2004','VUUID2','VQUUID2','VID2','Utility','Ford','F150',2004);
+
+INSERT INTO "VEHICLES" (COMMONNAME,UUID,QUUID,VEHICLEID,STYLE,MAKE,MODEL,MODELYEAR) VALUES ('Ford F150 2005','VUUID1','VQUUID1','VID1','Utility','Ford','F150',2005);
+
+INSERT INTO "VEHICLES" (COMMONNAME,UUID,QUUID,VEHICLEID,STYLE,MAKE,MODEL,MODELYEAR) VALUES ('Ford Windstar 2004','VUUID5','VQUUID5','VID5','Minivan','Ford','Windstar',2004);
+
+INSERT INTO "VEHICLES" (COMMONNAME,UUID,QUUID,VEHICLEID,STYLE,MAKE,MODEL,MODELYEAR) VALUES ('Ford Windstar 2005','VUUID4','VQUUID4','VID4','Minivan','Ford','Windstar',2005);
+
+INSERT INTO "VEHICLES" (COMMONNAME,UUID,QUUID,VEHICLEID,STYLE,MAKE,MODEL,MODELYEAR) VALUES ('Honda Pilot 2005','VUUID9','VQUUID9','VID9','SUV','Honda','Pilot',2005);
+
+INSERT INTO "VEHICLES" (COMMONNAME,UUID,QUUID,VEHICLEID,STYLE,MAKE,MODEL,MODELYEAR) VALUES ('Nissan Quest 2004','VUUID7','VQUUID7','VID7','Minivan','Nissan','Quest',2004);
+
+INSERT INTO "VEHICLES" (COMMONNAME,UUID,QUUID,VEHICLEID,STYLE,MAKE,MODEL,MODELYEAR) VALUES ('Nissan Quest 2005','VUUID6','VQUUID6','VID6','Minivan','Nissan','Quest',2005);
+
+INSERT INTO "VEHICLES" (COMMONNAME,UUID,QUUID,VEHICLEID,STYLE,MAKE,MODEL,MODELYEAR) VALUES ('Toyota Sienna 2004','VUUID8','VQUUID8','VID8','Minivan','Toyota','Sienna',2004);
+

Deleted: trunk/test-integration/common/src/test/resources/relate/test.zip
===================================================================
(Binary files differ)

Copied: trunk/test-integration/common/src/test/resources/relate/test.zip (from rev 3217, branches/7.4.x/test-integration/common/src/test/resources/relate/test.zip)
===================================================================
(Binary files differ)

Deleted: trunk/test-integration/common/src/test/resources/relate/testCase3365.expected
===================================================================
--- branches/7.4.x/test-integration/common/src/test/resources/relate/testCase3365.expected	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/test-integration/common/src/test/resources/relate/testCase3365.expected	2011-06-05 01:32:10 UTC (rev 3218)
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Avian" uuid="CUUID1" queryUUID="CQUUID1" companyID="CID1"><rental:name>Avian Rentals, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Pittsburgh</rental:location><rental:location>Keokuk</rental:location></rental:locations></rental:company><rental:company commonName="Entertwine" uuid="CUUID2" queryUUID="CQUUID2" companyID="CID2"><rental:name>Entertwine Rent A Car, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Moosejaw</rental:location></rental:locations></rental:company><rental:company commonName="Budge" uuid="CUUID3" queryUUID="CQUUID3" companyID="CID3"><rental:name>Budge, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company><rental:company commonName="Gigahertz" uuid="CUUID4" queryUUID="CQUUID4" companyID="C!
 ID4"><rental:name>Gigahertz, Inc.</rental:name><rental:type>Consumer</rental:type></rental:company><rental:company commonName="Wholefleet" uuid="CUUID6" queryUUID="CQUUID6" companyID="CID6"><rental:name>Wholefleet, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company></rental:rentals>
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:rentsVehicle commonName="RCV11" uuid="CVUUID11" queryUUID="CVQUUID11" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID1"><rental:quantityAuthorized>10</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Hourly</rental:duration><rental:duration>Daily</rental:duration><rental:duration>Weekly</rental:duration></rental:rentalProducts></rental:rentsVehicle><rental:rentsVehicle commonName="RCV12" uuid="CVUUID12" queryUUID="CVQUUID12" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Weekly</rental:duration></rental:rentalProducts></rent!
 al:rentsVehicle><rental:rentsVehicle commonName="RCV13" uuid="CVUUID13" queryUUID="CVQUUID13" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID3"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>0</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV14" uuid="CVUUID14" queryUUID="CVQUUID14" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID4"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV21" uuid="CVUUID21" queryUUID="CVQUUID21" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID2" vehicleID="VID1"><rental:quantityAuthorized>5</rental:quantityAuthorized><rental:quantityAvailable>3</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV22" uuid="CVUUID22" queryUUID=!
 "CVQUUID22" nature="rents" subjectType="Company" targetType="V!
 ehicle" 
companyID="CID2" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV32" uuid="CVUUID32" queryUUID="CVQUUID32" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID3" vehicleID="VID2"><rental:quantityAuthorized>1</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV47" uuid="CVUUID47" queryUUID="CVQUUID47" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID4" vehicleID="VID7"><rental:quantityAuthorized>1</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV61" uuid="CVUUID61" queryUUID="CVQUUID61" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID1"><rental:quantityAuthorized>1</rental:quantityAuth!
 orized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV62" uuid="CVUUID62" queryUUID="CVQUUID62" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV63" uuid="CVUUID63" queryUUID="CVQUUID63" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID3"><rental:quantityAuthorized>3</rental:quantityAuthorized><rental:quantityAvailable>3</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV64" uuid="CVUUID64" queryUUID="CVQUUID64" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID4"><rental:quantityAuthorized>4</rental:quantityAuthorized><rental:quantityAvailable>4</rental:quantityAvailable></rental:rentsVehicle!
 ><rental:rentsVehicle commonName="RCV65" uuid="CVUUID65" query!
 UUID="CV
QUUID65" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID5"><rental:quantityAuthorized>5</rental:quantityAuthorized><rental:quantityAvailable>5</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV66" uuid="CVUUID66" queryUUID="CVQUUID66" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID6"><rental:quantityAuthorized>6</rental:quantityAuthorized><rental:quantityAvailable>6</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV67" uuid="CVUUID67" queryUUID="CVQUUID67" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID7"><rental:quantityAuthorized>7</rental:quantityAuthorized><rental:quantityAvailable>7</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV68" uuid="CVUUID68" queryUUID="CVQUUID68" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6"!
  vehicleID="VID8"><rental:quantityAuthorized>8</rental:quantityAuthorized><rental:quantityAvailable>8</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV69" uuid="CVUUID69" queryUUID="CVQUUID69" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID9"><rental:quantityAuthorized>9</rental:quantityAuthorized><rental:quantityAvailable>9</rental:quantityAvailable></rental:rentsVehicle></rental:rentals>
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:vehicle commonName="Ford F150 2005" uuid="VUUID1" queryUUID="VQUUID1" vehicleID="VID1"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford F150 2004" uuid="VUUID2" queryUUID="VQUUID2" vehicleID="VID2"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2004</rental:year><rental:availablecolors><rental:color>Puce</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Chevy Tahoe 2005" uuid="VUUID3" queryUUID="VQUUID3" vehicleID="VID3"><rental:style>Utility</rental:style><rental:make>Chevrolet</rental!
 :make><rental:model>Tahoe</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford Windstar 2005" uuid="VUUID4" queryUUID="VQUUID4" vehicleID="VID4"><rental:style>Minivan</rental:style><rental:make>Ford</rental:make><rental:model>Windstar</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford Windstar 2004" uuid="VUUID5" queryUUID="VQUUID5" vehicleID="VID5"><rental:style>Minivan</rental:style><rental:make>Ford</rental:make><rental:model>Windstar</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Nissan Quest 2005" uuid="VUUID6" queryUUID="VQUUID6" vehicleID="VID6"><rental:style>Minivan</rental:style><rental:make>Nissan</rental:make><rental:model>Quest</rental:model><rental:year>2005</rental:year></!
 rental:vehicle><rental:vehicle commonName="Nissan Quest 2004" !
 uuid="VU
UID7" queryUUID="VQUUID7" vehicleID="VID7"><rental:style>Minivan</rental:style><rental:make>Nissan</rental:make><rental:model>Quest</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Toyota Sienna 2004" uuid="VUUID8" queryUUID="VQUUID8" vehicleID="VID8"><rental:style>Minivan</rental:style><rental:make>Toyota</rental:make><rental:model>Sienna</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Honda Pilot 2005" uuid="VUUID9" queryUUID="VQUUID9" vehicleID="VID9"><rental:style>SUV</rental:style><rental:make>Honda</rental:make><rental:model>Pilot</rental:model><rental:year>2005</rental:year></rental:vehicle></rental:rentals>

Copied: trunk/test-integration/common/src/test/resources/relate/testCase3365.expected (from rev 3217, branches/7.4.x/test-integration/common/src/test/resources/relate/testCase3365.expected)
===================================================================
--- trunk/test-integration/common/src/test/resources/relate/testCase3365.expected	                        (rev 0)
+++ trunk/test-integration/common/src/test/resources/relate/testCase3365.expected	2011-06-05 01:32:10 UTC (rev 3218)
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Avian" uuid="CUUID1" queryUUID="CQUUID1" companyID="CID1"><rental:name>Avian Rentals, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Pittsburgh</rental:location><rental:location>Keokuk</rental:location></rental:locations></rental:company><rental:company commonName="Entertwine" uuid="CUUID2" queryUUID="CQUUID2" companyID="CID2"><rental:name>Entertwine Rent A Car, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Moosejaw</rental:location></rental:locations></rental:company><rental:company commonName="Budge" uuid="CUUID3" queryUUID="CQUUID3" companyID="CID3"><rental:name>Budge, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company><rental:company commonName="Gigahertz" uuid="CUUID4" queryUUID="CQUUID4" companyID="C!
 ID4"><rental:name>Gigahertz, Inc.</rental:name><rental:type>Consumer</rental:type></rental:company><rental:company commonName="Wholefleet" uuid="CUUID6" queryUUID="CQUUID6" companyID="CID6"><rental:name>Wholefleet, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company></rental:rentals>
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:rentsVehicle commonName="RCV11" uuid="CVUUID11" queryUUID="CVQUUID11" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID1"><rental:quantityAuthorized>10</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Hourly</rental:duration><rental:duration>Daily</rental:duration><rental:duration>Weekly</rental:duration></rental:rentalProducts></rental:rentsVehicle><rental:rentsVehicle commonName="RCV12" uuid="CVUUID12" queryUUID="CVQUUID12" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Weekly</rental:duration></rental:rentalProducts></rent!
 al:rentsVehicle><rental:rentsVehicle commonName="RCV13" uuid="CVUUID13" queryUUID="CVQUUID13" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID3"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>0</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV14" uuid="CVUUID14" queryUUID="CVQUUID14" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID4"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV21" uuid="CVUUID21" queryUUID="CVQUUID21" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID2" vehicleID="VID1"><rental:quantityAuthorized>5</rental:quantityAuthorized><rental:quantityAvailable>3</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV22" uuid="CVUUID22" queryUUID=!
 "CVQUUID22" nature="rents" subjectType="Company" targetType="V!
 ehicle" 
companyID="CID2" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV32" uuid="CVUUID32" queryUUID="CVQUUID32" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID3" vehicleID="VID2"><rental:quantityAuthorized>1</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV47" uuid="CVUUID47" queryUUID="CVQUUID47" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID4" vehicleID="VID7"><rental:quantityAuthorized>1</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV61" uuid="CVUUID61" queryUUID="CVQUUID61" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID1"><rental:quantityAuthorized>1</rental:quantityAuth!
 orized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV62" uuid="CVUUID62" queryUUID="CVQUUID62" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV63" uuid="CVUUID63" queryUUID="CVQUUID63" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID3"><rental:quantityAuthorized>3</rental:quantityAuthorized><rental:quantityAvailable>3</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV64" uuid="CVUUID64" queryUUID="CVQUUID64" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID4"><rental:quantityAuthorized>4</rental:quantityAuthorized><rental:quantityAvailable>4</rental:quantityAvailable></rental:rentsVehicle!
 ><rental:rentsVehicle commonName="RCV65" uuid="CVUUID65" query!
 UUID="CV
QUUID65" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID5"><rental:quantityAuthorized>5</rental:quantityAuthorized><rental:quantityAvailable>5</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV66" uuid="CVUUID66" queryUUID="CVQUUID66" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID6"><rental:quantityAuthorized>6</rental:quantityAuthorized><rental:quantityAvailable>6</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV67" uuid="CVUUID67" queryUUID="CVQUUID67" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID7"><rental:quantityAuthorized>7</rental:quantityAuthorized><rental:quantityAvailable>7</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV68" uuid="CVUUID68" queryUUID="CVQUUID68" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6"!
  vehicleID="VID8"><rental:quantityAuthorized>8</rental:quantityAuthorized><rental:quantityAvailable>8</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV69" uuid="CVUUID69" queryUUID="CVQUUID69" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID9"><rental:quantityAuthorized>9</rental:quantityAuthorized><rental:quantityAvailable>9</rental:quantityAvailable></rental:rentsVehicle></rental:rentals>
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:vehicle commonName="Ford F150 2005" uuid="VUUID1" queryUUID="VQUUID1" vehicleID="VID1"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford F150 2004" uuid="VUUID2" queryUUID="VQUUID2" vehicleID="VID2"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2004</rental:year><rental:availablecolors><rental:color>Puce</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Chevy Tahoe 2005" uuid="VUUID3" queryUUID="VQUUID3" vehicleID="VID3"><rental:style>Utility</rental:style><rental:make>Chevrolet</rental!
 :make><rental:model>Tahoe</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford Windstar 2005" uuid="VUUID4" queryUUID="VQUUID4" vehicleID="VID4"><rental:style>Minivan</rental:style><rental:make>Ford</rental:make><rental:model>Windstar</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford Windstar 2004" uuid="VUUID5" queryUUID="VQUUID5" vehicleID="VID5"><rental:style>Minivan</rental:style><rental:make>Ford</rental:make><rental:model>Windstar</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Nissan Quest 2005" uuid="VUUID6" queryUUID="VQUUID6" vehicleID="VID6"><rental:style>Minivan</rental:style><rental:make>Nissan</rental:make><rental:model>Quest</rental:model><rental:year>2005</rental:year></!
 rental:vehicle><rental:vehicle commonName="Nissan Quest 2004" !
 uuid="VU
UID7" queryUUID="VQUUID7" vehicleID="VID7"><rental:style>Minivan</rental:style><rental:make>Nissan</rental:make><rental:model>Quest</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Toyota Sienna 2004" uuid="VUUID8" queryUUID="VQUUID8" vehicleID="VID8"><rental:style>Minivan</rental:style><rental:make>Toyota</rental:make><rental:model>Sienna</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Honda Pilot 2005" uuid="VUUID9" queryUUID="VQUUID9" vehicleID="VID9"><rental:style>SUV</rental:style><rental:make>Honda</rental:make><rental:model>Pilot</rental:model><rental:year>2005</rental:year></rental:vehicle></rental:rentals>

Deleted: trunk/test-integration/common/src/test/resources/relate/testCase3365_compoundCritNestedTgt.expected
===================================================================
--- branches/7.4.x/test-integration/common/src/test/resources/relate/testCase3365_compoundCritNestedTgt.expected	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/test-integration/common/src/test/resources/relate/testCase3365_compoundCritNestedTgt.expected	2011-06-05 01:32:10 UTC (rev 3218)
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Avian" uuid="CUUID1" queryUUID="CQUUID1" companyID="CID1"><rental:name>Avian Rentals, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Pittsburgh</rental:location><rental:location>Keokuk</rental:location></rental:locations></rental:company><rental:company commonName="Entertwine" uuid="CUUID2" queryUUID="CQUUID2" companyID="CID2"><rental:name>Entertwine Rent A Car, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Moosejaw</rental:location></rental:locations></rental:company><rental:company commonName="Budge" uuid="CUUID3" queryUUID="CQUUID3" companyID="CID3"><rental:name>Budge, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company><rental:company commonName="Wholefleet" uuid="CUUID6" queryUUID="CQUUID6" companyID="!
 CID6"><rental:name>Wholefleet, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company></rental:rentals>
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:rentsVehicle commonName="RCV11" uuid="CVUUID11" queryUUID="CVQUUID11" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID1"><rental:quantityAuthorized>10</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Hourly</rental:duration><rental:duration>Daily</rental:duration><rental:duration>Weekly</rental:duration></rental:rentalProducts></rental:rentsVehicle><rental:rentsVehicle commonName="RCV12" uuid="CVUUID12" queryUUID="CVQUUID12" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Weekly</rental:duration></rental:rentalProducts></rent!
 al:rentsVehicle><rental:rentsVehicle commonName="RCV13" uuid="CVUUID13" queryUUID="CVQUUID13" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID3"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>0</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV14" uuid="CVUUID14" queryUUID="CVQUUID14" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID4"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV21" uuid="CVUUID21" queryUUID="CVQUUID21" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID2" vehicleID="VID1"><rental:quantityAuthorized>5</rental:quantityAuthorized><rental:quantityAvailable>3</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV22" uuid="CVUUID22" queryUUID=!
 "CVQUUID22" nature="rents" subjectType="Company" targetType="V!
 ehicle" 
companyID="CID2" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV32" uuid="CVUUID32" queryUUID="CVQUUID32" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID3" vehicleID="VID2"><rental:quantityAuthorized>1</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV61" uuid="CVUUID61" queryUUID="CVQUUID61" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID1"><rental:quantityAuthorized>1</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV62" uuid="CVUUID62" queryUUID="CVQUUID62" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuth!
 orized><rental:quantityAvailable>2</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV63" uuid="CVUUID63" queryUUID="CVQUUID63" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID3"><rental:quantityAuthorized>3</rental:quantityAuthorized><rental:quantityAvailable>3</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV64" uuid="CVUUID64" queryUUID="CVQUUID64" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID4"><rental:quantityAuthorized>4</rental:quantityAuthorized><rental:quantityAvailable>4</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV65" uuid="CVUUID65" queryUUID="CVQUUID65" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID5"><rental:quantityAuthorized>5</rental:quantityAuthorized><rental:quantityAvailable>5</rental:quantityAvailable></rental:rentsVehicle!
 ><rental:rentsVehicle commonName="RCV66" uuid="CVUUID66" query!
 UUID="CV
QUUID66" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID6"><rental:quantityAuthorized>6</rental:quantityAuthorized><rental:quantityAvailable>6</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV67" uuid="CVUUID67" queryUUID="CVQUUID67" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID7"><rental:quantityAuthorized>7</rental:quantityAuthorized><rental:quantityAvailable>7</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV68" uuid="CVUUID68" queryUUID="CVQUUID68" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID8"><rental:quantityAuthorized>8</rental:quantityAuthorized><rental:quantityAvailable>8</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV69" uuid="CVUUID69" queryUUID="CVQUUID69" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6"!
  vehicleID="VID9"><rental:quantityAuthorized>9</rental:quantityAuthorized><rental:quantityAvailable>9</rental:quantityAvailable></rental:rentsVehicle></rental:rentals>
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:vehicle commonName="Ford F150 2005" uuid="VUUID1" queryUUID="VQUUID1" vehicleID="VID1"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford F150 2004" uuid="VUUID2" queryUUID="VQUUID2" vehicleID="VID2"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2004</rental:year><rental:availablecolors><rental:color>Puce</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Chevy Tahoe 2005" uuid="VUUID3" queryUUID="VQUUID3" vehicleID="VID3"><rental:style>Utility</rental:style><rental:make>Chevrolet</rental!
 :make><rental:model>Tahoe</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford Windstar 2005" uuid="VUUID4" queryUUID="VQUUID4" vehicleID="VID4"><rental:style>Minivan</rental:style><rental:make>Ford</rental:make><rental:model>Windstar</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford Windstar 2004" uuid="VUUID5" queryUUID="VQUUID5" vehicleID="VID5"><rental:style>Minivan</rental:style><rental:make>Ford</rental:make><rental:model>Windstar</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Nissan Quest 2005" uuid="VUUID6" queryUUID="VQUUID6" vehicleID="VID6"><rental:style>Minivan</rental:style><rental:make>Nissan</rental:make><rental:model>Quest</rental:model><rental:year>2005</rental:year></!
 rental:vehicle><rental:vehicle commonName="Nissan Quest 2004" !
 uuid="VU
UID7" queryUUID="VQUUID7" vehicleID="VID7"><rental:style>Minivan</rental:style><rental:make>Nissan</rental:make><rental:model>Quest</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Toyota Sienna 2004" uuid="VUUID8" queryUUID="VQUUID8" vehicleID="VID8"><rental:style>Minivan</rental:style><rental:make>Toyota</rental:make><rental:model>Sienna</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Honda Pilot 2005" uuid="VUUID9" queryUUID="VQUUID9" vehicleID="VID9"><rental:style>SUV</rental:style><rental:make>Honda</rental:make><rental:model>Pilot</rental:model><rental:year>2005</rental:year></rental:vehicle></rental:rentals>

Copied: trunk/test-integration/common/src/test/resources/relate/testCase3365_compoundCritNestedTgt.expected (from rev 3217, branches/7.4.x/test-integration/common/src/test/resources/relate/testCase3365_compoundCritNestedTgt.expected)
===================================================================
--- trunk/test-integration/common/src/test/resources/relate/testCase3365_compoundCritNestedTgt.expected	                        (rev 0)
+++ trunk/test-integration/common/src/test/resources/relate/testCase3365_compoundCritNestedTgt.expected	2011-06-05 01:32:10 UTC (rev 3218)
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Avian" uuid="CUUID1" queryUUID="CQUUID1" companyID="CID1"><rental:name>Avian Rentals, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Pittsburgh</rental:location><rental:location>Keokuk</rental:location></rental:locations></rental:company><rental:company commonName="Entertwine" uuid="CUUID2" queryUUID="CQUUID2" companyID="CID2"><rental:name>Entertwine Rent A Car, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Moosejaw</rental:location></rental:locations></rental:company><rental:company commonName="Budge" uuid="CUUID3" queryUUID="CQUUID3" companyID="CID3"><rental:name>Budge, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company><rental:company commonName="Wholefleet" uuid="CUUID6" queryUUID="CQUUID6" companyID="!
 CID6"><rental:name>Wholefleet, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company></rental:rentals>
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:rentsVehicle commonName="RCV11" uuid="CVUUID11" queryUUID="CVQUUID11" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID1"><rental:quantityAuthorized>10</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Hourly</rental:duration><rental:duration>Daily</rental:duration><rental:duration>Weekly</rental:duration></rental:rentalProducts></rental:rentsVehicle><rental:rentsVehicle commonName="RCV12" uuid="CVUUID12" queryUUID="CVQUUID12" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Weekly</rental:duration></rental:rentalProducts></rent!
 al:rentsVehicle><rental:rentsVehicle commonName="RCV13" uuid="CVUUID13" queryUUID="CVQUUID13" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID3"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>0</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV14" uuid="CVUUID14" queryUUID="CVQUUID14" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID4"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV21" uuid="CVUUID21" queryUUID="CVQUUID21" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID2" vehicleID="VID1"><rental:quantityAuthorized>5</rental:quantityAuthorized><rental:quantityAvailable>3</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV22" uuid="CVUUID22" queryUUID=!
 "CVQUUID22" nature="rents" subjectType="Company" targetType="V!
 ehicle" 
companyID="CID2" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV32" uuid="CVUUID32" queryUUID="CVQUUID32" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID3" vehicleID="VID2"><rental:quantityAuthorized>1</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV61" uuid="CVUUID61" queryUUID="CVQUUID61" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID1"><rental:quantityAuthorized>1</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV62" uuid="CVUUID62" queryUUID="CVQUUID62" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuth!
 orized><rental:quantityAvailable>2</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV63" uuid="CVUUID63" queryUUID="CVQUUID63" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID3"><rental:quantityAuthorized>3</rental:quantityAuthorized><rental:quantityAvailable>3</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV64" uuid="CVUUID64" queryUUID="CVQUUID64" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID4"><rental:quantityAuthorized>4</rental:quantityAuthorized><rental:quantityAvailable>4</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV65" uuid="CVUUID65" queryUUID="CVQUUID65" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID5"><rental:quantityAuthorized>5</rental:quantityAuthorized><rental:quantityAvailable>5</rental:quantityAvailable></rental:rentsVehicle!
 ><rental:rentsVehicle commonName="RCV66" uuid="CVUUID66" query!
 UUID="CV
QUUID66" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID6"><rental:quantityAuthorized>6</rental:quantityAuthorized><rental:quantityAvailable>6</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV67" uuid="CVUUID67" queryUUID="CVQUUID67" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID7"><rental:quantityAuthorized>7</rental:quantityAuthorized><rental:quantityAvailable>7</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV68" uuid="CVUUID68" queryUUID="CVQUUID68" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID8"><rental:quantityAuthorized>8</rental:quantityAuthorized><rental:quantityAvailable>8</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV69" uuid="CVUUID69" queryUUID="CVQUUID69" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6"!
  vehicleID="VID9"><rental:quantityAuthorized>9</rental:quantityAuthorized><rental:quantityAvailable>9</rental:quantityAvailable></rental:rentsVehicle></rental:rentals>
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:vehicle commonName="Ford F150 2005" uuid="VUUID1" queryUUID="VQUUID1" vehicleID="VID1"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford F150 2004" uuid="VUUID2" queryUUID="VQUUID2" vehicleID="VID2"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2004</rental:year><rental:availablecolors><rental:color>Puce</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Chevy Tahoe 2005" uuid="VUUID3" queryUUID="VQUUID3" vehicleID="VID3"><rental:style>Utility</rental:style><rental:make>Chevrolet</rental!
 :make><rental:model>Tahoe</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford Windstar 2005" uuid="VUUID4" queryUUID="VQUUID4" vehicleID="VID4"><rental:style>Minivan</rental:style><rental:make>Ford</rental:make><rental:model>Windstar</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford Windstar 2004" uuid="VUUID5" queryUUID="VQUUID5" vehicleID="VID5"><rental:style>Minivan</rental:style><rental:make>Ford</rental:make><rental:model>Windstar</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Nissan Quest 2005" uuid="VUUID6" queryUUID="VQUUID6" vehicleID="VID6"><rental:style>Minivan</rental:style><rental:make>Nissan</rental:make><rental:model>Quest</rental:model><rental:year>2005</rental:year></!
 rental:vehicle><rental:vehicle commonName="Nissan Quest 2004" !
 uuid="VU
UID7" queryUUID="VQUUID7" vehicleID="VID7"><rental:style>Minivan</rental:style><rental:make>Nissan</rental:make><rental:model>Quest</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Toyota Sienna 2004" uuid="VUUID8" queryUUID="VQUUID8" vehicleID="VID8"><rental:style>Minivan</rental:style><rental:make>Toyota</rental:make><rental:model>Sienna</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Honda Pilot 2005" uuid="VUUID9" queryUUID="VQUUID9" vehicleID="VID9"><rental:style>SUV</rental:style><rental:make>Honda</rental:make><rental:model>Pilot</rental:model><rental:year>2005</rental:year></rental:vehicle></rental:rentals>

Deleted: trunk/test-integration/common/src/test/resources/relate/testCase3365_crit.expected
===================================================================
--- branches/7.4.x/test-integration/common/src/test/resources/relate/testCase3365_crit.expected	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/test-integration/common/src/test/resources/relate/testCase3365_crit.expected	2011-06-05 01:32:10 UTC (rev 3218)
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Avian" uuid="CUUID1" queryUUID="CQUUID1" companyID="CID1"><rental:name>Avian Rentals, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Pittsburgh</rental:location><rental:location>Keokuk</rental:location></rental:locations></rental:company></rental:rentals>
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:rentsVehicle commonName="RCV11" uuid="CVUUID11" queryUUID="CVQUUID11" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID1"><rental:quantityAuthorized>10</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Hourly</rental:duration><rental:duration>Daily</rental:duration><rental:duration>Weekly</rental:duration></rental:rentalProducts></rental:rentsVehicle><rental:rentsVehicle commonName="RCV12" uuid="CVUUID12" queryUUID="CVQUUID12" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Weekly</rental:duration></rental:rentalProducts></rent!
 al:rentsVehicle><rental:rentsVehicle commonName="RCV13" uuid="CVUUID13" queryUUID="CVQUUID13" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID3"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>0</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV14" uuid="CVUUID14" queryUUID="CVQUUID14" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID4"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle></rental:rentals>
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:vehicle commonName="Ford F150 2005" uuid="VUUID1" queryUUID="VQUUID1" vehicleID="VID1"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford F150 2004" uuid="VUUID2" queryUUID="VQUUID2" vehicleID="VID2"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2004</rental:year><rental:availablecolors><rental:color>Puce</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Chevy Tahoe 2005" uuid="VUUID3" queryUUID="VQUUID3" vehicleID="VID3"><rental:style>Utility</rental:style><rental:make>Chevrolet</rental!
 :make><rental:model>Tahoe</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford Windstar 2005" uuid="VUUID4" queryUUID="VQUUID4" vehicleID="VID4"><rental:style>Minivan</rental:style><rental:make>Ford</rental:make><rental:model>Windstar</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle></rental:rentals>

Copied: trunk/test-integration/common/src/test/resources/relate/testCase3365_crit.expected (from rev 3217, branches/7.4.x/test-integration/common/src/test/resources/relate/testCase3365_crit.expected)
===================================================================
--- trunk/test-integration/common/src/test/resources/relate/testCase3365_crit.expected	                        (rev 0)
+++ trunk/test-integration/common/src/test/resources/relate/testCase3365_crit.expected	2011-06-05 01:32:10 UTC (rev 3218)
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Avian" uuid="CUUID1" queryUUID="CQUUID1" companyID="CID1"><rental:name>Avian Rentals, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Pittsburgh</rental:location><rental:location>Keokuk</rental:location></rental:locations></rental:company></rental:rentals>
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:rentsVehicle commonName="RCV11" uuid="CVUUID11" queryUUID="CVQUUID11" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID1"><rental:quantityAuthorized>10</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Hourly</rental:duration><rental:duration>Daily</rental:duration><rental:duration>Weekly</rental:duration></rental:rentalProducts></rental:rentsVehicle><rental:rentsVehicle commonName="RCV12" uuid="CVUUID12" queryUUID="CVQUUID12" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Weekly</rental:duration></rental:rentalProducts></rent!
 al:rentsVehicle><rental:rentsVehicle commonName="RCV13" uuid="CVUUID13" queryUUID="CVQUUID13" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID3"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>0</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV14" uuid="CVUUID14" queryUUID="CVQUUID14" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID4"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle></rental:rentals>
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:vehicle commonName="Ford F150 2005" uuid="VUUID1" queryUUID="VQUUID1" vehicleID="VID1"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford F150 2004" uuid="VUUID2" queryUUID="VQUUID2" vehicleID="VID2"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2004</rental:year><rental:availablecolors><rental:color>Puce</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Chevy Tahoe 2005" uuid="VUUID3" queryUUID="VQUUID3" vehicleID="VID3"><rental:style>Utility</rental:style><rental:make>Chevrolet</rental!
 :make><rental:model>Tahoe</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford Windstar 2005" uuid="VUUID4" queryUUID="VQUUID4" vehicleID="VID4"><rental:style>Minivan</rental:style><rental:make>Ford</rental:make><rental:model>Windstar</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle></rental:rentals>

Deleted: trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrc.expected
===================================================================
--- branches/7.4.x/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrc.expected	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrc.expected	2011-06-05 01:32:10 UTC (rev 3218)
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Avian" uuid="CUUID1" queryUUID="CQUUID1" companyID="CID1"><rental:name>Avian Rentals, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Pittsburgh</rental:location><rental:location>Keokuk</rental:location></rental:locations></rental:company></rental:rentals>
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:rentsVehicle commonName="RCV11" uuid="CVUUID11" queryUUID="CVQUUID11" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID1"><rental:quantityAuthorized>10</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Hourly</rental:duration><rental:duration>Daily</rental:duration><rental:duration>Weekly</rental:duration></rental:rentalProducts></rental:rentsVehicle><rental:rentsVehicle commonName="RCV12" uuid="CVUUID12" queryUUID="CVQUUID12" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Weekly</rental:duration></rental:rentalProducts></rent!
 al:rentsVehicle><rental:rentsVehicle commonName="RCV13" uuid="CVUUID13" queryUUID="CVQUUID13" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID3"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>0</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV14" uuid="CVUUID14" queryUUID="CVQUUID14" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID4"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle></rental:rentals>
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:vehicle commonName="Ford F150 2005" uuid="VUUID1" queryUUID="VQUUID1" vehicleID="VID1"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford F150 2004" uuid="VUUID2" queryUUID="VQUUID2" vehicleID="VID2"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2004</rental:year><rental:availablecolors><rental:color>Puce</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Chevy Tahoe 2005" uuid="VUUID3" queryUUID="VQUUID3" vehicleID="VID3"><rental:style>Utility</rental:style><rental:make>Chevrolet</rental!
 :make><rental:model>Tahoe</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford Windstar 2005" uuid="VUUID4" queryUUID="VQUUID4" vehicleID="VID4"><rental:style>Minivan</rental:style><rental:make>Ford</rental:make><rental:model>Windstar</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle></rental:rentals>

Copied: trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrc.expected (from rev 3217, branches/7.4.x/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrc.expected)
===================================================================
--- trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrc.expected	                        (rev 0)
+++ trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrc.expected	2011-06-05 01:32:10 UTC (rev 3218)
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Avian" uuid="CUUID1" queryUUID="CQUUID1" companyID="CID1"><rental:name>Avian Rentals, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Pittsburgh</rental:location><rental:location>Keokuk</rental:location></rental:locations></rental:company></rental:rentals>
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:rentsVehicle commonName="RCV11" uuid="CVUUID11" queryUUID="CVQUUID11" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID1"><rental:quantityAuthorized>10</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Hourly</rental:duration><rental:duration>Daily</rental:duration><rental:duration>Weekly</rental:duration></rental:rentalProducts></rental:rentsVehicle><rental:rentsVehicle commonName="RCV12" uuid="CVUUID12" queryUUID="CVQUUID12" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Weekly</rental:duration></rental:rentalProducts></rent!
 al:rentsVehicle><rental:rentsVehicle commonName="RCV13" uuid="CVUUID13" queryUUID="CVQUUID13" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID3"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>0</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV14" uuid="CVUUID14" queryUUID="CVQUUID14" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID4"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle></rental:rentals>
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:vehicle commonName="Ford F150 2005" uuid="VUUID1" queryUUID="VQUUID1" vehicleID="VID1"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford F150 2004" uuid="VUUID2" queryUUID="VQUUID2" vehicleID="VID2"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2004</rental:year><rental:availablecolors><rental:color>Puce</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Chevy Tahoe 2005" uuid="VUUID3" queryUUID="VQUUID3" vehicleID="VID3"><rental:style>Utility</rental:style><rental:make>Chevrolet</rental!
 :make><rental:model>Tahoe</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford Windstar 2005" uuid="VUUID4" queryUUID="VQUUID4" vehicleID="VID4"><rental:style>Minivan</rental:style><rental:make>Ford</rental:make><rental:model>Windstar</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle></rental:rentals>

Deleted: trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrcCombinationContext.expected
===================================================================
--- branches/7.4.x/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrcCombinationContext.expected	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrcCombinationContext.expected	2011-06-05 01:32:10 UTC (rev 3218)
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Avian" uuid="CUUID1" queryUUID="CQUUID1" companyID="CID1"><rental:name>Avian Rentals, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Pittsburgh</rental:location></rental:locations></rental:company></rental:rentals>
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:rentsVehicle commonName="RCV11" uuid="CVUUID11" queryUUID="CVQUUID11" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID1"><rental:quantityAuthorized>10</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Hourly</rental:duration><rental:duration>Daily</rental:duration><rental:duration>Weekly</rental:duration></rental:rentalProducts></rental:rentsVehicle><rental:rentsVehicle commonName="RCV12" uuid="CVUUID12" queryUUID="CVQUUID12" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Weekly</rental:duration></rental:rentalProducts></rent!
 al:rentsVehicle><rental:rentsVehicle commonName="RCV13" uuid="CVUUID13" queryUUID="CVQUUID13" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID3"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>0</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV14" uuid="CVUUID14" queryUUID="CVQUUID14" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID4"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle></rental:rentals>
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:vehicle commonName="Ford F150 2005" uuid="VUUID1" queryUUID="VQUUID1" vehicleID="VID1"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford F150 2004" uuid="VUUID2" queryUUID="VQUUID2" vehicleID="VID2"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2004</rental:year><rental:availablecolors><rental:color>Puce</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Chevy Tahoe 2005" uuid="VUUID3" queryUUID="VQUUID3" vehicleID="VID3"><rental:style>Utility</rental:style><rental:make>Chevrolet</rental!
 :make><rental:model>Tahoe</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford Windstar 2005" uuid="VUUID4" queryUUID="VQUUID4" vehicleID="VID4"><rental:style>Minivan</rental:style><rental:make>Ford</rental:make><rental:model>Windstar</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle></rental:rentals>

Copied: trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrcCombinationContext.expected (from rev 3217, branches/7.4.x/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrcCombinationContext.expected)
===================================================================
--- trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrcCombinationContext.expected	                        (rev 0)
+++ trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrcCombinationContext.expected	2011-06-05 01:32:10 UTC (rev 3218)
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Avian" uuid="CUUID1" queryUUID="CQUUID1" companyID="CID1"><rental:name>Avian Rentals, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Pittsburgh</rental:location></rental:locations></rental:company></rental:rentals>
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:rentsVehicle commonName="RCV11" uuid="CVUUID11" queryUUID="CVQUUID11" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID1"><rental:quantityAuthorized>10</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Hourly</rental:duration><rental:duration>Daily</rental:duration><rental:duration>Weekly</rental:duration></rental:rentalProducts></rental:rentsVehicle><rental:rentsVehicle commonName="RCV12" uuid="CVUUID12" queryUUID="CVQUUID12" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Weekly</rental:duration></rental:rentalProducts></rent!
 al:rentsVehicle><rental:rentsVehicle commonName="RCV13" uuid="CVUUID13" queryUUID="CVQUUID13" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID3"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>0</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV14" uuid="CVUUID14" queryUUID="CVQUUID14" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID4"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle></rental:rentals>
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:vehicle commonName="Ford F150 2005" uuid="VUUID1" queryUUID="VQUUID1" vehicleID="VID1"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford F150 2004" uuid="VUUID2" queryUUID="VQUUID2" vehicleID="VID2"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2004</rental:year><rental:availablecolors><rental:color>Puce</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Chevy Tahoe 2005" uuid="VUUID3" queryUUID="VQUUID3" vehicleID="VID3"><rental:style>Utility</rental:style><rental:make>Chevrolet</rental!
 :make><rental:model>Tahoe</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford Windstar 2005" uuid="VUUID4" queryUUID="VQUUID4" vehicleID="VID4"><rental:style>Minivan</rental:style><rental:make>Ford</rental:make><rental:model>Windstar</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle></rental:rentals>

Deleted: trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrcContext.expected
===================================================================
--- branches/7.4.x/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrcContext.expected	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrcContext.expected	2011-06-05 01:32:10 UTC (rev 3218)
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Avian" uuid="CUUID1" queryUUID="CQUUID1" companyID="CID1"><rental:name>Avian Rentals, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Pittsburgh</rental:location></rental:locations></rental:company><rental:company commonName="Entertwine" uuid="CUUID2" queryUUID="CQUUID2" companyID="CID2"><rental:name>Entertwine Rent A Car, Inc.</rental:name><rental:type>Consumer</rental:type></rental:company><rental:company commonName="Budge" uuid="CUUID3" queryUUID="CQUUID3" companyID="CID3"><rental:name>Budge, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company><rental:company commonName="Gigahertz" uuid="CUUID4" queryUUID="CQUUID4" companyID="CID4"><rental:name>Gigahertz, Inc.</rental:name><rental:type>Consumer</rental:type></rental:company><rental:company common!
 Name="Wholefleet" uuid="CUUID6" queryUUID="CQUUID6" companyID="CID6"><rental:name>Wholefleet, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company></rental:rentals>
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:rentsVehicle commonName="RCV11" uuid="CVUUID11" queryUUID="CVQUUID11" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID1"><rental:quantityAuthorized>10</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Hourly</rental:duration><rental:duration>Daily</rental:duration><rental:duration>Weekly</rental:duration></rental:rentalProducts></rental:rentsVehicle><rental:rentsVehicle commonName="RCV12" uuid="CVUUID12" queryUUID="CVQUUID12" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Weekly</rental:duration></rental:rentalProducts></rent!
 al:rentsVehicle><rental:rentsVehicle commonName="RCV13" uuid="CVUUID13" queryUUID="CVQUUID13" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID3"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>0</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV14" uuid="CVUUID14" queryUUID="CVQUUID14" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID4"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV21" uuid="CVUUID21" queryUUID="CVQUUID21" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID2" vehicleID="VID1"><rental:quantityAuthorized>5</rental:quantityAuthorized><rental:quantityAvailable>3</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV22" uuid="CVUUID22" queryUUID=!
 "CVQUUID22" nature="rents" subjectType="Company" targetType="V!
 ehicle" 
companyID="CID2" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV32" uuid="CVUUID32" queryUUID="CVQUUID32" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID3" vehicleID="VID2"><rental:quantityAuthorized>1</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV47" uuid="CVUUID47" queryUUID="CVQUUID47" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID4" vehicleID="VID7"><rental:quantityAuthorized>1</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV61" uuid="CVUUID61" queryUUID="CVQUUID61" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID1"><rental:quantityAuthorized>1</rental:quantityAuth!
 orized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV62" uuid="CVUUID62" queryUUID="CVQUUID62" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV63" uuid="CVUUID63" queryUUID="CVQUUID63" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID3"><rental:quantityAuthorized>3</rental:quantityAuthorized><rental:quantityAvailable>3</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV64" uuid="CVUUID64" queryUUID="CVQUUID64" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID4"><rental:quantityAuthorized>4</rental:quantityAuthorized><rental:quantityAvailable>4</rental:quantityAvailable></rental:rentsVehicle!
 ><rental:rentsVehicle commonName="RCV65" uuid="CVUUID65" query!
 UUID="CV
QUUID65" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID5"><rental:quantityAuthorized>5</rental:quantityAuthorized><rental:quantityAvailable>5</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV66" uuid="CVUUID66" queryUUID="CVQUUID66" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID6"><rental:quantityAuthorized>6</rental:quantityAuthorized><rental:quantityAvailable>6</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV67" uuid="CVUUID67" queryUUID="CVQUUID67" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID7"><rental:quantityAuthorized>7</rental:quantityAuthorized><rental:quantityAvailable>7</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV68" uuid="CVUUID68" queryUUID="CVQUUID68" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6"!
  vehicleID="VID8"><rental:quantityAuthorized>8</rental:quantityAuthorized><rental:quantityAvailable>8</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV69" uuid="CVUUID69" queryUUID="CVQUUID69" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID9"><rental:quantityAuthorized>9</rental:quantityAuthorized><rental:quantityAvailable>9</rental:quantityAvailable></rental:rentsVehicle></rental:rentals>
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:vehicle commonName="Ford F150 2005" uuid="VUUID1" queryUUID="VQUUID1" vehicleID="VID1"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford F150 2004" uuid="VUUID2" queryUUID="VQUUID2" vehicleID="VID2"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2004</rental:year><rental:availablecolors><rental:color>Puce</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Chevy Tahoe 2005" uuid="VUUID3" queryUUID="VQUUID3" vehicleID="VID3"><rental:style>Utility</rental:style><rental:make>Chevrolet</rental!
 :make><rental:model>Tahoe</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford Windstar 2005" uuid="VUUID4" queryUUID="VQUUID4" vehicleID="VID4"><rental:style>Minivan</rental:style><rental:make>Ford</rental:make><rental:model>Windstar</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford Windstar 2004" uuid="VUUID5" queryUUID="VQUUID5" vehicleID="VID5"><rental:style>Minivan</rental:style><rental:make>Ford</rental:make><rental:model>Windstar</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Nissan Quest 2005" uuid="VUUID6" queryUUID="VQUUID6" vehicleID="VID6"><rental:style>Minivan</rental:style><rental:make>Nissan</rental:make><rental:model>Quest</rental:model><rental:year>2005</rental:year></!
 rental:vehicle><rental:vehicle commonName="Nissan Quest 2004" !
 uuid="VU
UID7" queryUUID="VQUUID7" vehicleID="VID7"><rental:style>Minivan</rental:style><rental:make>Nissan</rental:make><rental:model>Quest</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Toyota Sienna 2004" uuid="VUUID8" queryUUID="VQUUID8" vehicleID="VID8"><rental:style>Minivan</rental:style><rental:make>Toyota</rental:make><rental:model>Sienna</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Honda Pilot 2005" uuid="VUUID9" queryUUID="VQUUID9" vehicleID="VID9"><rental:style>SUV</rental:style><rental:make>Honda</rental:make><rental:model>Pilot</rental:model><rental:year>2005</rental:year></rental:vehicle></rental:rentals>

Copied: trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrcContext.expected (from rev 3217, branches/7.4.x/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrcContext.expected)
===================================================================
--- trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrcContext.expected	                        (rev 0)
+++ trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedSrcContext.expected	2011-06-05 01:32:10 UTC (rev 3218)
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Avian" uuid="CUUID1" queryUUID="CQUUID1" companyID="CID1"><rental:name>Avian Rentals, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Pittsburgh</rental:location></rental:locations></rental:company><rental:company commonName="Entertwine" uuid="CUUID2" queryUUID="CQUUID2" companyID="CID2"><rental:name>Entertwine Rent A Car, Inc.</rental:name><rental:type>Consumer</rental:type></rental:company><rental:company commonName="Budge" uuid="CUUID3" queryUUID="CQUUID3" companyID="CID3"><rental:name>Budge, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company><rental:company commonName="Gigahertz" uuid="CUUID4" queryUUID="CQUUID4" companyID="CID4"><rental:name>Gigahertz, Inc.</rental:name><rental:type>Consumer</rental:type></rental:company><rental:company common!
 Name="Wholefleet" uuid="CUUID6" queryUUID="CQUUID6" companyID="CID6"><rental:name>Wholefleet, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company></rental:rentals>
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:rentsVehicle commonName="RCV11" uuid="CVUUID11" queryUUID="CVQUUID11" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID1"><rental:quantityAuthorized>10</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Hourly</rental:duration><rental:duration>Daily</rental:duration><rental:duration>Weekly</rental:duration></rental:rentalProducts></rental:rentsVehicle><rental:rentsVehicle commonName="RCV12" uuid="CVUUID12" queryUUID="CVQUUID12" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Weekly</rental:duration></rental:rentalProducts></rent!
 al:rentsVehicle><rental:rentsVehicle commonName="RCV13" uuid="CVUUID13" queryUUID="CVQUUID13" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID3"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>0</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV14" uuid="CVUUID14" queryUUID="CVQUUID14" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID4"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV21" uuid="CVUUID21" queryUUID="CVQUUID21" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID2" vehicleID="VID1"><rental:quantityAuthorized>5</rental:quantityAuthorized><rental:quantityAvailable>3</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV22" uuid="CVUUID22" queryUUID=!
 "CVQUUID22" nature="rents" subjectType="Company" targetType="V!
 ehicle" 
companyID="CID2" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV32" uuid="CVUUID32" queryUUID="CVQUUID32" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID3" vehicleID="VID2"><rental:quantityAuthorized>1</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV47" uuid="CVUUID47" queryUUID="CVQUUID47" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID4" vehicleID="VID7"><rental:quantityAuthorized>1</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV61" uuid="CVUUID61" queryUUID="CVQUUID61" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID1"><rental:quantityAuthorized>1</rental:quantityAuth!
 orized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV62" uuid="CVUUID62" queryUUID="CVQUUID62" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV63" uuid="CVUUID63" queryUUID="CVQUUID63" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID3"><rental:quantityAuthorized>3</rental:quantityAuthorized><rental:quantityAvailable>3</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV64" uuid="CVUUID64" queryUUID="CVQUUID64" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID4"><rental:quantityAuthorized>4</rental:quantityAuthorized><rental:quantityAvailable>4</rental:quantityAvailable></rental:rentsVehicle!
 ><rental:rentsVehicle commonName="RCV65" uuid="CVUUID65" query!
 UUID="CV
QUUID65" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID5"><rental:quantityAuthorized>5</rental:quantityAuthorized><rental:quantityAvailable>5</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV66" uuid="CVUUID66" queryUUID="CVQUUID66" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID6"><rental:quantityAuthorized>6</rental:quantityAuthorized><rental:quantityAvailable>6</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV67" uuid="CVUUID67" queryUUID="CVQUUID67" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID7"><rental:quantityAuthorized>7</rental:quantityAuthorized><rental:quantityAvailable>7</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV68" uuid="CVUUID68" queryUUID="CVQUUID68" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6"!
  vehicleID="VID8"><rental:quantityAuthorized>8</rental:quantityAuthorized><rental:quantityAvailable>8</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV69" uuid="CVUUID69" queryUUID="CVQUUID69" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID9"><rental:quantityAuthorized>9</rental:quantityAuthorized><rental:quantityAvailable>9</rental:quantityAvailable></rental:rentsVehicle></rental:rentals>
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:vehicle commonName="Ford F150 2005" uuid="VUUID1" queryUUID="VQUUID1" vehicleID="VID1"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford F150 2004" uuid="VUUID2" queryUUID="VQUUID2" vehicleID="VID2"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2004</rental:year><rental:availablecolors><rental:color>Puce</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Chevy Tahoe 2005" uuid="VUUID3" queryUUID="VQUUID3" vehicleID="VID3"><rental:style>Utility</rental:style><rental:make>Chevrolet</rental!
 :make><rental:model>Tahoe</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford Windstar 2005" uuid="VUUID4" queryUUID="VQUUID4" vehicleID="VID4"><rental:style>Minivan</rental:style><rental:make>Ford</rental:make><rental:model>Windstar</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford Windstar 2004" uuid="VUUID5" queryUUID="VQUUID5" vehicleID="VID5"><rental:style>Minivan</rental:style><rental:make>Ford</rental:make><rental:model>Windstar</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Nissan Quest 2005" uuid="VUUID6" queryUUID="VQUUID6" vehicleID="VID6"><rental:style>Minivan</rental:style><rental:make>Nissan</rental:make><rental:model>Quest</rental:model><rental:year>2005</rental:year></!
 rental:vehicle><rental:vehicle commonName="Nissan Quest 2004" !
 uuid="VU
UID7" queryUUID="VQUUID7" vehicleID="VID7"><rental:style>Minivan</rental:style><rental:make>Nissan</rental:make><rental:model>Quest</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Toyota Sienna 2004" uuid="VUUID8" queryUUID="VQUUID8" vehicleID="VID8"><rental:style>Minivan</rental:style><rental:make>Toyota</rental:make><rental:model>Sienna</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Honda Pilot 2005" uuid="VUUID9" queryUUID="VQUUID9" vehicleID="VID9"><rental:style>SUV</rental:style><rental:make>Honda</rental:make><rental:model>Pilot</rental:model><rental:year>2005</rental:year></rental:vehicle></rental:rentals>

Deleted: trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedTgt.expected
===================================================================
--- branches/7.4.x/test-integration/common/src/test/resources/relate/testCase3365_critNestedTgt.expected	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedTgt.expected	2011-06-05 01:32:10 UTC (rev 3218)
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Avian" uuid="CUUID1" queryUUID="CQUUID1" companyID="CID1"><rental:name>Avian Rentals, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Pittsburgh</rental:location><rental:location>Keokuk</rental:location></rental:locations></rental:company><rental:company commonName="Entertwine" uuid="CUUID2" queryUUID="CQUUID2" companyID="CID2"><rental:name>Entertwine Rent A Car, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Moosejaw</rental:location></rental:locations></rental:company><rental:company commonName="Wholefleet" uuid="CUUID6" queryUUID="CQUUID6" companyID="CID6"><rental:name>Wholefleet, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company></rental:rentals>
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:rentsVehicle commonName="RCV11" uuid="CVUUID11" queryUUID="CVQUUID11" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID1"><rental:quantityAuthorized>10</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Hourly</rental:duration><rental:duration>Daily</rental:duration><rental:duration>Weekly</rental:duration></rental:rentalProducts></rental:rentsVehicle><rental:rentsVehicle commonName="RCV12" uuid="CVUUID12" queryUUID="CVQUUID12" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Weekly</rental:duration></rental:rentalProducts></rent!
 al:rentsVehicle><rental:rentsVehicle commonName="RCV13" uuid="CVUUID13" queryUUID="CVQUUID13" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID3"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>0</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV14" uuid="CVUUID14" queryUUID="CVQUUID14" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID4"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV21" uuid="CVUUID21" queryUUID="CVQUUID21" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID2" vehicleID="VID1"><rental:quantityAuthorized>5</rental:quantityAuthorized><rental:quantityAvailable>3</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV22" uuid="CVUUID22" queryUUID=!
 "CVQUUID22" nature="rents" subjectType="Company" targetType="V!
 ehicle" 
companyID="CID2" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV61" uuid="CVUUID61" queryUUID="CVQUUID61" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID1"><rental:quantityAuthorized>1</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV62" uuid="CVUUID62" queryUUID="CVQUUID62" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV63" uuid="CVUUID63" queryUUID="CVQUUID63" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID3"><rental:quantityAuthorized>3</rental:quantityAuth!
 orized><rental:quantityAvailable>3</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV64" uuid="CVUUID64" queryUUID="CVQUUID64" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID4"><rental:quantityAuthorized>4</rental:quantityAuthorized><rental:quantityAvailable>4</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV65" uuid="CVUUID65" queryUUID="CVQUUID65" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID5"><rental:quantityAuthorized>5</rental:quantityAuthorized><rental:quantityAvailable>5</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV66" uuid="CVUUID66" queryUUID="CVQUUID66" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID6"><rental:quantityAuthorized>6</rental:quantityAuthorized><rental:quantityAvailable>6</rental:quantityAvailable></rental:rentsVehicle!
 ><rental:rentsVehicle commonName="RCV67" uuid="CVUUID67" query!
 UUID="CV
QUUID67" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID7"><rental:quantityAuthorized>7</rental:quantityAuthorized><rental:quantityAvailable>7</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV68" uuid="CVUUID68" queryUUID="CVQUUID68" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID8"><rental:quantityAuthorized>8</rental:quantityAuthorized><rental:quantityAvailable>8</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV69" uuid="CVUUID69" queryUUID="CVQUUID69" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID9"><rental:quantityAuthorized>9</rental:quantityAuthorized><rental:quantityAvailable>9</rental:quantityAvailable></rental:rentsVehicle></rental:rentals>
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:vehicle commonName="Ford F150 2005" uuid="VUUID1" queryUUID="VQUUID1" vehicleID="VID1"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford F150 2004" uuid="VUUID2" queryUUID="VQUUID2" vehicleID="VID2"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2004</rental:year><rental:availablecolors><rental:color>Puce</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Chevy Tahoe 2005" uuid="VUUID3" queryUUID="VQUUID3" vehicleID="VID3"><rental:style>Utility</rental:style><rental:make>Chevrolet</rental!
 :make><rental:model>Tahoe</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford Windstar 2005" uuid="VUUID4" queryUUID="VQUUID4" vehicleID="VID4"><rental:style>Minivan</rental:style><rental:make>Ford</rental:make><rental:model>Windstar</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford Windstar 2004" uuid="VUUID5" queryUUID="VQUUID5" vehicleID="VID5"><rental:style>Minivan</rental:style><rental:make>Ford</rental:make><rental:model>Windstar</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Nissan Quest 2005" uuid="VUUID6" queryUUID="VQUUID6" vehicleID="VID6"><rental:style>Minivan</rental:style><rental:make>Nissan</rental:make><rental:model>Quest</rental:model><rental:year>2005</rental:year></!
 rental:vehicle><rental:vehicle commonName="Nissan Quest 2004" !
 uuid="VU
UID7" queryUUID="VQUUID7" vehicleID="VID7"><rental:style>Minivan</rental:style><rental:make>Nissan</rental:make><rental:model>Quest</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Toyota Sienna 2004" uuid="VUUID8" queryUUID="VQUUID8" vehicleID="VID8"><rental:style>Minivan</rental:style><rental:make>Toyota</rental:make><rental:model>Sienna</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Honda Pilot 2005" uuid="VUUID9" queryUUID="VQUUID9" vehicleID="VID9"><rental:style>SUV</rental:style><rental:make>Honda</rental:make><rental:model>Pilot</rental:model><rental:year>2005</rental:year></rental:vehicle></rental:rentals>

Copied: trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedTgt.expected (from rev 3217, branches/7.4.x/test-integration/common/src/test/resources/relate/testCase3365_critNestedTgt.expected)
===================================================================
--- trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedTgt.expected	                        (rev 0)
+++ trunk/test-integration/common/src/test/resources/relate/testCase3365_critNestedTgt.expected	2011-06-05 01:32:10 UTC (rev 3218)
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Avian" uuid="CUUID1" queryUUID="CQUUID1" companyID="CID1"><rental:name>Avian Rentals, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Pittsburgh</rental:location><rental:location>Keokuk</rental:location></rental:locations></rental:company><rental:company commonName="Entertwine" uuid="CUUID2" queryUUID="CQUUID2" companyID="CID2"><rental:name>Entertwine Rent A Car, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Moosejaw</rental:location></rental:locations></rental:company><rental:company commonName="Wholefleet" uuid="CUUID6" queryUUID="CQUUID6" companyID="CID6"><rental:name>Wholefleet, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company></rental:rentals>
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:rentsVehicle commonName="RCV11" uuid="CVUUID11" queryUUID="CVQUUID11" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID1"><rental:quantityAuthorized>10</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Hourly</rental:duration><rental:duration>Daily</rental:duration><rental:duration>Weekly</rental:duration></rental:rentalProducts></rental:rentsVehicle><rental:rentsVehicle commonName="RCV12" uuid="CVUUID12" queryUUID="CVQUUID12" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable><rental:rentalProducts><rental:duration>Weekly</rental:duration></rental:rentalProducts></rent!
 al:rentsVehicle><rental:rentsVehicle commonName="RCV13" uuid="CVUUID13" queryUUID="CVQUUID13" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID3"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>0</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV14" uuid="CVUUID14" queryUUID="CVQUUID14" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID1" vehicleID="VID4"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV21" uuid="CVUUID21" queryUUID="CVQUUID21" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID2" vehicleID="VID1"><rental:quantityAuthorized>5</rental:quantityAuthorized><rental:quantityAvailable>3</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV22" uuid="CVUUID22" queryUUID=!
 "CVQUUID22" nature="rents" subjectType="Company" targetType="V!
 ehicle" 
companyID="CID2" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV61" uuid="CVUUID61" queryUUID="CVQUUID61" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID1"><rental:quantityAuthorized>1</rental:quantityAuthorized><rental:quantityAvailable>1</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV62" uuid="CVUUID62" queryUUID="CVQUUID62" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID2"><rental:quantityAuthorized>2</rental:quantityAuthorized><rental:quantityAvailable>2</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV63" uuid="CVUUID63" queryUUID="CVQUUID63" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID3"><rental:quantityAuthorized>3</rental:quantityAuth!
 orized><rental:quantityAvailable>3</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV64" uuid="CVUUID64" queryUUID="CVQUUID64" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID4"><rental:quantityAuthorized>4</rental:quantityAuthorized><rental:quantityAvailable>4</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV65" uuid="CVUUID65" queryUUID="CVQUUID65" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID5"><rental:quantityAuthorized>5</rental:quantityAuthorized><rental:quantityAvailable>5</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV66" uuid="CVUUID66" queryUUID="CVQUUID66" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID6"><rental:quantityAuthorized>6</rental:quantityAuthorized><rental:quantityAvailable>6</rental:quantityAvailable></rental:rentsVehicle!
 ><rental:rentsVehicle commonName="RCV67" uuid="CVUUID67" query!
 UUID="CV
QUUID67" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID7"><rental:quantityAuthorized>7</rental:quantityAuthorized><rental:quantityAvailable>7</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV68" uuid="CVUUID68" queryUUID="CVQUUID68" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID8"><rental:quantityAuthorized>8</rental:quantityAuthorized><rental:quantityAvailable>8</rental:quantityAvailable></rental:rentsVehicle><rental:rentsVehicle commonName="RCV69" uuid="CVUUID69" queryUUID="CVQUUID69" nature="rents" subjectType="Company" targetType="Vehicle" companyID="CID6" vehicleID="VID9"><rental:quantityAuthorized>9</rental:quantityAuthorized><rental:quantityAvailable>9</rental:quantityAvailable></rental:rentsVehicle></rental:rentals>
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:vehicle commonName="Ford F150 2005" uuid="VUUID1" queryUUID="VQUUID1" vehicleID="VID1"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford F150 2004" uuid="VUUID2" queryUUID="VQUUID2" vehicleID="VID2"><rental:style>Utility</rental:style><rental:make>Ford</rental:make><rental:model>F150</rental:model><rental:year>2004</rental:year><rental:availablecolors><rental:color>Puce</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Chevy Tahoe 2005" uuid="VUUID3" queryUUID="VQUUID3" vehicleID="VID3"><rental:style>Utility</rental:style><rental:make>Chevrolet</rental!
 :make><rental:model>Tahoe</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Red</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford Windstar 2005" uuid="VUUID4" queryUUID="VQUUID4" vehicleID="VID4"><rental:style>Minivan</rental:style><rental:make>Ford</rental:make><rental:model>Windstar</rental:model><rental:year>2005</rental:year><rental:availablecolors><rental:color>Black</rental:color></rental:availablecolors></rental:vehicle><rental:vehicle commonName="Ford Windstar 2004" uuid="VUUID5" queryUUID="VQUUID5" vehicleID="VID5"><rental:style>Minivan</rental:style><rental:make>Ford</rental:make><rental:model>Windstar</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Nissan Quest 2005" uuid="VUUID6" queryUUID="VQUUID6" vehicleID="VID6"><rental:style>Minivan</rental:style><rental:make>Nissan</rental:make><rental:model>Quest</rental:model><rental:year>2005</rental:year></!
 rental:vehicle><rental:vehicle commonName="Nissan Quest 2004" !
 uuid="VU
UID7" queryUUID="VQUUID7" vehicleID="VID7"><rental:style>Minivan</rental:style><rental:make>Nissan</rental:make><rental:model>Quest</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Toyota Sienna 2004" uuid="VUUID8" queryUUID="VQUUID8" vehicleID="VID8"><rental:style>Minivan</rental:style><rental:make>Toyota</rental:make><rental:model>Sienna</rental:model><rental:year>2004</rental:year></rental:vehicle><rental:vehicle commonName="Honda Pilot 2005" uuid="VUUID9" queryUUID="VQUUID9" vehicleID="VID9"><rental:style>SUV</rental:style><rental:make>Honda</rental:make><rental:model>Pilot</rental:model><rental:year>2005</rental:year></rental:vehicle></rental:rentals>

Deleted: trunk/test-integration/common/src/test/resources/relate/testSharesDoc.expected
===================================================================
--- branches/7.4.x/test-integration/common/src/test/resources/relate/testSharesDoc.expected	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/test-integration/common/src/test/resources/relate/testSharesDoc.expected	2011-06-05 01:32:10 UTC (rev 3218)
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Avian" uuid="CUUID1" queryUUID="CQUUID1" companyID="CID1"><rental:name>Avian Rentals, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Pittsburgh</rental:location><rental:location>Keokuk</rental:location></rental:locations></rental:company><rental:company commonName="Budge" uuid="CUUID3" queryUUID="CQUUID3" companyID="CID3"><rental:name>Budge, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company><rental:company commonName="Peso" uuid="CUUID5" queryUUID="CQUUID5" companyID="CID5"><rental:name>Peso, Inc.</rental:name><rental:type>Consumer</rental:type></rental:company><rental:company commonName="Wholefleet" uuid="CUUID6" queryUUID="CQUUID6" companyID="CID6"><rental:name>Wholefleet, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company><!
 /rental:rentals>
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:hasSharingAgreement commonName="RCC12" uuid="CCUUID12" queryUUID="CCQUUID12" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID1" secondaryPartyID="CID2" since="1985"/><rental:hasSharingAgreement commonName="RCC13" uuid="CCUUID13" queryUUID="CCQUUID13" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID1" secondaryPartyID="CID3" since="1995"/><rental:hasSharingAgreement commonName="RCC14" uuid="CCUUID14" queryUUID="CCQUUID14" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID1" secondaryPartyID="CID4" since="2005"/><rental:hasSharingAgreement commonName="RCC34" uuid="CCUUID34" queryUUID="CCQUUID34" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID3" secondaryPartyID="CID4" since="2001"/><rental:hasSha!
 ringAgreement commonName="RCC54" uuid="CCUUID54" queryUUID="CCQUUID54" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID5" secondaryPartyID="CID4" since="1999"/><rental:hasSharingAgreement commonName="RCC64" uuid="CCUUID64" queryUUID="CCQUUID64" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID6" secondaryPartyID="CID4" since="1995"/></rental:rentals>
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Entertwine" uuid="CUUID2" queryUUID="CQUUID2" companyID="CID2"><rental:name>Entertwine Rent A Car, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Moosejaw</rental:location></rental:locations></rental:company><rental:company commonName="Gigahertz" uuid="CUUID4" queryUUID="CQUUID4" companyID="CID4"><rental:name>Gigahertz, Inc.</rental:name><rental:type>Consumer</rental:type></rental:company></rental:rentals>

Copied: trunk/test-integration/common/src/test/resources/relate/testSharesDoc.expected (from rev 3217, branches/7.4.x/test-integration/common/src/test/resources/relate/testSharesDoc.expected)
===================================================================
--- trunk/test-integration/common/src/test/resources/relate/testSharesDoc.expected	                        (rev 0)
+++ trunk/test-integration/common/src/test/resources/relate/testSharesDoc.expected	2011-06-05 01:32:10 UTC (rev 3218)
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Avian" uuid="CUUID1" queryUUID="CQUUID1" companyID="CID1"><rental:name>Avian Rentals, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Pittsburgh</rental:location><rental:location>Keokuk</rental:location></rental:locations></rental:company><rental:company commonName="Budge" uuid="CUUID3" queryUUID="CQUUID3" companyID="CID3"><rental:name>Budge, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company><rental:company commonName="Peso" uuid="CUUID5" queryUUID="CQUUID5" companyID="CID5"><rental:name>Peso, Inc.</rental:name><rental:type>Consumer</rental:type></rental:company><rental:company commonName="Wholefleet" uuid="CUUID6" queryUUID="CQUUID6" companyID="CID6"><rental:name>Wholefleet, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company><!
 /rental:rentals>
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:hasSharingAgreement commonName="RCC12" uuid="CCUUID12" queryUUID="CCQUUID12" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID1" secondaryPartyID="CID2" since="1985"/><rental:hasSharingAgreement commonName="RCC13" uuid="CCUUID13" queryUUID="CCQUUID13" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID1" secondaryPartyID="CID3" since="1995"/><rental:hasSharingAgreement commonName="RCC14" uuid="CCUUID14" queryUUID="CCQUUID14" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID1" secondaryPartyID="CID4" since="2005"/><rental:hasSharingAgreement commonName="RCC34" uuid="CCUUID34" queryUUID="CCQUUID34" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID3" secondaryPartyID="CID4" since="2001"/><rental:hasSha!
 ringAgreement commonName="RCC54" uuid="CCUUID54" queryUUID="CCQUUID54" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID5" secondaryPartyID="CID4" since="1999"/><rental:hasSharingAgreement commonName="RCC64" uuid="CCUUID64" queryUUID="CCQUUID64" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID6" secondaryPartyID="CID4" since="1995"/></rental:rentals>
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Entertwine" uuid="CUUID2" queryUUID="CQUUID2" companyID="CID2"><rental:name>Entertwine Rent A Car, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Moosejaw</rental:location></rental:locations></rental:company><rental:company commonName="Gigahertz" uuid="CUUID4" queryUUID="CQUUID4" companyID="CID4"><rental:name>Gigahertz, Inc.</rental:name><rental:type>Consumer</rental:type></rental:company></rental:rentals>

Deleted: trunk/test-integration/common/src/test/resources/relate/testSharesDocEspaceQuestion3.expected
===================================================================
--- branches/7.4.x/test-integration/common/src/test/resources/relate/testSharesDocEspaceQuestion3.expected	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/test-integration/common/src/test/resources/relate/testSharesDocEspaceQuestion3.expected	2011-06-05 01:32:10 UTC (rev 3218)
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Avian" uuid="CUUID1" queryUUID="CQUUID1" companyID="CID1"><rental:name>Avian Rentals, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Pittsburgh</rental:location><rental:location>Keokuk</rental:location></rental:locations></rental:company></rental:rentals>
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:hasSharingAgreement commonName="RCC12" uuid="CCUUID12" queryUUID="CCQUUID12" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID1" secondaryPartyID="CID2" since="1985"/><rental:hasSharingAgreement commonName="RCC13" uuid="CCUUID13" queryUUID="CCQUUID13" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID1" secondaryPartyID="CID3" since="1995"/><rental:hasSharingAgreement commonName="RCC14" uuid="CCUUID14" queryUUID="CCQUUID14" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID1" secondaryPartyID="CID4" since="2005"/></rental:rentals>
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Budge" uuid="CUUID3" queryUUID="CQUUID3" companyID="CID3"><rental:name>Budge, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company><rental:company commonName="Entertwine" uuid="CUUID2" queryUUID="CQUUID2" companyID="CID2"><rental:name>Entertwine Rent A Car, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Moosejaw</rental:location></rental:locations></rental:company><rental:company commonName="Gigahertz" uuid="CUUID4" queryUUID="CQUUID4" companyID="CID4"><rental:name>Gigahertz, Inc.</rental:name><rental:type>Consumer</rental:type></rental:company></rental:rentals>

Copied: trunk/test-integration/common/src/test/resources/relate/testSharesDocEspaceQuestion3.expected (from rev 3217, branches/7.4.x/test-integration/common/src/test/resources/relate/testSharesDocEspaceQuestion3.expected)
===================================================================
--- trunk/test-integration/common/src/test/resources/relate/testSharesDocEspaceQuestion3.expected	                        (rev 0)
+++ trunk/test-integration/common/src/test/resources/relate/testSharesDocEspaceQuestion3.expected	2011-06-05 01:32:10 UTC (rev 3218)
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Avian" uuid="CUUID1" queryUUID="CQUUID1" companyID="CID1"><rental:name>Avian Rentals, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Pittsburgh</rental:location><rental:location>Keokuk</rental:location></rental:locations></rental:company></rental:rentals>
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:hasSharingAgreement commonName="RCC12" uuid="CCUUID12" queryUUID="CCQUUID12" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID1" secondaryPartyID="CID2" since="1985"/><rental:hasSharingAgreement commonName="RCC13" uuid="CCUUID13" queryUUID="CCQUUID13" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID1" secondaryPartyID="CID3" since="1995"/><rental:hasSharingAgreement commonName="RCC14" uuid="CCUUID14" queryUUID="CCQUUID14" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID1" secondaryPartyID="CID4" since="2005"/></rental:rentals>
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Budge" uuid="CUUID3" queryUUID="CQUUID3" companyID="CID3"><rental:name>Budge, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company><rental:company commonName="Entertwine" uuid="CUUID2" queryUUID="CQUUID2" companyID="CID2"><rental:name>Entertwine Rent A Car, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Moosejaw</rental:location></rental:locations></rental:company><rental:company commonName="Gigahertz" uuid="CUUID4" queryUUID="CQUUID4" companyID="CID4"><rental:name>Gigahertz, Inc.</rental:name><rental:type>Consumer</rental:type></rental:company></rental:rentals>

Deleted: trunk/test-integration/common/src/test/resources/relate/testSharesDocWithCritTgt.expected
===================================================================
--- branches/7.4.x/test-integration/common/src/test/resources/relate/testSharesDocWithCritTgt.expected	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/test-integration/common/src/test/resources/relate/testSharesDocWithCritTgt.expected	2011-06-05 01:32:10 UTC (rev 3218)
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Avian" uuid="CUUID1" queryUUID="CQUUID1" companyID="CID1"><rental:name>Avian Rentals, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Pittsburgh</rental:location><rental:location>Keokuk</rental:location></rental:locations></rental:company></rental:rentals>
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:hasSharingAgreement commonName="RCC12" uuid="CCUUID12" queryUUID="CCQUUID12" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID1" secondaryPartyID="CID2" since="1985"/><rental:hasSharingAgreement commonName="RCC13" uuid="CCUUID13" queryUUID="CCQUUID13" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID1" secondaryPartyID="CID3" since="1995"/><rental:hasSharingAgreement commonName="RCC14" uuid="CCUUID14" queryUUID="CCQUUID14" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID1" secondaryPartyID="CID4" since="2005"/></rental:rentals>
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Budge" uuid="CUUID3" queryUUID="CQUUID3" companyID="CID3"><rental:name>Budge, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company><rental:company commonName="Entertwine" uuid="CUUID2" queryUUID="CQUUID2" companyID="CID2"><rental:name>Entertwine Rent A Car, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Moosejaw</rental:location></rental:locations></rental:company><rental:company commonName="Gigahertz" uuid="CUUID4" queryUUID="CQUUID4" companyID="CID4"><rental:name>Gigahertz, Inc.</rental:name><rental:type>Consumer</rental:type></rental:company></rental:rentals>

Copied: trunk/test-integration/common/src/test/resources/relate/testSharesDocWithCritTgt.expected (from rev 3217, branches/7.4.x/test-integration/common/src/test/resources/relate/testSharesDocWithCritTgt.expected)
===================================================================
--- trunk/test-integration/common/src/test/resources/relate/testSharesDocWithCritTgt.expected	                        (rev 0)
+++ trunk/test-integration/common/src/test/resources/relate/testSharesDocWithCritTgt.expected	2011-06-05 01:32:10 UTC (rev 3218)
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Avian" uuid="CUUID1" queryUUID="CQUUID1" companyID="CID1"><rental:name>Avian Rentals, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Pittsburgh</rental:location><rental:location>Keokuk</rental:location></rental:locations></rental:company></rental:rentals>
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:hasSharingAgreement commonName="RCC12" uuid="CCUUID12" queryUUID="CCQUUID12" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID1" secondaryPartyID="CID2" since="1985"/><rental:hasSharingAgreement commonName="RCC13" uuid="CCUUID13" queryUUID="CCQUUID13" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID1" secondaryPartyID="CID3" since="1995"/><rental:hasSharingAgreement commonName="RCC14" uuid="CCUUID14" queryUUID="CCQUUID14" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID1" secondaryPartyID="CID4" since="2005"/></rental:rentals>
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Budge" uuid="CUUID3" queryUUID="CQUUID3" companyID="CID3"><rental:name>Budge, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company><rental:company commonName="Entertwine" uuid="CUUID2" queryUUID="CQUUID2" companyID="CID2"><rental:name>Entertwine Rent A Car, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Moosejaw</rental:location></rental:locations></rental:company><rental:company commonName="Gigahertz" uuid="CUUID4" queryUUID="CQUUID4" companyID="CID4"><rental:name>Gigahertz, Inc.</rental:name><rental:type>Consumer</rental:type></rental:company></rental:rentals>

Deleted: trunk/test-integration/common/src/test/resources/relate/testSharesDocWithCritTgtContext.expected
===================================================================
--- branches/7.4.x/test-integration/common/src/test/resources/relate/testSharesDocWithCritTgtContext.expected	2011-06-04 02:46:06 UTC (rev 3217)
+++ trunk/test-integration/common/src/test/resources/relate/testSharesDocWithCritTgtContext.expected	2011-06-05 01:32:10 UTC (rev 3218)
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Avian" uuid="CUUID1" queryUUID="CQUUID1" companyID="CID1"><rental:name>Avian Rentals, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Pittsburgh</rental:location><rental:location>Keokuk</rental:location></rental:locations></rental:company></rental:rentals>
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:hasSharingAgreement commonName="RCC13" uuid="CCUUID13" queryUUID="CCQUUID13" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID1" secondaryPartyID="CID3" since="1995"/></rental:rentals>
-<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Budge" uuid="CUUID3" queryUUID="CQUUID3" companyID="CID3"><rental:name>Budge, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company></rental:rentals>

Copied: trunk/test-integration/common/src/test/resources/relate/testSharesDocWithCritTgtContext.expected (from rev 3217, branches/7.4.x/test-integration/common/src/test/resources/relate/testSharesDocWithCritTgtContext.expected)
===================================================================
--- trunk/test-integration/common/src/test/resources/relate/testSharesDocWithCritTgtContext.expected	                        (rev 0)
+++ trunk/test-integration/common/src/test/resources/relate/testSharesDocWithCritTgtContext.expected	2011-06-05 01:32:10 UTC (rev 3218)
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Avian" uuid="CUUID1" queryUUID="CQUUID1" companyID="CID1"><rental:name>Avian Rentals, Inc.</rental:name><rental:type>Consumer</rental:type><rental:locations><rental:location>Pittsburgh</rental:location><rental:location>Keokuk</rental:location></rental:locations></rental:company></rental:rentals>
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:hasSharingAgreement commonName="RCC13" uuid="CCUUID13" queryUUID="CCQUUID13" nature="sharesWith" subjectType="Company" targetType="Company" primaryPartyID="CID1" secondaryPartyID="CID3" since="1995"/></rental:rentals>
+<?xml version="1.0" encoding="UTF-8"?><rental:rentals xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rental="urn:metamatrix:source:rental"><rental:company commonName="Budge" uuid="CUUID3" queryUUID="CQUUID3" companyID="CID3"><rental:name>Budge, Inc.</rental:name><rental:type>Wholesale</rental:type></rental:company></rental:rentals>



More information about the teiid-commits mailing list