Source Code Cross Referenced for MockDatabaseMetaDataTest.java in  » Testing » mockrunner-0.4 » com » mockrunner » test » jdbc » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » mockrunner 0.4 » com.mockrunner.test.jdbc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        package com.mockrunner.test.jdbc;
0002:
0003:        import java.sql.ResultSet;
0004:        import java.sql.SQLException;
0005:        import java.util.List;
0006:
0007:        import junit.framework.TestCase;
0008:
0009:        import com.mockrunner.mock.jdbc.MockDatabaseMetaData;
0010:        import com.mockrunner.mock.jdbc.MockResultSet;
0011:        import com.mockrunner.mock.jdbc.PolyResultSet;
0012:
0013:        public class MockDatabaseMetaDataTest extends TestCase {
0014:            private MockDatabaseMetaData metaData;
0015:
0016:            protected void setUp() throws Exception {
0017:                super .setUp();
0018:                metaData = new MockDatabaseMetaData();
0019:            }
0020:
0021:            protected void tearDown() throws Exception {
0022:                super .tearDown();
0023:                metaData = null;
0024:            }
0025:
0026:            public void testSchemas() throws SQLException {
0027:                assertNull(metaData.getSchemas());
0028:                assertNull(metaData.getSchemas("abc1", "abc2"));
0029:                ResultSet testResult = new MockResultSet("id");
0030:                metaData.setSchemas(testResult);
0031:                assertSame(testResult, metaData.getSchemas());
0032:                assertSame(testResult, metaData.getSchemas(null, null));
0033:                assertSame(testResult, metaData.getSchemas("", "test"));
0034:                assertSame(testResult, metaData.getSchemas("abc1", "test"));
0035:                metaData.clearSchemas();
0036:                assertNull(metaData.getSchemas());
0037:                ResultSet testResult2 = new MockResultSet("id2");
0038:                ResultSet testResult3 = new MockResultSet("id3");
0039:                ResultSet testResult4 = new MockResultSet("id4");
0040:                metaData.setSchemas("", "test1", testResult);
0041:                metaData.setSchemas("abc", "test", testResult2);
0042:                metaData.setSchemas(null, "test", testResult3);
0043:                assertSame(testResult2, metaData.getSchemas("abc", "test"));
0044:                PolyResultSet polyResult = (PolyResultSet) metaData.getSchemas(
0045:                        null, "test");
0046:                List resultSets = polyResult.getUnderlyingResultSetList();
0047:                assertEquals(2, resultSets.size());
0048:                assertTrue(resultSets.contains(testResult2));
0049:                assertTrue(resultSets.contains(testResult3));
0050:                polyResult = (PolyResultSet) metaData.getSchemas();
0051:                resultSets = polyResult.getUnderlyingResultSetList();
0052:                assertEquals(3, resultSets.size());
0053:                assertTrue(resultSets.contains(testResult));
0054:                assertTrue(resultSets.contains(testResult2));
0055:                assertTrue(resultSets.contains(testResult3));
0056:                assertSame(testResult, metaData.getSchemas("", "test1"));
0057:                assertSame(testResult3, metaData.getSchemas("", "test"));
0058:                assertSame(testResult2, metaData.getSchemas("abc", "test"));
0059:                assertNull(metaData.getSchemas(null, "test2"));
0060:                metaData.setSchemas(testResult4);
0061:                assertSame(testResult4, metaData.getSchemas(null, "test3"));
0062:                polyResult = (PolyResultSet) metaData.getSchemas(null, "test");
0063:                resultSets = polyResult.getUnderlyingResultSetList();
0064:                assertEquals(3, resultSets.size());
0065:            }
0066:
0067:            public void testSchemasWithWildcards() throws SQLException {
0068:                ResultSet testResult = new MockResultSet("id");
0069:                metaData.setSchemas("abc", "test", testResult);
0070:                assertSame(testResult, metaData.getSchemas("abc", "test"));
0071:                assertSame(testResult, metaData.getSchemas(null, "t__t"));
0072:                assertSame(testResult, metaData.getSchemas("abc", "tes%"));
0073:                assertSame(testResult, metaData.getSchemas("abc", "%es%"));
0074:                assertSame(testResult, metaData.getSchemas(null, "_est"));
0075:                assertNull(metaData.getSchemas("ab_", "test"));
0076:                assertNull(metaData.getSchemas("a%", "te_t"));
0077:                assertNull(metaData.getSchemas("abc", "t____"));
0078:                assertNull(metaData.getSchemas("abc", "test1%"));
0079:                ResultSet testResult2 = new MockResultSet("id2");
0080:                ResultSet testResult3 = new MockResultSet("id3");
0081:                metaData.setSchemas("abc1", "abc", testResult2);
0082:                metaData.setSchemas("abc2", "abc", testResult3);
0083:                PolyResultSet polyResult = (PolyResultSet) metaData.getSchemas(
0084:                        null, "%");
0085:                assertEquals(3, polyResult.getUnderlyingResultSetList().size());
0086:                assertTrue(metaData.getSchemas("abc1", "%") instanceof  MockResultSet);
0087:                polyResult = (PolyResultSet) metaData.getSchemas(null, "a__");
0088:                assertEquals(2, polyResult.getUnderlyingResultSetList().size());
0089:                assertTrue(metaData.getSchemas(null, "t___") instanceof  MockResultSet);
0090:                assertNull(metaData.getSchemas("%", "%"));
0091:                polyResult = (PolyResultSet) metaData.getSchemas(null, "ab%");
0092:                List resultSets = polyResult.getUnderlyingResultSetList();
0093:                assertEquals(2, resultSets.size());
0094:                assertTrue(resultSets.contains(testResult2));
0095:                assertTrue(resultSets.contains(testResult3));
0096:            }
0097:
0098:            public void testSchemasCaseSensitive() throws SQLException {
0099:                ResultSet testResult = new MockResultSet("id");
0100:                ResultSet testResult2 = new MockResultSet("id2");
0101:                ResultSet testResult3 = new MockResultSet("id3");
0102:                metaData.setSchemas("abc", "TEST", testResult);
0103:                metaData.setSchemas("abc", "test", testResult2);
0104:                metaData.setSchemas(null, "test", testResult3);
0105:                PolyResultSet polyResult = (PolyResultSet) metaData.getSchemas(
0106:                        null, "t_st");
0107:                List resultSets = polyResult.getUnderlyingResultSetList();
0108:                assertEquals(3, resultSets.size());
0109:                metaData.setCaseSensitive(true);
0110:                polyResult = (PolyResultSet) metaData.getSchemas(null, "t_st");
0111:                resultSets = polyResult.getUnderlyingResultSetList();
0112:                assertEquals(2, resultSets.size());
0113:                assertSame(testResult, metaData.getSchemas("abc", "TE%"));
0114:                assertNull(metaData.getSchemas("ABC", "TEST"));
0115:                metaData.setCaseSensitive(false);
0116:                polyResult = (PolyResultSet) metaData.getSchemas("ABC", "TEST");
0117:                resultSets = polyResult.getUnderlyingResultSetList();
0118:                assertEquals(2, resultSets.size());
0119:            }
0120:
0121:            public void testExportedKeys() throws SQLException {
0122:                assertNull(metaData.getExportedKeys(null, null, null));
0123:                assertNull(metaData.getExportedKeys("abc1", "abc2", "abc3"));
0124:                ResultSet testResult = new MockResultSet("id");
0125:                metaData.setExportedKeys(testResult);
0126:                assertSame(testResult, metaData.getExportedKeys(null, null,
0127:                        null));
0128:                assertSame(testResult, metaData.getExportedKeys("", "test",
0129:                        "xyz"));
0130:                assertSame(testResult, metaData.getExportedKeys("abc1", "test",
0131:                        "xyz"));
0132:                metaData.clearExportedKeys();
0133:                assertNull(metaData.getExportedKeys("", "test", "xyz"));
0134:                ResultSet testResult2 = new MockResultSet("id2");
0135:                ResultSet testResult3 = new MockResultSet("id3");
0136:                ResultSet testResult4 = new MockResultSet("id4");
0137:                metaData.setExportedKeys("", "test%", "xyz", testResult);
0138:                metaData.setExportedKeys("abc", "test", "xyz", testResult2);
0139:                metaData.setExportedKeys(null, "test", "xyz", testResult3);
0140:                assertSame(testResult2, metaData.getExportedKeys("abc", "test",
0141:                        "xyz"));
0142:                PolyResultSet polyResult = (PolyResultSet) metaData
0143:                        .getExportedKeys(null, "test", "xyz");
0144:                List resultSets = polyResult.getUnderlyingResultSetList();
0145:                assertEquals(2, resultSets.size());
0146:                assertTrue(resultSets.contains(testResult2));
0147:                assertTrue(resultSets.contains(testResult3));
0148:                assertSame(testResult, metaData.getExportedKeys("", "test%",
0149:                        "xyz"));
0150:                assertSame(testResult3, metaData.getExportedKeys("", "test",
0151:                        "xyz"));
0152:                assertSame(testResult2, metaData.getExportedKeys("abc", "test",
0153:                        "xyz"));
0154:                assertNull(metaData.getExportedKeys(null, "test_", "xyz"));
0155:                assertNull(metaData.getExportedKeys(null, "test", "xyz1"));
0156:                assertNull(metaData.getExportedKeys(null, "test", null));
0157:                metaData.setExportedKeys(testResult4);
0158:                assertSame(testResult4, metaData.getExportedKeys(null, "test3",
0159:                        "xyz"));
0160:                assertSame(testResult4, metaData.getExportedKeys(null, "test",
0161:                        "xyz1"));
0162:                assertSame(testResult4, metaData.getExportedKeys(null, "test",
0163:                        null));
0164:                polyResult = (PolyResultSet) metaData.getExportedKeys(null,
0165:                        "test", "xyz");
0166:                resultSets = polyResult.getUnderlyingResultSetList();
0167:                assertEquals(3, resultSets.size());
0168:            }
0169:
0170:            public void testExportedKeysCaseSensitive() throws SQLException {
0171:                ResultSet testResult = new MockResultSet("id");
0172:                ResultSet testResult2 = new MockResultSet("id2");
0173:                ResultSet testResult3 = new MockResultSet("id3");
0174:                metaData.setExportedKeys("abc", "TEST", "XYz", testResult);
0175:                metaData.setExportedKeys("abc", "test", "xyz", testResult2);
0176:                metaData.setExportedKeys(null, "test", "xyz", testResult3);
0177:                PolyResultSet polyResult = (PolyResultSet) metaData
0178:                        .getExportedKeys(null, "test", "xyz");
0179:                List resultSets = polyResult.getUnderlyingResultSetList();
0180:                assertEquals(3, resultSets.size());
0181:                metaData.setCaseSensitive(true);
0182:                polyResult = (PolyResultSet) metaData.getExportedKeys(null,
0183:                        "test", "xyz");
0184:                resultSets = polyResult.getUnderlyingResultSetList();
0185:                assertEquals(2, resultSets.size());
0186:                assertSame(testResult, metaData.getExportedKeys("abc", "TEST",
0187:                        "XYz"));
0188:                assertNull(metaData.getExportedKeys("ABC", "TEST", "XYz"));
0189:                metaData.setCaseSensitive(false);
0190:                polyResult = (PolyResultSet) metaData.getExportedKeys("ABC",
0191:                        "TEST", "XYz");
0192:                resultSets = polyResult.getUnderlyingResultSetList();
0193:                assertEquals(2, resultSets.size());
0194:            }
0195:
0196:            public void testImportedKeys() throws SQLException {
0197:                assertNull(metaData.getImportedKeys(null, null, null));
0198:                assertNull(metaData.getImportedKeys("abc1", "abc2", "abc3"));
0199:                ResultSet testResult = new MockResultSet("id");
0200:                metaData.setImportedKeys(testResult);
0201:                assertSame(testResult, metaData.getImportedKeys(null, null,
0202:                        null));
0203:                assertSame(testResult, metaData.getImportedKeys("", "test",
0204:                        "xyz"));
0205:                assertSame(testResult, metaData.getImportedKeys("abc1", "test",
0206:                        "xyz"));
0207:                metaData.clearImportedKeys();
0208:                assertNull(metaData.getImportedKeys("", "test", "xyz"));
0209:                ResultSet testResult2 = new MockResultSet("id2");
0210:                ResultSet testResult3 = new MockResultSet("id3");
0211:                ResultSet testResult4 = new MockResultSet("id4");
0212:                metaData.setImportedKeys("", "test%", "xyz", testResult);
0213:                metaData.setImportedKeys("abc", "test", "xyz", testResult2);
0214:                metaData.setImportedKeys(null, "test", "xyz", testResult3);
0215:                assertSame(testResult2, metaData.getImportedKeys("abc", "test",
0216:                        "xyz"));
0217:                PolyResultSet polyResult = (PolyResultSet) metaData
0218:                        .getImportedKeys(null, "test", "xyz");
0219:                List resultSets = polyResult.getUnderlyingResultSetList();
0220:                assertEquals(2, resultSets.size());
0221:                assertTrue(resultSets.contains(testResult2));
0222:                assertTrue(resultSets.contains(testResult3));
0223:                assertSame(testResult, metaData.getImportedKeys("", "test%",
0224:                        "xyz"));
0225:                assertSame(testResult3, metaData.getImportedKeys("", "test",
0226:                        "xyz"));
0227:                assertSame(testResult2, metaData.getImportedKeys("abc", "test",
0228:                        "xyz"));
0229:                assertNull(metaData.getImportedKeys(null, "test_", "xyz"));
0230:                assertNull(metaData.getImportedKeys(null, "test", "xyz1"));
0231:                assertNull(metaData.getImportedKeys(null, "test", null));
0232:                metaData.setImportedKeys(testResult4);
0233:                assertSame(testResult4, metaData.getImportedKeys(null, "test3",
0234:                        "xyz"));
0235:                assertSame(testResult4, metaData.getImportedKeys(null, "test",
0236:                        "xyz1"));
0237:                assertSame(testResult4, metaData.getImportedKeys(null, "test",
0238:                        null));
0239:                polyResult = (PolyResultSet) metaData.getImportedKeys(null,
0240:                        "test", "xyz");
0241:                resultSets = polyResult.getUnderlyingResultSetList();
0242:                assertEquals(3, resultSets.size());
0243:            }
0244:
0245:            public void testImportedKeysCaseSensitive() throws SQLException {
0246:                ResultSet testResult = new MockResultSet("id");
0247:                ResultSet testResult2 = new MockResultSet("id2");
0248:                ResultSet testResult3 = new MockResultSet("id3");
0249:                metaData.setImportedKeys("abc", "TEST", "XYz", testResult);
0250:                metaData.setImportedKeys("abc", "test", "xyz", testResult2);
0251:                metaData.setImportedKeys(null, "test", "xyz", testResult3);
0252:                PolyResultSet polyResult = (PolyResultSet) metaData
0253:                        .getImportedKeys(null, "test", "xyz");
0254:                List resultSets = polyResult.getUnderlyingResultSetList();
0255:                assertEquals(3, resultSets.size());
0256:                metaData.setCaseSensitive(true);
0257:                polyResult = (PolyResultSet) metaData.getImportedKeys(null,
0258:                        "test", "xyz");
0259:                resultSets = polyResult.getUnderlyingResultSetList();
0260:                assertEquals(2, resultSets.size());
0261:                assertSame(testResult, metaData.getImportedKeys("abc", "TEST",
0262:                        "XYz"));
0263:                assertNull(metaData.getImportedKeys("ABC", "TEST", "XYz"));
0264:                metaData.setCaseSensitive(false);
0265:                polyResult = (PolyResultSet) metaData.getImportedKeys("ABC",
0266:                        "TEST", "XYz");
0267:                resultSets = polyResult.getUnderlyingResultSetList();
0268:                assertEquals(2, resultSets.size());
0269:            }
0270:
0271:            public void testPrimaryKeys() throws SQLException {
0272:                assertNull(metaData.getPrimaryKeys(null, null, null));
0273:                assertNull(metaData.getPrimaryKeys("abc1", "abc2", "abc3"));
0274:                ResultSet testResult = new MockResultSet("id");
0275:                metaData.setPrimaryKeys(testResult);
0276:                assertSame(testResult, metaData
0277:                        .getPrimaryKeys(null, null, null));
0278:                assertSame(testResult, metaData.getPrimaryKeys("", "test",
0279:                        "xyz"));
0280:                assertSame(testResult, metaData.getPrimaryKeys("abc1", "test",
0281:                        "xyz"));
0282:                metaData.clearPrimaryKeys();
0283:                assertNull(metaData.getPrimaryKeys("", "test", "xyz"));
0284:                ResultSet testResult2 = new MockResultSet("id2");
0285:                ResultSet testResult3 = new MockResultSet("id3");
0286:                ResultSet testResult4 = new MockResultSet("id4");
0287:                metaData.setPrimaryKeys("", "test%", "xyz", testResult);
0288:                metaData.setPrimaryKeys("abc", "test", "xyz", testResult2);
0289:                metaData.setPrimaryKeys(null, "test", "xyz", testResult3);
0290:                assertSame(testResult2, metaData.getPrimaryKeys("abc", "test",
0291:                        "xyz"));
0292:                PolyResultSet polyResult = (PolyResultSet) metaData
0293:                        .getPrimaryKeys(null, "test", "xyz");
0294:                List resultSets = polyResult.getUnderlyingResultSetList();
0295:                assertEquals(2, resultSets.size());
0296:                assertTrue(resultSets.contains(testResult2));
0297:                assertTrue(resultSets.contains(testResult3));
0298:                assertSame(testResult, metaData.getPrimaryKeys("", "test%",
0299:                        "xyz"));
0300:                assertSame(testResult3, metaData.getPrimaryKeys("", "test",
0301:                        "xyz"));
0302:                assertSame(testResult2, metaData.getPrimaryKeys("abc", "test",
0303:                        "xyz"));
0304:                assertNull(metaData.getPrimaryKeys(null, "test_", "xyz"));
0305:                assertNull(metaData.getPrimaryKeys(null, "test", "xyz1"));
0306:                assertNull(metaData.getPrimaryKeys(null, "test", null));
0307:                metaData.setPrimaryKeys(testResult4);
0308:                assertSame(testResult4, metaData.getPrimaryKeys(null, "test3",
0309:                        "xyz"));
0310:                assertSame(testResult4, metaData.getPrimaryKeys(null, "test",
0311:                        "xyz1"));
0312:                assertSame(testResult4, metaData.getPrimaryKeys(null, "test",
0313:                        null));
0314:                polyResult = (PolyResultSet) metaData.getPrimaryKeys(null,
0315:                        "test", "xyz");
0316:                resultSets = polyResult.getUnderlyingResultSetList();
0317:                assertEquals(3, resultSets.size());
0318:            }
0319:
0320:            public void testPrimaryKeysCaseSensitive() throws SQLException {
0321:                ResultSet testResult = new MockResultSet("id");
0322:                ResultSet testResult2 = new MockResultSet("id2");
0323:                ResultSet testResult3 = new MockResultSet("id3");
0324:                metaData.setPrimaryKeys("abc", "TEST", "XYz", testResult);
0325:                metaData.setPrimaryKeys("abc", "test", "xyz", testResult2);
0326:                metaData.setPrimaryKeys(null, "test", "xyz", testResult3);
0327:                PolyResultSet polyResult = (PolyResultSet) metaData
0328:                        .getPrimaryKeys(null, "test", "xyz");
0329:                List resultSets = polyResult.getUnderlyingResultSetList();
0330:                assertEquals(3, resultSets.size());
0331:                metaData.setCaseSensitive(true);
0332:                polyResult = (PolyResultSet) metaData.getPrimaryKeys(null,
0333:                        "test", "xyz");
0334:                resultSets = polyResult.getUnderlyingResultSetList();
0335:                assertEquals(2, resultSets.size());
0336:                assertSame(testResult, metaData.getPrimaryKeys("abc", "TEST",
0337:                        "XYz"));
0338:                assertNull(metaData.getPrimaryKeys("ABC", "TEST", "XYz"));
0339:                metaData.setCaseSensitive(false);
0340:                polyResult = (PolyResultSet) metaData.getPrimaryKeys("ABC",
0341:                        "TEST", "XYz");
0342:                resultSets = polyResult.getUnderlyingResultSetList();
0343:                assertEquals(2, resultSets.size());
0344:            }
0345:
0346:            public void testProcedures() throws SQLException {
0347:                assertNull(metaData.getProcedures(null, null, null));
0348:                assertNull(metaData.getProcedures("abc1", "abc2", "abc3"));
0349:                ResultSet testResult = new MockResultSet("id");
0350:                metaData.setProcedures(testResult);
0351:                assertSame(testResult, metaData.getProcedures(null, null, null));
0352:                assertSame(testResult, metaData
0353:                        .getProcedures("", "test", "xyz"));
0354:                assertSame(testResult, metaData.getProcedures("abc1", "test",
0355:                        "xyz"));
0356:                metaData.clearProcedures();
0357:                assertNull(metaData.getProcedures("", "test", "xyz"));
0358:                ResultSet testResult2 = new MockResultSet("id2");
0359:                ResultSet testResult3 = new MockResultSet("id3");
0360:                ResultSet testResult4 = new MockResultSet("id4");
0361:                metaData.setProcedures("", "test1", "xyz", testResult);
0362:                metaData.setProcedures("abc", "test", "xyz", testResult2);
0363:                metaData.setProcedures(null, "test", "xyz", testResult3);
0364:                assertSame(testResult2, metaData.getProcedures("abc", "test",
0365:                        "xyz"));
0366:                PolyResultSet polyResult = (PolyResultSet) metaData
0367:                        .getProcedures(null, "test", "xyz");
0368:                List resultSets = polyResult.getUnderlyingResultSetList();
0369:                assertEquals(2, resultSets.size());
0370:                assertTrue(resultSets.contains(testResult2));
0371:                assertTrue(resultSets.contains(testResult3));
0372:                assertSame(testResult, metaData.getProcedures("", "test1",
0373:                        "xyz"));
0374:                assertSame(testResult3, metaData.getProcedures("", "test",
0375:                        "xyz"));
0376:                assertSame(testResult2, metaData.getProcedures("abc", "test",
0377:                        "xyz"));
0378:                assertNull(metaData.getProcedures(null, "test3", "xyz"));
0379:                assertNull(metaData.getProcedures(null, "test", "xyz1"));
0380:                assertNull(metaData.getProcedures(null, "test", null));
0381:                metaData.setProcedures(testResult4);
0382:                assertSame(testResult4, metaData.getProcedures(null, "test3",
0383:                        "xyz"));
0384:                assertSame(testResult4, metaData.getProcedures(null, "test",
0385:                        "xyz1"));
0386:                assertSame(testResult4, metaData.getProcedures(null, "test",
0387:                        null));
0388:                polyResult = (PolyResultSet) metaData.getProcedures(null,
0389:                        "test", "xyz");
0390:                resultSets = polyResult.getUnderlyingResultSetList();
0391:                assertEquals(3, resultSets.size());
0392:            }
0393:
0394:            public void testProceduresWithWildcards() throws SQLException {
0395:                ResultSet testResult = new MockResultSet("id");
0396:                metaData.setProcedures("abc", "test", "xyz", testResult);
0397:                assertSame(testResult, metaData.getProcedures("abc", "test",
0398:                        "xyz"));
0399:                assertSame(testResult, metaData
0400:                        .getProcedures(null, "t__t", "%"));
0401:                assertSame(testResult, metaData.getProcedures("abc", "tes%",
0402:                        "___"));
0403:                assertSame(testResult, metaData.getProcedures("abc", "%es%",
0404:                        "x_z"));
0405:                assertSame(testResult, metaData.getProcedures(null, "_est",
0406:                        "xyz"));
0407:                assertSame(testResult, metaData.getProcedures(null, "test",
0408:                        "_yz"));
0409:                assertSame(testResult, metaData.getProcedures("abc", "t%",
0410:                        "xy_"));
0411:                assertSame(testResult, metaData.getProcedures("abc", "test%",
0412:                        "%xyz"));
0413:                assertNull(metaData.getProcedures("ab_", "test", "xyz"));
0414:                assertNull(metaData.getProcedures("a%", "te_t", "xyz"));
0415:                assertNull(metaData.getProcedures("abc", "test", "a%"));
0416:                assertNull(metaData.getProcedures("abc", "t____", "xyz"));
0417:                assertNull(metaData.getProcedures(null, "test", "%xyz_"));
0418:                assertNull(metaData.getProcedures("abc", "test1%", "x_z"));
0419:                ResultSet testResult2 = new MockResultSet("id2");
0420:                ResultSet testResult3 = new MockResultSet("id3");
0421:                metaData.setProcedures("abc1", "abc", "xyz", testResult2);
0422:                metaData.setProcedures("abc1", "abc", "xyz1", testResult3);
0423:                PolyResultSet polyResult = (PolyResultSet) metaData
0424:                        .getProcedures(null, "%", "%");
0425:                assertEquals(3, polyResult.getUnderlyingResultSetList().size());
0426:                assertTrue(metaData.getProcedures("abc", "%", "xyz") instanceof  MockResultSet);
0427:                assertTrue(metaData.getProcedures("abc1", "%", "xyz") instanceof  MockResultSet);
0428:                polyResult = (PolyResultSet) metaData.getProcedures(null,
0429:                        "a__", "xyz%");
0430:                assertEquals(2, polyResult.getUnderlyingResultSetList().size());
0431:                assertTrue(metaData.getProcedures(null, "a__", "xyz_") instanceof  MockResultSet);
0432:                assertNull(metaData.getProcedures("%", "%", "%"));
0433:                polyResult = (PolyResultSet) metaData.getProcedures(null,
0434:                        "ab%", "%");
0435:                List resultSets = polyResult.getUnderlyingResultSetList();
0436:                assertEquals(2, resultSets.size());
0437:                assertTrue(resultSets.contains(testResult2));
0438:                assertTrue(resultSets.contains(testResult3));
0439:            }
0440:
0441:            public void testProceduresCaseSensitive() throws SQLException {
0442:                ResultSet testResult = new MockResultSet("id");
0443:                ResultSet testResult2 = new MockResultSet("id2");
0444:                ResultSet testResult3 = new MockResultSet("id3");
0445:                metaData.setProcedures("abc", "TEST", "XYz", testResult);
0446:                metaData.setProcedures("abc", "test", "xyz", testResult2);
0447:                metaData.setProcedures(null, "test", "xyz", testResult3);
0448:                PolyResultSet polyResult = (PolyResultSet) metaData
0449:                        .getProcedures(null, "t_st", "xyz");
0450:                List resultSets = polyResult.getUnderlyingResultSetList();
0451:                assertEquals(3, resultSets.size());
0452:                metaData.setCaseSensitive(true);
0453:                polyResult = (PolyResultSet) metaData.getProcedures(null,
0454:                        "t_st", "xyz");
0455:                resultSets = polyResult.getUnderlyingResultSetList();
0456:                assertEquals(2, resultSets.size());
0457:                assertSame(testResult, metaData.getProcedures("abc", "TE%",
0458:                        "XYz"));
0459:                assertNull(metaData.getProcedures("ABC", "TEST", "XYz"));
0460:                metaData.setCaseSensitive(false);
0461:                polyResult = (PolyResultSet) metaData.getProcedures("ABC",
0462:                        "TEST", "_Yz");
0463:                resultSets = polyResult.getUnderlyingResultSetList();
0464:                assertEquals(2, resultSets.size());
0465:            }
0466:
0467:            public void testFunctions() throws SQLException {
0468:                assertNull(metaData.getFunctions(null, null, null));
0469:                assertNull(metaData.getFunctions("abc1", "abc2", "abc3"));
0470:                ResultSet testResult = new MockResultSet("id");
0471:                metaData.setFunctions(testResult);
0472:                assertSame(testResult, metaData.getFunctions(null, null, null));
0473:                assertSame(testResult, metaData.getFunctions("", "test", "xyz"));
0474:                assertSame(testResult, metaData.getFunctions("abc1", "test",
0475:                        "xyz"));
0476:                metaData.clearFunctions();
0477:                assertNull(metaData.getFunctions("", "test", "xyz"));
0478:                ResultSet testResult2 = new MockResultSet("id2");
0479:                ResultSet testResult3 = new MockResultSet("id3");
0480:                ResultSet testResult4 = new MockResultSet("id4");
0481:                metaData.setFunctions("", "test1", "xyz", testResult);
0482:                metaData.setFunctions("abc", "test", "xyz", testResult2);
0483:                metaData.setFunctions(null, "test", "xyz", testResult3);
0484:                assertSame(testResult2, metaData.getFunctions("abc", "test",
0485:                        "xyz"));
0486:                PolyResultSet polyResult = (PolyResultSet) metaData
0487:                        .getFunctions(null, "test", "xyz");
0488:                List resultSets = polyResult.getUnderlyingResultSetList();
0489:                assertEquals(2, resultSets.size());
0490:                assertTrue(resultSets.contains(testResult2));
0491:                assertTrue(resultSets.contains(testResult3));
0492:                assertSame(testResult, metaData
0493:                        .getFunctions("", "test1", "xyz"));
0494:                assertSame(testResult3, metaData
0495:                        .getFunctions("", "test", "xyz"));
0496:                assertSame(testResult2, metaData.getFunctions("abc", "test",
0497:                        "xyz"));
0498:                assertNull(metaData.getFunctions(null, "test3", "xyz"));
0499:                assertNull(metaData.getFunctions(null, "test", "xyz1"));
0500:                assertNull(metaData.getFunctions(null, "test", null));
0501:                metaData.setFunctions(testResult4);
0502:                assertSame(testResult4, metaData.getFunctions(null, "test3",
0503:                        "xyz"));
0504:                assertSame(testResult4, metaData.getFunctions(null, "test",
0505:                        "xyz1"));
0506:                assertSame(testResult4, metaData.getFunctions(null, "test",
0507:                        null));
0508:                polyResult = (PolyResultSet) metaData.getFunctions(null,
0509:                        "test", "xyz");
0510:                resultSets = polyResult.getUnderlyingResultSetList();
0511:                assertEquals(3, resultSets.size());
0512:            }
0513:
0514:            public void testFunctionsWithWildcards() throws SQLException {
0515:                ResultSet testResult = new MockResultSet("id");
0516:                metaData.setFunctions("abc", "test", "xyz", testResult);
0517:                assertSame(testResult, metaData.getFunctions("abc", "test",
0518:                        "xyz"));
0519:                assertSame(testResult, metaData.getFunctions(null, "t__t", "%"));
0520:                assertSame(testResult, metaData.getFunctions("abc", "tes%",
0521:                        "___"));
0522:                assertSame(testResult, metaData.getFunctions("abc", "%es%",
0523:                        "x_z"));
0524:                assertSame(testResult, metaData.getFunctions(null, "_est",
0525:                        "xyz"));
0526:                assertSame(testResult, metaData.getFunctions(null, "test",
0527:                        "_yz"));
0528:                assertSame(testResult, metaData
0529:                        .getFunctions("abc", "t%", "xy_"));
0530:                assertSame(testResult, metaData.getFunctions("abc", "test%",
0531:                        "%xyz"));
0532:                assertNull(metaData.getFunctions("ab_", "test", "xyz"));
0533:                assertNull(metaData.getFunctions("a%", "te_t", "xyz"));
0534:                assertNull(metaData.getFunctions("abc", "test", "a%"));
0535:                assertNull(metaData.getFunctions("abc", "t____", "xyz"));
0536:                assertNull(metaData.getFunctions(null, "test", "%xyz_"));
0537:                assertNull(metaData.getFunctions("abc", "test1%", "x_z"));
0538:                ResultSet testResult2 = new MockResultSet("id2");
0539:                ResultSet testResult3 = new MockResultSet("id3");
0540:                metaData.setFunctions("abc1", "abc", "xyz", testResult2);
0541:                metaData.setFunctions("abc1", "abc", "xyz1", testResult3);
0542:                PolyResultSet polyResult = (PolyResultSet) metaData
0543:                        .getFunctions(null, "%", "%");
0544:                assertEquals(3, polyResult.getUnderlyingResultSetList().size());
0545:                assertTrue(metaData.getFunctions("abc", "%", "xyz") instanceof  MockResultSet);
0546:                assertTrue(metaData.getFunctions("abc1", "%", "xyz") instanceof  MockResultSet);
0547:                polyResult = (PolyResultSet) metaData.getFunctions(null, "a__",
0548:                        "xyz%");
0549:                assertEquals(2, polyResult.getUnderlyingResultSetList().size());
0550:                assertTrue(metaData.getFunctions(null, "a__", "xyz_") instanceof  MockResultSet);
0551:                assertNull(metaData.getFunctions("%", "%", "%"));
0552:                polyResult = (PolyResultSet) metaData.getFunctions(null, "ab%",
0553:                        "%");
0554:                List resultSets = polyResult.getUnderlyingResultSetList();
0555:                assertEquals(2, resultSets.size());
0556:                assertTrue(resultSets.contains(testResult2));
0557:                assertTrue(resultSets.contains(testResult3));
0558:            }
0559:
0560:            public void testFunctionsCaseSensitive() throws SQLException {
0561:                ResultSet testResult = new MockResultSet("id");
0562:                ResultSet testResult2 = new MockResultSet("id2");
0563:                ResultSet testResult3 = new MockResultSet("id3");
0564:                metaData.setFunctions("abc", "TEST", "XYz", testResult);
0565:                metaData.setFunctions("abc", "test", "xyz", testResult2);
0566:                metaData.setFunctions(null, "test", "xyz", testResult3);
0567:                PolyResultSet polyResult = (PolyResultSet) metaData
0568:                        .getFunctions(null, "t_st", "xyz");
0569:                List resultSets = polyResult.getUnderlyingResultSetList();
0570:                assertEquals(3, resultSets.size());
0571:                metaData.setCaseSensitive(true);
0572:                polyResult = (PolyResultSet) metaData.getFunctions(null,
0573:                        "t_st", "xyz");
0574:                resultSets = polyResult.getUnderlyingResultSetList();
0575:                assertEquals(2, resultSets.size());
0576:                assertSame(testResult, metaData.getFunctions("abc", "TE%",
0577:                        "XYz"));
0578:                assertNull(metaData.getFunctions("ABC", "TEST", "XYz"));
0579:                metaData.setCaseSensitive(false);
0580:                polyResult = (PolyResultSet) metaData.getFunctions("ABC",
0581:                        "TEST", "_Yz");
0582:                resultSets = polyResult.getUnderlyingResultSetList();
0583:                assertEquals(2, resultSets.size());
0584:            }
0585:
0586:            public void testSuperTables() throws SQLException {
0587:                assertNull(metaData.getSuperTables(null, null, null));
0588:                assertNull(metaData.getSuperTables("abc1", "abc2", "abc3"));
0589:                ResultSet testResult = new MockResultSet("id");
0590:                metaData.setSuperTables(testResult);
0591:                assertSame(testResult, metaData
0592:                        .getSuperTables(null, null, null));
0593:                assertSame(testResult, metaData.getSuperTables("", "test",
0594:                        "xyz"));
0595:                assertSame(testResult, metaData.getSuperTables("abc1", "test",
0596:                        "xyz"));
0597:                metaData.clearSuperTables();
0598:                assertNull(metaData.getSuperTables("", "test", "xyz"));
0599:                ResultSet testResult2 = new MockResultSet("id2");
0600:                ResultSet testResult3 = new MockResultSet("id3");
0601:                ResultSet testResult4 = new MockResultSet("id4");
0602:                metaData.setSuperTables("", "test1", "xyz", testResult);
0603:                metaData.setSuperTables("abc", "test", "xyz", testResult2);
0604:                metaData.setSuperTables(null, "test", "xyz", testResult3);
0605:                assertSame(testResult2, metaData.getSuperTables("abc", "test",
0606:                        "xyz"));
0607:                PolyResultSet polyResult = (PolyResultSet) metaData
0608:                        .getSuperTables(null, "test", "xyz");
0609:                List resultSets = polyResult.getUnderlyingResultSetList();
0610:                assertEquals(2, resultSets.size());
0611:                assertTrue(resultSets.contains(testResult2));
0612:                assertTrue(resultSets.contains(testResult3));
0613:                assertSame(testResult, metaData.getSuperTables("", "test1",
0614:                        "xyz"));
0615:                assertSame(testResult3, metaData.getSuperTables("", "test",
0616:                        "xyz"));
0617:                assertSame(testResult2, metaData.getSuperTables("abc", "test",
0618:                        "xyz"));
0619:                assertNull(metaData.getSuperTables(null, "test3", "xyz"));
0620:                assertNull(metaData.getSuperTables(null, "test", "xyz1"));
0621:                assertNull(metaData.getSuperTables(null, "test", null));
0622:                metaData.setSuperTables(testResult4);
0623:                assertSame(testResult4, metaData.getSuperTables(null, "test3",
0624:                        "xyz"));
0625:                assertSame(testResult4, metaData.getSuperTables(null, "test",
0626:                        "xyz1"));
0627:                assertSame(testResult4, metaData.getSuperTables(null, "test",
0628:                        null));
0629:                polyResult = (PolyResultSet) metaData.getSuperTables(null,
0630:                        "test", "xyz");
0631:                resultSets = polyResult.getUnderlyingResultSetList();
0632:                assertEquals(3, resultSets.size());
0633:            }
0634:
0635:            public void testSuperTablesWithWildcards() throws SQLException {
0636:                ResultSet testResult = new MockResultSet("id");
0637:                metaData.setSuperTables("abc", "test", "xyz", testResult);
0638:                assertSame(testResult, metaData.getSuperTables("abc", "test",
0639:                        "xyz"));
0640:                assertSame(testResult, metaData.getSuperTables(null, "t__t",
0641:                        "%"));
0642:                assertSame(testResult, metaData.getSuperTables("abc", "tes%",
0643:                        "___"));
0644:                assertSame(testResult, metaData.getSuperTables("abc", "%es%",
0645:                        "x_z"));
0646:                assertSame(testResult, metaData.getSuperTables(null, "_est",
0647:                        "xyz"));
0648:                assertSame(testResult, metaData.getSuperTables(null, "test",
0649:                        "_yz"));
0650:                assertSame(testResult, metaData.getSuperTables("abc", "t%",
0651:                        "xy_"));
0652:                assertSame(testResult, metaData.getSuperTables("abc", "test%",
0653:                        "%xyz"));
0654:                assertNull(metaData.getSuperTables("ab_", "test", "xyz"));
0655:                assertNull(metaData.getSuperTables("a%", "te_t", "xyz"));
0656:                assertNull(metaData.getSuperTables("abc", "test", "a%"));
0657:                assertNull(metaData.getSuperTables("abc", "t____", "xyz"));
0658:                assertNull(metaData.getSuperTables(null, "test", "%xyz_"));
0659:                assertNull(metaData.getSuperTables("abc", "test1%", "x_z"));
0660:                ResultSet testResult2 = new MockResultSet("id2");
0661:                ResultSet testResult3 = new MockResultSet("id3");
0662:                metaData.setSuperTables("abc1", "abc", "xyz", testResult2);
0663:                metaData.setSuperTables("abc1", "abc", "xyz1", testResult3);
0664:                PolyResultSet polyResult = (PolyResultSet) metaData
0665:                        .getSuperTables(null, "%", "%");
0666:                assertEquals(3, polyResult.getUnderlyingResultSetList().size());
0667:                assertTrue(metaData.getSuperTables("abc", "%", "xyz") instanceof  MockResultSet);
0668:                assertTrue(metaData.getSuperTables("abc1", "%", "xyz") instanceof  MockResultSet);
0669:                polyResult = (PolyResultSet) metaData.getSuperTables(null,
0670:                        "a__", "xyz%");
0671:                assertEquals(2, polyResult.getUnderlyingResultSetList().size());
0672:                assertTrue(metaData.getSuperTables(null, "a__", "xyz_") instanceof  MockResultSet);
0673:                assertNull(metaData.getSuperTables("%", "%", "%"));
0674:                polyResult = (PolyResultSet) metaData.getSuperTables(null,
0675:                        "ab%", "%");
0676:                List resultSets = polyResult.getUnderlyingResultSetList();
0677:                assertEquals(2, resultSets.size());
0678:                assertTrue(resultSets.contains(testResult2));
0679:                assertTrue(resultSets.contains(testResult3));
0680:            }
0681:
0682:            public void testSuperTablesCaseSensitive() throws SQLException {
0683:                ResultSet testResult = new MockResultSet("id");
0684:                ResultSet testResult2 = new MockResultSet("id2");
0685:                ResultSet testResult3 = new MockResultSet("id3");
0686:                metaData.setSuperTables("abc", "TEST", "XYz", testResult);
0687:                metaData.setSuperTables("abc", "test", "xyz", testResult2);
0688:                metaData.setSuperTables(null, "test", "xyz", testResult3);
0689:                PolyResultSet polyResult = (PolyResultSet) metaData
0690:                        .getSuperTables(null, "t_st", "xyz");
0691:                List resultSets = polyResult.getUnderlyingResultSetList();
0692:                assertEquals(3, resultSets.size());
0693:                metaData.setCaseSensitive(true);
0694:                polyResult = (PolyResultSet) metaData.getSuperTables(null,
0695:                        "t_st", "xyz");
0696:                resultSets = polyResult.getUnderlyingResultSetList();
0697:                assertEquals(2, resultSets.size());
0698:                assertSame(testResult, metaData.getSuperTables("abc", "TE%",
0699:                        "XYz"));
0700:                assertNull(metaData.getSuperTables("ABC", "TEST", "XYz"));
0701:                metaData.setCaseSensitive(false);
0702:                polyResult = (PolyResultSet) metaData.getSuperTables("ABC",
0703:                        "TEST", "_Yz");
0704:                resultSets = polyResult.getUnderlyingResultSetList();
0705:                assertEquals(2, resultSets.size());
0706:            }
0707:
0708:            public void testSuperTypes() throws SQLException {
0709:                assertNull(metaData.getSuperTypes(null, null, null));
0710:                assertNull(metaData.getSuperTypes("abc1", "abc2", "abc3"));
0711:                ResultSet testResult = new MockResultSet("id");
0712:                metaData.setSuperTypes(testResult);
0713:                assertSame(testResult, metaData.getSuperTypes(null, null, null));
0714:                assertSame(testResult, metaData
0715:                        .getSuperTypes("", "test", "xyz"));
0716:                assertSame(testResult, metaData.getSuperTypes("abc1", "test",
0717:                        "xyz"));
0718:                metaData.clearSuperTypes();
0719:                assertNull(metaData.getSuperTypes("", "test", "xyz"));
0720:                ResultSet testResult2 = new MockResultSet("id2");
0721:                ResultSet testResult3 = new MockResultSet("id3");
0722:                ResultSet testResult4 = new MockResultSet("id4");
0723:                metaData.setSuperTypes("", "test1", "xyz", testResult);
0724:                metaData.setSuperTypes("abc", "test", "xyz", testResult2);
0725:                metaData.setSuperTypes(null, "test", "xyz", testResult3);
0726:                assertSame(testResult2, metaData.getSuperTypes("abc", "test",
0727:                        "xyz"));
0728:                PolyResultSet polyResult = (PolyResultSet) metaData
0729:                        .getSuperTypes(null, "test", "xyz");
0730:                List resultSets = polyResult.getUnderlyingResultSetList();
0731:                assertEquals(2, resultSets.size());
0732:                assertTrue(resultSets.contains(testResult2));
0733:                assertTrue(resultSets.contains(testResult3));
0734:                assertSame(testResult, metaData.getSuperTypes("", "test1",
0735:                        "xyz"));
0736:                assertSame(testResult3, metaData.getSuperTypes("", "test",
0737:                        "xyz"));
0738:                assertSame(testResult2, metaData.getSuperTypes("abc", "test",
0739:                        "xyz"));
0740:                assertNull(metaData.getSuperTypes(null, "test3", "xyz"));
0741:                assertNull(metaData.getSuperTypes(null, "test", "xyz1"));
0742:                assertNull(metaData.getSuperTypes(null, "test", null));
0743:                metaData.setSuperTypes(testResult4);
0744:                assertSame(testResult4, metaData.getSuperTypes(null, "test3",
0745:                        "xyz"));
0746:                assertSame(testResult4, metaData.getSuperTypes(null, "test",
0747:                        "xyz1"));
0748:                assertSame(testResult4, metaData.getSuperTypes(null, "test",
0749:                        null));
0750:                polyResult = (PolyResultSet) metaData.getSuperTypes(null,
0751:                        "test", "xyz");
0752:                resultSets = polyResult.getUnderlyingResultSetList();
0753:                assertEquals(3, resultSets.size());
0754:            }
0755:
0756:            public void testSuperTypesWithWildcards() throws SQLException {
0757:                ResultSet testResult = new MockResultSet("id");
0758:                metaData.setSuperTypes("abc", "test", "xyz", testResult);
0759:                assertSame(testResult, metaData.getSuperTypes("abc", "test",
0760:                        "xyz"));
0761:                assertSame(testResult, metaData
0762:                        .getSuperTypes(null, "t__t", "%"));
0763:                assertSame(testResult, metaData.getSuperTypes("abc", "tes%",
0764:                        "___"));
0765:                assertSame(testResult, metaData.getSuperTypes("abc", "%es%",
0766:                        "x_z"));
0767:                assertSame(testResult, metaData.getSuperTypes(null, "_est",
0768:                        "xyz"));
0769:                assertSame(testResult, metaData.getSuperTypes(null, "test",
0770:                        "_yz"));
0771:                assertSame(testResult, metaData.getSuperTypes("abc", "t%",
0772:                        "xy_"));
0773:                assertSame(testResult, metaData.getSuperTypes("abc", "test%",
0774:                        "%xyz"));
0775:                assertNull(metaData.getSuperTypes("ab_", "test", "xyz"));
0776:                assertNull(metaData.getSuperTypes("a%", "te_t", "xyz"));
0777:                assertNull(metaData.getSuperTypes("abc", "test", "a%"));
0778:                assertNull(metaData.getSuperTypes("abc", "t____", "xyz"));
0779:                assertNull(metaData.getSuperTypes(null, "test", "%xyz_"));
0780:                assertNull(metaData.getSuperTypes("abc", "test1%", "x_z"));
0781:                ResultSet testResult2 = new MockResultSet("id2");
0782:                ResultSet testResult3 = new MockResultSet("id3");
0783:                metaData.setSuperTypes("abc1", "abc", "xyz", testResult2);
0784:                metaData.setSuperTypes("abc1", "abc", "xyz1", testResult3);
0785:                PolyResultSet polyResult = (PolyResultSet) metaData
0786:                        .getSuperTypes(null, "%", "%");
0787:                assertEquals(3, polyResult.getUnderlyingResultSetList().size());
0788:                assertTrue(metaData.getSuperTypes("abc", "%", "xyz") instanceof  MockResultSet);
0789:                assertTrue(metaData.getSuperTypes("abc1", "%", "xyz") instanceof  MockResultSet);
0790:                polyResult = (PolyResultSet) metaData.getSuperTypes(null,
0791:                        "a__", "xyz%");
0792:                assertEquals(2, polyResult.getUnderlyingResultSetList().size());
0793:                assertTrue(metaData.getSuperTypes(null, "a__", "xyz_") instanceof  MockResultSet);
0794:                assertNull(metaData.getSuperTypes("%", "%", "%"));
0795:                polyResult = (PolyResultSet) metaData.getSuperTypes(null,
0796:                        "ab%", "%");
0797:                List resultSets = polyResult.getUnderlyingResultSetList();
0798:                assertEquals(2, resultSets.size());
0799:                assertTrue(resultSets.contains(testResult2));
0800:                assertTrue(resultSets.contains(testResult3));
0801:            }
0802:
0803:            public void testSuperTypesCaseSensitive() throws SQLException {
0804:                ResultSet testResult = new MockResultSet("id");
0805:                ResultSet testResult2 = new MockResultSet("id2");
0806:                ResultSet testResult3 = new MockResultSet("id3");
0807:                metaData.setSuperTypes("abc", "TEST", "XYz", testResult);
0808:                metaData.setSuperTypes("abc", "test", "xyz", testResult2);
0809:                metaData.setSuperTypes(null, "test", "xyz", testResult3);
0810:                PolyResultSet polyResult = (PolyResultSet) metaData
0811:                        .getSuperTypes(null, "t_st", "xyz");
0812:                List resultSets = polyResult.getUnderlyingResultSetList();
0813:                assertEquals(3, resultSets.size());
0814:                metaData.setCaseSensitive(true);
0815:                polyResult = (PolyResultSet) metaData.getSuperTypes(null,
0816:                        "t_st", "xyz");
0817:                resultSets = polyResult.getUnderlyingResultSetList();
0818:                assertEquals(2, resultSets.size());
0819:                assertSame(testResult, metaData.getSuperTypes("abc", "TE%",
0820:                        "XYz"));
0821:                assertNull(metaData.getSuperTypes("ABC", "TEST", "XYz"));
0822:                metaData.setCaseSensitive(false);
0823:                polyResult = (PolyResultSet) metaData.getSuperTypes("ABC",
0824:                        "TEST", "_Yz");
0825:                resultSets = polyResult.getUnderlyingResultSetList();
0826:                assertEquals(2, resultSets.size());
0827:            }
0828:
0829:            public void testTablePrivileges() throws SQLException {
0830:                assertNull(metaData.getTablePrivileges(null, null, null));
0831:                assertNull(metaData.getTablePrivileges("abc1", "abc2", "abc3"));
0832:                ResultSet testResult = new MockResultSet("id");
0833:                metaData.setTablePrivileges(testResult);
0834:                assertSame(testResult, metaData.getTablePrivileges(null, null,
0835:                        null));
0836:                assertSame(testResult, metaData.getTablePrivileges("", "test",
0837:                        "xyz"));
0838:                assertSame(testResult, metaData.getTablePrivileges("abc1",
0839:                        "test", "xyz"));
0840:                metaData.clearTablePrivileges();
0841:                assertNull(metaData.getTablePrivileges("", "test", "xyz"));
0842:                ResultSet testResult2 = new MockResultSet("id2");
0843:                ResultSet testResult3 = new MockResultSet("id3");
0844:                ResultSet testResult4 = new MockResultSet("id4");
0845:                metaData.setTablePrivileges("", "test1", "xyz", testResult);
0846:                metaData.setTablePrivileges("abc", "test", "xyz", testResult2);
0847:                metaData.setTablePrivileges(null, "test", "xyz", testResult3);
0848:                assertSame(testResult2, metaData.getTablePrivileges("abc",
0849:                        "test", "xyz"));
0850:                PolyResultSet polyResult = (PolyResultSet) metaData
0851:                        .getTablePrivileges(null, "test", "xyz");
0852:                List resultSets = polyResult.getUnderlyingResultSetList();
0853:                assertEquals(2, resultSets.size());
0854:                assertTrue(resultSets.contains(testResult2));
0855:                assertTrue(resultSets.contains(testResult3));
0856:                assertSame(testResult, metaData.getTablePrivileges("", "test1",
0857:                        "xyz"));
0858:                assertSame(testResult3, metaData.getTablePrivileges("", "test",
0859:                        "xyz"));
0860:                assertSame(testResult2, metaData.getTablePrivileges("abc",
0861:                        "test", "xyz"));
0862:                assertNull(metaData.getTablePrivileges(null, "test3", "xyz"));
0863:                assertNull(metaData.getTablePrivileges(null, "test", "xyz1"));
0864:                assertNull(metaData.getTablePrivileges(null, "test", null));
0865:                metaData.setTablePrivileges(testResult4);
0866:                assertSame(testResult4, metaData.getTablePrivileges(null,
0867:                        "test3", "xyz"));
0868:                assertSame(testResult4, metaData.getTablePrivileges(null,
0869:                        "test", "xyz1"));
0870:                assertSame(testResult4, metaData.getTablePrivileges(null,
0871:                        "test", null));
0872:                polyResult = (PolyResultSet) metaData.getTablePrivileges(null,
0873:                        "test", "xyz");
0874:                resultSets = polyResult.getUnderlyingResultSetList();
0875:                assertEquals(3, resultSets.size());
0876:            }
0877:
0878:            public void testTablePrivilegesWithWildcards() throws SQLException {
0879:                ResultSet testResult = new MockResultSet("id");
0880:                metaData.setTablePrivileges("abc", "test", "xyz", testResult);
0881:                assertSame(testResult, metaData.getTablePrivileges("abc",
0882:                        "test", "xyz"));
0883:                assertSame(testResult, metaData.getTablePrivileges(null,
0884:                        "t__t", "%"));
0885:                assertSame(testResult, metaData.getTablePrivileges("abc",
0886:                        "tes%", "___"));
0887:                assertSame(testResult, metaData.getTablePrivileges("abc",
0888:                        "%es%", "x_z"));
0889:                assertSame(testResult, metaData.getTablePrivileges(null,
0890:                        "_est", "xyz"));
0891:                assertSame(testResult, metaData.getTablePrivileges(null,
0892:                        "test", "_yz"));
0893:                assertSame(testResult, metaData.getTablePrivileges("abc", "t%",
0894:                        "xy_"));
0895:                assertSame(testResult, metaData.getTablePrivileges("abc",
0896:                        "test%", "%xyz"));
0897:                assertNull(metaData.getTablePrivileges("ab_", "test", "xyz"));
0898:                assertNull(metaData.getTablePrivileges("a%", "te_t", "xyz"));
0899:                assertNull(metaData.getTablePrivileges("abc", "test", "a%"));
0900:                assertNull(metaData.getTablePrivileges("abc", "t____", "xyz"));
0901:                assertNull(metaData.getTablePrivileges(null, "test", "%xyz_"));
0902:                assertNull(metaData.getTablePrivileges("abc", "test1%", "x_z"));
0903:                ResultSet testResult2 = new MockResultSet("id2");
0904:                ResultSet testResult3 = new MockResultSet("id3");
0905:                metaData.setTablePrivileges("abc1", "abc", "xyz", testResult2);
0906:                metaData.setTablePrivileges("abc1", "abc", "xyz1", testResult3);
0907:                PolyResultSet polyResult = (PolyResultSet) metaData
0908:                        .getTablePrivileges(null, "%", "%");
0909:                assertEquals(3, polyResult.getUnderlyingResultSetList().size());
0910:                assertTrue(metaData.getTablePrivileges("abc", "%", "xyz") instanceof  MockResultSet);
0911:                assertTrue(metaData.getTablePrivileges("abc1", "%", "xyz") instanceof  MockResultSet);
0912:                polyResult = (PolyResultSet) metaData.getTablePrivileges(null,
0913:                        "a__", "xyz%");
0914:                assertEquals(2, polyResult.getUnderlyingResultSetList().size());
0915:                assertTrue(metaData.getTablePrivileges(null, "a__", "xyz_") instanceof  MockResultSet);
0916:                assertNull(metaData.getTablePrivileges("%", "%", "%"));
0917:                polyResult = (PolyResultSet) metaData.getTablePrivileges(null,
0918:                        "ab%", "%");
0919:                List resultSets = polyResult.getUnderlyingResultSetList();
0920:                assertEquals(2, resultSets.size());
0921:                assertTrue(resultSets.contains(testResult2));
0922:                assertTrue(resultSets.contains(testResult3));
0923:            }
0924:
0925:            public void testTablePrivilegesCaseSensitive() throws SQLException {
0926:                ResultSet testResult = new MockResultSet("id");
0927:                ResultSet testResult2 = new MockResultSet("id2");
0928:                ResultSet testResult3 = new MockResultSet("id3");
0929:                metaData.setTablePrivileges("abc", "TEST", "XYz", testResult);
0930:                metaData.setTablePrivileges("abc", "test", "xyz", testResult2);
0931:                metaData.setTablePrivileges(null, "test", "xyz", testResult3);
0932:                PolyResultSet polyResult = (PolyResultSet) metaData
0933:                        .getTablePrivileges(null, "t_st", "xyz");
0934:                List resultSets = polyResult.getUnderlyingResultSetList();
0935:                assertEquals(3, resultSets.size());
0936:                metaData.setCaseSensitive(true);
0937:                polyResult = (PolyResultSet) metaData.getTablePrivileges(null,
0938:                        "t_st", "xyz");
0939:                resultSets = polyResult.getUnderlyingResultSetList();
0940:                assertEquals(2, resultSets.size());
0941:                assertSame(testResult, metaData.getTablePrivileges("abc",
0942:                        "TE%", "XYz"));
0943:                assertNull(metaData.getTablePrivileges("ABC", "TEST", "XYz"));
0944:                metaData.setCaseSensitive(false);
0945:                polyResult = (PolyResultSet) metaData.getTablePrivileges("ABC",
0946:                        "TEST", "_Yz");
0947:                resultSets = polyResult.getUnderlyingResultSetList();
0948:                assertEquals(2, resultSets.size());
0949:            }
0950:
0951:            public void testVersionColumns() throws SQLException {
0952:                assertNull(metaData.getVersionColumns(null, null, null));
0953:                assertNull(metaData.getVersionColumns("abc1", "abc2", "abc3"));
0954:                ResultSet testResult = new MockResultSet("id");
0955:                metaData.setVersionColumns(testResult);
0956:                assertSame(testResult, metaData.getVersionColumns(null, null,
0957:                        null));
0958:                assertSame(testResult, metaData.getVersionColumns("", "test",
0959:                        "xyz"));
0960:                assertSame(testResult, metaData.getVersionColumns("abc1",
0961:                        "test", "xyz"));
0962:                metaData.clearVersionColumns();
0963:                assertNull(metaData.getVersionColumns("", "test", "xyz"));
0964:                ResultSet testResult2 = new MockResultSet("id2");
0965:                ResultSet testResult3 = new MockResultSet("id3");
0966:                ResultSet testResult4 = new MockResultSet("id4");
0967:                metaData.setVersionColumns("", "test%", "xyz", testResult);
0968:                metaData.setVersionColumns("abc", "test", "xyz", testResult2);
0969:                metaData.setVersionColumns(null, "test", "xyz", testResult3);
0970:                assertSame(testResult2, metaData.getVersionColumns("abc",
0971:                        "test", "xyz"));
0972:                PolyResultSet polyResult = (PolyResultSet) metaData
0973:                        .getVersionColumns(null, "test", "xyz");
0974:                List resultSets = polyResult.getUnderlyingResultSetList();
0975:                assertEquals(2, resultSets.size());
0976:                assertTrue(resultSets.contains(testResult2));
0977:                assertTrue(resultSets.contains(testResult3));
0978:                assertSame(testResult, metaData.getVersionColumns("", "test%",
0979:                        "xyz"));
0980:                assertSame(testResult3, metaData.getVersionColumns("", "test",
0981:                        "xyz"));
0982:                assertSame(testResult2, metaData.getVersionColumns("abc",
0983:                        "test", "xyz"));
0984:                assertNull(metaData.getVersionColumns(null, "test_", "xyz"));
0985:                assertNull(metaData.getVersionColumns(null, "test", "xyz1"));
0986:                assertNull(metaData.getVersionColumns(null, "test", null));
0987:                metaData.setVersionColumns(testResult4);
0988:                assertSame(testResult4, metaData.getVersionColumns(null,
0989:                        "test3", "xyz"));
0990:                assertSame(testResult4, metaData.getVersionColumns(null,
0991:                        "test", "xyz1"));
0992:                assertSame(testResult4, metaData.getVersionColumns(null,
0993:                        "test", null));
0994:                polyResult = (PolyResultSet) metaData.getVersionColumns(null,
0995:                        "test", "xyz");
0996:                resultSets = polyResult.getUnderlyingResultSetList();
0997:                assertEquals(3, resultSets.size());
0998:            }
0999:
1000:            public void testVersionColumnsCaseSensitive() throws SQLException {
1001:                ResultSet testResult = new MockResultSet("id");
1002:                ResultSet testResult2 = new MockResultSet("id2");
1003:                ResultSet testResult3 = new MockResultSet("id3");
1004:                metaData.setVersionColumns("abc", "TEST", "XYz", testResult);
1005:                metaData.setVersionColumns("abc", "test", "xyz", testResult2);
1006:                metaData.setVersionColumns(null, "test", "xyz", testResult3);
1007:                PolyResultSet polyResult = (PolyResultSet) metaData
1008:                        .getVersionColumns(null, "test", "xyz");
1009:                List resultSets = polyResult.getUnderlyingResultSetList();
1010:                assertEquals(3, resultSets.size());
1011:                metaData.setCaseSensitive(true);
1012:                polyResult = (PolyResultSet) metaData.getVersionColumns(null,
1013:                        "test", "xyz");
1014:                resultSets = polyResult.getUnderlyingResultSetList();
1015:                assertEquals(2, resultSets.size());
1016:                assertSame(testResult, metaData.getVersionColumns("abc",
1017:                        "TEST", "XYz"));
1018:                assertNull(metaData.getVersionColumns("ABC", "TEST", "XYz"));
1019:                metaData.setCaseSensitive(false);
1020:                polyResult = (PolyResultSet) metaData.getVersionColumns("ABC",
1021:                        "TEST", "XYz");
1022:                resultSets = polyResult.getUnderlyingResultSetList();
1023:                assertEquals(2, resultSets.size());
1024:            }
1025:
1026:            public void testBestRowIdentifier() throws SQLException {
1027:                assertNull(metaData.getBestRowIdentifier(null, null, null, 1,
1028:                        false));
1029:                assertNull(metaData.getBestRowIdentifier("abc1", "abc2",
1030:                        "abc3", 2, true));
1031:                ResultSet testResult = new MockResultSet("id");
1032:                metaData.setBestRowIdentifier(testResult);
1033:                assertSame(testResult, metaData.getBestRowIdentifier(null,
1034:                        null, null, 1, false));
1035:                assertSame(testResult, metaData.getBestRowIdentifier("",
1036:                        "test", "xyz", 2, true));
1037:                assertSame(testResult, metaData.getBestRowIdentifier("abc1",
1038:                        "test", "xyz", 3, false));
1039:                metaData.clearBestRowIdentifier();
1040:                assertNull(metaData.getBestRowIdentifier("", "test", "xyz", 1,
1041:                        false));
1042:                ResultSet testResult2 = new MockResultSet("id2");
1043:                ResultSet testResult3 = new MockResultSet("id3");
1044:                ResultSet testResult4 = new MockResultSet("id4");
1045:                metaData.setBestRowIdentifier("", "test%", "xyz", 1, false,
1046:                        testResult);
1047:                metaData.setBestRowIdentifier("abc", "test", "xyz", 2, true,
1048:                        testResult2);
1049:                metaData.setBestRowIdentifier(null, "test", "xyz", 2, true,
1050:                        testResult3);
1051:                assertSame(testResult2, metaData.getBestRowIdentifier("abc",
1052:                        "test", "xyz", 2, true));
1053:                PolyResultSet polyResult = (PolyResultSet) metaData
1054:                        .getBestRowIdentifier(null, "test", "xyz", 2, true);
1055:                List resultSets = polyResult.getUnderlyingResultSetList();
1056:                assertEquals(2, resultSets.size());
1057:                assertTrue(resultSets.contains(testResult2));
1058:                assertTrue(resultSets.contains(testResult3));
1059:                assertSame(testResult, metaData.getBestRowIdentifier("",
1060:                        "test%", "xyz", 1, false));
1061:                assertSame(testResult3, metaData.getBestRowIdentifier("",
1062:                        "test", "xyz", 2, true));
1063:                assertSame(testResult2, metaData.getBestRowIdentifier("abc",
1064:                        "test", "xyz", 2, true));
1065:                assertNull(metaData.getBestRowIdentifier(null, "test_", "xyz",
1066:                        1, false));
1067:                assertNull(metaData.getBestRowIdentifier(null, "test", "xyz1",
1068:                        2, true));
1069:                assertNull(metaData.getBestRowIdentifier(null, "test", null, 2,
1070:                        true));
1071:                metaData.setBestRowIdentifier(testResult4);
1072:                assertSame(testResult4, metaData.getBestRowIdentifier(null,
1073:                        "test3", "xyz", 5, false));
1074:                assertSame(testResult4, metaData.getBestRowIdentifier(null,
1075:                        "test", "xyz1", 2, true));
1076:                assertSame(testResult4, metaData.getBestRowIdentifier(null,
1077:                        "test", null, 1, false));
1078:                polyResult = (PolyResultSet) metaData.getBestRowIdentifier(
1079:                        null, "test", "xyz", 2, true);
1080:                resultSets = polyResult.getUnderlyingResultSetList();
1081:                assertEquals(3, resultSets.size());
1082:            }
1083:
1084:            public void testBestRowIdentifierCaseSensitive()
1085:                    throws SQLException {
1086:                ResultSet testResult = new MockResultSet("id");
1087:                ResultSet testResult2 = new MockResultSet("id2");
1088:                ResultSet testResult3 = new MockResultSet("id3");
1089:                metaData.setBestRowIdentifier("abc", "TEST", "XYz", 1, false,
1090:                        testResult);
1091:                metaData.setBestRowIdentifier("abc", "test", "xyz", 1, false,
1092:                        testResult2);
1093:                metaData.setBestRowIdentifier(null, "test", "xyz", 1, false,
1094:                        testResult3);
1095:                PolyResultSet polyResult = (PolyResultSet) metaData
1096:                        .getBestRowIdentifier(null, "test", "xyz", 1, false);
1097:                List resultSets = polyResult.getUnderlyingResultSetList();
1098:                assertEquals(3, resultSets.size());
1099:                metaData.setCaseSensitive(true);
1100:                polyResult = (PolyResultSet) metaData.getBestRowIdentifier(
1101:                        null, "test", "xyz", 1, false);
1102:                resultSets = polyResult.getUnderlyingResultSetList();
1103:                assertEquals(2, resultSets.size());
1104:                assertSame(testResult, metaData.getBestRowIdentifier("abc",
1105:                        "TEST", "XYz", 1, false));
1106:                assertNull(metaData.getBestRowIdentifier("ABC", "TEST", "XYz",
1107:                        1, false));
1108:                metaData.setCaseSensitive(false);
1109:                polyResult = (PolyResultSet) metaData.getBestRowIdentifier(
1110:                        "ABC", "TEST", "XYz", 1, false);
1111:                resultSets = polyResult.getUnderlyingResultSetList();
1112:                assertEquals(2, resultSets.size());
1113:            }
1114:
1115:            public void testIndexInfo() throws SQLException {
1116:                assertNull(metaData.getIndexInfo(null, null, null, true, false));
1117:                assertNull(metaData.getIndexInfo("abc1", "abc2", "abc3", false,
1118:                        true));
1119:                ResultSet testResult = new MockResultSet("id");
1120:                metaData.setIndexInfo(testResult);
1121:                assertSame(testResult, metaData.getIndexInfo(null, null, null,
1122:                        true, false));
1123:                assertSame(testResult, metaData.getIndexInfo("", "test", "xyz",
1124:                        false, true));
1125:                assertSame(testResult, metaData.getIndexInfo("abc1", "test",
1126:                        "xyz", false, false));
1127:                metaData.clearIndexInfo();
1128:                assertNull(metaData
1129:                        .getIndexInfo("", "test", "xyz", true, false));
1130:                ResultSet testResult2 = new MockResultSet("id2");
1131:                ResultSet testResult3 = new MockResultSet("id3");
1132:                ResultSet testResult4 = new MockResultSet("id4");
1133:                metaData.setIndexInfo("", "test%", "xyz", true, false,
1134:                        testResult);
1135:                metaData.setIndexInfo("abc", "test", "xyz", false, true,
1136:                        testResult2);
1137:                metaData.setIndexInfo(null, "test", "xyz", false, true,
1138:                        testResult3);
1139:                assertSame(testResult2, metaData.getIndexInfo("abc", "test",
1140:                        "xyz", false, true));
1141:                PolyResultSet polyResult = (PolyResultSet) metaData
1142:                        .getIndexInfo(null, "test", "xyz", false, true);
1143:                List resultSets = polyResult.getUnderlyingResultSetList();
1144:                assertEquals(2, resultSets.size());
1145:                assertTrue(resultSets.contains(testResult2));
1146:                assertTrue(resultSets.contains(testResult3));
1147:                assertSame(testResult, metaData.getIndexInfo("", "test%",
1148:                        "xyz", true, false));
1149:                assertSame(testResult3, metaData.getIndexInfo("", "test",
1150:                        "xyz", false, true));
1151:                assertSame(testResult2, metaData.getIndexInfo("abc", "test",
1152:                        "xyz", false, true));
1153:                assertNull(metaData.getIndexInfo(null, "test_", "xyz", true,
1154:                        false));
1155:                assertNull(metaData.getIndexInfo(null, "test", "xyz1", false,
1156:                        true));
1157:                assertNull(metaData.getIndexInfo(null, "test", null, false,
1158:                        true));
1159:                metaData.setIndexInfo(testResult4);
1160:                assertSame(testResult4, metaData.getIndexInfo(null, "test3",
1161:                        "xyz", true, false));
1162:                assertSame(testResult4, metaData.getIndexInfo(null, "test",
1163:                        "xyz1", false, true));
1164:                assertSame(testResult4, metaData.getIndexInfo(null, "test",
1165:                        null, false, false));
1166:                polyResult = (PolyResultSet) metaData.getIndexInfo(null,
1167:                        "test", "xyz", false, true);
1168:                resultSets = polyResult.getUnderlyingResultSetList();
1169:                assertEquals(3, resultSets.size());
1170:            }
1171:
1172:            public void testIndexInfoCaseSensitive() throws SQLException {
1173:                ResultSet testResult = new MockResultSet("id");
1174:                ResultSet testResult2 = new MockResultSet("id2");
1175:                ResultSet testResult3 = new MockResultSet("id3");
1176:                metaData.setIndexInfo("abc", "TEST", "XYz", true, false,
1177:                        testResult);
1178:                metaData.setIndexInfo("abc", "test", "xyz", true, false,
1179:                        testResult2);
1180:                metaData.setIndexInfo(null, "test", "xyz", true, false,
1181:                        testResult3);
1182:                PolyResultSet polyResult = (PolyResultSet) metaData
1183:                        .getIndexInfo(null, "test", "xyz", true, false);
1184:                List resultSets = polyResult.getUnderlyingResultSetList();
1185:                assertEquals(3, resultSets.size());
1186:                metaData.setCaseSensitive(true);
1187:                polyResult = (PolyResultSet) metaData.getIndexInfo(null,
1188:                        "test", "xyz", true, false);
1189:                resultSets = polyResult.getUnderlyingResultSetList();
1190:                assertEquals(2, resultSets.size());
1191:                assertSame(testResult, metaData.getIndexInfo("abc", "TEST",
1192:                        "XYz", true, false));
1193:                assertNull(metaData.getIndexInfo("ABC", "TEST", "XYz", true,
1194:                        false));
1195:                metaData.setCaseSensitive(false);
1196:                polyResult = (PolyResultSet) metaData.getIndexInfo("ABC",
1197:                        "TEST", "XYz", true, false);
1198:                resultSets = polyResult.getUnderlyingResultSetList();
1199:                assertEquals(2, resultSets.size());
1200:            }
1201:
1202:            public void testUDTs() throws SQLException {
1203:                assertNull(metaData.getUDTs(null, null, null, null));
1204:                assertNull(metaData.getUDTs("abc1", "abc2", "abc3",
1205:                        new int[] { 1 }));
1206:                ResultSet testResult = new MockResultSet("id");
1207:                metaData.setUDTs(testResult);
1208:                assertSame(testResult, metaData.getUDTs(null, null, null, null));
1209:                assertSame(testResult, metaData.getUDTs("", "test", "xyz",
1210:                        new int[] { 1, 2, 3 }));
1211:                assertSame(testResult, metaData.getUDTs("abc1", "test", "xyz",
1212:                        new int[] {}));
1213:                metaData.clearUDTs();
1214:                assertNull(metaData.getUDTs("", "test", "xyz", null));
1215:                ResultSet testResult2 = new MockResultSet("id2");
1216:                ResultSet testResult3 = new MockResultSet("id3");
1217:                ResultSet testResult4 = new MockResultSet("id4");
1218:                metaData.setUDTs("", "test1", "xyz", null, testResult);
1219:                metaData.setUDTs("abc", "test", "xyz", new int[] { 1 },
1220:                        testResult2);
1221:                metaData.setUDTs(null, "test", "xyz", new int[] { 1, 2, 3 },
1222:                        testResult3);
1223:                assertSame(testResult2, metaData.getUDTs("abc", "test", "xyz",
1224:                        new int[] { 1, 2, 3 }));
1225:                PolyResultSet polyResult = (PolyResultSet) metaData.getUDTs(
1226:                        null, "test", "xyz", new int[] { 1, 2, 3 });
1227:                List resultSets = polyResult.getUnderlyingResultSetList();
1228:                assertEquals(2, resultSets.size());
1229:                assertTrue(resultSets.contains(testResult2));
1230:                assertTrue(resultSets.contains(testResult3));
1231:                assertSame(testResult, metaData.getUDTs("", "test1", "xyz",
1232:                        null));
1233:                assertSame(testResult3, metaData.getUDTs("", "test", "xyz",
1234:                        new int[] { 1, 2, 3 }));
1235:                assertSame(testResult2, metaData.getUDTs("abc", "test", "xyz",
1236:                        new int[] { 1, 2, 3 }));
1237:                assertNull(metaData.getUDTs(null, "test3", "xyz", null));
1238:                assertNull(metaData.getUDTs(null, "test", "xyz1", new int[] {
1239:                        1, 2, 3 }));
1240:                assertNull(metaData.getUDTs(null, "test", null, new int[] { 1,
1241:                        2, 3 }));
1242:                metaData.setUDTs(testResult4);
1243:                assertSame(testResult4, metaData.getUDTs(null, "test3", "xyz",
1244:                        null));
1245:                assertSame(testResult4, metaData.getUDTs(null, "test", "xyz1",
1246:                        new int[] { 1, 2, 3 }));
1247:                assertSame(testResult4, metaData.getUDTs(null, "test", null,
1248:                        new int[] {}));
1249:                polyResult = (PolyResultSet) metaData.getUDTs(null, "test",
1250:                        "xyz", new int[] { 1, 2, 3 });
1251:                resultSets = polyResult.getUnderlyingResultSetList();
1252:                assertEquals(3, resultSets.size());
1253:                metaData.clearUDTs();
1254:                metaData.setUDTs("1", "2", "3", null, testResult);
1255:                metaData.setUDTs("1", "2", "3", new int[] { 1, 2, 3 },
1256:                        testResult2);
1257:                metaData.setUDTs("1", "2", "3", new int[] { 4 }, testResult3);
1258:                metaData.setUDTs("1", "2", "3", new int[] { 1 }, testResult4);
1259:                polyResult = (PolyResultSet) metaData.getUDTs("1", "2", "3",
1260:                        null);
1261:                resultSets = polyResult.getUnderlyingResultSetList();
1262:                assertEquals(4, resultSets.size());
1263:                assertSame(testResult3, metaData.getUDTs("1", "2", "3",
1264:                        new int[] { 4 }));
1265:            }
1266:
1267:            public void testUDTsWithWildcards() throws SQLException {
1268:                ResultSet testResult = new MockResultSet("id");
1269:                metaData.setUDTs("abc", "test", "xyz", new int[] { 1 },
1270:                        testResult);
1271:                assertSame(testResult, metaData.getUDTs("abc", "test", "xyz",
1272:                        new int[] { 1 }));
1273:                assertSame(testResult, metaData.getUDTs(null, "t__t", "%",
1274:                        new int[] { 1 }));
1275:                assertSame(testResult, metaData.getUDTs("abc", "tes%", "___",
1276:                        new int[] { 1 }));
1277:                assertSame(testResult, metaData.getUDTs("abc", "%es%", "x_z",
1278:                        new int[] { 1 }));
1279:                assertSame(testResult, metaData.getUDTs(null, "_est", "xyz",
1280:                        new int[] { 1 }));
1281:                assertSame(testResult, metaData.getUDTs(null, "test", "_yz",
1282:                        new int[] { 1 }));
1283:                assertSame(testResult, metaData.getUDTs("abc", "t%", "xy_",
1284:                        new int[] { 1 }));
1285:                assertSame(testResult, metaData.getUDTs("abc", "test%", "%xyz",
1286:                        new int[] { 1 }));
1287:                assertNull(metaData.getUDTs("ab_", "test", "xyz",
1288:                        new int[] { 1 }));
1289:                assertNull(metaData.getUDTs("a%", "te_t", "xyz",
1290:                        new int[] { 1 }));
1291:                assertNull(metaData.getUDTs("abc", "test", "a%",
1292:                        new int[] { 1 }));
1293:                assertNull(metaData.getUDTs("abc", "t____", "xyz",
1294:                        new int[] { 1 }));
1295:                assertNull(metaData.getUDTs(null, "test", "%xyz_",
1296:                        new int[] { 1 }));
1297:                assertNull(metaData.getUDTs("abc", "test1%", "x_z",
1298:                        new int[] { 1 }));
1299:                ResultSet testResult2 = new MockResultSet("id2");
1300:                ResultSet testResult3 = new MockResultSet("id3");
1301:                metaData.setUDTs("abc1", "abc", "xyz", new int[] { 1 },
1302:                        testResult2);
1303:                metaData.setUDTs("abc1", "abc", "xyz1", new int[] { 1 },
1304:                        testResult3);
1305:                PolyResultSet polyResult = (PolyResultSet) metaData.getUDTs(
1306:                        null, "%", "%", null);
1307:                assertEquals(3, polyResult.getUnderlyingResultSetList().size());
1308:                assertTrue(metaData.getUDTs("abc", "%", "xyz", new int[] { 1 }) instanceof  MockResultSet);
1309:                assertTrue(metaData.getUDTs("abc1", "%", "xyz", null) instanceof  MockResultSet);
1310:                polyResult = (PolyResultSet) metaData.getUDTs(null, "a__",
1311:                        "xyz%", new int[] { 1 });
1312:                assertEquals(2, polyResult.getUnderlyingResultSetList().size());
1313:                assertTrue(metaData.getUDTs(null, "a__", "xyz_", null) instanceof  MockResultSet);
1314:                assertNull(metaData.getUDTs("%", "%", "%", null));
1315:                polyResult = (PolyResultSet) metaData.getUDTs(null, "ab%", "%",
1316:                        new int[] { 1 });
1317:                List resultSets = polyResult.getUnderlyingResultSetList();
1318:                assertEquals(2, resultSets.size());
1319:                assertTrue(resultSets.contains(testResult2));
1320:                assertTrue(resultSets.contains(testResult3));
1321:            }
1322:
1323:            public void testUDTsWithTypes() throws SQLException {
1324:                ResultSet testResult = new MockResultSet("id");
1325:                metaData.setUDTs("abc", "test", "xyz", new int[] { 1 },
1326:                        testResult);
1327:                assertNull(metaData.getUDTs("abc", "test", "xyz",
1328:                        new int[] { 2 }));
1329:                assertEquals(testResult, metaData.getUDTs("abc", "test", "xyz",
1330:                        null));
1331:                assertEquals(testResult, metaData.getUDTs("abc", "test", "xyz",
1332:                        new int[] { 1, 2 }));
1333:                ResultSet testResult2 = new MockResultSet("id2");
1334:                metaData.setUDTs("abc", "test", "xyz", new int[] { 2, 4 },
1335:                        testResult2);
1336:                assertEquals(testResult2, metaData.getUDTs("abc", "test",
1337:                        "xyz", new int[] { 2 }));
1338:                PolyResultSet polyResult = (PolyResultSet) metaData.getUDTs(
1339:                        "abc", "%", "%", new int[] { 1, 2, 3 });
1340:                List resultSets = polyResult.getUnderlyingResultSetList();
1341:                assertEquals(2, resultSets.size());
1342:                assertTrue(resultSets.contains(testResult));
1343:                assertTrue(resultSets.contains(testResult2));
1344:            }
1345:
1346:            public void testUDTsCaseSensitive() throws SQLException {
1347:                ResultSet testResult = new MockResultSet("id");
1348:                ResultSet testResult2 = new MockResultSet("id2");
1349:                ResultSet testResult3 = new MockResultSet("id3");
1350:                metaData.setUDTs("abc", "TEST", "XYz", new int[] { 1 },
1351:                        testResult);
1352:                metaData.setUDTs("abc", "test", "xyz", new int[] { 1 },
1353:                        testResult2);
1354:                metaData.setUDTs(null, "test", "xyz", new int[] { 1 },
1355:                        testResult3);
1356:                PolyResultSet polyResult = (PolyResultSet) metaData.getUDTs(
1357:                        null, "t_st", "xyz", new int[] { 1 });
1358:                List resultSets = polyResult.getUnderlyingResultSetList();
1359:                assertEquals(3, resultSets.size());
1360:                metaData.setCaseSensitive(true);
1361:                polyResult = (PolyResultSet) metaData.getUDTs(null, "t_st",
1362:                        "xyz", new int[] { 1 });
1363:                resultSets = polyResult.getUnderlyingResultSetList();
1364:                assertEquals(2, resultSets.size());
1365:                assertSame(testResult, metaData.getUDTs("abc", "TE%", "XYz",
1366:                        new int[] { 1 }));
1367:                assertNull(metaData.getUDTs("ABC", "TEST", "XYz",
1368:                        new int[] { 1 }));
1369:                metaData.setCaseSensitive(false);
1370:                polyResult = (PolyResultSet) metaData.getUDTs("ABC", "TEST",
1371:                        "_Yz", new int[] { 1 });
1372:                resultSets = polyResult.getUnderlyingResultSetList();
1373:                assertEquals(2, resultSets.size());
1374:            }
1375:
1376:            public void testAttributes() throws SQLException {
1377:                assertNull(metaData.getAttributes(null, null, null, null));
1378:                assertNull(metaData.getAttributes("abc1", "abc2", "abc3",
1379:                        "abc4"));
1380:                ResultSet testResult = new MockResultSet("id");
1381:                metaData.setAttributes(testResult);
1382:                assertSame(testResult, metaData.getAttributes(null, null, null,
1383:                        null));
1384:                assertSame(testResult, metaData.getAttributes("", "test",
1385:                        "xyz", "123"));
1386:                assertSame(testResult, metaData.getAttributes("abc1", "test",
1387:                        "xyz", "12345"));
1388:                metaData.clearAttributes();
1389:                assertNull(metaData.getAttributes("", "test", "xyz", null));
1390:                ResultSet testResult2 = new MockResultSet("id2");
1391:                ResultSet testResult3 = new MockResultSet("id3");
1392:                ResultSet testResult4 = new MockResultSet("id4");
1393:                metaData.setAttributes("", "test1", "xyz", "123", testResult);
1394:                metaData
1395:                        .setAttributes("abc", "test", "xyz", "456", testResult2);
1396:                metaData.setAttributes(null, "test", "xyz", "456", testResult3);
1397:                assertSame(testResult2, metaData.getAttributes("abc", "test",
1398:                        "xyz", "456"));
1399:                PolyResultSet polyResult = (PolyResultSet) metaData
1400:                        .getAttributes(null, "test", "xyz", "456");
1401:                List resultSets = polyResult.getUnderlyingResultSetList();
1402:                assertEquals(2, resultSets.size());
1403:                assertTrue(resultSets.contains(testResult2));
1404:                assertTrue(resultSets.contains(testResult3));
1405:                assertSame(testResult, metaData.getAttributes("", "test1",
1406:                        "xyz", "123"));
1407:                assertSame(testResult3, metaData.getAttributes("", "test",
1408:                        "xyz", "456"));
1409:                assertSame(testResult2, metaData.getAttributes("abc", "test",
1410:                        "xyz", "456"));
1411:                assertNull(metaData.getAttributes(null, "test3", "xyz", "123"));
1412:                assertNull(metaData.getAttributes(null, "test", "xyz1", "456"));
1413:                assertNull(metaData.getAttributes(null, "test", null, "456"));
1414:                assertNull(metaData.getAttributes("abc", "test", "xyz", null));
1415:                metaData.setAttributes(testResult4);
1416:                assertSame(testResult4, metaData.getAttributes(null, "test3",
1417:                        "xyz", null));
1418:                assertSame(testResult4, metaData.getAttributes(null, "test",
1419:                        "xyz1", "123"));
1420:                assertSame(testResult4, metaData.getAttributes(null, "test",
1421:                        null, null));
1422:                polyResult = (PolyResultSet) metaData.getAttributes(null,
1423:                        "test", "xyz", "456");
1424:                resultSets = polyResult.getUnderlyingResultSetList();
1425:                assertEquals(3, resultSets.size());
1426:            }
1427:
1428:            public void testAttributesWithWildcards() throws SQLException {
1429:                ResultSet testResult = new MockResultSet("id");
1430:                metaData.setAttributes("abc", "test", "xyz", "123", testResult);
1431:                assertSame(testResult, metaData.getAttributes("abc", "test",
1432:                        "xyz", "123"));
1433:                assertSame(testResult, metaData.getAttributes(null, "t__t",
1434:                        "%", "12_"));
1435:                assertSame(testResult, metaData.getAttributes("abc", "tes%",
1436:                        "___", "123"));
1437:                assertSame(testResult, metaData.getAttributes("abc", "%es%",
1438:                        "x_z", "%%"));
1439:                assertSame(testResult, metaData.getAttributes(null, "_est",
1440:                        "xyz", "1_3%"));
1441:                assertSame(testResult, metaData.getAttributes(null, "test",
1442:                        "_yz", "%123%%"));
1443:                assertSame(testResult, metaData.getAttributes("abc", "t%",
1444:                        "xy_", "___"));
1445:                assertSame(testResult, metaData.getAttributes("abc", "test%",
1446:                        "%xyz", "123"));
1447:                assertNull(metaData.getAttributes("ab_", "test", "xyz", "123"));
1448:                assertNull(metaData.getAttributes("a%", "te_t", "xyz", "123"));
1449:                assertNull(metaData.getAttributes("abc", "test", "a%", "1_3"));
1450:                assertNull(metaData.getAttributes("abc", "t____", "xyz", "1%"));
1451:                assertNull(metaData.getAttributes(null, "test", "%xyz_", "123"));
1452:                assertNull(metaData
1453:                        .getAttributes("abc", "test1%", "x_z", "123"));
1454:                assertNull(metaData.getAttributes("abc", "test%", "xyz",
1455:                        "1___%"));
1456:                ResultSet testResult2 = new MockResultSet("id2");
1457:                ResultSet testResult3 = new MockResultSet("id3");
1458:                metaData
1459:                        .setAttributes("abc1", "abc", "xyz", "456", testResult2);
1460:                metaData.setAttributes("abc1", "abc", "xyz1", "456",
1461:                        testResult3);
1462:                PolyResultSet polyResult = (PolyResultSet) metaData
1463:                        .getAttributes(null, "%", "%", "%");
1464:                assertEquals(3, polyResult.getUnderlyingResultSetList().size());
1465:                assertTrue(metaData.getAttributes("abc", "%", "xyz", "1__") instanceof  MockResultSet);
1466:                assertTrue(metaData.getAttributes("abc1", "%", "xyz", "456") instanceof  MockResultSet);
1467:                polyResult = (PolyResultSet) metaData.getAttributes(null,
1468:                        "a__", "xyz%", "_56%");
1469:                assertEquals(2, polyResult.getUnderlyingResultSetList().size());
1470:                assertTrue(metaData.getAttributes(null, "a__", "xyz_", "4_6") instanceof  MockResultSet);
1471:                assertNull(metaData.getAttributes("%", "%", "%", "%"));
1472:                polyResult = (PolyResultSet) metaData.getAttributes(null,
1473:                        "ab%", "%", "4%");
1474:                List resultSets = polyResult.getUnderlyingResultSetList();
1475:                assertEquals(2, resultSets.size());
1476:                assertTrue(resultSets.contains(testResult2));
1477:                assertTrue(resultSets.contains(testResult3));
1478:            }
1479:
1480:            public void testAttributesCaseSensitive() throws SQLException {
1481:                ResultSet testResult = new MockResultSet("id");
1482:                ResultSet testResult2 = new MockResultSet("id2");
1483:                ResultSet testResult3 = new MockResultSet("id3");
1484:                metaData.setAttributes("abc", "TEST", "XYz", "efg", testResult);
1485:                metaData
1486:                        .setAttributes("abc", "test", "xyz", "EFg", testResult2);
1487:                metaData.setAttributes(null, "test", "xyz", "EFg", testResult3);
1488:                PolyResultSet polyResult = (PolyResultSet) metaData
1489:                        .getAttributes(null, "t_st", "xyz", "EFG");
1490:                List resultSets = polyResult.getUnderlyingResultSetList();
1491:                assertEquals(3, resultSets.size());
1492:                metaData.setCaseSensitive(true);
1493:                polyResult = (PolyResultSet) metaData.getAttributes(null,
1494:                        "t_st", "xyz", "EFg");
1495:                resultSets = polyResult.getUnderlyingResultSetList();
1496:                assertEquals(2, resultSets.size());
1497:                assertSame(testResult, metaData.getAttributes("abc", "TE%",
1498:                        "XYz", "efg"));
1499:                assertNull(metaData.getAttributes("ABC", "TEST", "XYz", "efg"));
1500:                metaData.setCaseSensitive(false);
1501:                polyResult = (PolyResultSet) metaData.getAttributes("ABC",
1502:                        "TEST", "_Yz", "EFg");
1503:                resultSets = polyResult.getUnderlyingResultSetList();
1504:                assertEquals(2, resultSets.size());
1505:            }
1506:
1507:            public void testColumnPrivileges() throws SQLException {
1508:                assertNull(metaData.getColumnPrivileges(null, null, null, null));
1509:                assertNull(metaData.getColumnPrivileges("abc1", "abc2", "abc3",
1510:                        "abc4"));
1511:                ResultSet testResult = new MockResultSet("id");
1512:                metaData.setColumnPrivileges(testResult);
1513:                assertSame(testResult, metaData.getColumnPrivileges(null, null,
1514:                        null, null));
1515:                assertSame(testResult, metaData.getColumnPrivileges("", "test",
1516:                        "xyz", "123"));
1517:                assertSame(testResult, metaData.getColumnPrivileges("abc1",
1518:                        "test", "xyz", "12345"));
1519:                metaData.clearColumnPrivileges();
1520:                assertNull(metaData
1521:                        .getColumnPrivileges("", "test", "xyz", null));
1522:                ResultSet testResult2 = new MockResultSet("id2");
1523:                ResultSet testResult3 = new MockResultSet("id3");
1524:                ResultSet testResult4 = new MockResultSet("id4");
1525:                metaData.setColumnPrivileges("", "test1", "xyz", "123",
1526:                        testResult);
1527:                metaData.setColumnPrivileges("abc", "test", "xyz", "456",
1528:                        testResult2);
1529:                metaData.setColumnPrivileges(null, "test", "xyz", "456",
1530:                        testResult3);
1531:                assertSame(testResult2, metaData.getColumnPrivileges("abc",
1532:                        "test", "xyz", "456"));
1533:                PolyResultSet polyResult = (PolyResultSet) metaData
1534:                        .getColumnPrivileges(null, "test", "xyz", "456");
1535:                List resultSets = polyResult.getUnderlyingResultSetList();
1536:                assertEquals(2, resultSets.size());
1537:                assertTrue(resultSets.contains(testResult2));
1538:                assertTrue(resultSets.contains(testResult3));
1539:                assertSame(testResult, metaData.getColumnPrivileges("",
1540:                        "test1", "xyz", "123"));
1541:                assertSame(testResult3, metaData.getColumnPrivileges("",
1542:                        "test", "xyz", "456"));
1543:                assertSame(testResult2, metaData.getColumnPrivileges("abc",
1544:                        "test", "xyz", "456"));
1545:                assertNull(metaData.getColumnPrivileges(null, "test3", "xyz",
1546:                        "123"));
1547:                assertNull(metaData.getColumnPrivileges(null, "test", "xyz1",
1548:                        "456"));
1549:                assertNull(metaData.getColumnPrivileges(null, "test", null,
1550:                        "456"));
1551:                assertNull(metaData.getColumnPrivileges("abc", "test", "xyz",
1552:                        null));
1553:                metaData.setColumnPrivileges(testResult4);
1554:                assertSame(testResult4, metaData.getColumnPrivileges(null,
1555:                        "test3", "xyz", null));
1556:                assertSame(testResult4, metaData.getColumnPrivileges(null,
1557:                        "test", "xyz1", "123"));
1558:                assertSame(testResult4, metaData.getColumnPrivileges(null,
1559:                        "test", null, null));
1560:                polyResult = (PolyResultSet) metaData.getColumnPrivileges(null,
1561:                        "test", "xyz", "456");
1562:                resultSets = polyResult.getUnderlyingResultSetList();
1563:                assertEquals(3, resultSets.size());
1564:            }
1565:
1566:            public void testColumnPrivilegesWithWildcards() throws SQLException {
1567:                ResultSet testResult = new MockResultSet("id");
1568:                metaData.setColumnPrivileges("abc", "test", "xyz", "123",
1569:                        testResult);
1570:                assertSame(testResult, metaData.getColumnPrivileges("abc",
1571:                        "test", "xyz", "123"));
1572:                assertSame(testResult, metaData.getColumnPrivileges(null,
1573:                        "test", "xyz", "12_"));
1574:                assertSame(testResult, metaData.getColumnPrivileges("abc",
1575:                        "test", "xyz", "%"));
1576:                assertSame(testResult, metaData.getColumnPrivileges("abc",
1577:                        "test", "xyz", "%%"));
1578:                assertSame(testResult, metaData.getColumnPrivileges(null,
1579:                        "test", "xyz", "1_3%"));
1580:                assertNull(metaData.getColumnPrivileges("abc", "te_t", "xyz",
1581:                        "123"));
1582:                assertNull(metaData.getColumnPrivileges("abc", "test", "a%",
1583:                        "1_3"));
1584:                assertNull(metaData.getColumnPrivileges("abc", "t____", "xyz",
1585:                        "1%"));
1586:                assertNull(metaData.getColumnPrivileges(null, "test", "%xyz_",
1587:                        "123"));
1588:                assertNull(metaData.getColumnPrivileges("abc", "test1%", "x_z",
1589:                        "123"));
1590:                assertNull(metaData.getColumnPrivileges("abc", "test%", "xyz",
1591:                        "1___%"));
1592:                ResultSet testResult2 = new MockResultSet("id2");
1593:                ResultSet testResult3 = new MockResultSet("id3");
1594:                metaData.setColumnPrivileges("abc1", "abc", "xyz", "456",
1595:                        testResult2);
1596:                metaData.setColumnPrivileges("abc1", "abc", "xyz1", "456",
1597:                        testResult3);
1598:                assertSame(testResult2, metaData.getColumnPrivileges(null,
1599:                        "abc", "xyz", "%"));
1600:                assertTrue(metaData.getColumnPrivileges("abc", "test", "xyz",
1601:                        "1__") instanceof  MockResultSet);
1602:                assertTrue(metaData.getColumnPrivileges("abc1", "abc", "xyz",
1603:                        "456") instanceof  MockResultSet);
1604:                ResultSet testResult4 = new MockResultSet("id4");
1605:                metaData.setColumnPrivileges("abc1", "abc", "xyz1", "789",
1606:                        testResult4);
1607:                PolyResultSet polyResult = (PolyResultSet) metaData
1608:                        .getColumnPrivileges("abc1", "abc", "xyz1", "___");
1609:                List resultSets = polyResult.getUnderlyingResultSetList();
1610:                assertEquals(2, resultSets.size());
1611:            }
1612:
1613:            public void testColumnPrivilegesCaseSensitive() throws SQLException {
1614:                ResultSet testResult = new MockResultSet("id");
1615:                ResultSet testResult2 = new MockResultSet("id2");
1616:                ResultSet testResult3 = new MockResultSet("id3");
1617:                metaData.setColumnPrivileges("abc", "TEST", "XYz", "efg",
1618:                        testResult);
1619:                metaData.setColumnPrivileges("abc", "test", "xyz", "EFg",
1620:                        testResult2);
1621:                metaData.setColumnPrivileges(null, "test", "xyz", "EFg",
1622:                        testResult3);
1623:                PolyResultSet polyResult = (PolyResultSet) metaData
1624:                        .getColumnPrivileges(null, "test", "xyz", "EFG");
1625:                List resultSets = polyResult.getUnderlyingResultSetList();
1626:                assertEquals(3, resultSets.size());
1627:                metaData.setCaseSensitive(true);
1628:                polyResult = (PolyResultSet) metaData.getColumnPrivileges(null,
1629:                        "test", "xyz", "E_g");
1630:                resultSets = polyResult.getUnderlyingResultSetList();
1631:                assertEquals(2, resultSets.size());
1632:                assertSame(testResult, metaData.getColumnPrivileges("abc",
1633:                        "TEST", "XYz", "efg"));
1634:                assertNull(metaData.getColumnPrivileges("ABC", "TEST", "XYz",
1635:                        "efg"));
1636:                metaData.setCaseSensitive(false);
1637:                polyResult = (PolyResultSet) metaData.getColumnPrivileges(
1638:                        "ABC", "TEST", "XYz", "EF%");
1639:                resultSets = polyResult.getUnderlyingResultSetList();
1640:                assertEquals(2, resultSets.size());
1641:            }
1642:
1643:            public void testColumns() throws SQLException {
1644:                assertNull(metaData.getColumns(null, null, null, null));
1645:                assertNull(metaData.getColumns("abc1", "abc2", "abc3", "abc4"));
1646:                ResultSet testResult = new MockResultSet("id");
1647:                metaData.setColumns(testResult);
1648:                assertSame(testResult, metaData.getColumns(null, null, null,
1649:                        null));
1650:                assertSame(testResult, metaData.getColumns("", "test", "xyz",
1651:                        "123"));
1652:                assertSame(testResult, metaData.getColumns("abc1", "test",
1653:                        "xyz", "12345"));
1654:                metaData.clearColumns();
1655:                assertNull(metaData.getColumns("", "test", "xyz", null));
1656:                ResultSet testResult2 = new MockResultSet("id2");
1657:                ResultSet testResult3 = new MockResultSet("id3");
1658:                ResultSet testResult4 = new MockResultSet("id4");
1659:                metaData.setColumns("", "test1", "xyz", "123", testResult);
1660:                metaData.setColumns("abc", "test", "xyz", "456", testResult2);
1661:                metaData.setColumns(null, "test", "xyz", "456", testResult3);
1662:                assertSame(testResult2, metaData.getColumns("abc", "test",
1663:                        "xyz", "456"));
1664:                PolyResultSet polyResult = (PolyResultSet) metaData.getColumns(
1665:                        null, "test", "xyz", "456");
1666:                List resultSets = polyResult.getUnderlyingResultSetList();
1667:                assertEquals(2, resultSets.size());
1668:                assertTrue(resultSets.contains(testResult2));
1669:                assertTrue(resultSets.contains(testResult3));
1670:                assertSame(testResult, metaData.getColumns("", "test1", "xyz",
1671:                        "123"));
1672:                assertSame(testResult3, metaData.getColumns("", "test", "xyz",
1673:                        "456"));
1674:                assertSame(testResult2, metaData.getColumns("abc", "test",
1675:                        "xyz", "456"));
1676:                assertNull(metaData.getColumns(null, "test3", "xyz", "123"));
1677:                assertNull(metaData.getColumns(null, "test", "xyz1", "456"));
1678:                assertNull(metaData.getColumns(null, "test", null, "456"));
1679:                assertNull(metaData.getColumns("abc", "test", "xyz", null));
1680:                metaData.setColumns(testResult4);
1681:                assertSame(testResult4, metaData.getColumns(null, "test3",
1682:                        "xyz", null));
1683:                assertSame(testResult4, metaData.getColumns(null, "test",
1684:                        "xyz1", "123"));
1685:                assertSame(testResult4, metaData.getColumns(null, "test", null,
1686:                        null));
1687:                polyResult = (PolyResultSet) metaData.getColumns(null, "test",
1688:                        "xyz", "456");
1689:                resultSets = polyResult.getUnderlyingResultSetList();
1690:                assertEquals(3, resultSets.size());
1691:            }
1692:
1693:            public void testColumnsWithWildcards() throws SQLException {
1694:                ResultSet testResult = new MockResultSet("id");
1695:                metaData.setColumns("abc", "test", "xyz", "123", testResult);
1696:                assertSame(testResult, metaData.getColumns("abc", "test",
1697:                        "xyz", "123"));
1698:                assertSame(testResult, metaData.getColumns(null, "t__t", "%",
1699:                        "12_"));
1700:                assertSame(testResult, metaData.getColumns("abc", "tes%",
1701:                        "___", "123"));
1702:                assertSame(testResult, metaData.getColumns("abc", "%es%",
1703:                        "x_z", "%%"));
1704:                assertSame(testResult, metaData.getColumns(null, "_est", "xyz",
1705:                        "1_3%"));
1706:                assertSame(testResult, metaData.getColumns(null, "test", "_yz",
1707:                        "%123%%"));
1708:                assertSame(testResult, metaData.getColumns("abc", "t%", "xy_",
1709:                        "___"));
1710:                assertSame(testResult, metaData.getColumns("abc", "test%",
1711:                        "%xyz", "123"));
1712:                assertNull(metaData.getColumns("ab_", "test", "xyz", "123"));
1713:                assertNull(metaData.getColumns("a%", "te_t", "xyz", "123"));
1714:                assertNull(metaData.getColumns("abc", "test", "a%", "1_3"));
1715:                assertNull(metaData.getColumns("abc", "t____", "xyz", "1%"));
1716:                assertNull(metaData.getColumns(null, "test", "%xyz_", "123"));
1717:                assertNull(metaData.getColumns("abc", "test1%", "x_z", "123"));
1718:                assertNull(metaData.getColumns("abc", "test%", "xyz", "1___%"));
1719:                ResultSet testResult2 = new MockResultSet("id2");
1720:                ResultSet testResult3 = new MockResultSet("id3");
1721:                metaData.setColumns("abc1", "abc", "xyz", "456", testResult2);
1722:                metaData.setColumns("abc1", "abc", "xyz1", "456", testResult3);
1723:                PolyResultSet polyResult = (PolyResultSet) metaData.getColumns(
1724:                        null, "%", "%", "%");
1725:                assertEquals(3, polyResult.getUnderlyingResultSetList().size());
1726:                assertTrue(metaData.getColumns("abc", "%", "xyz", "1__") instanceof  MockResultSet);
1727:                assertTrue(metaData.getColumns("abc1", "%", "xyz", "456") instanceof  MockResultSet);
1728:                polyResult = (PolyResultSet) metaData.getColumns(null, "a__",
1729:                        "xyz%", "_56%");
1730:                assertEquals(2, polyResult.getUnderlyingResultSetList().size());
1731:                assertTrue(metaData.getColumns(null, "a__", "xyz_", "4_6") instanceof  MockResultSet);
1732:                assertNull(metaData.getColumns("%", "%", "%", "%"));
1733:                polyResult = (PolyResultSet) metaData.getColumns(null, "ab%",
1734:                        "%", "4%");
1735:                List resultSets = polyResult.getUnderlyingResultSetList();
1736:                assertEquals(2, resultSets.size());
1737:                assertTrue(resultSets.contains(testResult2));
1738:                assertTrue(resultSets.contains(testResult3));
1739:            }
1740:
1741:            public void testColumnsCaseSensitive() throws SQLException {
1742:                ResultSet testResult = new MockResultSet("id");
1743:                ResultSet testResult2 = new MockResultSet("id2");
1744:                ResultSet testResult3 = new MockResultSet("id3");
1745:                metaData.setColumns("abc", "TEST", "XYz", "efg", testResult);
1746:                metaData.setColumns("abc", "test", "xyz", "EFg", testResult2);
1747:                metaData.setColumns(null, "test", "xyz", "EFg", testResult3);
1748:                PolyResultSet polyResult = (PolyResultSet) metaData.getColumns(
1749:                        null, "t_st", "xyz", "EFG");
1750:                List resultSets = polyResult.getUnderlyingResultSetList();
1751:                assertEquals(3, resultSets.size());
1752:                metaData.setCaseSensitive(true);
1753:                polyResult = (PolyResultSet) metaData.getColumns(null, "t_st",
1754:                        "xyz", "EFg");
1755:                resultSets = polyResult.getUnderlyingResultSetList();
1756:                assertEquals(2, resultSets.size());
1757:                assertSame(testResult, metaData.getColumns("abc", "TE%", "XYz",
1758:                        "efg"));
1759:                assertNull(metaData.getColumns("ABC", "TEST", "XYz", "efg"));
1760:                metaData.setCaseSensitive(false);
1761:                polyResult = (PolyResultSet) metaData.getColumns("ABC", "TEST",
1762:                        "_Yz", "EFg");
1763:                resultSets = polyResult.getUnderlyingResultSetList();
1764:                assertEquals(2, resultSets.size());
1765:            }
1766:
1767:            public void testProcedureColumns() throws SQLException {
1768:                assertNull(metaData.getProcedureColumns(null, null, null, null));
1769:                assertNull(metaData.getProcedureColumns("abc1", "abc2", "abc3",
1770:                        "abc4"));
1771:                ResultSet testResult = new MockResultSet("id");
1772:                metaData.setProcedureColumns(testResult);
1773:                assertSame(testResult, metaData.getProcedureColumns(null, null,
1774:                        null, null));
1775:                assertSame(testResult, metaData.getProcedureColumns("", "test",
1776:                        "xyz", "123"));
1777:                assertSame(testResult, metaData.getProcedureColumns("abc1",
1778:                        "test", "xyz", "12345"));
1779:                metaData.clearProcedureColumns();
1780:                assertNull(metaData
1781:                        .getProcedureColumns("", "test", "xyz", null));
1782:                ResultSet testResult2 = new MockResultSet("id2");
1783:                ResultSet testResult3 = new MockResultSet("id3");
1784:                ResultSet testResult4 = new MockResultSet("id4");
1785:                metaData.setProcedureColumns("", "test1", "xyz", "123",
1786:                        testResult);
1787:                metaData.setProcedureColumns("abc", "test", "xyz", "456",
1788:                        testResult2);
1789:                metaData.setProcedureColumns(null, "test", "xyz", "456",
1790:                        testResult3);
1791:                assertSame(testResult2, metaData.getProcedureColumns("abc",
1792:                        "test", "xyz", "456"));
1793:                PolyResultSet polyResult = (PolyResultSet) metaData
1794:                        .getProcedureColumns(null, "test", "xyz", "456");
1795:                List resultSets = polyResult.getUnderlyingResultSetList();
1796:                assertEquals(2, resultSets.size());
1797:                assertTrue(resultSets.contains(testResult2));
1798:                assertTrue(resultSets.contains(testResult3));
1799:                assertSame(testResult, metaData.getProcedureColumns("",
1800:                        "test1", "xyz", "123"));
1801:                assertSame(testResult3, metaData.getProcedureColumns("",
1802:                        "test", "xyz", "456"));
1803:                assertSame(testResult2, metaData.getProcedureColumns("abc",
1804:                        "test", "xyz", "456"));
1805:                assertNull(metaData.getProcedureColumns(null, "test3", "xyz",
1806:                        "123"));
1807:                assertNull(metaData.getProcedureColumns(null, "test", "xyz1",
1808:                        "456"));
1809:                assertNull(metaData.getProcedureColumns(null, "test", null,
1810:                        "456"));
1811:                assertNull(metaData.getProcedureColumns("abc", "test", "xyz",
1812:                        null));
1813:                metaData.setProcedureColumns(testResult4);
1814:                assertSame(testResult4, metaData.getProcedureColumns(null,
1815:                        "test3", "xyz", null));
1816:                assertSame(testResult4, metaData.getProcedureColumns(null,
1817:                        "test", "xyz1", "123"));
1818:                assertSame(testResult4, metaData.getProcedureColumns(null,
1819:                        "test", null, null));
1820:                polyResult = (PolyResultSet) metaData.getProcedureColumns(null,
1821:                        "test", "xyz", "456");
1822:                resultSets = polyResult.getUnderlyingResultSetList();
1823:                assertEquals(3, resultSets.size());
1824:            }
1825:
1826:            public void testProcedureColumnsWithWildcards() throws SQLException {
1827:                ResultSet testResult = new MockResultSet("id");
1828:                metaData.setProcedureColumns("abc", "test", "xyz", "123",
1829:                        testResult);
1830:                assertSame(testResult, metaData.getProcedureColumns("abc",
1831:                        "test", "xyz", "123"));
1832:                assertSame(testResult, metaData.getProcedureColumns(null,
1833:                        "t__t", "%", "12_"));
1834:                assertSame(testResult, metaData.getProcedureColumns("abc",
1835:                        "tes%", "___", "123"));
1836:                assertSame(testResult, metaData.getProcedureColumns("abc",
1837:                        "%es%", "x_z", "%%"));
1838:                assertSame(testResult, metaData.getProcedureColumns(null,
1839:                        "_est", "xyz", "1_3%"));
1840:                assertSame(testResult, metaData.getProcedureColumns(null,
1841:                        "test", "_yz", "%123%%"));
1842:                assertSame(testResult, metaData.getProcedureColumns("abc",
1843:                        "t%", "xy_", "___"));
1844:                assertSame(testResult, metaData.getProcedureColumns("abc",
1845:                        "test%", "%xyz", "123"));
1846:                assertNull(metaData.getProcedureColumns("ab_", "test", "xyz",
1847:                        "123"));
1848:                assertNull(metaData.getProcedureColumns("a%", "te_t", "xyz",
1849:                        "123"));
1850:                assertNull(metaData.getProcedureColumns("abc", "test", "a%",
1851:                        "1_3"));
1852:                assertNull(metaData.getProcedureColumns("abc", "t____", "xyz",
1853:                        "1%"));
1854:                assertNull(metaData.getProcedureColumns(null, "test", "%xyz_",
1855:                        "123"));
1856:                assertNull(metaData.getProcedureColumns("abc", "test1%", "x_z",
1857:                        "123"));
1858:                assertNull(metaData.getProcedureColumns("abc", "test%", "xyz",
1859:                        "1___%"));
1860:                ResultSet testResult2 = new MockResultSet("id2");
1861:                ResultSet testResult3 = new MockResultSet("id3");
1862:                metaData.setProcedureColumns("abc1", "abc", "xyz", "456",
1863:                        testResult2);
1864:                metaData.setProcedureColumns("abc1", "abc", "xyz1", "456",
1865:                        testResult3);
1866:                PolyResultSet polyResult = (PolyResultSet) metaData
1867:                        .getProcedureColumns(null, "%", "%", "%");
1868:                assertEquals(3, polyResult.getUnderlyingResultSetList().size());
1869:                assertTrue(metaData.getProcedureColumns("abc", "%", "xyz",
1870:                        "1__") instanceof  MockResultSet);
1871:                assertTrue(metaData.getProcedureColumns("abc1", "%", "xyz",
1872:                        "456") instanceof  MockResultSet);
1873:                polyResult = (PolyResultSet) metaData.getProcedureColumns(null,
1874:                        "a__", "xyz%", "_56%");
1875:                assertEquals(2, polyResult.getUnderlyingResultSetList().size());
1876:                assertTrue(metaData.getProcedureColumns(null, "a__", "xyz_",
1877:                        "4_6") instanceof  MockResultSet);
1878:                assertNull(metaData.getProcedureColumns("%", "%", "%", "%"));
1879:                polyResult = (PolyResultSet) metaData.getProcedureColumns(null,
1880:                        "ab%", "%", "4%");
1881:                List resultSets = polyResult.getUnderlyingResultSetList();
1882:                assertEquals(2, resultSets.size());
1883:                assertTrue(resultSets.contains(testResult2));
1884:                assertTrue(resultSets.contains(testResult3));
1885:            }
1886:
1887:            public void testProcedureColumnsCaseSensitive() throws SQLException {
1888:                ResultSet testResult = new MockResultSet("id");
1889:                ResultSet testResult2 = new MockResultSet("id2");
1890:                ResultSet testResult3 = new MockResultSet("id3");
1891:                metaData.setProcedureColumns("abc", "TEST", "XYz", "efg",
1892:                        testResult);
1893:                metaData.setProcedureColumns("abc", "test", "xyz", "EFg",
1894:                        testResult2);
1895:                metaData.setProcedureColumns(null, "test", "xyz", "EFg",
1896:                        testResult3);
1897:                PolyResultSet polyResult = (PolyResultSet) metaData
1898:                        .getProcedureColumns(null, "t_st", "xyz", "EFG");
1899:                List resultSets = polyResult.getUnderlyingResultSetList();
1900:                assertEquals(3, resultSets.size());
1901:                metaData.setCaseSensitive(true);
1902:                polyResult = (PolyResultSet) metaData.getProcedureColumns(null,
1903:                        "t_st", "xyz", "EFg");
1904:                resultSets = polyResult.getUnderlyingResultSetList();
1905:                assertEquals(2, resultSets.size());
1906:                assertSame(testResult, metaData.getProcedureColumns("abc",
1907:                        "TE%", "XYz", "efg"));
1908:                assertNull(metaData.getProcedureColumns("ABC", "TEST", "XYz",
1909:                        "efg"));
1910:                metaData.setCaseSensitive(false);
1911:                polyResult = (PolyResultSet) metaData.getProcedureColumns(
1912:                        "ABC", "TEST", "_Yz", "EFg");
1913:                resultSets = polyResult.getUnderlyingResultSetList();
1914:                assertEquals(2, resultSets.size());
1915:            }
1916:
1917:            public void testFunctionColumns() throws SQLException {
1918:                assertNull(metaData.getFunctionColumns(null, null, null, null));
1919:                assertNull(metaData.getFunctionColumns("abc1", "abc2", "abc3",
1920:                        "abc4"));
1921:                ResultSet testResult = new MockResultSet("id");
1922:                metaData.setFunctionColumns(testResult);
1923:                assertSame(testResult, metaData.getFunctionColumns(null, null,
1924:                        null, null));
1925:                assertSame(testResult, metaData.getFunctionColumns("", "test",
1926:                        "xyz", "123"));
1927:                assertSame(testResult, metaData.getFunctionColumns("abc1",
1928:                        "test", "xyz", "12345"));
1929:                metaData.clearFunctionColumns();
1930:                assertNull(metaData.getFunctionColumns("", "test", "xyz", null));
1931:                ResultSet testResult2 = new MockResultSet("id2");
1932:                ResultSet testResult3 = new MockResultSet("id3");
1933:                ResultSet testResult4 = new MockResultSet("id4");
1934:                metaData.setFunctionColumns("", "test1", "xyz", "123",
1935:                        testResult);
1936:                metaData.setFunctionColumns("abc", "test", "xyz", "456",
1937:                        testResult2);
1938:                metaData.setFunctionColumns(null, "test", "xyz", "456",
1939:                        testResult3);
1940:                assertSame(testResult2, metaData.getFunctionColumns("abc",
1941:                        "test", "xyz", "456"));
1942:                PolyResultSet polyResult = (PolyResultSet) metaData
1943:                        .getFunctionColumns(null, "test", "xyz", "456");
1944:                List resultSets = polyResult.getUnderlyingResultSetList();
1945:                assertEquals(2, resultSets.size());
1946:                assertTrue(resultSets.contains(testResult2));
1947:                assertTrue(resultSets.contains(testResult3));
1948:                assertSame(testResult, metaData.getFunctionColumns("", "test1",
1949:                        "xyz", "123"));
1950:                assertSame(testResult3, metaData.getFunctionColumns("", "test",
1951:                        "xyz", "456"));
1952:                assertSame(testResult2, metaData.getFunctionColumns("abc",
1953:                        "test", "xyz", "456"));
1954:                assertNull(metaData.getFunctionColumns(null, "test3", "xyz",
1955:                        "123"));
1956:                assertNull(metaData.getFunctionColumns(null, "test", "xyz1",
1957:                        "456"));
1958:                assertNull(metaData.getFunctionColumns(null, "test", null,
1959:                        "456"));
1960:                assertNull(metaData.getFunctionColumns("abc", "test", "xyz",
1961:                        null));
1962:                metaData.setFunctionColumns(testResult4);
1963:                assertSame(testResult4, metaData.getFunctionColumns(null,
1964:                        "test3", "xyz", null));
1965:                assertSame(testResult4, metaData.getFunctionColumns(null,
1966:                        "test", "xyz1", "123"));
1967:                assertSame(testResult4, metaData.getFunctionColumns(null,
1968:                        "test", null, null));
1969:                polyResult = (PolyResultSet) metaData.getFunctionColumns(null,
1970:                        "test", "xyz", "456");
1971:                resultSets = polyResult.getUnderlyingResultSetList();
1972:                assertEquals(3, resultSets.size());
1973:            }
1974:
1975:            public void testFunctionColumnsWithWildcards() throws SQLException {
1976:                ResultSet testResult = new MockResultSet("id");
1977:                metaData.setFunctionColumns("abc", "test", "xyz", "123",
1978:                        testResult);
1979:                assertSame(testResult, metaData.getFunctionColumns("abc",
1980:                        "test", "xyz", "123"));
1981:                assertSame(testResult, metaData.getFunctionColumns(null,
1982:                        "t__t", "%", "12_"));
1983:                assertSame(testResult, metaData.getFunctionColumns("abc",
1984:                        "tes%", "___", "123"));
1985:                assertSame(testResult, metaData.getFunctionColumns("abc",
1986:                        "%es%", "x_z", "%%"));
1987:                assertSame(testResult, metaData.getFunctionColumns(null,
1988:                        "_est", "xyz", "1_3%"));
1989:                assertSame(testResult, metaData.getFunctionColumns(null,
1990:                        "test", "_yz", "%123%%"));
1991:                assertSame(testResult, metaData.getFunctionColumns("abc", "t%",
1992:                        "xy_", "___"));
1993:                assertSame(testResult, metaData.getFunctionColumns("abc",
1994:                        "test%", "%xyz", "123"));
1995:                assertNull(metaData.getFunctionColumns("ab_", "test", "xyz",
1996:                        "123"));
1997:                assertNull(metaData.getFunctionColumns("a%", "te_t", "xyz",
1998:                        "123"));
1999:                assertNull(metaData.getFunctionColumns("abc", "test", "a%",
2000:                        "1_3"));
2001:                assertNull(metaData.getFunctionColumns("abc", "t____", "xyz",
2002:                        "1%"));
2003:                assertNull(metaData.getFunctionColumns(null, "test", "%xyz_",
2004:                        "123"));
2005:                assertNull(metaData.getFunctionColumns("abc", "test1%", "x_z",
2006:                        "123"));
2007:                assertNull(metaData.getFunctionColumns("abc", "test%", "xyz",
2008:                        "1___%"));
2009:                ResultSet testResult2 = new MockResultSet("id2");
2010:                ResultSet testResult3 = new MockResultSet("id3");
2011:                metaData.setFunctionColumns("abc1", "abc", "xyz", "456",
2012:                        testResult2);
2013:                metaData.setFunctionColumns("abc1", "abc", "xyz1", "456",
2014:                        testResult3);
2015:                PolyResultSet polyResult = (PolyResultSet) metaData
2016:                        .getFunctionColumns(null, "%", "%", "%");
2017:                assertEquals(3, polyResult.getUnderlyingResultSetList().size());
2018:                assertTrue(metaData
2019:                        .getFunctionColumns("abc", "%", "xyz", "1__") instanceof  MockResultSet);
2020:                assertTrue(metaData.getFunctionColumns("abc1", "%", "xyz",
2021:                        "456") instanceof  MockResultSet);
2022:                polyResult = (PolyResultSet) metaData.getFunctionColumns(null,
2023:                        "a__", "xyz%", "_56%");
2024:                assertEquals(2, polyResult.getUnderlyingResultSetList().size());
2025:                assertTrue(metaData.getFunctionColumns(null, "a__", "xyz_",
2026:                        "4_6") instanceof  MockResultSet);
2027:                assertNull(metaData.getFunctionColumns("%", "%", "%", "%"));
2028:                polyResult = (PolyResultSet) metaData.getFunctionColumns(null,
2029:                        "ab%", "%", "4%");
2030:                List resultSets = polyResult.getUnderlyingResultSetList();
2031:                assertEquals(2, resultSets.size());
2032:                assertTrue(resultSets.contains(testResult2));
2033:                assertTrue(resultSets.contains(testResult3));
2034:            }
2035:
2036:            public void testFunctionColumnsCaseSensitive() throws SQLException {
2037:                ResultSet testResult = new MockResultSet("id");
2038:                ResultSet testResult2 = new MockResultSet("id2");
2039:                ResultSet testResult3 = new MockResultSet("id3");
2040:                metaData.setFunctionColumns("abc", "TEST", "XYz", "efg",
2041:                        testResult);
2042:                metaData.setFunctionColumns("abc", "test", "xyz", "EFg",
2043:                        testResult2);
2044:                metaData.setFunctionColumns(null, "test", "xyz", "EFg",
2045:                        testResult3);
2046:                PolyResultSet polyResult = (PolyResultSet) metaData
2047:                        .getFunctionColumns(null, "t_st", "xyz", "EFG");
2048:                List resultSets = polyResult.getUnderlyingResultSetList();
2049:                assertEquals(3, resultSets.size());
2050:                metaData.setCaseSensitive(true);
2051:                polyResult = (PolyResultSet) metaData.getFunctionColumns(null,
2052:                        "t_st", "xyz", "EFg");
2053:                resultSets = polyResult.getUnderlyingResultSetList();
2054:                assertEquals(2, resultSets.size());
2055:                assertSame(testResult, metaData.getFunctionColumns("abc",
2056:                        "TE%", "XYz", "efg"));
2057:                assertNull(metaData.getFunctionColumns("ABC", "TEST", "XYz",
2058:                        "efg"));
2059:                metaData.setCaseSensitive(false);
2060:                polyResult = (PolyResultSet) metaData.getFunctionColumns("ABC",
2061:                        "TEST", "_Yz", "EFg");
2062:                resultSets = polyResult.getUnderlyingResultSetList();
2063:                assertEquals(2, resultSets.size());
2064:            }
2065:
2066:            public void testTables() throws SQLException {
2067:                assertNull(metaData.getTables(null, null, null, null));
2068:                assertNull(metaData.getTables("abc1", "abc2", "abc3",
2069:                        new String[] { "1", "2", "3" }));
2070:                ResultSet testResult = new MockResultSet("id");
2071:                metaData.setTables(testResult);
2072:                assertSame(testResult, metaData.getTables(null, null, null,
2073:                        null));
2074:                assertSame(testResult, metaData.getTables("", "test", "xyz",
2075:                        new String[] { "1", "2", "3" }));
2076:                assertSame(testResult, metaData.getTables("abc1", "test",
2077:                        "xyz", new String[] {}));
2078:                metaData.clearTables();
2079:                assertNull(metaData.getTables("", "test", "xyz", null));
2080:                ResultSet testResult2 = new MockResultSet("id2");
2081:                ResultSet testResult3 = new MockResultSet("id3");
2082:                ResultSet testResult4 = new MockResultSet("id4");
2083:                metaData.setTables("", "test1", "xyz", null, testResult);
2084:                metaData.setTables("abc", "test", "xyz", new String[] { "1" },
2085:                        testResult2);
2086:                metaData.setTables(null, "test", "xyz",
2087:                        new String[] { "2", "3" }, testResult3);
2088:                assertSame(testResult2, metaData.getTables("abc", "test",
2089:                        "xyz", new String[] { "1", "2", "3" }));
2090:                PolyResultSet polyResult = (PolyResultSet) metaData.getTables(
2091:                        null, "test", "xyz", new String[] { "1", "2", "3" });
2092:                List resultSets = polyResult.getUnderlyingResultSetList();
2093:                assertEquals(2, resultSets.size());
2094:                assertTrue(resultSets.contains(testResult2));
2095:                assertTrue(resultSets.contains(testResult3));
2096:                assertSame(testResult, metaData.getTables("", "test1", "xyz",
2097:                        null));
2098:                assertSame(testResult3, metaData.getTables("", "test", "xyz",
2099:                        new String[] { "1", "2", "3" }));
2100:                assertSame(testResult2, metaData.getTables("abc", "test",
2101:                        "xyz", new String[] { "1", "2", "3" }));
2102:                assertNull(metaData.getTables(null, "test3", "xyz", null));
2103:                assertNull(metaData.getTables(null, "test", "xyz1",
2104:                        new String[] { "1", "2", "3" }));
2105:                assertNull(metaData.getTables(null, "test", null, new String[] {
2106:                        "1", "2", "3" }));
2107:                metaData.setTables(testResult4);
2108:                assertSame(testResult4, metaData.getTables(null, "test3",
2109:                        "xyz", null));
2110:                assertSame(testResult4, metaData.getTables(null, "test",
2111:                        "xyz1", new String[] { "1", "2", "3" }));
2112:                assertSame(testResult4, metaData.getTables(null, "test", null,
2113:                        new String[] {}));
2114:                polyResult = (PolyResultSet) metaData.getTables(null, "test",
2115:                        "xyz", new String[] { "1", "2", "3" });
2116:                resultSets = polyResult.getUnderlyingResultSetList();
2117:                assertEquals(3, resultSets.size());
2118:                metaData.clearTables();
2119:                metaData.setTables("1", "2", "3", null, testResult);
2120:                metaData.setTables("1", "2", "3",
2121:                        new String[] { "1", "2", "3" }, testResult2);
2122:                metaData.setTables("1", "2", "3", new String[] { "5" },
2123:                        testResult3);
2124:                metaData.setTables("1", "2", "3", new String[] { "1" },
2125:                        testResult4);
2126:                polyResult = (PolyResultSet) metaData.getTables("1", "2", "3",
2127:                        null);
2128:                resultSets = polyResult.getUnderlyingResultSetList();
2129:                assertEquals(4, resultSets.size());
2130:                assertSame(testResult3, metaData.getTables("1", "2", "3",
2131:                        new String[] { "5", "6" }));
2132:            }
2133:
2134:            public void testTablesWithWildcards() throws SQLException {
2135:                ResultSet testResult = new MockResultSet("id");
2136:                metaData.setTables("abc", "test", "xyz", new String[] { "1" },
2137:                        testResult);
2138:                assertSame(testResult, metaData.getTables("abc", "test", "xyz",
2139:                        new String[] { "1" }));
2140:                assertSame(testResult, metaData.getTables(null, "t__t", "%",
2141:                        new String[] { "1" }));
2142:                assertSame(testResult, metaData.getTables("abc", "tes%", "___",
2143:                        new String[] { "1" }));
2144:                assertSame(testResult, metaData.getTables("abc", "%es%", "x_z",
2145:                        new String[] { "1" }));
2146:                assertSame(testResult, metaData.getTables(null, "_est", "xyz",
2147:                        new String[] { "1" }));
2148:                assertSame(testResult, metaData.getTables(null, "test", "_yz",
2149:                        new String[] { "1" }));
2150:                assertSame(testResult, metaData.getTables("abc", "t%", "xy_",
2151:                        new String[] { "1" }));
2152:                assertSame(testResult, metaData.getTables("abc", "test%",
2153:                        "%xyz", new String[] { "1" }));
2154:                assertNull(metaData.getTables("ab_", "test", "xyz",
2155:                        new String[] { "1" }));
2156:                assertNull(metaData.getTables("a%", "te_t", "xyz",
2157:                        new String[] { "1" }));
2158:                assertNull(metaData.getTables("abc", "test", "a%",
2159:                        new String[] { "1" }));
2160:                assertNull(metaData.getTables("abc", "t____", "xyz",
2161:                        new String[] { "1" }));
2162:                assertNull(metaData.getTables(null, "test", "%xyz_",
2163:                        new String[] { "1" }));
2164:                assertNull(metaData.getTables("abc", "test1%", "x_z",
2165:                        new String[] { "1" }));
2166:                ResultSet testResult2 = new MockResultSet("id2");
2167:                ResultSet testResult3 = new MockResultSet("id3");
2168:                metaData.setTables("abc1", "abc", "xyz", new String[] { "1" },
2169:                        testResult2);
2170:                metaData.setTables("abc1", "abc", "xyz1", new String[] { "1" },
2171:                        testResult3);
2172:                PolyResultSet polyResult = (PolyResultSet) metaData.getTables(
2173:                        null, "%", "%", null);
2174:                assertEquals(3, polyResult.getUnderlyingResultSetList().size());
2175:                assertTrue(metaData.getTables("abc", "%", "xyz",
2176:                        new String[] { "1" }) instanceof  MockResultSet);
2177:                assertTrue(metaData.getTables("abc1", "%", "xyz", null) instanceof  MockResultSet);
2178:                polyResult = (PolyResultSet) metaData.getTables(null, "a__",
2179:                        "xyz%", new String[] { "1" });
2180:                assertEquals(2, polyResult.getUnderlyingResultSetList().size());
2181:                assertTrue(metaData.getTables(null, "a__", "xyz_", null) instanceof  MockResultSet);
2182:                assertNull(metaData.getTables("%", "%", "%", null));
2183:                polyResult = (PolyResultSet) metaData.getTables(null, "ab%",
2184:                        "%", new String[] { "1" });
2185:                List resultSets = polyResult.getUnderlyingResultSetList();
2186:                assertEquals(2, resultSets.size());
2187:                assertTrue(resultSets.contains(testResult2));
2188:                assertTrue(resultSets.contains(testResult3));
2189:            }
2190:
2191:            public void testTablesWithTypes() throws SQLException {
2192:                ResultSet testResult = new MockResultSet("id");
2193:                metaData.setTables("abc", "test", "xyz", new String[] { "1" },
2194:                        testResult);
2195:                assertNull(metaData.getTables("abc", "test", "xyz",
2196:                        new String[] { "2" }));
2197:                assertEquals(testResult, metaData.getTables("abc", "test",
2198:                        "xyz", null));
2199:                assertEquals(testResult, metaData.getTables("abc", "test",
2200:                        "xyz", new String[] { "1", "2" }));
2201:                ResultSet testResult2 = new MockResultSet("id2");
2202:                metaData.setTables("abc", "test", "xyz", new String[] { "2",
2203:                        "4" }, testResult2);
2204:                assertEquals(testResult2, metaData.getTables("abc", "test",
2205:                        "xyz", new String[] { "2" }));
2206:                PolyResultSet polyResult = (PolyResultSet) metaData.getTables(
2207:                        "abc", "%", "%", new String[] { "1", "2", "3" });
2208:                List resultSets = polyResult.getUnderlyingResultSetList();
2209:                assertEquals(2, resultSets.size());
2210:                assertTrue(resultSets.contains(testResult));
2211:                assertTrue(resultSets.contains(testResult2));
2212:            }
2213:
2214:            public void testTablesCaseSensitive() throws SQLException {
2215:                ResultSet testResult = new MockResultSet("id");
2216:                ResultSet testResult2 = new MockResultSet("id2");
2217:                ResultSet testResult3 = new MockResultSet("id3");
2218:                metaData.setTables("abc", "TEST", "XYz", new String[] { "a" },
2219:                        testResult);
2220:                metaData.setTables("abc", "test", "xyz", new String[] { "a" },
2221:                        testResult2);
2222:                metaData.setTables(null, "test", "xyz", new String[] { "a" },
2223:                        testResult3);
2224:                PolyResultSet polyResult = (PolyResultSet) metaData.getTables(
2225:                        null, "t_st", "xyz", new String[] { "a" });
2226:                List resultSets = polyResult.getUnderlyingResultSetList();
2227:                assertEquals(3, resultSets.size());
2228:                metaData.setCaseSensitive(true);
2229:                polyResult = (PolyResultSet) metaData.getTables(null, "t_st",
2230:                        "xyz", new String[] { "a" });
2231:                resultSets = polyResult.getUnderlyingResultSetList();
2232:                assertEquals(2, resultSets.size());
2233:                assertSame(testResult, metaData.getTables("abc", "TE%", "XYz",
2234:                        new String[] { "a" }));
2235:                assertNull(metaData.getTables("ABC", "TEST", "XYz",
2236:                        new String[] { "a" }));
2237:                metaData.setCaseSensitive(false);
2238:                polyResult = (PolyResultSet) metaData.getTables("ABC", "TEST",
2239:                        "_Yz", new String[] { "a" });
2240:                resultSets = polyResult.getUnderlyingResultSetList();
2241:                assertEquals(2, resultSets.size());
2242:            }
2243:
2244:            public void testCrossReference() throws SQLException {
2245:                assertNull(metaData.getCrossReference(null, null, null, null,
2246:                        null, null));
2247:                assertNull(metaData.getCrossReference(null, "ab", null, "12",
2248:                        null, "34"));
2249:                ResultSet testResult = new MockResultSet("id");
2250:                metaData.setCrossReference(testResult);
2251:                assertSame(testResult, metaData.getCrossReference(null, null,
2252:                        null, null, null, null));
2253:                assertSame(testResult, metaData.getCrossReference("", "", "",
2254:                        "", "", ""));
2255:                assertSame(testResult, metaData.getCrossReference(null, "ab",
2256:                        null, "12", null, "34"));
2257:                metaData.clearCrossReference();
2258:                assertNull(metaData.getCrossReference(null, "ab", null, "12",
2259:                        null, "34"));
2260:                ResultSet testResult2 = new MockResultSet("id2");
2261:                metaData.setCrossReference(null, "ab", "78", "12", null, "34",
2262:                        testResult);
2263:                metaData.setCrossReference("cd", "ab", "78", "12", "56", "34",
2264:                        testResult2);
2265:                PolyResultSet polyResult = (PolyResultSet) metaData
2266:                        .getCrossReference(null, "ab", "78", "12", null, "34");
2267:                List resultSets = polyResult.getUnderlyingResultSetList();
2268:                assertEquals(2, resultSets.size());
2269:                assertTrue(resultSets.contains(testResult));
2270:                assertTrue(resultSets.contains(testResult2));
2271:                assertSame(testResult2, metaData.getCrossReference("cd", "ab",
2272:                        "78", "12", "56", "34"));
2273:                assertNull(metaData.getCrossReference(null, "b", "78", "12",
2274:                        null, "34"));
2275:                assertNull(metaData.getCrossReference("cd", "ab", "78", "12",
2276:                        "56", null));
2277:                metaData.setCrossReference(testResult);
2278:                assertSame(testResult, metaData.getCrossReference("cd", "ab",
2279:                        "78", "12", "56", null));
2280:            }
2281:
2282:            public void testCrossReferenceCaseSensitive() throws SQLException {
2283:                ResultSet testResult = new MockResultSet("id");
2284:                ResultSet testResult2 = new MockResultSet("id2");
2285:                ResultSet testResult3 = new MockResultSet("id3");
2286:                metaData.setCrossReference("ab", "cd", "ef", "gh", "ij", "kl",
2287:                        testResult);
2288:                metaData.setCrossReference("Ab", "cd", "EF", "gh", "ij", "kl",
2289:                        testResult2);
2290:                metaData.setCrossReference("ab", "CD", "ef", "gH", "IJ", "kl",
2291:                        testResult3);
2292:                PolyResultSet polyResult = (PolyResultSet) metaData
2293:                        .getCrossReference("ab", "Cd", "ef", "gh", "ij", "kl");
2294:                List resultSets = polyResult.getUnderlyingResultSetList();
2295:                assertEquals(3, resultSets.size());
2296:                assertTrue(resultSets.contains(testResult));
2297:                assertTrue(resultSets.contains(testResult2));
2298:                assertTrue(resultSets.contains(testResult3));
2299:                metaData.setCaseSensitive(true);
2300:                assertSame(testResult2, metaData.getCrossReference("Ab", "cd",
2301:                        "EF", "gh", "ij", "kl"));
2302:            }
2303:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.