[teiid-commits] teiid SVN: r3962 - in trunk: test-integration/common/src/test/java/org/teiid/arquillian and 1 other directory.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Mon Apr 2 15:12:17 EDT 2012
Author: rareddy
Date: 2012-04-02 15:12:16 -0400 (Mon, 02 Apr 2012)
New Revision: 3962
Modified:
trunk/admin/src/main/java/org/teiid/adminapi/AdminFactory.java
trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDeployment.java
trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDynamicViewDefinition.java
Log:
TEIID-1981: fixing the admin api methods
Modified: trunk/admin/src/main/java/org/teiid/adminapi/AdminFactory.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/AdminFactory.java 2012-04-02 16:16:52 UTC (rev 3961)
+++ trunk/admin/src/main/java/org/teiid/adminapi/AdminFactory.java 2012-04-02 19:12:16 UTC (rev 3962)
@@ -160,7 +160,8 @@
}
private class AdminImpl implements Admin{
- private static final String JAVA_CONTEXT = "java:/";
+ private static final String CLASS_NAME = "class-name";
+ private static final String JAVA_CONTEXT = "java:/";
private ModelControllerClient connection;
private boolean domainMode = false;
@@ -215,6 +216,10 @@
builder.addNode("connection-definitions", deploymentName); //$NON-NLS-1$ //$NON-NLS-2$
builder.setOperationName("add");
builder.addProperty("jndi-name", addJavaContext(deploymentName));
+ builder.addProperty("enabled", "true");
+ if (properties.getProperty(CLASS_NAME) != null) {
+ builder.addProperty(CLASS_NAME, properties.getProperty(CLASS_NAME));
+ }
request = builder.buildRequest();
} catch (OperationFormatException e) {
throw new IllegalStateException("Failed to build operation", e); //$NON-NLS-1$
@@ -226,6 +231,9 @@
Enumeration keys = properties.propertyNames();
while (keys.hasMoreElements()) {
String key = (String)keys.nextElement();
+ if (key.equals(CLASS_NAME)) {
+ continue;
+ }
addConfigProperty(deploymentName, key, properties.getProperty(key));
}
@@ -323,7 +331,7 @@
driverList.addAll(drivers);
}
} catch (Exception e) {
- throw new AdminProcessingException(e);
+ throw new AdminProcessingException(e.getMessage(), e);
}
}
else {
@@ -434,7 +442,7 @@
throw new AdminProcessingException(AdminPlugin.Event.TEIID70006, Util.getFailureDescription(outcome));
}
} catch (IOException e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70007, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70007, e, e.getMessage());
}
}
@@ -508,7 +516,7 @@
}
return true;
} catch (IOException e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70009, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70009, e, e.getMessage());
}
}
@@ -518,7 +526,7 @@
try {
request = buildUndeployRequest(deployedName);
} catch (OperationFormatException e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70010, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70010, e, e.getMessage());
}
execute(request);
}
@@ -609,9 +617,9 @@
}
return composite;
} catch (OperationFormatException e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70011, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70011, e, e.getMessage());
} catch (IOException e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70012, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70012, e, e.getMessage());
}
}
@@ -624,7 +632,7 @@
return getDomainAwareList(outcome, VDBMetadataMapper.CacheStatisticsMetadataMapper.INSTANCE);
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70013, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70013, e, e.getMessage());
}
return null;
}
@@ -642,7 +650,7 @@
return Util.getList(outcome);
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70014, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70014, e, e.getMessage());
}
return Collections.emptyList();
}
@@ -655,7 +663,7 @@
return Util.getList(outcome);
}
} catch (IOException e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70015, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70015, e, e.getMessage());
}
return Collections.emptyList();
@@ -762,7 +770,7 @@
return getDomainAwareList(outcome, VDBMetadataMapper.WorkerPoolStatisticsMetadataMapper.INSTANCE);
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70020, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70020, e, e.getMessage());
}
}
return null;
@@ -781,7 +789,7 @@
throw new AdminProcessingException(AdminPlugin.Event.TEIID70021, Util.getFailureDescription(outcome));
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70022, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70022, e, e.getMessage());
}
}
@@ -795,7 +803,7 @@
return getDomainAwareList(outcome, RequestMetadataMapper.INSTANCE);
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70023, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70023, e, e.getMessage());
}
}
return Collections.emptyList();
@@ -811,7 +819,7 @@
return getDomainAwareList(outcome, RequestMetadataMapper.INSTANCE);
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70024, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70024, e, e.getMessage());
}
}
return Collections.emptyList();
@@ -827,7 +835,7 @@
return getDomainAwareList(outcome, SessionMetadataMapper.INSTANCE);
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70025, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70025, e, e.getMessage());
}
}
return Collections.emptyList();
@@ -863,7 +871,7 @@
}
result = outcome.get("result");
} catch (IOException e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70027, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70027, e, e.getMessage());
}
}
else {
@@ -994,7 +1002,7 @@
return getDomainAwareList(outcome, TransactionMetadataMapper.INSTANCE);
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70028, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70028, e, e.getMessage());
}
}
return Collections.emptyList();
@@ -1012,7 +1020,7 @@
throw new AdminProcessingException(AdminPlugin.Event.TEIID70029, Util.getFailureDescription(outcome));
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70030, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70030, e, e.getMessage());
}
}
@@ -1028,7 +1036,7 @@
throw new AdminProcessingException(AdminPlugin.Event.TEIID70031, Util.getFailureDescription(outcome));
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70032, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70032, e, e.getMessage());
}
}
@@ -1042,15 +1050,21 @@
ModelNode outcome = this.connection.execute(request);
if (Util.isSuccess(outcome)) {
if (outcome.hasDefined("result")) {
- List<VDBTranslatorMetaData> list = getDomainAwareList(outcome, VDBMetadataMapper.VDBTranslatorMetaDataMapper.INSTANCE);
- if (list != null && !list.isEmpty()) {
- return list.get(0);
+ if (this.domainMode) {
+ List<VDBTranslatorMetaData> list = getDomainAwareList(outcome, VDBMetadataMapper.VDBTranslatorMetaDataMapper.INSTANCE);
+ if (list != null && !list.isEmpty()) {
+ return list.get(0);
+ }
}
+ else {
+ ModelNode result = outcome.get("result");
+ return VDBMetadataMapper.VDBTranslatorMetaDataMapper.INSTANCE.unwrap(result);
+ }
}
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70033, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70033, e, e.getMessage());
}
return null;
}
@@ -1064,7 +1078,7 @@
return getDomainAwareList(outcome, VDBMetadataMapper.VDBTranslatorMetaDataMapper.INSTANCE);
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70034, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70034, e, e.getMessage());
}
return Collections.emptyList();
@@ -1157,13 +1171,21 @@
try {
ModelNode outcome = this.connection.execute(request);
if (Util.isSuccess(outcome)) {
- List<VDBMetaData> list = getDomainAwareList(outcome, VDBMetadataMapper.INSTANCE);
- if (list != null && !list.isEmpty()) {
- return list.get(0);
+ if (this.domainMode) {
+ List<VDBMetaData> list = getDomainAwareList(outcome, VDBMetadataMapper.INSTANCE);
+ if (list != null && !list.isEmpty()) {
+ return list.get(0);
+ }
}
+ else {
+ if (outcome.hasDefined("result")) {
+ ModelNode result = outcome.get("result");
+ return VDBMetadataMapper.INSTANCE.unwrap(result);
+ }
+ }
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70035, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70035, e, e.getMessage());
}
return null;
}
@@ -1177,7 +1199,7 @@
return getDomainAwareList(outcome, VDBMetadataMapper.INSTANCE);
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70036, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70036, e, e.getMessage());
}
return Collections.emptyList();
@@ -1198,7 +1220,7 @@
throw new AdminProcessingException(AdminPlugin.Event.TEIID70037, Util.getFailureDescription(outcome));
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70038, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70038, e, e.getMessage());
}
}
@@ -1215,7 +1237,7 @@
throw new AdminProcessingException(AdminPlugin.Event.TEIID70039, Util.getFailureDescription(outcome));
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70040, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70040, e, e.getMessage());
}
}
@@ -1232,7 +1254,7 @@
throw new AdminProcessingException(AdminPlugin.Event.TEIID70041, Util.getFailureDescription(outcome));
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70042, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70042, e, e.getMessage());
}
}
@@ -1255,7 +1277,7 @@
throw new AdminProcessingException(AdminPlugin.Event.TEIID70043, Util.getFailureDescription(outcome));
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70044, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70044, e, e.getMessage());
}
}
@@ -1271,7 +1293,7 @@
throw new AdminProcessingException(AdminPlugin.Event.TEIID70045, Util.getFailureDescription(outcome));
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70046, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70046, e, e.getMessage());
}
}
@@ -1291,7 +1313,7 @@
throw new AdminProcessingException(AdminPlugin.Event.TEIID70047, Util.getFailureDescription(outcome));
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70048, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70048, e, e.getMessage());
}
}
@@ -1304,7 +1326,7 @@
throw new AdminProcessingException(AdminPlugin.Event.TEIID70049, Util.getFailureDescription(outcome));
}
} catch (Exception e) {
- throw new AdminProcessingException(AdminPlugin.Event.TEIID70050, e);
+ throw new AdminProcessingException(AdminPlugin.Event.TEIID70050, e, e.getMessage());
}
}
}
Modified: trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDeployment.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDeployment.java 2012-04-02 16:16:52 UTC (rev 3961)
+++ trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDeployment.java 2012-04-02 19:12:16 UTC (rev 3962)
@@ -320,10 +320,11 @@
@Test
public void getDatasourceTemplateNames() throws Exception {
- String[] array = {"teiid-connector-file.rar", "teiid-local", "teiid-connector-salesforce.rar", "teiid-connector-ldap.rar", "teiid-connector-ws.rar", "h2"};
+ String[] array = {"teiid-connector-file.rar", "teiid-local", "teiid", "teiid-connector-salesforce.rar", "teiid-connector-ldap.rar", "teiid-connector-ws.rar", "h2"};
try {
deployVdb();
Set<String> templates = admin.getDataSourceTemplateNames();
+ System.out.println(templates);
assertArrayEquals(array, templates.toArray(new String[templates.size()]));
} finally {
undeploy();
Modified: trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDynamicViewDefinition.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDynamicViewDefinition.java 2012-04-02 16:16:52 UTC (rev 3961)
+++ trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDynamicViewDefinition.java 2012-04-02 19:12:16 UTC (rev 3962)
@@ -10,11 +10,9 @@
import org.junit.runner.RunWith;
import org.teiid.adminapi.Admin;
import org.teiid.adminapi.AdminFactory;
-import org.teiid.adminapi.VDB;
import org.teiid.core.util.UnitTestUtil;
import org.teiid.jdbc.AbstractMMQueryTestCase;
import org.teiid.jdbc.TeiidDriver;
-import org.teiid.jdbc.TestMMDatabaseMetaData;
@RunWith(Arquillian.class)
@SuppressWarnings("nls")
@@ -40,20 +38,11 @@
Properties props = new Properties();
props.setProperty("ParentDirectory", "../docs/teiid/examples/dynamicvdb-portfolio/data");
props.setProperty("AllowParentPaths", "true");
+ props.setProperty("class-name", "org.teiid.resource.adapter.file.FileManagedConnectionFactory");
admin.createDataSource("marketdata-file", "teiid-connector-file.rar", props);
- int count = 0;
- while (count < 10) {
- VDB vdb = admin.getVDB("dynamic", 1);
- if (vdb == null || vdb.getStatus() != VDB.Status.ACTIVE) {
- Thread.sleep(500);
- count++;
- }
- else {
- break;
- }
- }
+ Thread.sleep(3000);
this.internalConnection = TeiidDriver.getInstance().connect("jdbc:teiid:dynamic at mm://localhost:31000;user=user;password=user", null);
@@ -61,6 +50,8 @@
//TestMMDatabaseMetaData.compareResultSet("TestDymamicImportedMetaData/columns", this.internalResultSet);
admin.undeploy("dynamicview-vdb.xml");
+
+ admin.deleteDataSource("marketdata-file");
}
}
More information about the teiid-commits
mailing list