[teiid-commits] teiid SVN: r1931 - in trunk: client/src/main/java/org/teiid/adminapi/impl and 6 other directories.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Fri Mar 5 17:48:26 EST 2010
Author: rareddy
Date: 2010-03-05 17:48:25 -0500 (Fri, 05 Mar 2010)
New Revision: 1931
Removed:
trunk/jboss-integration/src/main/java/com/metamatrix/
Modified:
trunk/client/src/main/java/org/teiid/adminapi/VDB.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/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
trunk/test-integration/db/pom.xml
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategyFactory.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/DataSourceConnection.java
trunk/test-integration/db/src/main/resources/default-config.properties
Log:
TEIID-833: fixing the compilation issues in the test-integration-db
Modified: trunk/client/src/main/java/org/teiid/adminapi/VDB.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/VDB.java 2010-03-05 21:43:09 UTC (rev 1930)
+++ trunk/client/src/main/java/org/teiid/adminapi/VDB.java 2010-03-05 22:48:25 UTC (rev 1931)
@@ -22,7 +22,6 @@
package org.teiid.adminapi;
-import java.util.Collection;
import java.util.List;
/**
@@ -30,7 +29,7 @@
* <br>A VDB has a name and a version.</br>
*
* <p>The identifier pattern for a VDB is <CODE>"name<{@link #DELIMITER_CHAR}>version"</CODE>,
- * where the name of the VDB and its version represent its unique identifier in the MetaMatrix system.
+ * where the name of the VDB and its version represent its unique identifier in the Teiid system.
* There are no spaces allowed in a given VDB name, and VDB name must start with a letter.
* A version number is automatically assigned to a VDB when it is deployed into
* a system. A VDB is uniquely identified by <CODE>"name<{@link #DELIMITER_CHAR}>version"</CODE>.
@@ -52,9 +51,9 @@
/**
- * @return Collection of MMModels
+ * @return Collection of Teiid Models
*/
- public Collection<? extends Model> getModels();
+ public List<Model> getModels();
/**
* @return the status
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2010-03-05 21:43:09 UTC (rev 1930)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2010-03-05 22:48:25 UTC (rev 1931)
@@ -147,9 +147,10 @@
this.fileUrl = url;
}
+ @Override
@ManagementProperty(description="Models in a VDB", managed=true)
- public List<ModelMetaData> getModels(){
- return new ArrayList<ModelMetaData>(this.models.getMap().values());
+ public List<Model> getModels(){
+ return new ArrayList<Model>(this.models.getMap().values());
}
public void addModel(ModelMetaData m) {
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-03-05 21:43:09 UTC (rev 1930)
+++ trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2010-03-05 22:48:25 UTC (rev 1931)
@@ -63,6 +63,7 @@
import org.teiid.adminapi.AdminProcessingException;
import org.teiid.adminapi.ConnectionPoolStatistics;
import org.teiid.adminapi.ConnectorBinding;
+import org.teiid.adminapi.Model;
import org.teiid.adminapi.PropertyDefinition;
import org.teiid.adminapi.Request;
import org.teiid.adminapi.Session;
@@ -89,7 +90,6 @@
private static final String XA_DATA_SOURCE_TEMPLATE = "XADataSourceTemplate";
private static final long serialVersionUID = 7081309086056911304L;
private static ComponentType VDBTYPE = new ComponentType("teiid", "vdb");
- private static ComponentType MODELTYPE = new ComponentType("teiid", "model");
private static ComponentType NOTXTYPE = new ComponentType("ConnectionFactory", "NoTx");
private static ComponentType TXTYPE = new ComponentType("ConnectionFactory", "Tx");
private static ComponentType DQPTYPE = new ComponentType("teiid", "dqp");
@@ -340,10 +340,10 @@
HashMap<String, ConnectorBinding> bindingMap = new HashMap<String, ConnectorBinding>();
VDBMetaData vdb = (VDBMetaData) getVDB(vdbName, vdbVersion);
if (vdb != null) {
- for (ModelMetaData model:vdb.getModels()) {
+ for (Model model:vdb.getModels()) {
if (model.isSource()) {
for (String sourceName : model.getSourceNames()) {
- ConnectorBinding binding = getConnectorBinding(model.getSourceJndiName(sourceName));
+ ConnectorBinding binding = getConnectorBinding(((ModelMetaData)model).getSourceJndiName(sourceName));
if (binding != null) {
bindingMap.put(sourceName, binding);
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2010-03-05 21:43:09 UTC (rev 1930)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2010-03-05 22:48:25 UTC (rev 1931)
@@ -41,6 +41,7 @@
import org.jboss.managed.api.ManagedObject;
import org.jboss.managed.api.factory.ManagedObjectFactory;
import org.jboss.virtual.VirtualFile;
+import org.teiid.adminapi.Model;
import org.teiid.adminapi.VDB;
import org.teiid.adminapi.impl.ModelMetaData;
import org.teiid.adminapi.impl.VDBMetaData;
@@ -94,11 +95,11 @@
// 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>();
- for (ModelMetaData model:deployment.getModels()) {
+ for (Model model:deployment.getModels()) {
if (model.getName().equals(CoreConstants.SYSTEM_MODEL)){
continue;
}
- stores.add(buildDynamicMetadataStore((VFSDeploymentUnit)unit, deployment, model));
+ stores.add(buildDynamicMetadataStore((VFSDeploymentUnit)unit, deployment, (ModelMetaData)model));
}
store = new CompositeMetadataStore(stores);
unit.addAttachment(CompositeMetadataStore.class, store);
@@ -143,7 +144,8 @@
private boolean validateSources(VDBMetaData deployment) {
boolean valid = true;
- for(ModelMetaData model:deployment.getModels()) {
+ for(Model m:deployment.getModels()) {
+ ModelMetaData model = (ModelMetaData)m;
for (String sourceName:model.getSourceNames()) {
String jndiName = model.getSourceJndiName(sourceName);
try {
@@ -191,7 +193,7 @@
ManagedObject vdbMO = managedObjects.get(VDBMetaData.class.getName());
if (vdbMO != null) {
VDBMetaData vdb = (VDBMetaData) vdbMO.getAttachment();
- for (ModelMetaData m : vdb.getModels()) {
+ for (Model m : vdb.getModels()) {
if (m.getName().equals(CoreConstants.SYSTEM_MODEL)) {
continue;
}
Modified: trunk/test-integration/db/pom.xml
===================================================================
--- trunk/test-integration/db/pom.xml 2010-03-05 21:43:09 UTC (rev 1930)
+++ trunk/test-integration/db/pom.xml 2010-03-05 22:48:25 UTC (rev 1931)
@@ -30,6 +30,11 @@
<version>4.4</version>
</dependency>
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ <version>1.1</version>
+ </dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java 2010-03-05 21:43:09 UTC (rev 1930)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java 2010-03-05 22:48:25 UTC (rev 1931)
@@ -9,14 +9,15 @@
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.sql.Connection;
-import java.util.Collection;
import java.util.Iterator;
+import java.util.List;
import java.util.Properties;
+import java.util.Set;
import javax.sql.XAConnection;
import org.teiid.adminapi.Admin;
-import org.teiid.adminapi.AdminOptions;
+import org.teiid.adminapi.AdminFactory;
import org.teiid.adminapi.Model;
import org.teiid.adminapi.VDB;
import org.teiid.test.framework.ConfigPropertyLoader;
@@ -109,58 +110,56 @@
- void configure() throws QueryTestFailedException {
-
- if (this.isDataStoreDisabled()) {
- return;
- }
+ void configure() throws QueryTestFailedException {
- try {
-
- // the the driver strategy is going to be used to connection directly to the connector binding
- // source, then no administration can be done
- Admin admin = null;
-
- java.sql.Connection conn = getConnection();
-
- if ( conn instanceof com.metamatrix.jdbc.MMConnection) {
- com.metamatrix.jdbc.MMConnection c = (com.metamatrix.jdbc.MMConnection) conn;
- admin = (Admin)c.getAdminAPI();
- } else if (conn instanceof com.metamatrix.jdbc.api.Connection) {
- com.metamatrix.jdbc.api.Connection c = (com.metamatrix.jdbc.api.Connection) conn;
- admin = (Admin)c.getAdminAPI();
- } else {
- TestLogger.log("ConnectionStrategy configuration: connection is not of type MMConnection and therefore no vdb setup will be performed");
- return;
- }
+ if (this.isDataStoreDisabled()) {
+ return;
+ }
- setupVDBConnectorBindings(admin);
-
- // admin.restart();
-
- int sleep = 5;
-
- TestLogger.log("Bouncing the system..(wait " + sleep + " seconds)"); //$NON-NLS-1$
- Thread.sleep(1000*sleep);
- TestLogger.log("done."); //$NON-NLS-1$
+ try {
+ // the the driver strategy is going to be used to connection
+ // directly to the connector binding
+ // source, then no administration can be done
+ Admin admin = AdminFactory.getInstance().createAdmin(this.env.getProperty("admin.user"), this.env.getProperty("admin.password").toCharArray(), this.env.getProperty("admin.url"));
- } catch (Throwable e) {
- e.printStackTrace();
+ java.sql.Connection conn = getConnection();
- throw new TransactionRuntimeException(e.getMessage());
- } finally {
- // need to close and flush the connection after restarting
- // this.shutdown();
-
- }
- }
+ if (conn instanceof com.metamatrix.jdbc.MMConnection) {
+ com.metamatrix.jdbc.MMConnection c = (com.metamatrix.jdbc.MMConnection) conn;
+ } else if (conn instanceof com.metamatrix.jdbc.api.Connection) {
+ com.metamatrix.jdbc.api.Connection c = (com.metamatrix.jdbc.api.Connection) conn;
+ } else {
+ TestLogger.log("ConnectionStrategy configuration: connection is not of type MMConnection and therefore no vdb setup will be performed");
+ return;
+ }
+
+ setupVDBConnectorBindings(admin);
+
+ // admin.restart();
+
+ int sleep = 5;
+
+ TestLogger.log("Bouncing the system..(wait " + sleep + " seconds)"); //$NON-NLS-1$
+ Thread.sleep(1000 * sleep);
+ TestLogger.log("done."); //$NON-NLS-1$
+
+ } catch (Throwable e) {
+ e.printStackTrace();
+
+ throw new TransactionRuntimeException(e.getMessage());
+ } finally {
+ // need to close and flush the connection after restarting
+ // this.shutdown();
+
+ }
+ }
protected void setupVDBConnectorBindings(Admin api) throws QueryTestFailedException {
try {
- VDB vdb = null;
- Collection<VDB> vdbs = api.getVDBs("*");
+ VDB vdb = null;
+ Set<VDB> vdbs = api.getVDBs();
if (vdbs == null || vdbs.isEmpty()) {
throw new QueryTestFailedException(
"AdminApi.GetVDBS returned no vdbs available");
@@ -183,11 +182,12 @@
+ url.getVDBName());
}
- Iterator<Model> modelIt = vdb.getModels().iterator();
+ List<Model> models = vdb.getModels();
+ Iterator<Model> modelIt = models.iterator();
while (modelIt.hasNext()) {
Model m = modelIt.next();
- if (!m.isPhysical())
+ if (!m.isSource())
continue;
// get the mapping, if defined
@@ -198,24 +198,17 @@
useName = mappedName;
}
- org.teiid.test.framework.datasource.DataSource ds = this.dsFactory
- .getDatasource(useName, m.getName());
+ org.teiid.test.framework.datasource.DataSource ds = this.dsFactory.getDatasource(useName, m.getName());
if (ds != null) {
TestLogger.logInfo("Set up Connector Binding (model:mapping:type): " + m.getName() + ":" + useName + ":" + ds.getConnectorType()); //$NON-NLS-1$
- AdminOptions ao = new AdminOptions(
- AdminOptions.OnConflict.OVERWRITE);
- ao.addOption(AdminOptions.BINDINGS_IGNORE_DECRYPT_ERROR);
+ api.addConnectorBinding(ds.getName(),ds.getConnectorType(), ds.getProperties());
- api.addConnectorBinding(ds.getName(),
- ds.getConnectorType(), ds.getProperties(), ao);
+ api.assignBindingToModel(vdb.getName(), vdb.getVersion(), m.getName(), ds.getName());
- api.assignBindingToModel(ds.getName(), vdb.getName(), vdb
- .getVDBVersion(), m.getName());
-
- api.startConnectorBinding(ds.getName());
+ api.startConnectorBinding(api.getConnectorBinding(ds.getName()));
} else {
throw new QueryTestFailedException(
"Error: Unable to create binding to map to model : "
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategyFactory.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategyFactory.java 2010-03-05 21:43:09 UTC (rev 1930)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategyFactory.java 2010-03-05 22:48:25 UTC (rev 1931)
@@ -23,9 +23,9 @@
public static ConnectionStrategy createConnectionStrategy() {
- ConfigPropertyLoader configLoader = ConfigPropertyLoader.getInstance();
+ ConfigPropertyLoader configLoader = ConfigPropertyLoader.getInstance();
- ConnectionStrategy strategy = null;
+ ConnectionStrategy strategy = null;
Properties props = configLoader.getProperties();
String type = props.getProperty(ConfigPropertyNames.CONNECTION_TYPE, ConfigPropertyNames.CONNECTION_TYPES.DRIVER_CONNECTION);
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/DataSourceConnection.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/DataSourceConnection.java 2010-03-05 21:43:09 UTC (rev 1930)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/DataSourceConnection.java 2010-03-05 22:48:25 UTC (rev 1931)
@@ -21,7 +21,6 @@
import com.metamatrix.common.util.PropertiesUtils;
import com.metamatrix.jdbc.BaseDataSource;
-import com.metamatrix.jdbc.EmbeddedDataSource;
public class DataSourceConnection extends ConnectionStrategy {
@@ -129,68 +128,57 @@
return xaConnection;
}
- private XAConnection createConnection() throws SQLException,
- InstantiationException, IllegalAccessException,
- ClassNotFoundException {
- TestLogger.log("Creating Datasource Connection: \"" + this.serverName + " - " + this.databaseName + "\""); //$NON-NLS-1$ //$NON-NLS-2$
+ private XAConnection createConnection() throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException {
+
+ TestLogger.log("Creating Datasource Connection: \"" + this.serverName + " - " + this.databaseName + "\""); //$NON-NLS-1$ //$NON-NLS-2$
- DataSource ds = (DataSource)Class.forName(this.driver).newInstance();
-
- if (ds instanceof BaseDataSource) {
-
- BaseDataSource dataSource = (BaseDataSource) ds;
-
- dataSource.setDatabaseName(this.databaseName);
- if (this.applName != null) {
- dataSource.setApplicationName(this.applName);
- }
-
- if (dataSource instanceof EmbeddedDataSource) {
- ((EmbeddedDataSource) dataSource).setBootstrapFile(this.serverName);
- } else {
- ((TeiidDataSource) dataSource).setServerName(this.serverName);
- ((TeiidDataSource) dataSource).setPortNumber(Integer
- .parseInt(this.portNumber));
- }
-
- if (this.username != null) {
- dataSource.setUser(this.username);
- dataSource.setPassword(this.pwd);
- }
-
-
- return ((XADataSource) dataSource).getXAConnection(this.username,
- this.pwd);
- } else {
- Properties props = new Properties();
- props.setProperty(DS_DATABASENAME, this.databaseName);
- props.setProperty(DS_SERVERPORT, this.portNumber);
- props.setProperty(DS_URL, this.url);
- props.setProperty(DS_SERVERNAME, this.serverName);
- if (this.username != null) {
- props.setProperty(DS_USERNAME, this.username);
- props.setProperty(DS_USER, this.username);
- props.setProperty(DS_PASSWORD, this.pwd);
- }
-
- PropertiesUtils.setBeanProperties(ds, props, null);
- return ((XADataSource)ds).getXAConnection();
- }
+ DataSource ds = (DataSource) Class.forName(this.driver).newInstance();
+ if (ds instanceof BaseDataSource) {
- }
+ BaseDataSource dataSource = (BaseDataSource) ds;
- public void shutdown() {
- super.shutdown();
- try {
+ dataSource.setDatabaseName(this.databaseName);
+ if (this.applName != null) {
+ dataSource.setApplicationName(this.applName);
+ }
- if (this.xaConnection != null) {
- this.xaConnection.close();
- }
- } catch (SQLException e) {
- // ignore..
+ ((TeiidDataSource) dataSource).setServerName(this.serverName);
+ ((TeiidDataSource) dataSource).setPortNumber(Integer.parseInt(this.portNumber));
+
+ if (this.username != null) {
+ dataSource.setUser(this.username);
+ dataSource.setPassword(this.pwd);
+ }
+
+ return ((XADataSource) dataSource).getXAConnection(this.username,
+ this.pwd);
+ }
+ Properties props = new Properties();
+ props.setProperty(DS_DATABASENAME, this.databaseName);
+ props.setProperty(DS_SERVERPORT, this.portNumber);
+ props.setProperty(DS_URL, this.url);
+ props.setProperty(DS_SERVERNAME, this.serverName);
+ if (this.username != null) {
+ props.setProperty(DS_USERNAME, this.username);
+ props.setProperty(DS_USER, this.username);
+ props.setProperty(DS_PASSWORD, this.pwd);
+ }
+
+ PropertiesUtils.setBeanProperties(ds, props, null);
+ return ((XADataSource) ds).getXAConnection();
}
- this.xaConnection = null;
- }
+ public void shutdown() {
+ super.shutdown();
+ try {
+
+ if (this.xaConnection != null) {
+ this.xaConnection.close();
+ }
+ } catch (SQLException e) {
+ // ignore..
+ }
+ this.xaConnection = null;
+ }
}
Modified: trunk/test-integration/db/src/main/resources/default-config.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/default-config.properties 2010-03-05 21:43:09 UTC (rev 1930)
+++ trunk/test-integration/db/src/main/resources/default-config.properties 2010-03-05 22:48:25 UTC (rev 1931)
@@ -35,6 +35,9 @@
mm.ds-jndiname=mmXA
usertxn-jndiname=java:comp/UserTransaction
+admin.url=mm://localhost:31443
+admin.user=admin
+admin.password=admin
# These mappings control what datasource is mapped to which model when the -Dusedatasources=<comma seperated datasource names> option is used
# or the system environment is set.
More information about the teiid-commits
mailing list