teiid SVN: r3634 - tags.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-11-10 14:13:11 -0500 (Thu, 10 Nov 2011)
New Revision: 3634
Added:
tags/teiid-parent-7.6.0.Beta2/
Log:
[maven-release-plugin] copy for tag teiid-parent-7.6.0.Beta2
14 years, 1 month
teiid SVN: r3633 - in trunk: adminshell and 37 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-11-10 14:12:59 -0500 (Thu, 10 Nov 2011)
New Revision: 3633
Modified:
trunk/adminshell/pom.xml
trunk/api/pom.xml
trunk/build/pom.xml
trunk/cache-jbosscache/pom.xml
trunk/client-jdk15/pom.xml
trunk/client/pom.xml
trunk/common-core/pom.xml
trunk/connectors/connector-file/pom.xml
trunk/connectors/connector-ldap/pom.xml
trunk/connectors/connector-salesforce/pom.xml
trunk/connectors/connector-ws/pom.xml
trunk/connectors/pom.xml
trunk/connectors/salesforce-api/pom.xml
trunk/connectors/sandbox/pom.xml
trunk/connectors/sandbox/translator-yahoo/pom.xml
trunk/connectors/translator-file/pom.xml
trunk/connectors/translator-jdbc/pom.xml
trunk/connectors/translator-ldap/pom.xml
trunk/connectors/translator-loopback/pom.xml
trunk/connectors/translator-olap/pom.xml
trunk/connectors/translator-salesforce/pom.xml
trunk/connectors/translator-ws/pom.xml
trunk/console/pom.xml
trunk/documentation/admin-guide/pom.xml
trunk/documentation/caching-guide/pom.xml
trunk/documentation/client-developers-guide/pom.xml
trunk/documentation/developer-guide/pom.xml
trunk/documentation/pom.xml
trunk/documentation/quick-start-example/pom.xml
trunk/documentation/reference/pom.xml
trunk/engine/pom.xml
trunk/hibernate-dialect/pom.xml
trunk/jboss-integration/pom.xml
trunk/metadata/pom.xml
trunk/pom.xml
trunk/runtime/pom.xml
trunk/test-integration/common/pom.xml
trunk/test-integration/db/pom.xml
trunk/test-integration/pom.xml
Log:
[maven-release-plugin] prepare release teiid-parent-7.6.0.Beta2
Modified: trunk/adminshell/pom.xml
===================================================================
--- trunk/adminshell/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/adminshell/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-adminshell</artifactId>
Modified: trunk/api/pom.xml
===================================================================
--- trunk/api/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/api/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-api</artifactId>
Modified: trunk/build/pom.xml
===================================================================
--- trunk/build/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/build/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid</artifactId>
Modified: trunk/cache-jbosscache/pom.xml
===================================================================
--- trunk/cache-jbosscache/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/cache-jbosscache/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-cache-jbosscache</artifactId>
Modified: trunk/client/pom.xml
===================================================================
--- trunk/client/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/client/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-client</artifactId>
Modified: trunk/client-jdk15/pom.xml
===================================================================
--- trunk/client-jdk15/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/client-jdk15/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-client-jdk15</artifactId>
Modified: trunk/common-core/pom.xml
===================================================================
--- trunk/common-core/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/common-core/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-common-core</artifactId>
Modified: trunk/connectors/connector-file/pom.xml
===================================================================
--- trunk/connectors/connector-file/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/connectors/connector-file/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-file</artifactId>
Modified: trunk/connectors/connector-ldap/pom.xml
===================================================================
--- trunk/connectors/connector-ldap/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/connectors/connector-ldap/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-ldap</artifactId>
Modified: trunk/connectors/connector-salesforce/pom.xml
===================================================================
--- trunk/connectors/connector-salesforce/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/connectors/connector-salesforce/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-salesforce</artifactId>
Modified: trunk/connectors/connector-ws/pom.xml
===================================================================
--- trunk/connectors/connector-ws/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/connectors/connector-ws/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-ws</artifactId>
Modified: trunk/connectors/pom.xml
===================================================================
--- trunk/connectors/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/connectors/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: trunk/connectors/salesforce-api/pom.xml
===================================================================
--- trunk/connectors/salesforce-api/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/connectors/salesforce-api/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>salesforce-api</artifactId>
Modified: trunk/connectors/sandbox/pom.xml
===================================================================
--- trunk/connectors/sandbox/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/connectors/sandbox/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid.connectors</groupId>
Modified: trunk/connectors/sandbox/translator-yahoo/pom.xml
===================================================================
--- trunk/connectors/sandbox/translator-yahoo/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/connectors/sandbox/translator-yahoo/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>sandbox</artifactId>
<groupId>org.jboss.teiid.connectors</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-yahoo</artifactId>
Modified: trunk/connectors/translator-file/pom.xml
===================================================================
--- trunk/connectors/translator-file/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/connectors/translator-file/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-file</artifactId>
Modified: trunk/connectors/translator-jdbc/pom.xml
===================================================================
--- trunk/connectors/translator-jdbc/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/connectors/translator-jdbc/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-jdbc</artifactId>
Modified: trunk/connectors/translator-ldap/pom.xml
===================================================================
--- trunk/connectors/translator-ldap/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/connectors/translator-ldap/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-ldap</artifactId>
Modified: trunk/connectors/translator-loopback/pom.xml
===================================================================
--- trunk/connectors/translator-loopback/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/connectors/translator-loopback/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-loopback</artifactId>
Modified: trunk/connectors/translator-olap/pom.xml
===================================================================
--- trunk/connectors/translator-olap/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/connectors/translator-olap/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-olap</artifactId>
Modified: trunk/connectors/translator-salesforce/pom.xml
===================================================================
--- trunk/connectors/translator-salesforce/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/connectors/translator-salesforce/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-salesforce</artifactId>
Modified: trunk/connectors/translator-ws/pom.xml
===================================================================
--- trunk/connectors/translator-ws/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/connectors/translator-ws/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-ws</artifactId>
Modified: trunk/console/pom.xml
===================================================================
--- trunk/console/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/console/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: trunk/documentation/admin-guide/pom.xml
===================================================================
--- trunk/documentation/admin-guide/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/documentation/admin-guide/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>admin-guide</artifactId>
Modified: trunk/documentation/caching-guide/pom.xml
===================================================================
--- trunk/documentation/caching-guide/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/documentation/caching-guide/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>caching-guide</artifactId>
Modified: trunk/documentation/client-developers-guide/pom.xml
===================================================================
--- trunk/documentation/client-developers-guide/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/documentation/client-developers-guide/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>client-developers-guide</artifactId>
Modified: trunk/documentation/developer-guide/pom.xml
===================================================================
--- trunk/documentation/developer-guide/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/documentation/developer-guide/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>developer-guide</artifactId>
Modified: trunk/documentation/pom.xml
===================================================================
--- trunk/documentation/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/documentation/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: trunk/documentation/quick-start-example/pom.xml
===================================================================
--- trunk/documentation/quick-start-example/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/documentation/quick-start-example/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>quick-start-example</artifactId>
Modified: trunk/documentation/reference/pom.xml
===================================================================
--- trunk/documentation/reference/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/documentation/reference/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>reference</artifactId>
Modified: trunk/engine/pom.xml
===================================================================
--- trunk/engine/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/engine/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-engine</artifactId>
Modified: trunk/hibernate-dialect/pom.xml
===================================================================
--- trunk/hibernate-dialect/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/hibernate-dialect/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-hibernate-dialect</artifactId>
Modified: trunk/jboss-integration/pom.xml
===================================================================
--- trunk/jboss-integration/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/jboss-integration/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: trunk/metadata/pom.xml
===================================================================
--- trunk/metadata/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/metadata/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-metadata</artifactId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -5,16 +5,16 @@
<artifactId>teiid-parent</artifactId>
<packaging>pom</packaging>
<name>Teiid</name>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
<description>Federated SQL and XML query engine.</description>
<properties>
<ant.version>1.7.0</ant.version>
<site.url>http://www.jboss.org/teiid</site.url>
</properties>
<scm>
- <connection>scm:svn:https://anonsvn.jboss.org/repos/teiid/trunk</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/trunk</developerConnection>
- <url>http://anonsvn.jboss.org/repos/teiid/trunk</url>
+ <connection>scm:svn:https://anonsvn.jboss.org/repos/teiid/tags/teiid-parent-7.6.0.Beta2</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/tags/teiid-parent-7.6.0.Beta2</developerConnection>
+ <url>http://anonsvn.jboss.org/repos/teiid/tags/teiid-parent-7.6.0.Beta2</url>
</scm>
<licenses>
<license>
Modified: trunk/runtime/pom.xml
===================================================================
--- trunk/runtime/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/runtime/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: trunk/test-integration/common/pom.xml
===================================================================
--- trunk/test-integration/common/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/test-integration/common/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-test-integration</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>test-integration-common</artifactId>
Modified: trunk/test-integration/db/pom.xml
===================================================================
--- trunk/test-integration/db/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/test-integration/db/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -9,7 +9,7 @@
<parent>
<artifactId>teiid-test-integration</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: trunk/test-integration/pom.xml
===================================================================
--- trunk/test-integration/pom.xml 2011-11-10 18:16:54 UTC (rev 3632)
+++ trunk/test-integration/pom.xml 2011-11-10 19:12:59 UTC (rev 3633)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.6.0.Beta2-SNAPSHOT</version>
+ <version>7.6.0.Beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-test-integration</artifactId>
14 years, 1 month
teiid SVN: r3632 - in trunk: client/src/main/java/org/teiid/net and 10 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-11-10 13:16:54 -0500 (Thu, 10 Nov 2011)
New Revision: 3632
Added:
trunk/client/src/main/java/org/teiid/net/socket/AuthenticationType.java
Modified:
trunk/client/src/main/java/org/teiid/jdbc/JDBCURL.java
trunk/client/src/main/java/org/teiid/jdbc/TeiidDataSource.java
trunk/client/src/main/java/org/teiid/net/TeiidURL.java
trunk/client/src/main/java/org/teiid/net/socket/Handshake.java
trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java
trunk/client/src/main/java/org/teiid/net/socket/SocketServerInstance.java
trunk/client/src/main/java/org/teiid/net/socket/SocketServerInstanceImpl.java
trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java
trunk/client/src/test/java/org/teiid/net/socket/TestSocketServerConnection.java
trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml
trunk/engine/src/main/java/org/teiid/dqp/service/SessionService.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
trunk/runtime/src/main/java/org/teiid/transport/ClientServiceRegistry.java
trunk/runtime/src/main/java/org/teiid/transport/ClientServiceRegistryImpl.java
trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java
trunk/runtime/src/main/java/org/teiid/transport/ODBCClientInstance.java
trunk/runtime/src/main/java/org/teiid/transport/ODBCSocketListener.java
trunk/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java
trunk/runtime/src/test/java/org/teiid/transport/TestLogonImpl.java
Log:
TEIID-1610 removing the need for the client to set the auth type property
Modified: trunk/client/src/main/java/org/teiid/jdbc/JDBCURL.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/JDBCURL.java 2011-11-10 17:48:21 UTC (rev 3631)
+++ trunk/client/src/main/java/org/teiid/jdbc/JDBCURL.java 2011-11-10 18:16:54 UTC (rev 3632)
@@ -74,7 +74,6 @@
TeiidURL.CONNECTION.AUTO_FAILOVER,
TeiidURL.CONNECTION.DISCOVERY_STRATEGY,
TeiidURL.CONNECTION.PASSTHROUGH_AUTHENTICATION,
- TeiidURL.CONNECTION.AUTHENTICATION_TYPE,
TeiidURL.CONNECTION.JAAS_NAME,
TeiidURL.CONNECTION.KERBEROS_SERVICE_PRINCIPLE_NAME));
props.addAll(EXECUTION_PROPERTIES);
Modified: trunk/client/src/main/java/org/teiid/jdbc/TeiidDataSource.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/TeiidDataSource.java 2011-11-10 17:48:21 UTC (rev 3631)
+++ trunk/client/src/main/java/org/teiid/jdbc/TeiidDataSource.java 2011-11-10 18:16:54 UTC (rev 3632)
@@ -99,11 +99,6 @@
private boolean passthroughAuthentication = false;
/**
- * Authentication type to used from client. choices are simple - which is plain user/password; krb5 - kerberos
- */
- private String authenticationType;
-
- /**
* Name of the jass configuration to use from the -Djava.security.auth.login.config=login.conf property
*/
private String jaasName;
@@ -258,9 +253,6 @@
Properties props = buildProperties(userName, password);
props.setProperty(TeiidURL.CONNECTION.PASSTHROUGH_AUTHENTICATION, Boolean.toString(this.passthroughAuthentication));
- if (getAuthenticationType() != null) {
- props.setProperty(TeiidURL.CONNECTION.AUTHENTICATION_TYPE, getAuthenticationType());
- }
if (getJaasName() != null) {
props.setProperty(TeiidURL.CONNECTION.JAAS_NAME, getJaasName());
}
@@ -492,24 +484,7 @@
this.passthroughAuthentication = passthroughAuthentication;
}
- /**
- * Authentication Type {simple, krb5} default:simple
- * @return
- */
- public String getAuthenticationType() {
- return authenticationType;
- }
-
/**
- * Authentication Type.
- * @since 7.6
- * @return
- */
- public void setAuthenticationType(final String authType) {
- this.authenticationType = authType;
- }
-
- /**
* Application name from JAAS Login Config file
* @since 7.6
* @return
Modified: trunk/client/src/main/java/org/teiid/net/TeiidURL.java
===================================================================
--- trunk/client/src/main/java/org/teiid/net/TeiidURL.java 2011-11-10 17:48:21 UTC (rev 3631)
+++ trunk/client/src/main/java/org/teiid/net/TeiidURL.java 2011-11-10 18:16:54 UTC (rev 3632)
@@ -83,15 +83,9 @@
public static final String PASSTHROUGH_AUTHENTICATION = "PassthroughAuthentication"; //$NON-NLS-1$
- public static final String AUTHENTICATION_TYPE = "authenticationType"; //$NON-NLS-1$
-
public static final String JAAS_NAME = "jaasName"; //$NON-NLS-1$
- public static final String KERBEROS_SERVICE_PRINCIPLE_NAME = "kerberosServicePrincipleName"; //$NON-NLS-1$
-
- public enum AuthenticationType {
- CLEARTEXT,GSS
- };
+ public static final String KERBEROS_SERVICE_PRINCIPLE_NAME = "kerberosServicePrincipleName"; //$NON-NLS-1$;
}
public static final String DOT_DELIMITER = "."; //$NON-NLS-1$
Added: trunk/client/src/main/java/org/teiid/net/socket/AuthenticationType.java
===================================================================
--- trunk/client/src/main/java/org/teiid/net/socket/AuthenticationType.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/net/socket/AuthenticationType.java 2011-11-10 18:16:54 UTC (rev 3632)
@@ -0,0 +1,27 @@
+/*
+ * 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.net.socket;
+
+public enum AuthenticationType {
+ CLEARTEXT,GSS
+}
\ No newline at end of file
Property changes on: trunk/client/src/main/java/org/teiid/net/socket/AuthenticationType.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/client/src/main/java/org/teiid/net/socket/Handshake.java
===================================================================
--- trunk/client/src/main/java/org/teiid/net/socket/Handshake.java 2011-11-10 17:48:21 UTC (rev 3631)
+++ trunk/client/src/main/java/org/teiid/net/socket/Handshake.java 2011-11-10 18:16:54 UTC (rev 3632)
@@ -26,6 +26,7 @@
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.io.OptionalDataException;
import org.teiid.core.util.ApplicationInfo;
@@ -39,6 +40,7 @@
private String version = ApplicationInfo.getInstance().getReleaseNumber();
private byte[] publicKey;
+ private AuthenticationType authType = AuthenticationType.CLEARTEXT;
/**
* @return Returns the version.
@@ -68,17 +70,31 @@
this.publicKey = key;
}
+ public AuthenticationType getAuthType() {
+ return authType;
+ }
+
+ public void setAuthType(AuthenticationType authType) {
+ this.authType = authType;
+ }
+
@Override
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
version = (String)in.readObject();
publicKey = (byte[])in.readObject();
+ try {
+ authType = AuthenticationType.values()[in.readByte()];
+ } catch (OptionalDataException e) {
+
+ }
}
@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(version);
out.writeObject(publicKey);
+ out.writeByte(authType.ordinal());
}
}
Modified: trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java
===================================================================
--- trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java 2011-11-10 17:48:21 UTC (rev 3631)
+++ trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java 2011-11-10 18:16:54 UTC (rev 3632)
@@ -56,7 +56,6 @@
import org.teiid.net.HostInfo;
import org.teiid.net.ServerConnection;
import org.teiid.net.TeiidURL;
-import org.teiid.net.TeiidURL.CONNECTION.AuthenticationType;
/**
@@ -172,7 +171,7 @@
SocketServerInstance instance = this.serverInstance;
LogonResult newResult = null;
- AuthenticationType authType = getAuthenticationType();
+ AuthenticationType authType = instance.getAuthenticationType();
if (AuthenticationType.CLEARTEXT.equals(authType)) {
newResult = newLogon.logon(connProps);
}
@@ -194,14 +193,6 @@
this.connectionFactory.connected(instance, this.logonResult.getSessionToken());
}
- private AuthenticationType getAuthenticationType() {
- String authStr = this.connProps.getProperty(TeiidURL.CONNECTION.AUTHENTICATION_TYPE);
- if (authStr == null) {
- return AuthenticationType.CLEARTEXT;
- }
- return AuthenticationType.valueOf(authStr);
- }
-
private ILogon connect(HostInfo hostInfo) throws CommunicationException,
IOException {
hostInfo.setSsl(secure);
Modified: trunk/client/src/main/java/org/teiid/net/socket/SocketServerInstance.java
===================================================================
--- trunk/client/src/main/java/org/teiid/net/socket/SocketServerInstance.java 2011-11-10 17:48:21 UTC (rev 3631)
+++ trunk/client/src/main/java/org/teiid/net/socket/SocketServerInstance.java 2011-11-10 18:16:54 UTC (rev 3632)
@@ -53,4 +53,6 @@
String getServerVersion();
+ AuthenticationType getAuthenticationType();
+
}
\ No newline at end of file
Modified: trunk/client/src/main/java/org/teiid/net/socket/SocketServerInstanceImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/net/socket/SocketServerInstanceImpl.java 2011-11-10 17:48:21 UTC (rev 3631)
+++ trunk/client/src/main/java/org/teiid/net/socket/SocketServerInstanceImpl.java 2011-11-10 18:16:54 UTC (rev 3632)
@@ -76,6 +76,7 @@
private ObjectChannel socketChannel;
private Cryptor cryptor;
private String serverVersion;
+ private AuthenticationType authType = AuthenticationType.CLEARTEXT;
private boolean hasReader;
@@ -130,6 +131,7 @@
throw new CommunicationException(NetPlugin.Util.getString("SocketServerInstanceImpl.version_mismatch", getVersionInfo(), handshake.getVersion())); //$NON-NLS-1$
}*/
serverVersion = handshake.getVersion();
+ authType = handshake.getAuthType();
handshake.setVersion();
byte[] serverPublicKey = handshake.getPublicKey();
@@ -369,4 +371,9 @@
}
+ @Override
+ public AuthenticationType getAuthenticationType() {
+ return authType;
+ }
+
}
\ No newline at end of file
Modified: trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java 2011-11-10 17:48:21 UTC (rev 3631)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java 2011-11-10 18:16:54 UTC (rev 3632)
@@ -138,7 +138,7 @@
@Test public void testGetPropertyInfo1() throws Exception {
DriverPropertyInfo info[] = drv.getPropertyInfo("jdbc:teiid:vdb@mm://localhost:12345;applicationName=x", null); //$NON-NLS-1$
- assertEquals(24, info.length);
+ assertEquals(23, info.length);
assertEquals(false, info[0].required);
assertEquals("ApplicationName", info[0].name); //$NON-NLS-1$
assertEquals("x", info[0].value); //$NON-NLS-1$
Modified: trunk/client/src/test/java/org/teiid/net/socket/TestSocketServerConnection.java
===================================================================
--- trunk/client/src/test/java/org/teiid/net/socket/TestSocketServerConnection.java 2011-11-10 17:48:21 UTC (rev 3631)
+++ trunk/client/src/test/java/org/teiid/net/socket/TestSocketServerConnection.java 2011-11-10 18:16:54 UTC (rev 3632)
@@ -213,6 +213,7 @@
Mockito.stub(instance.getHostInfo()).toReturn(hostInfo);
Mockito.stub(instance.getService(ILogon.class)).toReturn(logon);
Mockito.stub(instance.getServerVersion()).toReturn("7.3");
+ Mockito.stub(instance.getAuthenticationType()).toReturn(AuthenticationType.CLEARTEXT);
if (t != null) {
try {
Mockito.doAnswer(new Answer<Void>() {
Modified: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml
===================================================================
--- trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml 2011-11-10 17:48:21 UTC (rev 3631)
+++ trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml 2011-11-10 18:16:54 UTC (rev 3632)
@@ -258,27 +258,14 @@
</row>
<row>
<entry>
- <code>authenticationType</code>
- </entry>
- <entry>
- <code>String</code>
- </entry>
- <entry>
- <para>Type of authentication to use. Valid values are CLEARTEXT (default) and KRB5 (kerberos). See
- Admin Guide for configuration required for kerberos
- </para>
- </entry>
- </row>
- <row>
- <entry>
<code>jaasName</code>
</entry>
<entry>
<code>String</code>
</entry>
<entry>
- <para>JAAS configuration name. Only applies when configuring a kerberos authentication.
- See Admin Guide for configuration required for kerberos</para>
+ <para>JAAS configuration name. Only applies when configuring a GSS authentication.
+ See the Admin Guide for configuration required for GSS.</para>
</entry>
</row>
<row>
@@ -289,8 +276,8 @@
<code>String</code>
</entry>
<entry>
- <para>Kerberos authenticated principle name. Only applies when configuring a kerberos authentication.
- See Admin Guide for configuration required for kerberos</para>
+ <para>Kerberos authenticated principle name. Only applies when configuring a GSS authentication.
+ See the Admin Guide for configuration required for GSS</para>
</entry>
</row>
Modified: trunk/engine/src/main/java/org/teiid/dqp/service/SessionService.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/service/SessionService.java 2011-11-10 17:48:21 UTC (rev 3631)
+++ trunk/engine/src/main/java/org/teiid/dqp/service/SessionService.java 2011-11-10 18:16:54 UTC (rev 3632)
@@ -32,7 +32,7 @@
import org.teiid.adminapi.impl.SessionMetadata;
import org.teiid.client.security.InvalidSessionException;
import org.teiid.dqp.internal.process.DQPCore;
-import org.teiid.net.TeiidURL.CONNECTION.AuthenticationType;
+import org.teiid.net.socket.AuthenticationType;
import org.teiid.security.Credentials;
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-11-10 17:48:21 UTC (rev 3631)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-11-10 18:16:54 UTC (rev 3632)
@@ -113,6 +113,7 @@
import org.teiid.metadata.TableStats;
import org.teiid.metadata.Table.TriggerEvent;
import org.teiid.net.TeiidURL;
+import org.teiid.net.socket.AuthenticationType;
import org.teiid.query.ObjectReplicator;
import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.optimizer.relational.RelationalPlanner;
@@ -230,6 +231,7 @@
this.csr.registerClientService(Admin.class, adminProxy, LogConstants.CTX_ADMIN_API);
ClientServiceRegistryImpl jdbcCsr = new ClientServiceRegistryImpl();
+ jdbcCsr.setAuthenticationType(this.sessionService.getAuthType());
jdbcCsr.registerClientService(ILogon.class, logon, LogConstants.CTX_SECURITY);
jdbcCsr.registerClientService(DQP.class, dqpProxy, LogConstants.CTX_DQP);
@@ -241,6 +243,7 @@
}
ClientServiceRegistryImpl adminCsr = new ClientServiceRegistryImpl(Type.Admin);
+ adminCsr.setAuthenticationType(this.sessionService.getAuthType());
adminCsr.registerClientService(ILogon.class, logon, LogConstants.CTX_SECURITY);
adminCsr.registerClientService(Admin.class, adminProxy, LogConstants.CTX_ADMIN_API);
@@ -857,4 +860,9 @@
*/
public void setContainerLifeCycleListener(ContainerLifeCycleListener listener) {
}
+
+ @Override
+ public AuthenticationType getAuthenticationType() {
+ return this.sessionService.getAuthType();
+ }
}
Modified: trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java 2011-11-10 17:48:21 UTC (rev 3631)
+++ trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java 2011-11-10 18:16:54 UTC (rev 3632)
@@ -54,7 +54,7 @@
import org.teiid.jdbc.TeiidDriver;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
-import org.teiid.net.TeiidURL.CONNECTION.AuthenticationType;
+import org.teiid.net.socket.AuthenticationType;
import org.teiid.odbc.PGUtil.PgColInfo;
import org.teiid.query.parser.SQLParserUtil;
import org.teiid.runtime.RuntimePlugin;
Modified: trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2011-11-10 17:48:21 UTC (rev 3631)
+++ trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2011-11-10 18:16:54 UTC (rev 3632)
@@ -63,7 +63,7 @@
import org.teiid.logging.LogManager;
import org.teiid.net.ServerConnection;
import org.teiid.net.TeiidURL;
-import org.teiid.net.TeiidURL.CONNECTION.AuthenticationType;
+import org.teiid.net.socket.AuthenticationType;
import org.teiid.runtime.RuntimePlugin;
import org.teiid.security.Credentials;
import org.teiid.security.SecurityHelper;
Modified: trunk/runtime/src/main/java/org/teiid/transport/ClientServiceRegistry.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/ClientServiceRegistry.java 2011-11-10 17:48:21 UTC (rev 3631)
+++ trunk/runtime/src/main/java/org/teiid/transport/ClientServiceRegistry.java 2011-11-10 18:16:54 UTC (rev 3632)
@@ -23,6 +23,7 @@
package org.teiid.transport;
import org.teiid.core.ComponentNotFoundException;
+import org.teiid.net.socket.AuthenticationType;
import org.teiid.security.SecurityHelper;
@@ -35,5 +36,7 @@
<T> T getClientService(Class<T> iface) throws ComponentNotFoundException;
SecurityHelper getSecurityHelper();
+
+ AuthenticationType getAuthenticationType();
}
Modified: trunk/runtime/src/main/java/org/teiid/transport/ClientServiceRegistryImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/ClientServiceRegistryImpl.java 2011-11-10 17:48:21 UTC (rev 3631)
+++ trunk/runtime/src/main/java/org/teiid/transport/ClientServiceRegistryImpl.java 2011-11-10 18:16:54 UTC (rev 3632)
@@ -26,6 +26,7 @@
import org.teiid.core.ComponentNotFoundException;
import org.teiid.core.util.ReflectionHelper;
+import org.teiid.net.socket.AuthenticationType;
import org.teiid.runtime.RuntimePlugin;
import org.teiid.security.SecurityHelper;
@@ -58,6 +59,7 @@
private HashMap<String, ClientService> clientServices = new HashMap<String, ClientService>();
private SecurityHelper securityHelper;
private Type type = Type.JDBC;
+ private AuthenticationType authenticationType = AuthenticationType.CLEARTEXT;
public ClientServiceRegistryImpl() {
@@ -66,6 +68,10 @@
public ClientServiceRegistryImpl(Type type) {
this.type = type;
}
+
+ public void setAuthenticationType(AuthenticationType authenticationType) {
+ this.authenticationType = authenticationType;
+ }
public <T> T getClientService(Class<T> iface) throws ComponentNotFoundException {
ClientService cs = getClientService(iface.getName());
@@ -92,5 +98,10 @@
public void setSecurityHelper(SecurityHelper securityHelper) {
this.securityHelper = securityHelper;
}
+
+ @Override
+ public AuthenticationType getAuthenticationType() {
+ return authenticationType;
+ }
}
Modified: trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2011-11-10 17:48:21 UTC (rev 3631)
+++ trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2011-11-10 18:16:54 UTC (rev 3632)
@@ -50,7 +50,7 @@
import org.teiid.logging.LogManager;
import org.teiid.net.CommunicationException;
import org.teiid.net.TeiidURL;
-import org.teiid.net.TeiidURL.CONNECTION.AuthenticationType;
+import org.teiid.net.socket.AuthenticationType;
import org.teiid.runtime.RuntimePlugin;
import org.teiid.security.Credentials;
Modified: trunk/runtime/src/main/java/org/teiid/transport/ODBCClientInstance.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/ODBCClientInstance.java 2011-11-10 17:48:21 UTC (rev 3631)
+++ trunk/runtime/src/main/java/org/teiid/transport/ODBCClientInstance.java 2011-11-10 18:16:54 UTC (rev 3632)
@@ -36,7 +36,7 @@
import org.teiid.logging.LogManager;
import org.teiid.logging.MessageLevel;
import org.teiid.net.CommunicationException;
-import org.teiid.net.TeiidURL.CONNECTION.AuthenticationType;
+import org.teiid.net.socket.AuthenticationType;
import org.teiid.net.socket.ObjectChannel;
import org.teiid.net.socket.ServiceInvocationStruct;
import org.teiid.odbc.ODBCClientRemote;
Modified: trunk/runtime/src/main/java/org/teiid/transport/ODBCSocketListener.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/ODBCSocketListener.java 2011-11-10 17:48:21 UTC (rev 3631)
+++ trunk/runtime/src/main/java/org/teiid/transport/ODBCSocketListener.java 2011-11-10 18:16:54 UTC (rev 3632)
@@ -26,7 +26,7 @@
import org.teiid.client.security.ILogon;
import org.teiid.common.buffer.StorageManager;
import org.teiid.jdbc.TeiidDriver;
-import org.teiid.net.TeiidURL.CONNECTION.AuthenticationType;
+import org.teiid.net.socket.AuthenticationType;
import org.teiid.net.socket.ObjectChannel;
public class ODBCSocketListener extends SocketListener {
Modified: trunk/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java 2011-11-10 17:48:21 UTC (rev 3631)
+++ trunk/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java 2011-11-10 18:16:54 UTC (rev 3632)
@@ -95,7 +95,7 @@
public void onConnection() throws CommunicationException {
Handshake handshake = new Handshake();
-
+ handshake.setAuthType(csr.getAuthenticationType());
if (usingEncryption) {
keyGen = new DhKeyGenerator();
byte[] publicKey;
Modified: trunk/runtime/src/test/java/org/teiid/transport/TestLogonImpl.java
===================================================================
--- trunk/runtime/src/test/java/org/teiid/transport/TestLogonImpl.java 2011-11-10 17:48:21 UTC (rev 3631)
+++ trunk/runtime/src/test/java/org/teiid/transport/TestLogonImpl.java 2011-11-10 18:16:54 UTC (rev 3632)
@@ -34,7 +34,7 @@
import org.teiid.dqp.internal.process.DQPWorkContext;
import org.teiid.dqp.service.SessionService;
import org.teiid.net.TeiidURL;
-import org.teiid.net.TeiidURL.CONNECTION.AuthenticationType;
+import org.teiid.net.socket.AuthenticationType;
public class TestLogonImpl extends TestCase {
14 years, 1 month
teiid SVN: r3631 - in branches/7.1.x/connectors: translator-netezza and 15 other directories.
by teiid-commits@lists.jboss.org
Author: van.halbert
Date: 2011-11-10 12:48:21 -0500 (Thu, 10 Nov 2011)
New Revision: 3631
Added:
branches/7.1.x/connectors/translator-netezza/
branches/7.1.x/connectors/translator-netezza/pom.xml
branches/7.1.x/connectors/translator-netezza/src/
branches/7.1.x/connectors/translator-netezza/src/main/
branches/7.1.x/connectors/translator-netezza/src/main/java/
branches/7.1.x/connectors/translator-netezza/src/main/java/org/
branches/7.1.x/connectors/translator-netezza/src/main/java/org/teiid/
branches/7.1.x/connectors/translator-netezza/src/main/java/org/teiid/translator/
branches/7.1.x/connectors/translator-netezza/src/main/java/org/teiid/translator/jdbc/
branches/7.1.x/connectors/translator-netezza/src/main/java/org/teiid/translator/jdbc/netezza/
branches/7.1.x/connectors/translator-netezza/src/main/java/org/teiid/translator/jdbc/netezza/NetezzaExecutionFactory.java
branches/7.1.x/connectors/translator-netezza/src/test/
branches/7.1.x/connectors/translator-netezza/src/test/java/
branches/7.1.x/connectors/translator-netezza/src/test/java/org/
branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/
branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/
branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/
branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/
branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaConvertModifier.java
branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaTranslatorCapabilities.java
branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaTranslatorDatetimeConversion.java
branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaTranslatorSourceSystemFunctions.java
branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaTranslatorTypeMapping.java
branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestSubstringFunctionModifier.java
Modified:
branches/7.1.x/connectors/pom.xml
Log:
SOA-3573 backporting the Netezza translator from 7.4.x
Modified: branches/7.1.x/connectors/pom.xml
===================================================================
--- branches/7.1.x/connectors/pom.xml 2011-11-10 17:02:42 UTC (rev 3630)
+++ branches/7.1.x/connectors/pom.xml 2011-11-10 17:48:21 UTC (rev 3631)
@@ -90,5 +90,6 @@
<module>sandbox</module>
<module>translator-ws</module>
+ <module>translator-netezza</module>
</modules>
</project>
Added: branches/7.1.x/connectors/translator-netezza/pom.xml
===================================================================
--- branches/7.1.x/connectors/translator-netezza/pom.xml (rev 0)
+++ branches/7.1.x/connectors/translator-netezza/pom.xml 2011-11-10 17:48:21 UTC (rev 3631)
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <artifactId>connectors</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.1.1.CP3</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>translator-netezza</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>Netezza Translator</name>
+
+ <description>This project contains translator for a Netezza source. </description>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <artifactId>translator-jdbc</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <artifactId>translator-jdbc</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <version>1.5</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <outputDirectory>target/classes</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.xml</include>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ <exclude>**/*.properties</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </build>
+
+</project>
Added: branches/7.1.x/connectors/translator-netezza/src/main/java/org/teiid/translator/jdbc/netezza/NetezzaExecutionFactory.java
===================================================================
--- branches/7.1.x/connectors/translator-netezza/src/main/java/org/teiid/translator/jdbc/netezza/NetezzaExecutionFactory.java (rev 0)
+++ branches/7.1.x/connectors/translator-netezza/src/main/java/org/teiid/translator/jdbc/netezza/NetezzaExecutionFactory.java 2011-11-10 17:48:21 UTC (rev 3631)
@@ -0,0 +1,465 @@
+package org.teiid.translator.jdbc.netezza;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.teiid.language.Expression;
+import org.teiid.language.Function;
+import org.teiid.language.Limit;
+import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.SourceSystemFunctions;
+import org.teiid.translator.Translator;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.jdbc.AliasModifier;
+import org.teiid.translator.jdbc.ConvertModifier;
+import org.teiid.translator.jdbc.ExtractFunctionModifier;
+import org.teiid.translator.jdbc.FunctionModifier;
+import org.teiid.translator.jdbc.JDBCExecutionFactory;
+import org.teiid.translator.jdbc.LocateFunctionModifier;
+
+@SuppressWarnings("nls")
+@Translator(name = "netezza", description = "A translator for Netezza Database")
+public class NetezzaExecutionFactory extends JDBCExecutionFactory {
+
+ private static final String TIME_FORMAT = "HH24:MI:SS";
+ private static final String DATE_FORMAT = "YYYY-MM-DD";
+ private static final String DATETIME_FORMAT = DATE_FORMAT + " "
+ + TIME_FORMAT;
+ private static final String TIMESTAMP_FORMAT = DATETIME_FORMAT + ".MS";
+
+ public NetezzaExecutionFactory() {
+ setSupportsFullOuterJoins(true);
+ setSupportsOrderBy(true);
+ setSupportsOuterJoins(true);
+ setSupportsSelectDistinct(true);
+ setSupportsInnerJoins(true);
+ }
+
+ public void start() throws TranslatorException {
+ super.start();
+
+ // STRING FUNCTION MODIFIERS
+ // //////////////////////////////////
+ registerFunctionModifier(SourceSystemFunctions.CHAR, new AliasModifier(
+ "chr"));
+ registerFunctionModifier(SourceSystemFunctions.LCASE,
+ new AliasModifier("lower"));
+ registerFunctionModifier(SourceSystemFunctions.UCASE,
+ new AliasModifier("upper"));
+ registerFunctionModifier(SourceSystemFunctions.LOCATE,
+ new LocateFunctionModifier(getLanguageFactory(), "INSTR", true));
+ registerFunctionModifier(SourceSystemFunctions.CONCAT,
+ new AliasModifier("||"));
+ // /NUMERIC FUNCTION MODIFIERS
+ // //////////////////////////////////
+ registerFunctionModifier(SourceSystemFunctions.CEILING,
+ new AliasModifier("ceil"));
+ registerFunctionModifier(SourceSystemFunctions.POWER,
+ new AliasModifier("pow"));
+ registerFunctionModifier(SourceSystemFunctions.LOG, new AliasModifier(
+ "LN"));
+ // /BIT FUNCTION MODIFIERS
+ // //////////////////////////////////
+ registerFunctionModifier(SourceSystemFunctions.BITAND,
+ new AliasModifier("intNand"));
+ registerFunctionModifier(SourceSystemFunctions.BITNOT,
+ new AliasModifier("intNnot"));
+ registerFunctionModifier(SourceSystemFunctions.BITOR,
+ new AliasModifier("intNor"));
+ registerFunctionModifier(SourceSystemFunctions.BITXOR,
+ new AliasModifier("intNxor"));
+ // DATE FUNCTION MODIFIERS
+ // ////////////////////////////////////////
+ registerFunctionModifier(SourceSystemFunctions.YEAR,
+ new ExtractFunctionModifier());
+ registerFunctionModifier(SourceSystemFunctions.DAYOFYEAR,
+ new ExtractModifier("DOY"));
+ registerFunctionModifier(SourceSystemFunctions.QUARTER,
+ new ExtractFunctionModifier());
+ registerFunctionModifier(SourceSystemFunctions.MONTH,
+ new ExtractFunctionModifier());
+ registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH,
+ new ExtractModifier("DAY"));
+ registerFunctionModifier(SourceSystemFunctions.WEEK,
+ new ExtractFunctionModifier());
+ registerFunctionModifier(SourceSystemFunctions.DAYOFWEEK,
+ new ExtractModifier("DOW"));
+ registerFunctionModifier(SourceSystemFunctions.HOUR,
+ new ExtractFunctionModifier());
+ registerFunctionModifier(SourceSystemFunctions.MINUTE,
+ new ExtractFunctionModifier());
+ registerFunctionModifier(SourceSystemFunctions.SECOND,
+ new ExtractFunctionModifier());
+ registerFunctionModifier(SourceSystemFunctions.CURDATE,
+ new AliasModifier("CURRENT_DATE"));
+ registerFunctionModifier(SourceSystemFunctions.CURTIME,
+ new AliasModifier("CURRENT_TIME"));
+ // SYSTEM FUNCTIONS
+ // //////////////////////////////////
+ registerFunctionModifier(SourceSystemFunctions.IFNULL,
+ new AliasModifier("NVL"));
+
+ // DATA TYPE CONVERSION
+ // /////////////////////////////////////////
+ ConvertModifier convertModifier = new ConvertModifier();
+ convertModifier.addTypeMapping("char(1)", FunctionModifier.CHAR);
+ convertModifier.addTypeMapping("byteint", FunctionModifier.BYTE);
+ convertModifier.addTypeMapping("smallint", FunctionModifier.SHORT);
+ convertModifier.addTypeMapping("bigint", FunctionModifier.LONG);
+ convertModifier.addTypeMapping("numeric(38)",
+ FunctionModifier.BIGINTEGER);
+ convertModifier.addTypeMapping("numeric(38,18)",
+ FunctionModifier.BIGDECIMAL);
+ convertModifier
+ .addTypeMapping("varchar(4000)", FunctionModifier.STRING);
+
+ // /NO BOOLEAN, INTEGER, FLOAT, DATE, TIME, TIMESTAMP, as they are
+ // directly available in netezza
+ // /NO NULL, CLOB, BLOB, OBJECT, XML
+
+ // /BOOLEAN--BYTE, SHORT, INTEGER, LONG, FLOAT, DOUBLE, BIGINTEGER,
+ // BIGDECIMAL--AS IT DOESN'T WORK IMPLICITLY IN NETEZZA
+
+
+ convertModifier.addConvert(FunctionModifier.FLOAT, FunctionModifier.BIGDECIMAL, new CastModifier("numeric"));
+ convertModifier.addConvert(FunctionModifier.DOUBLE, FunctionModifier.BIGDECIMAL, new CastModifier("numeric"));
+
+ convertModifier.addConvert(FunctionModifier.BOOLEAN,
+ FunctionModifier.INTEGER,
+ new BooleanToNumericConversionModifier());
+ convertModifier
+ .addConvert(FunctionModifier.BOOLEAN, FunctionModifier.BYTE,
+ new BooleanToNumericConversionModifier());
+ convertModifier.addConvert(FunctionModifier.BOOLEAN,
+ FunctionModifier.SHORT,
+ new BooleanToNumericConversionModifier());
+ convertModifier
+ .addConvert(FunctionModifier.BOOLEAN, FunctionModifier.LONG,
+ new BooleanToNumericConversionModifier());
+ convertModifier.addConvert(FunctionModifier.BOOLEAN,
+ FunctionModifier.FLOAT,
+ new BooleanToNumericConversionModifier());
+ convertModifier.addConvert(FunctionModifier.BOOLEAN,
+ FunctionModifier.DOUBLE,
+ new BooleanToNumericConversionModifier());
+ convertModifier.addConvert(FunctionModifier.BOOLEAN,
+ FunctionModifier.BIGINTEGER,
+ new BooleanToNumericConversionModifier());
+ convertModifier.addConvert(FunctionModifier.BOOLEAN,
+ FunctionModifier.BIGDECIMAL,
+ new BooleanToNumericConversionModifier());
+ convertModifier.addConvert(FunctionModifier.BOOLEAN,
+ FunctionModifier.STRING,
+ new BooleanToStringConversionModifier());
+ convertModifier.addConvert(FunctionModifier.STRING,
+ FunctionModifier.BOOLEAN, new FunctionModifier() {
+ @Override
+ public List<?> translate(Function function) {
+ Expression stringValue = function.getParameters()
+ .get(0);
+ return Arrays.asList("CASE WHEN ", stringValue,
+ " IN ('false', '0') THEN '0' WHEN ",
+ stringValue, " IS NOT NULL THEN '1' END");
+ }
+ });
+ convertModifier.addTypeConversion(new FunctionModifier() {
+ @Override
+ public List<?> translate(Function function) {
+ Expression stringValue = function.getParameters().get(0);
+ return Arrays.asList("CASE WHEN ", stringValue,
+ " = 0 THEN '0' WHEN ", stringValue,
+ " IS NOT NULL THEN '1' END");
+ }
+ }, FunctionModifier.BOOLEAN);
+
+ // //////STRING TO DATATYPE CONVERSION OTHER THAN DATE/TIME
+ convertModifier.addConvert(FunctionModifier.STRING,
+ FunctionModifier.INTEGER, new CastModifier("integer"));
+ convertModifier.addConvert(FunctionModifier.STRING,
+ FunctionModifier.FLOAT, new CastModifier("float"));
+ convertModifier.addConvert(FunctionModifier.STRING,
+ FunctionModifier.DOUBLE, new CastModifier("double"));
+ // /// STRING --> CHAR, BYTE, SHORT, LONG, BIGI, BIGD, BOOLEAN is taken
+ // care by Type Mapping
+ // /// NO conversion support for NULL, CLOB, BLOB, OBJECT, XML
+ // //STRING TO DATE/TIME CONVERSION////
+ // ////////////////////////////////////
+ convertModifier.addConvert(FunctionModifier.STRING,
+ FunctionModifier.DATE, new ConvertModifier.FormatModifier(
+ "to_date", DATE_FORMAT));
+ convertModifier.addConvert(FunctionModifier.STRING,
+ FunctionModifier.TIME, new ConvertModifier.FormatModifier(
+ "to_timestamp", TIME_FORMAT));
+ convertModifier.addConvert(FunctionModifier.STRING,
+ FunctionModifier.TIMESTAMP, new ConvertModifier.FormatModifier(
+ "to_timestamp", TIMESTAMP_FORMAT));
+ // ////DATE/TIME INTERNAL CONVERSION/////////
+ convertModifier.addConvert(FunctionModifier.TIMESTAMP,
+ FunctionModifier.TIME, new CastModifier("TIME"));
+ convertModifier.addConvert(FunctionModifier.TIMESTAMP,
+ FunctionModifier.DATE, new CastModifier("DATE"));
+ convertModifier.addConvert(FunctionModifier.DATE,
+ FunctionModifier.TIMESTAMP, new CastModifier("TIMESTAMP"));
+ // convertModifier.addConvert(FunctionModifier.TIME,
+ // FunctionModifier.TIMESTAMP, new CastModifier("TIMESTAMP")); //TIME
+ // --> TIMESTAMP --DOESN't WORK IN NETEZZA-NO FUNCTION SUPPORT
+
+ // //DATE/TIME to STRING CONVERION////
+ // ///////////////////////////////////
+ convertModifier.addConvert(FunctionModifier.TIMESTAMP,
+ FunctionModifier.STRING, new ConvertModifier.FormatModifier(
+ "to_char", TIMESTAMP_FORMAT));
+ // /NO NETEZAA FUNCTION for DATE, TIME to STRING
+
+ convertModifier.setWideningNumericImplicit(true);
+ registerFunctionModifier(SourceSystemFunctions.CONVERT, convertModifier);
+ }
+
+ @Override
+ public List<String> getSupportedFunctions() {
+ List<String> supportedFunctions = new ArrayList<String>();
+ supportedFunctions.addAll(super.getSupportedFunctions());
+
+ // //////////////////////////////////////////////////////////
+ // STRING FUNCTIONS
+ // ////////////////////////////////////////////////////////
+ supportedFunctions.add(SourceSystemFunctions.ASCII);// taken care with
+ // alias function
+ // modifier
+ supportedFunctions.add(SourceSystemFunctions.CHAR);// ALIAS to use 'chr'
+ supportedFunctions.add(SourceSystemFunctions.CONCAT); // ALIAS ||
+ supportedFunctions.add(SourceSystemFunctions.INITCAP);
+ supportedFunctions.add(SourceSystemFunctions.LCASE);// ALIAS 'lower'
+// supportedFunctions.add(SourceSystemFunctions.LPAD);
+ supportedFunctions.add(SourceSystemFunctions.LENGTH);
+ supportedFunctions.add(SourceSystemFunctions.LOCATE); // LOCATE FUNCTIO
+ // MODIFIER
+ supportedFunctions.add(SourceSystemFunctions.LTRIM);
+ // supportedFunctions.add(SourceSystemFunctions.REPEAT);
+// supportedFunctions.add(SourceSystemFunctions.RPAD);
+ supportedFunctions.add(SourceSystemFunctions.RTRIM);
+ supportedFunctions.add(SourceSystemFunctions.SUBSTRING); // No Need of
+ // ALIAS as
+ // both
+ // substring
+ // and
+ // substr
+ // work in
+ // netezza
+ supportedFunctions.add(SourceSystemFunctions.UCASE); // ALIAS UPPER
+ // FUNCTION DIFFERENCE = "difference"; ///NO FUNCTION FOUND--DIFFERENCE
+ // FUNCTION INSERT = "insert";
+ // supportedFunctions.add(SourceSystemFunctions.LEFT); //is this
+ // available or is it simply for LEFT OUTER JOIN?
+ // FUNCTION REPLACE = "replace"; // NO REPLACE Function
+ // supportedFunctions.add(SourceSystemFunctions.RIGHT);--is this
+ // available or is it simply for RIGHT OUTER JOIN?
+ // FUNCTION SOUNDEX = "soundex";
+ // FUNCTION TO_BYTES = "to_bytes";
+ // FUNCTION TO_CHARS = "to_chars";
+ // ////////
+ // ////////////////////////////////////////////////////////////////////
+ // NUMERIC
+ // FUNCTIONS////////////////////////////////////////////////////////////
+ // ////////////////////////////////////////////////////////////////////////////
+ // supportedFunctions.add(SourceSystemFunctions.ABS);
+// supportedFunctions.add(SourceSystemFunctions.ACOS);
+// supportedFunctions.add(SourceSystemFunctions.ASIN);
+// supportedFunctions.add(SourceSystemFunctions.ATAN);
+// supportedFunctions.add(SourceSystemFunctions.ATAN2);
+ supportedFunctions.add(SourceSystemFunctions.CEILING); // /ALIAS-ceil
+ supportedFunctions.add(SourceSystemFunctions.COS);
+ supportedFunctions.add(SourceSystemFunctions.COT);
+ supportedFunctions.add(SourceSystemFunctions.DEGREES);
+ // supportedFunctions.add(SourceSystemFunctions.EXP);
+ supportedFunctions.add(SourceSystemFunctions.FLOOR);
+ supportedFunctions.add(SourceSystemFunctions.LOG);
+// supportedFunctions.add(SourceSystemFunctions.MOD);
+ supportedFunctions.add(SourceSystemFunctions.PI);
+ supportedFunctions.add(SourceSystemFunctions.POWER);// ALIAS-POW
+ supportedFunctions.add(SourceSystemFunctions.RADIANS);
+ supportedFunctions.add(SourceSystemFunctions.ROUND);
+ supportedFunctions.add(SourceSystemFunctions.SIGN);
+ supportedFunctions.add(SourceSystemFunctions.SIN);
+ supportedFunctions.add(SourceSystemFunctions.SQRT);
+ supportedFunctions.add(SourceSystemFunctions.TAN);
+ // FUNCTION TRANSLATE = "translate";
+ // FUNCTION TRUNCATE = "truncate";
+ // FUNCTION FORMATINTEGER = "formatinteger";
+ // FUNCTION FORMATLONG = "formatlong";
+ // FUNCTION FORMATDOUBLE = "formatdouble";
+ // FUNCTION FORMATFLOAT = "formatfloat";
+ // FUNCTION FORMATBIGINTEGER = "formatbiginteger";
+ // FUNCTION FORMATBIGDECIMAL = "formatbigdecimal";
+ // FUNCTION LOG10 = "log10";
+ // FUNCTION PARSEINTEGER = "parseinteger";
+ // FUNCTION PARSELONG = "parselong";
+ // FUNCTION PARSEDOUBLE = "parsedouble";
+ // FUNCTION PARSEFLOAT = "parsefloat";
+ // FUNCTION PARSEBIGINTEGER = "parsebiginteger";
+ // FUNCTION PARSEBIGDECIMAL = "parsebigdecimal";
+ // supportedFunctions.add(SourceSystemFunctions.RAND); --Needs
+ // Alias--But, is it required to even have an alias???
+ // ///////////////////////////////////////////////////////////////////
+ // BIT FUNCTIONS//////////////////////////////////////////////////////
+ // ALIAS FUNCTION MODIFIER IS APPLIED//////////////////////////////
+ supportedFunctions.add(SourceSystemFunctions.BITAND);
+ supportedFunctions.add(SourceSystemFunctions.BITOR);
+ supportedFunctions.add(SourceSystemFunctions.BITNOT);
+ supportedFunctions.add(SourceSystemFunctions.BITXOR);
+ // DATE FUNCTIONS
+ supportedFunctions.add(SourceSystemFunctions.CURDATE);
+ supportedFunctions.add(SourceSystemFunctions.CURTIME);
+ supportedFunctions.add(SourceSystemFunctions.DAYOFMONTH);
+ supportedFunctions.add(SourceSystemFunctions.DAYOFYEAR);
+ supportedFunctions.add(SourceSystemFunctions.DAYOFWEEK);
+ supportedFunctions.add(SourceSystemFunctions.HOUR);
+ supportedFunctions.add(SourceSystemFunctions.MINUTE);
+ supportedFunctions.add(SourceSystemFunctions.MONTH);
+ supportedFunctions.add(SourceSystemFunctions.QUARTER);
+ supportedFunctions.add(SourceSystemFunctions.SECOND);
+ supportedFunctions.add(SourceSystemFunctions.WEEK);
+ supportedFunctions.add(SourceSystemFunctions.YEAR);
+ // FUNCTION DAYNAME = "dayname";
+ // FUNCTION FORMATTIMESTAMP = "formattimestamp";
+ // FUNCTION MODIFYTIMEZONE = "modifytimezone";
+ // FUNCTION MONTHNAME = "monthname";
+ // FUNCTION NOW = "now";
+ // FUNCTION PARSETIMESTAMP = "parsetimestamp";
+ // FUNCTION TIMESTAMPADD = "timestampadd";
+ // FUNCTION TIMESTAMPCREATE = "timestampcreate";
+ // FUNCTION TIMESTAMPDIFF = "timestampdiff";
+
+ // SYSTEM FUNCTIONS
+ supportedFunctions.add(SourceSystemFunctions.IFNULL); // ALIAS-NVL
+ supportedFunctions.add(SourceSystemFunctions.COALESCE);
+ supportedFunctions.add(SourceSystemFunctions.NULLIF);
+
+ // CONVERSION functions
+ supportedFunctions.add(SourceSystemFunctions.CONVERT);
+
+ // USER DEFINED FUNCTIONS
+ // supportedFunctions.add("USR_DEF_FUNC");
+
+ return supportedFunctions;
+ }
+
+ public static class ExtractModifier extends FunctionModifier {
+ private String type;
+
+ public ExtractModifier(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public List<?> translate(Function function) {
+ return Arrays.asList("extract(", this.type, " from ", function
+ .getParameters().get(0), ")");
+ }
+ }
+
+ public static class BooleanToNumericConversionModifier extends
+ FunctionModifier {
+ @Override
+ public List<?> translate(Function function) {
+ Expression booleanValue = function.getParameters().get(0);
+ if (booleanValue instanceof Function) {
+ Function nested = (Function) booleanValue;
+ if (nested.getName().equalsIgnoreCase("convert")
+ && Number.class.isAssignableFrom(nested.getParameters()
+ .get(0).getType())) {
+ booleanValue = nested.getParameters().get(0);
+ }
+ }
+ return Arrays.asList("(CASE WHEN ", booleanValue,
+ " IN ( '0', 'FALSE') THEN 0 WHEN ", booleanValue,
+ " IS NOT NULL THEN 1 END)");
+ }
+
+ }
+
+ public static class BooleanToStringConversionModifier extends
+ FunctionModifier {
+ @Override
+ public List<?> translate(Function function) {
+ Expression booleanValue = function.getParameters().get(0);
+ if (booleanValue instanceof Function) {
+ Function nested = (Function) booleanValue;
+ if (nested.getName().equalsIgnoreCase("convert")
+ && Number.class.isAssignableFrom(nested.getParameters()
+ .get(0).getType())) {
+ booleanValue = nested.getParameters().get(0);
+ }
+ }
+ return Arrays.asList("CASE WHEN ", booleanValue,
+ " = '0' THEN 'false' WHEN ", booleanValue,
+ " IS NOT NULL THEN 'true' END");
+ }
+
+ }
+
+ public static class CastModifier extends FunctionModifier {
+ private String target;
+
+ public CastModifier(String target) {
+ this.target = target;
+ }
+
+ @Override
+ public List<?> translate(Function function) {
+ return Arrays.asList("cast(", function.getParameters().get(0),
+ " AS " + this.target + ")");
+ }
+ }
+
+ @Override
+ public List<?> translateLimit(Limit limit, ExecutionContext context) {
+ if (limit.getRowOffset() > 0) {
+ return Arrays.asList("LIMIT ", limit.getRowLimit(), " OFFSET ",
+ limit.getRowOffset());
+ }
+ return null;
+ }
+
+ @Override
+ public boolean supportsCorrelatedSubqueries() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsIntersect() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsExcept() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsInlineViews() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsRowLimit() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsRowOffset() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsAggregatesEnhancedNumeric() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsFunctionsInGroupBy() {
+ return true;
+ }
+
+}
Added: branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaConvertModifier.java
===================================================================
--- branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaConvertModifier.java (rev 0)
+++ branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaConvertModifier.java 2011-11-10 17:48:21 UTC (rev 3631)
@@ -0,0 +1,509 @@
+/*
+ * 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.translator.jdbc.netezza;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Arrays;
+
+import junit.framework.TestCase;
+
+import org.teiid.language.Expression;
+import org.teiid.language.Function;
+import org.teiid.language.LanguageFactory;
+import org.teiid.translator.TypeFacility;
+import org.teiid.translator.jdbc.SQLConversionVisitor;
+
+
+/**
+ */
+public class TestNetezzaConvertModifier extends TestCase {
+
+ private static final LanguageFactory LANG_FACTORY = new LanguageFactory();
+
+ public TestNetezzaConvertModifier(String name) {
+ super(name);
+ }
+
+ public String helpGetString(Expression expr) throws Exception {
+ NetezzaExecutionFactory trans = new NetezzaExecutionFactory();
+ trans.start();
+ SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor();
+ sqlVisitor.append(expr);
+
+ return sqlVisitor.toString();
+ }
+
+ public void helpTest(Expression srcExpression, String tgtType, String expectedExpression) throws Exception {
+ Function func = LANG_FACTORY.createFunction("convert", //$NON-NLS-1$
+ Arrays.asList(
+ srcExpression,
+ LANG_FACTORY.createLiteral(tgtType, String.class)),
+ TypeFacility.getDataTypeClass(tgtType));
+
+ assertEquals("Error converting from " + srcExpression.getType() + " to " + tgtType,
+ expectedExpression, helpGetString(func));
+ }
+
+
+
+
+ // Source = STRING
+ public void testStringToChar() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral("5", String.class), "char", "cast('5' AS char(1))");
+ }
+
+ public void testStringToBoolean() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral("5", String.class), "boolean", "CASE WHEN '5' IN ('false', '0') THEN '0' WHEN '5' IS NOT NULL THEN '1' END");
+ }
+
+ public void testStringToByte() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral("5", String.class), "byte", "cast('5' AS byteint)");
+ }
+
+ public void testStringToShort() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral("5", String.class), "short", "cast('5' AS smallint)");
+ }
+
+ public void testStringToInteger() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral("5", String.class), "integer", "cast('5' AS integer)");
+ }
+
+ public void testStringToLong() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral("5", String.class), "long", "cast('5' AS bigint)");
+ }
+
+ public void testStringToBigInteger() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral("5", String.class), "biginteger", "cast('5' AS numeric(38))"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ public void testStringToFloat() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral("5", String.class), "float", "cast('5' AS float)");
+ }
+
+ public void testStringToDouble() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral("5", String.class), "double", "cast('5' AS double)");
+ }
+
+ public void testStringToDate() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral("2004-06-29", String.class), "date", "to_date('2004-06-29', 'YYYY-MM-DD')");
+ }
+
+ public void testStringToTime() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral("23:59:59", String.class), "time", "to_timestamp('23:59:59', 'HH24:MI:SS')");
+ }
+
+ public void testStringToTimestamp() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral("2004-06-29 23:59:59.987", String.class), "timestamp", "to_timestamp('2004-06-29 23:59:59.987', 'YYYY-MM-DD HH24:MI:SS.MS')");
+ }
+
+ public void testStringToBigDecimal() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral("5", String.class), "bigdecimal", "cast('5' AS numeric(38,18))");
+ }
+
+ // Source = CHAR
+
+ public void testCharToString() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(new Character('5'), Character.class), "string", "'5'");
+ }
+
+ // Source = BOOLEAN
+
+ public void testBooleanToString() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "string", "CASE WHEN 1 = '0' THEN 'false' WHEN 1 IS NOT NULL THEN 'true' END");
+ }
+
+ public void testBooleanToByte() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(Boolean.FALSE, Boolean.class), "byte", "(CASE WHEN 0 IN ( '0', 'FALSE') THEN 0 WHEN 0 IS NOT NULL THEN 1 END)");
+ }
+
+ public void testBooleanToShort() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(Boolean.FALSE, Boolean.class), "short", "(CASE WHEN 0 IN ( '0', 'FALSE') THEN 0 WHEN 0 IS NOT NULL THEN 1 END)");
+ }
+
+ public void testBooleanToInteger() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(Boolean.FALSE, Boolean.class), "integer", "(CASE WHEN 0 IN ( '0', 'FALSE') THEN 0 WHEN 0 IS NOT NULL THEN 1 END)");
+ }
+
+ public void testBooleanToLong() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(Boolean.FALSE, Boolean.class), "long", "(CASE WHEN 0 IN ( '0', 'FALSE') THEN 0 WHEN 0 IS NOT NULL THEN 1 END)");
+ }
+
+ public void testBooleanToBigInteger() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(Boolean.FALSE, Boolean.class), "biginteger", "(CASE WHEN 0 IN ( '0', 'FALSE') THEN 0 WHEN 0 IS NOT NULL THEN 1 END)");
+ }
+
+ public void testBooleanToFloat() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(Boolean.FALSE, Boolean.class), "float", "(CASE WHEN 0 IN ( '0', 'FALSE') THEN 0 WHEN 0 IS NOT NULL THEN 1 END)");
+ }
+
+ public void testBooleanToDouble() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(Boolean.FALSE, Boolean.class), "double", "(CASE WHEN 0 IN ( '0', 'FALSE') THEN 0 WHEN 0 IS NOT NULL THEN 1 END)");
+ }
+
+ public void testBooleanToBigDecimal() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(Boolean.FALSE, Boolean.class), "bigdecimal", "(CASE WHEN 0 IN ( '0', 'FALSE') THEN 0 WHEN 0 IS NOT NULL THEN 1 END)");
+ }
+
+ // Source = BYTE
+
+ public void testByteToString() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "string", "cast(1 AS varchar(4000))");
+ }
+
+ public void testByteToBoolean() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "boolean", "CASE WHEN 1 = 0 THEN '0' WHEN 1 IS NOT NULL THEN '1' END");
+ }
+
+// public void testByteToShort() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "short", "1");
+// }
+//
+// public void testByteToInteger() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "integer", "integer(1)");
+// }
+//
+// public void testByteToLong() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "long", "bigint(1)");
+// }
+//
+// public void testByteToBigInteger() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "biginteger", "cast(1 AS numeric(31,0))");
+// }
+//
+// public void testByteToFloat() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "float", "cast(1 AS real)");
+// }
+//
+// public void testByteToDouble() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "double", "double(1)");
+// }
+//
+// public void testByteToBigDecimal() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "bigdecimal", "cast(1 AS numeric(31,12))");
+// }
+
+ // Source = SHORT
+
+ public void testShortToString() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "string", "cast(1 AS varchar(4000))");
+ }
+
+ public void testShortToBoolean() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "boolean", "CASE WHEN 1 = 0 THEN '0' WHEN 1 IS NOT NULL THEN '1' END");
+ }
+
+// public void testShortToByte() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "byte", "1");
+// }
+//
+// public void testShortToInteger() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "integer", "integer(1)");
+// }
+//
+// public void testShortToLong() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "long", "bigint(1)");
+// }
+//
+// public void testShortToBigInteger() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "biginteger", "cast(1 AS numeric(31,0))");
+// }
+//
+// public void testShortToFloat() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "float", "cast(1 AS real)");
+// }
+//
+// public void testShortToDouble() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "double", "double(1)");
+// }
+//
+// public void testShortToBigDecimal() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "bigdecimal", "cast(1 AS numeric(31,12))");
+// }
+
+ // Source = INTEGER
+
+ public void testIntegerToString() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "string", "cast(1 AS varchar(4000))");
+ }
+
+ public void testIntegerToBoolean() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "boolean", "CASE WHEN 1 = 0 THEN '0' WHEN 1 IS NOT NULL THEN '1' END");
+ }
+
+// public void testIntegerToByte() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "byte", "smallint(1)");
+// }
+//
+// public void testIntegerToShort() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "short", "smallint(1)");
+// }
+//
+// public void testIntegerToLong() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "long", "bigint(1)");
+// }
+//
+// public void testIntegerToBigInteger() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "biginteger", "cast(1 AS numeric(31,0))");
+// }
+//
+// public void testIntegerToFloat() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "float", "cast(1 AS real)");
+// }
+//
+// public void testIntegerToDouble() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "double", "double(1)");
+// }
+//
+// public void testIntegerToBigDecimal() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "bigdecimal", "cast(1 AS numeric(31,12))");
+// }
+
+ // Source = LONG
+
+ public void testLongToString() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "string", "cast(1 AS varchar(4000))");
+ }
+
+ public void testLongToBoolean() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "boolean", "CASE WHEN 1 = 0 THEN '0' WHEN 1 IS NOT NULL THEN '1' END");
+ }
+
+// public void testLongToByte() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "byte", "smallint(1)");
+// }
+//
+// public void testLongToShort() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "short", "smallint(1)");
+// }
+//
+// public void testLongToInteger() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "integer", "integer(1)");
+// }
+//
+// public void testLongToBigInteger() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "biginteger", "cast(1 AS numeric(31,0))");
+// }
+//
+// public void testLongToFloat() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "float", "cast(1 AS real)");
+// }
+//
+// public void testLongToDouble() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "double", "double(1)");
+// }
+//
+// public void testLongToBigDecimal() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "bigdecimal", "cast(1 AS numeric(31,12))");
+// }
+
+ // Source = BIGINTEGER
+
+ public void testBigIntegerToString() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "string", "cast(1 AS varchar(4000))");
+ }
+
+ public void testBigIntegerToBoolean() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "boolean", "CASE WHEN 1 = 0 THEN '0' WHEN 1 IS NOT NULL THEN '1' END");
+ }
+
+// public void testBigIntegerToByte() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "byte", "smallint(1)");
+// }
+//
+// public void testBigIntegerToShort() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "short", "smallint(1)");
+// }
+//
+// public void testBigIntegerToInteger() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "integer", "integer(1)");
+// }
+//
+// public void testBigIntegerToLong() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "long", "bigint(1)");
+// }
+//
+// public void testBigIntegerToFloat() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "float", "cast(1 AS real)");
+// }
+//
+// public void testBigIntegerToDouble() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "double", "double(1)");
+// }
+//
+// public void testBigIntegerToBigDecimal() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "bigdecimal", "cast(1 AS numeric(31,12))");
+// }
+
+ // Source = FLOAT
+
+ public void testFloatToString() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "string", "cast(1.2 AS varchar(4000))");
+ }
+
+ public void testFloatToBoolean() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "boolean", "CASE WHEN 1.2 = 0 THEN '0' WHEN 1.2 IS NOT NULL THEN '1' END");
+ }
+
+// public void testFloatToByte() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "byte", "smallint(1.2)");
+// }
+//
+// public void testFloatToShort() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "short", "smallint(1.2)");
+// }
+//
+// public void testFloatToInteger() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "integer", "integer(1.2)");
+// }
+//
+// public void testFloatToLong() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "long", "bigint(1.2)");
+// }
+//
+// public void testFloatToBigInteger() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "biginteger", "cast(1.2 AS numeric(31,0))");
+// }
+//
+// public void testFloatToDouble() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "double", "double(1.2)");
+// }
+//
+// public void testFloatToBigDecimal() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "bigdecimal", "cast(1.2 AS numeric(31,12))");
+// }
+
+ // Source = DOUBLE
+
+ public void testDoubleToString() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "string", "cast(1.2 AS varchar(4000))");
+ }
+
+ public void testDoubleToBoolean() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "boolean", "CASE WHEN 1.2 = 0 THEN '0' WHEN 1.2 IS NOT NULL THEN '1' END");
+ }
+
+// public void testDoubleToByte() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "byte", "smallint(1.2)");
+// }
+//
+// public void testDoubleToShort() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "short", "smallint(1.2)");
+// }
+//
+// public void testDoubleToInteger() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "integer", "integer(1.2)");
+// }
+//
+// public void testDoubleToLong() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "long", "bigint(1.2)");
+// }
+//
+// public void testDoubleToBigInteger() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "biginteger", "cast(1.2 AS numeric(31,0))");
+// }
+//
+// public void testDoubleToFloat() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "float", "cast(1.2 AS real)");
+// }
+//
+// public void testDoubleToBigDecimal() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "bigdecimal", "cast(1.2 AS numeric(31,12))");
+// }
+
+ // Source = BIGDECIMAL
+
+ public void testBigDecimalToString() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "string", "cast(1.0 AS varchar(4000))");
+ }
+
+ public void testBigDecimalToBoolean() throws Exception {
+ helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "boolean", "CASE WHEN 1.0 = 0 THEN '0' WHEN 1.0 IS NOT NULL THEN '1' END");
+ }
+
+// public void testBigDecimalToByte() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "byte", "smallint(1.0)");
+// }
+//
+// public void testBigDecimalToShort() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "short", "smallint(1.0)");
+// }
+//
+// public void testBigDecimalToInteger() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "integer", "integer(1.0)");
+// }
+//
+// public void testBigDecimalToLong() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "long", "bigint(1.0)");
+// }
+//
+// public void testBigDecimalToBigInteger() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "biginteger", "cast(1.0 AS numeric(31,0))");
+// }
+//
+// public void testBigDecimalToFloat() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "float", "cast(1.0 AS real)");
+// }
+//
+// public void testBigDecimalToDouble() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "double", "double(1.0)");
+// }
+
+// // Source = DATE
+//
+// public void testDateToString() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createDate(103, 10, 1), java.sql.Date.class), "string", "char({d '2003-11-01'})");
+// }
+//
+// public void testDateToTimestamp() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createDate(103, 10, 1), java.sql.Date.class), "timestamp", "timestamp({d '2003-11-01'}, '00:00:00')");
+// }
+//
+// // Source = TIME
+//
+// public void testTimeToString() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createTime(23, 59, 59), java.sql.Time.class), "string", "char({t '23:59:59'})");
+// }
+//
+// public void testTimeToTimestamp() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createTime(23, 59, 59), java.sql.Time.class), "timestamp", "timestamp('1970-01-01', {t '23:59:59'})");
+// }
+//
+// // Source = TIMESTAMP
+//
+// public void testTimestampToString() throws Exception {
+// Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);
+// helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "string", "char({ts '2003-11-01 12:05:02.0'})");
+// }
+//
+// public void testTimestampToDate() throws Exception {
+// Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);
+// helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "date", "date({ts '2003-11-01 12:05:02.0'})");
+// }
+//
+// public void testTimestampToTime() throws Exception {
+// Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);
+// helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "time", "time({ts '2003-11-01 12:05:02.0'})");
+// }
+
+}
Added: branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaTranslatorCapabilities.java
===================================================================
--- branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaTranslatorCapabilities.java (rev 0)
+++ branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaTranslatorCapabilities.java 2011-11-10 17:48:21 UTC (rev 3631)
@@ -0,0 +1,376 @@
+package org.teiid.translator.jdbc.netezza;
+
+import junit.framework.TestCase;
+
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.teiid.cdk.unittest.FakeTranslationFactory;
+import org.teiid.dqp.internal.datamgr.FakeExecutionContextImpl;
+import org.teiid.language.Command;
+import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.jdbc.TranslatedCommand;
+import org.teiid.translator.jdbc.TranslationHelper;
+
+public class TestNetezzaTranslatorCapabilities extends TestCase {
+
+ private static NetezzaExecutionFactory TRANSLATOR;
+ private static ExecutionContext EMPTY_CONTEXT = new FakeExecutionContextImpl();
+
+ static {
+ try {
+ TRANSLATOR = new NetezzaExecutionFactory();
+ TRANSLATOR.start();
+ } catch(TranslatorException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ private String getTestBQTVDB() {
+ return TranslationHelper.BQT_VDB;
+ }
+
+ public void helpTestVisitor(String input, String expectedOutput) throws TranslatorException {
+ // Convert from sql to objects
+ Command obj = FakeTranslationFactory.getInstance().getBQTTranslationUtility().parseCommand(input);
+
+ TranslatedCommand tc = new TranslatedCommand(Mockito.mock(ExecutionContext.class), TRANSLATOR);
+ tc.translateCommand(obj);
+
+
+ // Check stuff
+ assertEquals("Did not get correct sql", expectedOutput, tc.getSql());
+ }
+
+
+ /////////BASIC TEST CASES FOR CAPABILITIES/////////////
+ /////////////////////////////////////////////////
+ @Test
+ public void testRowLimit() throws Exception {
+ String input = "select intkey from bqt1.smalla limit 100";
+ String output = "SELECT SmallA.IntKey FROM SmallA LIMIT 100";
+
+ helpTestVisitor(
+ input,
+ output);
+
+ }
+ @Test
+ public void testSelectDistinct() throws Exception {
+ String input = "select distinct intkey from bqt1.smalla limit 100";
+ String output = "SELECT DISTINCT SmallA.IntKey FROM SmallA LIMIT 100";
+
+ helpTestVisitor(
+ input,
+ output);
+ }
+ @Test
+ public void testSelectExpression() throws Exception {
+ String input = "select intkey, intkey + longnum / 2 as test from bqt1.smalla";
+ String output = "SELECT SmallA.IntKey, (SmallA.IntKey + (SmallA.LongNum / 2)) AS test FROM SmallA";
+
+ helpTestVisitor(
+ input,
+ output);
+ }
+
+ public void testBetweenCriteria() throws Exception {
+ String input = "select intkey, intnum from bqt1.smalla where intnum BETWEEN 2 AND 10";
+ String output = "SELECT SmallA.IntKey, SmallA.IntNum FROM SmallA WHERE SmallA.IntNum >= ? AND SmallA.IntNum <= ?";
+
+ helpTestVisitor(
+ input,
+ output);
+ }
+ public void testCompareCriteriaEquals() throws Exception {
+ String input = "select intkey, intnum from bqt1.smalla where intnum = 10";
+ String output = "SELECT SmallA.IntKey, SmallA.IntNum FROM SmallA WHERE SmallA.IntNum = ?";
+
+ helpTestVisitor(
+ input,
+ output);
+ }
+ public void testCompareCriteriaOrdered() throws Exception {
+ String input = "select intkey, intnum from bqt1.smalla where intnum < 10";
+ String output = "SELECT SmallA.IntKey, SmallA.IntNum FROM SmallA WHERE SmallA.IntNum < ?";
+
+ helpTestVisitor(
+ input,
+ output);
+ }
+ public void testLikeCriteria() throws Exception {
+ String input = "select intkey, intnum from bqt1.smalla where stringkey like '4%'";
+ String output = "SELECT SmallA.IntKey, SmallA.IntNum FROM SmallA WHERE SmallA.StringKey LIKE ?";
+
+ helpTestVisitor(
+ input,
+ output);
+ }
+ public void testLikeWithEscapeCriteria() throws Exception {
+ String input = "select intkey, intnum from bqt1.smalla where stringkey like '4\\%'";
+ String output = "SELECT SmallA.IntKey, SmallA.IntNum FROM SmallA WHERE SmallA.StringKey LIKE ?";
+
+ helpTestVisitor(
+ input,
+ output);
+ }
+
+ public void testInCriteria() throws Exception {
+ String input = "select intkey, intnum from bqt1.smalla where stringkey IN ('10', '11', '12')";
+ String output = "SELECT SmallA.IntKey, SmallA.IntNum FROM SmallA WHERE SmallA.StringKey IN (?, ?, ?)";
+
+ helpTestVisitor(
+ input,
+ output);
+ }
+ public void testInCriteriaSubQuery() throws Exception {
+ String input = "select intkey, intnum from bqt1.smalla where stringkey IN (select stringkey from bqt1.smalla where intkey < 10)";
+ String output = "SELECT SmallA.IntKey, SmallA.IntNum FROM SmallA WHERE SmallA.StringKey IN (SELECT SmallA.StringKey FROM SmallA WHERE SmallA.IntKey < ?)";
+
+ helpTestVisitor(
+ input,
+ output);
+ }
+
+ public void testIsNullCriteria() throws Exception {
+ String input = "select intkey, intnum from bqt1.smalla where intnum IS NULL";
+ String output = "SELECT SmallA.IntKey, SmallA.IntNum FROM SmallA WHERE SmallA.IntNum IS NULL";
+
+ helpTestVisitor(
+ input,
+ output);
+ }
+ @Test public void testOrCriteria() throws Exception {
+ String input = "select intkey, intnum from bqt1.smalla where intnum < 2 OR intnum > 10";
+ String output = "SELECT SmallA.IntKey, SmallA.IntNum FROM SmallA WHERE SmallA.IntNum < ? OR SmallA.IntNum > ?";
+
+ helpTestVisitor(
+ input,
+ output);
+ }
+ @Test public void testIsNotNullCriteria() throws Exception {
+ String input = "select intkey, intnum from bqt1.smalla where intnum IS NOT NULL";
+ String output = "SELECT SmallA.IntKey, SmallA.IntNum FROM SmallA WHERE SmallA.IntNum IS NOT NULL";
+
+ helpTestVisitor(
+ input,
+ output);
+ }
+
+ @Test public void testExistsCriteria() throws Exception {
+ String input = "select intkey, intnum from bqt1.smalla where exists (select intkey from bqt1.smallb)";
+ String output = "SELECT SmallA.IntKey, SmallA.IntNum FROM SmallA WHERE EXISTS (SELECT SmallB.IntKey FROM SmallB)";
+
+ helpTestVisitor(
+ input,
+ output);
+ }
+ @Test public void testHavingClauseCriteria() throws Exception {
+ String input = "SELECT INTKEY FROM BQT1.SMALLA GROUP BY INTKEY HAVING INTKEY = (SELECT INTKEY FROM BQT1.SMALLA WHERE STRINGKEY = 20)";
+ String output = "SELECT SmallA.IntKey FROM SmallA GROUP BY SmallA.IntKey HAVING SmallA.IntKey = (SELECT SmallA.IntKey FROM SmallA WHERE SmallA.StringKey = ?)";
+
+ helpTestVisitor(
+ input,
+ output);
+ }
+
+ @Test public void testScalarSubQuery() throws Exception {
+ String input = "select intkey, intnum from bqt1.smalla where intnum < (0.01 * (select sum(intnum) from bqt1.smalla ))";
+ String output = "SELECT SmallA.IntKey, SmallA.IntNum FROM SmallA WHERE SmallA.IntNum < (0.010000000000000 * (SELECT SUM(SmallA.IntNum) FROM SmallA))";
+
+ helpTestVisitor(
+ input,
+ output);
+ }
+
+ @Test public void testSimpleCaseExpression() throws Exception {
+ String input = "SELECT stringnum, intnum, CASE BOOLEANVALUE WHEN 'true' then 'true' WHEN false THEN 'FALSE' ELSE 'GOOD' END FROM bqt1.smalla;";
+ String output = "SELECT SmallA.StringNum, SmallA.IntNum, CASE WHEN SmallA.BooleanValue = ? THEN 'true' WHEN SmallA.BooleanValue = ? THEN 'FALSE' ELSE 'GOOD' END FROM SmallA";
+
+ helpTestVisitor(
+ input,
+ output);
+ }
+
+ @Test public void testSearchedCaseExpression() throws Exception {
+ String input = "SELECT AVG(CASE WHEN intnum > 10 THEN intnum ELSE intkey END) \"Average\" FROM bqt1.smalla";
+ String output = "SELECT AVG(CASE WHEN SmallA.IntNum > ? THEN SmallA.IntNum ELSE SmallA.IntKey END) AS Average FROM SmallA";
+
+ helpTestVisitor(
+ input,
+ output);
+ }
+
+ @Test public void testQuantifiedCompareSOMEorANY() throws Exception {
+ String input = "SELECT INTKEY, BYTENUM FROM BQT1.SmallA WHERE BYTENUM = ANY (SELECT BYTENUM FROM BQT1.SmallA WHERE BYTENUM >= '-108')";
+ String output = "SELECT SmallA.IntKey, SmallA.ByteNum FROM SmallA WHERE SmallA.ByteNum = SOME (SELECT SmallA.ByteNum FROM SmallA WHERE SmallA.ByteNum >= ?)";
+
+ helpTestVisitor(
+ input,
+ output);
+ }
+
+ @Test public void testQuantifiedCompareALL() throws Exception {
+ String input = "SELECT INTKEY, STRINGKEY FROM BQT1.SMALLA WHERE STRINGKEY = ALL (SELECT STRINGKEY FROM BQT1.SMALLA WHERE INTKEY = 40)";
+ String output = "SELECT SmallA.IntKey, SmallA.StringKey FROM SmallA WHERE SmallA.StringKey = ALL (SELECT SmallA.StringKey FROM SmallA WHERE SmallA.IntKey = ?)";
+
+ helpTestVisitor(
+ input,
+ output);
+ }
+
+ @Test public void testSelfJoin() throws Exception {
+ String input = "SELECT x.intnum, y.intkey FROM bqt1.smalla x, bqt1.smalla y WHERE x.stringnum = y.intnum;";
+ String output = "SELECT x.IntNum, y.IntKey FROM SmallA AS x, SmallA AS y WHERE x.StringNum = cast(y.IntNum AS varchar(4000))";
+
+ helpTestVisitor(
+ input,
+ output);
+ }
+
+ @Test public void testLimitWithNestedInlineView() throws Exception {
+ String input = "select max(intkey), stringkey from (select intkey, stringkey from bqt1.smalla order by intkey limit 100) x group by stringkey";
+ String output = "SELECT MAX(x.intkey), x.stringkey FROM (SELECT SmallA.IntKey, SmallA.StringKey FROM SmallA ORDER BY SmallA.IntKey LIMIT 100) AS x GROUP BY x.stringkey";
+
+ helpTestVisitor( input, output);
+ }
+
+ @Test public void testAggregatesAndEnhancedNumeric() throws Exception {
+ String input = "select count(*), min(intkey), max(intkey), sum(intkey), avg(intkey), count(intkey), STDDEV_SAMP(intkey), STDDEV_POP(intkey), VAR_SAMP(intkey), VAR_POP(intkey) from bqt1.smalla";
+ String output = "SELECT COUNT(*), MIN(SmallA.IntKey), MAX(SmallA.IntKey), SUM(SmallA.IntKey), AVG(SmallA.IntKey), COUNT(SmallA.IntKey), STDDEV_SAMP(SmallA.IntKey), STDDEV_POP(SmallA.IntKey), VAR_SAMP(SmallA.IntKey), VAR_POP(SmallA.IntKey) FROM SmallA";
+
+ helpTestVisitor( input, output);
+ }
+ @Test public void testAggregatesDistinct() throws Exception {
+ String input = "select avg(DISTINCT intnum) from bqt1.smalla";
+ String output = "SELECT AVG(DISTINCT SmallA.IntNum) FROM SmallA";
+
+ helpTestVisitor( input, output);
+ }
+
+
+ @Test public void testExceptAsMinus() throws Exception {
+ String input = "select intkey, intnum from bqt1.smalla except select intnum, intkey from bqt1.smallb";
+ String output = "SELECT SmallA.IntKey, SmallA.IntNum FROM SmallA EXCEPT SELECT SmallB.IntNum, SmallB.IntKey FROM SmallB";
+
+ helpTestVisitor( input, output);
+ }
+
+ @Test public void testUnionAsPlus() throws Exception {
+ String input = "select intkey, intnum from bqt1.smalla union select intnum, intkey from bqt1.smallb";
+ String output = "SELECT SmallA.IntKey, SmallA.IntNum FROM SmallA UNION SELECT SmallB.IntNum, SmallB.IntKey FROM SmallB";
+
+ helpTestVisitor( input, output);
+ }
+ @Test public void testUnionAllAsPlus() throws Exception {
+ String input = "select intkey, intnum from bqt1.smalla union all select intnum, intkey from bqt1.smallb";
+ String output = "SELECT SmallA.IntKey, SmallA.IntNum FROM SmallA UNION ALL SELECT SmallB.IntNum, SmallB.IntKey FROM SmallB";
+
+ helpTestVisitor( input, output);
+ }
+
+ @Test public void testUnionAllAsPlusWithAggregates() throws Exception {
+ String input = "select intkey, Sum(intnum) from bqt1.smalla group by intkey union all select intnum, intkey from bqt1.smallb";
+ String output = "SELECT SmallA.IntKey, SUM(SmallA.IntNum) FROM SmallA GROUP BY SmallA.IntKey UNION ALL SELECT SmallB.IntNum, SmallB.IntKey AS IntKey FROM SmallB";
+
+ helpTestVisitor( input, output);
+ }
+
+
+ @Test public void testintersect() throws Exception {
+ String input = "select intkey from bqt1.smalla where intkey < 20 INTERSECT select intkey from bqt1.smalla where intkey > 10";
+ String output = "SELECT SmallA.IntKey FROM SmallA WHERE SmallA.IntKey < ? INTERSECT SELECT SmallA.IntKey FROM SmallA WHERE SmallA.IntKey > ?";
+
+
+ helpTestVisitor( input, output);
+ }
+
+
+ @Test public void testUnionOrderBy() throws Exception {
+ String input = "(select intkey from bqt1.smalla) union select intnum from bqt1.smalla order by intkey";
+ String output = "SELECT SmallA.IntKey FROM SmallA UNION SELECT SmallA.IntNum FROM SmallA ORDER BY intkey";
+
+ helpTestVisitor( input, output);
+
+ }
+
+ @Test public void testIntersectOrderBy() throws Exception {
+ String input = "(select intkey from bqt1.smalla) intersect select intnum from bqt1.smalla order by intkey";
+ String output = "SELECT SmallA.IntKey FROM SmallA INTERSECT SELECT SmallA.IntNum FROM SmallA ORDER BY intkey";
+
+ helpTestVisitor( input, output);
+
+ }
+
+ @Test public void testExceptOrderBy() throws Exception {
+ String input = "(select intkey from bqt1.smalla) except select intnum from bqt1.smalla order by intkey";
+ String output = "SELECT SmallA.IntKey FROM SmallA EXCEPT SELECT SmallA.IntNum FROM SmallA ORDER BY intkey";
+
+ helpTestVisitor( input, output);
+
+ }
+
+
+ @Test public void testRowLimitOFFSET() throws Exception {
+ String input = "select intkey from bqt1.smalla limit 20, 30";
+ String output = "SELECT SmallA.IntKey FROM SmallA LIMIT 30 OFFSET 20";
+
+ helpTestVisitor( input, output);
+ }
+
+
+ @Test public void testOrderByNullsFirstLast() throws Exception {
+ String input = "select intkey, longnum from bqt1.smalla order by longnum NULLS LAST";
+ String output = "SELECT SmallA.IntKey, SmallA.LongNum FROM SmallA ORDER BY SmallA.LongNum NULLS LAST";
+
+ helpTestVisitor( input, output);
+ }
+
+ @Test public void testOrderByUnRelated() throws Exception {
+ String input = "select intkey, longnum from bqt1.smalla order by floatnum";
+ String output = "SELECT SmallA.IntKey, SmallA.LongNum FROM SmallA ORDER BY SmallA.FloatNum";
+
+ helpTestVisitor( input, output);
+ }
+
+
+ @Test public void testInnerJoin() throws Exception {
+ String input = "SELECT BQT1.SmallA.IntKey FROM BQT1.SmallA, BQT2.SmallB WHERE BQT1.SmallA.IntKey = BQT2.SmallB.IntKey AND BQT1.SmallA.IntKey >= 0 AND BQT2.SmallB.IntKey >= 0 ORDER BY BQT1.SmallA.IntKey";
+ String output = "SELECT SmallA.IntKey FROM SmallA, SmallB WHERE SmallA.IntKey = SmallB.IntKey AND SmallA.IntKey >= ? AND SmallB.IntKey >= ? ORDER BY SmallA.IntKey";
+
+ helpTestVisitor( input, output);
+ }
+
+
+ @Test public void testOuterJoin() throws Exception {
+ String input = "SELECT BQT1.SmallA.IntKey FROM BQT1.SmallA, BQT2.SmallB WHERE BQT1.SmallA.IntKey = BQT2.SmallB.IntKey AND BQT1.SmallA.IntKey >= 0 AND BQT2.SmallB.IntKey >= 0 ORDER BY BQT1.SmallA.IntKey";
+ String output = "SELECT SmallA.IntKey FROM SmallA, SmallB WHERE SmallA.IntKey = SmallB.IntKey AND SmallA.IntKey >= ? AND SmallB.IntKey >= ? ORDER BY SmallA.IntKey";
+
+ helpTestVisitor( input, output);
+ }
+
+ @Test public void testFullOuterJoin() throws Exception {
+ String input = "SELECT BQT1.SmallA.IntNum, BQT2.SmallB.IntNum FROM BQT1.SmallA FULL OUTER JOIN BQT2.SmallB ON BQT1.SmallA.IntNum = BQT2.SmallB.IntNum ORDER BY BQT1.SmallA.IntNum";
+ String output = "SELECT SmallA.IntNum, SmallB.IntNum FROM SmallA FULL OUTER JOIN SmallB ON SmallA.IntNum = SmallB.IntNum ORDER BY SmallA.IntNum";
+
+ helpTestVisitor( input, output);
+ }
+
+ @Test public void testRightOuterJoin() throws Exception {
+ String input = "SELECT BQT1.SmallA.IntNum, BQT2.SmallB.IntNum FROM BQT1.SmallA RIGHT OUTER JOIN BQT2.SmallB ON BQT1.SmallA.IntNum = BQT2.SmallB.IntNum ORDER BY BQT2.SmallB.IntNum";
+ String output= "SELECT SmallA.IntNum, SmallB.IntNum FROM SmallB LEFT OUTER JOIN SmallA ON SmallA.IntNum = SmallB.IntNum ORDER BY SmallB.IntNum";
+
+ helpTestVisitor( input, output);
+ }
+ @Test
+ public void testLeftOuterJoin() throws Exception {
+ String input = "SELECT BQT1.SmallA.IntNum, BQT2.SmallB.IntNum FROM BQT1.SmallA LEFT OUTER JOIN BQT2.SmallB ON BQT1.SmallA.IntNum = BQT2.SmallB.IntNum ORDER BY BQT1.SmallA.IntNum";
+ String output = "SELECT SmallA.IntNum, SmallB.IntNum FROM SmallA LEFT OUTER JOIN SmallB ON SmallA.IntNum = SmallB.IntNum ORDER BY SmallA.IntNum";
+
+ helpTestVisitor( input, output);
+ }
+
+
+
+}
Added: branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaTranslatorDatetimeConversion.java
===================================================================
--- branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaTranslatorDatetimeConversion.java (rev 0)
+++ branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaTranslatorDatetimeConversion.java 2011-11-10 17:48:21 UTC (rev 3631)
@@ -0,0 +1,141 @@
+/*
+ * 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.translator.jdbc.netezza;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Arrays;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.teiid.language.Expression;
+import org.teiid.language.Function;
+import org.teiid.language.LanguageFactory;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.TypeFacility;
+import org.teiid.translator.jdbc.SQLConversionVisitor;
+import org.teiid.translator.jdbc.TranslationHelper;
+
+/**
+ */
+public class TestNetezzaTranslatorDatetimeConversion {
+
+ private static NetezzaExecutionFactory TRANSLATOR;
+ private static final LanguageFactory LANG_FACTORY = new LanguageFactory();
+
+ @BeforeClass public static void oneTimeSetup() throws TranslatorException {
+ TRANSLATOR = new NetezzaExecutionFactory();
+ TRANSLATOR.setUseBindVariables(false);
+ TRANSLATOR.start();
+
+
+ }
+
+ /////////////////UTILLITY FUNCTIONS/////////
+ ////////////////////////////////////////////
+
+ private String getTestVDB() {
+ //return TranslationHelper.NETEZZA_VDB;
+ return TranslationHelper.PARTS_VDB;
+ }
+
+ private String getTestBQTVDB() {
+ return TranslationHelper.BQT_VDB;
+ }
+
+ public void helpTest(Expression srcExpression, String tgtType, String expectedExpression) throws Exception {
+ Function func = LANG_FACTORY.createFunction("convert",
+ Arrays.asList( srcExpression,LANG_FACTORY.createLiteral(tgtType, String.class)),TypeFacility.getDataTypeClass(tgtType));
+
+ assertEquals("Error converting from " + srcExpression.getType() + " to " + tgtType,
+ expectedExpression, helpGetString(func));
+ }
+ public String helpGetString(Expression expr) throws Exception {
+ SQLConversionVisitor sqlVisitor = TRANSLATOR.getSQLConversionVisitor();
+ sqlVisitor.append(expr);
+
+ return sqlVisitor.toString();
+ }
+
+
+ ///////////////DATE/TIME CONVERSION TESTCASES///////
+ ////////////////////////////////////////////////////
+
+ @Test public void testdayofmonth() throws Exception {
+ String input = "SELECT dayofmonth(datevalue) FROM BQT1.SMALLA";
+ String output = "SELECT extract(DAY from SmallA.DateValue) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(), input, output, TRANSLATOR);
+ }
+
+
+ ///BEGIN--FROM TIMESTAMP->DATE, TIME, STRING////////
+ @Test public void testTimestampToDate() throws Exception {
+ String input = "SELECT convert(convert(TIMESTAMPVALUE, date), string) FROM BQT1.SMALLA";
+ String output = "SELECT cast(cast(SmallA.TimestampValue AS DATE) AS varchar(4000)) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(), input, output, TRANSLATOR);
+ }
+ @Test public void testTimestampToTime() throws Exception {
+ String input = "SELECT convert(convert(TIMESTAMPVALUE, time), string) FROM BQT1.SMALLA";
+ String output = "SELECT cast(cast(SmallA.TimestampValue AS TIME) AS varchar(4000)) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(), input, output, TRANSLATOR);
+ }
+
+ @Test public void testTimestampToString() throws Exception {
+ String input = "SELECT convert(timestampvalue, string) FROM BQT1.SMALLA";
+ String output = "SELECT to_char(SmallA.TimestampValue, 'YYYY-MM-DD HH24:MI:SS.MS') FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(), input, output, TRANSLATOR);
+ }
+ ///END--FROM TIMESTAMP->DATE, TIME, STRING////////
+
+ ///BEGIN--FROM DATE->TIMESTAMP////////
+ @Test public void testDateToTimestamp() throws Exception {
+ String input = "SELECT convert(convert(datevalue, timestamp), string) FROM BQT1.SMALLA";
+ String output = "SELECT to_char(cast(SmallA.DateValue AS TIMESTAMP), 'YYYY-MM-DD HH24:MI:SS.MS') FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(), input, output, TRANSLATOR);
+ }
+ ///END--FROM DATE->TIMESTAMP////////
+
+ ///BEGIN--FROM TIME->TIMESTAMP////////
+ @Test public void testTimeToTimestamp() throws Exception {
+ String input = "SELECT convert(convert(TIMEVALUE, timestamp), string) FROM BQT1.SMALLA";
+ //String output = "SELECT to_char(cast(SmallA.TimeValue AS timestamp), 'YYYY-MM-DD HH24:MI:SS.FF') FROM SmallA";
+ String output = "SELECT to_char(SmallA.TimeValue, 'YYYY-MM-DD HH24:MI:SS.MS') FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(), input, output, TRANSLATOR);
+ }
+ ///END--FROM TIME->TIMESTAMP////////
+
+
+// @Test public void testTimestampToTime() throws Exception {
+// helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(111, 4, 5, 9, 16, 34, 220000000), Timestamp.class), "TIME", "cast(cast('2011-05-05 09:16:34.22' AS TIMESTAMP(6)) AS TIME)");
+// }
+
+
+
+
+}
Added: branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaTranslatorSourceSystemFunctions.java
===================================================================
--- branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaTranslatorSourceSystemFunctions.java (rev 0)
+++ branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaTranslatorSourceSystemFunctions.java 2011-11-10 17:48:21 UTC (rev 3631)
@@ -0,0 +1,243 @@
+/*
+ * 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.translator.jdbc.netezza;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.teiid.language.LanguageFactory;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.jdbc.TranslationHelper;
+
+/**
+ */
+public class TestNetezzaTranslatorSourceSystemFunctions {
+
+ private static NetezzaExecutionFactory TRANSLATOR;
+ private static final LanguageFactory LANG_FACTORY = new LanguageFactory();
+
+ @BeforeClass public static void oneTimeSetup() throws TranslatorException {
+ TRANSLATOR = new NetezzaExecutionFactory();
+ TRANSLATOR.setUseBindVariables(false);
+ TRANSLATOR.start();
+
+
+ }
+
+
+ /////////////////UTILLITY FUNCTIONS/////////
+ ////////////////////////////////////////////
+
+
+ private String getTestBQTVDB() {
+ return TranslationHelper.BQT_VDB;
+ }
+
+
+ /////SOURCESYSTEM FUNCTION TESTCASES//////////////
+ ///////////////////////////////////////////////
+
+
+ //////////////////BEGIN---STRING FUNCTIONS TESTCASES///////////////////
+
+ @Test
+ public void testLcaseUcase() throws Exception {
+ String input = "select lcase(StringKey), ucase(StringKey) FROM BQT1.SmallA";
+ String output = "SELECT lower(SmallA.StringKey), upper(SmallA.StringKey) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(), input, output,TRANSLATOR);
+ }
+ @Test public void testPad() throws Exception {
+ String input = "select lpad(smalla.stringkey, 18), rpad(smalla.stringkey, 12) from bqt1.smalla"; //$NON-NLS-1$
+ String output = "SELECT lpad(SmallA.StringKey, 18), rpad(SmallA.StringKey, 12) FROM SmallA"; //$NON-NLS-1$
+
+ TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB,
+ input,
+ output, TRANSLATOR);
+ }
+
+ @Test
+ public void testIFNull() throws Exception {
+ String input = "SELECT ifnull(StringKey, 'otherString') FROM BQT1.SmallA";
+ String output = "SELECT NVL(SmallA.StringKey, 'otherString') FROM SmallA";
+ //SELECT IFNULL(GL_ACTG_APPL_ID, 'otherString') FROM ACTG_UNIT_BAL_FACT
+ //SELECT nvl(GL_ACTG_APPL_ID, 'otherString') FROM ACTG_UNIT_BAL_FACT
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(), input, output, TRANSLATOR);
+ }
+
+
+ @Test public void testSubstring1() throws Exception {
+
+ //////////BOTH SUBSTRING AND SUBSTR work in NETEZZA//
+ //////////////////////////////////////////////////////
+ String input = "SELECT substring(StringKey, 1) FROM BQT1.SmallA";
+ String output = "SELECT substring(SmallA.StringKey, 1) FROM SmallA";
+ //SELECT substring(FDL_PMF_ACCT, 3) FROM ACTG_UNIT_BAL_FACT
+ //SELECT substr(FDL_PMF_ACCT, 3) FROM ACTG_UNIT_BAL_FACT
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(), input, output, TRANSLATOR);
+ }
+ @Test public void testSubstring2() throws Exception {
+
+ //////////BOTH SUBSTRING AND SUBSTR work in NETEZZA//
+ //////////////////////////////////////////////////////
+ String input = "SELECT substring(StringKey, 1, 5) FROM BQT1.SmallA";
+ String output = "SELECT substring(SmallA.StringKey, 1, 5) FROM SmallA";
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(), input, output, TRANSLATOR);
+ }
+
+
+
+ @Test public void testConcat_withLiteral() throws Exception {
+// String sql = "select stringnum || '1' from BQT1.Smalla";
+// String expected = "SELECT CASE WHEN SmallA.StringNum IS NULL THEN NULL ELSE concat(SmallA.StringNum, '1') END FROM SmallA";
+// helpTestVisitor(FakeMetadataFactory.exampleBQTCached(), sql, EMPTY_CONTEXT, null, expected);
+ String input = "select stringnum || '1' from BQT1.Smalla";
+ String output = "SELECT (SmallA.StringNum || '1') FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(), input, output, TRANSLATOR);
+ }
+
+
+
+ ////BEGIN-LOCATE FUNCTION
+ @Test public void testLocate() throws Exception {
+ String input = "SELECT locate(INTNUM, 'chimp', 1) FROM BQT1.SMALLA";
+ String output = "SELECT INSTR('chimp', cast(SmallA.IntNum AS varchar(4000)), 1) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB,
+ input, output,
+ TRANSLATOR);
+ }
+
+ @Test public void testLocate2() throws Exception {
+ String input = "SELECT locate(STRINGNUM, 'chimp') FROM BQT1.SMALLA";
+ String output = "SELECT INSTR('chimp', SmallA.StringNum) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB,
+ input, output,
+ TRANSLATOR);
+ }
+
+ @Test public void testLocate3() throws Exception {
+ String input = "SELECT locate(INTNUM, '234567890', 1) FROM BQT1.SMALLA WHERE INTKEY = 26";
+ String output = "SELECT INSTR('234567890', cast(SmallA.IntNum AS varchar(4000)), 1) FROM SmallA WHERE SmallA.IntKey = 26";
+
+ TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, input, output, TRANSLATOR);
+ }
+
+ @Test public void testLocate4() throws Exception {
+ String input = "SELECT locate('c', 'chimp', 1) FROM BQT1.SMALLA";
+ String output = "SELECT 1 FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, input, output, TRANSLATOR);
+ }
+
+ @Test public void testLocate5() throws Exception {
+ String input = "SELECT locate(STRINGNUM, 'chimp', -5) FROM BQT1.SMALLA";
+ String output = "SELECT INSTR('chimp', SmallA.StringNum, 1) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, input, output, TRANSLATOR);
+ }
+
+ @Test public void testLocate6() throws Exception {
+ String input = "SELECT locate(STRINGNUM, 'chimp', INTNUM) FROM BQT1.SMALLA";
+ String output = "SELECT INSTR('chimp', SmallA.StringNum, CASE WHEN SmallA.IntNum < 1 THEN 1 ELSE SmallA.IntNum END) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, input, output, TRANSLATOR);
+ }
+
+ @Test public void testLocate7() throws Exception {
+ String input = "SELECT locate(STRINGNUM, 'chimp', LOCATE(STRINGNUM, 'chimp') + 1) FROM BQT1.SMALLA";
+ String output = "SELECT INSTR('chimp', SmallA.StringNum, CASE WHEN (INSTR('chimp', SmallA.StringNum) + 1) < 1 THEN 1 ELSE (INSTR('chimp', SmallA.StringNum) + 1) END) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, input, output, TRANSLATOR);
+ }
+ ////END-LOCATE FUNCTION
+
+
+
+
+ //////////////////BEGIN---NUMERIC FUNCTIONS TESTCASES///////////////////
+ @Test public void testCeil() throws Exception {
+ //select ceiling(sqrt(MEAS_PRD_ID)) from ACTG_UNIT_BAL_FACT
+ //select ceil(sqrt(MEAS_PRD_ID)) from ACTG_UNIT_BAL_FACT
+ String input = "SELECT ceiling(sqrt(INTKEY)) FROM BQT1.SMALLA";
+ String output = "SELECT ceil(sqrt(SmallA.IntKey)) FROM SmallA";
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(),
+ input,
+ output, TRANSLATOR);
+ }
+
+ @Test public void testPower() throws Exception {
+
+ //select power(MEAS_PRD_ID, 2) from ACTG_UNIT_BAL_FACT
+ //select pow(MEAS_PRD_ID, 2) from ACTG_UNIT_BAL_FACT
+ String input = "SELECT power(INTKEY, 2) FROM BQT1.SMALLA";
+ String output = "SELECT pow(SmallA.IntKey, 2) FROM SmallA";
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(),
+ input,
+ output, TRANSLATOR);
+ }
+ //////////////////END---NUMERIC FUNCTIONS TESTCASES///////////////////
+
+
+ //////////////////BEGIN---BIT FUNCTIONS CONVERSION TESTCASES///////////////////
+ ///////////////////////////////////////////////////////////////////
+
+ @Test public void testBitAnd() throws Exception {
+ String input = "select bitand(intkey, intnum) from bqt1.smalla";
+ String output = "SELECT intNand(SmallA.IntKey, SmallA.IntNum) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB,
+ input,
+ output, TRANSLATOR);
+ }
+ @Test public void testBitNot() throws Exception {
+ String input = "select bitnot(intkey) from bqt1.smalla";
+ String output = "SELECT intNnot(SmallA.IntKey) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB,
+ input,
+ output, TRANSLATOR);
+ }
+ @Test public void testBitOr() throws Exception {
+ String input = "select bitor(intkey, intnum) from bqt1.smalla";
+ String output = "SELECT intNor(SmallA.IntKey, SmallA.IntNum) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB,
+ input,
+ output, TRANSLATOR);
+ }
+ @Test public void testBitXor() throws Exception {
+ String input = "select bitxor(intkey, intnum) from bqt1.smalla";
+ String output = "SELECT intNxor(SmallA.IntKey, SmallA.IntNum) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB,
+ input,
+ output, TRANSLATOR);
+ }
+ //////////////////END---BIT FUNCTIONS CONVERSION TESTCASES///////////////////
+ /////////////////////////////////////////////////////////////////////////////
+
+
+}
Added: branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaTranslatorTypeMapping.java
===================================================================
--- branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaTranslatorTypeMapping.java (rev 0)
+++ branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaTranslatorTypeMapping.java 2011-11-10 17:48:21 UTC (rev 3631)
@@ -0,0 +1,246 @@
+/*
+ * 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.translator.jdbc.netezza;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Arrays;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.teiid.language.Expression;
+import org.teiid.language.Function;
+import org.teiid.language.LanguageFactory;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.TypeFacility;
+import org.teiid.translator.jdbc.SQLConversionVisitor;
+import org.teiid.translator.jdbc.TranslationHelper;
+
+
+public class TestNetezzaTranslatorTypeMapping {
+
+ private static NetezzaExecutionFactory TRANSLATOR;
+ private static final LanguageFactory LANG_FACTORY = new LanguageFactory();
+
+ @BeforeClass public static void oneTimeSetup() throws TranslatorException {
+ TRANSLATOR = new NetezzaExecutionFactory();
+ TRANSLATOR.setUseBindVariables(false);
+ TRANSLATOR.start();
+
+
+ }
+
+
+ /////////////////UTILLITY FUNCTIONS/////////
+ ////////////////////////////////////////////
+
+ private String getTestBQTVDB() {
+
+ return TranslationHelper.BQT_VDB;
+ }
+
+
+ public void helpTest(Expression srcExpression, String tgtType, String expectedExpression) throws Exception {
+ Function func = LANG_FACTORY.createFunction("convert",
+ Arrays.asList( srcExpression,LANG_FACTORY.createLiteral(tgtType, String.class)),TypeFacility.getDataTypeClass(tgtType));
+
+ assertEquals("Error converting from " + srcExpression.getType() + " to " + tgtType,
+ expectedExpression, helpGetString(func));
+ }
+ public String helpGetString(Expression expr) throws Exception {
+ SQLConversionVisitor sqlVisitor = TRANSLATOR.getSQLConversionVisitor();
+ sqlVisitor.append(expr);
+
+ return sqlVisitor.toString();
+ }
+
+
+ /////////TYPE MAPPING TESTS/////////
+ ///////////////////////////////////
+
+ @Test public void testCHARtoChar1() throws Exception {
+ String input = "SELECT convert(StringKey, CHAR) FROM BQT1.SmallA";
+ String output = "SELECT cast(SmallA.StringKey AS char(1)) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(),
+ input,
+ output, TRANSLATOR);
+ }
+
+ @Test public void testLongToBigInt() throws Exception {
+ String input = "SELECT convert(convert(StringKey, long), string) FROM BQT1.SmallA";
+ String output = "SELECT cast(cast(SmallA.StringKey AS bigint) AS varchar(4000)) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(),
+ input,
+ output, TRANSLATOR);
+ }
+ @Test public void testStringToByte() throws Exception {
+ String input = "SELECT char(convert(stringnum, byte) + 100) FROM BQT1.SMALLA";
+ String output = "SELECT chr((cast(SmallA.StringNum AS byteint) + 100)) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(),
+ input,
+ output, TRANSLATOR);
+ }
+ @Test public void testStringToShort() throws Exception {
+ String input = "SELECT char(convert(stringnum, short) + 100) FROM BQT1.SMALLA";
+ String output = "SELECT chr((cast(SmallA.StringNum AS smallint) + 100)) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(),
+ input,
+ output, TRANSLATOR);
+ }
+ @Test public void testStringToLong() throws Exception {
+// String input = "SELECT char(convert(PART_WEIGHT, long) + 100) FROM PARTS";
+// String output = "SELECT chr((cast(PARTS.PART_WEIGHT AS bigint) + 100)) FROM PARTS";
+ String input = "SELECT convert(stringnum, long) FROM BQT1.SMALLA";
+ String output = "SELECT cast(SmallA.StringNum AS bigint) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(),
+ input,
+ output, TRANSLATOR);
+ }
+ @Test public void testStringToBiginteger() throws Exception {
+ String input = "SELECT convert(stringnum, BIGINTEGER) FROM BQT1.SMALLA";
+ String output = "SELECT cast(SmallA.StringNum AS numeric(38)) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(),
+ input,
+ output, TRANSLATOR);
+ }
+
+ @Test public void testStringToBigdecimal() throws Exception {
+ String input = "SELECT convert(stringnum, BIGDECIMAL) FROM BQT1.SMALLA";
+ String output = "SELECT cast(SmallA.StringNum AS numeric(38,18)) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(),
+ input,
+ output, TRANSLATOR);
+ }
+
+ @Test public void testStringToVarchar() throws Exception {
+ String input = "SELECT convert(intkey, STRING) FROM BQT1.SMALLA";
+ String output = "SELECT cast(SmallA.IntKey AS varchar(4000)) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(),
+ input,
+ output, TRANSLATOR);
+ }
+
+
+
+
+ ////NON-MAPPED TYPES TEST/////////////
+ //////////////////////////////////////
+
+ @Test public void testStringToInteger() throws Exception {
+ String input = "SELECT char(convert(stringnum, integer) + 100) FROM BQT1.SMALLA";
+ String output = "SELECT chr((cast(SmallA.StringNum AS integer) + 100)) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(),
+ input,
+ output, TRANSLATOR);
+ }
+
+ @Test public void testStringToFloat() throws Exception {
+ String input = "SELECT convert(stringnum, float) FROM BQT1.SMALLA";
+ String output = "SELECT cast(SmallA.StringNum AS float) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(),
+ input,
+ output, TRANSLATOR);
+ }
+ @Test public void testStringToReal() throws Exception {
+ String input = "SELECT convert(stringnum, real) FROM BQT1.SMALLA";
+ String output = "SELECT cast(SmallA.StringNum AS float) FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(),
+ input,
+ output, TRANSLATOR);
+ }
+ @Test public void testStringToDouble() throws Exception {
+ String input = "SELECT convert(stringnum, double) FROM BQT1.SMALLA";
+ String output = "SELECT cast(SmallA.StringNum AS double) FROM SmallA";
+ //SELECT cast(MEAS_PRD_ID AS DOUBLE) from ACTG_UNIT_BAL_FACT
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(),
+ input,
+ output, TRANSLATOR);
+ }
+ @Test public void testStringToBoolean() throws Exception {
+ String input = "SELECT convert(stringnum, boolean) FROM BQT1.SMALLA";
+ String output = "SELECT CASE WHEN SmallA.StringNum IN ('false', '0') THEN '0' WHEN SmallA.StringNum IS NOT NULL THEN '1' END FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(),
+ input,
+ output, TRANSLATOR);
+ }
+ @Test public void testStringToDate() throws Exception {
+ String input = "SELECT convert(stringnum, date) FROM BQT1.SMALLA";
+ String output = "SELECT to_date(SmallA.StringNum, 'YYYY-MM-DD') FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(),
+ input,
+ output, TRANSLATOR);
+ }
+ @Test public void testStringToTime() throws Exception {
+ String input = "SELECT convert(stringnum, time) FROM BQT1.SMALLA";
+ String output = "SELECT to_timestamp(SmallA.StringNum, 'HH24:MI:SS') FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(),
+ input,
+ output, TRANSLATOR);
+ }
+ @Test public void testStringToTimestamp() throws Exception {
+ String input = "SELECT convert(stringnum, timestamp) FROM BQT1.SMALLA";
+ String output = "SELECT to_timestamp(SmallA.StringNum, 'YYYY-MM-DD HH24:MI:SS.MS') FROM SmallA";
+
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(),
+ input,
+ output, TRANSLATOR);
+ }
+
+
+ @Test public void testbooleanToIntegerConversion() throws Exception {
+ String input = "SELECT BQT1.SmallA.IntNum, BQT2.SmallB.BooleanValue FROM BQT1.SmallA, BQT2.SmallB WHERE BQT1.SmallA.IntNum = convert(BQT2.SmallB.booleanvalue, integer)";
+ String output = "SELECT SmallA.IntNum, SmallB.BooleanValue FROM SmallA, SmallB WHERE SmallA.IntNum = (CASE WHEN SmallB.BooleanValue IN ( '0', 'FALSE') THEN 0 WHEN SmallB.BooleanValue IS NOT NULL THEN 1 END)";
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(),
+ input,
+ output, TRANSLATOR);
+
+
+ }
+
+ @Test public void testIntegerToBooleanconversion() throws Exception {
+ String input = "SELECT BQT1.SmallA.IntNum, BQT2.SmallB.BooleanValue FROM BQT1.SmallA, BQT2.SmallB WHERE BQT1.SmallA.booleanvalue = convert(BQT2.SmallB.IntNum, boolean) AND BQT1.SmallA.IntKey >= 0 AND BQT2.SmallB.IntKey >= 0 ORDER BY BQT1.SmallA.IntNum";
+ String output = "SELECT SmallA.IntNum, SmallB.BooleanValue FROM SmallA, SmallB WHERE SmallA.BooleanValue = CASE WHEN SmallB.IntNum = 0 THEN '0' WHEN SmallB.IntNum IS NOT NULL THEN '1' END AND SmallA.IntKey >= 0 AND SmallB.IntKey >= 0 ORDER BY SmallA.IntNum";
+ TranslationHelper.helpTestVisitor(getTestBQTVDB(),
+ input,
+ output, TRANSLATOR);
+
+
+ }
+
+
+}
Added: branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestSubstringFunctionModifier.java
===================================================================
--- branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestSubstringFunctionModifier.java (rev 0)
+++ branches/7.1.x/connectors/translator-netezza/src/test/java/org/teiid/translator/jdbc/netezza/TestSubstringFunctionModifier.java 2011-11-10 17:48:21 UTC (rev 3631)
@@ -0,0 +1,98 @@
+/*
+ * 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.translator.jdbc.netezza;
+
+import java.util.Arrays;
+
+import junit.framework.TestCase;
+
+import org.teiid.language.Expression;
+import org.teiid.language.Function;
+import org.teiid.language.LanguageFactory;
+import org.teiid.translator.TypeFacility;
+import org.teiid.translator.jdbc.SQLConversionVisitor;
+
+/**
+ */
+public class TestSubstringFunctionModifier extends TestCase {
+
+ private static final LanguageFactory LANG_FACTORY = new LanguageFactory();
+
+
+ /**
+ * Constructor for TestSubstringFunctionModifier.
+ * @param name
+ */
+ public TestSubstringFunctionModifier(String name) {
+ super(name);
+ }
+
+ public void helpTestMod(Expression[] args, String expectedStr) throws Exception {
+ Function func = LANG_FACTORY.createFunction("substring",
+ Arrays.asList(args), TypeFacility.RUNTIME_TYPES.STRING);
+
+ NetezzaExecutionFactory trans = new NetezzaExecutionFactory();
+ trans.start();
+
+ SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor();
+ sqlVisitor.append(func);
+
+ assertEquals(expectedStr, sqlVisitor.toString());
+ }
+
+ public void testTwoArgs() throws Exception {
+ Expression[] args = new Expression[] {
+ LANG_FACTORY.createLiteral("a.b.c", String.class),
+ LANG_FACTORY.createLiteral(new Integer(1), Integer.class)
+ };
+ helpTestMod(args, "substring('a.b.c', 1)");
+ }
+
+ public void testThreeArgsWithConstant() throws Exception {
+ Expression[] args = new Expression[] {
+ LANG_FACTORY.createLiteral("a.b.c", String.class),
+ LANG_FACTORY.createLiteral(new Integer(3), Integer.class),
+ LANG_FACTORY.createLiteral(new Integer(1), Integer.class)
+ };
+ helpTestMod(args, "substring('a.b.c', 3, 1)");
+ }
+
+ public void testThreeArgsWithElement() throws Exception {
+ Expression[] args = new Expression[] {
+ LANG_FACTORY.createLiteral("a.b.c", String.class),
+ LANG_FACTORY.createColumnReference("e1", null, null, Integer.class),
+ LANG_FACTORY.createLiteral(new Integer(1), Integer.class)
+ };
+ helpTestMod(args, "substring('a.b.c', e1, 1)");
+ }
+
+ public void testThreeArgsWithNull() throws Exception {
+ Expression[] args = new Expression[] {
+ LANG_FACTORY.createLiteral("a.b.c", String.class),
+ LANG_FACTORY.createLiteral(null, Integer.class),
+ LANG_FACTORY.createLiteral(new Integer(5), Integer.class)
+ };
+ helpTestMod(args, "substring('a.b.c', NULL, 5)");
+ }
+
+}
14 years, 1 month
teiid SVN: r3630 - in branches/as7/build/kits/jboss-as7: standalone/configuration and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2011-11-10 12:02:42 -0500 (Thu, 10 Nov 2011)
New Revision: 3630
Modified:
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/salesforce/main/module.xml
branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
Log:
TEIID-1720: Correcting the SF addition
Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/salesforce/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/salesforce/main/module.xml 2011-11-10 16:48:57 UTC (rev 3629)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/translator/salesforce/main/module.xml 2011-11-10 17:02:42 UTC (rev 3630)
@@ -12,6 +12,6 @@
<module name="org.apache.log4j"/>
<module name="org.jboss.teiid.common-core" />
<module name="org.jboss.teiid.api" />
- <module name="org.jboss.teiid.transalator.salesforce.api"/>
+ <module name="org.jboss.teiid.translator.salesforce.api"/>
</dependencies>
</module>
\ No newline at end of file
Modified: branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml 2011-11-10 16:48:57 UTC (rev 3629)
+++ branches/as7/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml 2011-11-10 17:02:42 UTC (rev 3630)
@@ -476,6 +476,7 @@
<translator name="loopback" module="org.jboss.teiid.translator.loopback"/>
<translator name="olap" module="org.jboss.teiid.translator.olap"/>
<translator name="ws" module="org.jboss.teiid.translator.ws"/>
+ <translator name="salesforce" module="org.jboss.teiid.translator.salesforce"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:threads:1.0">
14 years, 1 month
teiid SVN: r3629 - in trunk/engine/src: main/java/org/teiid/query/validator and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-11-10 11:48:57 -0500 (Thu, 10 Nov 2011)
New Revision: 3629
Modified:
trunk/engine/src/main/java/org/teiid/query/resolver/command/SimpleQueryResolver.java
trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java
Log:
TEIID-1821 fix for default expression resolving/validation
Modified: trunk/engine/src/main/java/org/teiid/query/resolver/command/SimpleQueryResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/command/SimpleQueryResolver.java 2011-11-10 16:29:43 UTC (rev 3628)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/command/SimpleQueryResolver.java 2011-11-10 16:48:57 UTC (rev 3629)
@@ -349,7 +349,7 @@
if (column.getDefaultExpression() == null) {
continue;
}
- ResolverVisitor.resolveLanguageObject(column.getDefaultExpression(), metadata);
+ visitNode(column.getDefaultExpression());
Expression ex = ResolverUtil.convertExpression(column.getDefaultExpression(), DataTypeManager.getDataTypeName(column.getSymbol().getType()), metadata);
column.setDefaultExpression(ex);
}
Modified: trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2011-11-10 16:29:43 UTC (rev 3628)
+++ trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2011-11-10 16:48:57 UTC (rev 3629)
@@ -1385,7 +1385,7 @@
boolean hasOrdinal = false;
for (XMLColumn xc : obj.getColumns()) {
if (!xc.isOrdinal()) {
- if (xc.getDefaultExpression() != null && !EvaluatableVisitor.isFullyEvaluatable(obj, false)) {
+ if (xc.getDefaultExpression() != null && !EvaluatableVisitor.isFullyEvaluatable(xc.getDefaultExpression(), false)) {
handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.invalid_default", xc.getDefaultExpression()), obj); //$NON-NLS-1$
}
continue;
Modified: trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java 2011-11-10 16:29:43 UTC (rev 3628)
+++ trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java 2011-11-10 16:48:57 UTC (rev 3629)
@@ -1791,6 +1791,10 @@
@Test public void testXMLTablePassingMultipleContext() {
helpValidate("select * from pm1.g1, xmltable('/' passing xmlparse(DOCUMENT '<a/>'), xmlparse(DOCUMENT '<b/>')) as x", new String[] {"XMLTABLE('/' PASSING XMLPARSE(DOCUMENT '<a/>'), XMLPARSE(DOCUMENT '<b/>')) AS x"}, RealMetadataFactory.example1Cached());
}
+
+ @Test public void testInvalidDefault() {
+ helpValidate("select * from pm1.g1, xmltable('/' passing xmlparse(DOCUMENT '<a/>') columns y string default 'a', x string default (select e1 from pm1.g1)) as x", new String[] {"XMLTABLE('/' PASSING XMLPARSE(DOCUMENT '<a/>') COLUMNS y string DEFAULT 'a', x string DEFAULT (SELECT e1 FROM pm1.g1)) AS x"}, RealMetadataFactory.example1Cached());
+ }
@Ignore("this is actually handled by saxon and will show up during resolving")
@Test public void testXMLTablePassingSameName() {
14 years, 1 month
teiid SVN: r3628 - in trunk/engine/src: main/java/org/teiid/query/sql/lang and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-11-10 11:29:43 -0500 (Thu, 10 Nov 2011)
New Revision: 3628
Modified:
trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java
trunk/engine/src/main/java/org/teiid/query/sql/lang/MatchCriteria.java
trunk/engine/src/test/java/org/teiid/query/processor/eval/TestCriteriaEvaluator.java
trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java
Log:
TEIID-1820 updating the match logic to use find and optimizing generated regex
Modified: trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java 2011-11-10 02:29:40 UTC (rev 3627)
+++ trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java 2011-11-10 16:29:43 UTC (rev 3628)
@@ -435,7 +435,7 @@
}
Matcher matcher = patternRegex.matcher(search);
- return matcher.matches();
+ return matcher.find();
}
private Boolean evaluate(AbstractSetCriteria criteria, List<?> tuple)
Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/MatchCriteria.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/MatchCriteria.java 2011-11-10 02:29:40 UTC (rev 3627)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/MatchCriteria.java 2011-11-10 16:29:43 UTC (rev 3628)
@@ -292,11 +292,17 @@
public String getPatternString(String pattern, char escape)
throws ExpressionEvaluationException {
- StringBuffer newPattern = new StringBuffer("^"); //$NON-NLS-1$
+ int startChar = 0;
+ StringBuffer newPattern = new StringBuffer(pattern.length());
+ if (pattern.length() > 0 && pattern.charAt(0) == '%') {
+ startChar = 1;
+ } else {
+ newPattern.append('^');
+ }
boolean escaped = false;
-
- for (int i = 0; i < pattern.length(); i++) {
+ boolean endsWithMatchAny = false;
+ for (int i = startChar; i < pattern.length(); i++) {
char character = pattern.charAt(i);
if (character == escape && character != NULL_ESCAPE_CHAR) {
@@ -313,6 +319,10 @@
appendCharacter(newPattern, character);
escaped = false;
} else {
+ if (character == '%' && i == pattern.length() - 1) {
+ endsWithMatchAny = true;
+ continue;
+ }
newPattern.append(replacements[index]);
}
} else {
@@ -328,7 +338,9 @@
throw new ExpressionEvaluationException(QueryPlugin.Util.getString("MatchCriteria.invalid_escape", new Object[] {pattern, new Character(escape)})); //$NON-NLS-1$
}
- newPattern.append('$');
+ if (!endsWithMatchAny) {
+ newPattern.append('$');
+ }
return newPattern.toString();
}
Modified: trunk/engine/src/test/java/org/teiid/query/processor/eval/TestCriteriaEvaluator.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/eval/TestCriteriaEvaluator.java 2011-11-10 02:29:40 UTC (rev 3627)
+++ trunk/engine/src/test/java/org/teiid/query/processor/eval/TestCriteriaEvaluator.java 2011-11-10 16:29:43 UTC (rev 3628)
@@ -156,10 +156,6 @@
helpTestMatch("xx", "%", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- @Test public void testMatch6() throws Exception {
- helpTestMatch("xx", "%", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
@Test public void testMatch7() throws Exception {
helpTestMatch("a", "a%", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -172,10 +168,6 @@
helpTestMatch("a.", "a%", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
- @Test public void testMatch10() throws Exception {
- helpTestMatch("a.", "a%", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
@Test public void testMatch11() throws Exception {
helpTestMatch("ax.", "a%", MatchCriteria.NULL_ESCAPE_CHAR, true); //$NON-NLS-1$ //$NON-NLS-2$
}
Modified: trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java 2011-11-10 02:29:40 UTC (rev 3627)
+++ trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java 2011-11-10 16:29:43 UTC (rev 3628)
@@ -504,6 +504,11 @@
assertEquals(Boolean.FALSE, Evaluator.evaluate(ex));
}
+ @Test public void testLikeRegex4() throws Exception {
+ Expression ex = TestFunctionResolving.getExpression("'xay' like_regex 'a'");
+ assertEquals(Boolean.TRUE, Evaluator.evaluate(ex));
+ }
+
@Test public void testLikePlus() throws Exception {
Expression ex = TestFunctionResolving.getExpression("'+' like '+'");
assertEquals(Boolean.TRUE, Evaluator.evaluate(ex));
14 years, 1 month
teiid SVN: r3627 - trunk/documentation/admin-guide/src/main/docbook/en-US/content.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-11-09 21:29:40 -0500 (Wed, 09 Nov 2011)
New Revision: 3627
Modified:
trunk/documentation/admin-guide/src/main/docbook/en-US/content/security.xml
Log:
TEIID-1816 clarifications to the security chapter
Modified: trunk/documentation/admin-guide/src/main/docbook/en-US/content/security.xml
===================================================================
--- trunk/documentation/admin-guide/src/main/docbook/en-US/content/security.xml 2011-11-10 02:10:03 UTC (rev 3626)
+++ trunk/documentation/admin-guide/src/main/docbook/en-US/content/security.xml 2011-11-10 02:29:40 UTC (rev 3627)
@@ -10,8 +10,9 @@
<section>
<title>Authentication</title>
<para>JDBC clients may use simple passwords to authenticate a user.</para>
+
<para>Typically a user name is required, however user names may be considered optional if the
- identity of the user can be discerned by the password credential alone. In
+ identity of the user can be discerned by the password credential alone. In
any case it is up to the configured security domain to determine whether a user can be
authenticated. If you need authentication, the administrator must configure a LoginModule to be used with Teiid.
See below for more information on how configure the Login module in JBoss AS.</para>
@@ -25,25 +26,26 @@
<section>
<title>Pass-through Authentication</title>
<para>If your client application (web application or Web service) resides in the same JBoss AS instance as Teiid and
- client application uses a security-domain to handle the security concerns, then you can configure Teiid to use the
- same security-domain and not force the user to re-authenticate for using Teiid. In this case Teiid looks for a authenticated
- subject in the calling thread context and uses for its session and authorization purposes. To configure Teiid for this
- pass-through authentication mechanism, you need change the Teiid's security-domain name to same name as your
+ the client application uses a security-domain, then you can configure Teiid to use the
+ same security-domain and not force the user to re-authenticate. In this case Teiid looks for an authenticated
+ subject in the calling thread context and uses it for sessioning and authorization. To configure Teiid for
+ pass-through authentication, change the Teiid security-domain name to the same name as your
application's security domain name in the "teiid-jboss-beans.xml" file in the SessionService section.
Please note that for this to work, the security-domain
- must be a JAAS based Login Module and your client application MUST obtain Teiid connection
- using <emphasis>Local</emphasis> Connection, with <emphasis>PassthroughAuthentication=true</emphasis> flag set.</para>
+ must be a JAAS based Login Module and your client application MUST obtain its Teiid connection
+ using a <emphasis>local/embedded</emphasis> connection with the<emphasis>PassthroughAuthentication=true</emphasis> connection flag set.</para>
</section>
</section>
<section>
<title>Authorization</title>
<para>Authorization covers both administrative activities and data
- roles. A data role is a collection of permissions (also referred to as entitlements) and a
+ roles. A data role is a collection of permissions (also referred to as entitlements) and a
collection of entitled principals or groups. With the deployment of a VDB
the deployer can choose which principals and groups have which data roles.</para>
</section>
<section>
<title>Encryption</title>
+
<para>At a transport level Teiid provides built-in support for JDBC
over SSL or just sensitive message encryption when SSL is not in use.
</para>
@@ -57,6 +59,7 @@
</section>
<section>
<title>LoginModules</title>
+
<para>
LoginModules are an essential part of the JAAS security
framework and provide Teiid customizable user authentication and the
@@ -69,7 +72,7 @@
that group together relevant LoginModules. Each of these application
policy (or domains) names can be used to fully
qualify user names to
- authenticate only against that domain. The format for a qualified
+ authenticate only against that domain. The format for a qualified
name is username@domainname.
</para>
<para>If a user name is not fully qualified, then the installed
@@ -77,6 +80,7 @@
successfully or unsuccessfully authenticates the
user.
</para>
+
<para>If no domain can authenticate the user, the login
attempt will fail.
Details of the failed attempt including invalid users, which
@@ -94,18 +98,20 @@
<section>
<title>Built-in LoginModules</title>
<para>JBossAS provides several LoginModules for common authentication needs, such as authenticating from a <xref linkend="text-login"/> or a <xref linkend="ldap-login"/>.</para>
+
<para>You can install multiple login modules as part of single security domain configuration and configure them
to part of login process. For example, for "teiid-security" domain, you can configure a file based and also LDAP based login modules,
- and have your user authenticated with either or both login modules. If you want to write your own custom login module, check out the Developer's Guide for instructions.
+ and have your user authenticated with either or both login modules. If you want to write your own custom login module, refer to the Developer's Guide for instructions.
</para>
<section id="text-login">
<title>Text Based LoginModule</title>
- <para>The UsersRolesLoginModule utilizes simple text files to authenticate users and to define their groups.
+ <para>The UsersRolesLoginModule utilizes simple text files to authenticate users and to define their groups.
The teiid-jboss-beans.xml configuration file contains an example of how to use UsersRolesLoginModule.
-<note><para>The UsersRolesLoginModule is not recommended for production use and is strongly recommended that you replace this login module.</para></note>
+<note><para>The UsersRolesLoginModule is not recommended for production use and it is strongly recommended that you replace this login module.</para></note>
</para>
<para>User names and passwords are stored in the <profile>conf/props/teiid-security-users.properties file.
+
<example><title>Example user.properties file</title>
<programlisting><![CDATA[# A users.properties file for use with the UsersRolesLoginModule
# username=password
@@ -144,6 +150,7 @@
<para>Reuse the jmx-console (or whatever name you choose) security domain for Teiid by changing the teiid configuration &jboss-beans; to point to jmx-console, rather than teiid-security.
</para>
</listitem>
+
<listitem>
<para>Follow the same steps to configure an LDAP security domain named teiid-security.
</para>
@@ -154,8 +161,9 @@
</listitem>
</itemizedlist>
</para></listitem>
+
<listitem><para>Obscure the LDAP Password</para><para>Finally, protect the password following <ulink url="http://docs.redhat.com/docs/en-US/JBoss_Enterprise_Application_Platform/5...">these instructions.</ulink>
- Note that the salt must be 8 chars andd see also http://community.jboss.org/message/137756#137756 for more on securing passwords.
+ Note that the salt must be 8 chars and see also http://community.jboss.org/message/137756#137756 for more on securing passwords.
</para></listitem>
</orderedlist>
</para>
@@ -163,6 +171,7 @@
</section>
<section>
+
<title>Kerberos support through GSSAPI</title>
<para>Teiid supports kerberos authentication using GSSAPI, to be used with single sign-on applications.
This service ticket negotiation based authentication is supported through remote JDBC and ODBC drivers and LocalConnections.
@@ -175,6 +184,7 @@
authentication of your web-application with kerberos. When the web application authenticates with the provided
kerberos token, the same subject authenticated will be used in Teiid. For details about configuration, check the
JBoss Negotiation documentation.</para>
+
</section>
<section>
@@ -218,6 +228,7 @@
</login-module>
</authentication>
</application-policy>]]></programlisting>
+
Edit the "run.conf" or "run.conf.bat" file depending upon the environment in the "${jboss-as}/bin" directory
and add the following JVM options (changing the realm and KDC settings according to your environment)
<programlisting><![CDATA[JAVA_OPTS = "$JAVA_OPTS -Djava.security.krb5.realm=EXAMPLE.COM -Djava.security.krb5.kdc=kerberos.example.com -Djavax.security.auth.useSubjectCredsOnly=false"]]></programlisting>
@@ -250,10 +261,11 @@
Add the following URL connection properties to Teiid JDBC connection string
<programlisting><![CDATA[authenticationType=KRB5;jaasName=Client;kerberosServicePrincipleName=demo(a)EXAMPLE.COM]]></programlisting>
- There is no need to provide the user name and password, when the application is trying to make JDBC connection it
- will authenticate locally and use the same user credetinals to neogitiate service token with server and grant the
+ There is no need to provide the user name and password. When the application makes a JDBC connection, it
+ will authenticate locally and use the same user credentials to negotiate a service token with server and grant the
connection. See Client Developer's guide for information on connection properties and how to configure data sources.
</para>
+
</section>
</section>
@@ -265,9 +277,10 @@
</section>
<section>
+
<title>Security at Data Source level</title>
- <para>In some use cases, user might need to pass-in different credentials to their data sources based on the logged in user
- than using the shared credentials for all the logged users. To support this feature, JBoss AS and Teiid provide multiple different
+ <para>In some use cases, the user might need to pass-in different credentials to their data sources based on the logged in user
+ rather than using the shared credentials for all the logged users. To support this feature, JBoss AS and Teiid provide multiple different
login modules to be used in conjunction with Teiid's main security domain. See this
<ulink url="http://community.jboss.org/docs/DOC-9350">document</ulink> for details on configuration. Note that the below
directions need to be used in conjunction with this document.</para>
@@ -302,27 +315,28 @@
<programlisting><![CDATA[<security-domain>teiid-security</security-domain>]]></programlisting>
- <para>In the above configuration example, in the primary login module "UsersRolesLoginModule" is setup to hold the
+ <para>In the above configuration example, in the primary login module "UsersRolesLoginModule" is set up to hold the
passwords in the file, and when user logs in with password, the same password will be also set on the logged in Subject after
- authentication. This credentials can be extracted by the data source by asking for Subject's private credentials.</para>
+ authentication. These credentials can be extracted by the data source by asking for Subject's private credentials.</para>
- <para>To use a certificate or serialized object instead of plain password as the token, simply replace the simple text password
- with Base64 encoded contents of the serialized object. Please note that, encoding and decoding of this object
- is strictly up to the user as JBoss AS and Teiid will only act like carrier of the information from
+ <para>To use a certificate or serialized object instead of plain password as the token, replace the simple text password
+ with Base64 encoded contents of the serialized object. Please note that encoding and decoding of this object
+ is strictly up to the user as JBoss AS and Teiid will only act as a carrier of the information from
login module to connection factory. Using this CallerIdentity module, the connection pool for data source is segmented
by Subject.</para>
</section>
<section>
+
<title>Role Based Credential Map</title>
- <para>In some use cases, the users are divided by their functionality and they have varied level of security access to
+ <para>In some use cases, the users are divided by their functionality and they have varied levels of security access to
data sources. These types of users are identified by their roles as to what they have access to. In the above "CallerIdentity"
login scenario, that may be too fine-grained security at data sources, that can lead resource exhaustion as every user has
their own separate connection.
Using Role based security gives a balance, where the users with same role are treated equally
for authentication purposes at the data source. Teiid provides a login module called "RoleBasedCredentialMap"
- for this purposes, where administrator can define a role based authentication module, where given the role of the user
- from the primary login module, this module will hold credentail to that role. So, it is container of credentials that
- map to different roles. If a user has multiple roles, the first role that has the credential will be chosen.
+ for this purposes, where administrator can define a role-based authentication module, where given the role of the user
+ from the primary login module, this module will hold a credential to that role. So, it is the container of credentials that
+ maps to different roles. If a user has multiple roles, the first role that has the credential will be chosen.
Below find the sample configuration.</para>
<programlisting><![CDATA[<application-policy xmlns="urn:jboss:security-beans:1.0" name="teiid-security">
@@ -347,7 +361,7 @@
<programlisting><![CDATA[<security-domain>teiid-security</security-domain>]]></programlisting>
- <para>In the above configuration example, in the primary login module "UsersRolesLoginModule" is setup for logging in
+ <para>In the above configuration example, in the primary login module "UsersRolesLoginModule" is set up for logging in
the primary user and assign some roles. The "RoleBasedCredentialMap" login module is configured to hold
role to password information in the file defined by "credentialMap" property. When user logs in, the role information
from the primary login module is taken, and extracts the role's passsword and attaches as
@@ -383,8 +397,9 @@
<para>The Teiid's configuration file
<code><jboss-install>/server/<profile>/deploy/teiid/teiid-jboss-beans.xml</code>,
contains the properties to configure SSL per socket transport.</para>
+
<itemizedlist>
- <para>There are three socket transports, each with it's own SSL configuration:</para>
+ <para>There are three socket transports, each with its own SSL configuration:</para>
<listitem><para>JDBC Connections - uses the <code>JdbcSslConfiguration</code> bean configuration. Defaults to only encrypt login traffic, none of the other properties are used.</para></listitem>
<listitem><para>Admin Connections - uses the <code>AdminSslConfiguration</code> bean configuration. Defaults to encrypting all traffic with anonymous SSL, none of the other properties are used.</para></listitem>
<listitem><para>ODBC Connections - uses the <code>OdbcSslConfiguration</code> bean configuration. Defaults to no SSL.</para></listitem>
@@ -407,6 +422,7 @@
</example>
<itemizedlist>
<title>Properties</title>
+
<listitem><para>mode - diabled|login|enabled, disabled = no transport or message level security will be used.
login = only the login traffic will be encrypted at a message level using 128 bit AES with an ephemerial DH key exchange. No other config values are needed in this mode.
enabled = traffic will be secured using the other configuration properties.</para></listitem>
@@ -415,8 +431,10 @@
<listitem><para>authenticationMode - anonymous|1-way|2-way, Type of <link linkend="ssl_auth">SSL Authentication Mode</link>.</para></listitem>
<listitem><para>keymanagementAlgorithm - Type of key algorithm used. Default
is based upon the VM, e.g. "SunX509"</para></listitem>
+
<listitem><para>keystoreFilename - The file name of the keystore, which contains the
- private key of the Server. This must be available in the classpath of Teiid Server.</para></listitem>
+ private key of the Server. The file name can be relative resource path available to the Teiid deployer classloader or an absolute file system path.
+ A typical installation would place the keystore file in the conf directory of the profile where Teiid is deployed with a file name relative to the conf path.</para></listitem>
<listitem><para>keystorePassword - password for the keystore.</para></listitem>
<listitem><para>truststoreFilename - if "authenticationMode" is chosen
as "2-way", then this property must be provided. This is the truststore that contains the
@@ -426,6 +444,7 @@
<listitem><para>enabledCipherSuites - A comma separated list of cipher suites allowed for encryption between server and client. The values must be valid supported cipher suites otherwise SSL connections will fail.</para></listitem>
</itemizedlist>
<section id="ssl_auth">
+
<title>SSL Authentication Modes</title>
<para>SSL supports multiple authentication modes. In most secure intranet environments, anonymous is suitable to just bulk encrypt traffic without the need
to setup SSL certificates.
@@ -437,6 +456,7 @@
<listitem><para><emphasis>1-way</emphasis> - the server will present a certificate, which is obtained from the keystore related properties.
The client should have a truststore configured to accept the server certificate.
</para></listitem>
+
<listitem><para><emphasis>2-way</emphasis> - the server will present a certificate, which is obtained from the keystore related properties.
The client should have a truststore configured to accept the server certificate. The client is also expected to present a certificate, which is obtained from its
keystore. The client certificate should be accepted by the trust store configured by the truststore related properties.
@@ -449,6 +469,7 @@
1-way and 2-way SSL allow for cipher suite negotiation based upon the default cipher suites supported by the respective Java platforms of the client and server.
User can restrict the cipher suites used for encryption by specifying the <emphasis>enabledCipherSuites</emphasis> property above in ssl configuration.
</para>
+
</section>
</section>
-</chapter>
\ No newline at end of file
+</chapter>
14 years, 1 month
teiid SVN: r3625 - in trunk: documentation/developer-guide/src/main/docbook/en-US/content and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-11-09 15:55:17 -0500 (Wed, 09 Nov 2011)
New Revision: 3625
Modified:
trunk/build/kits/jboss-container/teiid-releasenotes.html
trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml
trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml
Log:
TEIID-1726 adding the ability to pass source hints through the teiid system
Modified: trunk/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- trunk/build/kits/jboss-container/teiid-releasenotes.html 2011-11-09 20:06:24 UTC (rev 3624)
+++ trunk/build/kits/jboss-container/teiid-releasenotes.html 2011-11-09 20:55:17 UTC (rev 3625)
@@ -38,6 +38,7 @@
<LI><B>View removal hint</B> - the NO_UNNEST hint now also applies to from clause views and subqueries. It will instruct the planner to not perform view flattening.
<LI><B>Non-blocking statement execution</B> - Teiid JDBC extensions TeiidStatement and TeiidPreparedStatement can be used to submit queries against embedded connections with a callback to process results in a non-blocking manner.
<LI><B>NON_STRICT limit hint</B> - the NON_STRICT hint can be used with unordered limits to tell the optimizer to not inhibit push operations even if the results will not be consistent with the logical application of the limit.
+ <LI><B>Source Hints</B> - user and transformation queries can specify a meta source hint, e.g. SELECT /*+ sh my-oracle:'leading' */ * FROM TBL. The hint information will be passed to the passed to the translator. The Oracle translator will by default treat the source hint as an Oracle hint.
</UL>
<h2><a name="Compatibility">Compatibility Issues</a></h2>
Modified: trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml
===================================================================
--- trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml 2011-11-09 20:06:24 UTC (rev 3624)
+++ trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml 2011-11-09 20:55:17 UTC (rev 3625)
@@ -227,21 +227,37 @@
interface that defines how executions are
cancelled and closed. ProcedureExecution also extends ResultSetExecution, since procedures may also return resultsets.</para>
</section>
+
<section>
+ <title>ExecutionContext</title>
+ <para>The <code>org.teiid.translator.ExecutionContext</code> provides a considerable amount of information related to the current execution.
+ An <code>ExecutionContext</code> instance is made available to each <code>Execution</code>. Specific usage is highlighted in this guide where applicable, but you may use any informational getter method as desired.
+ Example usage would include calling <code>ExecutionContext.getRequestIdentifier()</code>, <code>ExecutionContext.getSession()</code>, etc. for logging purposes.</para>
+
+ <section>
+ <title>Source Hints</title>
+ <para>The Teiid source meta-hint is used to provide hints directly to source executions via user or transformation queries. See the reference for more on source hints. If specified and applicable, the general and source specific
+ hint will be supplied via the ExecutionContext methods <code>getGeneralHint</code> and <code>getSourceHint</code>. See the source for the <code>OracleExecutionFactory</code> for an example of how this source hint information
+ can be utilized.</para>
+ </section>
+
+ </section>
+
+ <section>
<title>ResultSetExecution</title>
<para>
Typically most commands executed against translators are QueryExpression.
While the command is being executed, the translator provides results via the
ResultSetExecution's "next" method. The "next" method should return null to indicate the end
of results. Note: the expected batch size can be obtained from the
- ExecutionContext and used as a hint in fetching results from the EIS.
+ <code>ExecutionContext.getBatchSize()</code> method and used as a hint in fetching results from the EIS.
</para>
</section>
<section>
<title>Update Execution</title>
<para>Each execution returns the update count(s) expected by the update command.
If possible BatchedUpdates should be executed atomically.
- The ExecutionContext can be used to determine if the execution is already under a transaction.</para>
+ The <code>ExecutionContext.isTransactional()</code> method can be used to determine if the execution is already under a transaction.</para>
</section>
<section>
<title>Procedure Execution</title>
@@ -271,7 +287,7 @@
The
<code>DataNotAvailableException.NO_POLLING</code>
exception (or any DataNotAvailableException with a negative delay) can be thrown to indicate that
- the execution will call <code>ExecutionContext.dataAvailable</code> to indicate processing should resume.
+ the execution will call <code>ExecutionContext.dataAvailable()</code> to indicate processing should resume.
</para>
</note>
</para>
@@ -320,6 +336,7 @@
termination of queries being processed and may allow the underlying data source to terminate its operations
faster as well.</para>
</section>
+
</section>
<section id="command_language">
@@ -1497,8 +1514,8 @@
connection is either closed/released as soon as all rows for that
execution have been retrieved. However, LOB objects may need to be
read after their initial retrieval of results. When LOBs are detected
- the default closing behavior is prevented by setting a flag on the
- ExecutionContext. See ExecutionContext.keepAlive() method. </para>
+ the default closing behavior is prevented by setting a flag via the
+ <code>ExecutionContext.keepAlive</code> method. </para>
<para>When the "keepAlive" alive flag is set, then the execution object is only closed when user's Statement is closed.</para>
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml 2011-11-09 20:06:24 UTC (rev 3624)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml 2011-11-09 20:55:17 UTC (rev 3625)
@@ -712,9 +712,20 @@
</tbody>
</tgroup>
</informaltable>
- <para />
</section>
</section>
+ <section>
+ <title>Source Hints</title>
+ <para>Teiid user and transformation queries can contain a meta source hint that can provide additional information to source queries.
+ The source hint has the form /*+ sh(:'arg') source-name:'arg1' ... */ and is expected to appear after the query keyword, e.g. "SELECT /*+ sh:'general hint' my-oracle:'oracle hint' */.
+ The sh arg is optional and is passed to all source queries via the <code>ExecutionContext.getGeneralHint</code> method. See the Developer's Guide for more onThe additional args should have source-name that matches
+ the source name assigned to the translator in the VDB. If the source-name matches the hint value will be supplied via the <code>ExecutionContext.getSourceHint</code> method.
+ See the Developer's Guide for more on using an ExecutionContext.
+ Each of the arg values has the form of a string literal - it must be surrounded in single quotes and a single quote can be escaped with another signle quote.
+ Only the Oracle translator does anything with source hints by default. The Oracle translator will use either the source hint or the general hint (in that order) if available to form an Oracle hint enclosed in
+ /*+ ... */. Source hints in views will not be passed to the source if the view is used as a pushdown subquery, is joined, or is in a set operation.
+ </para>
+ </section>
</section>
<section id="query_planner">
<title>Query Planner</title>
14 years, 1 month