[teiid-commits] teiid SVN: r1966 - in trunk: build/kit-jboss-container/deploy/teiid and 14 other directories.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Tue Mar 16 14:29:30 EDT 2010
Author: rareddy
Date: 2010-03-16 14:29:29 -0400 (Tue, 16 Mar 2010)
New Revision: 1966
Added:
trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadataMapper.java
trunk/test-integration/db/src/test/java/org/teiid/adminapi/
trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/
trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java
trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
trunk/test-integration/db/src/test/resources/
trunk/test-integration/db/src/test/resources/TransactionsRevisited.vdb
trunk/test-integration/db/src/test/resources/connector-loopback.rar
trunk/test-integration/db/src/test/resources/log4j.xml
Removed:
trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java
trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
trunk/jboss-integration/src/test/resources/TransactionsRevisited.vdb
trunk/jboss-integration/src/test/resources/connector-loopback.rar
trunk/jboss-integration/src/test/resources/log4j.xml
trunk/test-integration/db/resources/
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/Model.java
trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.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/adminapi/impl/TransactionMetadataMapper.java
trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java
trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java
trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
Log:
TEIID-833: fixed few misc errors. (1) moved the admin tests to integration-db (2) fixed ping based on invalid session (3) removed admin api calls "shutdown" and "restart"
Modified: trunk/adminshell/src/main/resources/scripts/adminapi.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/adminapi.bsh 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/adminshell/src/main/resources/scripts/adminapi.bsh 2010-03-16 18:29:29 UTC (rev 1966)
@@ -100,29 +100,19 @@
/**
* Assign a {@link ConnectorBinding} to a {@link VDB}'s Model
*
- * @param vdbName
- * Name of the VDB
- * @param vdbVersion
- * Version of the VDB
- * @param modelName
- * Name of the Model to map Connector Binding
- * @param connectorBindingName
- * Name of the ConnectorBinding
- * @throws AdminException
- * if there's a system error or if there's a user input error.
- * @since 4.3
+ * @param vdbName Name of the VDB
+ * @param vdbVersion Version of the VDB
+ * @param modelName Name of the Model to map Connector Binding
+ * @param sourceName sourceName for the model
+ * @param jndiName JNDI names to which the source name needs to map to
+ * @throws AdminException if there's a system error or if there's a user input error.
*/
-void assignBindingToModel(String vdbName, int vdbVersion, String modelName, String connectorBindingName) {
- debug("Assigning Connector Binding " + connectorBindingName + " to Model " + modelName + " in VDB " + vdbName + " version " + vdbVersion);
+void assignBindingToModel(String vdbName, int vdbVersion, String modelName, String sourceName, String jndiName) throws AdminException{
+ debug("Assigning Connector Binding, source name:" + sourceName +" to JNDI resource: "+jndiName+ " for Model " + modelName + " in VDB " + vdbName + " version " + vdbVersion);
checkAdmin();
- internalAdmin.assignBindingToModel(vdbName, vdbVersion, modelName, connectorBindingName);
+ internalAdmin.assignBindingToModel(vdbName, vdbVersion, modelName, sourceName, jndiName);
}
-void assignBindingToModel(String vdbName, int vdbVersion, String modelName, String[] connectorBindingNames) {
- debug("Assigning Connector Bindings " + connectorBindingNames + " to Model " + modelName + " in VDB " + vdbName + " version " + vdbVersion);
- checkAdmin();
- internalAdmin.assignBindingToModel(vdbName, vdbVersion, modelName, connectorBindingNames);
-}
/**
* Adds JDBC XA Data Source in the container.
@@ -538,30 +528,7 @@
internalAdmin.cancelRequest(sessionId, requestId);
}
-/**
- * Stop the Teiid. If millisToWait is >0, then close to incoming queries, wait the time period
- * for work to stop, then stop the MM Query. Otherwise, stop immediately, aborting all running queries.
- * @param millisToWait Milliseconds to wait (if >0) or <=0 for no wait before stopping
- * @throws AdminException
- */
-void shutdown(int millisToWait) {
- checkAdmin();
- internalAdmin.shutdown(millisToWait);
- disconnect();
-}
-/**
- * Restart System
- * @throws AdminException if there's a system error.
- */
-void restart() {
- checkAdmin();
- internalAdmin.restart();
- disconnect();
-}
-
-
-
//*********************************************************************************************
// Utility Methods
//
Modified: trunk/build/kit-jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
--- trunk/build/kit-jboss-container/deploy/teiid/teiid-jboss-beans.xml 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/build/kit-jboss-container/deploy/teiid/teiid-jboss-beans.xml 2010-03-16 18:29:29 UTC (rev 1966)
@@ -72,7 +72,7 @@
<property name="adminSocketConfiguration"><inject bean="AdminSocketConfiguration"/></property>
<property name="workManager"><inject bean="WorkManager"/></property>
<property name="XATerminator"><inject bean="TransactionManager" property="XATerminator"/></property>
- <property name="TransactionManager"><inject bean="TransactionManager"/></property>
+ <property name="transactionManager"><inject bean="TransactionManager" property="transactionManager"/></property>
<property name="authorizationService"><inject bean="AuthorizationService"/></property>
<property name="sessionService"><inject bean="SessionService"/></property>
<property name="bufferService"><inject bean="BufferService"/></property>
Modified: trunk/client/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -22,7 +22,6 @@
package org.teiid.adminapi;
-import java.io.InputStream;
import java.net.URL;
import java.util.Collection;
import java.util.Properties;
@@ -82,7 +81,7 @@
* @return InputStream of contents of the rar file
* @throws AdminException if there's a system error.
*/
- InputStream exportConnectorType(String name) throws AdminException;
+ byte[] exportConnectorType(String name) throws AdminException;
/**
* Deploy a {@link ConnectorBinding} to Configuration
@@ -111,7 +110,7 @@
* @throws AdminException
* if there's a system error.
*/
- InputStream exportConnectorBinding(String deployedName) throws AdminException;
+ char[] exportConnectorBinding(String deployedName) throws AdminException;
/**
* Deploy a {@link VDB} file.
@@ -140,7 +139,7 @@
* @return InputStream of the VDB
* @throws AdminException if there's a system error.
*/
- InputStream exportVDB(String vdbName, int vdbVersion) throws AdminException;
+ byte[] exportVDB(String vdbName, int vdbVersion) throws AdminException;
/**
* Set a process level property.
Modified: trunk/client/src/main/java/org/teiid/adminapi/Model.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Model.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/client/src/main/java/org/teiid/adminapi/Model.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -66,5 +66,12 @@
* Associated Source Names for the Models (Connector Bindings)
* @return String
*/
- List<String> getSourceNames();
+ List<String> getSourceNames();
+
+ /**
+ * Get the configured JNDI name for the given source name.
+ * @param sourceName - name of the source
+ * @return null if none configured.
+ */
+ String getSourceJndiName(String sourceName);
}
\ No newline at end of file
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -165,6 +165,7 @@
return new ArrayList<String>(this.sources.getMap().keySet());
}
+ @Override
public String getSourceJndiName(String sourceName) {
SourceMappingMetadata s = this.sources.getMap().get(sourceName);
if (s == null) {
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -35,19 +35,27 @@
import org.jboss.metatype.spi.values.MetaMapper;
public class RequestMetadataMapper extends MetaMapper<RequestMetadata> {
+ private static final String TRANSACTION_ID = "transactionId"; //$NON-NLS-1$
+ private static final String NODE_ID = "nodeId"; //$NON-NLS-1$
+ private static final String SOURCE_REQUEST = "sourceRequest"; //$NON-NLS-1$
+ private static final String COMMAND = "command"; //$NON-NLS-1$
+ private static final String PROCESSING_TIME = "processingTime"; //$NON-NLS-1$
+ private static final String CREATED_TIME = "createdTime"; //$NON-NLS-1$
+ private static final String SESSION_ID = "sessionId"; //$NON-NLS-1$
+ private static final String EXECUTION_ID = "executionId"; //$NON-NLS-1$
private static final MutableCompositeMetaType metaType;
private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
static {
- metaType = new MutableCompositeMetaType(RequestMetadata.class.getName(), "The Session domain meta data");
- metaType.addItem("executionId", "executionId", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("sessionId", "sessionId", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("createdTime", "createdTime", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("processingTime", "processingTime", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("command", "command", SimpleMetaType.STRING);
- metaType.addItem("sourceRequest", "sourceRequest", SimpleMetaType.BOOLEAN_PRIMITIVE);
- metaType.addItem("nodeId", "nodeId", SimpleMetaType.INTEGER_PRIMITIVE);
- metaType.addItem("transactionId", "transactionId", SimpleMetaType.STRING);
+ metaType = new MutableCompositeMetaType(RequestMetadata.class.getName(), "The Request meta data"); //$NON-NLS-1$
+ metaType.addItem(EXECUTION_ID, EXECUTION_ID, SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem(SESSION_ID, SESSION_ID, SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem(CREATED_TIME, CREATED_TIME, SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem(PROCESSING_TIME, PROCESSING_TIME, SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem(COMMAND, COMMAND, SimpleMetaType.STRING);
+ metaType.addItem(SOURCE_REQUEST, SOURCE_REQUEST, SimpleMetaType.BOOLEAN_PRIMITIVE);
+ metaType.addItem(NODE_ID, NODE_ID, SimpleMetaType.INTEGER_PRIMITIVE);
+ metaType.addItem(TRANSACTION_ID, TRANSACTION_ID, SimpleMetaType.STRING);
metaType.freeze();
}
@@ -69,17 +77,17 @@
CompositeMetaType composite = (CompositeMetaType) metaType;
CompositeValueSupport request = new CompositeValueSupport(composite);
- request.set("executionId", SimpleValueSupport.wrap(object.getExecutionId()));
- request.set("sessionId", SimpleValueSupport.wrap(object.getSessionId()));
- request.set("processingTime", SimpleValueSupport.wrap(object.getProcessingTime()));
- request.set("command", SimpleValueSupport.wrap(object.getCommand()));
- request.set("sourceRequest", SimpleValueSupport.wrap(object.sourceRequest()));
- request.set("nodeId", SimpleValueSupport.wrap(object.getNodeId()));
- request.set("transactionId",SimpleValueSupport.wrap(object.getTransactionId()));
+ request.set(EXECUTION_ID, SimpleValueSupport.wrap(object.getExecutionId()));
+ request.set(SESSION_ID, SimpleValueSupport.wrap(object.getSessionId()));
+ request.set(PROCESSING_TIME, SimpleValueSupport.wrap(object.getProcessingTime()));
+ request.set(COMMAND, SimpleValueSupport.wrap(object.getCommand()));
+ request.set(SOURCE_REQUEST, SimpleValueSupport.wrap(object.sourceRequest()));
+ request.set(NODE_ID, SimpleValueSupport.wrap(object.getNodeId()));
+ request.set(TRANSACTION_ID,SimpleValueSupport.wrap(object.getTransactionId()));
return request;
}
- throw new IllegalArgumentException("Cannot convert request " + object);
+ throw new IllegalArgumentException("Cannot convert RequestMetadata " + object); //$NON-NLS-1$
}
@Override
@@ -91,16 +99,16 @@
CompositeValue compositeValue = (CompositeValue) metaValue;
RequestMetadata request = new RequestMetadata();
- request.setExecutionId((Long) metaValueFactory.unwrap(compositeValue.get("executionId")));
- request.setSessionId((Long) metaValueFactory.unwrap(compositeValue.get("sessionId")));
- request.setProcessingTime((Long) metaValueFactory.unwrap(compositeValue.get("processingTime")));
- request.setCommand((String) metaValueFactory.unwrap(compositeValue.get("command")));
- request.setSourceRequest((Boolean) metaValueFactory.unwrap(compositeValue.get("sourceRequest")));
- request.setNodeId((Integer) metaValueFactory.unwrap(compositeValue.get("nodeId")));
- request.setTransactionId((String) metaValueFactory.unwrap(compositeValue.get("transactionId")));
+ request.setExecutionId((Long) metaValueFactory.unwrap(compositeValue.get(EXECUTION_ID)));
+ request.setSessionId((Long) metaValueFactory.unwrap(compositeValue.get(SESSION_ID)));
+ request.setProcessingTime((Long) metaValueFactory.unwrap(compositeValue.get(PROCESSING_TIME)));
+ request.setCommand((String) metaValueFactory.unwrap(compositeValue.get(COMMAND)));
+ request.setSourceRequest((Boolean) metaValueFactory.unwrap(compositeValue.get(SOURCE_REQUEST)));
+ request.setNodeId((Integer) metaValueFactory.unwrap(compositeValue.get(NODE_ID)));
+ request.setTransactionId((String) metaValueFactory.unwrap(compositeValue.get(TRANSACTION_ID)));
return request;
}
- throw new IllegalStateException("Unable to unwrap request " + metaValue);
+ throw new IllegalStateException("Unable to unwrap RequestMetadata " + metaValue); //$NON-NLS-1$
}
}
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -49,7 +49,7 @@
private String userName;
private String vdbName;
private int vdbVersion;
- private long sessionId;
+ private long sessionId = -1; // invalid session
private String securityDomain;
//server session state
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -35,21 +35,31 @@
import org.jboss.metatype.spi.values.MetaMapper;
public class SessionMetadataMapper extends MetaMapper<SessionMetadata> {
+ private static final String SECURITY_DOMAIN = "securityDomain"; //$NON-NLS-1$
+ private static final String VDB_VERSION = "VDBVersion"; //$NON-NLS-1$
+ private static final String VDB_NAME = "VDBName"; //$NON-NLS-1$
+ private static final String USER_NAME = "userName"; //$NON-NLS-1$
+ private static final String SESSION_ID = "sessionId"; //$NON-NLS-1$
+ 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 CREATED_TIME = "createdTime"; //$NON-NLS-1$
+ private static final String APPLICATION_NAME = "applicationName"; //$NON-NLS-1$
private static final MutableCompositeMetaType metaType;
private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
static {
- metaType = new MutableCompositeMetaType(SessionMetadata.class.getName(), "The Session domain meta data");
- metaType.addItem("applicationName", "applicationName", SimpleMetaType.STRING);
- metaType.addItem("createdTime", "createdTime", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("clientHostName", "clientHostName", SimpleMetaType.STRING);
- metaType.addItem("IPAddress", "IPAddress", SimpleMetaType.STRING);
- metaType.addItem("lastPingTime", "lastPingTime", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("sessionId", "sessionId", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("userName", "userName", SimpleMetaType.STRING);
- metaType.addItem("VDBName", "VDBName", SimpleMetaType.STRING);
- metaType.addItem("VDBVersion", "VDBVersion", SimpleMetaType.INTEGER_PRIMITIVE);
- metaType.addItem("securityDomain", "SecurityDomain", SimpleMetaType.STRING);
+ metaType = new MutableCompositeMetaType(SessionMetadata.class.getName(), "The Session domain meta data"); //$NON-NLS-1$
+ metaType.addItem(APPLICATION_NAME, APPLICATION_NAME, SimpleMetaType.STRING);
+ metaType.addItem(CREATED_TIME, CREATED_TIME, SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem(CLIENT_HOST_NAME, CLIENT_HOST_NAME, SimpleMetaType.STRING);
+ metaType.addItem(IP_ADDRESS, IP_ADDRESS, SimpleMetaType.STRING);
+ metaType.addItem(LAST_PING_TIME, LAST_PING_TIME, SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem(SESSION_ID, SESSION_ID, SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem(USER_NAME, USER_NAME, SimpleMetaType.STRING);
+ 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.freeze();
}
@@ -71,20 +81,20 @@
CompositeMetaType composite = (CompositeMetaType) metaType;
CompositeValueSupport session = new CompositeValueSupport(composite);
- session.set("applicationName", SimpleValueSupport.wrap(object.getName()));
- session.set("createdTime", SimpleValueSupport.wrap(object.getCreatedTime()));
- session.set("clientHostName", SimpleValueSupport.wrap(object.getClientHostName()));
- session.set("IPAddress", SimpleValueSupport.wrap(object.getIPAddress()));
- session.set("lastPingTime", SimpleValueSupport.wrap(object.getLastPingTime()));
- session.set("sessionId", SimpleValueSupport.wrap(object.getSessionId()));
- session.set("userName", SimpleValueSupport.wrap(object.getUserName()));
- session.set("VDBName",SimpleValueSupport.wrap(object.getVDBName()));
- session.set("VDBVersion", SimpleValueSupport.wrap(object.getVDBVersion()));
- session.set("securityDomain", SimpleValueSupport.wrap(object.getSecurityDomain()));
+ session.set(APPLICATION_NAME, SimpleValueSupport.wrap(object.getName()));
+ session.set(CREATED_TIME, SimpleValueSupport.wrap(object.getCreatedTime()));
+ session.set(CLIENT_HOST_NAME, SimpleValueSupport.wrap(object.getClientHostName()));
+ session.set(IP_ADDRESS, SimpleValueSupport.wrap(object.getIPAddress()));
+ session.set(LAST_PING_TIME, SimpleValueSupport.wrap(object.getLastPingTime()));
+ session.set(SESSION_ID, SimpleValueSupport.wrap(object.getSessionId()));
+ session.set(USER_NAME, SimpleValueSupport.wrap(object.getUserName()));
+ session.set(VDB_NAME,SimpleValueSupport.wrap(object.getVDBName()));
+ session.set(VDB_VERSION, SimpleValueSupport.wrap(object.getVDBVersion()));
+ session.set(SECURITY_DOMAIN, SimpleValueSupport.wrap(object.getSecurityDomain()));
return session;
}
- throw new IllegalArgumentException("Cannot convert session " + object);
+ throw new IllegalArgumentException("Cannot convert session " + object); //$NON-NLS-1$
}
@Override
@@ -96,19 +106,19 @@
CompositeValue compositeValue = (CompositeValue) metaValue;
SessionMetadata session = new SessionMetadata();
- session.setApplicationName((String) metaValueFactory.unwrap(compositeValue.get("applicationName")));
- session.setCreatedTime((Long) metaValueFactory.unwrap(compositeValue.get("createdTime")));
- session.setClientHostName((String) metaValueFactory.unwrap(compositeValue.get("clientHostName")));
- session.setIPAddress((String) metaValueFactory.unwrap(compositeValue.get("IPAddress")));
- session.setLastPingTime((Long) metaValueFactory.unwrap(compositeValue.get("lastPingTime")));
- session.setSessionId((Long) metaValueFactory.unwrap(compositeValue.get("sessionId")));
- session.setUserName((String) metaValueFactory.unwrap(compositeValue.get("userName")));
- session.setVDBName((String) metaValueFactory.unwrap(compositeValue.get("VDBName")));
- session.setVDBVersion((Integer) metaValueFactory.unwrap(compositeValue.get("VDBVersion")));
- session.setSecurityDomain((String) metaValueFactory.unwrap(compositeValue.get("securityDomain")));
+ session.setApplicationName((String) metaValueFactory.unwrap(compositeValue.get(APPLICATION_NAME)));
+ session.setCreatedTime((Long) metaValueFactory.unwrap(compositeValue.get(CREATED_TIME)));
+ session.setClientHostName((String) metaValueFactory.unwrap(compositeValue.get(CLIENT_HOST_NAME)));
+ session.setIPAddress((String) metaValueFactory.unwrap(compositeValue.get(IP_ADDRESS)));
+ session.setLastPingTime((Long) metaValueFactory.unwrap(compositeValue.get(LAST_PING_TIME)));
+ session.setSessionId((Long) metaValueFactory.unwrap(compositeValue.get(SESSION_ID)));
+ session.setUserName((String) metaValueFactory.unwrap(compositeValue.get(USER_NAME)));
+ 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)));
return session;
}
- throw new IllegalStateException("Unable to unwrap session " + metaValue);
+ throw new IllegalStateException("Unable to unwrap session " + metaValue); //$NON-NLS-1$
}
}
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -36,15 +36,19 @@
import org.jboss.metatype.spi.values.MetaMapper;
public class TransactionMetadataMapper extends MetaMapper<TransactionMetadata> {
+ private static final String XID = "xid"; //$NON-NLS-1$
+ private static final String SCOPE = "scope"; //$NON-NLS-1$
+ private static final String CREATED_TIME = "createdTime"; //$NON-NLS-1$
+ private static final String ASSOCIATED_SESSION = "associatedSession"; //$NON-NLS-1$
private static final MutableCompositeMetaType metaType;
private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
static {
- metaType = new MutableCompositeMetaType(TransactionMetadata.class.getName(), "The Session domain meta data");
- metaType.addItem("associatedSession", "associatedSession", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("createdTime", "createdTime", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("scope", "scope", SimpleMetaType.STRING);
- metaType.addItem("xid", "xid", SimpleMetaType.STRING);
+ metaType = new MutableCompositeMetaType(TransactionMetadata.class.getName(), "The Transaction domain meta data"); //$NON-NLS-1$
+ metaType.addItem(ASSOCIATED_SESSION, ASSOCIATED_SESSION, SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem(CREATED_TIME, CREATED_TIME, SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem(SCOPE, SCOPE, SimpleMetaType.STRING);
+ metaType.addItem(XID, XID, SimpleMetaType.STRING);
metaType.freeze();
}
@@ -66,14 +70,14 @@
CompositeMetaType composite = (CompositeMetaType) metaType;
CompositeValueSupport transaction = new CompositeValueSupport(composite);
- transaction.set("associatedSession", SimpleValueSupport.wrap(object.getAssociatedSession()));
- transaction.set("createdTime", SimpleValueSupport.wrap(object.getCreatedTime()));
- transaction.set("scope", SimpleValueSupport.wrap(object.getScope()));
- transaction.set("id", SimpleValueSupport.wrap(object.getId()));
+ transaction.set(ASSOCIATED_SESSION, SimpleValueSupport.wrap(object.getAssociatedSession()));
+ transaction.set(CREATED_TIME, SimpleValueSupport.wrap(object.getCreatedTime()));
+ transaction.set(SCOPE, SimpleValueSupport.wrap(object.getScope()));
+ transaction.set("id", SimpleValueSupport.wrap(object.getId())); //$NON-NLS-1$
return transaction;
}
- throw new IllegalArgumentException("Cannot convert session " + object);
+ throw new IllegalArgumentException("Cannot convert TransactionMetadata " + object); //$NON-NLS-1$
}
@Override
@@ -85,12 +89,12 @@
CompositeValue compositeValue = (CompositeValue) metaValue;
TransactionMetadata transaction = new TransactionMetadata();
- transaction.setAssociatedSession((Long) metaValueFactory.unwrap(compositeValue.get("associatedSession")));
- transaction.setCreatedTime((Long) metaValueFactory.unwrap(compositeValue.get("createdTime")));
- transaction.setScope((String) metaValueFactory.unwrap(compositeValue.get("scope")));
- transaction.setId((String) metaValueFactory.unwrap(compositeValue.get("id")));
+ transaction.setAssociatedSession((Long) metaValueFactory.unwrap(compositeValue.get(ASSOCIATED_SESSION)));
+ transaction.setCreatedTime((Long) metaValueFactory.unwrap(compositeValue.get(CREATED_TIME)));
+ transaction.setScope((String) metaValueFactory.unwrap(compositeValue.get(SCOPE)));
+ transaction.setId((String) metaValueFactory.unwrap(compositeValue.get("id"))); //$NON-NLS-1$
return transaction;
}
- throw new IllegalStateException("Unable to unwrap transaction " + metaValue);
+ throw new IllegalStateException("Unable to unwrap TransactionMetadata " + metaValue); //$NON-NLS-1$
}
}
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -23,11 +23,13 @@
package org.teiid.adminapi.impl;
import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.metatype.api.annotations.MetaMapping;
import org.teiid.adminapi.WorkerPoolStatistics;
/**
* This class is a holder for all the statistics gathered about a worker pool.
*/
+ at MetaMapping(WorkerPoolStatisticsMetadataMapper.class)
public class WorkerPoolStatisticsMetadata extends AdminObjectImpl implements WorkerPoolStatistics {
private static final long serialVersionUID = -4917902925523802295L;
Added: trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadataMapper.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadataMapper.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadataMapper.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -0,0 +1,116 @@
+/*
+ * 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.adminapi.impl;
+
+import java.lang.reflect.Type;
+
+import org.jboss.metatype.api.types.CompositeMetaType;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.CompositeValue;
+import org.jboss.metatype.api.values.CompositeValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.metatype.plugins.types.MutableCompositeMetaType;
+import org.jboss.metatype.spi.values.MetaMapper;
+
+public class WorkerPoolStatisticsMetadataMapper extends MetaMapper<WorkerPoolStatisticsMetadata> {
+ private static final String MAX_THREADS = "maxThreads"; //$NON-NLS-1$
+ private static final String HIGHEST_QUEUED = "highestQueued"; //$NON-NLS-1$
+ private static final String QUEUED = "queued"; //$NON-NLS-1$
+ private static final String QUEUE_NAME = "queueName"; //$NON-NLS-1$
+ private static final String TOTAL_SUBMITTED = "totalSubmitted"; //$NON-NLS-1$
+ private static final String TOTAL_COMPLETED = "totalCompleted"; //$NON-NLS-1$
+ private static final String HIGHEST_ACTIVE_THREADS = "highestActiveThreads"; //$NON-NLS-1$
+ private static final String ACTIVE_THREADS = "activeThreads"; //$NON-NLS-1$
+ private static final MutableCompositeMetaType metaType;
+ private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
+
+ static {
+ metaType = new MutableCompositeMetaType(WorkerPoolStatisticsMetadata.class.getName(), "The Worker Pool statistics"); //$NON-NLS-1$
+ metaType.addItem(ACTIVE_THREADS, "ActiveThreads", SimpleMetaType.INTEGER_PRIMITIVE); //$NON-NLS-1$
+ metaType.addItem(HIGHEST_ACTIVE_THREADS, "HighestActiveThreads", SimpleMetaType.INTEGER_PRIMITIVE); //$NON-NLS-1$
+ metaType.addItem(TOTAL_COMPLETED, "TotalCompleted", SimpleMetaType.LONG_PRIMITIVE); //$NON-NLS-1$
+ metaType.addItem(TOTAL_SUBMITTED, "TotalSubmitted", SimpleMetaType.LONG_PRIMITIVE); //$NON-NLS-1$
+ metaType.addItem(QUEUE_NAME, "QueueName", SimpleMetaType.STRING); //$NON-NLS-1$
+ metaType.addItem(QUEUED, "Queued", SimpleMetaType.INTEGER_PRIMITIVE); //$NON-NLS-1$
+ metaType.addItem(HIGHEST_QUEUED, "HighestQueued", SimpleMetaType.INTEGER_PRIMITIVE); //$NON-NLS-1$
+ metaType.addItem(MAX_THREADS, "MaxThreads", SimpleMetaType.INTEGER_PRIMITIVE); //$NON-NLS-1$
+ metaType.freeze();
+ }
+
+ @Override
+ public Type mapToType() {
+ return WorkerPoolStatisticsMetadata.class;
+ }
+
+ @Override
+ public MetaType getMetaType() {
+ return metaType;
+ }
+
+ @Override
+ public MetaValue createMetaValue(MetaType metaType, WorkerPoolStatisticsMetadata object) {
+ if (object == null)
+ return null;
+ if (metaType instanceof CompositeMetaType) {
+ CompositeMetaType composite = (CompositeMetaType) metaType;
+ CompositeValueSupport transaction = new CompositeValueSupport(composite);
+
+ transaction.set(ACTIVE_THREADS, SimpleValueSupport.wrap(object.getActiveThreads()));
+ transaction.set(HIGHEST_ACTIVE_THREADS, SimpleValueSupport.wrap(object.getHighestActiveThreads()));
+ transaction.set(TOTAL_COMPLETED, SimpleValueSupport.wrap(object.getTotalCompleted()));
+ transaction.set(TOTAL_SUBMITTED, SimpleValueSupport.wrap(object.getTotalSubmitted()));
+ transaction.set(QUEUE_NAME, SimpleValueSupport.wrap(object.getQueueName()));
+ transaction.set(QUEUED, SimpleValueSupport.wrap(object.getQueued()));
+ transaction.set(HIGHEST_QUEUED, SimpleValueSupport.wrap(object.getHighestQueued()));
+ transaction.set(MAX_THREADS, SimpleValueSupport.wrap(object.getMaxThreads()));
+
+ return transaction;
+ }
+ throw new IllegalArgumentException("Cannot convert Worker Pool Statistics " + object); //$NON-NLS-1$
+ }
+
+ @Override
+ public WorkerPoolStatisticsMetadata unwrapMetaValue(MetaValue metaValue) {
+ if (metaValue == null)
+ return null;
+
+ if (metaValue instanceof CompositeValue) {
+ CompositeValue compositeValue = (CompositeValue) metaValue;
+
+ WorkerPoolStatisticsMetadata stats = new WorkerPoolStatisticsMetadata();
+ stats.setActiveThreads((Integer) metaValueFactory.unwrap(compositeValue.get(ACTIVE_THREADS)));
+ stats.setHighestActiveThreads((Integer) metaValueFactory.unwrap(compositeValue.get(HIGHEST_ACTIVE_THREADS)));
+ stats.setTotalCompleted((Long) metaValueFactory.unwrap(compositeValue.get(TOTAL_COMPLETED)));
+ stats.setTotalSubmitted((Long) metaValueFactory.unwrap(compositeValue.get(TOTAL_SUBMITTED)));
+ stats.setQueueName((String) metaValueFactory.unwrap(compositeValue.get(QUEUE_NAME)));
+ stats.setQueued((Integer) metaValueFactory.unwrap(compositeValue.get(QUEUED)));
+ stats.setHighestQueued((Integer) metaValueFactory.unwrap(compositeValue.get(HIGHEST_QUEUED)));
+ stats.setMaxThreads((Integer) metaValueFactory.unwrap(compositeValue.get(MAX_THREADS)));
+ return stats;
+ }
+ throw new IllegalStateException("Unable to unwrap transaction " + metaValue); //$NON-NLS-1$
+ }
+}
Property changes on: trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadataMapper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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-15 21:54:11 UTC (rev 1965)
+++ trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -23,10 +23,10 @@
package org.teiid.adminapi.jboss;
import java.io.BufferedOutputStream;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
@@ -81,10 +81,13 @@
import org.teiid.adminapi.impl.SessionMetadata;
import org.teiid.adminapi.impl.TransactionMetadata;
import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
import org.teiid.connector.api.Connector;
import org.teiid.jboss.IntegrationPlugin;
import org.teiid.jboss.deployers.RuntimeEngineDeployer;
+import com.metamatrix.core.util.FileUtils;
+
public class Admin extends TeiidAdmin {
private static final ProfileKey DEFAULT_PROFILE_KEY = new ProfileKey(ProfileKey.DEFAULT);
@@ -171,18 +174,20 @@
}
@Override
- public InputStream exportConnectorBinding(String deployedName) throws AdminException {
+ public char[] exportConnectorBinding(String deployedName) throws AdminException {
ManagedComponent mc = getConnectorBindingComponent(deployedName);
if (mc != null) {
- return exportDeployment(mc.getDeployment().getName());
+ return new String(exportDeployment(mc.getDeployment().getName()).toByteArray()).toCharArray();
}
return null;
}
- private InputStream exportDeployment(String url) throws AdminComponentException {
+ private ByteArrayOutputStream exportDeployment(String url) throws AdminComponentException {
try {
URL contentURL = new URL(url);
- return contentURL.openStream();
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ FileUtils.write(contentURL.openStream(), bos, FileUtils.DEFAULT_BUFFER_SIZE);
+ return bos;
} catch (MalformedURLException e) {
throw new AdminComponentException(e);
} catch (IOException e) {
@@ -392,10 +397,10 @@
}
@Override
- public InputStream exportVDB(String vdbName, int vdbVersion) throws AdminException{
+ public byte[] exportVDB(String vdbName, int vdbVersion) throws AdminException{
ManagedComponent mc = getVDBManagedComponent(vdbName, vdbVersion);
if (mc != null) {
- return exportDeployment(mc.getDeployment().getName());
+ return exportDeployment(mc.getDeployment().getName()).toByteArray();
}
return null;
}
@@ -619,22 +624,22 @@
}
String deployerName = getRarDeployerName(connectorName);
if (deployerName != null) {
- ManagedUtil.removeArchive(getDeploymentManager(), deployerName);
-
//also need to delete template for the properties
String connectorNameWithoutExt = connectorName.substring(0, connectorName.length()-4);
ManagedUtil.removeArchive(getDeploymentManager(), connectorNameWithoutExt+"-template.jar");//$NON-NLS-1$
+
+ ManagedUtil.removeArchive(getDeploymentManager(), deployerName);
}
}
@Override
- public InputStream exportConnectorType(String connectorName) throws AdminException {
+ public byte[] exportConnectorType(String connectorName) throws AdminException {
if (!connectorName.endsWith(".rar")) {//$NON-NLS-1$
connectorName = connectorName + ".rar";//$NON-NLS-1$
}
String deployerName = getRarDeployerName(connectorName);
if (deployerName != null) {
- return exportDeployment(deployerName);
+ return exportDeployment(deployerName).toByteArray();
}
return null;
}
@@ -698,7 +703,7 @@
try {
ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);
MetaValue value = ManagedUtil.executeOperation(mc, "getWorkManagerStatistics", SimpleValueSupport.wrap(identifier));//$NON-NLS-1$
- return (WorkerPoolStatistics)MetaValueFactory.getInstance().unwrap(value, WorkerPoolStatistics.class);
+ return (WorkerPoolStatistics)MetaValueFactory.getInstance().unwrap(value, WorkerPoolStatisticsMetadata.class);
} catch (Exception e) {
throw new AdminComponentException(e.getMessage(), e);
}
Deleted: trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java
===================================================================
--- trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -1,66 +0,0 @@
-package org.teiid.adminapi.jboss;
-
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-import org.teiid.jdbc.TeiidDataSource;
-
-
-public class BaseConnection {
- static String user = "ramesh";
- static String password = "mm";
-
- interface ConnectionFactory{
- Connection getConnection(String vdbName) throws Exception;
- }
-
- static class ServerDatasourceConnection implements ConnectionFactory {
- public Connection getConnection(String vdbName) throws Exception {
- TeiidDataSource ds = new TeiidDataSource();
- ds.setUser(user);
- ds.setPassword(password);
- ds.setServerName("localhost");
- ds.setPortNumber(31000);
- ds.setDatabaseName(vdbName);
- ds.setAutoCommitTxn("AUTO");
- return ds.getConnection();
- }
- }
-
- public void execute(ConnectionFactory connF, String vdbName, String sql) throws Exception {
- Connection connection = connF.getConnection(vdbName);
- try {
- connection.getMetaData();
- Statement statement = connection.createStatement();
- boolean hasResults = statement.execute(sql);
- if (hasResults) {
- ResultSet results = statement.getResultSet();
- ResultSetMetaData metadata = results.getMetaData();
- int columns = metadata.getColumnCount();
-
- while(results.next()) {
- for (int i = 0; i < columns; i++) {
- System.out.print(results.getString(i+1));
- System.out.print(",");
- }
- System.out.println("");
- }
- System.out.println("Done getting results!");
- results.close();
- }
- else {
- System.out.println("update count is="+statement.getUpdateCount());
- }
- statement.close();
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
- }
-}
Deleted: trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
===================================================================
--- trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -1,312 +0,0 @@
-package org.teiid.adminapi.jboss;
-
-
-import static junit.framework.Assert.*;
-
-import java.io.File;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Properties;
-import java.util.Set;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.teiid.adminapi.Admin;
-import org.teiid.adminapi.AdminFactory;
-import org.teiid.adminapi.ConnectionPoolStatistics;
-import org.teiid.adminapi.ConnectorBinding;
-import org.teiid.adminapi.PropertyDefinition;
-import org.teiid.adminapi.Request;
-import org.teiid.adminapi.Session;
-import org.teiid.adminapi.Transaction;
-import org.teiid.adminapi.VDB;
-import org.teiid.adminapi.WorkerPoolStatistics;
-
-import com.metamatrix.core.util.ObjectConverterUtil;
-import com.metamatrix.core.util.UnitTestUtil;
-
-public class TestConnectorBindings extends BaseConnection {
- ServerDatasourceConnection ds;
- Admin admin;
-
- @Before
- public void setUp() throws Exception {
- //if (!Bootstrap.getInstance().isStarted()) Bootstrap.getInstance().bootstrap();
- ds = new ServerDatasourceConnection();
- //admin = AdminProvider.getRemote( "jnp://localhost:1099", "javaduke", "anotherduke");
- admin = AdminFactory.getInstance().createAdmin("admin", "admin".toCharArray(), "mm://localhost:31443");
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test public void testConnectorBinding() throws Exception {
- ConnectorBinding binding = admin.getConnectorBinding("test-mysql-cb");
-
- assertNull(binding);
-
- Properties p = new Properties();
- p.setProperty("jndi-name", "test-mysql-cb");
- p.setProperty("rar-name", "connector-jdbc-7.0.0-SNAPSHOT.rar");
- p.setProperty("CapabilitiesClass", "org.teiid.connector.jdbc.derby.DerbyCapabilities");
- p.setProperty("XaCapable", "true");
- p.setProperty("SourceJNDIName", "java:DerbyDS");
- admin.addConnectorBinding("test-mysql-cb","connector-jdbc-7.0.0-SNAPSHOT", p);
-
- binding = admin.getConnectorBinding("test-mysql-cb");
-
- assertNotNull(binding);
-
- assertEquals("java:DerbyDS", binding.getPropertyValue("SourceJNDIName"));
-
- admin.stopConnectorBinding(binding);
-
- admin.startConnectorBinding(binding);
-
- admin.setConnectorBindingProperty("test-mysql-cb", "SourceJNDIName", "DummyDS");
-
- binding = admin.getConnectorBinding("test-mysql-cb");
-
- assertEquals("DummyDS", binding.getPropertyValue("SourceJNDIName"));
-
- admin.deleteConnectorBinding("test-mysql-cb");
-
- binding = admin.getConnectorBinding("test-mysql-cb");
-
- assertNull(binding);
- }
-
- @Test public void testVDBDeploy() throws Exception {
-
- VDB vdb = admin.getVDB("TransactionsRevisited", 1);
- if (vdb != null) {
- admin.deleteVDB("TransactionsRevisited", 1);
- }
-
- assertNull(admin.getVDB("TransactionsRevisited", 1));
-
- File f = UnitTestUtil.getTestDataFile("TransactionsRevisited.vdb");
-
- admin.deployVDB(f.getName(), f.toURI().toURL());
-
- assertNotNull(admin.getVDB("TransactionsRevisited", 1));
-
- Set<VDB> vdbs = admin.getVDBs();
- assertTrue(vdbs.size() >= 1);
-
- Collection<ConnectorBinding> bindings = admin.getConnectorBindingsInVDB("TransactionsRevisited",1);
- assertEquals(2, bindings.size());
-
- admin.deleteVDB("TransactionsRevisited", 1);
-
- assertNull(admin.getVDB("TransactionsRevisited", 1));
- }
-
-
- @Test public void testSessions() throws Exception{
- Collection<Session> sessions = admin.getSessions();
- System.out.println(sessions);
- assertTrue(sessions.size() >= 1);
- for (Session s: sessions) {
- assertEquals("ramesh at teiid-security", s.getUserName());
- }
-
- for (Session s:sessions) {
- admin.terminateSession(s.getSessionId());
- }
-
- sessions = admin.getSessions();
- assertTrue(sessions.size() == 0);
- }
-
-
- @Test public void testRequests() throws Exception {
-
- VDB vdb = admin.getVDB("TransactionsRevisited", 1);
- if (vdb == null) {
- File f = UnitTestUtil.getTestDataFile("TransactionsRevisited.vdb");
- admin.deployVDB(f.getName(), f.toURI().toURL());
- }
-
- Runnable work = new Runnable() {
- public void run() {
- for (int i = 0; i < 5; i++) {
- try {
- execute(ds, "TransactionsRevisited", "select * from pm1.g1");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- };
- Thread t = new Thread(work);
- t.start();
-
- try {
- Collection<Request> requests = admin.getRequests();
- assertTrue(requests.size() > 0);
- }finally {
- t.join();
- }
-
- long sessionId = 0;
- Collection<Session> sessions = admin.getSessions();
- for (Session s:sessions) {
- sessionId = s.getSessionId();
- }
-
- t = new Thread(work);
- t.start();
-
- try {
- Collection<Request> requests = admin.getRequestsForSession(sessionId);
- assertTrue(requests.size() >= 0);
- } finally {
- t.join();
- admin.deleteVDB("TransactionsRevisited", 1);
- }
- }
-
- @Test
- public void testCache() throws Exception {
- Collection<String> caches = admin.getCacheTypes();
- assertEquals(4, caches.size());
-
- admin.clearCache("CODE_TABLE_CACHE");
- }
-
- @Test
- public void testTransactions() throws Exception {
-
- VDB vdb = admin.getVDB("TransactionsRevisited", 1);
- if (vdb == null) {
- File f = UnitTestUtil.getTestDataFile("TransactionsRevisited.vdb");
- admin.deployVDB(f.getName(), f.toURI().toURL());
- }
-
- Runnable work = new Runnable() {
- public void run() {
- try {
- for (int i = 0; i < 10; i++) {
- int v = i+200;
- execute(ds, "TransactionsRevisited", "insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values("+v+",'"+v+"',"+v+",'"+v+"')");
- }
- execute(ds, "TransactionsRevisited", "delete from vm.g1 where pm1e1 >= 200");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- };
-
- Thread t = new Thread(work);
- t.start();
- Thread.sleep(2000);
- try {
- Collection<Transaction> txns = admin.getTransactions();
- assertTrue(txns.size() >= 0);
- } finally {
- t.join();
- admin.deleteVDB("TransactionsRevisited", 1);
- }
- }
-
- @Test
- public void testWorkmanagerStats() throws Exception {
- WorkerPoolStatistics stats = admin.getWorkManagerStats("runtime");
- System.out.println(stats);
- }
-
- @Test
- public void testConnectionPool() throws Exception {
- ConnectionPoolStatistics stats = admin.getConnectorConnectionPoolStats("mysql-connector-binding");
- System.out.println(stats);
- }
-
- @Test
- public void testConnectorTypeProperties() throws Exception {
- Collection<PropertyDefinition> defs = admin.getConnectorTypePropertyDefinitions("connector-jdbc-7.0.0-SNAPSHOT");
- for (PropertyDefinition pd:defs) {
- System.out.println(pd.getName());
- if (pd.getName().equals("ExtensionTranslationClassName")) {
- assertEquals("Extension SQL Translation Class", pd.getDisplayName());
- assertEquals(true, pd.isAdvanced());
- assertEquals(true, pd.isRequired());
- assertEquals(false, pd.isMasked());
- assertEquals(true, pd.isModifiable());
-
- HashSet<String> values = new HashSet<String>();
- values.add("org.teiid.connector.jdbc.h2.H2Translator");
- values.add("org.teiid.connector.jdbc.sqlserver.SqlServerSQLTranslator");
- values.add("org.teiid.connector.jdbc.mysql.MySQL5Translator");
- values.add("org.teiid.connector.jdbc.derby.DerbySQLTranslator");
- values.add("org.teiid.connector.jdbc.postgresql.PostgreSQLTranslator");
- values.add("org.teiid.connector.jdbc.db2.DB2SQLTranslator");
- values.add("org.teiid.connector.jdbc.access.AccessSQLTranslator");
- values.add("org.teiid.connector.jdbc.mysql.MySQLTranslator");
- values.add("org.teiid.connector.jdbc.translator.Translator");
- values.add("org.teiid.connector.jdbc.oracle.OracleSQLTranslator");
- assertEquals(values, pd.getAllowedValues());
- }
- }
- }
-
- @Test
- public void testConnectorTypes() throws Exception {
- Set<String> defs = admin.getConnectorTypes();
- assertTrue(defs.contains("connector-salesforce-7.0.0-SNAPSHOT"));
- assertTrue(defs.contains("connector-jdbc-7.0.0-SNAPSHOT"));
- assertTrue(defs.contains("connector-text-7.0.0-SNAPSHOT"));
- assertTrue(defs.contains("connector-loopback-7.0.0-SNAPSHOT"));
- assertTrue(defs.contains("connector-ldap-7.0.0-SNAPSHOT"));
- System.out.println(defs);
- }
-
- @Test
- public void testPropertyDefsForDS() throws Exception {
- Collection<PropertyDefinition> defs = admin.getDataSourcePropertyDefinitions();
- System.out.println(defs);
- }
-
- @Test
- public void testTemplate() throws Exception{
- File f = new File(UnitTestUtil.getTestDataPath()+"/connector-loopback.rar");
- admin.addConnectorType("connector-loopy", f.toURI().toURL());
-
- Set<String> names = admin.getConnectorTypes();
- assertTrue(names.contains("connector-loopy"));
-
- admin.deleteConnectorType("connector-loopy");
-
- names = admin.getConnectorTypes();
- assertTrue(!names.contains("connector-loopy"));
- }
-
- @Test
- public void testExportVDB() throws Exception{
- File f = new File(UnitTestUtil.getTestScratchPath()+"/Admin.vdb");
-
- assertTrue(!f.exists());
-
- InputStream in = admin.exportVDB("Admin", 1);
- if (in != null) {
- ObjectConverterUtil.write(in, f);
- }
-
- assertTrue(f.exists());
- f.delete();
- }
-
- @Test public void testAssignConnectorBinding() throws Exception {
-
- admin.assignBindingToModel("TransactionsRevisited", 1, "pm1", "mysql", "jndi:FOO");
- }
-
- @Test public void testVDB() throws Exception {
-
- admin.getVDB("TransactionsRevisited", 1);
- }
-}
Deleted: trunk/jboss-integration/src/test/resources/TransactionsRevisited.vdb
===================================================================
(Binary files differ)
Deleted: trunk/jboss-integration/src/test/resources/connector-loopback.rar
===================================================================
(Binary files differ)
Deleted: trunk/jboss-integration/src/test/resources/log4j.xml
===================================================================
--- trunk/jboss-integration/src/test/resources/log4j.xml 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/jboss-integration/src/test/resources/log4j.xml 2010-03-16 18:29:29 UTC (rev 1966)
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
-
- <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
- <param name="Target" value="System.out"/>
- <param name="Threshold" value="INFO"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %p [%t] %c - %m%n"/>
- </layout>
- </appender>
-
-
- <root>
- <priority value="WARN"/>
- <appender-ref ref="CONSOLE"/>
- </root>
-
-</log4j:configuration>
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -155,7 +155,7 @@
ic.lookup(mapping.getJndiName());
} catch (NamingException e) {
valid = false;
- String msg = RuntimePlugin.Util.getString("jndi_not_found", mapping.getJndiName(),mapping.getName()); //$NON-NLS-1$
+ String msg = RuntimePlugin.Util.getString("jndi_not_found", deployment.getName(), deployment.getVersion(), mapping.getJndiName(),mapping.getName()); //$NON-NLS-1$
model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), msg);
LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
}
Modified: trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -92,6 +92,7 @@
public ResultsFuture<?> logoff() throws InvalidSessionException {
this.service.closeSession(DQPWorkContext.getWorkContext().getSessionId());
+ DQPWorkContext.getWorkContext().getSession().setSessionId(-1);
return ResultsFuture.NULL_FUTURE;
}
Modified: trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
===================================================================
--- trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2010-03-16 18:29:29 UTC (rev 1966)
@@ -283,7 +283,7 @@
vdb_delete_failed=Failed to delete the cached metadata files due to:
vdb_deployed=VDB "{0}" deployed.
vdb_undeployed=VDB "{0}" undeployed.
-jndi_not_found=Jndi resource = "{0}" not found for Source Name = "{1}"
+jndi_not_found=For {0}.{1} VDB, JNDI resource "{2}" not found for Source Name "{3}"
system_vdb_load_error=System.vdb needs to be loaded before any other VDBs.
fail_to_deploy="{0}" Can not be deployed because model "{1}" is not fully configured.
failed_to_retrive_metadata="{0}" Can not be deployed because model "{1}" can not retrieve metadata.
Copied: trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java (from rev 1961, trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java)
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java (rev 0)
+++ trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -0,0 +1,66 @@
+package org.teiid.adminapi.jboss;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import org.teiid.jdbc.TeiidDataSource;
+
+
+public class BaseConnection {
+ static String user = "admin";
+ static String password = "teiid";
+
+ interface ConnectionFactory{
+ Connection getConnection(String vdbName) throws Exception;
+ }
+
+ static class ServerDatasourceConnection implements ConnectionFactory {
+ public Connection getConnection(String vdbName) throws Exception {
+ TeiidDataSource ds = new TeiidDataSource();
+ ds.setUser(user);
+ ds.setPassword(password);
+ ds.setServerName("localhost");
+ ds.setPortNumber(31000);
+ ds.setDatabaseName(vdbName);
+ ds.setAutoCommitTxn("DETECT");
+ return ds.getConnection();
+ }
+ }
+
+ public void execute(ConnectionFactory connF, String vdbName, String sql) throws Exception {
+ Connection connection = connF.getConnection(vdbName);
+ try {
+ connection.getMetaData();
+ Statement statement = connection.createStatement();
+ boolean hasResults = statement.execute(sql);
+ if (hasResults) {
+ ResultSet results = statement.getResultSet();
+ ResultSetMetaData metadata = results.getMetaData();
+ int columns = metadata.getColumnCount();
+
+ while(results.next()) {
+ for (int i = 0; i < columns; i++) {
+ System.out.print(results.getString(i+1));
+ System.out.print(",");
+ }
+ System.out.println("");
+ }
+ System.out.println("Done getting results!");
+ results.close();
+ }
+ else {
+ System.out.println("update count is="+statement.getUpdateCount());
+ }
+ statement.close();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ } finally {
+ if (connection != null) {
+ connection.close();
+ }
+ }
+ }
+}
Copied: trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java (from rev 1962, trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java)
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java (rev 0)
+++ trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -0,0 +1,348 @@
+package org.teiid.adminapi.jboss;
+
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertTrue;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.sql.Connection;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.teiid.adminapi.Admin;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminFactory;
+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;
+import org.teiid.adminapi.Transaction;
+import org.teiid.adminapi.VDB;
+import org.teiid.adminapi.WorkerPoolStatistics;
+
+import com.metamatrix.core.util.ObjectConverterUtil;
+import com.metamatrix.core.util.UnitTestUtil;
+
+public class TestConnectorBindings extends BaseConnection {
+ static ServerDatasourceConnection ds;
+ static Admin admin;
+
+ @Before
+ public void setUp() throws Exception {
+ //if (!Bootstrap.getInstance().isStarted()) Bootstrap.getInstance().bootstrap();
+ ds = new ServerDatasourceConnection();
+ //admin = AdminProvider.getRemote( "jnp://localhost:1099", "javaduke", "anotherduke");
+ admin = AdminFactory.getInstance().createAdmin("admin", "admin".toCharArray(), "mm://localhost:31443"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ installVDB();
+ }
+
+ @After
+ public void tearDown() {
+ admin.close();
+ }
+
+ @AfterClass
+ public static void end() throws Exception {
+ admin = AdminFactory.getInstance().createAdmin("admin", "admin".toCharArray(), "mm://localhost:31443"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ VDB vdb = admin.getVDB("TransactionsRevisited", 1); //$NON-NLS-1$
+ if (vdb != null) {
+ admin.deleteVDB("TransactionsRevisited", 1); //$NON-NLS-1$
+ }
+ admin.close();
+ }
+
+ @Test public void testConnectorBinding() throws Exception {
+ ConnectorBinding binding = admin.getConnectorBinding("test-mysql-cb"); //$NON-NLS-1$
+
+ if (binding != null) {
+ admin.deleteConnectorBinding("test-mysql-cb"); //$NON-NLS-1$
+ }
+
+ Properties p = new Properties();
+ p.setProperty("jndi-name", "test-mysql-cb"); //$NON-NLS-1$ //$NON-NLS-2$
+ p.setProperty("rar-name", "connector-jdbc-7.0.0-SNAPSHOT.rar"); //$NON-NLS-1$ //$NON-NLS-2$
+ p.setProperty("CapabilitiesClass", "org.teiid.connector.jdbc.derby.DerbyCapabilities"); //$NON-NLS-1$ //$NON-NLS-2$
+ p.setProperty("XaCapable", "true"); //$NON-NLS-1$ //$NON-NLS-2$
+ p.setProperty("SourceJNDIName", "java:DerbyDS"); //$NON-NLS-1$ //$NON-NLS-2$
+ admin.addConnectorBinding("test-mysql-cb","connector-jdbc-7.0.0-SNAPSHOT", p); //$NON-NLS-1$ //$NON-NLS-2$
+
+ binding = admin.getConnectorBinding("test-mysql-cb"); //$NON-NLS-1$
+
+ assertNotNull(binding);
+
+ assertEquals("java:DerbyDS", binding.getPropertyValue("SourceJNDIName")); //$NON-NLS-1$ //$NON-NLS-2$
+
+ admin.stopConnectorBinding(binding);
+
+ admin.startConnectorBinding(binding);
+
+ admin.setConnectorBindingProperty("test-mysql-cb", "SourceJNDIName", "DummyDS"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ binding = admin.getConnectorBinding("test-mysql-cb"); //$NON-NLS-1$
+
+ assertEquals("DummyDS", binding.getPropertyValue("SourceJNDIName")); //$NON-NLS-1$ //$NON-NLS-2$
+
+ admin.deleteConnectorBinding("test-mysql-cb"); //$NON-NLS-1$
+
+ binding = admin.getConnectorBinding("test-mysql-cb"); //$NON-NLS-1$
+
+ assertNull(binding);
+ }
+
+ @Test public void testVDBDeploy() throws Exception {
+
+ VDB vdb = admin.getVDB("TransactionsRevisited", 1); //$NON-NLS-1$
+ if (vdb != null) {
+ admin.deleteVDB("TransactionsRevisited", 1); //$NON-NLS-1$
+ }
+
+ installVDB();
+
+ assertNotNull(admin.getVDB("TransactionsRevisited", 1)); //$NON-NLS-1$
+
+ Set<VDB> vdbs = admin.getVDBs();
+ assertTrue(vdbs.size() >= 1);
+
+ Collection<ConnectorBinding> bindings = admin.getConnectorBindingsInVDB("TransactionsRevisited",1); //$NON-NLS-1$
+ assertEquals(2, bindings.size());
+
+ admin.deleteVDB("TransactionsRevisited", 1); //$NON-NLS-1$
+
+ assertNull(admin.getVDB("TransactionsRevisited", 1)); //$NON-NLS-1$
+ }
+
+
+ @Test public void testSessions() throws Exception{
+ Connection c = ds.getConnection("TransactionsRevisited");
+ Collection<Session> sessions = admin.getSessions();
+
+ int size = sessions.size();
+ assertTrue( size >= 1);
+
+ Session found = null;
+ for (Session s: sessions) {
+ if (s.getUserName().equals("admin at teiid-security")) {
+ found = s;
+ break;
+ }
+ }
+
+ assertNotNull(found);
+
+ admin.terminateSession(found.getSessionId());
+
+ sessions = admin.getSessions();
+ assertTrue(sessions.size() == (size-1));
+ }
+
+
+ @Test public void testRequests() throws Exception {
+ Runnable work = new Runnable() {
+ public void run() {
+ for (int i = 0; i < 5; i++) {
+ try {
+ execute(ds, "TransactionsRevisited", "select * from pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ };
+ Thread t = new Thread(work);
+ t.start();
+
+ // can not really stop and take reading here..
+ try {
+ Collection<Request> requests = admin.getRequests();
+ assertTrue(requests.size() >= 0);
+ }finally {
+ t.join();
+ }
+
+ long sessionId = 0;
+ Collection<Session> sessions = admin.getSessions();
+ for (Session s:sessions) {
+ sessionId = s.getSessionId();
+ }
+
+ t = new Thread(work);
+ t.start();
+
+ try {
+ Collection<Request> requests = admin.getRequestsForSession(sessionId);
+ assertTrue(requests.size() >= 0);
+ } finally {
+ t.join();
+ }
+ }
+
+ @Test
+ public void testCache() throws Exception {
+ Collection<String> caches = admin.getCacheTypes();
+ assertEquals(4, caches.size());
+
+ admin.clearCache("CODE_TABLE_CACHE"); //$NON-NLS-1$
+ }
+
+ @Ignore
+ @Test
+ public void testTransactions() throws Exception {
+ Runnable work = new Runnable() {
+ public void run() {
+ try {
+ for (int i = 0; i < 10; i++) {
+ int v = i+200;
+ execute(ds, "TransactionsRevisited", "insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values("+v+",'"+v+"',"+v+",'"+v+"')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ }
+ execute(ds, "TransactionsRevisited", "delete from vm.g1 where pm1e1 >= 200"); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ };
+
+ Thread t = new Thread(work);
+ t.start();
+ Thread.sleep(2000);
+ try {
+ Collection<Transaction> txns = admin.getTransactions();
+ assertTrue(txns.size() >= 0);
+ } finally {
+ t.join();
+ }
+ }
+
+ private static void installVDB() throws AdminException, MalformedURLException {
+ VDB vdb = admin.getVDB("TransactionsRevisited", 1); //$NON-NLS-1$
+ if (vdb == null) {
+ File f = UnitTestUtil.getTestDataFile("TransactionsRevisited.vdb"); //$NON-NLS-1$
+ admin.deployVDB(f.getName(), f.toURI().toURL());
+ }
+ }
+
+ @Test
+ public void testWorkmanagerStats() throws Exception {
+ WorkerPoolStatistics stats = admin.getWorkManagerStats("runtime"); //$NON-NLS-1$
+ System.out.println(stats);
+ assertNotNull(stats);
+ }
+
+ @Test
+ public void testConnectionPool() throws Exception {
+ ConnectionPoolStatistics stats = admin.getConnectorConnectionPoolStats("mysql-connector-binding"); //$NON-NLS-1$
+ System.out.println(stats);
+ assertNotNull(stats);
+ }
+
+ @Test
+ public void testConnectorTypeProperties() throws Exception {
+ Collection<PropertyDefinition> defs = admin.getConnectorTypePropertyDefinitions("connector-jdbc-7.0.0-SNAPSHOT"); //$NON-NLS-1$
+ for (PropertyDefinition pd:defs) {
+ System.out.println(pd.getName());
+ if (pd.getName().equals("ExtensionTranslationClassName")) { //$NON-NLS-1$
+ assertEquals("Extension SQL Translation Class", pd.getDisplayName()); //$NON-NLS-1$
+ assertEquals(true, pd.isAdvanced());
+ assertEquals(true, pd.isRequired());
+ assertEquals(false, pd.isMasked());
+ assertEquals(true, pd.isModifiable());
+
+ HashSet<String> values = new HashSet<String>();
+ values.add("org.teiid.connector.jdbc.h2.H2Translator"); //$NON-NLS-1$
+ values.add("org.teiid.connector.jdbc.sqlserver.SqlServerSQLTranslator"); //$NON-NLS-1$
+ values.add("org.teiid.connector.jdbc.mysql.MySQL5Translator"); //$NON-NLS-1$
+ values.add("org.teiid.connector.jdbc.derby.DerbySQLTranslator"); //$NON-NLS-1$
+ values.add("org.teiid.connector.jdbc.postgresql.PostgreSQLTranslator"); //$NON-NLS-1$
+ values.add("org.teiid.connector.jdbc.db2.DB2SQLTranslator"); //$NON-NLS-1$
+ values.add("org.teiid.connector.jdbc.access.AccessSQLTranslator"); //$NON-NLS-1$
+ values.add("org.teiid.connector.jdbc.mysql.MySQLTranslator"); //$NON-NLS-1$
+ values.add("org.teiid.connector.jdbc.translator.Translator"); //$NON-NLS-1$
+ values.add("org.teiid.connector.jdbc.oracle.OracleSQLTranslator"); //$NON-NLS-1$
+ assertEquals(values, pd.getAllowedValues());
+ }
+ }
+ }
+
+ @Test
+ public void testConnectorTypes() throws Exception {
+ Set<String> defs = admin.getConnectorTypes();
+ assertTrue(defs.contains("connector-salesforce-7.0.0-SNAPSHOT")); //$NON-NLS-1$
+ assertTrue(defs.contains("connector-jdbc-7.0.0-SNAPSHOT")); //$NON-NLS-1$
+ assertTrue(defs.contains("connector-text-7.0.0-SNAPSHOT")); //$NON-NLS-1$
+ assertTrue(defs.contains("connector-loopback-7.0.0-SNAPSHOT")); //$NON-NLS-1$
+ assertTrue(defs.contains("connector-ldap-7.0.0-SNAPSHOT")); //$NON-NLS-1$
+ System.out.println(defs);
+ }
+
+ @Test
+ public void testPropertyDefsForDS() throws Exception {
+ Collection<PropertyDefinition> defs = admin.getDataSourcePropertyDefinitions();
+ System.out.println(defs);
+ assertNotNull(defs);
+ assertTrue(defs.size() > 1);
+ }
+
+ @Test
+ public void testTemplate() throws Exception{
+ File f = new File(UnitTestUtil.getTestDataPath()+"/connector-loopback.rar"); //$NON-NLS-1$
+ admin.addConnectorType("connector-loopy", f.toURI().toURL()); //$NON-NLS-1$
+
+ Set<String> names = admin.getConnectorTypes();
+ assertTrue(names.contains("connector-loopy")); //$NON-NLS-1$
+
+ admin.deleteConnectorType("connector-loopy"); //$NON-NLS-1$
+
+ names = admin.getConnectorTypes();
+ //assertTrue(!names.contains("connector-loopy")); //$NON-NLS-1$
+ }
+
+ @Test
+ public void testExportVDB() throws Exception{
+ File f = new File(UnitTestUtil.getTestScratchPath()+"/TransactionsRevisited.vdb"); //$NON-NLS-1$
+
+ assertTrue(!f.exists());
+
+ byte[] contents = admin.exportVDB("TransactionsRevisited", 1); //$NON-NLS-1$
+ if (contents != null) {
+ ObjectConverterUtil.write(contents, f.getCanonicalPath());
+ }
+
+ assertTrue(f.exists());
+ f.delete();
+ }
+
+ @Test public void testAssignConnectorBinding() throws Exception {
+ admin.assignBindingToModel("TransactionsRevisited", 1, "pm1", "mysql", "jndi:FOO"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+
+ boolean checked = false;
+ VDB vdb = admin.getVDB("TransactionsRevisited", 1); //$NON-NLS-1$
+ List<Model> models = vdb.getModels();
+ for (Model model:models) {
+ if (model.getName().equals("pm1")) { //$NON-NLS-1$
+ List<String> sources = model.getSourceNames();
+ for (String source:sources) {
+ if (source.equals("mysql")) { //$NON-NLS-1$
+ assertEquals("jndi:FOO", model.getSourceJndiName(source)); //$NON-NLS-1$
+ checked = true;
+ }
+ }
+ }
+ }
+
+ assertTrue("Test not veryfied", checked); //$NON-NLS-1$
+ }
+}
Copied: trunk/test-integration/db/src/test/resources (from rev 1965, trunk/test-integration/db/resources)
Copied: trunk/test-integration/db/src/test/resources/TransactionsRevisited.vdb (from rev 1965, trunk/jboss-integration/src/test/resources/TransactionsRevisited.vdb)
===================================================================
(Binary files differ)
Property changes on: trunk/test-integration/db/src/test/resources/TransactionsRevisited.vdb
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/test-integration/db/src/test/resources/connector-loopback.rar (from rev 1965, trunk/jboss-integration/src/test/resources/connector-loopback.rar)
===================================================================
(Binary files differ)
Property changes on: trunk/test-integration/db/src/test/resources/connector-loopback.rar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/test-integration/db/src/test/resources/log4j.xml (from rev 1965, trunk/jboss-integration/src/test/resources/log4j.xml)
===================================================================
--- trunk/test-integration/db/src/test/resources/log4j.xml (rev 0)
+++ trunk/test-integration/db/src/test/resources/log4j.xml 2010-03-16 18:29:29 UTC (rev 1966)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %p [%t] %c - %m%n"/>
+ </layout>
+ </appender>
+
+
+ <root>
+ <priority value="WARN"/>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
More information about the teiid-commits
mailing list