Re: [JDBC] Fix DatabaseMetaDataTest in JDBC test suite

2001-09-10 Thread Bruce Momjian


Your patch has been added to the PostgreSQL unapplied patches list at:

http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

 Attached is a patch that fixes DatabaseMetaDataTest in the JDBC
 driver's test suite. With previous patches applied, this reduces
 the number of failures of the test suite from 6 to 4. The patch
 fixes the test case itself, rather than the driver.
 
 Details:
 
 1) The driver correctly provided DatabaseMetaData about the sort
 order of NULLs. This was confirmed by Peter Eisentraut on
 pgsql-hackers. I fixed the test to accept/require the current
 behaviour, and made it dependent on the backend version. See
 nullsAreSortedAtStart(), nullsAreSortedAtEnd(),
 nullsAreSortedHigh() and nullsAreSortedLow().
 
 2) DatabaseMetaData.supportsOrderByUnrelated() correctly
 returned true (an ORDER BY clause can contain columns that are
 not in the SELECT clause), but the test case required false.
 Fixed that.
 
 3) Replaced deprecated assert() of junit.framework.TestCase by
 assertEquals(), assertTrue() and assertNotNull(). This is
 because assert will be a new keyword in Java 1.4.
 
 4) Replaced assert(message,false) by the more elegant
 fail(message).
 
 Regards,
 Ren? Pijlman [EMAIL PROTECTED]

[ Attachment, skipping... ]

 
 ---(end of broadcast)---
 TIP 3: if posting/reading through Usenet, please send an appropriate
 subscribe-nomail command to [EMAIL PROTECTED] so that your
 message can get through to the mailing list cleanly

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])



[JDBC] Fix DatabaseMetaDataTest in JDBC test suite

2001-09-09 Thread Rene Pijlman

Attached is a patch that fixes DatabaseMetaDataTest in the JDBC
driver's test suite. With previous patches applied, this reduces
the number of failures of the test suite from 6 to 4. The patch
fixes the test case itself, rather than the driver.

Details:

1) The driver correctly provided DatabaseMetaData about the sort
order of NULLs. This was confirmed by Peter Eisentraut on
pgsql-hackers. I fixed the test to accept/require the current
behaviour, and made it dependent on the backend version. See
nullsAreSortedAtStart(), nullsAreSortedAtEnd(),
nullsAreSortedHigh() and nullsAreSortedLow().

2) DatabaseMetaData.supportsOrderByUnrelated() correctly
returned true (an ORDER BY clause can contain columns that are
not in the SELECT clause), but the test case required false.
Fixed that.

3) Replaced deprecated assert() of junit.framework.TestCase by
assertEquals(), assertTrue() and assertNotNull(). This is
because assert will be a new keyword in Java 1.4.

4) Replaced assert(message,false) by the more elegant
fail(message).

Regards,
René Pijlman [EMAIL PROTECTED]


Index: org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
===
RCS file: 
/home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java,v
retrieving revision 1.1
diff -c -r1.1 DatabaseMetaDataTest.java
*** org/postgresql/test/jdbc2/DatabaseMetaDataTest.java 2001/02/13 16:39:05 1.1
--- org/postgresql/test/jdbc2/DatabaseMetaDataTest.java 2001/09/09 14:04:42
***
*** 29,39 
Connection con = JDBC2Tests.openDB();
  
DatabaseMetaData dbmd = con.getMetaData();
!   assert(dbmd!=null);
  
JDBC2Tests.closeDB(con);
  } catch(SQLException ex) {
!   assert(ex.getMessage(),false);
  }
}
  
--- 29,39 
Connection con = JDBC2Tests.openDB();
  
DatabaseMetaData dbmd = con.getMetaData();
!   assertNotNull(dbmd);
  
JDBC2Tests.closeDB(con);
  } catch(SQLException ex) {
!   fail(ex.getMessage());
  }
}
  
***
*** 45,76 
Connection con = JDBC2Tests.openDB();
  
DatabaseMetaData dbmd = con.getMetaData();
!   assert(dbmd!=null);
  
!   assert(dbmd.allProceduresAreCallable()==true);
!   assert(dbmd.allTablesAreSelectable()==true); // not true all the time
  
// This should always be false for postgresql (at least for 7.x)
!   assert(!dbmd.isReadOnly());
  
// does the backend support this yet? The protocol does...
!   assert(!dbmd.supportsMultipleResultSets());
  
// yes, as multiple backends can have transactions open
!   assert(dbmd.supportsMultipleTransactions());
  
!   assert(dbmd.supportsMinimumSQLGrammar());
!   assert(!dbmd.supportsCoreSQLGrammar());
!   assert(!dbmd.supportsExtendedSQLGrammar());
!   assert(!dbmd.supportsANSI92EntryLevelSQL());
!   assert(!dbmd.supportsANSI92IntermediateSQL());
!   assert(!dbmd.supportsANSI92FullSQL());
  
!   assert(!dbmd.supportsIntegrityEnhancementFacility());
  
JDBC2Tests.closeDB(con);
  } catch(SQLException ex) {
!   assert(ex.getMessage(),false);
  }
}
  
--- 45,76 
Connection con = JDBC2Tests.openDB();
  
DatabaseMetaData dbmd = con.getMetaData();
!   assertNotNull(dbmd);
  
!   assertTrue(dbmd.allProceduresAreCallable());
!   assertTrue(dbmd.allTablesAreSelectable()); // not true all the time
  
// This should always be false for postgresql (at least for 7.x)
!   assertTrue(!dbmd.isReadOnly());
  
// does the backend support this yet? The protocol does...
!   assertTrue(!dbmd.supportsMultipleResultSets());
  
// yes, as multiple backends can have transactions open
!   assertTrue(dbmd.supportsMultipleTransactions());
  
!   assertTrue(dbmd.supportsMinimumSQLGrammar());
!   assertTrue(!dbmd.supportsCoreSQLGrammar());
!   assertTrue(!dbmd.supportsExtendedSQLGrammar());
!   assertTrue(!dbmd.supportsANSI92EntryLevelSQL());
!   assertTrue(!dbmd.supportsANSI92IntermediateSQL());
!   assertTrue(!dbmd.supportsANSI92FullSQL());
  
!   assertTrue(!dbmd.supportsIntegrityEnhancementFacility());
  
JDBC2Tests.closeDB(con);
  } catch(SQLException ex) {
!   fail(ex.getMessage());
  }
}
  
***
*** 80,94 
Connection con = JDBC2Tests.openDB();
  
DatabaseMetaData dbmd = con.getMetaData();
!   assert(dbmd!=null);
  
!   assert(dbmd.supportsOuterJoins());
!   assert(dbmd.supportsFullOuterJoins());
!   assert(dbmd.supportsLimitedOuterJoins());
  
JDBC2Tests.closeDB(con);
  } catch(SQLException ex) {
!   assert(ex.getMessage(),false);
  }
}
  
--- 80,94 
Connection con = JDBC2Tests.openDB();
  
DatabaseMetaData dbmd = con.getMetaData();
!   assertNotNull(dbmd);
  
!