[teiid-commits] teiid SVN: r2044 - in trunk: build/kit-jboss-container/deploy/teiid and 10 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Fri Apr 9 15:44:19 EDT 2010


Author: rareddy
Date: 2010-04-09 15:44:15 -0400 (Fri, 09 Apr 2010)
New Revision: 2044

Added:
   trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
   trunk/runtime/src/main/java/org/teiid/deployers/MetadataStoreGroup.java
   trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
   trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestVDBMerge.java
Modified:
   trunk/adminshell/src/main/resources/scripts/adminapi.bsh
   trunk/build/kit-jboss-container/deploy/teiid/teiid-jboss-beans.xml
   trunk/client/src/main/java/org/teiid/adminapi/Admin.java
   trunk/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java
   trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
   trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
   trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
   trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectionFactoryDeployer.java
   trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
   trunk/metadata/src/test/java/org/teiid/metadata/index/VDBMetadataFactory.java
   trunk/runtime/src/main/java/org/teiid/deployers/SystemVDBDeployer.java
   trunk/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java
   trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
   trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
   trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
   trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
   trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestCase3473.java
   trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestMMDatabaseMetaData.java
   trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestQueryPlans.java
   trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestPartsDatabaseMetadata.java
   trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestResultSetMetadata.java
   trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java
   trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestVirtualDocWithVirtualProc.java
   trunk/test-integration/common/src/test/resources/system/expected/Schemas.txt
Log:
TEIID-1039: Providing a admin method to merge two VDBs. This can be used by the Designer for preview functionality.

Modified: trunk/adminshell/src/main/resources/scripts/adminapi.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/adminapi.bsh	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/adminshell/src/main/resources/scripts/adminapi.bsh	2010-04-09 19:44:15 UTC (rev 2044)
@@ -49,6 +49,20 @@
 }
 
 /**
+ * Merge the Source VDB into Target VDB. Both Source and Target VDBs must be present for this method to
+ * succeed. The changes will not be persistent between server restarts.
+ * @param sourceVDBName
+ * @param sourceVDBVersion
+ * @param targetVDBName
+ * @param targetVDBVersion
+ */
+void mergeVDBs(String sourceVDBName, int sourceVDBVersion, String targetVDBName, int targetVDBVersion) {
+    debug("Merging VDB " + sourceVDBName+"."+sourceVDBVersion + " into " + targetVDBName+"."+targetVDBVersion);
+    checkAdmin();    
+    internalAdmin.mergeVDBs(sourceVDBName, sourceVDBVersion, targetVDBName, targetVDBVersion);
+}
+
+/**
  * Deploy a {@link ConnectionFactory} to Configuration
  *
  * @param deployedName  Connection Factory name that will be added to Configuration

Modified: trunk/build/kit-jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
--- trunk/build/kit-jboss-container/deploy/teiid/teiid-jboss-beans.xml	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/build/kit-jboss-container/deploy/teiid/teiid-jboss-beans.xml	2010-04-09 19:44:15 UTC (rev 2044)
@@ -71,6 +71,7 @@
         <property name="bufferService"><inject bean="BufferService"/></property>
         <property name="connectorManagerRepository"><inject bean="ConnectorManagerRepository"/></property>
         <property name="securityHelper"><inject bean="SecurityHelper"/></property>
+        <property name="VDBRepository"><inject bean="VDBRepository"/></property>
         
         <!-- Name of the process that uniquely identifies this process -->
         <property name="processName">localhost</property>

Modified: trunk/client/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Admin.java	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/client/src/main/java/org/teiid/adminapi/Admin.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -373,14 +373,14 @@
     void removeRoleFromDataPolicy(String vdbName, int vdbVersion, String policyName, String role) throws AdminException;
     
     
-//    /**
-//     * Merge the Source VDB into Target VDB. Both Source and Target VDBs must be present for this method to
-//     * succeed. The changes will not be persistent between server restarts.
-//     * @param sourceVDBName
-//     * @param sourceVDBVersion
-//     * @param targetVDBName
-//     * @param targetVDBVersion
-//     */
-//    void mergeVDBs(String sourceVDBName, int sourceVDBVersion, String targetVDBName, int targetVDBVersion) throws AdminException;
+    /**
+     * Merge the Source VDB into Target VDB. Both Source and Target VDBs must be present for this method to
+     * succeed. The changes will not be persistent between server restarts.
+     * @param sourceVDBName
+     * @param sourceVDBVersion
+     * @param targetVDBName
+     * @param targetVDBVersion
+     */
+    void mergeVDBs(String sourceVDBName, int sourceVDBVersion, String targetVDBName, int targetVDBVersion) throws AdminException;
 
 }

Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -39,4 +39,5 @@
     int getActiveSessionsCount() throws AdminException;
     Collection<org.teiid.adminapi.Transaction> getTransactions();
     void terminateTransaction(String xid) throws AdminException ;
+    void mergeVDBs(String sourceVDBName, int sourceVDBVersion, String targetVDBName, int targetVDBVersion) throws AdminException;
 }

Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -150,6 +150,10 @@
         this.modelType = modelType.name();
     }
     
+    public void setModelType(String modelType) {
+        this.modelType = modelType;
+    }    
+    
     public String toString() {
 		return getName() + this.sources;
     }

Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -263,4 +263,8 @@
 	public DataPolicyMetadata getDataPolicy(String policyName) {
 		return this.dataPolicies.getMap().get(policyName);
 	}
+	
+	public boolean isPreview() {
+		return Boolean.valueOf(getPropertyValue("preview")); //$NON-NLS-1$
+	}
 }

Modified: trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -540,7 +540,7 @@
 		ModelMetaData model = new ModelMetaData();
 		model.setName(ManagedUtil.getSimpleValue(managedModel, "name", String.class));//$NON-NLS-1$
 		model.setVisible(ManagedUtil.getSimpleValue(managedModel, "visible", Boolean.class));//$NON-NLS-1$
-		model.setModelType(Model.Type.valueOf(ManagedUtil.getSimpleValue(managedModel, "modelType", String.class)));//$NON-NLS-1$
+		model.setModelType(ManagedUtil.getSimpleValue(managedModel, "modelType", String.class));//$NON-NLS-1$
 
 		ManagedProperty prop = managedModel.getProperty("JAXBProperties"); //$NON-NLS-1$
 		List<ManagedObject> properties = (List<ManagedObject>)MetaValueFactory.getInstance().unwrap(prop.getValue());
@@ -1060,17 +1060,17 @@
 		manageRoleToDataPolicy(vdbName, vdbVersion, policyName, role, false);
 	}	
 
-//	@Override
-//	public void mergeVDBs(String sourceVDBName, int sourceVDBVersion, String targetVDBName, int targetVDBVersion) throws AdminException {
-//		try {
-//			ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);	
-//			ManagedUtil.executeOperation(mc, "mergeVDBs", 
-//					SimpleValueSupport.wrap(sourceVDBName), 
-//					SimpleValueSupport.wrap(sourceVDBVersion), 
-//					SimpleValueSupport.wrap(targetVDBName), 
-//					SimpleValueSupport.wrap(targetVDBVersion));//$NON-NLS-1$
-//		} catch (Exception e) {
-//			throw new AdminComponentException(e.getMessage(), e);
-//		}   		
-//	}
+	@Override
+	public void mergeVDBs(String sourceVDBName, int sourceVDBVersion, String targetVDBName, int targetVDBVersion) throws AdminException {
+		try {
+			ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);	
+			ManagedUtil.executeOperation(mc, "mergeVDBs", 
+					SimpleValueSupport.wrap(sourceVDBName), 
+					SimpleValueSupport.wrap(sourceVDBVersion), 
+					SimpleValueSupport.wrap(targetVDBName), 
+					SimpleValueSupport.wrap(targetVDBVersion));//$NON-NLS-1$
+		} catch (Exception e) {
+			throw new AdminComponentException(e.getMessage(), e);
+		}   		
+	}
 }

Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectionFactoryDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectionFactoryDeployer.java	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectionFactoryDeployer.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -154,9 +154,10 @@
 	
 	public void connectorAdded(String connectorName) {
 		for (VDBMetaData vdb:this.vdbRepository.getVDBs()) {
-			if (vdb.getStatus() == VDB.Status.ACTIVE) {
+			if (vdb.getStatus() == VDB.Status.ACTIVE || vdb.isPreview()) {
 				continue;
 			}
+			
 			for (Model m:vdb.getModels()) {
 				ModelMetaData model = (ModelMetaData)m;
 				if (model.getErrors().isEmpty()) {
@@ -206,6 +207,9 @@
 
 	public void connectorRemoved(String connectorName) {
 		for (VDBMetaData vdb:this.vdbRepository.getVDBs()) {
+			if (vdb.isPreview()) {
+				continue;
+			}
 			for (Model m:vdb.getModels()) {
 				ModelMetaData model = (ModelMetaData)m;
 				for (String sourceName:model.getSourceNames()) {

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	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -52,6 +52,7 @@
 import org.teiid.client.DQP;
 import org.teiid.client.security.ILogon;
 import org.teiid.client.util.ExceptionUtil;
+import org.teiid.deployers.VDBRepository;
 import org.teiid.dqp.internal.datamgr.impl.ConnectorManagerRepository;
 import org.teiid.dqp.internal.process.DQPConfiguration;
 import org.teiid.dqp.internal.process.DQPCore;
@@ -93,6 +94,7 @@
 	private transient ILogon logon;
 	private transient Admin admin;
 	private transient ClientServiceRegistryImpl csr = new ClientServiceRegistryImpl();	
+	private transient VDBRepository vdbRepository;
 
     public RuntimeEngineDeployer() {
 		// TODO: this does not belong here
@@ -230,6 +232,10 @@
 		this.csr.setSecurityHelper(helper);
 	}
 	
+	public void setVDBRepository(VDBRepository repo) {
+		this.vdbRepository = repo;
+	}
+	
 	@Override
     @ManagementOperation(description="Requests for perticular session", impact=Impact.ReadOnly,params={@ManagementParameter(name="sessionId",description="The session Identifier")})
     public List<RequestMetadata> getRequestsForSession(long sessionId) {
@@ -313,5 +319,12 @@
 	@ManagementOperation(description="Clear the caches in the system", impact=Impact.ReadOnly)
 	public void terminateTransaction(String xid) throws AdminException {
 		this.dqpCore.terminateTransaction(xid);
+	}
+
+	@Override
+    @ManagementOperation(description="Merge Two VDBs",params={@ManagementParameter(name="sourceVDBName"), at ManagementParameter(name="sourceVDBName"), @ManagementParameter(name="targetVDBName"), @ManagementParameter(name="targetVDBVersion")})
+	public void mergeVDBs(String sourceVDBName, int sourceVDBVersion,
+			String targetVDBName, int targetVDBVersion) throws AdminException {
+		this.vdbRepository.mergeVDBs(sourceVDBName, sourceVDBVersion, targetVDBName, targetVDBVersion);
 	}	
 }

Modified: trunk/metadata/src/test/java/org/teiid/metadata/index/VDBMetadataFactory.java
===================================================================
--- trunk/metadata/src/test/java/org/teiid/metadata/index/VDBMetadataFactory.java	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/metadata/src/test/java/org/teiid/metadata/index/VDBMetadataFactory.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -56,6 +56,15 @@
 		}
     }
 	
+	public static MetadataStore getSystemVDBMetadataStore() {
+		try {
+			IndexMetadataFactory imf = loadMetadata(Thread.currentThread().getContextClassLoader().getResource(CoreConstants.SYSTEM_VDB));
+			return imf.getMetadataStore();
+		} catch (Exception e) {
+			throw new MetaMatrixRuntimeException("System VDB not found");
+		}
+    }
+	
 	public static TransformationMetadata getVDBMetadata(URL vdbURL, URL udfFile) throws IOException {
 		TransformationMetadata vdbmetadata = VDB_CACHE.get(vdbURL);
 		if (vdbmetadata != null) {
@@ -78,7 +87,7 @@
 		}
     }
 
-	private static IndexMetadataFactory loadMetadata(URL vdbURL)
+	public static IndexMetadataFactory loadMetadata(URL vdbURL)
 			throws IOException, MalformedURLException, URISyntaxException {
 		//vfs has a problem with vdbs embedded in jars in the classpath, so we'll create a temp version
 		if (vdbURL.getProtocol().equals("jar")) {

Added: trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java	                        (rev 0)
+++ trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -0,0 +1,187 @@
+/*
+ * 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.deployers;
+
+import java.util.Collection;
+import java.util.LinkedHashMap;
+
+import org.teiid.adminapi.DataPolicy;
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.impl.DataPolicyMetadata;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.connector.metadata.runtime.MetadataStore;
+import org.teiid.metadata.CompositeMetadataStore;
+import org.teiid.metadata.TransformationMetadata;
+import org.teiid.metadata.TransformationMetadata.Resource;
+
+import com.metamatrix.query.function.metadata.FunctionMethod;
+import com.metamatrix.query.metadata.QueryMetadataInterface;
+import com.metamatrix.vdb.runtime.VDBKey;
+
+
+public class CompositeVDB {
+	private VDBMetaData vdb;
+	private MetadataStoreGroup stores;
+	private LinkedHashMap<String, Resource> visibilityMap;
+	private UDFMetaData udf;
+	private LinkedHashMap<VDBKey, CompositeVDB> children;
+	private MetadataStore systemStore;
+	
+	// used as cached item to avoid rebuilding
+	private VDBMetaData mergedVDB;
+	
+	public CompositeVDB(VDBMetaData vdb, MetadataStoreGroup stores, LinkedHashMap<String, Resource> visibilityMap, UDFMetaData udf, MetadataStore systemStore) {
+		this.vdb = vdb;
+		this.stores = stores;
+		this.visibilityMap = visibilityMap;
+		this.udf = udf;
+		this.systemStore = systemStore;
+		update(this.vdb);
+	}
+	
+	public void addChild(CompositeVDB child) {
+		if (this.children == null) {
+			this.children = new LinkedHashMap<VDBKey, CompositeVDB>();
+		}
+		VDBMetaData childVDB = child.getVDB();
+		this.children.put(new VDBKey(childVDB.getName(), childVDB.getVersion()), child);
+		this.mergedVDB = null;
+	}
+	
+	public void removeChild(VDBKey child) {
+		if (this.children != null) {
+			this.children.remove(child);
+		}
+		this.mergedVDB = null;
+	}	
+	
+	private void update(VDBMetaData vdbMetadata) {
+		TransformationMetadata metadata = buildTransformationMetaData(vdbMetadata, getVisibilityMap(), getMetadataStores(), getUDF());
+		vdbMetadata.addAttchment(QueryMetadataInterface.class, metadata);
+		vdbMetadata.addAttchment(TransformationMetadata.class, metadata);		
+	}
+	
+	private TransformationMetadata buildTransformationMetaData(VDBMetaData vdb, LinkedHashMap<String, Resource> visibilityMap, MetadataStoreGroup stores, UDFMetaData udf) {
+		Collection <FunctionMethod> methods = null;
+		if (udf != null) {
+			methods = udf.getFunctions();
+		}
+		
+		CompositeMetadataStore compositeStore = new CompositeMetadataStore(stores.getStores());
+		compositeStore.addMetadataStore(this.systemStore);
+		
+		TransformationMetadata metadata =  new TransformationMetadata(vdb, compositeStore, visibilityMap, methods);
+				
+		return metadata;
+	}	
+	
+	public VDBMetaData getVDB() {
+		if (this.children == null || this.children.isEmpty()) {
+			return vdb;
+		}
+		if (this.mergedVDB == null) {
+			this.mergedVDB = buildVDB();
+			update(mergedVDB);
+		}
+		return this.mergedVDB;
+	}
+	
+	
+	private VDBMetaData buildVDB() {
+		VDBMetaData mergedVDB = new VDBMetaData();
+		mergedVDB.setName(this.vdb.getName());
+		mergedVDB.setVersion(this.vdb.getVersion());
+		mergedVDB.setModels(this.vdb.getModels());
+		mergedVDB.setDataPolicies(this.vdb.getDataPolicies());
+		mergedVDB.setDescription(this.vdb.getDescription());
+		mergedVDB.setStatus(this.vdb.getStatus());
+		mergedVDB.setJAXBProperties(this.vdb.getJAXBProperties());
+		
+		for (CompositeVDB child:this.children.values()) {
+			
+			// add models
+			for (Model m:child.getVDB().getModels()) {
+				mergedVDB.addModel((ModelMetaData)m);
+			}
+			
+			for (DataPolicy p:child.getVDB().getDataPolicies()) {
+				mergedVDB.addDataPolicy((DataPolicyMetadata)p);
+			}
+		}
+		return mergedVDB;
+	}
+	
+	private UDFMetaData getUDF() {
+		if (this.children == null || this.children.isEmpty()) {
+			return this.udf;
+		}
+		
+		UDFMetaData mergedUDF = new UDFMetaData();
+		if (this.udf != null) {
+			mergedUDF.addFunctions(this.udf.getFunctions());
+		}
+		for (CompositeVDB child:this.children.values()) {
+			UDFMetaData funcs = child.getUDF();
+			if (funcs != null) {
+				mergedUDF.addFunctions(funcs.getFunctions());
+			}
+		}		
+		return mergedUDF;
+	}
+	
+	private LinkedHashMap<String, Resource> getVisibilityMap() {
+		if (this.children == null || this.children.isEmpty()) {
+			return this.visibilityMap;
+		}
+		
+		LinkedHashMap<String, Resource> mergedvisibilityMap = new LinkedHashMap<String, Resource>();
+		if (this.visibilityMap != null) {
+			mergedvisibilityMap.putAll(this.visibilityMap);
+		}
+		for (CompositeVDB child:this.children.values()) {
+			LinkedHashMap<String, Resource> vm = child.getVisibilityMap();
+			if ( vm != null) {
+				mergedvisibilityMap.putAll(vm);
+			}
+		}		
+		return mergedvisibilityMap;
+	}
+	
+	private MetadataStoreGroup getMetadataStores() {
+		if (this.children == null || this.children.isEmpty()) {
+			return this.stores;
+		}		
+		
+		MetadataStoreGroup mergedStores = new MetadataStoreGroup();
+		if (this.stores != null) {
+			mergedStores.addStores(this.stores.getStores());
+		}
+		for (CompositeVDB child:this.children.values()) {
+			MetadataStoreGroup stores = child.getMetadataStores();
+			if ( stores != null) {
+				mergedStores.addStores(stores.getStores());
+			}
+		}		
+		return mergedStores;
+	}
+}


Property changes on: trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/runtime/src/main/java/org/teiid/deployers/MetadataStoreGroup.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/MetadataStoreGroup.java	                        (rev 0)
+++ trunk/runtime/src/main/java/org/teiid/deployers/MetadataStoreGroup.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -0,0 +1,46 @@
+/*
+ * 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.deployers;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.teiid.connector.metadata.runtime.MetadataStore;
+
+public class MetadataStoreGroup implements Serializable{
+	private static final long serialVersionUID = -3702321839716725121L;
+	
+	List<MetadataStore> stores = new ArrayList<MetadataStore>();
+	
+	public void addStores(List<MetadataStore> stores) {
+		this.stores.addAll(stores);
+	}
+	
+	public void addStore(MetadataStore store) {
+		this.stores.add(store);
+	}
+	
+	public List<MetadataStore> getStores(){
+		return this.stores;
+	}
+}


Property changes on: trunk/runtime/src/main/java/org/teiid/deployers/MetadataStoreGroup.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/runtime/src/main/java/org/teiid/deployers/SystemVDBDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/SystemVDBDeployer.java	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/runtime/src/main/java/org/teiid/deployers/SystemVDBDeployer.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -25,8 +25,6 @@
 import java.net.URISyntaxException;
 import java.net.URL;
 
-import org.teiid.adminapi.impl.ModelMetaData;
-import org.teiid.adminapi.impl.VDBMetaData;
 import org.teiid.metadata.index.IndexMetadataFactory;
 import org.teiid.metadata.index.RuntimeMetadataPlugin;
 import org.teiid.runtime.RuntimePlugin;
@@ -39,21 +37,12 @@
 	
 
 	public void start() {
-		ModelMetaData model = new ModelMetaData();
-		model.setName(CoreConstants.SYSTEM_MODEL);
-		model.setVisible(true);
-		
-		VDBMetaData deployment = new VDBMetaData();
-		deployment.setName(CoreConstants.SYSTEM_VDB);
-		
-		deployment.addModel(model);		
-
 		try {
 			URL url = Thread.currentThread().getContextClassLoader().getResource(CoreConstants.SYSTEM_VDB);
 			if (url == null) {
 				throw new MetaMatrixRuntimeException(RuntimeMetadataPlugin.Util.getString("system_vdb_not_found")); //$NON-NLS-1$
 			}
-			this.vdbRepository.addMetadataStore(deployment, new IndexMetadataFactory(url).getMetadataStore());
+			this.vdbRepository.setSystemStore(new IndexMetadataFactory(url).getMetadataStore());
 		} catch (URISyntaxException e) {
 			throw new MetaMatrixRuntimeException(e, RuntimePlugin.Util.getString("failed_to_deployed", CoreConstants.SYSTEM_VDB)); //$NON-NLS-1$
 		} catch (IOException e) {
@@ -61,10 +50,6 @@
 		}
 	}
 
-	public void stop() {
-		this.vdbRepository.removeVDB(CoreConstants.SYSTEM_VDB, 1);
-	}
-	
 	public void setVDBRepository(VDBRepository repo) {
 		this.vdbRepository = repo;
 	}	

Modified: trunk/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -57,4 +57,8 @@
 	public Collection <FunctionMethod> getFunctions(){
 		return this.methods;
 	}
+	
+	public void addFunctions(Collection <FunctionMethod> funcs){
+		this.methods.addAll(funcs);
+	}
 }

Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -23,8 +23,6 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
 import java.util.LinkedHashMap;
 import java.util.List;
 
@@ -45,8 +43,6 @@
 import org.teiid.dqp.internal.cache.DQPContextCache;
 import org.teiid.dqp.internal.datamgr.impl.ConnectorManager;
 import org.teiid.dqp.internal.datamgr.impl.ConnectorManagerRepository;
-import org.teiid.metadata.CompositeMetadataStore;
-import org.teiid.metadata.TransformationMetadata;
 import org.teiid.metadata.TransformationMetadata.Resource;
 import org.teiid.metadata.index.IndexMetadataFactory;
 import org.teiid.runtime.RuntimePlugin;
@@ -55,8 +51,6 @@
 import com.metamatrix.common.log.LogManager;
 import com.metamatrix.core.CoreConstants;
 import com.metamatrix.core.util.FileUtils;
-import com.metamatrix.query.function.metadata.FunctionMethod;
-import com.metamatrix.query.metadata.QueryMetadataInterface;
 
 public class VDBDeployer extends AbstractSimpleRealDeployer<VDBMetaData> {
 	private VDBRepository vdbRepository;
@@ -77,25 +71,28 @@
 			LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("redeploying_vdb", deployment)); //$NON-NLS-1$ 
 		}
 		
-		List<String> errors = deployment.getValidityErrors();
-		if (errors != null && !errors.isEmpty()) {
-			throw new DeploymentException(RuntimePlugin.Util.getString("validity_errors_in_vdb", deployment)); //$NON-NLS-1$
+		boolean preview = deployment.isPreview();
+		
+		if (!preview) {
+			List<String> errors = deployment.getValidityErrors();
+			if (errors != null && !errors.isEmpty()) {
+				throw new DeploymentException(RuntimePlugin.Util.getString("validity_errors_in_vdb", deployment)); //$NON-NLS-1$
+			}
 		}
 		
 		// get the metadata store of the VDB (this is build in parse stage)
-		CompositeMetadataStore store = unit.getAttachment(CompositeMetadataStore.class);
+		MetadataStoreGroup store = unit.getAttachment(MetadataStoreGroup.class);
 		
 		// if store is null and vdb dynamic vdb then try to get the metadata
 		if (store == null && deployment.isDynamic()) {
-			ArrayList<MetadataStore> stores = new ArrayList<MetadataStore>();
+			MetadataStoreGroup dynamicStore = new MetadataStoreGroup();
 			for (Model model:deployment.getModels()) {
 				if (model.getName().equals(CoreConstants.SYSTEM_MODEL)){
 					continue;
 				}
-				stores.add(buildDynamicMetadataStore((VFSDeploymentUnit)unit, deployment, (ModelMetaData)model));
+				dynamicStore.addStore(buildDynamicMetadataStore((VFSDeploymentUnit)unit, deployment, (ModelMetaData)model));
 			}
-			store = new CompositeMetadataStore(stores);
-			unit.addAttachment(CompositeMetadataStore.class, store);			
+			store = dynamicStore;		
 		}
 		
 		if (store == null) {
@@ -103,42 +100,40 @@
 		}
 		
 		// check if this is a VDB with index files, if there are then build the TransformationMetadata
-		TransformationMetadata metadata = null;
-		IndexMetadataFactory indexFactory = unit.getAttachment(IndexMetadataFactory.class);
 		UDFMetaData udf = unit.getAttachment(UDFMetaData.class);
+		
+		LinkedHashMap<String, Resource> visibilityMap = null;
+		IndexMetadataFactory indexFactory = unit.getAttachment(IndexMetadataFactory.class);		
 		if (indexFactory != null) {
-			LinkedHashMap<String, Resource> visibilityMap = indexFactory.getEntriesPlusVisibilities();
-			metadata = buildTransformationMetaData(deployment, visibilityMap, store, udf);
+			visibilityMap = indexFactory.getEntriesPlusVisibilities();
 		}
-		else {
-			// this dynamic VDB
-			metadata = buildTransformationMetaData(deployment, null, store, udf);
-		}
 				
 		// add the metadata objects as attachments
 		deployment.removeAttachment(IndexMetadataFactory.class);
 		deployment.removeAttachment(UDFMetaData.class);
-		deployment.addAttchment(QueryMetadataInterface.class, metadata);
-		deployment.addAttchment(TransformationMetadata.class, metadata);
 		
 		// add transformation metadata to the repository.
-		this.vdbRepository.addMetadata(deployment, metadata);
-		this.vdbRepository.addMetadataStore(deployment, store);
-		this.vdbRepository.addVDB(deployment);
+		this.vdbRepository.addVDB(deployment, store, visibilityMap, udf);
 		
 		try {
-			saveMetadataStore((VFSDeploymentUnit)unit, deployment, metadata.getMetadataStore());
+			saveMetadataStore((VFSDeploymentUnit)unit, deployment, store);
 		} catch (IOException e1) {
 			LogManager.logWarning(LogConstants.CTX_RUNTIME, e1, RuntimePlugin.Util.getString("vdb_save_failed", deployment.getName()+"."+deployment.getVersion())); //$NON-NLS-1$ //$NON-NLS-2$			
 		}
 				
-		boolean valid = validateSources(deployment);
-		
-		// Check if the VDB is fully configured.
-		if (valid) {
+		boolean valid = true;
+		if (!preview) {
+			valid = validateSources(deployment);
+			
+			// Check if the VDB is fully configured.
+			if (valid) {
+				deployment.setStatus(VDB.Status.ACTIVE);
+			} else {
+				deployment.setStatus(VDB.Status.INACTIVE);
+			}			
+		}
+		else {
 			deployment.setStatus(VDB.Status.ACTIVE);
-		} else {
-			deployment.setStatus(VDB.Status.INACTIVE);
 		}
 		LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_deployed",deployment, valid?"active":"inactive")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 	}
@@ -166,28 +161,6 @@
 		return valid;
 	}
 
-
-	// does this need to be synchronized? 
-	private TransformationMetadata buildTransformationMetaData(VDBMetaData vdb, LinkedHashMap<String, Resource> visibilityMap, CompositeMetadataStore store, UDFMetaData udf) throws DeploymentException {
-		
-		// get the system VDB metadata store
-		MetadataStore systemStore = this.vdbRepository.getMetadataStore(CoreConstants.SYSTEM_VDB, 1);
-		if (systemStore == null) {
-			throw new DeploymentException(RuntimePlugin.Util.getString("system_vdb_load_error")); //$NON-NLS-1$
-		}
-		
-		store.addMetadataStore(systemStore);
-		
-		Collection <FunctionMethod> methods = null;
-		if (udf != null) {
-			methods = udf.getFunctions();
-		}
-		
-		TransformationMetadata metadata =  new TransformationMetadata(vdb, store, visibilityMap, methods);
-				
-		return metadata;
-	}	
-	
 	public void setVDBRepository(VDBRepository repo) {
 		this.vdbRepository = repo;
 	}
@@ -226,7 +199,7 @@
 		this.connectorManagerRepository = repo;
 	}  
 	
-	private void saveMetadataStore(VFSDeploymentUnit unit, VDBMetaData vdb, CompositeMetadataStore store) throws IOException {
+	private void saveMetadataStore(VFSDeploymentUnit unit, VDBMetaData vdb, MetadataStoreGroup store) throws IOException {
 		File cacheFileName = this.serializer.getAttachmentPath(unit, vdb.getName()+"_"+vdb.getVersion()); //$NON-NLS-1$
 		if (!cacheFileName.exists()) {
 			this.serializer.saveAttachment(cacheFileName,store);

Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -44,7 +44,6 @@
 import org.teiid.adminapi.Model;
 import org.teiid.adminapi.impl.ModelMetaData;
 import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.metadata.CompositeMetadataStore;
 import org.teiid.metadata.index.IndexConstants;
 import org.teiid.metadata.index.IndexMetadataFactory;
 import org.teiid.runtime.RuntimePlugin;
@@ -141,15 +140,16 @@
 				unit.addAttachment(IndexMetadataFactory.class, imf);
 								
 				// add the cached store.
-				CompositeMetadataStore store = null;
+				MetadataStoreGroup stores = null;
 				File cacheFileName = this.serializer.getAttachmentPath(unit, vdb.getName()+"_"+vdb.getVersion()); //$NON-NLS-1$
 				if (cacheFileName.exists()) {
-					store = this.serializer.loadAttachment(cacheFileName, CompositeMetadataStore.class);
+					stores = this.serializer.loadAttachment(cacheFileName, MetadataStoreGroup.class);
 				}
 				else {
-					store = new CompositeMetadataStore(imf.getMetadataStore());
+					stores = new MetadataStoreGroup();
+					stores.addStore(imf.getMetadataStore());
 				}
-				unit.addAttachment(CompositeMetadataStore.class, store);				
+				unit.addAttachment(MetadataStoreGroup.class, stores);				
 			}
 		}
 		

Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -24,22 +24,23 @@
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.jboss.deployers.spi.DeploymentException;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminProcessingException;
 import org.teiid.adminapi.VDB;
 import org.teiid.adminapi.impl.VDBMetaData;
 import org.teiid.connector.metadata.runtime.Datatype;
 import org.teiid.connector.metadata.runtime.MetadataStore;
-import org.teiid.metadata.TransformationMetadata;
+import org.teiid.metadata.TransformationMetadata.Resource;
 import org.teiid.runtime.RuntimePlugin;
 
 import com.metamatrix.common.types.DataTypeManager;
-import com.metamatrix.core.CoreConstants;
 import com.metamatrix.vdb.runtime.VDBKey;
 
 /**
@@ -48,24 +49,36 @@
 public class VDBRepository implements Serializable{
 	private static final long serialVersionUID = 312177538191772674L;
 	
-	private Map<VDBKey, VDBMetaData> vdbRepo = new ConcurrentHashMap<VDBKey, VDBMetaData>();
-	private Map<VDBKey, MetadataStore> metadataStoreRepo = new ConcurrentHashMap<VDBKey, MetadataStore>();
-	private Map<VDBKey, TransformationMetadata> vdbToQueryMetadata = Collections.synchronizedMap(new HashMap<VDBKey, TransformationMetadata>());
+	private Map<VDBKey, CompositeVDB> vdbRepo = new ConcurrentHashMap<VDBKey, CompositeVDB>();
+	private MetadataStore systemStore;
 	
-	
-	public void addVDB(VDBMetaData vdb) throws DeploymentException {
+	public void addVDB(VDBMetaData vdb, MetadataStoreGroup stores, LinkedHashMap<String, Resource> visibilityMap, UDFMetaData udf) throws DeploymentException {
 		if (getVDB(vdb.getName(), vdb.getVersion()) != null) {
 			throw new DeploymentException(RuntimePlugin.Util.getString("duplicate_vdb", vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
 		}
-		this.vdbRepo.put(vdbId(vdb), vdb);
+		
+		// get the system VDB metadata store
+		if (this.systemStore == null) {
+			throw new DeploymentException(RuntimePlugin.Util.getString("system_vdb_load_error")); //$NON-NLS-1$
+		}		
+		
+		this.vdbRepo.put(vdbId(vdb), new CompositeVDB(vdb, stores, visibilityMap, udf, this.systemStore));
 	}
 	
 	public VDBMetaData getVDB(String name, int version) {
-		return this.vdbRepo.get(new VDBKey(name, version));
+		CompositeVDB v = this.vdbRepo.get(new VDBKey(name, version));
+		if (v != null) {
+			return v.getVDB();
+		}
+		return null;
 	}
 	
 	public List<VDBMetaData> getVDBs(){
-		return new ArrayList(this.vdbRepo.values());
+		ArrayList<VDBMetaData> vdbs = new ArrayList<VDBMetaData>();
+		for(CompositeVDB cVDB:this.vdbRepo.values()) {
+			vdbs.add(cVDB.getVDB());
+		}
+		return vdbs;
 	}
 
     protected VDBKey vdbId(VDBMetaData vdb) {
@@ -76,7 +89,7 @@
     	int latestVersion = 0;
         for (VDBKey key:this.vdbRepo.keySet()) {
             if(key.getName().equalsIgnoreCase(vdbName)) {
-            	VDBMetaData vdb = this.vdbRepo.get(key);
+            	VDBMetaData vdb = this.vdbRepo.get(key).getVDB();
                 if (vdb.getStatus() == VDB.Status.ACTIVE_DEFAULT) {
                 	latestVersion = vdb.getVersion();
                 	break;
@@ -96,32 +109,22 @@
         throw new VirtualDatabaseException(RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._2", vdbName, latestVersion)); //$NON-NLS-1$
 	}
 	
-
-	public TransformationMetadata getMetadata(String vdbName, int vdbVersion) {
-		return this.vdbToQueryMetadata.get(new VDBKey(vdbName, vdbVersion));
+	public void setSystemStore(MetadataStore store) {
+		this.systemStore = store;
 	}
 	
-	public void addMetadata(VDBMetaData vdb, TransformationMetadata metadata) {
-		this.vdbToQueryMetadata.put(vdbId(vdb), metadata);
-	}
-
-	public void addMetadataStore(VDBMetaData vdb, MetadataStore store) {
-		this.metadataStoreRepo.put(vdbId(vdb), store);
-	}	
-	
-	public MetadataStore getMetadataStore(String vdbName, int vdbVersion) {
-		return this.metadataStoreRepo.get(new VDBKey(vdbName, vdbVersion));
-	}
-	
 	public synchronized void removeVDB(String vdbName, int vdbVersion) {
 		VDBKey key = new VDBKey(vdbName, vdbVersion);
 		this.vdbRepo.remove(key);
-		this.metadataStoreRepo.remove(key);
-		this.vdbToQueryMetadata.remove(key);
+		
+		// if this VDB was part of another VDB; then remove them.
+		for (CompositeVDB other:this.vdbRepo.values()) {
+			other.removeChild(key);
+		}
 	}	
 	
 	public Map<String, Datatype> getBuiltinDatatypes() {
-		Collection<Datatype> datatypes = getMetadataStore(CoreConstants.SYSTEM_VDB, 1).getDatatypes();
+		Collection<Datatype> datatypes = this.systemStore.getDatatypes();
 		Map<String, Datatype> datatypeMap = new HashMap<String, Datatype>();
 		for (Class<?> typeClass : DataTypeManager.getAllDataTypeClasses()) {
 			for (Datatype datatypeRecordImpl : datatypes) {
@@ -133,4 +136,19 @@
 		}
 		return datatypeMap;
 	}
+	
+	public void mergeVDBs(String sourceVDBName, int sourceVDBVersion, String targetVDBName, int targetVDBVersion) throws AdminException{
+		CompositeVDB source = this.vdbRepo.get(new VDBKey(sourceVDBName, sourceVDBVersion));
+		if (source == null) {
+			throw new AdminProcessingException(RuntimePlugin.Util.getString("vdb_not_found", sourceVDBName, sourceVDBVersion));
+		}
+		
+		CompositeVDB target = this.vdbRepo.get(new VDBKey(targetVDBName, targetVDBVersion));
+		if (target == null) {
+			throw new AdminProcessingException(RuntimePlugin.Util.getString("vdb_not_found", sourceVDBName, sourceVDBVersion));
+		}		
+		
+		// merge them
+		target.addChild(source);
+	}
 }

Modified: trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
===================================================================
--- trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties	2010-04-09 19:44:15 UTC (rev 2044)
@@ -293,4 +293,5 @@
 system_vdb_not_found=System.vdb not found in classpath
 failed_to_deployed=Failed to deploy {0}
 invalid_udf_file=No "path" information found to load the FUNCTION model {0}; FUNCTION model must have path information.
-failed_matadata_load=Failed to load metadata for VDB {0}.{1}
\ No newline at end of file
+failed_matadata_load=Failed to load metadata for VDB {0}.{1}
+vdb_not_found=VDB {0}.{1} not found deployed.
\ No newline at end of file

Added: trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java	                        (rev 0)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -0,0 +1,147 @@
+/*
+ * 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 java.io.File;
+import java.util.Properties;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.mockito.Mockito;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.VDB;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.client.DQP;
+import org.teiid.client.security.ILogon;
+import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.metadata.runtime.MetadataStore;
+import org.teiid.connector.metadata.runtime.Schema;
+import org.teiid.deployers.MetadataStoreGroup;
+import org.teiid.deployers.VDBRepository;
+import org.teiid.dqp.internal.datamgr.impl.ConnectorManager;
+import org.teiid.dqp.internal.datamgr.impl.ConnectorManagerRepository;
+import org.teiid.dqp.internal.datamgr.impl.FakeTransactionService;
+import org.teiid.dqp.internal.process.DQPConfiguration;
+import org.teiid.dqp.internal.process.DQPCore;
+import org.teiid.metadata.index.IndexMetadataFactory;
+import org.teiid.metadata.index.VDBMetadataFactory;
+import org.teiid.services.SessionServiceImpl;
+import org.teiid.transport.ClientServiceRegistry;
+import org.teiid.transport.ClientServiceRegistryImpl;
+import org.teiid.transport.LocalServerConnection;
+import org.teiid.transport.LogonImpl;
+
+import com.metamatrix.common.queue.FakeWorkManager;
+import com.metamatrix.dqp.service.FakeBufferService;
+import com.metamatrix.query.optimizer.capabilities.BasicSourceCapabilities;
+import com.metamatrix.query.optimizer.capabilities.SourceCapabilities;
+
+public class FakeServer extends ClientServiceRegistryImpl {
+
+	SessionServiceImpl sessionService = new SessionServiceImpl();
+	LogonImpl logon;
+	DQPCore dqp = new DQPCore();
+	VDBRepository repo = new VDBRepository();
+	MetadataStore systemStore;
+	
+	public FakeServer() {
+		this.logon = new LogonImpl(sessionService, null);
+
+		systemStore = VDBMetadataFactory.getSystemVDBMetadataStore();
+		this.repo.setSystemStore(systemStore);
+		
+        this.sessionService.setVDBRepository(repo);
+        this.dqp.setWorkManager(new FakeWorkManager());
+        this.dqp.setBufferService(new FakeBufferService());
+        this.dqp.setTransactionService(new FakeTransactionService());
+        
+        ConnectorManagerRepository cmr = Mockito.mock(ConnectorManagerRepository.class);
+        Mockito.stub(cmr.getConnectorManager("jndi:source")).toReturn(new ConnectorManager("x") {
+        	@Override
+        	public SourceCapabilities getCapabilities()
+        			throws ConnectorException {
+        		return new BasicSourceCapabilities();
+        	}
+        });
+        
+        this.dqp.setConnectorManagerRepository(cmr);
+        this.dqp.start(new DQPConfiguration());
+        this.sessionService.setDqp(this.dqp);
+        
+        registerClientService(ILogon.class, logon, null);
+        registerClientService(DQP.class, dqp, null);
+	}
+	
+	public void deployVDB(String vdbName, String vdbPath) throws Exception {
+		
+		IndexMetadataFactory imf = VDBMetadataFactory.loadMetadata(new File(vdbPath).toURI().toURL());
+		MetadataStore metadata = imf.getMetadataStore();
+		
+        VDBMetaData vdbMetaData = new VDBMetaData();
+        vdbMetaData.setName(vdbName);
+        vdbMetaData.setStatus(VDB.Status.ACTIVE);
+        
+        for (Schema schema : systemStore.getSchemas().values()) {
+        	ModelMetaData model = new ModelMetaData();
+            model.setName(schema.getName());
+            vdbMetaData.addModel(model);
+            model.addSourceMapping("source", "jndi:source"); 
+        }
+        
+        for (Schema schema : metadata.getSchemas().values()) {
+        	ModelMetaData model = new ModelMetaData();
+            model.setName(schema.getName());
+            vdbMetaData.addModel(model);
+            model.addSourceMapping("source", "jndi:source"); 
+        }
+                        
+        try {
+        	MetadataStoreGroup stores = new MetadataStoreGroup();
+        	stores.addStore(metadata);
+			this.repo.addVDB(vdbMetaData, stores, imf.getEntriesPlusVisibilities(), null);
+		} catch (DeploymentException e) {
+			throw new RuntimeException(e);
+		}		
+	}
+	
+	public void undeployVDB(String vdbName) {
+		this.repo.removeVDB(vdbName, 1);
+	}
+	
+	public void mergeVDBS(String sourceVDB, String targetVDB) throws AdminException {
+		this.repo.mergeVDBs(sourceVDB, 1, targetVDB, 1);
+	}
+	
+	public ConnectionImpl createConnection(String embeddedURL) throws Exception {
+		final Properties p = new Properties();
+		EmbeddedProfile.parseURL(embeddedURL, p);
+
+		return new ConnectionImpl(new LocalServerConnection(p) {
+			@Override
+			protected ClientServiceRegistry getClientServiceRegistry() {
+				return FakeServer.this;
+			}
+		}, p, embeddedURL);
+	}
+	
+	
+}


Property changes on: trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestCase3473.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestCase3473.java	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestCase3473.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -40,7 +40,9 @@
     ////////////////////Query Related Methods///////////////////////////
 
     @Before public void setUp() throws Exception {
-    	Connection conn = TestMMDatabaseMetaData.createConnection("jdbc:teiid:test", UnitTestUtil.getTestDataPath() + "/TestCase3473/test.vdb"); //$NON-NLS-1$ //$NON-NLS-2$
+    	FakeServer server = new FakeServer();
+    	server.deployVDB("test", UnitTestUtil.getTestDataPath() + "/TestCase3473/test.vdb");
+    	Connection conn = server.createConnection("jdbc:teiid:test"); //$NON-NLS-1$ //$NON-NLS-2$
     	dbmd = conn.getMetaData();
     }
     

Modified: trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestMMDatabaseMetaData.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestMMDatabaseMetaData.java	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestMMDatabaseMetaData.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -22,7 +22,8 @@
 
 package org.teiid.jdbc;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -55,7 +56,9 @@
 import org.teiid.client.DQP;
 import org.teiid.client.security.ILogon;
 import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.metadata.runtime.MetadataStore;
 import org.teiid.connector.metadata.runtime.Schema;
+import org.teiid.deployers.MetadataStoreGroup;
 import org.teiid.deployers.VDBRepository;
 import org.teiid.dqp.internal.datamgr.impl.ConnectorManager;
 import org.teiid.dqp.internal.datamgr.impl.ConnectorManagerRepository;
@@ -63,7 +66,6 @@
 import org.teiid.dqp.internal.process.DQPConfiguration;
 import org.teiid.dqp.internal.process.DQPCore;
 import org.teiid.jdbc.util.ResultSetUtil;
-import org.teiid.metadata.TransformationMetadata;
 import org.teiid.metadata.index.VDBMetadataFactory;
 import org.teiid.net.TeiidURL;
 import org.teiid.services.SessionServiceImpl;
@@ -77,7 +79,6 @@
 import com.metamatrix.core.CoreConstants;
 import com.metamatrix.core.util.UnitTestUtil;
 import com.metamatrix.dqp.service.FakeBufferService;
-import com.metamatrix.query.metadata.QueryMetadataInterface;
 import com.metamatrix.query.optimizer.capabilities.BasicSourceCapabilities;
 import com.metamatrix.query.optimizer.capabilities.SourceCapabilities;
 
@@ -86,56 +87,7 @@
 @SuppressWarnings("nls")
 public class TestMMDatabaseMetaData {
 	
-    public static ConnectionImpl createConnection(String embeddedURL, final String vdbPath) throws Exception {
-    	final Properties p = new Properties();
-    	EmbeddedProfile.parseURL(embeddedURL, p);
-        return new ConnectionImpl(new LocalServerConnection(p) {
-			@Override
-        	protected ClientServiceRegistry getClientServiceRegistry() {
-        		ClientServiceRegistryImpl impl = new ClientServiceRegistryImpl();
-        		SessionServiceImpl sessionService = new SessionServiceImpl();
-        		LogonImpl logon = new LogonImpl(sessionService, null);
-        		impl.registerClientService(ILogon.class, logon, null);
-        		DQPCore dqp = new DQPCore();
-        		sessionService.setDqp(dqp);
-                TransformationMetadata metadata = VDBMetadataFactory.getVDBMetadata(vdbPath);
-                VDBRepository repo = new VDBRepository();
-                VDBMetaData vdbMetaData = new VDBMetaData();
-                vdbMetaData.setName(p.getProperty(TeiidURL.JDBC.VDB_NAME));
-                vdbMetaData.addAttchment(QueryMetadataInterface.class, metadata);
-                vdbMetaData.addAttchment(TransformationMetadata.class, metadata);
-                vdbMetaData.setStatus(VDB.Status.ACTIVE);
-                repo.addMetadata(vdbMetaData, metadata);
-                for (Schema schema : metadata.getMetadataStore().getSchemas().values()) {
-                	ModelMetaData model = new ModelMetaData();
-                    model.setName(schema.getName());
-                    vdbMetaData.addModel(model);
-                    model.addSourceMapping("source", "jndi:source"); 
-                }
-                ConnectorManagerRepository cmr = Mockito.mock(ConnectorManagerRepository.class);
-                Mockito.stub(cmr.getConnectorManager("jndi:source")).toReturn(new ConnectorManager("x") {
-                	@Override
-                	public SourceCapabilities getCapabilities()
-                			throws ConnectorException {
-                		return new BasicSourceCapabilities();
-                	}
-                });
-                try {
-					repo.addVDB(vdbMetaData);
-				} catch (DeploymentException e) {
-					throw new RuntimeException(e);
-				}
-                sessionService.setVDBRepository(repo);
-                dqp.setWorkManager(new FakeWorkManager());
-                dqp.setBufferService(new FakeBufferService());
-                dqp.setTransactionService(new FakeTransactionService());
-                dqp.setConnectorManagerRepository(cmr);
-                dqp.start(new DQPConfiguration());
-        		impl.registerClientService(DQP.class, dqp, null);
-        		return impl;
-        	}
-        }, p, embeddedURL);
-    }
+ 
     
     private static final boolean REPLACE_EXPECTED = false;
     private static final boolean WRITE_ACTUAL_RESULTS_TO_FILE = false;
@@ -226,7 +178,9 @@
     
     @BeforeClass
     public static void oneTimeSetUp() throws Exception {
-        conn = createConnection("jdbc:teiid:QT_Ora9DS", UnitTestUtil.getTestDataPath()+"/QT_Ora9DS_1.vdb"); //$NON-NLS-1$ //$NON-NLS-2$
+    	FakeServer server = new FakeServer();
+    	server.deployVDB("QT_Ora9DS", UnitTestUtil.getTestDataPath()+"/QT_Ora9DS_1.vdb");
+        conn = server.createConnection("jdbc:teiid:QT_Ora9DS"); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
     /** Test all the non-query methods */

Modified: trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestQueryPlans.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestQueryPlans.java	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestQueryPlans.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -39,7 +39,9 @@
 	private Connection conn;
 	
 	@Before public void setUp() throws Exception {
-    	conn = TestMMDatabaseMetaData.createConnection("jdbc:teiid:test", UnitTestUtil.getTestDataPath() + "/TestCase3473/test.vdb"); //$NON-NLS-1$ //$NON-NLS-2$
+    	FakeServer server = new FakeServer();
+    	server.deployVDB("test", UnitTestUtil.getTestDataPath() + "/TestCase3473/test.vdb");
+    	conn = server.createConnection("jdbc:teiid:test"); //$NON-NLS-1$ //$NON-NLS-2$		
     }
 	
 	@Test public void testNoExec() throws Exception {

Added: trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestVDBMerge.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestVDBMerge.java	                        (rev 0)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestVDBMerge.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -0,0 +1,73 @@
+package org.teiid.jdbc;
+
+import org.junit.Test;
+
+import com.metamatrix.core.util.UnitTestUtil;
+
+ at SuppressWarnings("nls")
+public class TestVDBMerge extends AbstractMMQueryTestCase {
+	
+	private static final String VDB1 = "PartsSupplier"; //$NON-NLS-1$
+	private static final String VDB2 = "QT_Ora9DS"; //$NON-NLS-1$
+	FakeServer server = new FakeServer();
+	
+	@Test
+    public void testMerge() throws Throwable {
+		
+		server.deployVDB(VDB1, UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
+    	this.internalConnection = server.createConnection("jdbc:teiid:"+VDB1);
+    	
+    	String[] expected = {
+    			"VDBName[string]    SchemaName[string]    Name[string]    Type[string]    NameInSource[string]    IsPhysical[boolean]    SupportsUpdates[boolean]    UID[string]    Cardinality[integer]    Description[string]    IsSystem[boolean]    IsMaterialized[boolean]",
+    			"PartsSupplier    PartsSupplier    PARTSSUPPLIER.PARTS    Table    PARTS    true    true    mmuuid:f6276601-73fe-1edc-a81c-ecf397b10590    16    null    false    false",
+    			"PartsSupplier    PartsSupplier    PARTSSUPPLIER.SHIP_VIA    Table    SHIP_VIA    true    true    mmuuid:0f4e9b80-73ff-1edc-a81c-ecf397b10590    4    null    false    false",
+    			"PartsSupplier    PartsSupplier    PARTSSUPPLIER.STATUS    Table    STATUS    true    true    mmuuid:1f297200-73ff-1edc-a81c-ecf397b10590    3    null    false    false",
+    			"PartsSupplier    PartsSupplier    PARTSSUPPLIER.SUPPLIER_PARTS    Table    SUPPLIER_PARTS    true    true    mmuuid:3deafb00-73ff-1edc-a81c-ecf397b10590    227    null    false    false",
+    			"PartsSupplier    PartsSupplier    PARTSSUPPLIER.SUPPLIER    Table    SUPPLIER    true    true    mmuuid:2c371ec0-73ff-1edc-a81c-ecf397b10590    16    null    false    false"
+        	};
+       executeTest("select * from tables where schemaname ='PartsSupplier'", expected); //$NON-NLS-1$
+
+       String[] expectedBefore = {
+    		   "VDBName[string]    SchemaName[string]    Name[string]    Type[string]    NameInSource[string]    IsPhysical[boolean]    SupportsUpdates[boolean]    UID[string]    Cardinality[integer]    Description[string]    IsSystem[boolean]    IsMaterialized[boolean]",
+       };
+       String[] expectedAfter = {
+    		   "VDBName[string]    SchemaName[string]    Name[string]    Type[string]    NameInSource[string]    IsPhysical[boolean]    SupportsUpdates[boolean]    UID[string]    Cardinality[integer]    Description[string]    IsSystem[boolean]    IsMaterialized[boolean]",
+    		   "PartsSupplier    BQT1    HugeA    Table    null    true    false    mmuuid:7c66fc80-33d2-1dfa-9931-e83d04ce10a0    500000    null    false    false",
+    		   "PartsSupplier    BQT1    HugeB    Table    null    true    false    mmuuid:b0369400-33f8-1dfa-9931-e83d04ce10a0    500000    null    false    false",
+    		   "PartsSupplier    BQT1    LargeA    Table    null    true    false    mmuuid:3976a800-33b2-1dfa-9931-e83d04ce10a0    10000    null    false    false",
+    		   "PartsSupplier    BQT1    LargeB    Table    null    true    false    mmuuid:5fb40600-33c3-1dfa-9931-e83d04ce10a0    10000    null    false    false",
+    		   "PartsSupplier    BQT1    MediumA    Table    null    true    false    mmuuid:61074980-338d-1dfa-9931-e83d04ce10a0    1000    null    false    false",
+    		   "PartsSupplier    BQT1    MediumB    Table    null    true    false    mmuuid:e24bd1c0-33a4-1dfa-9931-e83d04ce10a0    1000    null    false    false",
+    		   "PartsSupplier    BQT1    SmallA    Table    null    true    false    mmuuid:0968424f-e6a0-1df9-ac06-b890ff96f710    50    null    false    false",
+    		   "PartsSupplier    BQT1    SmallB    Table    null    true    false    mmuuid:06fb8980-3377-1dfa-9931-e83d04ce10a0    50    null    false    false"       
+       };
+
+       executeTest("select * from tables where schemaname='BQT1'", expectedBefore); //$NON-NLS-1$
+       
+       this.internalConnection.close();
+       
+       server.deployVDB(VDB2, UnitTestUtil.getTestDataPath()+"/QT_Ora9DS_1.vdb");
+       
+       server.mergeVDBS(VDB2, VDB1);
+       
+       this.internalConnection = server.createConnection("jdbc:teiid:"+VDB1);
+       executeTest("select * from tables where schemaname='BQT1'", expectedAfter); //$NON-NLS-1$
+       
+       server.undeployVDB(VDB2);
+       
+       // since the connection is not closed; need to behave as if still merged
+       executeTest("select * from tables where schemaname='BQT1'", expectedAfter); //$NON-NLS-1$
+       
+       // re-connect should behave as the original
+       this.internalConnection.close();
+       this.internalConnection = server.createConnection("jdbc:teiid:"+VDB1);
+       
+       executeTest("select * from tables where schemaname='BQT1'", expectedBefore); //$NON-NLS-1$
+       executeTest("select * from tables where schemaname ='PartsSupplier'", expected); //$NON-NLS-1$
+    }
+	
+    private void executeTest(String sql, String[] expected){
+    	execute(sql);
+    	assertResults(expected);
+    }	
+}


Property changes on: trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestVDBMerge.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestPartsDatabaseMetadata.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestPartsDatabaseMetadata.java	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestPartsDatabaseMetadata.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -29,6 +29,7 @@
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.teiid.jdbc.FakeServer;
 import org.teiid.jdbc.TestMMDatabaseMetaData;
 
 import com.metamatrix.core.util.UnitTestUtil;
@@ -45,7 +46,9 @@
     static final String VDB = "PartsSupplier";
     
 	@Before public void setUp() throws Exception {
-    	connection  = TestMMDatabaseMetaData.createConnection("jdbc:teiid:" + VDB, UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
+    	FakeServer server = new FakeServer();
+    	server.deployVDB(VDB, UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
+    	connection = server.createConnection("jdbc:teiid:" + VDB); //$NON-NLS-1$ //$NON-NLS-2$		
     	dbMetadata = connection.getMetaData();
     }
     

Modified: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestResultSetMetadata.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestResultSetMetadata.java	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestResultSetMetadata.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -28,7 +28,7 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.teiid.jdbc.AbstractMMQueryTestCase;
-import org.teiid.jdbc.TestMMDatabaseMetaData;
+import org.teiid.jdbc.FakeServer;
 
 import com.metamatrix.core.util.UnitTestUtil;
 
@@ -44,7 +44,9 @@
 	}
     
     @Before public void setUp() throws Exception {
-    	this.internalConnection = TestMMDatabaseMetaData.createConnection("jdbc:teiid:" + VDB, UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
+    	FakeServer server = new FakeServer();
+    	server.deployVDB(VDB, UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
+    	this.internalConnection = server.createConnection("jdbc:teiid:" + VDB); //$NON-NLS-1$ //$NON-NLS-2$	    	
     }
     
     @After public void tearDown() throws SQLException {

Modified: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -26,7 +26,7 @@
 import org.junit.Ignore;
 import org.junit.Test;
 import org.teiid.jdbc.AbstractMMQueryTestCase;
-import org.teiid.jdbc.TestMMDatabaseMetaData;
+import org.teiid.jdbc.FakeServer;
 
 import com.metamatrix.core.util.UnitTestUtil;
 
@@ -44,8 +44,10 @@
 	}
 	
     @Before public void setUp() throws Exception {
-    	this.internalConnection = TestMMDatabaseMetaData.createConnection("jdbc:teiid:" + VDB, UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
-    }
+    	FakeServer server = new FakeServer();
+    	server.deployVDB(VDB, UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
+    	this.internalConnection = server.createConnection("jdbc:teiid:" + VDB); //$NON-NLS-1$ //$NON-NLS-2$	
+   	}
 
     @Ignore("ODBC support to be readded")
 	@Test public void testDefect23534() {
@@ -68,7 +70,7 @@
     }
     
 	@Test public void testModels() throws Exception {
-		checkResult("testSchemas", "select* from SYS.Schemas"); //$NON-NLS-1$ //$NON-NLS-2$
+		checkResult("testSchemas", "select* from SYS.Schemas order by Name"); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
 	@Test public void testKeys() throws Exception {

Modified: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestVirtualDocWithVirtualProc.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestVirtualDocWithVirtualProc.java	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestVirtualDocWithVirtualProc.java	2010-04-09 19:44:15 UTC (rev 2044)
@@ -26,7 +26,7 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.teiid.jdbc.AbstractMMQueryTestCase;
-import org.teiid.jdbc.TestMMDatabaseMetaData;
+import org.teiid.jdbc.FakeServer;
 
 import com.metamatrix.core.util.UnitTestUtil;
 
@@ -46,7 +46,9 @@
     }
     
     @Before public void setUp() throws Exception {
-    	this.internalConnection = TestMMDatabaseMetaData.createConnection("jdbc:teiid:" + VDB, UnitTestUtil.getTestDataPath() + "/xml-vp/xmlvp_1.vdb");
+    	FakeServer server = new FakeServer();
+    	server.deployVDB(VDB, UnitTestUtil.getTestDataPath() + "/xml-vp/xmlvp_1.vdb");
+    	this.internalConnection = server.createConnection("jdbc:teiid:" + VDB); //$NON-NLS-1$ //$NON-NLS-2$	    	
     }
     
     @After public void tearDown() {

Modified: trunk/test-integration/common/src/test/resources/system/expected/Schemas.txt
===================================================================
--- trunk/test-integration/common/src/test/resources/system/expected/Schemas.txt	2010-04-09 19:29:27 UTC (rev 2043)
+++ trunk/test-integration/common/src/test/resources/system/expected/Schemas.txt	2010-04-09 19:44:15 UTC (rev 2044)
@@ -1,3 +1,3 @@
 VDBName[string]	Name[string]	IsPhysical[boolean]	UID[string]	Description[string]	PrimaryMetamodelURI[string]
+PartsSupplier	PartsSupplier	true	mmuuid:19c7f380-73d8-1edc-a81c-ecf397b10590	null	http://www.metamatrix.com/metamodels/Relational
 PartsSupplier	SYS	true	mmuuid:49b9c0f9-2c4c-42d3-9409-2d847d29a1de	System	http://www.metamatrix.com/metamodels/Relational
-PartsSupplier	PartsSupplier	true	mmuuid:19c7f380-73d8-1edc-a81c-ecf397b10590	null	http://www.metamatrix.com/metamodels/Relational



More information about the teiid-commits mailing list