001: /*
002: * $Id: TestAxionDatabaseMetaData.java,v 1.31 2005/12/20 18:32:47 ahimanikya Exp $
003: * =======================================================================
004: * Copyright (c) 2003-2005 Axion Development Team. All rights reserved.
005: *
006: * Redistribution and use in source and binary forms, with or without
007: * modification, are permitted provided that the following conditions
008: * are met:
009: *
010: * 1. Redistributions of source code must retain the above
011: * copyright notice, this list of conditions and the following
012: * disclaimer.
013: *
014: * 2. Redistributions in binary form must reproduce the above copyright
015: * notice, this list of conditions and the following disclaimer in
016: * the documentation and/or other materials provided with the
017: * distribution.
018: *
019: * 3. The names "Tigris", "Axion", nor the names of its contributors may
020: * not be used to endorse or promote products derived from this
021: * software without specific prior written permission.
022: *
023: * 4. Products derived from this software may not be called "Axion", nor
024: * may "Tigris" or "Axion" appear in their names without specific prior
025: * written permission.
026: *
027: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
028: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
029: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
030: * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
031: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
032: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
033: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
034: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
035: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
036: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
037: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
038: * =======================================================================
039: */
040:
041: package org.axiondb.jdbc;
042:
043: import java.io.File;
044: import java.sql.Connection;
045: import java.sql.DatabaseMetaData;
046: import java.sql.ResultSet;
047: import java.sql.SQLException;
048: import java.util.List;
049:
050: import junit.framework.Test;
051: import junit.framework.TestSuite;
052:
053: import org.axiondb.AxionException;
054: import org.axiondb.DataType;
055: import org.axiondb.Database;
056: import org.axiondb.DatabaseLink;
057: import org.axiondb.Index;
058: import org.axiondb.IndexFactory;
059: import org.axiondb.Sequence;
060: import org.axiondb.Table;
061: import org.axiondb.TableFactory;
062: import org.axiondb.TableIdentifier;
063: import org.axiondb.TransactionManager;
064: import org.axiondb.event.DatabaseModificationListener;
065: import org.axiondb.functional.AbstractFunctionalTest;
066: import org.axiondb.functions.ConcreteFunction;
067:
068: /**
069: * @version $Revision: 1.31 $ $Date: 2005/12/20 18:32:47 $
070: * @author Rod Waldhoff
071: * @author Ahimanikya Satapathy
072: */
073: public class TestAxionDatabaseMetaData extends AbstractFunctionalTest {
074:
075: private DatabaseMetaData _meta = null;
076:
077: public TestAxionDatabaseMetaData(String testName) {
078: super (testName);
079: }
080:
081: public static Test suite() {
082: return new TestSuite(TestAxionDatabaseMetaData.class);
083: }
084:
085: public void setUp() throws Exception {
086: super .setUp();
087: _meta = _conn.getMetaData();
088: }
089:
090: public void tearDown() throws Exception {
091: super .tearDown();
092: _meta = null;
093: }
094:
095: public void testGetNumericFunctions() throws Exception {
096: try {
097: _meta.getNumericFunctions();
098: fail("Expected SQLException");
099: } catch (SQLException e) {
100: // expected
101: }
102: }
103:
104: public void testGetSystemFunctions() throws Exception {
105: try {
106: _meta.getSystemFunctions();
107: fail("Expected SQLException");
108: } catch (SQLException e) {
109: // expected
110: }
111: }
112:
113: public void testGetSQLKeywords() throws Exception {
114: try {
115: _meta.getSQLKeywords();
116: fail("Expected SQLException");
117: } catch (SQLException e) {
118: // expected
119: }
120: }
121:
122: public void testGetSearchStringEscape() throws Exception {
123: try {
124: _meta.getSearchStringEscape();
125: fail("Expected SQLException");
126: } catch (SQLException e) {
127: // expected
128: }
129: }
130:
131: public void testGetStringFunctions() throws Exception {
132: try {
133: _meta.getStringFunctions();
134: fail("Expected SQLException");
135: } catch (SQLException e) {
136: // expected
137: }
138: }
139:
140: public void testGettTimeDateFunctions() throws Exception {
141: try {
142: _meta.getTimeDateFunctions();
143: fail("Expected SQLException");
144: } catch (SQLException e) {
145: // expected
146: }
147: }
148:
149: public void testGetExtraNameCharacters() throws Exception {
150: try {
151: _meta.getExtraNameCharacters();
152: fail("Expected SQLException");
153: } catch (SQLException e) {
154: // expected
155: }
156: }
157:
158: public void testGetSchemaTerm() throws Exception {
159: try {
160: _meta.getSchemaTerm();
161: fail("Expected SQLException");
162: } catch (SQLException e) {
163: // expected
164: }
165: }
166:
167: public void testGetProcedureTerm() throws Exception {
168: try {
169: _meta.getProcedureTerm();
170: fail("Expected SQLException");
171: } catch (SQLException e) {
172: // expected
173: }
174: }
175:
176: public void testGetCatalogTerm() throws Exception {
177: try {
178: _meta.getCatalogTerm();
179: fail("Expected SQLException");
180: } catch (SQLException e) {
181: // expected
182: }
183: }
184:
185: public void testIsCatalogAtStart() throws Exception {
186: try {
187: _meta.isCatalogAtStart();
188: fail("Expected SQLException");
189: } catch (SQLException e) {
190: // expected
191: }
192: }
193:
194: public void testGetCatalogSeparator() throws Exception {
195: try {
196: _meta.getCatalogSeparator();
197: fail("Expected SQLException");
198: } catch (SQLException e) {
199: // expected
200: }
201: }
202:
203: public void testGetProcedures() throws Exception {
204: try {
205: _meta.getProcedures(null, null, null);
206: fail("Expected SQLException");
207: } catch (SQLException e) {
208: // expected
209: }
210: }
211:
212: public void testGetProcedureColumns() throws Exception {
213: try {
214: _meta.getProcedureColumns(null, null, null, null);
215: fail("Expected SQLException");
216: } catch (SQLException e) {
217: // expected
218: }
219: }
220:
221: public void testGetColumnPrivileges() throws Exception {
222: try {
223: _meta.getColumnPrivileges(null, null, null, null);
224: fail("Expected SQLException");
225: } catch (SQLException e) {
226: // expected
227: }
228: }
229:
230: public void testGetTablePrivileges() throws Exception {
231: try {
232: _meta.getTablePrivileges(null, null, null);
233: fail("Expected SQLException");
234: } catch (SQLException e) {
235: // expected
236: }
237: }
238:
239: public void testGetBestRowIdentifier() throws Exception {
240: try {
241: _meta.getBestRowIdentifier(null, null, null, 0, false);
242: fail("Expected SQLException");
243: } catch (SQLException e) {
244: // expected
245: }
246: }
247:
248: public void testGetVersionColumns() throws Exception {
249: try {
250: _meta.getVersionColumns(null, null, null);
251: fail("Expected SQLException");
252: } catch (SQLException e) {
253: // expected
254: }
255: }
256:
257: public void testGetPrimaryKeys() throws Exception {
258: try {
259: _meta.getPrimaryKeys(null, null, null);
260: fail("Expected SQLException");
261: } catch (SQLException e) {
262: // expected
263: }
264: }
265:
266: public void testGetImportedKeys() throws Exception {
267: try {
268: _meta.getImportedKeys(null, null, null);
269: fail("Expected SQLException");
270: } catch (SQLException e) {
271: // expected
272: }
273: }
274:
275: public void testGetExportedKeys() throws Exception {
276: try {
277: _meta.getExportedKeys(null, null, null);
278: fail("Expected SQLException");
279: } catch (SQLException e) {
280: // expected
281: }
282: }
283:
284: public void testGetCrossReference() throws Exception {
285: try {
286: _meta.getCrossReference(null, null, null, null, null, null);
287: fail("Expected SQLException");
288: } catch (SQLException e) {
289: // expected
290: }
291: }
292:
293: public void testSupportsResultSetConcurrency() throws Exception {
294: assertTrue(_meta
295: .supportsResultSetConcurrency(
296: ResultSet.TYPE_FORWARD_ONLY,
297: ResultSet.CONCUR_READ_ONLY));
298: assertTrue(_meta
299: .supportsResultSetConcurrency(
300: ResultSet.TYPE_FORWARD_ONLY,
301: ResultSet.CONCUR_UPDATABLE));
302: assertTrue(_meta.supportsResultSetConcurrency(
303: ResultSet.TYPE_SCROLL_SENSITIVE,
304: ResultSet.CONCUR_READ_ONLY));
305: assertTrue(_meta.supportsResultSetConcurrency(
306: ResultSet.TYPE_SCROLL_SENSITIVE,
307: ResultSet.CONCUR_UPDATABLE));
308: assertFalse(_meta.supportsResultSetConcurrency(
309: ResultSet.TYPE_SCROLL_INSENSITIVE,
310: ResultSet.CONCUR_READ_ONLY));
311: assertFalse(_meta.supportsResultSetConcurrency(
312: ResultSet.TYPE_SCROLL_INSENSITIVE,
313: ResultSet.CONCUR_UPDATABLE));
314:
315: try {
316: _meta.supportsResultSetConcurrency(0, 0);
317: fail("Expected SQLException");
318: } catch (SQLException e) {
319: // expected
320: }
321: }
322:
323: public void testChangeVisibility() throws Exception {
324: assertTrue(_meta
325: .ownDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY));
326: assertTrue(_meta
327: .ownUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY));
328: assertTrue(_meta
329: .ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));
330: assertFalse(_meta
331: .ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE));
332: assertTrue(_meta
333: .ownInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY));
334: assertTrue(!_meta
335: .othersDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY));
336: assertTrue(!_meta
337: .othersUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY));
338: assertTrue(!_meta
339: .othersInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY));
340: assertFalse(_meta
341: .updatesAreDetected(ResultSet.TYPE_FORWARD_ONLY));
342: assertFalse(_meta
343: .updatesAreDetected(ResultSet.TYPE_SCROLL_SENSITIVE));
344: assertFalse(_meta
345: .updatesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE));
346: assertTrue(!_meta
347: .updatesAreDetected(ResultSet.TYPE_FORWARD_ONLY));
348: assertTrue(!_meta
349: .deletesAreDetected(ResultSet.TYPE_FORWARD_ONLY));
350: assertTrue(!_meta
351: .insertsAreDetected(ResultSet.TYPE_FORWARD_ONLY));
352: assertFalse(_meta
353: .insertsAreDetected(ResultSet.TYPE_FORWARD_ONLY));
354: assertFalse(_meta
355: .insertsAreDetected(ResultSet.TYPE_SCROLL_SENSITIVE));
356: assertFalse(_meta
357: .insertsAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE));
358: }
359:
360: public void testGetUDTs() throws Exception {
361: try {
362: _meta.getUDTs(null, null, null, null);
363: fail("Expected SQLException");
364: } catch (SQLException e) {
365: // expected
366: }
367: }
368:
369: public void testGetCatalogs() throws Exception {
370: assertNotNull(_meta.getCatalogs());
371: }
372:
373: public void testGetSchemas() throws Exception {
374: assertNotNull(_meta.getSchemas());
375: }
376:
377: public void testGetTableTypes() throws Exception {
378: assertNotNull(_meta.getTableTypes());
379: }
380:
381: public void testGetTypeInfo() throws Exception {
382: assertNotNull(_meta.getTypeInfo());
383: }
384:
385: public void testGetSuperTables() throws Exception {
386: assertNotNull(_meta.getSuperTables(null, null, null));
387: }
388:
389: public void testGetSuperTypes() throws Exception {
390: assertNotNull(_meta.getSuperTypes(null, null, null));
391: }
392:
393: public void testGetColumns() throws Exception {
394: assertNotNull(_meta.getColumns(null, null, null, null));
395: assertNotNull(_meta.getColumns("", "%", "%", "%"));
396: assertNotNull(_meta.getColumns("x", "x", "x", "x"));
397: }
398:
399: public void testGetTables() throws Exception {
400: DatabaseMetaData meta = _conn.getMetaData();
401: {
402: ResultSet rset = meta.getTables(null, null, "FOO",
403: new String[] { "TABLE" });
404: assertNotNull(rset);
405: assertTrue(!rset.next());
406: rset.close();
407: }
408:
409: _stmt.execute("create table foo ( id integer )");
410: {
411: ResultSet rset = meta.getTables(null, null, "FOO",
412: new String[] { "TABLE" });
413: assertNotNull(rset);
414: assertTrue(rset.next());
415: assertTrue(!rset.next());
416: rset.close();
417: }
418: }
419:
420: public void testGetConnection() throws Exception {
421: assertEquals(_conn, _meta.getConnection());
422: }
423:
424: public void testGetUserName() throws Exception {
425: assertNull(_meta.getUserName());
426: }
427:
428: public void testGetDefaultTransactionIsolation() throws Exception {
429: assertEquals(Connection.TRANSACTION_SERIALIZABLE, _meta
430: .getDefaultTransactionIsolation());
431: }
432:
433: public void testGetURL() throws Exception {
434: assertEquals(getConnectString(), _meta.getURL());
435: }
436:
437: public void testReadOnly() throws Exception {
438: MockDatabase mockdb = new MockDatabase();
439: AxionConnection conn = new AxionConnection(mockdb);
440: DatabaseMetaData meta = new AxionDatabaseMetaData(conn, mockdb);
441: mockdb.setReadOnly(true);
442: assertTrue(meta.isReadOnly());
443: mockdb.setReadOnly(false);
444: assertTrue(!meta.isReadOnly());
445: }
446:
447: public void testSupportsResultSetType() throws Exception {
448: assertTrue(_meta
449: .supportsResultSetType(ResultSet.TYPE_FORWARD_ONLY));
450: assertTrue(_meta
451: .supportsResultSetType(ResultSet.TYPE_SCROLL_SENSITIVE));
452: assertFalse(_meta
453: .supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE));
454: }
455:
456: public void testOther() throws Exception {
457: assertTrue(!_meta.usesLocalFiles()); // what exactly does this mean?
458: assertTrue(!_meta.usesLocalFilePerTable()); // what exactly does this mean?
459: }
460:
461: public void testVendorInfo() throws Exception {
462: assertNotNull(_meta.getDatabaseProductName());
463: assertNotNull(_meta.getDatabaseProductVersion());
464: assertNotNull(_meta.getDriverName());
465: assertNotNull(_meta.getDriverVersion());
466: assertEquals(0, _meta.getDriverMajorVersion());
467: assertEquals(3, _meta.getDriverMinorVersion());
468: assertEquals(0, _meta.getDatabaseMajorVersion());
469: assertEquals(3, _meta.getDatabaseMinorVersion());
470: }
471:
472: public void testNotSupportedFeatures() throws Exception {
473: assertTrue(!_meta.supportsSelectForUpdate());
474: assertTrue(!_meta.supportsSubqueriesInQuantifieds()); // ?
475: assertTrue(!_meta.supportsConvert(1, 1));
476: assertTrue(!_meta.supportsMultipleResultSets());
477: assertTrue(!_meta.supportsGetGeneratedKeys());
478: assertTrue(!_meta.supportsCoreSQLGrammar());
479: assertTrue(!_meta.supportsFullOuterJoins());
480: assertTrue(!_meta.supportsIntegrityEnhancementFacility());
481: assertTrue(!_meta.supportsANSI92IntermediateSQL());
482: assertTrue(!_meta.supportsSchemasInPrivilegeDefinitions());
483: assertTrue(!_meta.supportsExtendedSQLGrammar());
484: assertTrue(!_meta.supportsSchemasInTableDefinitions());
485:
486: // per the javadoc, this refers to CallableStatements,
487: // which we don't support at all
488: assertTrue(!_meta.supportsMultipleOpenResults());
489:
490: // per the javadoc, this refers to CallableStatements,
491: // which we don't support at all
492: assertTrue(!_meta.supportsNamedParameters());
493:
494: assertTrue(!_meta.supportsSavepoints());
495: assertTrue(!_meta.supportsStatementPooling());
496: }
497:
498: public void testSupportedFeatures() throws Exception {
499: assertTrue(_meta.supportsBatchUpdates());
500: assertTrue(_meta.allTablesAreSelectable());
501: assertTrue(_meta.supportsTableCorrelationNames());
502: assertTrue(_meta.supportsDifferentTableCorrelationNames());
503: assertTrue(_meta.supportsColumnAliasing());
504: assertTrue(_meta.supportsOuterJoins());
505: assertTrue(_meta.supportsLimitedOuterJoins());
506: assertTrue(_meta.supportsMinimumSQLGrammar());
507: assertTrue(_meta.nullPlusNonNullIsNull());
508: assertTrue(_meta.supportsNonNullableColumns());
509: assertTrue(_meta.supportsSubqueriesInComparisons());
510: assertTrue(_meta.supportsSubqueriesInExists());
511: assertTrue(_meta.supportsSubqueriesInIns());
512: assertTrue(_meta.supportsConvert());
513: assertTrue(_meta.supportsCorrelatedSubqueries());
514: assertTrue(_meta.supportsANSI92EntryLevelSQL());
515: assertTrue(_meta.supportsLikeEscapeClause());
516: assertTrue(_meta.supportsAlterTableWithDropColumn());
517: assertTrue(_meta.supportsAlterTableWithAddColumn());
518: assertTrue(_meta.supportsPositionedDelete());
519: assertTrue(_meta.supportsPositionedUpdate());
520: }
521:
522: public void testTransactions() throws Exception {
523: assertTrue(_meta.supportsTransactions());
524:
525: assertTrue(_meta
526: .supportsTransactionIsolationLevel(Connection.TRANSACTION_SERIALIZABLE));
527: assertTrue(!_meta
528: .supportsTransactionIsolationLevel(Connection.TRANSACTION_NONE));
529: assertTrue(!_meta
530: .supportsTransactionIsolationLevel(Connection.TRANSACTION_READ_COMMITTED));
531: assertTrue(!_meta
532: .supportsTransactionIsolationLevel(Connection.TRANSACTION_READ_UNCOMMITTED));
533: assertTrue(!_meta
534: .supportsTransactionIsolationLevel(Connection.TRANSACTION_REPEATABLE_READ));
535: assertTrue(!_meta.supportsTransactionIsolationLevel(-12345));
536:
537: assertTrue(_meta.supportsMultipleTransactions());
538: assertTrue(!_meta.supportsOpenCursorsAcrossCommit());
539: assertTrue(!_meta.supportsOpenCursorsAcrossRollback());
540: assertTrue(_meta.supportsOpenStatementsAcrossCommit());
541: assertTrue(_meta.supportsOpenStatementsAcrossRollback());
542:
543: assertTrue(_meta.supportsDataManipulationTransactionsOnly());
544: assertTrue(!_meta
545: .supportsDataDefinitionAndDataManipulationTransactions());
546: assertTrue(!_meta.dataDefinitionCausesTransactionCommit());
547: assertTrue(!_meta.dataDefinitionIgnoredInTransactions());
548:
549: assertEquals(ResultSet.CLOSE_CURSORS_AT_COMMIT, _meta
550: .getResultSetHoldability());
551: assertTrue(_meta
552: .supportsResultSetHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT));
553: assertTrue(!_meta
554: .supportsResultSetHoldability(ResultSet.HOLD_CURSORS_OVER_COMMIT));
555: }
556:
557: public void testProcedures() throws Exception {
558: assertTrue(!_meta.supportsStoredProcedures());
559: assertTrue(!_meta.allProceduresAreCallable());
560: assertEquals(0, _meta.getMaxProcedureNameLength());
561: }
562:
563: public void testSchemas() throws Exception {
564: assertEquals(0, _meta.getMaxSchemaNameLength());
565: assertTrue(!_meta.supportsSchemasInDataManipulation());
566: assertTrue(!_meta.supportsSchemasInProcedureCalls());
567: assertTrue(!_meta.supportsSchemasInIndexDefinitions());
568: }
569:
570: public void testCatalogs() throws Exception {
571: assertEquals(0, _meta.getMaxCatalogNameLength());
572: assertTrue(!_meta.supportsCatalogsInDataManipulation());
573: assertTrue(!_meta.supportsCatalogsInProcedureCalls());
574: assertTrue(!_meta.supportsCatalogsInTableDefinitions());
575: assertTrue(!_meta.supportsCatalogsInIndexDefinitions());
576: assertTrue(!_meta.supportsCatalogsInPrivilegeDefinitions());
577: }
578:
579: public void testOrderBy() throws Exception {
580: assertEquals(Integer.MAX_VALUE, _meta.getMaxColumnsInOrderBy());
581: assertTrue(_meta.supportsOrderByUnrelated());
582: assertTrue(_meta.supportsExpressionsInOrderBy());
583: }
584:
585: public void testGroupBy() throws Exception {
586: assertEquals(0, _meta.getMaxColumnsInGroupBy());
587: assertTrue(_meta.supportsGroupBy());
588: assertTrue(_meta.supportsGroupByBeyondSelect());
589: assertTrue(_meta.supportsGroupByUnrelated());
590: }
591:
592: public void testUnion() throws Exception {
593: assertTrue(!_meta.supportsUnion());
594: assertTrue(!_meta.supportsUnionAll());
595: }
596:
597: public void testLimits() throws Exception {
598: assertEquals(0, _meta.getMaxRowSize());
599: assertEquals(0, _meta.getMaxStatementLength());
600:
601: assertEquals(0, _meta.getMaxConnections());
602: assertEquals(0, _meta.getMaxStatements());
603: assertEquals(Integer.MAX_VALUE, _meta.getMaxColumnNameLength());
604: assertEquals(Integer.MAX_VALUE, _meta.getMaxTableNameLength());
605: assertEquals(0, _meta.getMaxUserNameLength());
606: assertEquals(0, _meta.getMaxCursorNameLength());
607:
608: assertEquals(0, _meta.getMaxBinaryLiteralLength());
609: assertEquals(0, _meta.getMaxCharLiteralLength());
610:
611: assertEquals(0, _meta.getMaxIndexLength());
612:
613: assertEquals(1, _meta.getMaxColumnsInIndex());
614: assertEquals(Integer.MAX_VALUE, _meta.getMaxTablesInSelect());
615: assertEquals(Integer.MAX_VALUE, _meta.getMaxColumnsInSelect());
616: assertEquals(Integer.MAX_VALUE, _meta.getMaxColumnsInTable());
617:
618: assertTrue(!_meta.doesMaxRowSizeIncludeBlobs());
619: }
620:
621: public void testIdentifiers() throws Exception {
622: assertTrue(_meta.storesUpperCaseIdentifiers());
623: assertTrue(_meta.storesUpperCaseQuotedIdentifiers());
624: assertTrue(_meta.storesUpperCaseIdentifiers() != _meta
625: .storesLowerCaseIdentifiers());
626: assertTrue(_meta.storesUpperCaseIdentifiers() != _meta
627: .storesMixedCaseIdentifiers());
628:
629: assertTrue(!_meta.supportsMixedCaseIdentifiers());
630: assertTrue(!_meta.supportsMixedCaseQuotedIdentifiers());
631: assertTrue(!_meta.storesMixedCaseQuotedIdentifiers());
632: assertTrue(!_meta.storesLowerCaseQuotedIdentifiers());
633: assertEquals("\"", _meta.getIdentifierQuoteString());
634: }
635:
636: public void testNullSorting() throws Exception {
637: assertTrue(_meta.nullsAreSortedHigh());
638: assertTrue(_meta.nullsAreSortedHigh() != _meta
639: .nullsAreSortedLow());
640: assertTrue(_meta.nullsAreSortedHigh() != _meta
641: .nullsAreSortedAtStart());
642: assertTrue(_meta.nullsAreSortedHigh() != _meta
643: .nullsAreSortedAtEnd());
644: }
645:
646: private static class MockDatabase implements Database {
647:
648: public void dropDatabaseLink(String name) throws AxionException {
649: throw new UnsupportedOperationException("Not implemented");
650: }
651:
652: public boolean hasDatabaseLink(String name)
653: throws AxionException {
654: return false;
655: }
656:
657: public void setReadOnly(boolean readOnly) {
658: _readOnly = readOnly;
659: }
660:
661: // --------------------------------------------------------------------
662: public void addDatabaseModificationListener(
663: DatabaseModificationListener l) {
664: throw new UnsupportedOperationException("Not implemented");
665: }
666:
667: public boolean hasIndex(String name) throws AxionException {
668: throw new UnsupportedOperationException("Not implemented");
669: }
670:
671: public void dropIndex(String name) throws AxionException {
672: throw new UnsupportedOperationException("Not implemented");
673: }
674:
675: public void addIndex(Index index, Table table)
676: throws AxionException {
677: throw new UnsupportedOperationException("Not implemented");
678: }
679:
680: public void addIndex(Index index, Table table,
681: boolean doPopulate) throws AxionException {
682: throw new UnsupportedOperationException("Not implemented");
683: }
684:
685: public void addTable(Table table) throws AxionException {
686: throw new UnsupportedOperationException("Not implemented");
687: }
688:
689: public void checkpoint() throws AxionException {
690: throw new UnsupportedOperationException("Not implemented");
691: }
692:
693: public void createSequence(Sequence seq) throws AxionException {
694: throw new UnsupportedOperationException("Not implemented");
695: }
696:
697: public void dropSequence(String name) throws AxionException {
698: throw new UnsupportedOperationException("Not implemented");
699: }
700:
701: public void createDatabaseLink(DatabaseLink server)
702: throws AxionException {
703: throw new UnsupportedOperationException("Not implemented");
704: }
705:
706: public DatabaseLink getDatabaseLink(String name) {
707: throw new UnsupportedOperationException("Not implemented");
708: }
709:
710: public void dropTable(String name) throws AxionException {
711: throw new UnsupportedOperationException("Not implemented");
712: }
713:
714: public List getDatabaseModificationListeners() {
715: throw new UnsupportedOperationException("Not implemented");
716: }
717:
718: public DataType getDataType(String name) {
719: throw new UnsupportedOperationException("Not implemented");
720: }
721:
722: public IndexFactory getIndexFactory(String name) {
723: throw new UnsupportedOperationException("Not implemented");
724: }
725:
726: public String getName() {
727: throw new UnsupportedOperationException("Not implemented");
728: }
729:
730: public Object getGlobalVariable(String key) {
731: throw new UnsupportedOperationException("Not implemented");
732: }
733:
734: public ConcreteFunction getFunction(String name) {
735: throw new UnsupportedOperationException("Not implemented");
736: }
737:
738: public Sequence getSequence(String name) {
739: throw new UnsupportedOperationException("Not implemented");
740: }
741:
742: public Table getTable(String name) throws AxionException {
743: throw new UnsupportedOperationException("Not implemented");
744: }
745:
746: public Table getTable(TableIdentifier table)
747: throws AxionException {
748: throw new UnsupportedOperationException("Not implemented");
749: }
750:
751: public boolean hasSequence(String name) throws AxionException {
752: throw new UnsupportedOperationException("Not implemented");
753: }
754:
755: public boolean hasTable(String name) throws AxionException {
756: throw new UnsupportedOperationException("Not implemented");
757: }
758:
759: public boolean hasTable(TableIdentifier table)
760: throws AxionException {
761: throw new UnsupportedOperationException("Not implemented");
762: }
763:
764: public List getDependentViews(String tableName) {
765: throw new UnsupportedOperationException("Not implemented");
766: }
767:
768: public void dropDependentViews(List views)
769: throws AxionException {
770: throw new UnsupportedOperationException("Not implemented");
771: }
772:
773: public void dropDependentExternalDBTable(List tables)
774: throws AxionException {
775: throw new UnsupportedOperationException("Not implemented");
776: }
777:
778: public List getDependentExternalDBTable(String name) {
779: throw new UnsupportedOperationException("Not implemented");
780: }
781:
782: public File getDBDirectory() {
783: throw new UnsupportedOperationException("Not implemented");
784: }
785:
786: public TableFactory getTableFactory(String name) {
787: throw new UnsupportedOperationException("Not implemented");
788: }
789:
790: public TransactionManager getTransactionManager() {
791: throw new UnsupportedOperationException("Not implemented");
792: }
793:
794: public boolean isReadOnly() {
795: return _readOnly;
796: }
797:
798: public void migrate(int version) throws AxionException {
799: throw new UnsupportedOperationException("Not implemented");
800: }
801:
802: public void remount(File newdir) throws AxionException {
803: throw new UnsupportedOperationException("Not implemented");
804: }
805:
806: public void renameTable(String oldName, String newName)
807: throws AxionException {
808: throw new UnsupportedOperationException("Not implemented");
809: }
810:
811: public void shutdown() throws AxionException {
812: throw new UnsupportedOperationException("Not implemented");
813: }
814:
815: public void tableAltered(Table t) throws AxionException {
816: throw new UnsupportedOperationException("Not implemented");
817: }
818:
819: //-----------------------------------------------------------
820:
821: private boolean _readOnly = false;
822:
823: }
824:
825: }
|