teiid SVN: r2943 - in trunk: runtime/src/main/java/org/teiid/odbc and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-02-25 00:37:40 -0500 (Fri, 25 Feb 2011)
New Revision: 2943
Modified:
trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java
trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected
trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_TYPE.expected
Log:
forward merge from 7.1.1
Modified: trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java 2011-02-25 05:36:52 UTC (rev 2942)
+++ trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java 2011-02-25 05:37:40 UTC (rev 2943)
@@ -369,7 +369,7 @@
" union " + //$NON-NLS-1$
"SELECT 20 as oid, 'long' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace, convert(8, short) as typlen, convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid FROM (SELECT 1) X" + //$NON-NLS-1$
" union " + //$NON-NLS-1$
- "SELECT 23 as oid, 'int' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace, convert(4, short) as typlen, convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid FROM (SELECT 1) X" + //$NON-NLS-1$
+ "SELECT 23 as oid, 'integer' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typnamespace, convert(4, short) as typlen, convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid FROM (SELECT 1) X" + //$NON-NLS-1$
" union " + //$NON-NLS-1$
"SELECT 26 as oid, 'oid' as typname, (SELECT OID FROM SYS.Schemas where Name = 'SYS') as typname, convert(4, short) as typlen, convert('b', char) as typtype, 0 as typbasetype, -1 as typtypmod, 0 as typrelid FROM (SELECT 1) X" + //$NON-NLS-1$
" union " + //$NON-NLS-1$
Modified: trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java 2011-02-25 05:36:52 UTC (rev 2942)
+++ trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java 2011-02-25 05:37:40 UTC (rev 2943)
@@ -34,6 +34,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.teiid.core.util.ApplicationInfo;
import org.teiid.jdbc.ConnectionImpl;
import org.teiid.jdbc.TeiidDriver;
import org.teiid.logging.LogConstants;
@@ -300,7 +301,8 @@
// set client_encoding to 'WIN1252'
if (sql != null) {
// selects are coming with "select\t" so using a space after "select" does not always work
- if (sql.startsWith("select") || sql.startsWith("SELECT")) { //$NON-NLS-1$ //$NON-NLS-2$
+ String sqlLower = sql.toLowerCase();
+ if (sqlLower.startsWith("select")) { //$NON-NLS-1$
modified = sql.replace('\n', ' ');
Matcher m = null;
@@ -321,6 +323,15 @@
"FKTABLE_NAME, FKCOLUMN_NAME, KEY_SEQ, UPDATE_RULE, DELETE_RULE, FK_NAME, PK_NAME, DEFERRABILITY "+//$NON-NLS-1$
"FROM SYS.ReferenceKeyColumns WHERE PKTABLE_NAME LIKE '"+m.group(14)+"' and PKTABLE_SCHEM LIKE '"+m.group(15)+"'";//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
+ else if (modified.equalsIgnoreCase("select version()")) { //$NON-NLS-1$
+ modified = "SELECT 'Teiid "+ApplicationInfo.getInstance().getReleaseNumber()+"'"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ else if (modified.startsWith("SELECT name FROM master..sysdatabases")) { //$NON-NLS-1$
+ modified = "SELECT 'Teiid'"; //$NON-NLS-1$
+ }
+ else if (modified.equalsIgnoreCase("select db_name() dbname")) { //$NON-NLS-1$
+ modified = "SELECT current_database()"; //$NON-NLS-1$
+ }
else {
modified = modified.replaceAll("E'", "'"); //$NON-NLS-1$ //$NON-NLS-2$
modified = modified.replaceAll("::[A-Za-z0-9]*", " "); //$NON-NLS-1$ //$NON-NLS-2$
@@ -342,8 +353,11 @@
if (m.matches()) {
if (m.group(2).equalsIgnoreCase("client_encoding")) { //$NON-NLS-1$
this.client.setEncoding(PGCharsetConverter.getCharset(m.group(4)));
- modified = "SELECT 'SET'"; //$NON-NLS-1$
}
+ else {
+ this.props.setProperty(m.group(2), m.group(4));
+ }
+ modified = "SELECT 'SET'"; //$NON-NLS-1$
}
else if (modified.equalsIgnoreCase("BEGIN")) { //$NON-NLS-1$
try {
Modified: trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected 2011-02-25 05:36:52 UTC (rev 2942)
+++ trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected 2011-02-25 05:37:40 UTC (rev 2943)
@@ -1,42 +1,42 @@
integer integer string integer short short integer boolean boolean boolean
oid attrelid attname atttypid attlen attnum atttypmod attnotnull attisdropped atthasdef
-0 0 PART_ID 1043 4 1 4 false false false
-1 0 PART_NAME 1043 255 2 255 false false false
-2 0 PART_COLOR 1043 30 3 30 false false false
-3 0 PART_WEIGHT 1043 255 4 255 false false false
-4 1 SHIPPER_ID 21 0 1 0 false false false
-5 1 SHIPPER_NAME 1043 30 2 30 false false false
-6 2 STATUS_ID 21 0 1 0 false false false
-7 2 STATUS_NAME 1043 30 2 30 false false false
-8 3 SUPPLIER_ID 1043 10 1 10 false false false
-9 3 PART_ID 1043 4 2 4 false false false
-10 3 QUANTITY 21 0 3 0 false false false
-11 3 SHIPPER_ID 21 0 4 0 false false false
-12 4 SUPPLIER_ID 1043 10 1 10 false false false
-13 4 SUPPLIER_NAME 1043 30 2 30 false false false
-14 4 SUPPLIER_STATUS 21 0 3 0 false false false
-15 4 SUPPLIER_CITY 1043 30 4 30 false false false
-16 4 SUPPLIER_STATE 1043 2 5 2 false false false
-17 5 VDBName 1043 255 1 255 false false false
-18 5 SchemaName 1043 255 2 255 false false false
-19 5 Name 1043 255 3 255 false false false
-20 5 TargetSchemaName 1043 255 4 255 false false false
-21 5 TargetName 1043 4000 5 4000 false false false
-22 5 Valid 16 0 6 0 false false false
-23 5 LoadState 1043 255 7 255 false false false
-24 5 Updated 1114 0 8 0 false false false
-25 5 Cardinality <null> 10 9 10 false false false
-26 6 resourcePath 1043 255 1 255 false false false
-27 6 contents 14939 0 2 0 false false false
-28 7 VDBName 1043 255 1 255 false false false
-29 7 SchemaName 1043 255 2 255 false false false
-30 7 TableName 1043 255 3 255 false false false
-31 7 Name 1043 255 4 255 false false false
-32 7 Position <null> 10 5 10 false false false
-33 7 NameInSource 1043 255 6 255 false false false
-34 7 DataType 1043 100 7 100 false false false
-35 7 Scale <null> 10 8 10 false false false
-36 7 Length <null> 10 9 10 false false false
+0 0 PART_ID 1043 -1 1 4 false false false
+1 0 PART_NAME 1043 -1 2 255 false false false
+2 0 PART_COLOR 1043 -1 3 30 false false false
+3 0 PART_WEIGHT 1043 -1 4 255 false false false
+4 1 SHIPPER_ID 21 2 1 0 false false false
+5 1 SHIPPER_NAME 1043 -1 2 30 false false false
+6 2 STATUS_ID 21 2 1 0 false false false
+7 2 STATUS_NAME 1043 -1 2 30 false false false
+8 3 SUPPLIER_ID 1043 -1 1 10 false false false
+9 3 PART_ID 1043 -1 2 4 false false false
+10 3 QUANTITY 21 2 3 0 false false false
+11 3 SHIPPER_ID 21 2 4 0 false false false
+12 4 SUPPLIER_ID 1043 -1 1 10 false false false
+13 4 SUPPLIER_NAME 1043 -1 2 30 false false false
+14 4 SUPPLIER_STATUS 21 2 3 0 false false false
+15 4 SUPPLIER_CITY 1043 -1 4 30 false false false
+16 4 SUPPLIER_STATE 1043 -1 5 2 false false false
+17 5 VDBName 1043 -1 1 255 false false false
+18 5 SchemaName 1043 -1 2 255 false false false
+19 5 Name 1043 -1 3 255 false false false
+20 5 TargetSchemaName 1043 -1 4 255 false false false
+21 5 TargetName 1043 -1 5 4000 false false false
+22 5 Valid 16 1 6 0 false false false
+23 5 LoadState 1043 -1 7 255 false false false
+24 5 Updated 1114 8 8 0 false false false
+25 5 Cardinality 23 4 9 10 false false false
+26 6 resourcePath 1043 -1 1 255 false false false
+27 6 contents 14939 -1 2 0 false false false
+28 7 VDBName 1043 -1 1 255 false false false
+29 7 SchemaName 1043 -1 2 255 false false false
+30 7 TableName 1043 -1 3 255 false false false
+31 7 Name 1043 -1 4 255 false false false
+32 7 Position 23 4 5 10 false false false
+33 7 NameInSource 1043 -1 6 255 false false false
+34 7 DataType 1043 -1 7 100 false false false
+35 7 Scale 23 4 8 10 false false false
+36 7 Length 23 4 9 10 false false false
37 7 IsLengthFixed 16 1 10 1 false false false
38 7 SupportsSelect 16 1 11 1 false false false
39 7 SupportsUpdates 16 1 12 1 false false false
@@ -44,198 +44,198 @@
41 7 IsSigned 16 1 14 1 false false false
42 7 IsCurrency 16 1 15 1 false false false
43 7 IsAutoIncremented 16 1 16 1 false false false
-44 7 NullType 1043 20 17 20 false false false
-45 7 MinRange 1043 50 18 50 false false false
-46 7 MaxRange 1043 50 19 50 false false false
-47 7 SearchType 1043 20 20 20 false false false
-48 7 Format 1043 255 21 255 false false false
-49 7 DefaultValue 1043 255 22 255 false false false
-50 7 JavaClass 1043 500 23 500 false false false
-51 7 Precision <null> 10 24 10 false false false
-52 7 CharOctetLength <null> 10 25 10 false false false
-53 7 Radix <null> 10 26 10 false false false
-54 7 UID 1043 50 27 50 false false false
-55 7 Description 1043 255 28 255 false false false
-56 7 OID <null> 10 29 10 false false false
-57 8 Name 1043 100 1 100 false false false
+44 7 NullType 1043 -1 17 20 false false false
+45 7 MinRange 1043 -1 18 50 false false false
+46 7 MaxRange 1043 -1 19 50 false false false
+47 7 SearchType 1043 -1 20 20 false false false
+48 7 Format 1043 -1 21 255 false false false
+49 7 DefaultValue 1043 -1 22 255 false false false
+50 7 JavaClass 1043 -1 23 500 false false false
+51 7 Precision 23 4 24 10 false false false
+52 7 CharOctetLength 23 4 25 10 false false false
+53 7 Radix 23 4 26 10 false false false
+54 7 UID 1043 -1 27 50 false false false
+55 7 Description 1043 -1 28 255 false false false
+56 7 OID 23 4 29 10 false false false
+57 8 Name 1043 -1 1 100 false false false
58 8 IsStandard 16 1 2 1 false false false
59 8 IsPhysical 16 1 3 1 false false false
-60 8 TypeName 1043 100 4 100 false false false
-61 8 JavaClass 1043 500 5 500 false false false
-62 8 Scale <null> 10 6 10 false false false
-63 8 TypeLength <null> 10 7 10 false false false
-64 8 NullType 1043 20 8 20 false false false
+60 8 TypeName 1043 -1 4 100 false false false
+61 8 JavaClass 1043 -1 5 500 false false false
+62 8 Scale 23 4 6 10 false false false
+63 8 TypeLength 23 4 7 10 false false false
+64 8 NullType 1043 -1 8 20 false false false
65 8 IsSigned 16 1 9 1 false false false
66 8 IsAutoIncremented 16 1 10 1 false false false
67 8 IsCaseSensitive 16 1 11 1 false false false
-68 8 Precision <null> 10 12 10 false false false
-69 8 Radix <null> 10 13 10 false false false
-70 8 SearchType 1043 20 14 20 false false false
-71 8 UID 1043 50 15 50 false false false
-72 8 RuntimeType 1043 64 16 64 false false false
-73 8 BaseType 1043 64 17 64 false false false
-74 8 Description 1043 255 18 255 false false false
-75 8 OID <null> 10 19 10 false false false
-76 9 VDBName 1043 255 1 255 false false false
-77 9 SchemaName 1043 255 2 255 false false false
-78 9 TableName 1043 2048 3 2048 false false false
-79 9 Name 1043 255 4 255 false false false
-80 9 KeyName 1043 255 5 255 false false false
-81 9 KeyType 1043 20 6 20 false false false
-82 9 RefKeyUID 1043 50 7 50 false false false
-83 9 UID 1043 50 8 50 false false false
-84 9 Position <null> 10 9 10 false false false
-85 9 OID <null> 10 10 10 false false false
-86 10 VDBName 1043 255 1 255 false false false
-87 10 SchemaName 1043 255 2 255 false false false
-88 10 TableName 1043 2048 3 2048 false false false
-89 10 Name 1043 255 4 255 false false false
-90 10 Description 1043 255 5 255 false false false
-91 10 NameInSource 1043 255 6 255 false false false
-92 10 Type 1043 20 7 20 false false false
+68 8 Precision 23 4 12 10 false false false
+69 8 Radix 23 4 13 10 false false false
+70 8 SearchType 1043 -1 14 20 false false false
+71 8 UID 1043 -1 15 50 false false false
+72 8 RuntimeType 1043 -1 16 64 false false false
+73 8 BaseType 1043 -1 17 64 false false false
+74 8 Description 1043 -1 18 255 false false false
+75 8 OID 23 4 19 10 false false false
+76 9 VDBName 1043 -1 1 255 false false false
+77 9 SchemaName 1043 -1 2 255 false false false
+78 9 TableName 1043 -1 3 2048 false false false
+79 9 Name 1043 -1 4 255 false false false
+80 9 KeyName 1043 -1 5 255 false false false
+81 9 KeyType 1043 -1 6 20 false false false
+82 9 RefKeyUID 1043 -1 7 50 false false false
+83 9 UID 1043 -1 8 50 false false false
+84 9 Position 23 4 9 10 false false false
+85 9 OID 23 4 10 10 false false false
+86 10 VDBName 1043 -1 1 255 false false false
+87 10 SchemaName 1043 -1 2 255 false false false
+88 10 TableName 1043 -1 3 2048 false false false
+89 10 Name 1043 -1 4 255 false false false
+90 10 Description 1043 -1 5 255 false false false
+91 10 NameInSource 1043 -1 6 255 false false false
+92 10 Type 1043 -1 7 20 false false false
93 10 IsIndexed 16 1 8 1 false false false
-94 10 RefKeyUID 1043 50 9 50 false false false
-95 10 UID 1043 50 10 50 false false false
-96 10 OID <null> 10 11 10 false false false
-97 11 VDBName 1043 255 1 255 false false false
-98 11 SchemaName 1043 255 2 255 false false false
-99 11 ProcedureName 1043 255 3 255 false false false
-100 11 Name 1043 255 4 255 false false false
-101 11 DataType 1043 25 5 25 false false false
-102 11 Position <null> 10 6 10 false false false
-103 11 Type 1043 100 7 100 false false false
+94 10 RefKeyUID 1043 -1 9 50 false false false
+95 10 UID 1043 -1 10 50 false false false
+96 10 OID 23 4 11 10 false false false
+97 11 VDBName 1043 -1 1 255 false false false
+98 11 SchemaName 1043 -1 2 255 false false false
+99 11 ProcedureName 1043 -1 3 255 false false false
+100 11 Name 1043 -1 4 255 false false false
+101 11 DataType 1043 -1 5 25 false false false
+102 11 Position 23 4 6 10 false false false
+103 11 Type 1043 -1 7 100 false false false
104 11 Optional 16 1 8 1 false false false
-105 11 Precision <null> 10 9 10 false false false
-106 11 TypeLength <null> 10 10 10 false false false
-107 11 Scale <null> 10 11 10 false false false
-108 11 Radix <null> 10 12 10 false false false
-109 11 NullType 1043 10 13 10 false false false
-110 11 UID 1043 50 14 50 false false false
-111 11 Description 1043 255 15 255 false false false
-112 11 OID <null> 10 16 10 false false false
-113 12 VDBName 1043 255 1 255 false false false
-114 12 SchemaName 1043 255 2 255 false false false
-115 12 Name 1043 255 3 255 false false false
-116 12 NameInSource 1043 255 4 255 false false false
+105 11 Precision 23 4 9 10 false false false
+106 11 TypeLength 23 4 10 10 false false false
+107 11 Scale 23 4 11 10 false false false
+108 11 Radix 23 4 12 10 false false false
+109 11 NullType 1043 -1 13 10 false false false
+110 11 UID 1043 -1 14 50 false false false
+111 11 Description 1043 -1 15 255 false false false
+112 11 OID 23 4 16 10 false false false
+113 12 VDBName 1043 -1 1 255 false false false
+114 12 SchemaName 1043 -1 2 255 false false false
+115 12 Name 1043 -1 3 255 false false false
+116 12 NameInSource 1043 -1 4 255 false false false
117 12 ReturnsResults 16 1 5 1 false false false
-118 12 UID 1043 50 6 50 false false false
-119 12 Description 1043 255 7 255 false false false
-120 12 OID <null> 10 8 10 false false false
-121 13 Name 1043 255 1 255 false false false
-122 13 Value 1043 255 2 255 false false false
-123 13 UID 1043 50 3 50 false false false
-124 13 OID <null> 10 4 10 false false false
-125 14 PKTABLE_CAT 1043 255 1 255 false false false
-126 14 PKTABLE_SCHEM 1043 255 2 255 false false false
-127 14 PKTABLE_NAME 1043 255 3 255 false false false
-128 14 PKCOLUMN_NAME 1043 255 4 255 false false false
-129 14 FKTABLE_CAT 1043 255 5 255 false false false
-130 14 FKTABLE_SCHEM 1043 255 6 255 false false false
-131 14 FKTABLE_NAME 1043 255 7 255 false false false
-132 14 FKCOLUMN_NAME 1043 255 8 255 false false false
-133 14 KEY_SEQ 21 5 9 5 false false false
-134 14 UPDATE_RULE <null> 10 10 10 false false false
-135 14 DELETE_RULE <null> 10 11 10 false false false
-136 14 FK_NAME 1043 255 12 255 false false false
-137 14 PK_NAME 1043 255 13 255 false false false
-138 14 DEFERRABILITY <null> 10 14 10 false false false
-139 15 VDBName 1043 255 1 255 false false false
-140 15 Name 1043 255 2 255 false false false
+118 12 UID 1043 -1 6 50 false false false
+119 12 Description 1043 -1 7 255 false false false
+120 12 OID 23 4 8 10 false false false
+121 13 Name 1043 -1 1 255 false false false
+122 13 Value 1043 -1 2 255 false false false
+123 13 UID 1043 -1 3 50 false false false
+124 13 OID 23 4 4 10 false false false
+125 14 PKTABLE_CAT 1043 -1 1 255 false false false
+126 14 PKTABLE_SCHEM 1043 -1 2 255 false false false
+127 14 PKTABLE_NAME 1043 -1 3 255 false false false
+128 14 PKCOLUMN_NAME 1043 -1 4 255 false false false
+129 14 FKTABLE_CAT 1043 -1 5 255 false false false
+130 14 FKTABLE_SCHEM 1043 -1 6 255 false false false
+131 14 FKTABLE_NAME 1043 -1 7 255 false false false
+132 14 FKCOLUMN_NAME 1043 -1 8 255 false false false
+133 14 KEY_SEQ 21 2 9 5 false false false
+134 14 UPDATE_RULE 23 4 10 10 false false false
+135 14 DELETE_RULE 23 4 11 10 false false false
+136 14 FK_NAME 1043 -1 12 255 false false false
+137 14 PK_NAME 1043 -1 13 255 false false false
+138 14 DEFERRABILITY 23 4 14 10 false false false
+139 15 VDBName 1043 -1 1 255 false false false
+140 15 Name 1043 -1 2 255 false false false
141 15 IsPhysical 16 1 3 1 false false false
-142 15 UID 1043 50 4 50 false false false
-143 15 Description 1043 255 5 255 false false false
-144 15 PrimaryMetamodelURI 1043 255 6 255 false false false
-145 15 OID <null> 10 7 10 false false false
-146 16 VDBName 1043 255 1 255 false false false
-147 16 SchemaName 1043 255 2 255 false false false
-148 16 Name 1043 255 3 255 false false false
-149 16 Type 1043 20 4 20 false false false
-150 16 NameInSource 1043 255 5 255 false false false
+142 15 UID 1043 -1 4 50 false false false
+143 15 Description 1043 -1 5 255 false false false
+144 15 PrimaryMetamodelURI 1043 -1 6 255 false false false
+145 15 OID 23 4 7 10 false false false
+146 16 VDBName 1043 -1 1 255 false false false
+147 16 SchemaName 1043 -1 2 255 false false false
+148 16 Name 1043 -1 3 255 false false false
+149 16 Type 1043 -1 4 20 false false false
+150 16 NameInSource 1043 -1 5 255 false false false
151 16 IsPhysical 16 1 6 1 false false false
152 16 SupportsUpdates 16 1 7 1 false false false
-153 16 UID 1043 50 8 50 false false false
-154 16 Cardinality <null> 10 9 10 false false false
-155 16 Description 1043 255 10 255 false false false
+153 16 UID 1043 -1 8 50 false false false
+154 16 Cardinality 23 4 9 10 false false false
+155 16 Description 1043 -1 10 255 false false false
156 16 IsSystem 16 1 11 1 false false false
-157 16 IsMaterialized 16 0 12 0 false false false
-158 16 OID <null> 10 13 10 false false false
-159 17 Name 1043 255 1 255 false false false
-160 17 Version 1043 50 2 50 false false false
-161 18 oid <null> 0 1 0 false false false
-162 18 nspname 1043 0 2 0 false false false
-163 19 oid <null> 0 1 0 false false false
-164 19 relname 1043 0 2 0 false false false
-165 19 relnamespace <null> 0 3 0 false false false
-166 19 relkind 1042 0 4 0 false false false
-167 19 relam <null> 0 5 0 false false false
-168 19 reltuples 700 0 6 0 false false false
-169 19 relpages <null> 0 7 0 false false false
-170 19 relhasrules 16 0 8 0 false false false
-171 19 relhasoids 1043 0 9 0 false false false
-172 20 oid <null> 0 1 0 false false false
-173 20 attrelid <null> 0 2 0 false false false
-174 20 attname 1043 0 3 0 false false false
-175 20 atttypid <null> 0 4 0 false false false
-176 20 attlen 21 0 5 0 false false false
-177 20 attnum 21 0 6 0 false false false
-178 20 atttypmod <null> 0 7 0 false false false
-179 20 attnotnull 16 0 8 0 false false false
-180 20 attisdropped 16 0 9 0 false false false
-181 20 atthasdef 16 0 10 0 false false false
-182 21 oid <null> 0 1 0 false false false
-183 21 typname 1043 0 2 0 false false false
-184 21 typnamespace <null> 0 3 0 false false false
-185 21 typlen 21 0 4 0 false false false
-186 21 typtype 1042 0 5 0 false false false
-187 21 typbasetype <null> 0 6 0 false false false
-188 21 typtypmod <null> 0 7 0 false false false
-189 21 typrelid <null> 0 8 0 false false false
-190 22 oid <null> 0 1 0 false false false
-191 22 indexrelid <null> 0 2 0 false false false
-192 22 indrelid <null> 0 3 0 false false false
-193 22 indisclustered 16 0 4 0 false false false
-194 22 indisunique 16 0 5 0 false false false
-195 22 indisprimary 16 0 6 0 false false false
-196 22 indexprs 1043 0 7 0 false false false
-197 22 indkey 1043 0 8 0 false false false
-198 23 oid <null> 0 1 0 false false false
-199 23 amname 1043 0 2 0 false false false
-200 24 oid <null> 0 1 0 false false false
-201 24 proname 1043 0 2 0 false false false
-202 24 proretset 16 0 3 0 false false false
-203 24 prorettype <null> 0 4 0 false false false
-204 24 pronargs 21 0 5 0 false false false
-205 24 proargtypes <null> 0 6 0 false false false
-206 24 proargnames <null> 0 7 0 false false false
-207 24 proargmodes <null> 0 8 0 false false false
-208 24 proallargtypes <null> 0 9 0 false false false
-209 24 pronamespace <null> 0 10 0 false false false
-210 25 oid <null> 0 1 0 false false false
-211 25 tgconstrrelid <null> 0 2 0 false false false
-212 25 tgfoid <null> 0 3 0 false false false
-213 25 tgargs <null> 0 4 0 false false false
-214 25 tgnargs <null> 0 5 0 false false false
-215 25 tgdeferrable 16 0 6 0 false false false
-216 25 tginitdeferred 16 0 7 0 false false false
-217 25 tgconstrname 1043 0 8 0 false false false
-218 25 tgrelid <null> 0 9 0 false false false
-219 26 oid <null> 0 1 0 false false false
-220 26 adsrc <null> 0 2 0 false false false
-221 26 adrelid <null> 0 3 0 false false false
-222 26 adnum <null> 0 4 0 false false false
-223 27 oid <null> 0 1 0 false false false
-224 27 datname 1043 0 2 0 false false false
-225 27 encoding <null> 0 3 0 false false false
-226 27 datlastsysoid <null> 0 4 0 false false false
-227 27 datallowconn 1042 0 5 0 false false false
-228 27 datconfig <null> 0 6 0 false false false
-229 27 datacl <null> 0 7 0 false false false
-230 27 datdba <null> 0 8 0 false false false
-231 27 dattablespace <null> 0 9 0 false false false
-232 28 oid <null> 0 1 0 false false false
-233 28 usename 1043 0 2 0 false false false
-234 28 usecreatedb 16 0 3 0 false false false
-235 28 usesuper 16 0 4 0 false false false
+157 16 IsMaterialized 16 1 12 0 false false false
+158 16 OID 23 4 13 10 false false false
+159 17 Name 1043 -1 1 255 false false false
+160 17 Version 1043 -1 2 50 false false false
+161 18 oid 23 4 1 0 false false false
+162 18 nspname 1043 -1 2 0 false false false
+163 19 oid 23 4 1 0 false false false
+164 19 relname 1043 -1 2 0 false false false
+165 19 relnamespace 23 4 3 0 false false false
+166 19 relkind 1042 1 4 0 false false false
+167 19 relam 23 4 5 0 false false false
+168 19 reltuples 700 4 6 0 false false false
+169 19 relpages 23 4 7 0 false false false
+170 19 relhasrules 16 1 8 0 false false false
+171 19 relhasoids 1043 -1 9 0 false false false
+172 20 oid 23 4 1 0 false false false
+173 20 attrelid 23 4 2 0 false false false
+174 20 attname 1043 -1 3 0 false false false
+175 20 atttypid 23 4 4 0 false false false
+176 20 attlen 21 2 5 0 false false false
+177 20 attnum 21 2 6 0 false false false
+178 20 atttypmod 23 4 7 0 false false false
+179 20 attnotnull 16 1 8 0 false false false
+180 20 attisdropped 16 1 9 0 false false false
+181 20 atthasdef 16 1 10 0 false false false
+182 21 oid 23 4 1 0 false false false
+183 21 typname 1043 -1 2 0 false false false
+184 21 typnamespace 23 4 3 0 false false false
+185 21 typlen 21 2 4 0 false false false
+186 21 typtype 1042 1 5 0 false false false
+187 21 typbasetype 23 4 6 0 false false false
+188 21 typtypmod 23 4 7 0 false false false
+189 21 typrelid 23 4 8 0 false false false
+190 22 oid 23 4 1 0 false false false
+191 22 indexrelid 23 4 2 0 false false false
+192 22 indrelid 23 4 3 0 false false false
+193 22 indisclustered 16 1 4 0 false false false
+194 22 indisunique 16 1 5 0 false false false
+195 22 indisprimary 16 1 6 0 false false false
+196 22 indexprs 1043 -1 7 0 false false false
+197 22 indkey 1043 -1 8 0 false false false
+198 23 oid 23 4 1 0 false false false
+199 23 amname 1043 -1 2 0 false false false
+200 24 oid 23 4 1 0 false false false
+201 24 proname 1043 -1 2 0 false false false
+202 24 proretset 16 1 3 0 false false false
+203 24 prorettype 23 4 4 0 false false false
+204 24 pronargs 21 2 5 0 false false false
+205 24 proargtypes <null> <null> 6 0 false false false
+206 24 proargnames <null> <null> 7 0 false false false
+207 24 proargmodes <null> <null> 8 0 false false false
+208 24 proallargtypes <null> <null> 9 0 false false false
+209 24 pronamespace 23 4 10 0 false false false
+210 25 oid 23 4 1 0 false false false
+211 25 tgconstrrelid 23 4 2 0 false false false
+212 25 tgfoid 23 4 3 0 false false false
+213 25 tgargs 23 4 4 0 false false false
+214 25 tgnargs 23 4 5 0 false false false
+215 25 tgdeferrable 16 1 6 0 false false false
+216 25 tginitdeferred 16 1 7 0 false false false
+217 25 tgconstrname 1043 -1 8 0 false false false
+218 25 tgrelid 23 4 9 0 false false false
+219 26 oid 23 4 1 0 false false false
+220 26 adsrc 23 4 2 0 false false false
+221 26 adrelid 23 4 3 0 false false false
+222 26 adnum 23 4 4 0 false false false
+223 27 oid 23 4 1 0 false false false
+224 27 datname 1043 -1 2 0 false false false
+225 27 encoding 23 4 3 0 false false false
+226 27 datlastsysoid 23 4 4 0 false false false
+227 27 datallowconn 1042 1 5 0 false false false
+228 27 datconfig <null> <null> 6 0 false false false
+229 27 datacl <null> <null> 7 0 false false false
+230 27 datdba 23 4 8 0 false false false
+231 27 dattablespace 23 4 9 0 false false false
+232 28 oid 23 4 1 0 false false false
+233 28 usename 1043 -1 2 0 false false false
+234 28 usecreatedb 16 1 3 0 false false false
+235 28 usesuper 16 1 4 0 false false false
Row Count : 236
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
oid 4 PartsSupplier java.lang.Integer oid integer pg_catalog pg_attribute 11 10 0 false false false false 2 true true false false
Modified: trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_TYPE.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_TYPE.expected 2011-02-25 05:36:52 UTC (rev 2942)
+++ trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_TYPE.expected 2011-02-25 05:37:40 UTC (rev 2943)
@@ -3,7 +3,7 @@
16 boolean 2 1 b 0 -1 0
20 long 2 8 b 0 -1 0
21 short 2 2 b 0 -1 0
-23 int 2 4 b 0 -1 0
+23 integer 2 4 b 0 -1 0
25 text 2 -1 b 0 -1 0
26 oid 2 4 b 0 -1 0
142 xml 2 -1 b 0 -1 0
14 years
teiid SVN: r2942 - in trunk: client/src/main/java/org/teiid/adminapi and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-02-25 00:36:52 -0500 (Fri, 25 Feb 2011)
New Revision: 2942
Modified:
trunk/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java
trunk/client/src/main/java/org/teiid/adminapi/Admin.java
Log:
TEIID-1329 adding the markDataSourceAvailable method to force the load of dynamic vdb metadata
Modified: trunk/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java
===================================================================
--- trunk/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java 2011-02-25 05:34:22 UTC (rev 2941)
+++ trunk/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java 2011-02-25 05:36:52 UTC (rev 2942)
@@ -417,4 +417,10 @@
help.help(method);
}
+ @Doc(text = "Tell the engine that the given source is available. Pending dynamic vdb metadata loads will be resumed.")
+ public static void markDataSourceAvailable(
+ @Doc(text = "jndi name") String name) throws AdminException {
+ getAdmin().markDataSourceAvailable(name);
+ }
+
}
Property changes on: trunk/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/7.1.x/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java:2901-2940
Modified: trunk/client/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2011-02-25 05:34:22 UTC (rev 2941)
+++ trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2011-02-25 05:36:52 UTC (rev 2942)
@@ -290,9 +290,9 @@
Set<String> getDataSourceTemplateNames() throws AdminException;
/**
- * Let
- * @param name
+ * Tell the engine that the given source is available. Pending dynamic vdb metadata loads will be resumed.
+ * @param jndiName
* @throws AdminException
*/
- void markDataSourceAvailable(String name) throws AdminException;
+ void markDataSourceAvailable(String jndiName) throws AdminException;
}
14 years
teiid SVN: r2941 - in trunk: client/src/main/java/org/teiid/adminapi and 2 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-02-25 00:34:22 -0500 (Fri, 25 Feb 2011)
New Revision: 2941
Modified:
trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
trunk/client/src/main/java/org/teiid/adminapi/Admin.java
trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminProvider.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
Log:
TEIID-1329 adding the markDataSourceAvailable method to force the load of dynamic vdb metadata
Modified: trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
--- trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2011-02-25 00:38:40 UTC (rev 2940)
+++ trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2011-02-25 05:34:22 UTC (rev 2941)
@@ -83,6 +83,7 @@
<property name="bufferService"><inject bean="BufferService"/></property>
<property name="securityHelper"><inject bean="SecurityHelper"/></property>
<property name="VDBRepository"><inject bean="VDBRepository"/></property>
+ <property name="VDBStatusChecker"><inject bean="VDBStatusChecker"/></property>
<property name="cacheFactory"><inject bean="CacheFactory"/></property>
<property name="resultsetCacheConfig"><inject bean="ResultsetCacheConfig"/></property>
Modified: trunk/client/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2011-02-25 00:38:40 UTC (rev 2940)
+++ trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2011-02-25 05:34:22 UTC (rev 2941)
@@ -288,4 +288,11 @@
* @throws AdminException
*/
Set<String> getDataSourceTemplateNames() throws AdminException;
+
+ /**
+ * Let
+ * @param name
+ * @throws AdminException
+ */
+ void markDataSourceAvailable(String name) throws AdminException;
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2011-02-25 00:38:40 UTC (rev 2940)
+++ trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2011-02-25 05:34:22 UTC (rev 2941)
@@ -73,6 +73,7 @@
import org.teiid.adminapi.impl.TranslatorMetaData;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
+import org.teiid.deployers.VDBStatusChecker;
import org.teiid.jboss.IntegrationPlugin;
public class Admin implements org.teiid.adminapi.Admin, Serializable {
@@ -91,13 +92,15 @@
private ManagementView view;
private DeploymentManager deploymentMgr;
+ final private VDBStatusChecker statusChecker;
static {
VFS.init();
}
- public Admin(ManagementView view, DeploymentManager deployMgr) {
+ public Admin(ManagementView view, DeploymentManager deployMgr, VDBStatusChecker statusChecker) {
this.view = view;
+ this.statusChecker = statusChecker;
this.view.load();
this.deploymentMgr = deployMgr;
@@ -734,4 +737,9 @@
throw new AdminComponentException(e.getMessage(), e);
}
}
+
+ @Override
+ public void markDataSourceAvailable(String name) throws AdminException {
+ statusChecker.dataSourceAdded(name);
+ }
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminProvider.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminProvider.java 2011-02-25 00:38:40 UTC (rev 2940)
+++ trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminProvider.java 2011-02-25 05:34:22 UTC (rev 2941)
@@ -43,22 +43,23 @@
import org.jboss.deployers.spi.management.deploy.DeploymentManager;
import org.jboss.profileservice.spi.ProfileService;
import org.teiid.adminapi.AdminComponentException;
+import org.teiid.deployers.VDBStatusChecker;
public class AdminProvider {
- public static Admin getLocal(final ProfileService profileService) {
+ public static Admin getLocal(final ProfileService profileService, VDBStatusChecker vdbStatusChecker) {
ProfileConnection pc = new ProfileConnection(profileService);
- return new Admin(pc.getManagementView(), pc.getDeploymentManager());
+ return new Admin(pc.getManagementView(), pc.getDeploymentManager(), vdbStatusChecker);
}
- public static Admin getLocal() throws AdminComponentException {
+ public static Admin getLocal(VDBStatusChecker vdbStatusChecker) throws AdminComponentException {
ProfileConnection pc = new ProfileConnection();
- return new Admin(pc.getManagementView(), pc.getDeploymentManager());
+ return new Admin(pc.getManagementView(), pc.getDeploymentManager(), vdbStatusChecker);
}
- public static Admin getRemote(String provideURL, String userid, String password) throws AdminComponentException {
+ public static Admin getRemote(String provideURL, String userid, String password, VDBStatusChecker vdbStatusChecker) throws AdminComponentException {
ProfileConnection pc = new ProfileConnection(provideURL, userid, password);
- return new Admin(pc.getManagementView(), pc.getDeploymentManager());
+ return new Admin(pc.getManagementView(), pc.getDeploymentManager(), vdbStatusChecker);
}
/**
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java 2011-02-25 00:38:40 UTC (rev 2940)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java 2011-02-25 05:34:22 UTC (rev 2941)
@@ -82,20 +82,21 @@
}
String sourceName = getSourceName(resourceName, model, translator);
- if (sourceName != null) {
- ConnectorManager cm = cmr.getConnectorManager(sourceName);
- String status = cm.getStausMessage();
- if (status != null && status.length() > 0) {
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), status);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, status);
+ if (sourceName == null) {
+ continue;
+ }
+ ConnectorManager cm = cmr.getConnectorManager(sourceName);
+ String status = cm.getStausMessage();
+ if (status != null && status.length() > 0) {
+ model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), status);
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, status);
+ } else {
+ //get the pending metadata load
+ Runnable r = model.removeAttachment(Runnable.class);
+ if (r != null) {
+ runnables.add(r);
} else {
- //get the pending metadata load
- Runnable r = model.removeAttachment(Runnable.class);
- if (r != null) {
- runnables.add(r);
- } else {
- model.clearErrors();
- }
+ model.clearErrors();
}
}
}
14 years
teiid SVN: r2940 - trunk/documentation/reference/src/main/docbook/en-US/content.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-02-24 19:38:40 -0500 (Thu, 24 Feb 2011)
New Revision: 2940
Modified:
trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml
Log:
TEIID-217 adding multivalued-concat handling
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml 2011-02-25 00:30:45 UTC (rev 2939)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml 2011-02-25 00:38:40 UTC (rev 2940)
@@ -511,6 +511,19 @@
</tbody>
</tgroup>
</table>
+
+ <para>
+ There are no import settings for the ldap translator; it also does not
+ provide metadata.
+ </para>
+
+ <section>
+ <title>Metadata Directives</title>
+ <para>String columns with a default value of "multivalued-concat" will concatinate all attribute
+ values together in alphabetical order using a ? delimiter. If a multivalued attribute does not have a default value of "multivalued-concat", then
+ any value may be returned.
+ </para>
+ </section>
</section>
<section>
14 years
teiid SVN: r2939 - in trunk/connectors/translator-ldap/src/main: resources/org/teiid/translator/ldap and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-02-24 19:30:45 -0500 (Thu, 24 Feb 2011)
New Revision: 2939
Modified:
trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPSearchDetails.java
trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPSyncQueryExecution.java
trunk/connectors/translator-ldap/src/main/resources/org/teiid/translator/ldap/i18n.properties
Log:
TEIID-217 adding multivalued-concat handling
Modified: trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPSearchDetails.java
===================================================================
--- trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPSearchDetails.java 2011-02-24 22:00:56 UTC (rev 2938)
+++ trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPSearchDetails.java 2011-02-25 00:30:45 UTC (rev 2939)
@@ -32,6 +32,7 @@
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
+import org.teiid.metadata.Column;
@@ -49,7 +50,7 @@
// private LdapSortKey[] netscapeKeys;
// If limit is set to -1, this means no limit (return all rows)
private long limit;
- private ArrayList elementList;
+ private ArrayList<Column> elementList;
/**
* Constructor
@@ -108,7 +109,7 @@
* get the element list
* @return the element list
*/
- public ArrayList getElementList() {
+ public ArrayList<Column> getElementList() {
return elementList;
}
Modified: trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPSyncQueryExecution.java
===================================================================
--- trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPSyncQueryExecution.java 2011-02-24 22:00:56 UTC (rev 2938)
+++ trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPSyncQueryExecution.java 2011-02-25 00:30:45 UTC (rev 2939)
@@ -76,6 +76,7 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
@@ -97,8 +98,9 @@
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.metadata.Column;
-import org.teiid.translator.TranslatorException;
import org.teiid.translator.ResultSetExecution;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.TypeFacility;
@@ -108,10 +110,12 @@
*/
public class LDAPSyncQueryExecution implements ResultSetExecution {
+ private static final String delimiter = "?"; //$NON-NLS-1$
+
private LDAPSearchDetails searchDetails;
private LdapContext ldapConnection;
private LdapContext ldapCtx;
- private NamingEnumeration searchEnumeration;
+ private NamingEnumeration<?> searchEnumeration;
private IQueryToLdapSearchParser parser;
private Select query;
private LDAPExecutionFactory executionFactory;
@@ -192,18 +196,13 @@
/**
* Set the search controls
*/
- private SearchControls setSearchControls() throws TranslatorException {
+ private SearchControls setSearchControls() {
SearchControls ctrls = new SearchControls();
//ArrayList modelAttrList = searchDetails.getAttributeList();
- ArrayList modelAttrList = searchDetails.getElementList();
+ ArrayList<Column> modelAttrList = searchDetails.getElementList();
String[] attrs = new String[modelAttrList.size()];
- Iterator itr = modelAttrList.iterator();
- int i = 0;
- while(itr.hasNext()) {
- attrs[i] = (parser.getNameFromElement((Column)itr.next()));
- //attrs[i] = (((Attribute)itr.next()).getID();
- //logger.logTrace("Adding attribute named " + attrs[i] + " to the search list.");
- i++;
+ for (int i = 0; i < attrs.length; i++) {
+ attrs[i] = (parser.getNameFromElement(modelAttrList.get(i)));
}
ctrls.setSearchScope(searchDetails.getSearchScope());
@@ -285,11 +284,11 @@
// it from being used again.
// GHH 20080326 - also added return of explanation for generic
// NamingException
- public List next() throws TranslatorException {
+ public List<?> next() throws TranslatorException {
try {
// The search has been executed, so process up to one batch of
// results.
- List result = null;
+ List<?> result = null;
while (result == null && searchEnumeration != null && searchEnumeration.hasMore())
{
SearchResult searchResult = (SearchResult) searchEnumeration.next();
@@ -316,20 +315,16 @@
*/
// GHH 20080326 - added fetching of DN of result, for directories that
// do not include it as an attribute
- private List getRow(SearchResult result) throws TranslatorException {
+ private List<?> getRow(SearchResult result) throws TranslatorException {
Attributes attrs = result.getAttributes();
String resultDN = result.getNameInNamespace(); // added GHH 20080326
- ArrayList attributeList = searchDetails.getElementList();
- List row = new ArrayList();
+ ArrayList<Column> attributeList = searchDetails.getElementList();
+ List<Object> row = new ArrayList<Object>(attributeList.size());
- if (attrs != null && attrs.size()>0) {
- Iterator itr = attributeList.iterator();
- while(itr.hasNext()) {
- addResultToRow((Column)itr.next(), resultDN, attrs, row); // GHH 20080326 - added resultDN parameter to call
- }
- return row;
+ for (Column col : attributeList) {
+ addResultToRow(col, resultDN, attrs, row); // GHH 20080326 - added resultDN parameter to call
}
- return null;
+ return row;
}
/**
@@ -344,11 +339,14 @@
// value for that column in the result
// GHH 20080326 - added handling of ClassCastException when non-string
// attribute is returned
- private void addResultToRow(Column modelElement, String resultDistinguishedName, Attributes attrs, List row) throws TranslatorException {
+ private void addResultToRow(Column modelElement, String resultDistinguishedName, Attributes attrs, List<Object> row) throws TranslatorException {
- String strResult;
+ String strResult = null;
String modelAttrName = parser.getNameFromElement(modelElement);
- Class modelAttrClass = modelElement.getJavaType();
+ Class<?> modelAttrClass = modelElement.getJavaType();
+
+ String multivalAttr = modelElement.getDefaultValue();
+
if(modelAttrName == null) {
final String msg = LDAPPlugin.Util.getString("LDAPSyncQueryExecution.nullAttrError"); //$NON-NLS-1$
throw new TranslatorException(msg);
@@ -370,97 +368,86 @@
row.add(null);
}
return;
- }
- // TODO: Currently, if an LDAP entry contains more than one matching
- // attribute, we only return the first.
- // Since attribute order is not guaranteed, this means that we may not
- // always return the exact same information.
- // Putting multi-valued attributes into a single row (or multiple rows) requires
- // some design decisions.
- // GHH 20080326 - first get attribute as generic object
- // so we can check to make sure it is a string separately - previously it was just put straight into a string.
+ }
Object objResult = null;
try {
+ if(TypeFacility.RUNTIME_TYPES.STRING.equals(modelAttrClass) && "multivalued-concat".equalsIgnoreCase(multivalAttr)) { //$NON-NLS-1$
+ // mpw 5/09
+ // Order the multi-valued attrs alphabetically before creating a single string,
+ // using the delimiter to separate each token
+ ArrayList<String> multivalList = new ArrayList<String>();
+ NamingEnumeration<?> attrNE = resultAttr.getAll();
+ int length = 0;
+ while(attrNE.hasMore()) {
+ String val = (String)attrNE.next();
+ multivalList.add(val);
+ length += ((val==null?0:val.length()) + 1);
+ }
+ Collections.sort(multivalList);
+
+ StringBuilder multivalSB = new StringBuilder(length);
+ Iterator<String> itr = multivalList.iterator();
+ while(itr.hasNext()) {
+ multivalSB.append(itr.next());
+ if (itr.hasNext()) {
+ multivalSB.append(delimiter);
+ }
+ }
+ row.add(multivalSB.toString());
+ return;
+ }
+
+ //just a single value
objResult = resultAttr.get();
} catch (NamingException ne) {
- final String msg = LDAPPlugin.Util.getString("LDAPSyncQueryExecution.attrValueFetchError",modelAttrName); //$NON-NLS-1$
- LogManager.logWarning(LogConstants.CTX_CONNECTOR, msg+" : "+ne.getExplanation()); //$NON-NLS-1$
- throw new TranslatorException(msg+" : "+ne.getExplanation()); //$NON-NLS-1$
+ final String msg = LDAPPlugin.Util.getString("LDAPSyncQueryExecution.attrValueFetchError",modelAttrName) +" : "+ne.getExplanation(); //$NON-NLS-1$m//$NON-NLS-2$
+ LogManager.logWarning(LogConstants.CTX_CONNECTOR, msg);
+ throw new TranslatorException(msg);
}
- // GHH 20080326 - if attribute is not a string, just
- // return an empty string.
+ // GHH 20080326 - if attribute is not a string or empty, just
+ // return null.
// TODO - allow return of non-strings (always byte[]) as
- // MM object. Perhaps also add directory-specific logic
+ // MM object (or blob). Perhaps also add directory-specific logic
// to deserialize byte[] attributes into Java objects
// when appropriate
- try {
+ if (objResult instanceof String) {
strResult = (String)objResult;
- } catch (ClassCastException cce) {
- strResult = ""; //$NON-NLS-1$
+ // MPW - 3.9.07 - Also return NULL when attribute is unset or empty string.
+ // There is no way to differentiate between being unset and being the empty string.
+ if(strResult.equals("")) { //$NON-NLS-1$
+ strResult = null;
+ }
}
- // MPW - 3.9.07 - Also return NULL when attribute is unset or empty string.
- // There is no way to differentiate between being unset and being the empty string.
- if(strResult.equals("")) { //$NON-NLS-1$
- strResult = null;
- }
-
// MPW: 3-11-07: Added support for java.lang.Integer conversion.
- try {
- if(modelAttrClass.equals(Class.forName(Integer.class.getName()))) {
- try {
- // Throw an exception if class cast fails.
- if(strResult != null) {
- Integer intResult = new Integer(strResult);
- row.add(intResult);
- } else {
- row.add(null);
- }
- } catch(NumberFormatException nfe) {
- throw new TranslatorException(nfe, "Element " + modelAttrName + " is typed as Integer, " + //$NON-NLS-1$ //$NON-NLS-2$
- "but it's value (" + strResult + ") cannot be converted from string " + //$NON-NLS-1$ //$NON-NLS-2$
- "to Integer. Please change type to String, or modify the data."); //$NON-NLS-1$
- }
- // java.lang.String
- } else if(modelAttrClass.equals(Class.forName(String.class.getName()))) {
- row.add(strResult);
- // java.sql.Timestamp
- } else if(modelAttrClass.equals(Class.forName(java.sql.Timestamp.class.getName()))) {
- Map<String, String> p = modelElement.getProperties();
+ if(TypeFacility.RUNTIME_TYPES.TIMESTAMP.equals(modelAttrClass)) {
+ Map<String, String> p = modelElement.getProperties();
- String timestampFormat = p.get("Format"); //$NON-NLS-1$
- SimpleDateFormat dateFormat;
- if(timestampFormat == null) {
- timestampFormat = LDAPConnectorConstants.ldapTimestampFormat;
-
- }
- dateFormat = new SimpleDateFormat(timestampFormat);
- try {
- if(strResult != null) {
- Date dateResult = dateFormat.parse(strResult);
- Timestamp tsResult = new Timestamp(dateResult.getTime());
- row.add(tsResult);
- } else {
- row.add(null);
- }
- } catch(ParseException pe) {
- throw new TranslatorException(pe, "Timestamp could not be parsed. Please check to ensure the " //$NON-NLS-1$
- + " Format field for attribute " //$NON-NLS-1$
- + modelAttrName + " is configured using SimpleDateFormat conventions."); //$NON-NLS-1$
- }
+ String timestampFormat = p.get("Format"); //$NON-NLS-1$
+ SimpleDateFormat dateFormat;
+ if(timestampFormat == null) {
+ timestampFormat = LDAPConnectorConstants.ldapTimestampFormat;
+ }
+ dateFormat = new SimpleDateFormat(timestampFormat);
+ try {
+ if(strResult != null) {
+ Date dateResult = dateFormat.parse(strResult);
+ Timestamp tsResult = new Timestamp(dateResult.getTime());
+ row.add(tsResult);
+ } else {
+ row.add(null);
+ }
+ } catch(ParseException pe) {
+ throw new TranslatorException(pe, LDAPPlugin.Util.getString("LDAPSyncQueryExecution.timestampParseFailed", modelAttrName)); //$NON-NLS-1$
+ }
+
// TODO: Extend support for more types in the future.
// Specifically, add support for byte arrays, since that's actually supported
// in the underlying data source.
- } else {
- throw new TranslatorException("Base type " + modelAttrClass.toString() //$NON-NLS-1$
- + " is not supported in the LDAP connector. " //$NON-NLS-1$
- + " Please modify the base model to use a supported type."); //$NON-NLS-1$
- }
- } catch(ClassNotFoundException cne) {
- final String msg = LDAPPlugin.Util.getString("LDAPSyncQueryExecution.supportedClassNotFoundError"); //$NON-NLS-1$
- throw new TranslatorException(cne, msg);
+ } else {
+ row.add(strResult); //the Teiid type conversion logic will handle refine from here if necessary
}
}
Modified: trunk/connectors/translator-ldap/src/main/resources/org/teiid/translator/ldap/i18n.properties
===================================================================
--- trunk/connectors/translator-ldap/src/main/resources/org/teiid/translator/ldap/i18n.properties 2011-02-24 22:00:56 UTC (rev 2938)
+++ trunk/connectors/translator-ldap/src/main/resources/org/teiid/translator/ldap/i18n.properties 2011-02-25 00:30:45 UTC (rev 2939)
@@ -59,4 +59,5 @@
LDAPUpdateExecution.criteriaRHSNotLiteralError=right side of equals comparison against DN is not a literal - must be a string literal
LDAPUpdateExecution.criteriaRHSNotStringError=right side of equals comparison against DN is not a string - must be a string literal
LDAPUpdateExecution.closeContextError=LDAP error occurred during attempt to close context : {0}
-
+LDAPSyncQueryExecution.timestampParseFailed=Timestamp could not be parsed. Please check to ensure the Format field for attribute {0} is configured using SimpleDateFormat conventions.
+
14 years
teiid SVN: r2938 - in trunk/engine/src: main/java/org/teiid/common/buffer/impl and 7 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-02-24 17:00:56 -0500 (Thu, 24 Feb 2011)
New Revision: 2938
Modified:
trunk/engine/src/main/java/org/teiid/common/buffer/BatchManager.java
trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java
trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java
trunk/engine/src/main/java/org/teiid/query/processor/BatchCollector.java
trunk/engine/src/main/java/org/teiid/query/processor/ProcessorPlan.java
trunk/engine/src/main/java/org/teiid/query/processor/QueryProcessor.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalPlan.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/SortNode.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/SourceState.java
trunk/engine/src/test/java/org/teiid/common/buffer/TestTupleBuffer.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
Log:
TEIID-1482 removing unnecessary rebuffering
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/BatchManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/BatchManager.java 2011-02-24 17:57:38 UTC (rev 2937)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/BatchManager.java 2011-02-24 22:00:56 UTC (rev 2938)
@@ -32,6 +32,8 @@
void remove();
+ void setPrefersMemory(boolean prefers);
+
}
ManagedBatch createManagedBatch(TupleBatch batch, boolean softCache) throws TeiidComponentException;
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java 2011-02-24 17:57:38 UTC (rev 2937)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java 2011-02-24 22:00:56 UTC (rev 2938)
@@ -28,6 +28,7 @@
import java.util.Map;
import java.util.TreeMap;
+import org.teiid.common.buffer.BatchManager.ManagedBatch;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.types.Streamable;
@@ -355,6 +356,9 @@
public void setPrefersMemory(boolean prefersMemory) {
this.prefersMemory = prefersMemory;
+ for (ManagedBatch batch : this.batches.values()) {
+ batch.setPrefersMemory(prefersMemory);
+ }
}
public boolean isPrefersMemory() {
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java 2011-02-24 17:57:38 UTC (rev 2937)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java 2011-02-24 22:00:56 UTC (rev 2938)
@@ -210,6 +210,12 @@
this.lobManager = new LobManager();
}
}
+
+ @Override
+ public void setPrefersMemory(boolean prefers) {
+ this.softCache = prefers;
+ //TODO: could recreate the reference
+ }
private void addToCache(boolean update) {
synchronized (activeBatches) {
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2011-02-24 17:57:38 UTC (rev 2937)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2011-02-24 22:00:56 UTC (rev 2938)
@@ -41,6 +41,7 @@
import org.teiid.common.buffer.BlockedException;
import org.teiid.common.buffer.TupleBatch;
import org.teiid.common.buffer.TupleBuffer;
+import org.teiid.common.buffer.BufferManager.TupleSourceType;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidException;
import org.teiid.core.TeiidProcessingException;
@@ -253,35 +254,32 @@
if (!doneProducingBatches) {
this.processor.getContext().setTimeSliceEnd(System.currentTimeMillis() + this.processorTimeslice);
sendResultsIfNeeded(null);
- collector.collectTuples();
+ this.resultsBuffer = collector.collectTuples();
+ if (!doneProducingBatches) {
+ doneProducingBatches();
+ addToCache();
+ }
}
- if (doneProducingBatches) {
- if (this.transactionState == TransactionState.ACTIVE) {
- /*
- * TEIID-14 if we are done producing batches, then proactively close transactional
- * executions even ones that were intentionally kept alive. this may
- * break the read of a lob from a transactional source under a transaction
- * if the source does not support holding the clob open after commit
- */
- for (DataTierTupleSource connectorRequest : this.connectorInfo.values()) {
- if (connectorRequest.isTransactional()) {
- connectorRequest.fullyCloseSource();
- }
- }
- this.transactionState = TransactionState.DONE;
- if (transactionContext.getTransactionType() == TransactionContext.Scope.REQUEST) {
- this.transactionService.commit(transactionContext);
- } else {
- suspend();
- }
+ if (this.transactionState == TransactionState.ACTIVE) {
+ /*
+ * TEIID-14 if we are done producing batches, then proactively close transactional
+ * executions even ones that were intentionally kept alive. this may
+ * break the read of a lob from a transactional source under a transaction
+ * if the source does not support holding the clob open after commit
+ */
+ for (DataTierTupleSource connectorRequest : this.connectorInfo.values()) {
+ if (connectorRequest.isTransactional()) {
+ connectorRequest.fullyCloseSource();
+ }
+ }
+ this.transactionState = TransactionState.DONE;
+ if (transactionContext.getTransactionType() == TransactionContext.Scope.REQUEST) {
+ this.transactionService.commit(transactionContext);
+ } else {
+ suspend();
}
- sendResultsIfNeeded(null);
- } else {
- moreWork(false); // If the timeslice expired, then the processor can probably produce more batches.
- if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
- LogManager.logDetail(LogConstants.CTX_DQP, "############# PW EXITING on " + requestID + " - reenqueueing for more processing ###########"); //$NON-NLS-1$ //$NON-NLS-2$
- }
}
+ sendResultsIfNeeded(null);
}
/**
@@ -381,13 +379,9 @@
this.cid = cacheId;
}
processor = request.processor;
- resultsBuffer = processor.createTupleBuffer();
- if (this.cid != null && originalCommand.getCacheHint() != null) {
- LogManager.logDetail(LogConstants.CTX_DQP, requestID, "Using cache hint", originalCommand.getCacheHint()); //$NON-NLS-1$
- resultsBuffer.setPrefersMemory(originalCommand.getCacheHint().getPrefersMemory());
- }
- collector = new BatchCollector(processor, resultsBuffer) {
+ collector = new BatchCollector(processor, processor.getBufferManager(), this.request.context, isForwardOnly()) {
protected void flushBatchDirect(TupleBatch batch, boolean add) throws TeiidComponentException,TeiidProcessingException {
+ resultsBuffer = getTupleBuffer();
boolean added = false;
if (cid != null) {
super.flushBatchDirect(batch, add);
@@ -396,28 +390,12 @@
if (batch.getTerminationFlag()) {
doneProducingBatches();
}
- if (doneProducingBatches && cid != null) {
- Determinism determinismLevel = processor.getContext().getDeterminismLevel();
- CachedResults cr = new CachedResults();
- cr.setCommand(originalCommand);
- cr.setAnalysisRecord(analysisRecord);
- cr.setResults(resultsBuffer);
-
- if (originalCommand.getCacheHint() != null && originalCommand.getCacheHint().getDeterminism() != null) {
- determinismLevel = originalCommand.getCacheHint().getDeterminism();
- LogManager.logTrace(LogConstants.CTX_DQP, new Object[] { "Cache hint modified the query determinism from ",processor.getContext().getDeterminismLevel(), " to ", determinismLevel }); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- if (determinismLevel.compareTo(Determinism.SESSION_DETERMINISTIC) <= 0) {
- LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("RequestWorkItem.cache_nondeterministic", originalCommand)); //$NON-NLS-1$
- }
- dqpCore.getRsCache().put(cid, determinismLevel, cr, originalCommand.getCacheHint() != null?originalCommand.getCacheHint().getTtl():null);
- }
+ addToCache();
add = sendResultsIfNeeded(batch);
if (!added) {
super.flushBatchDirect(batch, add);
//restrict the buffer size for forward only results
- if (add
+ if (add && !processor.hasFinalBuffer()
&& !batch.getTerminationFlag()
&& this.getTupleBuffer().getManagedRowCount() >= 20 * this.getTupleBuffer().getBatchSize()) {
//requestMore will trigger more processing
@@ -426,8 +404,11 @@
}
}
};
- resultsBuffer = collector.getTupleBuffer();
- resultsBuffer.setForwardOnly(isForwardOnly());
+ this.resultsBuffer = collector.getTupleBuffer();
+ if (this.resultsBuffer == null) {
+ //This is just a dummy result it will get replaced by collector source
+ resultsBuffer = this.processor.getBufferManager().createTupleBuffer(this.originalCommand.getProjectedSymbols(), this.request.context.getConnectionID(), TupleSourceType.FINAL);
+ }
analysisRecord = request.analysisRecord;
analysisRecord.setQueryPlan(processor.getProcessorPlan().getDescriptionProperties());
transactionContext = request.transactionContext;
@@ -442,6 +423,30 @@
this.returnsUpdateCount = request.returnsUpdateCount;
request = null;
}
+
+ private void addToCache() {
+ if (!doneProducingBatches || cid == null) {
+ return;
+ }
+ Determinism determinismLevel = processor.getContext().getDeterminismLevel();
+ CachedResults cr = new CachedResults();
+ cr.setCommand(originalCommand);
+ cr.setAnalysisRecord(analysisRecord);
+ cr.setResults(resultsBuffer);
+ if (originalCommand.getCacheHint() != null) {
+ LogManager.logDetail(LogConstants.CTX_DQP, requestID, "Using cache hint", originalCommand.getCacheHint()); //$NON-NLS-1$
+ resultsBuffer.setPrefersMemory(originalCommand.getCacheHint().getPrefersMemory());
+ if (originalCommand.getCacheHint().getDeterminism() != null) {
+ determinismLevel = originalCommand.getCacheHint().getDeterminism();
+ LogManager.logTrace(LogConstants.CTX_DQP, new Object[] { "Cache hint modified the query determinism from ",processor.getContext().getDeterminismLevel(), " to ", determinismLevel }); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ if (determinismLevel.compareTo(Determinism.SESSION_DETERMINISTIC) <= 0) {
+ LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("RequestWorkItem.cache_nondeterministic", originalCommand)); //$NON-NLS-1$
+ }
+ dqpCore.getRsCache().put(cid, determinismLevel, cr, originalCommand.getCacheHint() != null?originalCommand.getCacheHint().getTtl():null);
+ }
/**
* Send results if they have been requested. This should only be called from the processing thread.
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java 2011-02-24 17:57:38 UTC (rev 2937)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRemoveOptionalJoins.java 2011-02-24 22:00:56 UTC (rev 2938)
@@ -22,7 +22,6 @@
package org.teiid.query.optimizer.relational.rules;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
@@ -40,14 +39,10 @@
import org.teiid.query.optimizer.relational.plantree.NodeConstants;
import org.teiid.query.optimizer.relational.plantree.NodeEditor;
import org.teiid.query.optimizer.relational.plantree.PlanNode;
-import org.teiid.query.resolver.util.ResolverUtil;
import org.teiid.query.sql.LanguageObject;
import org.teiid.query.sql.lang.JoinType;
import org.teiid.query.sql.symbol.AggregateSymbol;
-import org.teiid.query.sql.symbol.Constant;
-import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.util.SymbolMap;
import org.teiid.query.sql.visitor.GroupsUsedByElementsVisitor;
import org.teiid.query.util.CommandContext;
@@ -75,12 +70,12 @@
continue;
}
Set<GroupSymbol> groups = GroupsUsedByElementsVisitor.getGroups((Collection<? extends LanguageObject>)planNode.getProperty(NodeConstants.Info.OUTPUT_COLS));
- List<PlanNode> removed = removeJoin(groups, planNode, planNode.getFirstChild(), metadata);
+ List<PlanNode> removed = removeJoin(groups, planNode, planNode.getFirstChild());
if (removed != null) {
removedNodes.addAll(removed);
continue;
}
- removed = removeJoin(groups, planNode, planNode.getLastChild(), metadata);
+ removed = removeJoin(groups, planNode, planNode.getLastChild());
if (removed != null) {
removedNodes.addAll(removed);
}
@@ -94,7 +89,7 @@
* @throws TeiidComponentException
* @throws QueryMetadataException
*/
- private List<PlanNode> removeJoin(Set<GroupSymbol> groups, PlanNode joinNode, PlanNode optionalNode, QueryMetadataInterface metadata) throws QueryPlannerException, QueryMetadataException, TeiidComponentException {
+ private List<PlanNode> removeJoin(Set<GroupSymbol> groups, PlanNode joinNode, PlanNode optionalNode) throws QueryPlannerException, QueryMetadataException, TeiidComponentException {
if (!Collections.disjoint(optionalNode.getGroups(), groups)) {
return null;
}
@@ -110,16 +105,6 @@
joinNode.removeChild(optionalNode);
NodeEditor.removeChildNode(parentNode, joinNode);
- // correct the parent nodes that may be using optional elements
- /*for (GroupSymbol optionalGroup : optionalNode.getGroups()) {
- List<ElementSymbol> optionalElements = ResolverUtil.resolveElementsInGroup(optionalGroup, metadata);
- List<Constant> replacements = new ArrayList<Constant>(optionalElements.size());
- for (ElementSymbol elementSymbol : optionalElements) {
- replacements.add(new Constant(null, elementSymbol.getType()));
- }
- FrameUtil.convertFrame(parentNode, optionalGroup, null, SymbolMap.createSymbolMap(optionalElements, replacements).asMap(), metadata);
- }*/
-
return NodeEditor.findAllNodes(optionalNode, NodeConstants.Types.JOIN);
}
Modified: trunk/engine/src/main/java/org/teiid/query/processor/BatchCollector.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/BatchCollector.java 2011-02-24 17:57:38 UTC (rev 2937)
+++ trunk/engine/src/main/java/org/teiid/query/processor/BatchCollector.java 2011-02-24 22:00:56 UTC (rev 2938)
@@ -26,11 +26,15 @@
import org.teiid.api.exception.query.ExpressionEvaluationException;
import org.teiid.common.buffer.BlockedException;
+import org.teiid.common.buffer.BufferManager;
import org.teiid.common.buffer.TupleBatch;
import org.teiid.common.buffer.TupleBuffer;
import org.teiid.common.buffer.TupleSource;
+import org.teiid.common.buffer.BufferManager.TupleSourceType;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.util.Assertion;
+import org.teiid.query.util.CommandContext;
public class BatchCollector {
@@ -51,6 +55,17 @@
* @return List of SingleElementSymbol
*/
List getOutputElements();
+
+ /**
+ * return the final tuple buffer or null if not available
+ * @return
+ * @throws TeiidProcessingException
+ * @throws TeiidComponentException
+ * @throws BlockedException
+ */
+ TupleBuffer getFinalBuffer() throws BlockedException, TeiidComponentException, TeiidProcessingException;
+
+ boolean hasFinalBuffer();
}
public static class BatchProducerTupleSource implements TupleSource {
@@ -103,17 +118,33 @@
private boolean done = false;
private TupleBuffer buffer;
+ private boolean forwardOnly;
- public BatchCollector(BatchProducer sourceNode, TupleBuffer buffer) {
+ public BatchCollector(BatchProducer sourceNode, BufferManager bm, CommandContext context, boolean fowardOnly) throws TeiidComponentException {
this.sourceNode = sourceNode;
- this.buffer = buffer;
+ if (!this.sourceNode.hasFinalBuffer()) {
+ this.buffer = bm.createTupleBuffer(sourceNode.getOutputElements(), context.getConnectionID(), TupleSourceType.PROCESSOR);
+ this.buffer.setForwardOnly(fowardOnly);
+ }
}
public TupleBuffer collectTuples() throws TeiidComponentException, TeiidProcessingException {
TupleBatch batch = null;
while(!done) {
- batch = sourceNode.nextBatch();
-
+ if (this.sourceNode.hasFinalBuffer()) {
+ if (this.buffer == null) {
+ TupleBuffer finalBuffer = this.sourceNode.getFinalBuffer();
+ Assertion.isNotNull(finalBuffer);
+ this.buffer = finalBuffer;
+ }
+ if (this.buffer.isFinal()) {
+ this.buffer.setForwardOnly(forwardOnly);
+ done = true;
+ break;
+ }
+ }
+ batch = sourceNode.nextBatch();
+
flushBatch(batch);
// Check for termination condition
@@ -142,10 +173,15 @@
@SuppressWarnings("unused")
protected void flushBatchDirect(TupleBatch batch, boolean add) throws TeiidComponentException, TeiidProcessingException {
- buffer.addTupleBatch(batch, add);
+ if (!this.sourceNode.hasFinalBuffer()) {
+ buffer.addTupleBatch(batch, add);
+ }
}
public int getRowCount() {
+ if (buffer == null) {
+ return 0;
+ }
return buffer.getRowCount();
}
Modified: trunk/engine/src/main/java/org/teiid/query/processor/ProcessorPlan.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/ProcessorPlan.java 2011-02-24 17:57:38 UTC (rev 2937)
+++ trunk/engine/src/main/java/org/teiid/query/processor/ProcessorPlan.java 2011-02-24 22:00:56 UTC (rev 2938)
@@ -31,9 +31,10 @@
import org.teiid.common.buffer.BlockedException;
import org.teiid.common.buffer.BufferManager;
import org.teiid.common.buffer.TupleBatch;
+import org.teiid.common.buffer.TupleBuffer;
import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidException;
import org.teiid.core.TeiidProcessingException;
-import org.teiid.core.TeiidException;
import org.teiid.query.analysis.AnalysisRecord;
import org.teiid.query.processor.BatchCollector.BatchProducer;
import org.teiid.query.util.CommandContext;
@@ -159,5 +160,20 @@
props.addProperty(PROP_OUTPUT_COLS, AnalysisRecord.getOutputColumnProperties(getOutputElements()));
return props;
}
+
+ /**
+ * return the final tuple buffer or null if not available
+ * @return
+ * @throws TeiidProcessingException
+ * @throws TeiidComponentException
+ * @throws BlockedException
+ */
+ public TupleBuffer getFinalBuffer() throws BlockedException, TeiidComponentException, TeiidProcessingException {
+ return null;
+ }
+ public boolean hasFinalBuffer() {
+ return false;
+ }
+
}
Modified: trunk/engine/src/main/java/org/teiid/query/processor/QueryProcessor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/QueryProcessor.java 2011-02-24 17:57:38 UTC (rev 2937)
+++ trunk/engine/src/main/java/org/teiid/query/processor/QueryProcessor.java 2011-02-24 22:00:56 UTC (rev 2938)
@@ -29,7 +29,6 @@
import org.teiid.common.buffer.TupleBatch;
import org.teiid.common.buffer.TupleBuffer;
import org.teiid.common.buffer.BufferManager.BufferReserveMode;
-import org.teiid.common.buffer.BufferManager.TupleSourceType;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidException;
import org.teiid.core.TeiidProcessingException;
@@ -123,18 +122,7 @@
TupleBatch result = null;
try {
- // initialize if necessary
- if(!initialized) {
- reserved = this.bufferMgr.reserveBuffers(this.bufferMgr.getSchemaSize(this.getOutputElements()), BufferReserveMode.FORCE);
- this.processPlan.initialize(context, this.dataMgr, bufferMgr);
- initialized = true;
- }
- if (!open) {
- // Open the top node for reading
- processPlan.open();
- open = true;
- }
-
+ init();
long currentTime = System.currentTimeMillis();
Assertion.assertTrue(!processorClosed);
@@ -180,6 +168,21 @@
return result;
}
+ private void init() throws TeiidComponentException, TeiidProcessingException {
+ // initialize if necessary
+ if(!initialized) {
+ reserved = this.bufferMgr.reserveBuffers(this.bufferMgr.getSchemaSize(this.getOutputElements()), BufferReserveMode.FORCE);
+ this.processPlan.initialize(context, this.dataMgr, bufferMgr);
+ initialized = true;
+ }
+
+ if (!open) {
+ // Open the top node for reading
+ processPlan.open();
+ open = true;
+ }
+ }
+
/**
* Close processing and clean everything up. Should only be called by the same thread that called process.
@@ -217,15 +220,46 @@
this.requestCanceled = true;
}
- public TupleBuffer createTupleBuffer() throws TeiidComponentException {
- return this.bufferMgr.createTupleBuffer(this.processPlan.getOutputElements(), context.getConnectionID(), TupleSourceType.PROCESSOR);
- }
-
public BatchCollector createBatchCollector() throws TeiidComponentException {
- return new BatchCollector(this, createTupleBuffer());
+ return new BatchCollector(this, this.bufferMgr, this.context, false);
}
public void setNonBlocking(boolean nonBlocking) {
this.context.setNonBlocking(nonBlocking);
}
+
+ @Override
+ public TupleBuffer getFinalBuffer() throws BlockedException, TeiidComponentException, TeiidProcessingException {
+ while (true) {
+ long wait = DEFAULT_WAIT;
+ try {
+ init();
+ return this.processPlan.getFinalBuffer();
+ } catch (BlockedException e) {
+ if (!this.context.isNonBlocking()) {
+ throw e;
+ }
+ } catch (TeiidComponentException e) {
+ closeProcessing();
+ throw e;
+ } catch (TeiidProcessingException e) {
+ closeProcessing();
+ throw e;
+ }
+ try {
+ Thread.sleep(wait);
+ } catch (InterruptedException err) {
+ throw new TeiidComponentException(err);
+ }
+ }
+ }
+
+ @Override
+ public boolean hasFinalBuffer() {
+ return this.processPlan.hasFinalBuffer();
+ }
+
+ public BufferManager getBufferManager() {
+ return bufferMgr;
+ }
}
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java 2011-02-24 17:57:38 UTC (rev 2937)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalNode.java 2011-02-24 22:00:56 UTC (rev 2938)
@@ -34,6 +34,7 @@
import org.teiid.common.buffer.BlockedException;
import org.teiid.common.buffer.BufferManager;
import org.teiid.common.buffer.TupleBatch;
+import org.teiid.common.buffer.TupleBuffer;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.util.Assertion;
@@ -597,4 +598,19 @@
return processingState;
}
+ public boolean hasFinalBuffer() {
+ return false;
+ }
+
+ /**
+ * return the final tuple buffer or null if not available
+ * @return
+ * @throws TeiidProcessingException
+ * @throws TeiidComponentException
+ * @throws BlockedException
+ */
+ public TupleBuffer getFinalBuffer() throws BlockedException, TeiidComponentException, TeiidProcessingException {
+ return null;
+ }
+
}
\ No newline at end of file
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalPlan.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalPlan.java 2011-02-24 17:57:38 UTC (rev 2937)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalPlan.java 2011-02-24 22:00:56 UTC (rev 2938)
@@ -29,6 +29,7 @@
import org.teiid.common.buffer.BlockedException;
import org.teiid.common.buffer.BufferManager;
import org.teiid.common.buffer.TupleBatch;
+import org.teiid.common.buffer.TupleBuffer;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
import org.teiid.language.SQLConstants;
@@ -285,5 +286,16 @@
}
return false;
}
+
+
+ @Override
+ public TupleBuffer getFinalBuffer() throws BlockedException, TeiidComponentException, TeiidProcessingException {
+ return root.getFinalBuffer();
+ }
+
+ @Override
+ public boolean hasFinalBuffer() {
+ return root.hasFinalBuffer();
+ }
}
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/SortNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/SortNode.java 2011-02-24 17:57:38 UTC (rev 2937)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/SortNode.java 2011-02-24 22:00:56 UTC (rev 2938)
@@ -47,6 +47,7 @@
private int phase = SORT;
private TupleBuffer output;
private TupleSource outputTs;
+ private boolean usingOutput;
private static final int SORT = 2;
private static final int OUTPUT = 3;
@@ -61,6 +62,7 @@
phase = SORT;
output = null;
outputTs = null;
+ usingOutput = false;
}
public void setSortElements(List<OrderByItem> items) {
@@ -103,7 +105,7 @@
private TupleBatch outputPhase() throws BlockedException, TeiidComponentException, TeiidProcessingException {
if (!this.output.isFinal()) {
this.phase = SORT;
- } else {
+ } else if (!usingOutput) {
this.output.setForwardOnly(true);
}
List<?> tuple = null;
@@ -127,10 +129,10 @@
public void closeDirect() {
if(this.output != null) {
- this.output.remove();
- this.output = null;
- this.outputTs = null;
+ this.output.remove();
+ this.output = null;
}
+ this.outputTs = null;
}
protected void getNodeString(StringBuffer str) {
@@ -166,4 +168,23 @@
return props;
}
+ @Override
+ public TupleBuffer getFinalBuffer() throws BlockedException, TeiidComponentException, TeiidProcessingException {
+ if (this.output == null) {
+ sortPhase();
+ }
+ usingOutput = true;
+ TupleBuffer result = this.output;
+ if (this.output.isFinal()) {
+ this.output = null;
+ close();
+ }
+ return result;
+ }
+
+ @Override
+ public boolean hasFinalBuffer() {
+ return this.getElements().size() == this.getChildren()[0].getElements().size();
+ }
+
}
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/SourceState.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/SourceState.java 2011-02-24 17:57:38 UTC (rev 2937)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/SourceState.java 2011-02-24 22:00:56 UTC (rev 2938)
@@ -31,7 +31,6 @@
import org.teiid.common.buffer.BufferManager.TupleSourceType;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
-import org.teiid.core.util.Assertion;
import org.teiid.query.processor.BatchCollector;
import org.teiid.query.processor.BatchIterator;
import org.teiid.query.processor.relational.MergeJoinStrategy.SortOption;
@@ -163,7 +162,7 @@
throw new AssertionError("cannot buffer the source"); //$NON-NLS-1$
}
if (collector == null) {
- collector = new BatchCollector(source, createSourceTupleBuffer());
+ collector = new BatchCollector(source, source.getBufferManager(), source.getContext(), false);
}
this.buffer = collector.collectTuples();
}
Modified: trunk/engine/src/test/java/org/teiid/common/buffer/TestTupleBuffer.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/common/buffer/TestTupleBuffer.java 2011-02-24 17:57:38 UTC (rev 2937)
+++ trunk/engine/src/test/java/org/teiid/common/buffer/TestTupleBuffer.java 2011-02-24 22:00:56 UTC (rev 2938)
@@ -39,7 +39,7 @@
public class TestTupleBuffer {
- private final class FakeBatchManager implements BatchManager {
+ public static final class FakeBatchManager implements BatchManager {
@Override
public void remove() {
@@ -60,6 +60,11 @@
throws TeiidComponentException {
return batch;
}
+
+ @Override
+ public void setPrefersMemory(boolean prefers) {
+
+ }
};
}
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java 2011-02-24 17:57:38 UTC (rev 2937)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java 2011-02-24 22:00:56 UTC (rev 2938)
@@ -21,8 +21,7 @@
*/
package org.teiid.dqp.internal.process;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -32,15 +31,11 @@
import java.util.List;
import org.junit.Test;
-import org.mockito.Mockito;
import org.teiid.cache.Cache;
import org.teiid.cache.DefaultCache;
-import org.teiid.common.buffer.BatchManager;
import org.teiid.common.buffer.BufferManager;
-import org.teiid.common.buffer.FileStore;
-import org.teiid.common.buffer.TupleBatch;
import org.teiid.common.buffer.TupleBuffer;
-import org.teiid.core.TeiidComponentException;
+import org.teiid.common.buffer.TestTupleBuffer.FakeBatchManager;
import org.teiid.core.types.DataTypeManager;
import org.teiid.dqp.service.FakeBufferService;
import org.teiid.query.sql.lang.Query;
@@ -49,35 +44,6 @@
public class TestCachedResults {
- private final class FakeBatchManager implements BatchManager {
- @Override
- public void remove() {
-
- }
-
- @Override
- public ManagedBatch createManagedBatch(final TupleBatch batch, boolean softCache)
- throws TeiidComponentException {
- return new ManagedBatch() {
-
- @Override
- public void remove() {
-
- }
-
- @Override
- public TupleBatch getBatch(boolean cache, String[] types)
- throws TeiidComponentException {
- return batch;
- }
- };
- }
-
- @Override
- public FileStore createStorage(String prefix) {
- return Mockito.mock(FileStore.class);
- }
- }
@Test
public void testCaching() throws Exception {
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2011-02-24 17:57:38 UTC (rev 2937)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2011-02-24 22:00:56 UTC (rev 2938)
@@ -222,6 +222,25 @@
}
}
+ @Test public void testBufferReuse() throws Exception {
+ //the sql should return 100 rows
+ String sql = "SELECT A.IntKey FROM BQT1.SmallA as A, BQT1.SmallA as B ORDER BY A.IntKey"; //$NON-NLS-1$
+ String userName = "1"; //$NON-NLS-1$
+ String sessionid = "1"; //$NON-NLS-1$
+
+ RequestMessage reqMsg = exampleRequestMessage(sql);
+ reqMsg.setCursorType(ResultSet.TYPE_FORWARD_ONLY);
+ DQPWorkContext.getWorkContext().getSession().setSessionId(sessionid);
+ DQPWorkContext.getWorkContext().getSession().setUserName(userName);
+ ((BufferManagerImpl)core.getBufferManager()).setProcessorBatchSize(2);
+ Future<ResultsMessage> message = core.executeRequest(reqMsg.getExecutionId(), reqMsg);
+ ResultsMessage rm = message.get(5000, TimeUnit.MILLISECONDS);
+ assertNull(rm.getException());
+ assertEquals(2, rm.getResults().length);
+ RequestWorkItem item = core.getRequestWorkItem(DQPWorkContext.getWorkContext().getRequestID(reqMsg.getExecutionId()));
+ assertEquals(100, item.resultsBuffer.getRowCount());
+ }
+
public void helpTestVisibilityFails(String sql) throws Exception {
RequestMessage reqMsg = exampleRequestMessage(sql);
reqMsg.setTxnAutoWrapMode(RequestMessage.TXN_WRAP_OFF);
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2011-02-24 17:57:38 UTC (rev 2937)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2011-02-24 22:00:56 UTC (rev 2938)
@@ -233,6 +233,7 @@
if (context.getGlobalTableStore() == null) {
context.setGlobalTableStore(new TempTableStore("SYSTEM"));
}
+ context.setBufferManager(bufferMgr);
if (!(dataManager instanceof TempTableDataManager)) {
SessionAwareCache<CachedResults> cache = new SessionAwareCache<CachedResults>();
cache.setBufferManager(bufferMgr);
14 years
teiid SVN: r2937 - in trunk: client/src/main/java/org/teiid/net and 5 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-02-24 12:57:38 -0500 (Thu, 24 Feb 2011)
New Revision: 2937
Modified:
trunk/client/src/main/java/org/teiid/jdbc/EmbeddedProfile.java
trunk/client/src/main/java/org/teiid/jdbc/JDBCURL.java
trunk/client/src/main/java/org/teiid/jdbc/SocketProfile.java
trunk/client/src/main/java/org/teiid/jdbc/TeiidDataSource.java
trunk/client/src/main/java/org/teiid/jdbc/TeiidDriver.java
trunk/client/src/main/java/org/teiid/net/TeiidURL.java
trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnectionFactory.java
trunk/client/src/main/resources/org/teiid/jdbc/i18n.properties
trunk/client/src/test/java/org/teiid/jdbc/TestEmbeddedProfile.java
trunk/client/src/test/java/org/teiid/jdbc/TestJDBCURL.java
trunk/client/src/test/java/org/teiid/jdbc/TestSocketProfile.java
trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDataSource.java
trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java
trunk/client/src/test/java/org/teiid/net/TestTeiidURL.java
trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
Log:
TEIID-1481 clean up of url handling logic
Modified: trunk/client/src/main/java/org/teiid/jdbc/EmbeddedProfile.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/EmbeddedProfile.java 2011-02-24 04:55:53 UTC (rev 2936)
+++ trunk/client/src/main/java/org/teiid/jdbc/EmbeddedProfile.java 2011-02-24 17:57:38 UTC (rev 2937)
@@ -25,15 +25,11 @@
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Arrays;
-import java.util.Enumeration;
import java.util.Properties;
import java.util.logging.Logger;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import org.teiid.core.TeiidException;
import org.teiid.core.TeiidRuntimeException;
-import org.teiid.core.util.PropertiesUtils;
import org.teiid.core.util.ReflectionHelper;
import org.teiid.net.CommunicationException;
import org.teiid.net.ConnectionException;
@@ -42,17 +38,8 @@
final class EmbeddedProfile {
- /**
- * Match URL like
- * - jdbc:teiid:BQT
- * - jdbc:teiid:BQT;verson=1
- */
- static final String BASE_PATTERN = "jdbc:teiid:([\\w-\\.]+)(;.*)?"; //$NON-NLS-1$
-
private static Logger logger = Logger.getLogger("org.teiid.jdbc"); //$NON-NLS-1$
- static Pattern basePattern = Pattern.compile(BASE_PATTERN);
-
/**
* This method tries to make a connection to the given URL. This class
* will return a null if this is not the right driver to connect to the given URL.
@@ -62,15 +49,6 @@
*/
public static Connection connect(String url, Properties info)
throws SQLException {
- // create a properties obj if it is null
- if (info == null) {
- info = new Properties();
- } else {
- info = PropertiesUtils.clone(info);
- }
-
- // parse the URL to add it's properties to properties object
- parseURL(url, info);
ConnectionImpl conn = createConnection(url, info);
logger.fine(JDBCPlugin.Util.getString("JDBCDriver.Connection_sucess")); //$NON-NLS-1$
return conn;
@@ -95,52 +73,6 @@
}
}
- /**
- * This method parses the URL and adds properties to the the properties object. These include required and any optional
- * properties specified in the URL.
- * Expected URL format --
- * jdbc:teiid:VDB;[name=value]*;
- *
- * @param The URL needed to be parsed.
- * @param The properties object which is to be updated with properties in the URL.
- * @throws SQLException if the URL is not in the expected format.
- */
- static void parseURL(String url, Properties info) throws SQLException {
- if (url == null || url.trim().length() == 0) {
- String logMsg = JDBCPlugin.Util.getString("EmbeddedDriver.URL_must_be_specified"); //$NON-NLS-1$
- throw new SQLException(logMsg);
- }
-
- try {
- JDBCURL jdbcURL = new JDBCURL(url);
-
- // Set the VDB Name
- info.setProperty(BaseDataSource.VDB_NAME, jdbcURL.getVDBName());
-
- Properties optionalParams = jdbcURL.getProperties();
- JDBCURL.normalizeProperties(info);
-
- Enumeration keys = optionalParams.keys();
- while (keys.hasMoreElements()) {
- String propName = (String)keys.nextElement();
- // Don't let the URL properties override the passed-in Properties object.
- if (!info.containsKey(propName)) {
- info.setProperty(propName, optionalParams.getProperty(propName));
- }
- }
- // add the property only if it is new because they could have
- // already been specified either through url or otherwise.
- if(! info.containsKey(BaseDataSource.VDB_VERSION) && jdbcURL.getVDBVersion() != null) {
- info.setProperty(BaseDataSource.VDB_VERSION, jdbcURL.getVDBVersion());
- }
- if(!info.containsKey(BaseDataSource.APP_NAME)) {
- info.setProperty(BaseDataSource.APP_NAME, BaseDataSource.DEFAULT_APP_NAME);
- }
- } catch (Exception e) {
- throw new SQLException(e);
- }
- }
-
/**
* validate some required properties
* @param info the connection properties to be validated
@@ -158,11 +90,4 @@
}
- public static boolean acceptsURL(String url) {
- // Check if this can match our default one, then allow it.
- Matcher m = basePattern.matcher(url);
- boolean matched = m.matches();
- return matched;
- }
-
}
Modified: trunk/client/src/main/java/org/teiid/jdbc/JDBCURL.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/JDBCURL.java 2011-02-24 04:55:53 UTC (rev 2936)
+++ trunk/client/src/main/java/org/teiid/jdbc/JDBCURL.java 2011-02-24 17:57:38 UTC (rev 2937)
@@ -32,21 +32,20 @@
import java.util.Map;
import java.util.Properties;
import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.teiid.net.TeiidURL;
-
-
-
-
-
/**
* @since 4.3
*/
public class JDBCURL {
private static final String UTF_8 = "UTF-8"; //$NON-NLS-1$
public static final String JDBC_PROTOCOL = "jdbc:teiid:"; //$NON-NLS-1$
- private static final String OLD_JDBC_PROTOCOL = "jdbc:metamatrix:"; //$NON-NLS-1$
+
+ static final String URL_PATTERN = JDBC_PROTOCOL + "([\\w-\\.]+)(?:@([^;]*))?(;.*)?"; //$NON-NLS-1$
+ static Pattern urlPattern = Pattern.compile(URL_PATTERN);
public static final Set<String> EXECUTION_PROPERTIES = Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(
ExecutionProperties.PROP_TXN_AUTO_WRAP,
@@ -79,7 +78,20 @@
private String vdbName;
private String connectionURL;
- private Properties properties = new Properties();
+ private Properties properties = new Properties();
+
+ public enum ConnectionType {
+ Embedded,
+ Socket
+ }
+
+ public static ConnectionType acceptsUrl(String url) {
+ Matcher m = urlPattern.matcher(url);
+ if (m.matches()) {
+ return m.group(2) != null?ConnectionType.Socket:ConnectionType.Embedded;
+ }
+ return null;
+ }
private String urlString;
@@ -121,63 +133,23 @@
jdbcURL = jdbcURL.trim();
if (jdbcURL.length() == 0) {
throw new IllegalArgumentException();
- }
- int delimiter = jdbcURL.indexOf('@');
- if (delimiter == -1) {
- // this is for default connection protocol in embedded driver.
- // then go by first semi colon
- int fsc = jdbcURL.indexOf(';');
- if (fsc == -1) {
- parseJDBCProtocol(jdbcURL);
- }
- else {
- parseJDBCProtocol(jdbcURL.substring(0, fsc));
- parseConnectionProperties(jdbcURL.substring(fsc+1), this.properties);
- }
- }
- else {
- String[] urlParts = jdbcURL.split("@", 2); //$NON-NLS-1$
- if (urlParts.length != 2) {
- throw new IllegalArgumentException();
- }
- parseJDBCProtocol(urlParts[0]);
- parseConnectionPart(urlParts[1]);
- }
- }
-
- private void parseJDBCProtocol(String protocol) {
- if (protocol.startsWith(JDBC_PROTOCOL)) {
- if (protocol.length() == JDBC_PROTOCOL.length()) {
- throw new IllegalArgumentException();
- }
- vdbName = protocol.substring(JDBC_PROTOCOL.length());
}
- else if (protocol.startsWith(OLD_JDBC_PROTOCOL)) {
- if (protocol.length() == OLD_JDBC_PROTOCOL.length()) {
- throw new IllegalArgumentException();
- }
- vdbName = protocol.substring(OLD_JDBC_PROTOCOL.length());
- }
- else {
+
+ Matcher m = urlPattern.matcher(jdbcURL);
+ if (!m.matches()) {
throw new IllegalArgumentException();
}
-
- }
-
- private void parseConnectionPart(String connectionInfo) {
- String[] connectionParts = connectionInfo.split(";"); //$NON-NLS-1$
- if (connectionParts.length == 0 || connectionParts[0].trim().length() == 0) {
- throw new IllegalArgumentException();
- }
- connectionURL = connectionParts[0].trim();
- if (connectionParts.length > 1) {
- // The rest should be connection params
- for (int i = 1; i < connectionParts.length; i++) {
- parseConnectionProperty(connectionParts[i], this.properties);
- }
- }
- }
-
+ vdbName = m.group(1);
+ connectionURL = m.group(2);
+ if (connectionURL != null) {
+ connectionURL = connectionURL.trim();
+ }
+ String props = m.group(3);
+ if (props != null) {
+ parseConnectionProperties(props, this.properties);
+ }
+ }
+
public static void parseConnectionProperties(String connectionInfo, Properties p) {
String[] connectionParts = connectionInfo.split(";"); //$NON-NLS-1$
if (connectionParts.length != 0) {
Modified: trunk/client/src/main/java/org/teiid/jdbc/SocketProfile.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/SocketProfile.java 2011-02-24 04:55:53 UTC (rev 2936)
+++ trunk/client/src/main/java/org/teiid/jdbc/SocketProfile.java 2011-02-24 17:57:38 UTC (rev 2937)
@@ -24,18 +24,13 @@
import java.sql.Connection;
import java.sql.SQLException;
-import java.util.Enumeration;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import org.teiid.core.TeiidException;
-import org.teiid.core.util.PropertiesUtils;
import org.teiid.net.CommunicationException;
import org.teiid.net.ConnectionException;
-import org.teiid.net.TeiidURL;
import org.teiid.net.ServerConnection;
import org.teiid.net.socket.SocketServerConnectionFactory;
@@ -53,38 +48,17 @@
private static Logger logger = Logger.getLogger("org.teiid.jdbc"); //$NON-NLS-1$
/**
- * Suports JDBC URLS of format
- * - jdbc:teiid:BQT@mm://localhost:####;version=1
- * - jdbc:teiid:BQT@mms://localhost:####;version=1
- * - jdbc:teiid:BQT@mm(s)://host1:####,host2:####,host3:####;version=1
- */
-
- // This host/port pattern allows just a . or a - to be in the host part.
- static final String HOST_PORT_PATTERN = "\\[?[\\p{Alnum}\\.\\-\\_:]+\\]?:\\d+"; //$NON-NLS-1$
- static final String URL_PATTERN = "jdbc:teiid:([\\w-\\.]+)@mm[s]?://"+HOST_PORT_PATTERN+"(,"+HOST_PORT_PATTERN+")*(;.*)?"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- static Pattern urlPattern = Pattern.compile(URL_PATTERN);
-
- /**
* This method tries to make a connection to the given URL. This class
* will return a null if this is not the right driver to connect to the given URL.
* @param The URL used to establish a connection.
* @return Connection object created
* @throws SQLException if it is unable to establish a connection to the server.
*/
- public static Connection connect(String url, Properties info) throws SQLException {
+ static Connection connect(String url, Properties info) throws SQLException {
ConnectionImpl myConnection = null;
- // create a properties obj if it is null
- if(info == null) {
- info = new Properties();
- } else {
- info = PropertiesUtils.clone(info);
- }
try {
- // parse the URL to add it's properties to properties object
- parseURL(url, info);
-
myConnection = createConnection(url, info);
} catch (TeiidException e) {
logger.log(Level.SEVERE, "Could not create connection", e); //$NON-NLS-1$
@@ -108,51 +82,4 @@
return connection;
}
- /**
- * This method parses the URL and adds properties to the the properties object.
- * These include required and any optional properties specified in the URL.
- * @param The URL needed to be parsed.
- * @param The properties object which is to be updated with properties in the URL.
- * @throws SQLException if the URL is not in the expected format.
- */
- protected static void parseURL(String url, Properties info) throws SQLException {
- if(url == null) {
- String msg = JDBCPlugin.Util.getString("MMDriver.urlFormat"); //$NON-NLS-1$
- throw new TeiidSQLException(msg);
- }
- try {
- JDBCURL jdbcURL = new JDBCURL(url);
- info.setProperty(BaseDataSource.VDB_NAME, jdbcURL.getVDBName());
- info.setProperty(TeiidURL.CONNECTION.SERVER_URL, jdbcURL.getConnectionURL());
- Properties optionalParams = jdbcURL.getProperties();
- JDBCURL.normalizeProperties(info);
- Enumeration keys = optionalParams.keys();
- while (keys.hasMoreElements()) {
- String propName = (String)keys.nextElement();
- // Don't let the URL properties override the passed-in Properties object.
- if (!info.containsKey(propName)) {
- info.setProperty(propName, optionalParams.getProperty(propName));
- }
- }
- // add the property only if it is new because they could have
- // already been specified either through url or otherwise.
- if(!info.containsKey(BaseDataSource.VDB_VERSION) && jdbcURL.getVDBVersion() != null) {
- info.setProperty(BaseDataSource.VDB_VERSION, jdbcURL.getVDBVersion());
- }
- if(!info.containsKey(BaseDataSource.APP_NAME)) {
- info.setProperty(BaseDataSource.APP_NAME, BaseDataSource.DEFAULT_APP_NAME);
- }
-
- } catch(IllegalArgumentException iae) {
- throw new TeiidSQLException(JDBCPlugin.Util.getString("MMDriver.urlFormat")); //$NON-NLS-1$
- }
- }
-
-
- public static boolean acceptsURL(String url) {
- Matcher m = urlPattern.matcher(url);
- return m.matches();
- }
}
-
-
Modified: trunk/client/src/main/java/org/teiid/jdbc/TeiidDataSource.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/TeiidDataSource.java 2011-02-24 04:55:53 UTC (rev 2936)
+++ trunk/client/src/main/java/org/teiid/jdbc/TeiidDataSource.java 2011-02-24 17:57:38 UTC (rev 2937)
@@ -22,6 +22,7 @@
package org.teiid.jdbc;
+import java.net.MalformedURLException;
import java.sql.Connection;
import java.util.Properties;
@@ -59,7 +60,7 @@
/**
* The port number where a server is listening for requests.
* This property name is one of the standard property names defined by the JDBC 2.0 specification,
- * and is <i>optional</i>.
+ * and is <i>required</i>.
*/
private int portNumber;
@@ -119,68 +120,66 @@
return props;
}
- private Properties buildServerProperties(final String userName, final String password) {
- Properties props = buildProperties(userName, password);
-
- props.setProperty(TeiidURL.CONNECTION.SERVER_URL,this.buildServerURL());
-
- return props;
- }
-
- protected String buildServerURL() {
- if ( this.alternateServers == null ) {
+ protected String buildServerURL() throws TeiidSQLException {
+ if ( this.alternateServers == null || this.alternateServers.length() == 0) {
// Format: "mm://server:port"
return new TeiidURL(this.serverName, this.portNumber, this.secure).getAppServerURL();
}
// Format: "mm://server1:port,server2:port,..."
- String serverURL = ""; //$NON-NLS-1$
-
- serverURL = "" + ( this.secure ? TeiidURL.SECURE_PROTOCOL : TeiidURL.DEFAULT_PROTOCOL ); //$NON-NLS-1$
+ String serverURL = this.secure ? TeiidURL.SECURE_PROTOCOL : TeiidURL.DEFAULT_PROTOCOL;
- if (this.serverName.indexOf(':') != -1) {
- serverURL += "["; //$NON-NLS-1$
+ if (this.serverName.indexOf(':') != -1 && !this.serverName.startsWith("[")) { //$NON-NLS-1$
+ serverURL += "[" + this.serverName + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ serverURL += this.serverName;
}
-
- serverURL += "" + this.serverName; //$NON-NLS-1$
- if (this.serverName.indexOf(':') != -1) {
- serverURL += "]"; //$NON-NLS-1$
- }
+ serverURL += TeiidURL.COLON_DELIMITER + this.portNumber;
+
+ //add in the port number if not specified
+
+ String[] as = this.alternateServers.split( TeiidURL.COMMA_DELIMITER);
+
+ for ( int i = 0; i < as.length; i++ ) {
+ String server = as[i].trim();
+ //ipv6 without port
+ if (server.startsWith("[") && server.endsWith("]")) { //$NON-NLS-1$ //$NON-NLS-2$
+ String msg = reasonWhyInvalidServerName(server.substring(1, server.length() - 1));
+ if (msg != null) {
+ throw createConnectionError(JDBCPlugin.Util.getString("MMDataSource.alternateServer_is_invalid", msg)); //$NON-NLS-1$
+ }
+ serverURL += (TeiidURL.COMMA_DELIMITER +as[i] + TeiidURL.COLON_DELIMITER + this.portNumber);
+ } else {
+ String[] serverParts = server.split(TeiidURL.COLON_DELIMITER, 2);
+ String msg = reasonWhyInvalidServerName(serverParts[0]);
+ if (msg != null) {
+ throw createConnectionError(JDBCPlugin.Util.getString("MMDataSource.alternateServer_is_invalid", msg)); //$NON-NLS-1$
+ }
+ serverURL += (TeiidURL.COMMA_DELIMITER + serverParts[0] + TeiidURL.COLON_DELIMITER);
+ if ( serverParts.length > 1 ) {
+ try {
+ TeiidURL.validatePort(serverParts[1]);
+ } catch (MalformedURLException e) {
+ throw createConnectionError(JDBCPlugin.Util.getString("MMDataSource.alternateServer_is_invalid", e.getMessage())); //$NON-NLS-1$
+ }
+
+ serverURL += serverParts[1];
+ } else {
+ serverURL += this.portNumber;
+ }
+ }
+ }
- if ( this.portNumber != 0 )
- serverURL += TeiidURL.COLON_DELIMITER + this.portNumber;
-
- if ( this.alternateServers.length() > 0 ) {
- String[] as = this.alternateServers.split( TeiidURL.COMMA_DELIMITER);
-
- for ( int i = 0; i < as.length; i++ ) {
- if (as[i].startsWith("[") && as[i].endsWith("]:")) { //$NON-NLS-1$ //$NON-NLS-2$
- serverURL += (TeiidURL.COMMA_DELIMITER + as[i]);
- }
- else if (as[i].startsWith("[") && as[i].endsWith("]")) { //$NON-NLS-1$ //$NON-NLS-2$
- serverURL += (TeiidURL.COMMA_DELIMITER +as[i] + TeiidURL.COLON_DELIMITER + this.portNumber);
- }
- else {
- String[] server = as[i].split(TeiidURL.COLON_DELIMITER );
-
- if ( server.length > 0 ) {
- serverURL += TeiidURL.COMMA_DELIMITER + server[0];
- if ( server.length > 1 ) {
- serverURL += TeiidURL.COLON_DELIMITER + server[1];
- } else {
- serverURL += TeiidURL.COLON_DELIMITER + this.portNumber;
- }
- }
- }
- }
- }
-
- return new TeiidURL(serverURL).getAppServerURL();
+ try {
+ return new TeiidURL(serverURL).getAppServerURL();
+ } catch (MalformedURLException e) {
+ throw TeiidSQLException.create(e);
+ }
}
- protected String buildURL() {
- return new JDBCURL(this.getDatabaseName(), buildServerURL(), buildProperties(getUser(), getPassword())).getJDBCURL();
+ protected JDBCURL buildURL() throws TeiidSQLException {
+ return new JDBCURL(this.getDatabaseName(), buildServerURL(), buildProperties(getUser(), getPassword()));
}
protected void validateProperties( final String userName, final String password) throws java.sql.SQLException {
@@ -195,11 +194,6 @@
if ( reason != null ) {
throw createConnectionError(reason);
}
-
- reason = reasonWhyInvalidAlternateServers(this.alternateServers);
- if ( reason != null) {
- throw createConnectionError(reason);
- }
}
private TeiidSQLException createConnectionError(String reason) {
@@ -242,9 +236,8 @@
// if not proceed with socket connection.
validateProperties(userName,password);
- final Properties props = buildServerProperties(userName, password);
- return driver.connect(buildURL(), props);
-
+
+ return driver.connect(buildURL().getJDBCURL(), null);
}
private Properties buildEmbeddedProperties(final String userName, final String password) {
@@ -257,7 +250,11 @@
* @see java.lang.Object#toString()
*/
public String toString() {
- return buildURL();
+ try {
+ return buildURL().getJDBCURL();
+ } catch (TeiidSQLException e) {
+ return e.getMessage();
+ }
}
// --------------------------------------------------------------------------------------------
@@ -370,14 +367,8 @@
* @return the reason why the property is invalid, or null if it is considered valid
* @see #setPortNumber(int)
*/
- public static String reasonWhyInvalidPortNumber( final int portNumber) {
- if ( portNumber == 0 ) {
- return null; // default is always fine
- }
- if ( portNumber < 1 ) {
- return JDBCPlugin.Util.getString("MMDataSource.Port_number_must_be_positive"); //$NON-NLS-1$
- }
- return null;
+ public static String reasonWhyInvalidPortNumber( final int portNumber) {
+ return TeiidURL.validatePort(portNumber);
}
/**
@@ -390,7 +381,7 @@
public static String reasonWhyInvalidServerName( final String serverName ) {
if ( serverName == null || serverName.trim().length() == 0 ) {
return JDBCPlugin.Util.getString("MMDataSource.Server_name_required"); //$NON-NLS-1$
- }
+ }
return null;
}
@@ -430,61 +421,6 @@
return null;
}
- /**
- * The reason why "alternateServers" is invalid.
- * @param value of "alternateServers" property
- * @return reason
- */
- public static String reasonWhyInvalidAlternateServers(final String alternateServers) {
- if ( alternateServers == null || alternateServers.trim().length() < 1 )
- return null;
-
- String[] as = alternateServers.split( TeiidURL.COMMA_DELIMITER);
- String sReason = null;
- String reason = ""; //$NON-NLS-1$
- int reasonCount = 0;
- final String newline = System.getProperty("line.separator"); //$NON-NLS-1$
-
- for ( int i = 0; i < as.length; i++ ) {
- String[] server = as[i].split( TeiidURL.COLON_DELIMITER );
-
- if ( server.length < 1 || server.length > 2 ) {
- // ie "server:31000:an invalid value"
- // ie "server,server:31000"
- return JDBCPlugin.Util.getString("MMDataSource.Alternate_Servers_format"); //$NON-NLS-1$
- }
-
- // check the server name portion
- sReason = reasonWhyInvalidServerName(server[0] );
- if ( sReason != null ) {
- reason += (reason.length() > 0 ? newline : "" ) + sReason; //$NON-NLS-1$
- reasonCount++;
- sReason = null;
- }
-
- if ( server.length > 1 ) {
- // check the port portion
- int port = 0;
- // parse the int from the string
- try { port = Integer.parseInt(server[1]); }
- catch ( NumberFormatException e ) {
- // ie "server:invalid_port"
- reason += (reason.length() > 0 ? newline : "" ) //$NON-NLS-1$
- + JDBCPlugin.Util.getString("MMDataSource.serverPort_must_be_a_number"); //$NON-NLS-1$
- reasonCount++;
- }
- sReason = reasonWhyInvalidPortNumber(port);
- if ( sReason != null ) {
- reason += (reason.length() > 0 ? newline : "" ) + sReason; //$NON-NLS-1$
- reasonCount++;
- sReason = null;
- }
- }
- }
- if ( reasonCount < 1 ) return null;
- return JDBCPlugin.Util.getString("MMDataSource.alternateServer_is_invalid", String.valueOf(reasonCount), reason); //$NON-NLS-1$
- }
-
/**
* @return Returns the transparentFailover.
*/
Modified: trunk/client/src/main/java/org/teiid/jdbc/TeiidDriver.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/TeiidDriver.java 2011-02-24 04:55:53 UTC (rev 2936)
+++ trunk/client/src/main/java/org/teiid/jdbc/TeiidDriver.java 2011-02-24 17:57:38 UTC (rev 2937)
@@ -27,6 +27,7 @@
import java.sql.DriverManager;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
+import java.util.Enumeration;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
@@ -35,6 +36,8 @@
import org.teiid.core.util.ApplicationInfo;
import org.teiid.core.util.PropertiesUtils;
+import org.teiid.jdbc.JDBCURL.ConnectionType;
+import org.teiid.net.TeiidURL;
/**
@@ -79,14 +82,21 @@
}
public Connection connect(String url, Properties info) throws SQLException {
-
- if (EmbeddedProfile.acceptsURL(url)) {
+ ConnectionType conn = JDBCURL.acceptsUrl(url);
+ if (conn == null) {
+ return null;
+ }
+ if(info == null) {
+ // create a properties obj if it is null
+ info = new Properties();
+ } else {
+ //don't modify the original
+ info = PropertiesUtils.clone(info);
+ }
+ if (conn == ConnectionType.Embedded) {
return EmbeddedProfile.connect(url, info);
}
- else if (SocketProfile.acceptsURL(url)) {
- return SocketProfile.connect(url, info);
- }
- return null;
+ return SocketProfile.connect(url, info);
}
/**
@@ -99,21 +109,13 @@
* @throws SQLException, should never occur
*/
public boolean acceptsURL(String url) throws SQLException {
- return EmbeddedProfile.acceptsURL(url) || SocketProfile.acceptsURL(url);
+ return JDBCURL.acceptsUrl(url) != null;
}
- /**
- * Get's the driver's major version number. Initially this should be 1.
- * @return major version number of the driver.
- */
public int getMajorVersion() {
return ApplicationInfo.getInstance().getMajorReleaseVersion();
}
- /**
- * Get's the driver's minor version number. Initially this should be 0.
- * @return major version number of the driver.
- */
public int getMinorVersion() {
return ApplicationInfo.getInstance().getMinorReleaseVersion();
}
@@ -132,11 +134,7 @@
// construct list of driverPropertyInfo objects
List<DriverPropertyInfo> driverProps = new LinkedList<DriverPropertyInfo>();
- if (EmbeddedProfile.acceptsURL(url)) {
- EmbeddedProfile.parseURL(url, info);
- } else if (SocketProfile.acceptsURL(url)) {
- SocketProfile.parseURL(url, info);
- }
+ parseURL(url, info);
for (String property: JDBCURL.KNOWN_PROPERTIES) {
DriverPropertyInfo dpi = new DriverPropertyInfo(property, info.getProperty(property));
@@ -154,6 +152,48 @@
}
/**
+ * This method parses the URL and adds properties to the the properties object.
+ * These include required and any optional properties specified in the URL.
+ * @param The URL needed to be parsed.
+ * @param The properties object which is to be updated with properties in the URL.
+ * @throws SQLException if the URL is not in the expected format.
+ */
+ protected static void parseURL(String url, Properties info) throws SQLException {
+ if(url == null) {
+ String msg = JDBCPlugin.Util.getString("MMDriver.urlFormat"); //$NON-NLS-1$
+ throw new TeiidSQLException(msg);
+ }
+ try {
+ JDBCURL jdbcURL = new JDBCURL(url);
+ info.setProperty(BaseDataSource.VDB_NAME, jdbcURL.getVDBName());
+ if (jdbcURL.getConnectionURL() != null) {
+ info.setProperty(TeiidURL.CONNECTION.SERVER_URL, jdbcURL.getConnectionURL());
+ }
+ Properties optionalParams = jdbcURL.getProperties();
+ JDBCURL.normalizeProperties(info);
+ Enumeration keys = optionalParams.keys();
+ while (keys.hasMoreElements()) {
+ String propName = (String)keys.nextElement();
+ // Don't let the URL properties override the passed-in Properties object.
+ if (!info.containsKey(propName)) {
+ info.setProperty(propName, optionalParams.getProperty(propName));
+ }
+ }
+ // add the property only if it is new because they could have
+ // already been specified either through url or otherwise.
+ if(!info.containsKey(BaseDataSource.VDB_VERSION) && jdbcURL.getVDBVersion() != null) {
+ info.setProperty(BaseDataSource.VDB_VERSION, jdbcURL.getVDBVersion());
+ }
+ if(!info.containsKey(BaseDataSource.APP_NAME)) {
+ info.setProperty(BaseDataSource.APP_NAME, BaseDataSource.DEFAULT_APP_NAME);
+ }
+
+ } catch(IllegalArgumentException iae) {
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("MMDriver.urlFormat")); //$NON-NLS-1$
+ }
+ }
+
+ /**
* This method returns true if the driver passes jdbc compliance tests.
* @return true if the driver is jdbc complaint, else false.
*/
Modified: trunk/client/src/main/java/org/teiid/net/TeiidURL.java
===================================================================
--- trunk/client/src/main/java/org/teiid/net/TeiidURL.java 2011-02-24 04:55:53 UTC (rev 2936)
+++ trunk/client/src/main/java/org/teiid/net/TeiidURL.java 2011-02-24 17:57:38 UTC (rev 2937)
@@ -22,13 +22,13 @@
package org.teiid.net;
-import java.net.UnknownHostException;
+import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import java.util.NoSuchElementException;
import java.util.StringTokenizer;
+import org.teiid.core.util.StringUtil;
import org.teiid.jdbc.JDBCPlugin;
@@ -92,12 +92,7 @@
public static final String DEFAULT_PROTOCOL= TeiidURL.CONNECTION.NON_SECURE_PROTOCOL + "://"; //$NON-NLS-1$
public static final String SECURE_PROTOCOL= TeiidURL.CONNECTION.SECURE_PROTOCOL + "://"; //$NON-NLS-1$
- public static final String FORMAT_SERVER = "mm[s]://server1:port1[,server2:port2]"; //$NON-NLS-1$
-
- public static final String INVALID_FORMAT_SERVER = JDBCPlugin.Util.getString("MMURL.INVALID_FORMAT", new Object[] {FORMAT_SERVER}); //$NON-NLS-1$
-
-
-
+ public static final String INVALID_FORMAT_SERVER = JDBCPlugin.Util.getString("MMURL.INVALID_FORMAT"); //$NON-NLS-1$
/*
* appserver URL
*/
@@ -112,15 +107,21 @@
/**
* Create an MMURL from the server URL. For use by the server-side.
* @param serverURL Expected format: mm[s]://server1:port1[,server2:port2]
+ * @throws MalformedURLException
* @since 4.2
*/
- public TeiidURL(String serverURL) {
- appServerURL = serverURL;
- if (!hasValidURLProtocol(serverURL)) {
- throw new IllegalArgumentException(INVALID_FORMAT_SERVER);
+ public TeiidURL(String serverURL) throws MalformedURLException {
+ if (serverURL == null) {
+ throw new MalformedURLException(INVALID_FORMAT_SERVER);
+ }
+ if (StringUtil.startsWithIgnoreCase(serverURL, SECURE_PROTOCOL)) {
+ usingSSL = true;
+ } else if (!StringUtil.startsWithIgnoreCase(serverURL, DEFAULT_PROTOCOL)) {
+ throw new IllegalArgumentException(INVALID_FORMAT_SERVER);
}
- usingSSL = isSecureProtocol(appServerURL);
- parseURL(serverURL, INVALID_FORMAT_SERVER);
+
+ appServerURL = serverURL;
+ parseServerURL(serverURL.substring(usingSSL?SECURE_PROTOCOL.length():DEFAULT_PROTOCOL.length()), INVALID_FORMAT_SERVER);
}
public TeiidURL(String host, int port, boolean secure) {
@@ -147,18 +148,6 @@
return valid;
}
- /**
- * @param appServerURL2
- * @return
- */
- private boolean isSecureProtocol(String url) {
- return url.toLowerCase().startsWith(SECURE_PROTOCOL);
- }
-
- private boolean hasValidURLProtocol(String url) {
- return url != null && (url.startsWith(DEFAULT_PROTOCOL) || url.startsWith(SECURE_PROTOCOL));
- }
-
public List<HostInfo> getHostInfo() {
return hosts;
}
@@ -166,7 +155,7 @@
/**
* Get a list of hosts
*
- * @return string of host seperated by commas
+ * @return string of host separated by commas
* @since 4.2
*/
public String getHosts() {
@@ -205,80 +194,69 @@
return portList.toString();
}
- private void parseURL(String url, String exceptionMessage) {
-
- // Parse property string
- int urlProtocolIndex = url.indexOf(DOUBLE_SLASH_DELIMITER);
- String serverURL;
- if (urlProtocolIndex > 0) {
- serverURL = url.substring(urlProtocolIndex + 2);
- if(serverURL == null || serverURL.equals("")) { //$NON-NLS-1$
- throw new IllegalArgumentException(exceptionMessage);
- }
- parseServerURL(serverURL, exceptionMessage);
- } else {
- throw new IllegalArgumentException(exceptionMessage);
- }
- }
-
/**
* @param url
- * @throws UnknownHostException
+ * @throws MalformedURLException
* @since 4.2
*/
- private void parseServerURL(String serverURL, String exceptionMessage) {
- StringTokenizer st;
- StringTokenizer st2;
-
- st = new StringTokenizer(serverURL, COMMA_DELIMITER);
+ private void parseServerURL(String serverURL, String exceptionMessage) throws MalformedURLException {
+ StringTokenizer st = new StringTokenizer(serverURL, COMMA_DELIMITER);
if (!st.hasMoreTokens()) {
- throw new IllegalArgumentException(exceptionMessage);
+ throw new MalformedURLException(exceptionMessage);
}
while (st.hasMoreTokens()) {
String nextToken = st.nextToken();
- try {
- String host = ""; //$NON-NLS-1$
- String port = ""; //$NON-NLS-1$
- if (nextToken.startsWith("[")) { //$NON-NLS-1$
- int hostEnd = nextToken.indexOf("]:"); //$NON-NLS-1$
- host = nextToken.substring(1, hostEnd);
- port = nextToken.substring(hostEnd+2);
- }
- else {
- st2 = new StringTokenizer(nextToken, COLON_DELIMITER);
- host = st2.nextToken().trim();
- port = st2.nextToken().trim();
- }
-
- if (host.equals("")) { //$NON-NLS-1$
- throw new IllegalArgumentException("hostname can't be empty"); //$NON-NLS-1$
- }
-
- if (port.equals("")) { //$NON-NLS-1$
- throw new IllegalArgumentException("port can't be empty"); //$NON-NLS-1$
- }
-
- int portNumber;
- try {
- portNumber = Integer.parseInt(port);
- } catch (NumberFormatException nfe) {
- throw new IllegalArgumentException("port must be numeric:" + port); //$NON-NLS-1$
- }
- if (portNumber < 0 || portNumber > 0xFFFF) {
- throw new IllegalArgumentException("port out of range:" + portNumber); //$NON-NLS-1$
- }
- HostInfo hostInfo = new HostInfo(host, portNumber);
- hosts.add(hostInfo);
-
- } catch (NoSuchElementException nsee) {
- throw new IllegalArgumentException(exceptionMessage);
- } catch (NullPointerException ne) {
- throw new IllegalArgumentException(exceptionMessage);
+ nextToken = nextToken.trim();
+ String host = ""; //$NON-NLS-1$
+ String port = ""; //$NON-NLS-1$
+ if (nextToken.startsWith("[")) { //$NON-NLS-1$
+ int hostEnd = nextToken.indexOf("]:"); //$NON-NLS-1$
+ if (hostEnd == -1) {
+ throw new MalformedURLException(JDBCPlugin.Util.getString("TeiidURL.invalid_ipv6_hostport", nextToken, exceptionMessage)); //$NON-NLS-1$
+ }
+ host = nextToken.substring(1, hostEnd);
+ port = nextToken.substring(hostEnd+2);
+ }
+ else {
+ int hostEnd = nextToken.indexOf(":"); //$NON-NLS-1$
+ if (hostEnd == -1) {
+ throw new MalformedURLException(JDBCPlugin.Util.getString("TeiidURL.invalid_hostport", nextToken, exceptionMessage)); //$NON-NLS-1$
+ }
+ host = nextToken.substring(0, hostEnd);
+ port = nextToken.substring(hostEnd+1);
+ }
+ host = host.trim();
+ port = port.trim();
+ if (host.equals("") || port.equals("")) { //$NON-NLS-1$ //$NON-NLS-2$
+ throw new MalformedURLException(JDBCPlugin.Util.getString("TeiidURL.invalid_hostport", nextToken, exceptionMessage)); //$NON-NLS-1$
}
-
+ int portNumber = validatePort(port);
+ HostInfo hostInfo = new HostInfo(host, portNumber);
+ hosts.add(hostInfo);
}
}
+ public static int validatePort(String port) throws MalformedURLException {
+ int portNumber;
+ try {
+ portNumber = Integer.parseInt(port);
+ } catch (NumberFormatException nfe) {
+ throw new MalformedURLException(JDBCPlugin.Util.getString("TeiidURL.non_numeric_port", port)); //$NON-NLS-1$
+ }
+ String msg = validatePort(portNumber);
+ if (msg != null) {
+ throw new MalformedURLException(msg);
+ }
+ return portNumber;
+ }
+
+ public static String validatePort(int portNumber) {
+ if (portNumber < 0 || portNumber > 0xFFFF) {
+ return JDBCPlugin.Util.getString("TeiidURL.port_out_of_range", portNumber); //$NON-NLS-1$
+ }
+ return null;
+ }
+
/**
* Get the Application Server URL
*
Modified: trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnectionFactory.java
===================================================================
--- trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnectionFactory.java 2011-02-24 04:55:53 UTC (rev 2936)
+++ trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnectionFactory.java 2011-02-24 17:57:38 UTC (rev 2937)
@@ -29,6 +29,7 @@
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.net.InetAddress;
+import java.net.MalformedURLException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.HashMap;
@@ -291,7 +292,12 @@
updateConnectionProperties(connectionProperties);
- TeiidURL url = new TeiidURL(connectionProperties.getProperty(TeiidURL.CONNECTION.SERVER_URL));
+ TeiidURL url;
+ try {
+ url = new TeiidURL(connectionProperties.getProperty(TeiidURL.CONNECTION.SERVER_URL));
+ } catch (MalformedURLException e1) {
+ throw new ConnectionException(e1);
+ }
String discoveryStrategyName = connectionProperties.getProperty(TeiidURL.CONNECTION.DISCOVERY_STRATEGY, URL);
Modified: trunk/client/src/main/resources/org/teiid/jdbc/i18n.properties
===================================================================
--- trunk/client/src/main/resources/org/teiid/jdbc/i18n.properties 2011-02-24 04:55:53 UTC (rev 2936)
+++ trunk/client/src/main/resources/org/teiid/jdbc/i18n.properties 2011-02-24 17:57:38 UTC (rev 2937)
@@ -82,14 +82,11 @@
MMStatement.Stmt_closed=Unable to perform operations on an already closed statement.
MMStatement.Success_query=Successfully executed a query {0} and obtained results
MMStatement.Invalid_field_size=Invalid MaxFieldSize {0}
-MMDataSource.Port_number_must_be_positive=The port number must be a positive number
-MMDataSource.serverPort_must_be_a_number=The serverPort property must be a number.
MMDataSource.Server_name_required=The server name must be specified
MMDataSource.Invalid_trans_auto_wrap_mode=The transaction auto-wrap setting must be one of \"{0}\", \"{1}\", or \"{2}\".
MMDataSource.Sockets_per_vm_invalid=The property socketsPerVM must be a positive number.
MMDataSource.Sticky_connections_invalid=The property stickyConnections must be boolean.
-MMDataSource.Alternate_Servers_format=The format for the alternateServers property is <server2>[:<port2>][,<server3>[:<port3>],...].
-MMDataSource.alternateServer_is_invalid=The alternateServers property contains the following {0} error(s): {1}
+MMDataSource.alternateServer_is_invalid=The alternateServers property contains the following error: {0} The format for the alternateServers property is <server2>[:<port2>][,<server3>[:<port3>],...].
StreamImpl.Unable_to_read_data_from_stream=Unable to read data from the stream: {0}
MMStatement.Invalid_During_Transaction=Call to method {0} not valid during a transaction.
@@ -146,6 +143,10 @@
SocketServerConnection.closed=Server connection is closed
SocketHelper.keystore_not_found=Key store ''{0}'' was not found.
-MMURL.INVALID_FORMAT=The required url format is {0}
+MMURL.INVALID_FORMAT=The required socket url format is mm[s]://server1:port1[,server2:port2]
+TeiidURL.invalid_ipv6_hostport=The IPv6 host:port ''{0}'' is not valid. {1}
+TeiidURL.invalid_hostport=The host:port ''{0}'' is not valid. {1}
+TeiidURL.non_numeric_port=The port ''{0}'' is a non-numeric value.
+TeiidURL.port_out_of_range=The port ''{0}'' is out of range.
BatchSerializer.datatype_mismatch=The modeled datatype {0} for column {1} doesn''t match the runtime type "{2}". Please ensure that the column''s modeled datatype matches the expected data.
Modified: trunk/client/src/test/java/org/teiid/jdbc/TestEmbeddedProfile.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestEmbeddedProfile.java 2011-02-24 04:55:53 UTC (rev 2936)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestEmbeddedProfile.java 2011-02-24 17:57:38 UTC (rev 2937)
@@ -28,6 +28,7 @@
import java.util.Properties;
import org.junit.Test;
+import org.teiid.jdbc.JDBCURL.ConnectionType;
public class TestEmbeddedProfile {
@@ -38,29 +39,25 @@
@Test public void testAcceptsURL() {
// ClassPath based URL
- assertFalse(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:teiid:BQT@classpath:/dqp.properties;partialResultsMode=true")); //$NON-NLS-1$
+ assertFalse(ConnectionType.Embedded == JDBCURL.acceptsUrl("jdbc:teiid:BQT@classpath:/dqp.properties;partialResultsMode=true")); //$NON-NLS-1$
- // These are specific to the MMorg.teiid.jdbc.EmbeddedProfile and should not be suported
- assertFalse(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:teiid:BQT@mm://host:7001;version=1")); //$NON-NLS-1$
- assertFalse(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:teiid:BQT@mms://host:7001;version=1")); //$NON-NLS-1$
-
- assertTrue(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:teiid:BQT")); //$NON-NLS-1$
- assertFalse(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:teiid:BQT!/path/foo.properties")); //$NON-NLS-1$
- assertTrue(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:teiid:BQT;")); //$NON-NLS-1$
- assertTrue(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:teiid:BQT;version=1;logFile=foo.txt")); //$NON-NLS-1$
- assertTrue(org.teiid.jdbc.EmbeddedProfile.acceptsURL("jdbc:teiid:BQT.1;version=1;logFile=foo.txt")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Embedded, JDBCURL.acceptsUrl("jdbc:teiid:BQT")); //$NON-NLS-1$
+ assertNull(JDBCURL.acceptsUrl("jdbc:teiid:BQT!/path/foo.properties")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Embedded, JDBCURL.acceptsUrl("jdbc:teiid:BQT;")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Embedded, JDBCURL.acceptsUrl("jdbc:teiid:BQT;version=1;logFile=foo.txt")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Embedded, JDBCURL.acceptsUrl("jdbc:teiid:BQT.1;version=1;logFile=foo.txt")); //$NON-NLS-1$
}
@Test public void testParseURL() throws SQLException{
Properties p = new Properties();
- org.teiid.jdbc.EmbeddedProfile.parseURL("jdbc:teiid:BQT", p); //$NON-NLS-1$
+ TeiidDriver.parseURL("jdbc:teiid:BQT", p); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
assertEquals(2, p.size());
}
@Test public void testParseURL2() throws SQLException {
Properties p = new Properties();
- org.teiid.jdbc.EmbeddedProfile.parseURL("jdbc:teiid:BQT;version=3", p); //$NON-NLS-1$
+ TeiidDriver.parseURL("jdbc:teiid:BQT;version=3", p); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("3")); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VERSION).equals("3")); //$NON-NLS-1$
@@ -69,7 +66,7 @@
@Test public void testParseURL3() throws SQLException{
Properties p = new Properties();
- org.teiid.jdbc.EmbeddedProfile.parseURL("jdbc:teiid:BQT@/metamatrix/dqp/dqp.properties;version=4;autoCommitTxn=ON;partialResultsMode=YES;", p); //$NON-NLS-1$
+ TeiidDriver.parseURL("jdbc:teiid:BQT;version=4;autoCommitTxn=ON;partialResultsMode=YES;", p); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("4")); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VERSION).equals("4")); //$NON-NLS-1$
@@ -80,7 +77,7 @@
@Test public void testParseURL4() throws SQLException{
Properties p = new Properties();
- org.teiid.jdbc.EmbeddedProfile.parseURL("jdbc:teiid:BQT;partialResultsMode=true", p); //$NON-NLS-1$
+ TeiidDriver.parseURL("jdbc:teiid:BQT;partialResultsMode=true", p); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
assertTrue(p.getProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE).equals("true")); //$NON-NLS-1$
assertEquals(3, p.size());
@@ -88,19 +85,19 @@
@Test public void testParseURL5() throws SQLException{
Properties p = new Properties();
- org.teiid.jdbc.EmbeddedProfile.parseURL("jdbc:teiid:BQT", p); //$NON-NLS-1$
+ TeiidDriver.parseURL("jdbc:teiid:BQT", p); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
}
@Test public void testParseURL55() throws SQLException{
Properties p = new Properties();
- org.teiid.jdbc.EmbeddedProfile.parseURL("jdbc:teiid:BQT;", p); //$NON-NLS-1$
+ TeiidDriver.parseURL("jdbc:teiid:BQT;", p); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
}
@Test public void testParseURL6() throws SQLException{
Properties p = new Properties();
- org.teiid.jdbc.EmbeddedProfile.parseURL("jdbc:teiid:BQT;partialResultsMode=true;version=1", p); //$NON-NLS-1$
+ TeiidDriver.parseURL("jdbc:teiid:BQT;partialResultsMode=true;version=1", p); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
assertTrue(p.getProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE).equals("true")); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("1")); //$NON-NLS-1$
Modified: trunk/client/src/test/java/org/teiid/jdbc/TestJDBCURL.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestJDBCURL.java 2011-02-24 04:55:53 UTC (rev 2936)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestJDBCURL.java 2011-02-24 17:57:38 UTC (rev 2937)
@@ -25,15 +25,12 @@
import java.net.URLEncoder;
import java.util.Properties;
-import org.teiid.jdbc.BaseDataSource;
-import org.teiid.jdbc.ExecutionProperties;
-import org.teiid.jdbc.JDBCURL;
-import org.teiid.net.TeiidURL;
-
import junit.framework.TestCase;
+import org.teiid.net.TeiidURL;
+
/**
* @since 4.3
*/
@@ -42,13 +39,13 @@
// Need to allow embedded spaces and ='s within optional properties
public final void testCredentials() throws Exception {
String credentials = URLEncoder.encode("defaultToLogon,(system=BQT1 SQL Server 2000 Simple Cap,user=xyz,password=xyz)", "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$
- JDBCURL url = new JDBCURL("jdbc:metamatrix:QT_sqls2kds@mm://slwxp136:43100;credentials="+credentials); //$NON-NLS-1$
+ JDBCURL url = new JDBCURL("jdbc:teiid:QT_sqls2kds@mm://slwxp136:43100;credentials="+credentials); //$NON-NLS-1$
Properties p = url.getProperties();
assertEquals("defaultToLogon,(system=BQT1 SQL Server 2000 Simple Cap,user=xyz,password=xyz)", p.getProperty("credentials")); //$NON-NLS-1$//$NON-NLS-2$
}
public void testJDBCURLWithProperties() {
- String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;password=***;logLevel=1;configFile=testdata/bqt/dqp_stmt_e2e.xmi;disableLocalTxn=true;autoFailover=false"; //$NON-NLS-1$
+ String URL = "jdbc:teiid:bqt@mm://localhost:12345;version=1;user=xyz;password=***;logLevel=1;configFile=testdata/bqt/dqp_stmt_e2e.xmi;disableLocalTxn=true;autoFailover=false"; //$NON-NLS-1$
Properties expectedProperties = new Properties();
expectedProperties.setProperty("version", "1"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -65,7 +62,7 @@
}
public void testJDBCURLWithoutProperties() {
- String URL = "jdbc:metamatrix:bqt@mm://localhost:12345"; //$NON-NLS-1$
+ String URL = "jdbc:teiid:bqt@mm://localhost:12345"; //$NON-NLS-1$
JDBCURL url = new JDBCURL(URL);
assertEquals("bqt", url.getVDBName()); //$NON-NLS-1$
@@ -75,7 +72,7 @@
public void testCaseConversion() {
// Different case ------------------------------------HERE -v ----------------and HERE -v
- String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;VERSION=1;user=xyz;password=***;configFile=testdata/bqt/dqp_stmt_e2e.xmi"; //$NON-NLS-1$
+ String URL = "jdbc:teiid:bqt@mm://localhost:12345;VERSION=1;user=xyz;password=***;configFile=testdata/bqt/dqp_stmt_e2e.xmi"; //$NON-NLS-1$
Properties expectedProperties = new Properties();
expectedProperties.setProperty("version", "1"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -89,7 +86,7 @@
}
public void testWithExtraSemicolons() {
- String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;password=***;logLevel=1;;;configFile=testdata/bqt/dqp_stmt_e2e.xmi;;"; //$NON-NLS-1$
+ String URL = "jdbc:teiid:bqt@mm://localhost:12345;version=1;user=xyz;password=***;logLevel=1;;;configFile=testdata/bqt/dqp_stmt_e2e.xmi;;"; //$NON-NLS-1$
Properties expectedProperties = new Properties();
expectedProperties.setProperty("version", "1"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -104,7 +101,7 @@
}
public void testWithWhitespace() {
- String URL = "jdbc:metamatrix:bqt@mm://localhost:12345; version =1;user= xyz ;password=***; logLevel = 1 ; configFile=testdata/bqt/dqp_stmt_e2e.xmi ;"; //$NON-NLS-1$
+ String URL = "jdbc:teiid:bqt@mm://localhost:12345; version =1;user= xyz ;password=***; logLevel = 1 ; configFile=testdata/bqt/dqp_stmt_e2e.xmi ;"; //$NON-NLS-1$
Properties expectedProperties = new Properties();
expectedProperties.setProperty("version", "1"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -119,7 +116,7 @@
}
public void testNoPropertyValue() {
- String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;password=***;logLevel=;configFile="; //$NON-NLS-1$
+ String URL = "jdbc:teiid:bqt@mm://localhost:12345;version=1;user=xyz;password=***;logLevel=;configFile="; //$NON-NLS-1$
Properties expectedProperties = new Properties();
expectedProperties.setProperty("version", "1"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -144,7 +141,7 @@
}
public void testNoVDBName() {
- String URL = "jdbc:metamatrix:@mm://localhost:12345;version=1;user=xyz;password=***;logLevel=1"; //$NON-NLS-1$
+ String URL = "jdbc:teiid:@mm://localhost:12345;version=1;user=xyz;password=***;logLevel=1"; //$NON-NLS-1$
try {
new JDBCURL(URL);
fail("Illegal argument should have failed."); //$NON-NLS-1$
@@ -154,7 +151,7 @@
}
public void testNoAtSignInURL() {
- String URL = "jdbc:metamatrix:bqt!mm://localhost:12345;version=1;user=xyz;password=***;logLevel=1"; //$NON-NLS-1$
+ String URL = "jdbc:teiid:bqt!mm://localhost:12345;version=1;user=xyz;password=***;logLevel=1"; //$NON-NLS-1$
try {
new JDBCURL(URL);
// No @ sign is llowed as part of embedded driver now,
@@ -166,7 +163,7 @@
}
public void testMoreThanOneAtSign() {
- String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xy@;password=***;logLevel=1"; //$NON-NLS-1$
+ String URL = "jdbc:teiid:bqt@mm://localhost:12345;version=1;user=xy@;password=***;logLevel=1"; //$NON-NLS-1$
try {
// this allowed as customer properties can have @ in their properties
new JDBCURL(URL);
@@ -176,7 +173,7 @@
}
public void testNoEqualsInProperty() {
- String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;password***;logLevel=1"; //$NON-NLS-1$
+ String URL = "jdbc:teiid:bqt@mm://localhost:12345;version=1;user=xyz;password***;logLevel=1"; //$NON-NLS-1$
try {
new JDBCURL(URL);
fail("Illegal argument should have failed."); //$NON-NLS-1$
@@ -186,21 +183,21 @@
}
public void testMoreThanOneEqualsInProperty() {
- String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;password==***;logLevel=1"; //$NON-NLS-1$
+ String URL = "jdbc:teiid:bqt@mm://localhost:12345;version=1;user=xyz;password==***;logLevel=1"; //$NON-NLS-1$
try {
new JDBCURL(URL);
fail("Illegal argument should have failed."); //$NON-NLS-1$
} catch (IllegalArgumentException e) {
// expected
}
- URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;password=***=;logLevel=1"; //$NON-NLS-1$
+ URL = "jdbc:teiid:bqt@mm://localhost:12345;version=1;user=xyz;password=***=;logLevel=1"; //$NON-NLS-1$
try {
new JDBCURL(URL);
fail("Illegal argument should have failed."); //$NON-NLS-1$
} catch (IllegalArgumentException e) {
// expected
}
- URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;=password=***;logLevel=1"; //$NON-NLS-1$
+ URL = "jdbc:teiid:bqt@mm://localhost:12345;version=1;user=xyz;=password=***;logLevel=1"; //$NON-NLS-1$
try {
new JDBCURL(URL);
fail("Illegal argument should have failed."); //$NON-NLS-1$
@@ -210,7 +207,7 @@
}
public void testNoKeyInProperty() {
- String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;=***;logLevel=1"; //$NON-NLS-1$
+ String URL = "jdbc:teiid:bqt@mm://localhost:12345;version=1;user=xyz;=***;logLevel=1"; //$NON-NLS-1$
try {
new JDBCURL(URL);
fail("Illegal argument should have failed."); //$NON-NLS-1$
@@ -277,19 +274,19 @@
public final void testEncodedPropertyInURL() throws Exception {
String password = "=@#^&*()+!%$^%@#_-)_~{}||\\`':;,./<>?password has = & %"; //$NON-NLS-1$
String encPassword = URLEncoder.encode(password, "UTF-8"); //$NON-NLS-1$
- JDBCURL url = new JDBCURL("jdbc:metamatrix:QT_sqls2kds@mm://slwxp136:43100;PASswoRd="+encPassword); //$NON-NLS-1$
+ JDBCURL url = new JDBCURL("jdbc:teiid:QT_sqls2kds@mm://slwxp136:43100;PASswoRd="+encPassword); //$NON-NLS-1$
Properties p = url.getProperties();
assertEquals(password, p.getProperty("password")); //$NON-NLS-1$
}
public void testGetServerURL_NoProperties() {
- String result = new JDBCURL("jdbc:metamatrix:designtimecatalog@mm://slwxp172:44401;user=ddifranco;password=mm").getConnectionURL(); //$NON-NLS-1$
+ String result = new JDBCURL("jdbc:teiid:designtimecatalog@mm://slwxp172:44401;user=ddifranco;password=mm").getConnectionURL(); //$NON-NLS-1$
assertEquals("mm://slwxp172:44401", result); //$NON-NLS-1$
}
public void testGetServerURL_Properties() {
- String result = new JDBCURL("jdbc:metamatrix:designtimecatalog@mm://slwxp172:44401;user=ddifranco;password=mm").getConnectionURL(); //$NON-NLS-1$
+ String result = new JDBCURL("jdbc:teiid:designtimecatalog@mm://slwxp172:44401;user=ddifranco;password=mm").getConnectionURL(); //$NON-NLS-1$
assertEquals("mm://slwxp172:44401", result); //$NON-NLS-1$
}
@@ -301,7 +298,7 @@
*/
public void testGetServerURL_PasswordProperties() throws Exception {
String result = null;
- String srcURL = "jdbc:metamatrix:designtimecatalog@mm://slwxp172:44401;user=ddifranco;password="; //$NON-NLS-1$
+ String srcURL = "jdbc:teiid:designtimecatalog@mm://slwxp172:44401;user=ddifranco;password="; //$NON-NLS-1$
String password = null;
String tgtURL = "mm://slwxp172:44401"; //$NON-NLS-1$
@@ -318,7 +315,7 @@
}
public void testGetServerURL_2Servers() {
- String result = new JDBCURL("jdbc:metamatrix:designtimecatalog@mm://slwxp172:44401,slabc123:12345;user=ddifranco;password=mm").getConnectionURL(); //$NON-NLS-1$
+ String result = new JDBCURL("jdbc:teiid:designtimecatalog@mm://slwxp172:44401,slabc123:12345;user=ddifranco;password=mm").getConnectionURL(); //$NON-NLS-1$
assertEquals("mm://slwxp172:44401,slabc123:12345", result); //$NON-NLS-1$
}
Modified: trunk/client/src/test/java/org/teiid/jdbc/TestSocketProfile.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestSocketProfile.java 2011-02-24 04:55:53 UTC (rev 2936)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestSocketProfile.java 2011-02-24 17:57:38 UTC (rev 2937)
@@ -22,13 +22,13 @@
package org.teiid.jdbc;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
import java.sql.SQLException;
import java.util.Properties;
import org.junit.Test;
+import org.teiid.jdbc.JDBCURL.ConnectionType;
import org.teiid.net.TeiidURL;
@@ -37,59 +37,58 @@
/** Valid format of urls*/
@Test public void testAcceptsURL1() throws Exception {
- assertTrue(SocketProfile.acceptsURL("jdbc:teiid:jvdb@mm://localhost:1234")); //$NON-NLS-1$
- assertTrue(SocketProfile.acceptsURL("jdbc:teiid:jvdb@mm://localhost:1234")); //$NON-NLS-1$
- assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234;version=x")); //$NON-NLS-1$
- assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234")); //$NON-NLS-1$
- assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$
- assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mms://localhost:1234;logLevel=1;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:@mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
- assertTrue(SocketProfile.acceptsURL("jdbc:teiid:jvdb@mms://localhost:1234")); //$NON-NLS-1$
- assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234;version=x")); //$NON-NLS-1$
- assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$
- assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mms://localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mms://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
- assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mm://127.0.0.1:1234;logLevel=2")); //$NON-NLS-1$
- assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mms://127.0.0.1:1234")); //$NON-NLS-1$
- assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mm://127.0.0.1:1234,localhost.mydomain.com:63636;logLevel=2")); //$NON-NLS-1$
- assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mm://my-host.mydomain.com:53535,127.0.0.1:1234")); //$NON-NLS-1$
- assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mm://123.123.123.123:53535,127.0.0.1:1234")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:jvdb@mm://localhost:1234")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:jvdb@mm://localhost:1234")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:vdb@mm://localhost:1234;version=x")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:vdb@mm://localhost:1234")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:vdb@mm://localhost:1234;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:vdb@mms://localhost:1234;logLevel=1;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertNull(JDBCURL.acceptsUrl("jdbc:teiid:@mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:vdb@mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:jvdb@mms://localhost:1234")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:vdb@mm://localhost:1234;version=x")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:vdb@mms://localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:vdb@mms://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:vdb@mm://127.0.0.1:1234;logLevel=2")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:vdb@mms://127.0.0.1:1234")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:vdb@mm://127.0.0.1:1234,localhost.mydomain.com:63636;logLevel=2")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:vdb@mm://my-host.mydomain.com:53535,127.0.0.1:1234")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:vdb@mm://123.123.123.123:53535,127.0.0.1:1234")); //$NON-NLS-1$
- assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:jvdb@localhost:1234")); //$NON-NLS-1$
- assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:jvdb@localhost:1234")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:jvdb@localhost:1234")); //$NON-NLS-1$
//DQP type
- assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:jvdb@c:/dqp.properties;version=1")); //$NON-NLS-1$
- assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:jvdb@/foo/dqp.properties;version=1")); //$NON-NLS-1$
- assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:jvdb@../foo/dqp.properties;version=1")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:jvdb@c:/dqp.properties;version=1")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:jvdb@/foo/dqp.properties;version=1")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:jvdb@../foo/dqp.properties;version=1")); //$NON-NLS-1$
- assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:jvdb@mm://localhost:port")); //$NON-NLS-1$
- assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:vdb@localhost:port;version=x")); //$NON-NLS-1$
- assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:@localhost:1234")); //$NON-NLS-1$
- assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:@localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$
- assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:@localhost:1234;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:@localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:@localhost:1234;logLevel=1;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
- assertTrue(!SocketProfile.acceptsURL("jdbc:teiid:@localhost:1234;stickyConnections=false;socketsPerVM=4")); //$NON-NLS-1$
- assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mm://my_host.mydomain.com:53535,127.0.0.1:1234")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:jvdb@mm://localhost:port")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:vdb@localhost:port;version=x")); //$NON-NLS-1$
+ assertNull(JDBCURL.acceptsUrl("jdbc:teiid:@localhost:1234")); //$NON-NLS-1$
+ assertNull(JDBCURL.acceptsUrl("jdbc:teiid:@localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$
+ assertNull(JDBCURL.acceptsUrl("jdbc:teiid:@localhost:1234;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertNull(JDBCURL.acceptsUrl("jdbc:teiid:@localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertNull(JDBCURL.acceptsUrl("jdbc:teiid:@localhost:1234;logLevel=1;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertNull(JDBCURL.acceptsUrl("jdbc:teiid:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertNull(JDBCURL.acceptsUrl("jdbc:teiid:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
+ assertNull(JDBCURL.acceptsUrl("jdbc:teiid:@localhost:1234;stickyConnections=false;socketsPerVM=4")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:vdb@mm://my_host.mydomain.com:53535,127.0.0.1:1234")); //$NON-NLS-1$
}
/** Invalid format of urls*/
@Test public void testAcceptsURL2() throws Exception {
- assertTrue(!SocketProfile.acceptsURL("jdbc:matamatrix:test")); //$NON-NLS-1$
- assertTrue(!SocketProfile.acceptsURL("metamatrix:test")); //$NON-NLS-1$
- assertTrue(!SocketProfile.acceptsURL("jdbc&matamatrix:test")); //$NON-NLS-1$
- assertTrue(!SocketProfile.acceptsURL("jdbc;metamatrix:test")); //$NON-NLS-1$
+ assertTrue(!TeiidDriver.getInstance().acceptsURL("jdbc:matamatrix:test")); //$NON-NLS-1$
+ assertTrue(!TeiidDriver.getInstance().acceptsURL("metamatrix:test")); //$NON-NLS-1$
+ assertTrue(!TeiidDriver.getInstance().acceptsURL("jdbc&matamatrix:test")); //$NON-NLS-1$
+ assertTrue(!TeiidDriver.getInstance().acceptsURL("jdbc;metamatrix:test")); //$NON-NLS-1$
}
@Test public void testParseURL() throws SQLException{
Properties p = new Properties();
- SocketProfile.parseURL("jdbc:teiid:BQT@mm://slwxp157:1234", p); //$NON-NLS-1$
+ TeiidDriver.parseURL("jdbc:teiid:BQT@mm://slwxp157:1234", p); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
assertTrue(p.getProperty(TeiidURL.CONNECTION.SERVER_URL).equals("mm://slwxp157:1234")); //$NON-NLS-1$
assertEquals(3, p.size());
@@ -97,7 +96,7 @@
@Test public void testParseURL2() throws SQLException {
Properties p = new Properties();
- SocketProfile.parseURL("jdbc:teiid:BQT@mms://slwxp157:1234;version=3", p); //$NON-NLS-1$
+ TeiidDriver.parseURL("jdbc:teiid:BQT@mms://slwxp157:1234;version=3", p); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("3")); //$NON-NLS-1$
assertTrue(p.getProperty(TeiidURL.CONNECTION.SERVER_URL).equals("mms://slwxp157:1234")); //$NON-NLS-1$
@@ -108,7 +107,7 @@
@Test public void testParseURL3() throws SQLException{
Properties p = new Properties();
- SocketProfile.parseURL("jdbc:teiid:BQT@mm://slwxp157:1234,slntmm01:43401,sluxmm09:43302;version=4;autoCommitTxn=ON;partialResultsMode=YES;ApplicationName=Client", p); //$NON-NLS-1$
+ TeiidDriver.parseURL("jdbc:teiid:BQT@mm://slwxp157:1234,slntmm01:43401,sluxmm09:43302;version=4;autoCommitTxn=ON;partialResultsMode=YES;ApplicationName=Client", p); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("4")); //$NON-NLS-1$
assertTrue(p.getProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP).equals("ON")); //$NON-NLS-1$
@@ -121,11 +120,11 @@
@Test
public void testIPV6() throws SQLException{
- assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mm://[::1]:53535,127.0.0.1:1234")); //$NON-NLS-1$
- assertTrue(SocketProfile.acceptsURL("jdbc:teiid:vdb@mm://[3ffe:ffff:0100:f101::1]:53535,127.0.0.1:1234")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:vdb@mm://[::1]:53535,127.0.0.1:1234")); //$NON-NLS-1$
+ assertEquals(ConnectionType.Socket, JDBCURL.acceptsUrl("jdbc:teiid:vdb@mm://[3ffe:ffff:0100:f101::1]:53535,127.0.0.1:1234")); //$NON-NLS-1$
Properties p = new Properties();
- SocketProfile.parseURL("jdbc:teiid:BQT@mms://[3ffe:ffff:0100:f101::1]:1234;version=3", p); //$NON-NLS-1$
+ TeiidDriver.parseURL("jdbc:teiid:BQT@mms://[3ffe:ffff:0100:f101::1]:1234;version=3", p); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("3")); //$NON-NLS-1$
assertTrue(p.getProperty(TeiidURL.CONNECTION.SERVER_URL).equals("mms://[3ffe:ffff:0100:f101::1]:1234")); //$NON-NLS-1$
@@ -135,7 +134,7 @@
@Test
public void testIPV6MultipleHosts() throws SQLException{
Properties p = new Properties();
- SocketProfile.parseURL("jdbc:teiid:BQT@mms://[3ffe:ffff:0100:f101::1]:1234,[::1]:31000,127.0.0.1:2134;version=3", p); //$NON-NLS-1$
+ TeiidDriver.parseURL("jdbc:teiid:BQT@mms://[3ffe:ffff:0100:f101::1]:1234,[::1]:31000,127.0.0.1:2134;version=3", p); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("3")); //$NON-NLS-1$
assertTrue(p.getProperty(TeiidURL.CONNECTION.SERVER_URL).equals("mms://[3ffe:ffff:0100:f101::1]:1234,[::1]:31000,127.0.0.1:2134")); //$NON-NLS-1$
Modified: trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDataSource.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDataSource.java 2011-02-24 04:55:53 UTC (rev 2936)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDataSource.java 2011-02-24 17:57:38 UTC (rev 2937)
@@ -27,14 +27,12 @@
import java.sql.Connection;
import java.sql.SQLException;
+import junit.framework.TestCase;
+
import org.teiid.client.RequestMessage.ShowPlan;
import org.teiid.core.util.UnitTestUtil;
-import org.teiid.jdbc.BaseDataSource;
-import org.teiid.jdbc.TeiidDataSource;
-import junit.framework.TestCase;
-
-
+@SuppressWarnings("nls")
public class TestTeiidDataSource extends TestCase {
protected static final boolean VALID = true;
@@ -102,9 +100,7 @@
return TeiidDataSource.reasonWhyInvalidSocketsPerVM(value);
} else if ( propertyName.equals("stickyConnections")) { //$NON-NLS-1$
return TeiidDataSource.reasonWhyInvalidStickyConnections(value);
- } else if ( propertyName.equals("alternateServers")) { //$NON-NLS-1$
- return TeiidDataSource.reasonWhyInvalidAlternateServers(value);
- }
+ }
fail("Unknown property name \"" + propertyName + "\""); //$NON-NLS-1$ //$NON-NLS-2$
return null;
@@ -159,7 +155,12 @@
ds.setSecure(secure);
ds.setAlternateServers(alternateServers);
- final String url = ds.buildURL();
+ String url;
+ try {
+ url = ds.buildURL().getJDBCURL();
+ } catch (TeiidSQLException e) {
+ throw new RuntimeException(e);
+ }
assertEquals(expectedURL, url);
}
@@ -336,7 +337,7 @@
helpTestReasonWhyInvalid("PortNumber", 1, VALID); //$NON-NLS-1$
}
public void testReasonWhyInvalidPortNumber2() {
- helpTestReasonWhyInvalid("PortNumber", 9999999, VALID); //$NON-NLS-1$
+ helpTestReasonWhyInvalid("PortNumber", 9999999, INVALID); //$NON-NLS-1$
}
public void testReasonWhyInvalidPortNumber3() {
helpTestReasonWhyInvalid("PortNumber", 0, VALID); //$NON-NLS-1$
@@ -406,62 +407,76 @@
helpTestReasonWhyInvalid("stickyConnections", "YES", INVALID); //$NON-NLS-1$ //$NON-NLS-2$
}
+ public void helpTestAlternateServer(String altServers, boolean valid) {
+ this.dataSource.setAlternateServers(altServers);
+ try {
+ this.dataSource.buildURL();
+ if (!valid) {
+ fail("expected exception");
+ }
+ } catch (TeiidSQLException e) {
+ if (valid) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
public void testReasonWhyInvalidAlternateServers1() {
- helpTestReasonWhyInvalid("alternateServers", null, VALID); //$NON-NLS-1$
+ helpTestAlternateServer(null, VALID);
}
public void testReasonWhyInvalidAlternateServers2() {
- helpTestReasonWhyInvalid("alternateServers", "", VALID); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestAlternateServer("", VALID); //$NON-NLS-1$
}
public void testReasonWhyInvalidAlternateServers3() {
- helpTestReasonWhyInvalid("alternateServers", "server", VALID); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestAlternateServer("server", VALID); //$NON-NLS-1$
}
public void testReasonWhyInvalidAlternateServers4() {
- helpTestReasonWhyInvalid("alternateServers", "server:100", VALID); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestAlternateServer("server:100", VALID); //$NON-NLS-1$
}
public void testReasonWhyInvalidAlternateServers5() {
- helpTestReasonWhyInvalid("alternateServers", "server:port", INVALID); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestAlternateServer("server:port", INVALID); //$NON-NLS-1$
}
public void testReasonWhyInvalidAlternateServers6() {
- helpTestReasonWhyInvalid("alternateServers", "server:100:1", INVALID); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestAlternateServer("server:100:1", INVALID); //$NON-NLS-1$
}
public void testReasonWhyInvalidAlternateServers7() {
- helpTestReasonWhyInvalid("alternateServers", "server:100:abc", INVALID); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestAlternateServer("server:100:abc", INVALID); //$NON-NLS-1$
}
public void testReasonWhyInvalidAlternateServers8() {
- helpTestReasonWhyInvalid("alternateServers", "server:abc:100", INVALID); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestAlternateServer("server:abc:100", INVALID); //$NON-NLS-1$
}
public void testReasonWhyInvalidAlternateServers9() {
- helpTestReasonWhyInvalid("alternateServers", ":100", INVALID); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestAlternateServer(":100", INVALID); //$NON-NLS-1$
}
public void testReasonWhyInvalidAlternateServers10() {
- helpTestReasonWhyInvalid("alternateServers", ":abc", INVALID); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestAlternateServer(":abc", INVALID); //$NON-NLS-1$
}
public void testReasonWhyInvalidAlternateServers11() {
- helpTestReasonWhyInvalid("alternateServers", "server1:100,server2", VALID); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestAlternateServer("server1:100,server2", VALID); //$NON-NLS-1$
}
public void testReasonWhyInvalidAlternateServers12() {
- helpTestReasonWhyInvalid("alternateServers", "server1:100,server2:101", VALID); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestAlternateServer("server1:100,server2:101", VALID); //$NON-NLS-1$
}
public void testReasonWhyInvalidAlternateServers13() {
- helpTestReasonWhyInvalid("alternateServers", "server1:100,", VALID); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestAlternateServer("server1:100,", VALID); //$NON-NLS-1$
}
public void testReasonWhyInvalidAlternateServers14() {
- helpTestReasonWhyInvalid("alternateServers", "server1:100,server2:abc", INVALID); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestAlternateServer("server1:100,server2:abc", INVALID); //$NON-NLS-1$
}
public void testReasonWhyInvalidAlternateServers15() {
- helpTestReasonWhyInvalid("alternateServers", "server1:100,server2:101:abc", INVALID); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestAlternateServer("server1:100,server2:101:abc", INVALID); //$NON-NLS-1$
}
public void testReasonWhyInvalidAlternateServers16() {
- helpTestReasonWhyInvalid("alternateServers", "server1,server2:100", VALID); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestAlternateServer("server1,server2:100", VALID); //$NON-NLS-1$
}
public void testReasonWhyInvalidAlternateServers17() {
- helpTestReasonWhyInvalid("alternateServers", "server1,server2", VALID); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestAlternateServer("server1,server2", VALID); //$NON-NLS-1$
}
public void testReasonWhyInvalidAlternateServers18() {
- helpTestReasonWhyInvalid("alternateServers", ",server2:100", INVALID); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestAlternateServer(",server2:100", INVALID); //$NON-NLS-1$
}
public void testReasonWhyInvalidAlternateServers19() {
- helpTestReasonWhyInvalid("alternateServers", "server1,server2,server3,server4:500", VALID); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestAlternateServer("server1,server2,server3,server4:500", VALID); //$NON-NLS-1$
}
@@ -612,13 +627,13 @@
"jdbc:teiid:vdbName@mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;ApplicationName=JDBC;SHOWPLAN=ON;partialResultsMode=false;autoCommitTxn=DETECT;VirtualDatabaseName=vdbName"); //$NON-NLS-1$
}
- public void testBuildURL_AdditionalProperties() {
+ public void testBuildURL_AdditionalProperties() throws TeiidSQLException {
final TeiidDataSource ds = new TeiidDataSource();
ds.setAdditionalProperties("foo=bar;a=b"); //$NON-NLS-1$
ds.setServerName("hostName"); //$NON-NLS-1$
ds.setDatabaseName("vdbName"); //$NON-NLS-1$
ds.setPortNumber(1);
- assertEquals("jdbc:teiid:vdbName@mm://hostname:1;fetchSize=2048;ApplicationName=JDBC;a=b;VirtualDatabaseName=vdbName;foo=bar", ds.buildURL()); //$NON-NLS-1$
+ assertEquals("jdbc:teiid:vdbName@mm://hostname:1;fetchSize=2048;ApplicationName=JDBC;a=b;VirtualDatabaseName=vdbName;foo=bar", ds.buildURL().getJDBCURL()); //$NON-NLS-1$
}
public void testInvalidDataSource() {
Modified: trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java 2011-02-24 04:55:53 UTC (rev 2936)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java 2011-02-24 17:57:38 UTC (rev 2937)
@@ -22,9 +22,7 @@
package org.teiid.jdbc;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.*;
import java.sql.DriverPropertyInfo;
import java.util.Properties;
@@ -40,12 +38,12 @@
assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:12345")); //$NON-NLS-1$
assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:12345;user=foo;password=bar")); //$NON-NLS-1$
assertTrue(drv.acceptsURL("jdbc:teiid:vdb")); //$NON-NLS-1$
- assertFalse(drv.acceptsURL("jdbc:teiid:vdb@/foo/blah/deploy.properties")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@/foo/blah/deploy.properties")); //$NON-NLS-1$
assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:12345")); //$NON-NLS-1$
assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:12345;user=foo;password=bar")); //$NON-NLS-1$
assertTrue(drv.acceptsURL("jdbc:teiid:vdb")); //$NON-NLS-1$
- assertFalse(drv.acceptsURL("jdbc:teiid:vdb@/foo/blah/deploy.properties")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@/foo/blah/deploy.properties")); //$NON-NLS-1$
assertTrue(drv.acceptsURL("jdbc:teiid:8294601c-9fe9-4244-9499-4a012c5e1476_vdb")); //$NON-NLS-1$
assertTrue(drv.acceptsURL("jdbc:teiid:8294601c-9fe9-4244-9499-4a012c5e1476_vdb@mm://localhost:12345")); //$NON-NLS-1$
assertTrue(drv.acceptsURL("jdbc:teiid:test_vdb@mm://local-host:12345")); //$NON-NLS-1$
@@ -77,12 +75,12 @@
assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://123.123.123.123:53535,127.0.0.1:1234")); //$NON-NLS-1$
//DQP type
- assertTrue(!drv.acceptsURL("jdbc:teiid:jvdb@c:/dqp.properties;version=1")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:teiid:jvdb@/foo/dqp.properties;version=1")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:teiid:jvdb@../foo/dqp.properties;version=1")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:jvdb@c:/dqp.properties;version=1")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:jvdb@/foo/dqp.properties;version=1")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:jvdb@../foo/dqp.properties;version=1")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:teiid:jvdb@mm://localhost:port")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:teiid:vdb@localhost:port;version=x")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:jvdb@mm://localhost:port")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@localhost:port;version=x")); //$NON-NLS-1$
assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234")); //$NON-NLS-1$
assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$
assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
@@ -104,7 +102,7 @@
@Test public void testParseURL() throws Exception{
Properties p = new Properties();
- SocketProfile.parseURL("jdbc:teiid:BQT@mm://slwxp157:1234", p); //$NON-NLS-1$
+ TeiidDriver.parseURL("jdbc:teiid:BQT@mm://slwxp157:1234", p); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
assertTrue(p.getProperty(TeiidURL.CONNECTION.SERVER_URL).equals("mm://slwxp157:1234")); //$NON-NLS-1$
assertEquals(3, p.size());
@@ -112,7 +110,7 @@
@Test public void testParseURL2() throws Exception {
Properties p = new Properties();
- SocketProfile.parseURL("jdbc:teiid:BQT@mms://slwxp157:1234;version=3", p); //$NON-NLS-1$
+ TeiidDriver.parseURL("jdbc:teiid:BQT@mms://slwxp157:1234;version=3", p); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("3")); //$NON-NLS-1$
assertTrue(p.getProperty(TeiidURL.CONNECTION.SERVER_URL).equals("mms://slwxp157:1234")); //$NON-NLS-1$
@@ -123,7 +121,7 @@
@Test public void testParseURL3() throws Exception{
Properties p = new Properties();
- SocketProfile.parseURL("jdbc:teiid:BQT@mm://slwxp157:1234,slntmm01:43401,sluxmm09:43302;version=4;autoCommitTxn=ON;partialResultsMode=YES;ApplicationName=Client", p); //$NON-NLS-1$
+ TeiidDriver.parseURL("jdbc:teiid:BQT@mm://slwxp157:1234,slntmm01:43401,sluxmm09:43302;version=4;autoCommitTxn=ON;partialResultsMode=YES;ApplicationName=Client", p); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("4")); //$NON-NLS-1$
assertTrue(p.getProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP).equals("ON")); //$NON-NLS-1$
Modified: trunk/client/src/test/java/org/teiid/net/TestTeiidURL.java
===================================================================
--- trunk/client/src/test/java/org/teiid/net/TestTeiidURL.java 2011-02-24 04:55:53 UTC (rev 2936)
+++ trunk/client/src/test/java/org/teiid/net/TestTeiidURL.java 2011-02-24 17:57:38 UTC (rev 2937)
@@ -22,18 +22,18 @@
package org.teiid.net;
+import static org.junit.Assert.*;
+
+import java.net.MalformedURLException;
import java.util.List;
import org.junit.Test;
-import static org.junit.Assert.*;
public class TestTeiidURL {
- public static final String REQUIRED_URL = TeiidURL.FORMAT_SERVER;
-
@Test
- public final void testTeiidURL() {
+ public final void testTeiidURL() throws Exception {
String SERVER_URL = "mm://localhost:31000"; //$NON-NLS-1$
assertTrue(TeiidURL.isValidServerURL(SERVER_URL));
@@ -44,7 +44,7 @@
}
@Test
- public final void testTeiidURLIPv6() {
+ public final void testTeiidURLIPv6() throws Exception {
String SERVER_URL = "mm://[3ffe:ffff:0100:f101::1]:31000"; //$NON-NLS-1$
assertTrue(TeiidURL.isValidServerURL(SERVER_URL));
@@ -57,33 +57,19 @@
}
@Test
- public final void testBogusProtocol() {
+ public final void testBogusProtocol() throws Exception {
String SERVER_URL = "foo://localhost:31000"; //$NON-NLS-1$
assertFalse(TeiidURL.isValidServerURL(SERVER_URL));
-
- try {
- new TeiidURL(SERVER_URL);
- fail("MM URL passed non standard protocal fine"); //$NON-NLS-1$
- } catch (RuntimeException e) {
- assertEquals(TeiidURL.INVALID_FORMAT_SERVER, e.getMessage());
- }
}
@Test
public final void testBogusProtocol1() {
String SERVER_URL = "foo://localhost:31000"; //$NON-NLS-1$
assertFalse(TeiidURL.isValidServerURL(SERVER_URL));
-
- try {
- new TeiidURL(SERVER_URL);
- fail("MM URL passed non standard protocal fine"); //$NON-NLS-1$
- } catch (RuntimeException e) {
- assertEquals(TeiidURL.INVALID_FORMAT_SERVER, e.getMessage());
- }
}
@Test
- public final void testTeiidURLSecure() {
+ public final void testTeiidURLSecure() throws Exception {
String SERVER_URL = "mms://localhost:31000"; //$NON-NLS-1$
assertTrue(TeiidURL.isValidServerURL(SERVER_URL));
@@ -97,94 +83,50 @@
public final void testTeiidURLBadProtocolMM() {
String SERVER_URL = "mmm://localhost:31000"; //$NON-NLS-1$
assertFalse(TeiidURL.isValidServerURL(SERVER_URL));
-
- try {
- new TeiidURL(SERVER_URL);
- fail("MMURL did not throw an exception"); //$NON-NLS-1$
- } catch( IllegalArgumentException e ) {
- assertEquals(TeiidURL.INVALID_FORMAT_SERVER,e.getMessage());
- }
}
@Test
public final void testTeiidURLWrongSlash() {
String SERVER_URL = "mm:\\\\localhost:31000"; //$NON-NLS-1$
assertFalse(TeiidURL.isValidServerURL(SERVER_URL));
-
- try {
- new TeiidURL(SERVER_URL);
- fail("MMURL did not throw an exception"); //$NON-NLS-1$
- } catch( IllegalArgumentException e ) {
- assertEquals(TeiidURL.INVALID_FORMAT_SERVER,e.getMessage());
- }
}
@Test
public final void testTeiidURLOneSlash() {
String SERVER_URL = "mm:/localhost:31000"; //$NON-NLS-1$
assertFalse(TeiidURL.isValidServerURL(SERVER_URL));
-
- try {
- new TeiidURL(SERVER_URL);
- fail("MMURL did not throw an exception"); //$NON-NLS-1$
- } catch( IllegalArgumentException e ) {
- assertEquals(TeiidURL.INVALID_FORMAT_SERVER,e.getMessage());
- }
}
- @Test
- public final void testTeiidURLNoHost() {
+ @Test(expected=MalformedURLException.class)
+ public final void testTeiidURLNoHost() throws Exception {
String SERVER_URL = "mm://:31000"; //$NON-NLS-1$
assertFalse(TeiidURL.isValidServerURL(SERVER_URL));
- try {
- new TeiidURL(SERVER_URL);
- fail("MMURL did not throw an exception"); //$NON-NLS-1$
- } catch( IllegalArgumentException e ) {
- assertEquals(TeiidURL.INVALID_FORMAT_SERVER,e.getMessage());
- }
+ new TeiidURL(SERVER_URL);
}
- @Test
- public final void testTeiidURLNoHostAndPort() {
+ @Test(expected=MalformedURLException.class)
+ public final void testTeiidURLNoHostAndPort() throws Exception {
String SERVER_URL = "mm://:"; //$NON-NLS-1$
assertFalse(TeiidURL.isValidServerURL(SERVER_URL));
- try {
- new TeiidURL(SERVER_URL);
- fail("MMURL did not throw an exception"); //$NON-NLS-1$
- } catch( IllegalArgumentException e ) {
- assertEquals(TeiidURL.INVALID_FORMAT_SERVER,e.getMessage());
- }
+ new TeiidURL(SERVER_URL);
}
@Test
public final void testTeiidURLNoHostAndPort2() {
String SERVER_URL = "mm://"; //$NON-NLS-1$
assertFalse(TeiidURL.isValidServerURL(SERVER_URL));
-
- try {
- new TeiidURL(SERVER_URL);
- fail("MMURL did not throw an exception"); //$NON-NLS-1$
- } catch( IllegalArgumentException e ) {
- assertEquals(TeiidURL.INVALID_FORMAT_SERVER,e.getMessage());
- }
}
@Test
public final void testTeiidURLBadPort() {
String SERVER_URL = "mm://localhost:port"; //$NON-NLS-1$
assertFalse(TeiidURL.isValidServerURL(SERVER_URL));
-
- try {
- new TeiidURL(SERVER_URL);
- fail("MMURL did not throw an Exception"); //$NON-NLS-1$
- } catch( IllegalArgumentException e ) {
- }
}
@Test
- public final void testTeiidURL2Hosts() {
+ public final void testTeiidURL2Hosts() throws Exception {
String SERVER_URL = "mm://localhost:31000,localhost:31001"; //$NON-NLS-1$
assertTrue(TeiidURL.isValidServerURL(SERVER_URL));
@@ -195,7 +137,7 @@
}
@Test
- public final void testTeiidIPv6URL2Hosts() {
+ public final void testTeiidIPv6URL2Hosts() throws Exception {
String SERVER_URL = "mm://[3ffe:ffff:0100:f101::1]:31000,[::1]:31001, 127.0.0.1:31003"; //$NON-NLS-1$
assertTrue(TeiidURL.isValidServerURL(SERVER_URL));
@@ -210,7 +152,7 @@
}
@Test
- public final void testTeiidURL3Hosts() {
+ public final void testTeiidURL3Hosts() throws Exception {
String SERVER_URL = "mm://localhost:31000,localhost:31001,localhost:31002"; //$NON-NLS-1$
assertTrue(TeiidURL.isValidServerURL(SERVER_URL));
@@ -221,7 +163,7 @@
}
@Test
- public final void testGetHostInfo() {
+ public final void testGetHostInfo() throws Exception {
String SERVER_URL = "mm://localhost:31000"; //$NON-NLS-1$
assertTrue(TeiidURL.isValidServerURL(SERVER_URL));
@@ -230,27 +172,27 @@
}
@Test
- public final void testGetProtocolStandalone() {
+ public final void testGetProtocolStandalone() throws Exception {
TeiidURL url = new TeiidURL("mm://localhost:31000"); //$NON-NLS-1$
assertNotNull(url);
assertEquals("mm://localhost:31000",url.getAppServerURL()); //$NON-NLS-1$
}
@Test
- public final void testHasMoreElements() {
+ public final void testHasMoreElements() throws Exception {
TeiidURL url = new TeiidURL("mm://localhost:31000,localhost:31001"); //$NON-NLS-1$
assertNotNull(url);
assertFalse(url.getHostInfo().isEmpty());
}
@Test
- public final void testNextElement() {
+ public final void testNextElement() throws Exception {
TeiidURL url = new TeiidURL("mm://localhost:31000,localhost:31001"); //$NON-NLS-1$
assertEquals(2, url.getHostInfo().size());
}
@Test
- public final void testHostInfoEquals() {
+ public final void testHostInfoEquals() throws Exception {
HostInfo expectedResults = new HostInfo("localhost",31000); //$NON-NLS-1$
TeiidURL url = new TeiidURL("mm://localhost:31000"); //$NON-NLS-1$
HostInfo actualResults = url.getHostInfo().get(0);
@@ -258,7 +200,7 @@
}
@Test
- public final void testWithEmbeddedSpaces() {
+ public final void testWithEmbeddedSpaces() throws Exception {
HostInfo expectedResults = new HostInfo("localhost",12345); //$NON-NLS-1$
TeiidURL url = new TeiidURL("mm://localhost : 12345"); //$NON-NLS-1$
Modified: trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2011-02-24 04:55:53 UTC (rev 2936)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2011-02-24 17:57:38 UTC (rev 2937)
@@ -151,7 +151,7 @@
public ConnectionImpl createConnection(String embeddedURL) throws Exception {
final Properties p = new Properties();
- EmbeddedProfile.parseURL(embeddedURL, p);
+ TeiidDriver.parseURL(embeddedURL, p);
LocalServerConnection conn = new LocalServerConnection(p) {
@Override
14 years
teiid SVN: r2936 - in trunk/engine/src: main/java/org/teiid/dqp/internal/process and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-02-23 23:55:53 -0500 (Wed, 23 Feb 2011)
New Revision: 2936
Modified:
trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
Log:
TEIID-1463 limiting forward only cursors to a 20 batch buffer.
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java 2011-02-23 21:50:25 UTC (rev 2935)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java 2011-02-24 04:55:53 UTC (rev 2936)
@@ -245,6 +245,24 @@
}
}
+ /**
+ * Returns the total number of rows contained in managed batches
+ * @return
+ */
+ public int getManagedRowCount() {
+ if (!this.batches.isEmpty()) {
+ int start = this.batches.firstKey();
+ return rowCount - start + 1;
+ } else if (this.batchBuffer != null) {
+ return this.batchBuffer.size();
+ }
+ return 0;
+ }
+
+ /**
+ * Returns the last row number
+ * @return
+ */
public int getRowCount() {
return rowCount;
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2011-02-23 21:50:25 UTC (rev 2935)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2011-02-24 04:55:53 UTC (rev 2936)
@@ -416,6 +416,13 @@
add = sendResultsIfNeeded(batch);
if (!added) {
super.flushBatchDirect(batch, add);
+ //restrict the buffer size for forward only results
+ if (add
+ && !batch.getTerminationFlag()
+ && this.getTupleBuffer().getManagedRowCount() >= 20 * this.getTupleBuffer().getBatchSize()) {
+ //requestMore will trigger more processing
+ throw BlockedException.INSTANCE;
+ }
}
}
};
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2011-02-23 21:50:25 UTC (rev 2935)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2011-02-24 04:55:53 UTC (rev 2936)
@@ -38,8 +38,10 @@
import org.teiid.cache.DefaultCacheFactory;
import org.teiid.client.RequestMessage;
import org.teiid.client.ResultsMessage;
+import org.teiid.common.buffer.impl.BufferManagerImpl;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
import org.teiid.dqp.internal.datamgr.FakeTransactionService;
+import org.teiid.dqp.internal.process.AbstractWorkItem.ThreadState;
import org.teiid.dqp.service.AutoGenDataService;
import org.teiid.dqp.service.FakeBufferService;
import org.teiid.query.unittest.FakeMetadataFactory;
@@ -181,6 +183,44 @@
@Test public void testCancel() throws Exception {
assertFalse(this.core.cancelRequest(1L));
}
+
+ @Test public void testBufferLimit() throws Exception {
+ //the sql should return 100 rows
+ String sql = "SELECT A.IntKey FROM BQT1.SmallA as A, BQT1.SmallA as B"; //$NON-NLS-1$
+ String userName = "1"; //$NON-NLS-1$
+ String sessionid = "1"; //$NON-NLS-1$
+
+ RequestMessage reqMsg = exampleRequestMessage(sql);
+ reqMsg.setCursorType(ResultSet.TYPE_FORWARD_ONLY);
+ DQPWorkContext.getWorkContext().getSession().setSessionId(sessionid);
+ DQPWorkContext.getWorkContext().getSession().setUserName(userName);
+ ((BufferManagerImpl)core.getBufferManager()).setProcessorBatchSize(2);
+ Future<ResultsMessage> message = core.executeRequest(reqMsg.getExecutionId(), reqMsg);
+ ResultsMessage rm = message.get(5000, TimeUnit.MILLISECONDS);
+ assertNull(rm.getException());
+ assertEquals(2, rm.getResults().length);
+ RequestWorkItem item = core.getRequestWorkItem(DQPWorkContext.getWorkContext().getRequestID(reqMsg.getExecutionId()));
+
+ message = core.processCursorRequest(reqMsg.getExecutionId(), 3, 2);
+ rm = message.get(5000, TimeUnit.MILLISECONDS);
+ assertNull(rm.getException());
+ assertEquals(2, rm.getResults().length);
+ //ensure that we are idle
+ for (int i = 0; i < 10 && item.getThreadState() != ThreadState.IDLE; i++) {
+ Thread.sleep(100);
+ }
+ assertEquals(ThreadState.IDLE, item.getThreadState());
+ assertEquals(46, item.resultsBuffer.getRowCount());
+ //pull the rest of the results
+ for (int j = 0; j < 48; j++) {
+ item = core.getRequestWorkItem(DQPWorkContext.getWorkContext().getRequestID(reqMsg.getExecutionId()));
+
+ message = core.processCursorRequest(reqMsg.getExecutionId(), j * 2 + 5, 2);
+ rm = message.get(5000, TimeUnit.MILLISECONDS);
+ assertNull(rm.getException());
+ assertEquals(2, rm.getResults().length);
+ }
+ }
public void helpTestVisibilityFails(String sql) throws Exception {
RequestMessage reqMsg = exampleRequestMessage(sql);
14 years
teiid SVN: r2935 - branches/7.1.x/test-integration/common/src/test/resources/TestODBCSchema.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2011-02-23 16:50:25 -0500 (Wed, 23 Feb 2011)
New Revision: 2935
Modified:
branches/7.1.x/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected
branches/7.1.x/test-integration/common/src/test/resources/TestODBCSchema/test_PG_TYPE.expected
Log:
TEIID-1477: Fixing the unit tests that failed because of the odbc type bug fix
Modified: branches/7.1.x/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected
===================================================================
--- branches/7.1.x/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected 2011-02-23 18:51:19 UTC (rev 2934)
+++ branches/7.1.x/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected 2011-02-23 21:50:25 UTC (rev 2935)
@@ -25,18 +25,18 @@
22 5 Valid 16 0 6 0 false false false
23 5 LoadState 1043 255 7 255 false false false
24 5 Updated 1114 0 8 0 false false false
-25 5 Cardinality <null> 10 9 10 false false false
+25 5 Cardinality 23 10 9 10 false false false
26 6 resourcePath 1043 255 1 255 false false false
27 6 contents 14939 0 2 0 false false false
28 7 VDBName 1043 255 1 255 false false false
29 7 SchemaName 1043 255 2 255 false false false
30 7 TableName 1043 255 3 255 false false false
31 7 Name 1043 255 4 255 false false false
-32 7 Position <null> 10 5 10 false false false
+32 7 Position 23 10 5 10 false false false
33 7 NameInSource 1043 255 6 255 false false false
34 7 DataType 1043 100 7 100 false false false
-35 7 Scale <null> 10 8 10 false false false
-36 7 Length <null> 10 9 10 false false false
+35 7 Scale 23 10 8 10 false false false
+36 7 Length 23 10 9 10 false false false
37 7 IsLengthFixed 16 1 10 1 false false false
38 7 SupportsSelect 16 1 11 1 false false false
39 7 SupportsUpdates 16 1 12 1 false false false
@@ -51,31 +51,31 @@
48 7 Format 1043 255 21 255 false false false
49 7 DefaultValue 1043 255 22 255 false false false
50 7 JavaClass 1043 500 23 500 false false false
-51 7 Precision <null> 10 24 10 false false false
-52 7 CharOctetLength <null> 10 25 10 false false false
-53 7 Radix <null> 10 26 10 false false false
+51 7 Precision 23 10 24 10 false false false
+52 7 CharOctetLength 23 10 25 10 false false false
+53 7 Radix 23 10 26 10 false false false
54 7 UID 1043 50 27 50 false false false
55 7 Description 1043 255 28 255 false false false
-56 7 OID <null> 10 29 10 false false false
+56 7 OID 23 10 29 10 false false false
57 8 Name 1043 100 1 100 false false false
58 8 IsStandard 16 1 2 1 false false false
59 8 IsPhysical 16 1 3 1 false false false
60 8 TypeName 1043 100 4 100 false false false
61 8 JavaClass 1043 500 5 500 false false false
-62 8 Scale <null> 10 6 10 false false false
-63 8 TypeLength <null> 10 7 10 false false false
+62 8 Scale 23 10 6 10 false false false
+63 8 TypeLength 23 10 7 10 false false false
64 8 NullType 1043 20 8 20 false false false
65 8 IsSigned 16 1 9 1 false false false
66 8 IsAutoIncremented 16 1 10 1 false false false
67 8 IsCaseSensitive 16 1 11 1 false false false
-68 8 Precision <null> 10 12 10 false false false
-69 8 Radix <null> 10 13 10 false false false
+68 8 Precision 23 10 12 10 false false false
+69 8 Radix 23 10 13 10 false false false
70 8 SearchType 1043 20 14 20 false false false
71 8 UID 1043 50 15 50 false false false
72 8 RuntimeType 1043 64 16 64 false false false
73 8 BaseType 1043 64 17 64 false false false
74 8 Description 1043 255 18 255 false false false
-75 8 OID <null> 10 19 10 false false false
+75 8 OID 23 10 19 10 false false false
76 9 VDBName 1043 255 1 255 false false false
77 9 SchemaName 1043 255 2 255 false false false
78 9 TableName 1043 2048 3 2048 false false false
@@ -84,8 +84,8 @@
81 9 KeyType 1043 20 6 20 false false false
82 9 RefKeyUID 1043 50 7 50 false false false
83 9 UID 1043 50 8 50 false false false
-84 9 Position <null> 10 9 10 false false false
-85 9 OID <null> 10 10 10 false false false
+84 9 Position 23 10 9 10 false false false
+85 9 OID 23 10 10 10 false false false
86 10 VDBName 1043 255 1 255 false false false
87 10 SchemaName 1043 255 2 255 false false false
88 10 TableName 1043 2048 3 2048 false false false
@@ -96,23 +96,23 @@
93 10 IsIndexed 16 1 8 1 false false false
94 10 RefKeyUID 1043 50 9 50 false false false
95 10 UID 1043 50 10 50 false false false
-96 10 OID <null> 10 11 10 false false false
+96 10 OID 23 10 11 10 false false false
97 11 VDBName 1043 255 1 255 false false false
98 11 SchemaName 1043 255 2 255 false false false
99 11 ProcedureName 1043 255 3 255 false false false
100 11 Name 1043 255 4 255 false false false
101 11 DataType 1043 25 5 25 false false false
-102 11 Position <null> 10 6 10 false false false
+102 11 Position 23 10 6 10 false false false
103 11 Type 1043 100 7 100 false false false
104 11 Optional 16 1 8 1 false false false
-105 11 Precision <null> 10 9 10 false false false
-106 11 TypeLength <null> 10 10 10 false false false
-107 11 Scale <null> 10 11 10 false false false
-108 11 Radix <null> 10 12 10 false false false
+105 11 Precision 23 10 9 10 false false false
+106 11 TypeLength 23 10 10 10 false false false
+107 11 Scale 23 10 11 10 false false false
+108 11 Radix 23 10 12 10 false false false
109 11 NullType 1043 10 13 10 false false false
110 11 UID 1043 50 14 50 false false false
111 11 Description 1043 255 15 255 false false false
-112 11 OID <null> 10 16 10 false false false
+112 11 OID 23 10 16 10 false false false
113 12 VDBName 1043 255 1 255 false false false
114 12 SchemaName 1043 255 2 255 false false false
115 12 Name 1043 255 3 255 false false false
@@ -120,11 +120,11 @@
117 12 ReturnsResults 16 1 5 1 false false false
118 12 UID 1043 50 6 50 false false false
119 12 Description 1043 255 7 255 false false false
-120 12 OID <null> 10 8 10 false false false
+120 12 OID 23 10 8 10 false false false
121 13 Name 1043 255 1 255 false false false
122 13 Value 1043 255 2 255 false false false
123 13 UID 1043 50 3 50 false false false
-124 13 OID <null> 10 4 10 false false false
+124 13 OID 23 10 4 10 false false false
125 14 PKTABLE_CAT 1043 255 1 255 false false false
126 14 PKTABLE_SCHEM 1043 255 2 255 false false false
127 14 PKTABLE_NAME 1043 255 3 255 false false false
@@ -134,18 +134,18 @@
131 14 FKTABLE_NAME 1043 255 7 255 false false false
132 14 FKCOLUMN_NAME 1043 255 8 255 false false false
133 14 KEY_SEQ 21 5 9 5 false false false
-134 14 UPDATE_RULE <null> 10 10 10 false false false
-135 14 DELETE_RULE <null> 10 11 10 false false false
+134 14 UPDATE_RULE 23 10 10 10 false false false
+135 14 DELETE_RULE 23 10 11 10 false false false
136 14 FK_NAME 1043 255 12 255 false false false
137 14 PK_NAME 1043 255 13 255 false false false
-138 14 DEFERRABILITY <null> 10 14 10 false false false
+138 14 DEFERRABILITY 23 10 14 10 false false false
139 15 VDBName 1043 255 1 255 false false false
140 15 Name 1043 255 2 255 false false false
141 15 IsPhysical 16 1 3 1 false false false
142 15 UID 1043 50 4 50 false false false
143 15 Description 1043 255 5 255 false false false
144 15 PrimaryMetamodelURI 1043 255 6 255 false false false
-145 15 OID <null> 10 7 10 false false false
+145 15 OID 23 10 7 10 false false false
146 16 VDBName 1043 255 1 255 false false false
147 16 SchemaName 1043 255 2 255 false false false
148 16 Name 1043 255 3 255 false false false
@@ -154,85 +154,85 @@
151 16 IsPhysical 16 1 6 1 false false false
152 16 SupportsUpdates 16 1 7 1 false false false
153 16 UID 1043 50 8 50 false false false
-154 16 Cardinality <null> 10 9 10 false false false
+154 16 Cardinality 23 10 9 10 false false false
155 16 Description 1043 255 10 255 false false false
156 16 IsSystem 16 1 11 1 false false false
157 16 IsMaterialized 16 0 12 0 false false false
-158 16 OID <null> 10 13 10 false false false
+158 16 OID 23 10 13 10 false false false
159 17 Name 1043 255 1 255 false false false
160 17 Version 1043 50 2 50 false false false
-161 18 oid <null> 0 1 0 false false false
+161 18 oid 23 0 1 0 false false false
162 18 nspname 1043 0 2 0 false false false
-163 19 oid <null> 0 1 0 false false false
+163 19 oid 23 0 1 0 false false false
164 19 relname 1043 0 2 0 false false false
-165 19 relnamespace <null> 0 3 0 false false false
+165 19 relnamespace 23 0 3 0 false false false
166 19 relkind 1042 0 4 0 false false false
-167 19 relam <null> 0 5 0 false false false
+167 19 relam 23 0 5 0 false false false
168 19 reltuples 700 0 6 0 false false false
-169 19 relpages <null> 0 7 0 false false false
+169 19 relpages 23 0 7 0 false false false
170 19 relhasrules 16 0 8 0 false false false
171 19 relhasoids 1043 0 9 0 false false false
-172 20 oid <null> 0 1 0 false false false
-173 20 attrelid <null> 0 2 0 false false false
+172 20 oid 23 0 1 0 false false false
+173 20 attrelid 23 0 2 0 false false false
174 20 attname 1043 0 3 0 false false false
-175 20 atttypid <null> 0 4 0 false false false
+175 20 atttypid 23 0 4 0 false false false
176 20 attlen 21 0 5 0 false false false
177 20 attnum 21 0 6 0 false false false
-178 20 atttypmod <null> 0 7 0 false false false
+178 20 atttypmod 23 0 7 0 false false false
179 20 attnotnull 16 0 8 0 false false false
180 20 attisdropped 16 0 9 0 false false false
181 20 atthasdef 16 0 10 0 false false false
-182 21 oid <null> 0 1 0 false false false
+182 21 oid 23 0 1 0 false false false
183 21 typname 1043 0 2 0 false false false
-184 21 typnamespace <null> 0 3 0 false false false
+184 21 typnamespace 23 0 3 0 false false false
185 21 typlen 21 0 4 0 false false false
186 21 typtype 1042 0 5 0 false false false
-187 21 typbasetype <null> 0 6 0 false false false
-188 21 typtypmod <null> 0 7 0 false false false
-189 21 typrelid <null> 0 8 0 false false false
-190 22 oid <null> 0 1 0 false false false
-191 22 indexrelid <null> 0 2 0 false false false
-192 22 indrelid <null> 0 3 0 false false false
+187 21 typbasetype 23 0 6 0 false false false
+188 21 typtypmod 23 0 7 0 false false false
+189 21 typrelid 23 0 8 0 false false false
+190 22 oid 23 0 1 0 false false false
+191 22 indexrelid 23 0 2 0 false false false
+192 22 indrelid 23 0 3 0 false false false
193 22 indisclustered 16 0 4 0 false false false
194 22 indisunique 16 0 5 0 false false false
195 22 indisprimary 16 0 6 0 false false false
196 22 indexprs 1043 0 7 0 false false false
197 22 indkey 1043 0 8 0 false false false
-198 23 oid <null> 0 1 0 false false false
+198 23 oid 23 0 1 0 false false false
199 23 amname 1043 0 2 0 false false false
-200 24 oid <null> 0 1 0 false false false
+200 24 oid 23 0 1 0 false false false
201 24 proname 1043 0 2 0 false false false
202 24 proretset 16 0 3 0 false false false
-203 24 prorettype <null> 0 4 0 false false false
+203 24 prorettype 23 0 4 0 false false false
204 24 pronargs 21 0 5 0 false false false
205 24 proargtypes <null> 0 6 0 false false false
206 24 proargnames <null> 0 7 0 false false false
207 24 proargmodes <null> 0 8 0 false false false
208 24 proallargtypes <null> 0 9 0 false false false
-209 24 pronamespace <null> 0 10 0 false false false
-210 25 oid <null> 0 1 0 false false false
-211 25 tgconstrrelid <null> 0 2 0 false false false
-212 25 tgfoid <null> 0 3 0 false false false
-213 25 tgargs <null> 0 4 0 false false false
-214 25 tgnargs <null> 0 5 0 false false false
+209 24 pronamespace 23 0 10 0 false false false
+210 25 oid 23 0 1 0 false false false
+211 25 tgconstrrelid 23 0 2 0 false false false
+212 25 tgfoid 23 0 3 0 false false false
+213 25 tgargs 23 0 4 0 false false false
+214 25 tgnargs 23 0 5 0 false false false
215 25 tgdeferrable 16 0 6 0 false false false
216 25 tginitdeferred 16 0 7 0 false false false
217 25 tgconstrname 1043 0 8 0 false false false
-218 25 tgrelid <null> 0 9 0 false false false
-219 26 oid <null> 0 1 0 false false false
-220 26 adsrc <null> 0 2 0 false false false
-221 26 adrelid <null> 0 3 0 false false false
-222 26 adnum <null> 0 4 0 false false false
-223 27 oid <null> 0 1 0 false false false
+218 25 tgrelid 23 0 9 0 false false false
+219 26 oid 23 0 1 0 false false false
+220 26 adsrc 23 0 2 0 false false false
+221 26 adrelid 23 0 3 0 false false false
+222 26 adnum 23 0 4 0 false false false
+223 27 oid 23 0 1 0 false false false
224 27 datname 1043 0 2 0 false false false
-225 27 encoding <null> 0 3 0 false false false
-226 27 datlastsysoid <null> 0 4 0 false false false
+225 27 encoding 23 0 3 0 false false false
+226 27 datlastsysoid 23 0 4 0 false false false
227 27 datallowconn 1042 0 5 0 false false false
228 27 datconfig <null> 0 6 0 false false false
229 27 datacl <null> 0 7 0 false false false
-230 27 datdba <null> 0 8 0 false false false
-231 27 dattablespace <null> 0 9 0 false false false
-232 28 oid <null> 0 1 0 false false false
+230 27 datdba 23 0 8 0 false false false
+231 27 dattablespace 23 0 9 0 false false false
+232 28 oid 23 0 1 0 false false false
233 28 usename 1043 0 2 0 false false false
234 28 usecreatedb 16 0 3 0 false false false
235 28 usesuper 16 0 4 0 false false false
Modified: branches/7.1.x/test-integration/common/src/test/resources/TestODBCSchema/test_PG_TYPE.expected
===================================================================
--- branches/7.1.x/test-integration/common/src/test/resources/TestODBCSchema/test_PG_TYPE.expected 2011-02-23 18:51:19 UTC (rev 2934)
+++ branches/7.1.x/test-integration/common/src/test/resources/TestODBCSchema/test_PG_TYPE.expected 2011-02-23 21:50:25 UTC (rev 2935)
@@ -3,7 +3,7 @@
16 boolean 2 1 b 0 -1 0
20 long 2 8 b 0 -1 0
21 short 2 2 b 0 -1 0
-23 int 2 4 b 0 -1 0
+23 integer 2 4 b 0 -1 0
25 text 2 -1 b 0 -1 0
26 oid 2 4 b 0 -1 0
142 xml 2 -1 b 0 -1 0
14 years