Author: rareddy
Date: 2012-03-09 07:32:32 -0500 (Fri, 09 Mar 2012)
New Revision: 3925
Added:
trunk/test-integration/common/src/test/resources/TestDymamicImportedMetaData/
trunk/test-integration/common/src/test/resources/TestDymamicImportedMetaData/columns.expected
Modified:
trunk/admin/src/main/java/org/teiid/adminapi/AdminFactory.java
trunk/build/kits/jboss-as7/docs/teiid/datasources/file/create-ds.cli
trunk/build/kits/jboss-as7/docs/teiid/datasources/web-service/create-ws-ds.cli
trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.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-1280: Adding implementation for providing the DDL based view definitions and also
flexible metadata repository plug-in architecture.
Modified: trunk/admin/src/main/java/org/teiid/adminapi/AdminFactory.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/AdminFactory.java 2012-03-08 22:48:30 UTC
(rev 3924)
+++ trunk/admin/src/main/java/org/teiid/adminapi/AdminFactory.java 2012-03-09 12:32:32 UTC
(rev 3925)
@@ -197,23 +197,21 @@
}
}
- private void createConnectionFactory(String deploymentName, String templateName,
Properties properties) throws AdminException {
- Set<String> resourceAdapters = getDeployedResourceAdapterNames();
- if (!resourceAdapters.contains(templateName)) {
- addResourceAdapter(templateName);
- }
+ private void createConnectionFactory(String deploymentName, String rarName, Properties
properties) throws AdminException {
+
+ ///subsystem=resource-adapters/resource-adapter=fileDS:add
+ addResourceAdapter(deploymentName, rarName);
- ///subsystem=resource-adapters/resource-adapter=teiid-connector-file.rar/connection-definitions=fooDS:add(class-name=org.teiid.resource.adapter.file.FileManagedConnectionFactory,
jndi-name=java\:\/fooDS, pool-name=foo-pool)
+ ///subsystem=resource-adapters/resource-adapter=fileDS/connection-definitions=fileDS:add(jndi-name=java\:\/fooDS)
DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
final ModelNode request;
try {
builder.addNode("subsystem", "resource-adapters");
//$NON-NLS-1$ //$NON-NLS-2$
- builder.addNode("resource-adapter", templateName); //$NON-NLS-1$
//$NON-NLS-2$
+ builder.addNode("resource-adapter", deploymentName); //$NON-NLS-1$
//$NON-NLS-2$
builder.addNode("connection-definitions", deploymentName);
//$NON-NLS-1$ //$NON-NLS-2$
builder.setOperationName("add");
builder.addProperty("jndi-name", addJavaContext(deploymentName));
- builder.addProperty("pool-name", deploymentName);
request = builder.buildRequest();
} catch (OperationFormatException e) {
throw new IllegalStateException("Failed to build operation", e);
//$NON-NLS-1$
@@ -225,17 +223,19 @@
Enumeration keys = properties.propertyNames();
while (keys.hasMoreElements()) {
String key = (String)keys.nextElement();
- addConfigProperty(templateName, deploymentName, key,
properties.getProperty(key));
+ addConfigProperty(deploymentName, key, properties.getProperty(key));
}
+
+ activateConnectionFactory(deploymentName);
}
- //
/subsystem=resource-adapters/resource-adapter=teiid-connector-file.rar/connection-definitions=fooDS/config-properties=ParentDirectory2:add(value=/home/rareddy/testing)
- private void addConfigProperty(String templateName, String deploymentName, String key,
String value) throws AdminProcessingException {
+ //
/subsystem=resource-adapters/resource-adapter=fileDS/connection-definitions=fileDS/config-properties=ParentDirectory2:add(value=/home/rareddy/testing)
+ private void addConfigProperty(String deploymentName, String key, String value) throws
AdminProcessingException {
DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
final ModelNode request;
try {
builder.addNode("subsystem", "resource-adapters");
//$NON-NLS-1$ //$NON-NLS-2$
- builder.addNode("resource-adapter", templateName); //$NON-NLS-1$
//$NON-NLS-2$
+ builder.addNode("resource-adapter", deploymentName); //$NON-NLS-1$
//$NON-NLS-2$
builder.addNode("connection-definitions", deploymentName);
//$NON-NLS-1$ //$NON-NLS-2$
builder.addNode("config-properties", key); //$NON-NLS-1$
//$NON-NLS-2$
builder.setOperationName("add");
@@ -247,15 +247,31 @@
execute(request);
}
+
+ // /subsystem=resource-adapters/resource-adapter=fileDS:activate
+ private void activateConnectionFactory(String deploymentName) throws
AdminProcessingException {
+ DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
+ final ModelNode request;
+ try {
+ builder.addNode("subsystem", "resource-adapters");
//$NON-NLS-1$ //$NON-NLS-2$
+ builder.addNode("resource-adapter", deploymentName); //$NON-NLS-1$
//$NON-NLS-2$
+ builder.setOperationName("activate");
+ request = builder.buildRequest();
+ } catch (OperationFormatException e) {
+ throw new IllegalStateException("Failed to build operation", e);
//$NON-NLS-1$
+ }
+
+ execute(request);
+ }
//
/subsystem=resource-adapters/resource-adapter=teiid-connector-ws.rar:add(archive=teiid-connector-ws.rar,
transaction-support=NoTransaction)
- private void addResourceAdapter(String rarName) throws AdminProcessingException {
+ private void addResourceAdapter(String deploymentName, String rarName) throws
AdminProcessingException {
DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
final ModelNode request;
try {
builder.addNode("subsystem", "resource-adapters");
//$NON-NLS-1$ //$NON-NLS-2$
- builder.addNode("resource-adapter", rarName); //$NON-NLS-1$
//$NON-NLS-2$
+ builder.addNode("resource-adapter", deploymentName); //$NON-NLS-1$
//$NON-NLS-2$
builder.setOperationName("add");
request = builder.buildRequest();
request.get("archive").set(rarName);
Modified: trunk/build/kits/jboss-as7/docs/teiid/datasources/file/create-ds.cli
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/file/create-ds.cli 2012-03-08
22:48:30 UTC (rev 3924)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/file/create-ds.cli 2012-03-09
12:32:32 UTC (rev 3925)
@@ -1,5 +1,5 @@
/subsystem=resource-adapters/resource-adapter=fileDS:add(archive=teiid-connector-file.rar,
transaction-support=NoTransaction)
/subsystem=resource-adapters/resource-adapter=fileDS/connection-definitions=fileDS:add(jndi-name=java:/fileDS,
class-name=org.teiid.resource.adapter.file.FileManagedConnectionFactory, enabled=true,
use-java-context=true)
-/subsystem=resource-adapters/resource-adapter=fileDS/connection-definitions=fileDS/config-properties=Parentdirectory:add(value=/home/rareddy/testing/)
+/subsystem=resource-adapters/resource-adapter=fileDS/connection-definitions=fileDS/config-properties=ParentDirectory:add(value=/home/rareddy/testing/)
/subsystem=resource-adapters/resource-adapter=fileDS/connection-definitions=fileDS/config-properties=AllowParentPaths:add(value=true)
-/subsystem=resource-adapters/resource-adapter=fileDS/connection-definitions=fileDS:enable
\ No newline at end of file
+/subsystem=resource-adapters/resource-adapter=fileDS:activate
\ No newline at end of file
Modified: trunk/build/kits/jboss-as7/docs/teiid/datasources/web-service/create-ws-ds.cli
===================================================================
---
trunk/build/kits/jboss-as7/docs/teiid/datasources/web-service/create-ws-ds.cli 2012-03-08
22:48:30 UTC (rev 3924)
+++
trunk/build/kits/jboss-as7/docs/teiid/datasources/web-service/create-ws-ds.cli 2012-03-09
12:32:32 UTC (rev 3925)
@@ -1,4 +1,4 @@
/subsystem=resource-adapters/resource-adapter=wsDS:add(archive=teiid-connector-ws.rar,
transaction-support=NoTransaction)
/subsystem=resource-adapters/resource-adapter=wsDS/connection-definitions=wsDS:add(jndi-name=java:/wsDS,
class-name=org.teiid.resource.adapter.ws.WSManagedConnectionFactory, enabled=true,
use-java-context=true)
/subsystem=resource-adapters/resource-adapter=wsDS/connection-definitions=wsDS/config-properties=EndPoint:add(value={end_point})
-/subsystem=resource-adapters/resource-adapter=wsDS/connection-definitions=wsDS:enable
\ No newline at end of file
+/subsystem=resource-adapters/resource-adapter=wsDS:activate
\ No newline at end of file
Modified: trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java 2012-03-08
22:48:30 UTC (rev 3924)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java 2012-03-09
12:32:32 UTC (rev 3925)
@@ -51,8 +51,8 @@
import org.teiid.query.report.ActivityReport;
import org.teiid.query.report.ReportItem;
import org.teiid.query.resolver.QueryResolver;
+import org.teiid.query.resolver.util.ResolverUtil;
import org.teiid.query.sql.lang.Command;
-import org.teiid.query.sql.lang.Query;
import org.teiid.query.sql.lang.QueryCommand;
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.symbol.GroupSymbol;
@@ -158,7 +158,9 @@
if (t.getSelectTransformation() == null) {
log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31079, t.getName(),
model.getName()));
}
- validate(vdb, model, t, store, report);
+ else {
+ validate(vdb, model, t, store, report);
+ }
}
}
@@ -167,7 +169,9 @@
if (p.getQueryPlan() == null) {
log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31081, p.getName(),
model.getName()));
}
- validate(vdb, model, p, store, report);
+ else {
+ validate(vdb, model, p, store, report);
+ }
}
}
}
@@ -209,12 +213,11 @@
}
}
- Query command = (Query)QueryParser.getQueryParser().parseCommand("SELECT *
FROM "+t.getFullName()); //$NON-NLS-1$
- QueryResolver.resolveCommand(command, metadata);
- GroupSymbol resolvedGroup = command.getFrom().getGroups().get(0);
+ GroupSymbol symbol = new GroupSymbol(t.getName(), t.getFullName());
+ ResolverUtil.resolveGroup(symbol, metadata);
// this seems to parse, resolve and validate.
- QueryResolver.resolveView(resolvedGroup, new
QueryNode(t.getSelectTransformation()), SQLConstants.Reserved.SELECT, metadata);
+ QueryResolver.resolveView(symbol, new QueryNode(t.getSelectTransformation()),
SQLConstants.Reserved.SELECT, metadata);
}
if(resolverReport != null && resolverReport.hasItems()) {
for (ValidatorFailure v:resolverReport.getItems()) {
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java 2012-03-08
22:48:30 UTC (rev 3924)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java 2012-03-09
12:32:32 UTC (rev 3925)
@@ -127,6 +127,9 @@
public OutputStream getVdbXmlOutputStream(VDBMetaData vdb) throws IOException {
File f = buildVdbXml(vdb);
+ if (!f.exists()) {
+ f.getParentFile().mkdirs();
+ }
return new FileOutputStream(f);
}
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2012-03-08
22:48:30 UTC (rev 3924)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2012-03-09
12:32:32 UTC (rev 3925)
@@ -58,7 +58,6 @@
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.metadata.MetadataRepository;
-import org.teiid.metadata.MetadataStore;
import org.teiid.metadata.index.IndexMetadataRepository;
import org.teiid.metadata.index.IndexMetadataStore;
import org.teiid.query.ObjectReplicator;
@@ -131,9 +130,6 @@
indexRepo = new IndexMetadataRepository(indexFactory);
}
- MetadataStore store = new MetadataStore();
- deployment.addAttchment(MetadataStore.class, store);
-
for (ModelMetaData model:deployment.getModelMetaDatas().values()) {
if (model.isSource() && model.getSourceNames().isEmpty()) {
throw new
DeploymentUnitProcessingException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50087,
model.getName(), deployment.getName(), deployment.getVersion()));
Modified: trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2012-03-08 22:48:30
UTC (rev 3924)
+++ trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2012-03-09 12:32:32
UTC (rev 3925)
@@ -32,13 +32,10 @@
import org.teiid.adminapi.Model;
import org.teiid.adminapi.impl.DataPolicyMetadata;
import org.teiid.adminapi.impl.ModelMetaData;
-import org.teiid.adminapi.impl.SourceMappingMetadata;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.core.CoreConstants;
import org.teiid.dqp.internal.datamgr.ConnectorManager;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
import org.teiid.metadata.AbstractMetadataRecord;
import org.teiid.metadata.Column;
import org.teiid.metadata.ColumnStats;
@@ -70,6 +67,7 @@
private MetadataStore[] additionalStores;
private ConnectorManagerRepository cmr;
private FunctionTree systemFunctions;
+ private boolean metadataloadFinished = false;
// used as cached item to avoid rebuilding
private VDBMetaData mergedVDB;
@@ -103,7 +101,7 @@
}
private synchronized void update() {
- if (this.mergedVDB == null) {
+ if (this.mergedVDB == null && this.metadataloadFinished) {
this.mergedVDB = buildVDB();
@@ -147,7 +145,7 @@
}
public synchronized VDBMetaData getVDB() {
- if (this.mergedVDB == null) {
+ if (this.mergedVDB == null && this.metadataloadFinished) {
update();
}
return this.mergedVDB;
@@ -341,4 +339,8 @@
}
metadataRepository.endLoadVdb(vdbName, vdbVersion);
}
+
+ public void setMetaloadFinished(boolean flag) {
+ this.metadataloadFinished = flag;
+ }
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2012-03-08 22:48:30
UTC (rev 3924)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2012-03-09 12:32:32
UTC (rev 3925)
@@ -246,6 +246,7 @@
CompositeVDB v = this.vdbRepo.get(new VDBKey(name, version));
if (v!= null) {
boolean valid = false;
+ v.setMetaloadFinished(true);
VDBMetaData metdataAwareVDB = v.getVDB();
ValidatorReport report = MetadataValidator.validate(metdataAwareVDB,
metdataAwareVDB.removeAttachment(MetadataStore.class));
@@ -258,7 +259,7 @@
// check the data sources available
if (valid) {
- valid = isValid(metdataAwareVDB);
+ valid = hasValidDataSources(metdataAwareVDB);
}
if (valid) {
@@ -273,7 +274,7 @@
}
}
- boolean isValid(VDBMetaData vdb) {
+ boolean hasValidDataSources(VDBMetaData vdb) {
ConnectorManagerRepository cmr = vdb.getAttachment(ConnectorManagerRepository.class);
for (ModelMetaData model:vdb.getModelMetaDatas().values()) {
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-03-08
22:48:30 UTC (rev 3924)
+++
trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDeployment.java 2012-03-09
12:32:32 UTC (rev 3925)
@@ -62,7 +62,6 @@
@Test
public void testVDBDeployment() throws Exception {
- boolean deployed = false;
try {
Set<?> vdbs = admin.getVDBs();
assertTrue(vdbs.isEmpty());
@@ -73,7 +72,6 @@
}
admin.deploy("bqt.vdb",new
FileInputStream(UnitTestUtil.getTestDataFile("bqt.vdb")));
- deployed = true;
vdbs = admin.getVDBs();
assertFalse(vdbs.isEmpty());
@@ -101,9 +99,7 @@
assertFalse(vdb.isValid());
assertTrue(vdb.getStatus().equals(Status.INACTIVE));
} finally {
- if (deployed) {
- admin.undeploy("bqt.vdb");
- }
+ undeploy();
}
}
@@ -111,7 +107,7 @@
public void testTraslators() throws Exception {
Collection<? extends Translator> translators = admin.getTranslators();
System.out.println(translators);
- assertEquals(28, translators.size());
+ assertEquals(29, translators.size());
JavaArchive jar = getLoopyArchive();
@@ -142,12 +138,9 @@
@Test
public void testVDBConnectionType() throws Exception {
- boolean vdbOneDeployed = false;
- boolean vdbTwoDeployed = false;
try {
admin.deploy("bqt.vdb", new
FileInputStream(UnitTestUtil.getTestDataFile("bqt.vdb")));
- vdbOneDeployed = true;
VDB vdb = admin.getVDB("bqt", 1);
Model model = vdb.getModels().get(0);
@@ -173,8 +166,6 @@
admin.deploy("bqt2.vdb", new
FileInputStream(UnitTestUtil.getTestDataFile("bqt2.vdb")));
admin.assignToModel("bqt", 2, model.getName(), "Source",
"h2", "java:jboss/datasources/ExampleDS");
- vdbTwoDeployed = true;
-
try {
Connection conn =
TeiidDriver.getInstance().connect("jdbc:teiid:bqt@mm://localhost:31000;user=user;password=user",
null);
conn.close();
@@ -197,10 +188,8 @@
assertEquals(ConnectionType.ANY, vdb.getConnectionType());
} finally {
- if (vdbOneDeployed) {
- admin.undeploy("bqt.vdb");
- }
- if (vdbTwoDeployed) {
+ undeploy();
+ if(admin.getVDB("bqt", 2) != null){
admin.undeploy("bqt2.vdb");
}
}
@@ -210,15 +199,13 @@
public void testCacheTypes() throws Exception {
String[] array = {Admin.Cache.PREPARED_PLAN_CACHE.toString(),
Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString()};
Collection<String> types = admin.getCacheTypes();
- System.out.println(types);
assertArrayEquals(array, types.toArray());
}
@Test
public void testSessions() throws Exception {
- boolean vdbOneDeployed = false;
try {
- vdbOneDeployed = deployVdb();
+ deployVdb();
Collection<? extends Session> sessions = admin.getSessions();
assertEquals (0, sessions.size());
@@ -255,10 +242,7 @@
}
} finally {
- if (vdbOneDeployed) {
- admin.undeploy("bqt.vdb");
- }
-
+ undeploy();
}
}
@@ -273,14 +257,20 @@
return vdbOneDeployed;
}
+ private void undeploy() throws Exception {
+ VDB vdb = admin.getVDB("bqt", 1);
+ if (vdb != null) {
+ admin.undeploy("bqt.vdb");
+ }
+ }
+
@Test
public void testGetRequests() throws Exception {
- boolean vdbOneDeployed = false;
JavaArchive jar = getLoopyArchive();
try {
admin.deploy("loopy.jar", jar.as(ZipExporter.class).exportAsInputStream());
- vdbOneDeployed = deployVdb();
+ deployVdb();
VDB vdb = admin.getVDB("bqt", 1);
Model model = vdb.getModels().get(0);
Translator t = admin.getTranslator("loopy");
@@ -324,33 +314,29 @@
} finally {
admin.undeploy("loopy.jar");
- if (vdbOneDeployed) {
- admin.undeploy("bqt.vdb");
- }
+ undeploy();
}
}
@Test
public void getDatasourceTemplateNames() throws Exception {
- String[] array = {"teiid-connector-file.rar",
"teiid-connector-salesforce.rar", "teiid-connector-ldap.rar",
"teiid-connector-ws.rar", "h2"};
- boolean vdbOneDeployed = false;
+ String[] array = {"teiid-connector-file.rar", "teiid-local",
"teiid-connector-salesforce.rar", "teiid-connector-ldap.rar",
"teiid-connector-ws.rar", "h2"};
try {
- vdbOneDeployed = deployVdb();
+ deployVdb();
Set<String> templates = admin.getDataSourceTemplateNames();
- assertArrayEquals(array, templates.toArray());
+ assertArrayEquals(array, templates.toArray(new String[templates.size()]));
} finally {
- if (vdbOneDeployed) {
- admin.undeploy("bqt.vdb");
- }
+ undeploy();
}
}
@Test
public void getTemplatePropertyDefinitions() throws Exception{
- boolean vdbOneDeployed = false;
try {
HashSet<String> props = new HashSet<String>();
- vdbOneDeployed = deployVdb();
+
+ deployVdb();
+
Collection<? extends PropertyDefinition> pds =
admin.getTemplatePropertyDefinitions("h2");
for(PropertyDefinition pd:pds) {
props.add(pd.getName());
@@ -372,31 +358,24 @@
assertTrue(rar_props.contains("AllowParentPaths"));
} finally {
- if (vdbOneDeployed) {
- admin.undeploy("bqt.vdb");
- }
+ undeploy();
}
}
@Test
public void getWorkerPoolStats() throws Exception{
- boolean vdbOneDeployed = false;
try {
- vdbOneDeployed = deployVdb();
+ deployVdb();
assertNotNull(admin.getWorkerPoolStats());
} finally {
- if (vdbOneDeployed) {
- admin.undeploy("bqt.vdb");
- }
+ undeploy();
}
}
@Test
public void testDataRoleMapping() throws Exception{
- boolean vdbOneDeployed = false;
try {
admin.deploy("bqt2.vdb", new
FileInputStream(UnitTestUtil.getTestDataFile("bqt2.vdb")));
- vdbOneDeployed = true;
VDB vdb = admin.getVDB("bqt", 2);
Model model = vdb.getModels().get(0);
@@ -442,11 +421,12 @@
assertFalse(dp.isAnyAuthenticated());
} finally {
- if (vdbOneDeployed) {
+ if (admin.getVDB("bqt", 2) != null) {
admin.undeploy("bqt2.vdb");
- }
+ }
}
}
+
}
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-03-08
22:48:30 UTC (rev 3924)
+++
trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDynamicViewDefinition.java 2012-03-09
12:32:32 UTC (rev 3925)
@@ -1,9 +1,6 @@
package org.teiid.arquillian;
-import static org.junit.Assert.*;
-
import java.io.FileInputStream;
-import java.sql.Connection;
import java.util.Properties;
import org.jboss.arquillian.junit.Arquillian;
@@ -13,13 +10,11 @@
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.FakeServer;
import org.teiid.jdbc.TeiidDriver;
import org.teiid.jdbc.TestMMDatabaseMetaData;
-import org.teiid.metadata.MetadataFactory;
-import org.teiid.metadata.Procedure;
@RunWith(Arquillian.class)
@SuppressWarnings("nls")
@@ -39,20 +34,33 @@
@Test
public void testViewDefinition() throws Exception {
+
+ admin.deploy("dynamicview-vdb.xml",new
FileInputStream(UnitTestUtil.getTestDataFile("dynamicview-vdb.xml")));
Properties props = new Properties();
props.setProperty("ParentDirectory",
"../docs/teiid/examples/dynamicvdb-portfolio/data");
props.setProperty("AllowParentPaths", "true");
+
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;
+ }
+ }
- admin.deploy("dynamicview-vdb.xml",new
FileInputStream(UnitTestUtil.getTestDataFile("dynamicview-vdb.xml")));
-
this.internalConnection =
TeiidDriver.getInstance().connect("jdbc:teiid:dynamic@mm://localhost:31000;user=user;password=user",
null);
- execute("select * FROM Portfolio.Stock Where SchemaName =
'portfolio'"); //$NON-NLS-1$
- TestMMDatabaseMetaData.compareResultSet("TestDymamicImportedMetaData/columns",
this.internalResultSet);
-
+ execute("SELECT * FROM Sys.Columns WHERE tablename='stock'");
//$NON-NLS-1$
+ //TestMMDatabaseMetaData.compareResultSet("TestDymamicImportedMetaData/columns",
this.internalResultSet);
+
+ admin.undeploy("dynamicview-vdb.xml");
}
}
Added:
trunk/test-integration/common/src/test/resources/TestDymamicImportedMetaData/columns.expected
===================================================================
---
trunk/test-integration/common/src/test/resources/TestDymamicImportedMetaData/columns.expected
(rev 0)
+++
trunk/test-integration/common/src/test/resources/TestDymamicImportedMetaData/columns.expected 2012-03-09
12:32:32 UTC (rev 3925)
@@ -0,0 +1,37 @@
+string string
string
string
integer string string
integer integer boolean
boolean boolean boolean boolean boolean boolean
string string string
integer integer string
string string
string
integer integer integer string !
string
integer
+VDBName SchemaName
TableName
Name
Position NameInSource DataType
Scale Length
IsLengthFixed SupportsSelect SupportsUpdates IsCaseSensitive IsSigned IsCurrency
IsAutoIncremented NullType MinRange
MaxRange DistinctCount NullCount
SearchType Format
DefaultValue JavaClass
Precision CharOctetLength Radix UID
!
Description
OID
+dynamic portfolio
stock
symbol 1
<null> string
0 0 false
true false false false false false
Nullable <null>
<null> -1 -1
Searchable <null>
<null>
java.lang.String 0 0
0 mmuuid:779b92e3-b217-!
4984-a0c4-739c6ed77376 <null>
1
+dynamic portfolio
stock
price 2
<null>
bigdecimal 0 0
false true false false false false
false Nullable <null>
<null> -1 -1
Searchable <null>
<null>
java.math.BigDecimal 0 0
0 mmuuid:34cec776-ce92-!
4648-b5ef-8229322d767b <null>
2
+Row Count : 2
+getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel
getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision
getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable
isReadOnly isSearchable isSigned isWritable
+VDBName 12 dynamic java.lang.String VDBName
string SYS Columns 255 255 0
false false false false 0 true
true false false
+SchemaName 12 dynamic java.lang.String SchemaName
string SYS Columns 255 255 0
false true false true 1 false
true true true
+TableName 12 dynamic java.lang.String TableName
string SYS Columns 255 255 0
false true false false 0 true
true false false
+Name 12 dynamic java.lang.String Name
string SYS Columns 255 255 0
false false false false 0 true
true false false
+Position 4 dynamic java.lang.Integer Position
integer SYS Columns 11 10 0
false false false false 0 true
true false false
+NameInSource 12 dynamic java.lang.String NameInSource
string SYS Columns 255 255 0
false false false false 1 true
true false false
+DataType 12 dynamic java.lang.String DataType
string SYS Columns 100 100 0
false true false false 0 true
true true false
+Scale 4 dynamic java.lang.Integer Scale
integer SYS Columns 11 10 0
false false false false 0 true
true false false
+Length 4 dynamic java.lang.Integer Length
integer SYS Columns 11 10 0
false false false false 0 true
true false false
+IsLengthFixed -7 dynamic java.lang.Boolean IsLengthFixed
boolean SYS Columns 5 1 0
false false false false 0 true
true false false
+SupportsSelect -7 dynamic java.lang.Boolean SupportsSelect
boolean SYS Columns 5 1 0
false false false false 0 true
true false false
+SupportsUpdates -7 dynamic java.lang.Boolean SupportsUpdates
boolean SYS Columns 5 1 0
false false false false 0 true
true false false
+IsCaseSensitive -7 dynamic java.lang.Boolean IsCaseSensitive
boolean SYS Columns 5 1 0
false false false false 0 true
true false false
+IsSigned -7 dynamic java.lang.Boolean IsSigned
boolean SYS Columns 5 1 0
false false false false 0 true
true false false
+IsCurrency -7 dynamic java.lang.Boolean IsCurrency
boolean SYS Columns 5 1 0
false false false false 0 true
true false false
+IsAutoIncremented -7 dynamic java.lang.Boolean IsAutoIncremented
boolean SYS Columns 5 1 0
false false false false 0 true
true false false
+NullType 12 dynamic java.lang.String NullType
string SYS Columns 20 20 0
false true false false 0 true
true false false
+MinRange 12 dynamic java.lang.String MinRange
string SYS Columns 50 50 0
false false false false 1 true
true false false
+MaxRange 12 dynamic java.lang.String MaxRange
string SYS Columns 50 50 0
false false false false 1 true
true false false
+DistinctCount 4 dynamic java.lang.Integer DistinctCount
integer SYS Columns 11 10 0
false true false true 1 false
true true true
+NullCount 4 dynamic java.lang.Integer NullCount
integer SYS Columns 11 10 0
false true false true 1 false
true true true
+SearchType 12 dynamic java.lang.String SearchType
string SYS Columns 20 20 0
false false false false 0 true
true false false
+Format 12 dynamic java.lang.String Format
string SYS Columns 255 255 0
false false false false 1 true
true false false
+DefaultValue 12 dynamic java.lang.String DefaultValue
string SYS Columns 255 255 0
false false false false 1 true
true false false
+JavaClass 12 dynamic java.lang.String JavaClass
string SYS Columns 500 500 0
false true false false 0 true
true false false
+Precision 4 dynamic java.lang.Integer Precision
integer SYS Columns 11 10 0
false false false false 0 true
true false false
+CharOctetLength 4 dynamic java.lang.Integer CharOctetLength
integer SYS Columns 11 10 0
false false false false 1 true
true false false
+Radix 4 dynamic java.lang.Integer Radix
integer SYS Columns 11 10 0
false false false false 0 true
true false false
+UID 12 dynamic java.lang.String UID
string SYS Columns 50 50 0
false false false false 0 true
true false false
+Description 12 dynamic java.lang.String Description
string SYS Columns 255 255 0
false true false true 1 false
true true true
+OID 4 dynamic java.lang.Integer OID
integer SYS Columns 11 10 0
false false false false 0 true
true false false