Date: Tuesday, February 6, 2007 @ 14:48:42
  Author: marc
    Path: /cvsroot/carob/carob/test

Modified: ConnectionSetup.cpp (1.19 -> 1.20) ConnectionSetup.hpp (1.12 ->
          1.13)

Implemented testConnection() method (currently "select * from product")
and calling it in tearDown(). Related to CAROB-124.


---------------------+
 ConnectionSetup.cpp |   20 ++++++++++++++++++--
 ConnectionSetup.hpp |    4 ++++
 2 files changed, 22 insertions(+), 2 deletions(-)


Index: carob/test/ConnectionSetup.cpp
diff -u carob/test/ConnectionSetup.cpp:1.19 carob/test/ConnectionSetup.cpp:1.20
--- carob/test/ConnectionSetup.cpp:1.19 Tue Feb  6 12:40:50 2007
+++ carob/test/ConnectionSetup.cpp      Tue Feb  6 14:48:42 2007
@@ -23,6 +23,7 @@
 #include "ConnectionParameters.hpp"
 #include "CarobException.hpp"
 #include "Statement.hpp"
+#include "DriverResultSet.hpp"
 
 #include "ConnectionSetup.hpp"
 
@@ -78,7 +79,7 @@
     }
     else // reuse failed: reconnect
       logInfo(fctName, std::wstring(L"lastConnection was ")
-              + (lastConnection ? L" closed" : L" NULL"));
+              + (lastConnection ? L"closed" : L"NULL"));
   }
 
   std::vector<ControllerInfo> ctrls;
@@ -108,8 +109,23 @@
 
 }
 
+void ConnectionSetup::testConnection()
+{
+  Statement* teststmt = connectionPtr->createStatement();
+
+  // FIXME: product table is created in CarobTestLauncher
+  DriverResultSet* drsPtr =
+    teststmt->executeQuery(L"SELECT * FROM product WHERE ID<2");
+
+  drsPtr->next();
+
+  connectionPtr->deleteStatement(teststmt);
+}
+
 void ConnectionSetup::tearDown()
 {
+  testConnection();
+
   if (reuseConnection)
     return;
 
@@ -166,7 +182,7 @@
 /*
  * Local Variables:
  * c-file-style: "bsd"
- * c-basic-offset: 4
+ * c-basic-offset: 2
  * indent-tabs-mode: nil
  * End:
  */
Index: carob/test/ConnectionSetup.hpp
diff -u carob/test/ConnectionSetup.hpp:1.12 carob/test/ConnectionSetup.hpp:1.13
--- carob/test/ConnectionSetup.hpp:1.12 Tue Jan 30 16:49:20 2007
+++ carob/test/ConnectionSetup.hpp      Tue Feb  6 14:48:42 2007
@@ -74,6 +74,10 @@
   /** Destroys the connection if applicable */
   virtual void tearDown();
 
+  /** Probably throws or at least logs errors if connection has been
+      left in a corrupted state by some test */
+  void testConnection();
+
   /** Valid connection on which data transferts are to be done */
   CarobNS::Connection*       connectionPtr;
 };

_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits

Reply via email to