Update of /cvsroot/monetdb/clients/src/java/tests
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv24628

Modified Files:
      Tag: Clients_1-18
        Makefile.ag Test_PStypes.java build.xml 
Added Files:
      Tag: Clients_1-18
        Test_Clargequery.java 
Log Message:
Backported tests that were reverted previously.

--- NEW FILE: Test_Clargequery.java ---
/*
 * The contents of this file are subject to the MonetDB Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 *
 * The Original Code is the MonetDB Database System.
 *
 * The Initial Developer of the Original Code is CWI.
 * Portions created by CWI are Copyright (C) 1997-2007 CWI.
 * All Rights Reserved.
 */

import java.sql.*;

public class Test_Clargequery {
        public static void main(String[] args) throws Exception {
                Class.forName("nl.cwi.monetdb.jdbc.MonetDriver");
                Connection con1 = DriverManager.getConnection(args[0]);
                Statement stmt1 = con1.createStatement();
                ResultSet rs = null;
                //DatabaseMetaData dbmd = con.getMetaData();

                // >> true: auto commit should be on by default
                System.out.println("0. true\t" + con1.getAutoCommit());

                final String query = 
                        "-- When a query larger than the send buffer is being " 
+
                        "sent, a deadlock situation can occur when the server 
writes " +
                        "data back, blocking because we as client are sending 
as well " +
                        "and not reading.  Hence, to avoid this deadlock, in 
JDBC a " +
                        "separate thread is started in the background such that 
results " +
                        "from the server can be read, while data is still being 
sent to " +
                        "the server.  To test this, we need to trigger the 
SendThread " +
                        "being started, which we do with a quite large query.  
We " +
                        "construct it by repeating some stupid query plus a 
comment " +
                        "a lot of times.  And as you're guessing by now, you're 
reading " +
                        "this stupid comment that we use :)\n" +
                        "select 1;\n";

                int size = 1000;
                StringBuffer bigq = new StringBuffer(query.length() * size);
                for (int i = 0; i < size; i++) {
                        bigq.append(query);
                }

                // test commit by checking if a change is visible in another 
connection
                try {
                        System.out.print("1. sending");
                        stmt1.execute(bigq.toString());
                        int i = 1;      // we skip the first "getResultSet()"
                        while (stmt1.getMoreResults() != false) {
                                i++;
                        }
                        if (stmt1.getUpdateCount() != -1) {
                                System.out.println("found an update count for a 
SELECT query");
                                throw new SQLException("boo");
                        }
                        if (i != size) {
                                System.out.println("expecting " + size + " 
tuples, only got " + i);
                                throw new SQLException("boo");
                        }
                } catch (SQLException e) {
                        // this means we failed (table not there perhaps?)
                        System.out.println("FAILED :(");
                        System.out.println("ABORTING TEST!!!");
                }

                if (rs != null) rs.close();

                con1.close();
        }
}

Index: build.xml
===================================================================
RCS file: /cvsroot/monetdb/clients/src/java/tests/build.xml,v
retrieving revision 1.5.2.2
retrieving revision 1.5.2.3
diff -u -d -r1.5.2.2 -r1.5.2.3
--- build.xml   17 Aug 2007 12:56:50 -0000      1.5.2.2
+++ build.xml   21 Aug 2007 09:14:15 -0000      1.5.2.3
@@ -38,7 +38,7 @@
   <property name="jdbc_jar"
     value="${jardir}/monetdb-${JDBC_MAJOR}.${JDBC_MINOR}-jdbc.jar" />
   <property name="jdbc_url"
-    
value="jdbc:monetdb://localhost/d?user=monetdb&amp;password=monetdb${debug}" />
+    
value="jdbc:monetdb://localhost/?user=monetdb&amp;password=monetdb${debug}" />
 
   <!-- Prepares the build directory -->
   <target name="prepare">
@@ -87,6 +87,7 @@
   <target name="test">
     <antcall target="Test_Cautocommit" />
     <antcall target="Test_Csavepoints" />
+    <antcall target="Test_Clargequery" />
     <antcall target="Test_Cmanycon" />
     <antcall target="Test_Ctransaction" />
     <antcall target="Test_Creplysize" />
@@ -127,6 +128,12 @@
     </antcall>
   </target>
 
+  <target name="Test_Clargequery">
+    <antcall target="test_class">
+      <param name="test.class" value="Test_Clargequery" />
+    </antcall>
+  </target>
+
   <target name="Test_Cmanycon">
     <antcall target="test_class">
       <param name="test.class" value="Test_Cmanycon" />

Index: Test_PStypes.java
===================================================================
RCS file: /cvsroot/monetdb/clients/src/java/tests/Test_PStypes.java,v
retrieving revision 1.2.6.2
retrieving revision 1.2.6.3
diff -u -d -r1.2.6.2 -r1.2.6.3
--- Test_PStypes.java   17 Aug 2007 12:56:50 -0000      1.2.6.2
+++ Test_PStypes.java   21 Aug 2007 09:14:14 -0000      1.2.6.3
@@ -72,6 +72,18 @@
                        pstmt.executeUpdate();
 
                        System.out.println("success :)");
+
+                       // try an update like bug #1757923
+                       pstmt = con.prepareStatement(
+"UPDATE HTMTEST set COMMENT=? WHERE HTMID=?"
+);
+                       System.out.print("2. updating record...");
+
+                       pstmt.setString(1, "some update");
+                       pstmt.setLong(2, 1L);
+                       pstmt.executeUpdate();
+
+                       System.out.println("success :)");
                } catch (SQLException e) {
                        System.out.println("FAILED :( "+ e.getMessage());
                        System.out.println("ABORTING TEST!!!");

Index: Makefile.ag
===================================================================
RCS file: /cvsroot/monetdb/clients/src/java/tests/Makefile.ag,v
retrieving revision 1.6.4.2
retrieving revision 1.6.4.3
diff -u -d -r1.6.4.2 -r1.6.4.3
--- Makefile.ag 17 Aug 2007 12:56:49 -0000      1.6.4.2
+++ Makefile.ag 21 Aug 2007 09:14:12 -0000      1.6.4.3
@@ -16,18 +16,19 @@
 
 EXTRA_DIST = \
                Test_Cautocommit.java \
+               Test_Clargequery.java \
+               Test_Cmanycon.java \
+               Test_Creplysize.java \
                Test_Csavepoints.java \
                Test_Ctransaction.java \
                Test_PStimedate.java \
+               Test_PStimezone.java \
+               Test_PStypes.java \
                Test_Rbooleans.java \
+               Test_Rmetadata.java \
                Test_Rpositioning.java \
                Test_Rtimedate.java \
                Test_Sbatching.java \
-               Test_Rmetadata.java \
-               Test_Creplysize.java \
-               Test_PStimezone.java \
-               Test_PStypes.java \
-               Test_Cmanycon.java \
                BugConcurrent_clients_SF_1504657.java \
                build.xml build.properties
 
@@ -35,17 +36,18 @@
        DIR = datadir/MonetDB/Tests
        FILES = \
                Test_Cautocommit.class \
+               Test_Clargequery.class \
+               Test_Cmanycon.class \
+               Test_Creplysize.class \
                Test_Csavepoints.class \
                Test_Ctransaction.class \
                Test_PStimedate.class \
+               Test_PStimezone.class \
+               Test_PStypes.class \
                Test_Rbooleans.class \
+               Test_Rmetadata.class \
                Test_Rpositioning.class \
                Test_Rtimedate.class \
                Test_Sbatching.class \
-               Test_Rmetadata.class \
-               Test_Creplysize.class \
-               Test_PStimezone.class \
-               Test_PStypes.class \
-               BugConcurrent_clients_SF_1504657.class \
-               Test_Cmanycon.class
+               BugConcurrent_clients_SF_1504657.class
 }


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to