db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Waagan <Kristian.Waa...@Sun.COM>
Subject Re: svn commit: r518875 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests: derbynet/NSSecurityMechanismTest.java derbynet/_Suite.java jdbcapi/AuthenticationTest.java jdbcapi/_Suite.java jdbcapi/checkDataSource.java
Date Fri, 16 Mar 2007 13:03:42 GMT
Hi,

When I run suites.All I get lots of errors (40) and my "premature guess" 
is that this commit is the reason. All the errors look like this:
Time: 1,131.236
There were 40 errors:
1) LangScripts:clientjava.lang.Exception: DRDA_InvalidValue.U:Invalid 
value, , for derby.drda.securityMechanism.
	at 
org.apache.derby.impl.drda.NetworkServerControlImpl.consolePropertyMessageWork(NetworkServerControlImpl.java:2937)
	at 
org.apache.derby.impl.drda.NetworkServerControlImpl.consolePropertyMessage(NetworkServerControlImpl.java:1625)
	at 
org.apache.derby.impl.drda.NetworkServerControlImpl.setSecurityMechanism(NetworkServerControlImpl.java:3235)
	at 
org.apache.derby.impl.drda.NetworkServerControlImpl.getPropertyInfo(NetworkServerControlImpl.java:2747)
	at 
org.apache.derby.impl.drda.NetworkServerControlImpl.<init>(NetworkServerControlImpl.java:376)
	at 
org.apache.derby.drda.NetworkServerControl.<init>(NetworkServerControl.java:204)
	at 
org.apache.derbyTesting.junit.NetworkServerTestSetup.getNetworkServerControl(NetworkServerTestSetup.java:269)
	at 
org.apache.derbyTesting.junit.NetworkServerTestSetup.setUp(NetworkServerTestSetup.java:107)
	at junit.extensions.TestSetup$1.protect(TestSetup.java:20)
	at junit.extensions.TestSetup.run(TestSetup.java:25)
	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
	at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
	at junit.extensions.TestSetup.run(TestSetup.java:25)


Unless this is taken care of during the day by someone else, I'll back 
out the commit or see if I can quickly find the cause.



-- 
Kristian

myrnavl@apache.org wrote:
> Author: myrnavl
> Date: Thu Mar 15 23:58:22 2007
> New Revision: 518875
> 
> URL: http://svn.apache.org/viewvc?view=rev&rev=518875
> Log:
> DERBY-1982 - now that the build level is jdk14, we don't need a separate sectionanymore
for jdk13/jdk14 tests in _Suite.java. Also removed the supportsJDBC20 section and moved the
one test under supportsJDBC30.
> Also added a very few whitespace changes; all addsuite statements in the main section
now have 2 tabs in front of them. 
> 
> Modified:
>     db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NSSecurityMechanismTest.java
>     db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/_Suite.java
>     db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AuthenticationTest.java
>     db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java
>     db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
> 
> Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NSSecurityMechanismTest.java
> URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NSSecurityMechanismTest.java?view=diff&rev=518875&r1=518874&r2=518875
> ==============================================================================
> --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NSSecurityMechanismTest.java
(original)
> +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NSSecurityMechanismTest.java
Thu Mar 15 23:58:22 2007
> @@ -352,7 +352,7 @@
>  
>          // shut down the server
>          server.shutdown();
> -        Thread.sleep(1000);
> +        Thread.sleep(500);
>          } catch (Exception e) {
>              if (!(e.getMessage().substring(0,17).equals("DRDA_InvalidValue")))
>              {
> @@ -383,7 +383,7 @@
>              server2.start(null);
>              // TODO: sleep ridiculously long, otherwise getting 08001 errors
>              //       even when the server is up.
> -            Thread.sleep(120000);
> +            Thread.sleep(80000);
>              
>              if (derby_drda_securityMechanism.equals("") ||
>                  derby_drda_securityMechanism.equals("INVALID_VALUE"))
> @@ -805,7 +805,6 @@
>                      getJDBCUrl(urlAttributes), "Test:", 
>                      getExpectedValueFromAll(expectedValues, k, j, 4));
>                  getDataSourceConnection(USER_ATTRIBUTE[k],PWD_ATTRIBUTE[j],
> -                    "TEST_DS("+urlAttributes+")", 
>                      getExpectedValueFromAll(expectedValues, k, j, 4));
>  
>                  for (int i = 0; i < SECMEC_ATTRIBUTE.length; i++) {
> @@ -882,7 +881,7 @@
>       * @param msg message to print for testcase
>       */
>      public void getDataSourceConnection(
> -        String user, String password,String msg, String expectedValue)
> +        String user, String password, String expectedValue)
>      {
>          Connection conn;
>          DataSource ds = getDS(user, password);
> @@ -996,9 +995,6 @@
>              fail("should not have failed");
>          }
>          
> -        // TODO: using this with ibm15 results in 42X05 - table does not exist
> -        //assertTableRowCount("sys.systables", 1);
> -        
>          if(rs != null)
>              rs.close();
>          if(stmt != null)
> @@ -1096,7 +1092,7 @@
>          try
>          {
>              println("Turning ON Derby BUILTIN authentication");
> -            Connection conn = getConnectionWithSecMec(
> +            Connection conn = getDataSourceConnectionWithSecMec(
>                  "neelima", "lee", new Short(SECMEC_USRSSBPWD));
>              if (conn == null)
>                  return; // Exception would have been raised
> @@ -1151,7 +1147,7 @@
>                  "TEST_DS - USRSSBPWD + BUILTIN (T4):", expectedValues[3]);
>  
>              // Prepare to turn OFF Derby BUILTIN authentication
> -            conn = getConnectionWithSecMec("neelima", "lee",
> +            conn = getDataSourceConnectionWithSecMec("neelima", "lee",
>                  new Short(SECMEC_USRSSBPWD));
>              if (conn == null)
>                  return; // Exception would have been raised
> @@ -1180,9 +1176,8 @@
>          }
>      }
>      
> -    public Connection getConnectionWithSecMec(String user,
> -        String password,
> -        Short secMec)
> +    public Connection getDataSourceConnectionWithSecMec(
> +        String user, String password, Short secMec)
>      {
>          Connection conn = null;
>          String securityMechanismProperty = "SecurityMechanism";
> @@ -1200,13 +1195,13 @@
>          catch (SQLException sqle)
>          {
>              // Exceptions expected in certain cases depending on JCE used for 
> -            // running the test.
> -            dumpSQLException(sqle.getNextException());
> -            assertSQLState("11111", sqle);
> +            // running the test, but in this case, we don't expect any
> +            // sqlexceptions
> +            fail("did not expect an sqlexception.");
>          }
>          catch (Exception e)
>          {
> -            fail("did not expect exception");
> +            fail("did not expect exception.");
>          }
>          return conn;
>      }
> 
> Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/_Suite.java
> URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/_Suite.java?view=diff&rev=518875&r1=518874&r2=518875
> ==============================================================================
> --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/_Suite.java
(original)
> +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/_Suite.java
Thu Mar 15 23:58:22 2007
> @@ -53,6 +53,7 @@
>          suite.addTest(BadConnectionTest.suite());
>          suite.addTest(NetHarnessJavaTest.suite());
>          suite.addTest(SecureServerTest.suite());
> +        suite.addTest(NSSecurityMechanismTest.suite());
>          
>          // These tests references a client class directly
>          // thus causing class not found exceptions if the
> 
> Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AuthenticationTest.java
> URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AuthenticationTest.java?view=diff&rev=518875&r1=518874&r2=518875
> ==============================================================================
> --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AuthenticationTest.java
(original)
> +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AuthenticationTest.java
Thu Mar 15 23:58:22 2007
> @@ -562,6 +562,10 @@
>          conn1.close();
>      }
>      
> +    // verify that the return value is the expected value, and 
> +    // we have the expected number of rows returning from the query
> +    // in this test, it will be one of the user names through
> +    // use of CURRENT_USER, SESSION_USER etc.
>      protected void assertUserValue(
>          String[] expected, String user, String password, String sql)
>      throws SQLException
> @@ -587,6 +591,7 @@
>          assertUserValue(expected, user, (user + PASSWORD_SUFFIX), sql);
>      }
>      
> +    // get a connection using ds.getConnection(user, password)
>      protected void assertConnectionOK(
>           String dbName, String user, String password)
>      throws SQLException
> @@ -600,7 +605,7 @@
>          }
>      }
>      
> -    // getConnection(), using setConnectionAttributes
> +    // get a connection, using setUser / setPassword, and ds.getConnection()
>      protected void assertConnectionWOUPOK(
>          String dbName, String user, String password)
>      throws SQLException
> @@ -630,7 +635,9 @@
>          }
>      }
>  
> -    // connection without user and password
> +    // same action as with assertConnectionFail, but using ds.getConnection()
> +    // instead of ds.getConnection(user, password). So, setting user and
> +    // password using appropriate ds.set method.
>      protected void assertConnectionWOUPFail(
>          String expectedError, String dbName, String user, String password) 
>      throws SQLException 
> @@ -678,6 +685,9 @@
>          }
>      }
>  
> +    // same action as with assertShutdownOK, but using ds.getConnection()
> +    // instead of ds.getConnection(user, password). So, setting user and
> +    // password using appropriate ds.set method.
>      protected void assertShutdownWOUPOK(
>          String dbName, String user, String password)
>      throws SQLException {
> @@ -748,7 +758,7 @@
>      throws SQLException
>      {
>          // with DerbyNetClient there is no Datasource setShutdownDatabase 
> -        // method so can't use the setBeanProperty
> +        // method so can't use the same setBeanProperty as with embedded
>          if (usingEmbedded()) 
>          {
>              DataSource ds = JDBCDataSource.getDataSource(dbName);
> @@ -819,6 +829,7 @@
>          if (usingEmbedded())
>          {
>              DataSource ds = JDBCDataSource.getDataSource();
> +            JDBCDataSource.clearStringBeanProperty(ds, "databaseName");
>              JDBCDataSource.setBeanProperty(ds, "shutdownDatabase", "shutdown");
>              JDBCDataSource.setBeanProperty(ds, "user", user);
>              JDBCDataSource.setBeanProperty(ds, "password", password);
> @@ -833,6 +844,7 @@
>          {
>              ClientDataSource ds = 
>                  (ClientDataSource)JDBCDataSource.getDataSource();
> +            JDBCDataSource.clearStringBeanProperty(ds, "databaseName");
>              ds.setConnectionAttributes(
>                  "shutdown=true;user=" + user + ";password=" + password);
>              try {
> 
> Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java
> URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java?view=diff&rev=518875&r1=518874&r2=518875
> ==============================================================================
> --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java
(original)
> +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java
Thu Mar 15 23:58:22 2007
> @@ -49,14 +49,14 @@
>  
>  		suite.addTest(ConcurrencyTest.suite());
>  		suite.addTest(HoldabilityTest.suite());
> -        suite.addTest(LobLengthTest.suite()); 
> +		suite.addTest(LobLengthTest.suite()); 
>  		suite.addTest(ProcedureTest.suite());
>  		suite.addTest(SURQueryMixTest.suite());
>  		suite.addTest(SURTest.suite());
>  		suite.addTest(UpdatableResultSetTest.suite());
>  		suite.addTest(UpdateXXXTest.suite());
>  		suite.addTest(URCoveringIndexTest.suite());
> -        suite.addTest(ResultSetCloseTest.suite());
> +		suite.addTest(ResultSetCloseTest.suite());
>  		suite.addTest(BlobClob4BlobTest.suite());
>  		suite.addTest(CharacterStreamsTest.suite());
>  		suite.addTest(BatchUpdateTest.suite());
> @@ -64,42 +64,32 @@
>  		suite.addTest(DboPowersTest.suite());
>  		suite.addTest(BlobStoredProcedureTest.suite());
>  		suite.addTest(ClobStoredProcedureTest.suite());
> -                suite.addTest(CallableTest.suite());
> -                suite.addTest(ResultSetMiscTest.suite());
> -                suite.addTest(PrepStmtMetaDataTest.suite());
> +		suite.addTest(CallableTest.suite());
> +		suite.addTest(ResultSetMiscTest.suite());
> +		suite.addTest(PrepStmtMetaDataTest.suite());
> +		suite.addTest(ScrollResultSetTest.suite());
> +		suite.addTest(LobStreamsTest.suite());
> +		suite.addTest(ResultSetJDBC30Test.suite());
> +		suite.addTest(DatabaseMetaDataTest.suite());
> +		suite.addTest(ClosedObjectTest.suite());
>          
>          // Old harness .java tests that run using the HarnessJavaTest
>          // adapter and continue to use a single master file.
>          suite.addTest(JDBCHarnessJavaTest.suite());
>          
> -        if (JDBC.vmSupportsJDBC2())
> +        if (JDBC.vmSupportsJDBC3())
>          {
>              // Tests that do not run under JSR169
>              // DERBY-2403 blocks ParameterMappingTest from running
>              // under JSR169
>              suite.addTest(ParameterMappingTest.suite());
> -        
> -        }
> -        if (JDBC.vmSupportsJDBC3())
> -        {
> +
>              // Class requires javax.sql.PooledConnection
>              // even to load, even though the suite method
>              // is correctly implemented.
>              suite.addTest(DataSourcePropertiesTest.suite());
>          }
>  		
> -		// Tests that are compiled using 1.4 target need to
> -		// be added this way, otherwise creating the suite
> -		// will throw an invalid class version error
> -		if (JDBC.vmSupportsJDBC3() || JDBC.vmSupportsJSR169())
> -		{
> -			suite.addTest(ScrollResultSetTest.suite());
> -			suite.addTest(LobStreamsTest.suite());
> -			suite.addTest(ResultSetJDBC30Test.suite());
> -            suite.addTest(DatabaseMetaDataTest.suite());
> -            suite.addTest(ClosedObjectTest.suite());
> -		}
> -        
>          return suite;
>  	}
>  }
> 
> Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
> URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java?view=diff&rev=518875&r1=518874&r2=518875
> ==============================================================================
> --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
(original)
> +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
Thu Mar 15 23:58:22 2007
> @@ -867,9 +867,9 @@
>                      ds.setDatabaseName("wombat");
>                      ds.setConnectionAttributes("bad");
>                      try {
> -                        // TODO: this gives XJ028 - url is badly formed, whereas
> -                        // all other datasources give XJ212 - invalid syntax for connatr.
> -                        // is this ok?
> +                        // Note: this gives XJ028 - url is badly formed, 
> +                        // whereas connectionPool and XA datasources give 
> +                        // XJ212 - invalid syntax for connatr.
>                          conn = ds.getConnection();
>                          conn.close();
>                          System.out.println("FAIL - should have seen an error");
> @@ -1629,7 +1629,7 @@
>          
>  	/**
>  	 * Check that traceFile connection attribute functions correctly.
> -         * tracefile was tested in checkDriver, but not for DataSources.
> +     * tracefile was tested in checkDriver, but not for DataSources.
>  	 * tracefile= was used in datasourcepermissions_net, but that's 
>  	 * incorrect syntax. Note that we're not checking the contents of
>  	 * the tracefile.
> @@ -1638,259 +1638,261 @@
>  	 */
>  	private static void testClientTraceFileDSConnectionAttribute() throws SQLException
{
>  
> -	    String DERBY_SYSTEM_HOME = System.getProperty("derby.system.home");
> +        String DERBY_SYSTEM_HOME = System.getProperty("derby.system.home");
>  	    String traceDirectory = DERBY_SYSTEM_HOME + File.separator;
>  	    String traceFile;
>              String coretraceFile;
>              
>  	    // DataSource
>  	    ClientDataSource ds = new ClientDataSource();
> -            ds.setDatabaseName("wombat");
> +        ds.setDatabaseName("wombat");
>              
> -            System.out.println("DataSource - connectionAttribute=traceFile=filename");
> -            coretraceFile = "trace1.out";
> -            traceFile = traceDirectory + coretraceFile;
> -            ds.setConnectionAttributes("traceFile="+traceFile);
> -            dsConnectionRequests(ds);
> -            assertTraceFileExists(traceFile, coretraceFile);
> -            ds.setConnectionAttributes(null);
> -
> -            System.out.println("DataSource - setTraceFile property");
> -            coretraceFile = "trace2.out";
> -            traceFile = traceDirectory + coretraceFile;
> -            ds.setTraceFile(traceFile);
> +        System.out.println("DataSource - connectionAttribute=traceFile=filename");
> +        coretraceFile = "trace1.out";
> +        traceFile = traceDirectory + coretraceFile;
> +        ds.setConnectionAttributes("traceFile="+traceFile);
> +        dsConnectionRequests(ds);
> +        assertTraceFileExists(traceFile, coretraceFile);
> +        ds.setConnectionAttributes(null);
> +
> +        System.out.println("DataSource - setTraceFile property");
> +        coretraceFile = "trace2.out";
> +        traceFile = traceDirectory + coretraceFile;
> +        ds.setTraceFile(traceFile);
> +        dsConnectionRequests(ds);
> +        assertTraceFileExists(traceFile, coretraceFile);
> +        ds.setTraceFile(null);
> +        ds.setDatabaseName(null);
> +
> +        // now with ConnectionPoolDataSource
> +        ClientConnectionPoolDataSource cpds = new ClientConnectionPoolDataSource();
> +        cpds.setDatabaseName("wombat");
> +
> +        System.out.println("ConnectionPoolDataSource - connectionAttribute=traceFile=filename");
> +        coretraceFile = "trace3.out";
> +        traceFile = traceDirectory + coretraceFile;
> +        cpds.setConnectionAttributes("traceFile="+traceFile);
> +        dsConnectionRequests((ConnectionPoolDataSource)cpds);
> +        // TODO: log bug - trace3.out does not get created
> +        assertTraceFileExists(traceFile, coretraceFile);
> +        cpds.setConnectionAttributes(null);
> +
> +        System.out.println("ConnectionPoolDataSource - setTraceFile property");
> +        coretraceFile = "trace4.out";
> +        traceFile = traceDirectory + coretraceFile;
> +        cpds.setTraceFile(traceFile);
> +        dsConnectionRequests((ConnectionPoolDataSource)cpds);
> +        assertTraceFileExists(traceFile, coretraceFile);
> +        cpds.setTraceFile(null);
> +        cpds.setDatabaseName(null);
> +
> +        // now with XADataSource
> +        ClientXADataSource xads = new ClientXADataSource();
> +        xads.setDatabaseName("wombat");
> +
> +        System.out.println("XADataSource - connectionAttribute=traceFile=filename");
> +        coretraceFile = "trace5.out";
> +        traceFile = traceDirectory + coretraceFile;
> +        xads.setConnectionAttributes("traceFile="+traceFile);
> +        dsConnectionRequests((XADataSource) xads);
> +        // TODO: log bug, like trace3.out, trace5.out does not get created
> +        assertTraceFileExists(traceFile, coretraceFile);
> +        xads.setConnectionAttributes(null);
> +
> +        System.out.println("XADataSource - setTraceFile property");
> +        coretraceFile = "trace6.out";
> +        traceFile = traceDirectory + coretraceFile;
> +        xads.setTraceFile(traceFile);
> +        dsConnectionRequests((XADataSource)xads);
> +        assertTraceFileExists(traceFile, coretraceFile);
> +        xads.setTraceFile(null);
> +        xads.setDatabaseName(null);
> +	}
> +        
> +	/**
> +	 * Check that trace file exists in <framework> directory
> +	 * 
> +	 * @param filename Name of trace file
> +	 */
> +	private static void assertTraceFileExists(
> +	        String filename, String corefileName) 
> +	{
> +	    File traceFile = new File(filename);
> +	    //System.out.println("user.dir=" + System.getProperty("user.dir"));
> +	    //System.out.println("fullpath = " + traceFile.getAbsolutePath());
> +	    boolean exists = traceFile.exists();
> +	    if (! exists)
> +	        // new Exception("FAILED trace file: " + filename + " does not exist").printStackTrace(System.out);
> +	        new Exception("FAILED trace file: " + corefileName + " does not exist").printStackTrace(System.out);

> +	    else
> +	        System.out.println(" trace file exists");
> +
> +	}
> +
> +	/**
> +	 * Check that messageText connection attribute functions correctly.
> +	 * retrievemessagetext was tested in checkdriver, and derbynet/testij,
> +	 * but not tested for datasources, and in datasourcepermissions_net,
> +	 * but as it has nothing to do with permissions/authentication,
> +	 * this test seems a better place for it. 
> +	 *  
> +	 * @throws SQLException
> +	 */
> +	private static void testClientMessageTextDSConnectionAttribute() throws SQLException
{
> +
> +	    String retrieveMessageTextProperty = "retrieveMessageText";
> +	    Connection conn;
> +
> +	    // DataSource
> +	    System.out.println("DataSource - retrieveMessageTextProperty");
> +	    ClientDataSource ds = new ClientDataSource();
> +	    ds.setDatabaseName("wombat");
> +	    ds.setConnectionAttributes(retrieveMessageTextProperty + "=false");
> +	    dsConnectionRequests(ds);
> +	    conn = ds.getConnection();
> +	    checkMessageText(conn,"false");
> +	    conn.close();
> +	    // now try with retrieveMessageText = true
> +	    ds.setConnectionAttributes(retrieveMessageTextProperty + "=true");
>  	    dsConnectionRequests(ds);
> -	    assertTraceFileExists(traceFile, coretraceFile);
> -            ds.setTraceFile(null);
> -	    ds.setDatabaseName(null);
> +	    conn = ds.getConnection();
> +	    checkMessageText(conn,"true");
> +	    ds.setConnectionAttributes(null);
> +	    conn.close();
>  
>  	    // now with ConnectionPoolDataSource
> +	    System.out.println("ConnectionPoolDataSource - retrieveMessageTextProperty");
>  	    ClientConnectionPoolDataSource cpds = new ClientConnectionPoolDataSource();
> -            cpds.setDatabaseName("wombat");
> -
> -            System.out.println("ConnectionPoolDataSource - connectionAttribute=traceFile=filename");
> -            coretraceFile = "trace3.out";
> -            traceFile = traceDirectory + coretraceFile;
> -	    cpds.setConnectionAttributes("traceFile="+traceFile);
> +	    cpds.setDatabaseName("wombat");
> +	    cpds.setConnectionAttributes(
> +	            retrieveMessageTextProperty + "=false");
>  	    dsConnectionRequests((ConnectionPoolDataSource)cpds);
> -            // TODO: log bug - trace3.out does not get created
> -	    assertTraceFileExists(traceFile, coretraceFile);
> -            cpds.setConnectionAttributes(null);
> -
> -            System.out.println("ConnectionPoolDataSource - setTraceFile property");
> -            coretraceFile = "trace4.out";
> -            traceFile = traceDirectory + coretraceFile;
> -	    cpds.setTraceFile(traceFile);
> +	    conn = cpds.getConnection();
> +	    checkMessageText(conn,"false");
> +	    conn.close();
> +	    cpds.setConnectionAttributes(
> +	            retrieveMessageTextProperty + "=true");
>  	    dsConnectionRequests((ConnectionPoolDataSource)cpds);
> -	    assertTraceFileExists(traceFile, coretraceFile);
> -            cpds.setTraceFile(null);
> -	    cpds.setDatabaseName(null);
> +	    conn = cpds.getConnection();
> +	    checkMessageText(conn,"true");
> +	    cpds.setConnectionAttributes(null);
> +	    conn.close();
>  
>  	    // now with XADataSource
>  	    ClientXADataSource xads = new ClientXADataSource();
> -            xads.setDatabaseName("wombat");
> -            
> -	    System.out.println("XADataSource - connectionAttribute=traceFile=filename");
> -            coretraceFile = "trace5.out";
> -            traceFile = traceDirectory + coretraceFile;
> -	    xads.setConnectionAttributes("traceFile="+traceFile);
> +	    System.out.println("XADataSource - retrieveMessageTextProperty");
> +	    xads.setDatabaseName("wombat");
> +	    xads.setConnectionAttributes(
> +	            retrieveMessageTextProperty + "=false");
> +	    dsConnectionRequests((XADataSource) xads);
> +	    conn = xads.getConnection();
> +	    checkMessageText(conn,"false");
> +	    conn.close();
> +	    xads.setConnectionAttributes(
> +	            retrieveMessageTextProperty + "=true");
>  	    dsConnectionRequests((XADataSource) xads);
> -            // TODO: log bug, like trace3.out, trace5.out does not get created
> -            assertTraceFileExists(traceFile, coretraceFile);
> +	    conn = xads.getConnection();
> +	    checkMessageText(conn,"true");
> +	    conn.close();
>  	    xads.setConnectionAttributes(null);
> -
> -            System.out.println("XADataSource - setTraceFile property");
> -            coretraceFile = "trace6.out";
> -            traceFile = traceDirectory + coretraceFile;
> -	    xads.setTraceFile(traceFile);
> -	    dsConnectionRequests((XADataSource)xads);
> -	    assertTraceFileExists(traceFile, coretraceFile);
> -            xads.setTraceFile(null);
> -	    xads.setDatabaseName(null);
>  	}
> -        
> -        /**
> -         * Check that trace file exists in <framework> directory
> -         * 
> -         * @param filename Name of trace file
> -         */
> -        private static void assertTraceFileExists(
> -                String filename, String corefileName) 
> -        {
> -                File traceFile = new File(filename);
> -                //System.out.println("user.dir=" + System.getProperty("user.dir"));
> -                //System.out.println("fullpath = " + traceFile.getAbsolutePath());
> -                boolean exists = traceFile.exists();
> -                if (! exists)
> -                        // new Exception("FAILED trace file: " + filename + " does not
exist").printStackTrace(System.out);
> -                    new Exception("FAILED trace file: " + corefileName + " does not
exist").printStackTrace(System.out); 
> -                else
> -                        System.out.println(" trace file exists");
> -                        
> -        }
> -        
> -        /**
> -         * Check that messageText connection attribute functions correctly.
> -         * retrievemessagetext was tested in checkdriver, and derbynet/testij,
> -         * but not tested for datasources, and in datasourcepermissions_net,
> -         * but as it has nothing to do with permissions/authentication,
> -         * this test seems a better place for it. 
> -         *  
> -         * @throws SQLException
> -         */
> -        private static void testClientMessageTextDSConnectionAttribute() throws SQLException
{
> -
> -            String retrieveMessageTextProperty = "retrieveMessageText";
> -            Connection conn;
> -
> -            // DataSource
> -            System.out.println("DataSource - retrieveMessageTextProperty");
> -            ClientDataSource ds = new ClientDataSource();
> -            ds.setDatabaseName("wombat");
> -            ds.setConnectionAttributes(retrieveMessageTextProperty + "=false");
> -            dsConnectionRequests(ds);
> -            conn = ds.getConnection();
> -            checkMessageText(conn,"false");
> -            conn.close();
> -            // now try with retrieveMessageText = true
> -            ds.setConnectionAttributes(retrieveMessageTextProperty + "=true");
> -            dsConnectionRequests(ds);
> -            conn = ds.getConnection();
> -            checkMessageText(conn,"true");
> -            ds.setConnectionAttributes(null);
> -            conn.close();
> -                
> -            // now with ConnectionPoolDataSource
> -            System.out.println("ConnectionPoolDataSource - retrieveMessageTextProperty");
> -            ClientConnectionPoolDataSource cpds = new ClientConnectionPoolDataSource();
> -            cpds.setDatabaseName("wombat");
> -            cpds.setConnectionAttributes(
> -                    retrieveMessageTextProperty + "=false");
> -            dsConnectionRequests((ConnectionPoolDataSource)cpds);
> -            conn = cpds.getConnection();
> -            checkMessageText(conn,"false");
> -            conn.close();
> -            cpds.setConnectionAttributes(
> -                    retrieveMessageTextProperty + "=true");
> -            dsConnectionRequests((ConnectionPoolDataSource)cpds);
> -            conn = cpds.getConnection();
> -            checkMessageText(conn,"true");
> -            cpds.setConnectionAttributes(null);
> -            conn.close();
> -
> -            // now with XADataSource
> -            ClientXADataSource xads = new ClientXADataSource();
> -            System.out.println("XADataSource - retrieveMessageTextProperty");
> -            xads.setDatabaseName("wombat");
> -            xads.setConnectionAttributes(
> -                    retrieveMessageTextProperty + "=false");
> -            dsConnectionRequests((XADataSource) xads);
> -            conn = xads.getConnection();
> -            checkMessageText(conn,"false");
> -            conn.close();
> -            xads.setConnectionAttributes(
> -                    retrieveMessageTextProperty + "=true");
> -            dsConnectionRequests((XADataSource) xads);
> -            conn = xads.getConnection();
> -            checkMessageText(conn,"true");
> -            conn.close();
> -            xads.setConnectionAttributes(null);
> -        }
>  
> -        public static void checkMessageText(Connection conn, String
> -                retrieveMessageTextValue) throws SQLException
> -                {
> -            System.out.println("** checkMessageText() with retrieveMessageText= " +
> -                    retrieveMessageTextValue);
> +	public static void checkMessageText(
> +        Connection conn, String retrieveMessageTextValue) 
> +    throws SQLException
> +    {
> +	    System.out.println("** checkMessageText() with retrieveMessageText= " +
> +	            retrieveMessageTextValue);
>  
> -            try {
> -                conn.createStatement().executeQuery("SELECT * FROM APP.NOTTHERE");
> -            }
> -            catch (SQLException e)
> +	    try {
> +	        conn.createStatement().executeQuery("SELECT * FROM APP.NOTTHERE");
> +	    }
> +	    catch (SQLException e)
> +	    {
> +	        String expectedSQLState = "42X05";
> +	        String sqlState = e.getSQLState();
> +	        if (sqlState == null || ! sqlState.equals(expectedSQLState))
> +	        {
> +	            System.out.println("Incorrect SQLState.  Got: " + sqlState +
> +	                    " should be: " + expectedSQLState);
> +	            throw e;
> +	        }
> +	        if (retrieveMessageTextValue.equals("true") )
> +	        {
> +	            if (e.getMessage().indexOf("does not exist") != -1)
> +	                System.out.println("PASS: Message Text retrieved properly");
> +	            else
> +	            {
> +	                System.out.println("FAIL: Message text was not retrieved");
> +	                throw e;
> +	            }
> +	        }
> +	        else
>              {
> -                String expectedSQLState = "42X05";
> -                String sqlState = e.getSQLState();
> -                if (sqlState == null || ! sqlState.equals(expectedSQLState))
> -                {
> -                    System.out.println("Incorrect SQLState.  Got: " + sqlState +
> -                            " should be: " + expectedSQLState);
> -                    throw e;
> -                }
> -                if (retrieveMessageTextValue.equals("true") )
> -                {
> -                    if (e.getMessage().indexOf("does not exist") != -1)
> -                        System.out.println("PASS: Message Text retrieved properly");
> -                    else
> -                    {
> -                        System.out.println("FAIL: Message text was not retrieved");
> -                        throw e;
> -                    }
> -                }
> -                else
> -//                  retrieveMessageTextValue is false
> -                    if (e.getMessage().indexOf("does not exist") == -1)
> -                    {
> -                        System.out.println("PASS: Message text not retrieved");
> -                    }
> -                    else
> -                    {
> -                        System.out.println("FAIL: Message Text should not have been
retrieved");
> -                        throw e;
> -                    }
> -
> -            }
> +                // retrieveMessageTextValue is false
> +	            if (e.getMessage().indexOf("does not exist") == -1)
> +	            {
> +	                System.out.println("PASS: Message text not retrieved");
> +	            }
> +	            else
> +	            {
> +	                System.out.println("FAIL: Message Text should not have been retrieved");
> +	                throw e;
> +	            }	           
> +	        }
>          }
> +    }
>  
> -        /**
> -         * Check that messageText connection attribute functions correctly.
> -         * retrievemessagetext was tested in checkdriver, and derbynet/testij,
> -         * but not tested for datasources, and in datasourcepermissions_net,
> -         *  but as it has nothing to do with permissions/authentication,
> -         *  this test seems a better place for it. 
> -         *  
> -         * @throws SQLException
> -         */
> -        private static void testClientDescriptionDSConnectionAttribute() throws SQLException,
Exception {
> -
> -            // DataSource
> -            String setDescription = "Everything you ever wanted to know about this datasource";
> -            String getDescription;
> -            Connection conn;
> -            
> -            System.out.println("DataSource - setDescription");
> -            ClientDataSource ds = new ClientDataSource();
> -            ds.setDatabaseName("wombat");
> -            ds.setDescription(setDescription);
> -            conn = ds.getConnection();
> -            getDescription = ds.getDescription();
> -            if (!setDescription.equals(getDescription))
> -                throw new Exception("getDescription() " + getDescription 
> -                        + " does not match setDescription() ");
> -            ds.setDescription(null);
> -            conn.close();
> +	/**
> +	 * Check that messageText connection attribute functions correctly.
> +	 * retrievemessagetext was tested in checkdriver, and derbynet/testij,
> +	 * but not tested for datasources, and in datasourcepermissions_net,
> +	 *  but as it has nothing to do with permissions/authentication,
> +	 *  this test seems a better place for it. 
> +	 *  
> +	 * @throws SQLException
> +	 */
> +	private static void testClientDescriptionDSConnectionAttribute() throws SQLException,
Exception {
>  
> -            System.out.println("ConnectionPoolDataSource - setDescription");
> -            ClientConnectionPoolDataSource cpds = new ClientConnectionPoolDataSource();
> -            cpds.setDatabaseName("wombat");
> -            cpds.setDescription(setDescription);
> -            conn = cpds.getConnection();
> -            getDescription = cpds.getDescription();
> -            if (!setDescription.equals(getDescription))
> -                throw new Exception("getDescription() " + getDescription + " does not
match setDescription() ");
> -            conn.close();
> -            cpds.setDescription(null);
> +	    // DataSource
> +	    String setDescription = "Everything you ever wanted to know about this datasource";
> +	    String getDescription;
> +	    Connection conn;
>  
> -            ClientXADataSource xads = new ClientXADataSource();
> -            System.out.println("XADataSource - setDescription");
> -            xads.setDatabaseName("wombat");
> -            xads.setDescription(setDescription);
> -            conn = xads.getConnection();
> -            getDescription = xads.getDescription();
> -            if (!setDescription.equals(getDescription))
> -                throw new Exception("getDescription() " + getDescription + " does not
match setDescription() ");
> -            conn.close();
> -            xads.setDescription(null);
> -        }
> +	    System.out.println("DataSource - setDescription");
> +	    ClientDataSource ds = new ClientDataSource();
> +	    ds.setDatabaseName("wombat");
> +	    ds.setDescription(setDescription);
> +	    conn = ds.getConnection();
> +	    getDescription = ds.getDescription();
> +	    if (!setDescription.equals(getDescription))
> +	        throw new Exception("getDescription() " + getDescription 
> +	                + " does not match setDescription() ");
> +	    ds.setDescription(null);
> +	    conn.close();
> +
> +	    System.out.println("ConnectionPoolDataSource - setDescription");
> +	    ClientConnectionPoolDataSource cpds = new ClientConnectionPoolDataSource();
> +	    cpds.setDatabaseName("wombat");
> +	    cpds.setDescription(setDescription);
> +	    conn = cpds.getConnection();
> +	    getDescription = cpds.getDescription();
> +	    if (!setDescription.equals(getDescription))
> +	        throw new Exception("getDescription() " + getDescription + " does not match
setDescription() ");
> +	    conn.close();
> +	    cpds.setDescription(null);
> +
> +	    ClientXADataSource xads = new ClientXADataSource();
> +	    System.out.println("XADataSource - setDescription");
> +	    xads.setDatabaseName("wombat");
> +	    xads.setDescription(setDescription);
> +	    conn = xads.getConnection();
> +	    getDescription = xads.getDescription();
> +	    if (!setDescription.equals(getDescription))
> +	        throw new Exception("getDescription() " + getDescription + " does not match
setDescription() ");
> +	    conn.close();
> +	    xads.setDescription(null);
> +	}
>  
>  	private static void dsConnectionRequests(DataSource ds) {
>  		
> 
> 


Mime
View raw message