Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

CVS update of carob/test (11 files): msg#00105

db.carob.cvs

Subject: CVS update of carob/test (11 files)

Date: Monday, February 27, 2006 @ 15:41:38
Author: gilles
Path: /cvsroot/carob/carob/test

Added: 20-Write/TestExecWriteRequest.cpp (1.1)
20-Write/TestExecWriteRequest.hpp (1.1)
35-ResultList/TestExec.cpp (1.1) 35-ResultList/TestExec.hpp
(1.1)
Modified: 30-ResultSet/TestExecReadRequest.cpp (1.1 -> 1.2)
30-ResultSet/TestExecReadRequest.hpp (1.1 -> 1.2)
CarobTestLauncher.cpp (1.24 -> 1.25)
Removed: TestExecWriteRequest.cpp (1.17) TestExecWriteRequest.hpp (1.7)
TestStatement.cpp (1.21) TestStatement.hpp (1.6)

Re-organized XXXExecXXX tests:
- modified TestExecXXX to use only statements (and not requests anymore)
- removed TestStatement that was testing exactly the same thing as TestExecXXX
- moved tests in their respective directory


--------------------------------------+
20-Write/TestExecWriteRequest.cpp | 142 +++++++++++
20-Write/TestExecWriteRequest.hpp | 62 +++++
30-ResultSet/TestExecReadRequest.cpp | 95 +++++---
30-ResultSet/TestExecReadRequest.hpp | 5
35-ResultList/TestExec.cpp | 184 +++++++++++++++
35-ResultList/TestExec.hpp | 57 ++++
CarobTestLauncher.cpp | 6
TestExecWriteRequest.cpp | 145 ------------
TestExecWriteRequest.hpp | 61 -----
TestStatement.cpp | 391 ---------------------------------
TestStatement.hpp | 96 --------
11 files changed, 521 insertions(+), 723 deletions(-)


Index: carob/test/20-Write/TestExecWriteRequest.cpp
diff -u /dev/null carob/test/20-Write/TestExecWriteRequest.cpp:1.1
--- /dev/null Mon Feb 27 15:41:38 2006
+++ carob/test/20-Write/TestExecWriteRequest.cpp Mon Feb 27 15:41:37 2006
@@ -0,0 +1,142 @@
+/*
+ * Sequoia: Database clustering technology.
+ * Copyright (C) 2005-2006 Continuent, Inc.
+ * Contact: sequoia-NAAfj4rwCWAYtQj7fl1lsA@xxxxxxxxxxxxxxxx
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Initial developer(s): Gilles Rayrat
+ * Contributor(s):
+ */
+
+#include "TestExecWriteRequest.hpp"
+
+#include "Statement.hpp"
+
+#include "CarobException.hpp"
+#include "Common.hpp"
+
+#include <string>
+
+using std::wstring;
+
+using namespace CarobNS;
+
+void TestExecWriteRequest::testWriteBadRequest()
+{
+ wstring fctName(L"TestExecWriteRequest::testWriteBadRequest");
+ try
+ {
+ Statement* statementPtr = connectionPtr->createStatement();
+ if (isInfoEnabled())
+ {
+ logInfo(fctName, L"Executing dummy update - should fail");
+ }
+ statementPtr->executeUpdate(L"dummy request");
+ // We should receive an exception instead of coming here
+ CPPUNIT_ASSERT(false);
+ }
+ catch (ControllerException ce)
+ {
+ if (isErrorEnabled())
+ {
+ logError(fctName, L"Update failed (this is ok). Exception: "
+ + ce.description());
+ }
+ }
+}
+
+void TestExecWriteRequest::testWriteBadTable()
+{
+ wstring fctName(L"TestExecWriteRequest::testWriteBadTable");
+ try
+ {
+ Statement* statementPtr = connectionPtr->createStatement();
+ if (isInfoEnabled())
+ {
+ logInfo(fctName, L"Executing bad table update - this should fail");
+ }
+ statementPtr->executeUpdate(L"update dummy set name='gotit' where id=0");
+ // We should receive an exception instead of coming here
+ CPPUNIT_ASSERT(false);
+ }
+ catch (BackendException be)
+ {
+ if (isErrorEnabled())
+ {
+ logError(fctName, L"Update failed (this is ok). Exception: "
+ + be.description());
+ }
+ }
+}
+
+void TestExecWriteRequest::testWriteGood()
+{
+ wstring fctName(L"TestExecWriteRequest::testWriteGood");
+ Statement* statementPtr = connectionPtr->createStatement();
+ if (isInfoEnabled())
+ {
+ logInfo(fctName, L"Executing update - should succeed");
+ }
+ int nbRowsAffected = statementPtr->executeUpdate(
+ L"update product set name='changed by testExecuteUpdateGood' where
id=0");
+ if (isInfoEnabled())
+ {
+ logInfo(fctName, L"Update succeeded. Number of affected rows = "
+ + toWString(nbRowsAffected));
+ }
+ CPPUNIT_ASSERT(nbRowsAffected == 1);
+}
+
+void TestExecWriteRequest::testWriteThousandGood()
+{
+ wstring fctName(L"TestExecWriteRequest::testWriteThousandGood");
+ wstring requestBegin = L"UPDATE product SET cost=";
+ wstring requestEnd = L" WHERE id=";
+
+ Statement* statementPtr = connectionPtr->createStatement();
+ if (isInfoEnabled())
+ {
+ logInfo(fctName, L"Executing 1000 writes");
+ }
+ for (int i=0; i<1000; i++)
+ {
+ int nbRowsAffected = statementPtr->executeUpdate(requestBegin +
toWString(i)
+ + requestEnd + toWString(i%50));
+ CPPUNIT_ASSERT(nbRowsAffected == 1);
+ }
+ if (isInfoEnabled())
+ {
+ logInfo(fctName, L"1000 writes succeeded");
+ }
+}
+
+CppUnit::Test* TestExecWriteRequest::suite()
+{
+ CppUnit::TestSuite *suiteOfTests = new CppUnit::TestSuite(
"TestExecWriteRequest" );
+
+ suiteOfTests->addTest(new CppUnit::TestCaller<TestExecWriteRequest>(
+ "testWriteBadRequest",
+ &TestExecWriteRequest::testWriteBadRequest));
+ suiteOfTests->addTest(new CppUnit::TestCaller<TestExecWriteRequest>(
+ "testWriteBadTable",
+ &TestExecWriteRequest::testWriteBadTable));
+ suiteOfTests->addTest(new CppUnit::TestCaller<TestExecWriteRequest>(
+ "testWriteGood",
+ &TestExecWriteRequest::testWriteGood));
+/* suiteOfTests->addTest(new CppUnit::TestCaller<TestExecWriteRequest>(
+ "testWriteThousandGood",
+
&TestExecWriteRequest::testWriteThousandGood));
+*/
+ return suiteOfTests;
+}
Index: carob/test/20-Write/TestExecWriteRequest.hpp
diff -u /dev/null carob/test/20-Write/TestExecWriteRequest.hpp:1.1
--- /dev/null Mon Feb 27 15:41:38 2006
+++ carob/test/20-Write/TestExecWriteRequest.hpp Mon Feb 27 15:41:37 2006
@@ -0,0 +1,62 @@
+/*
+ * Sequoia: Database clustering technology.
+ * Copyright (C) 2005-2006 Continuent, Inc.
+ * Contact: sequoia-NAAfj4rwCWAYtQj7fl1lsA@xxxxxxxxxxxxxxxx
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Initial developer(s): Gilles Rayrat
+ * Contributor(s):
+ */
+
+#ifndef TESTEXECWRITEREQUEST_H_
+#define TESTEXECWRITEREQUEST_H_
+
+#include "../ConnectionSetup.hpp"
+
+/**
+ * Test class for ExecWriteRequest command.
+ * Tries to run a dummy request, then a request on a dummy table, then a
+ * correct request and finally a correct request played 1000 times
+ * A controller *MUST* run locally for test success !!!
+ */
+class TestExecWriteRequest : public ConnectionSetup
+{
+public:
+ /** Suite of tests to be run */
+ static CppUnit::Test* suite();
+
+ /**
+ * Tries to send a dummy write request to the controller and checks that the
+ * error is consistent.
+ */
+ void testWriteBadRequest();
+ /**
+ * Tries to do a good write request on a dummy table and checks that the
+ * error is consistent.
+ */
+ void testWriteBadTable();
+ /**
+ * Sends a valid update request to the controller and checks that there is no
+ * error.
+ */
+ void testWriteGood();
+ /**
+ * Sends 1000 valid update requests to the controller and checks that there
is
+ * no error.
+ * DISABLED TEST because too long
+ */
+ void testWriteThousandGood();
+};
+
+#endif /*TESTEXECWRITEREQUEST_H_*/
Index: carob/test/30-ResultSet/TestExecReadRequest.cpp
diff -u carob/test/30-ResultSet/TestExecReadRequest.cpp:1.1
carob/test/30-ResultSet/TestExecReadRequest.cpp:1.2
--- carob/test/30-ResultSet/TestExecReadRequest.cpp:1.1 Fri Feb 24 19:07:41 2006
+++ carob/test/30-ResultSet/TestExecReadRequest.cpp Mon Feb 27 15:41:38 2006
@@ -19,14 +19,16 @@
* Contributor(s):
*/

-#include <iostream>
+#include "TestExecReadRequest.hpp"
+
+#include "Statement.hpp"
+#include "ResultSetMetaData.hpp"

-#include "Common.hpp"
#include "CarobException.hpp"
-#include "Connection.hpp"
-#include "DriverResultSet.hpp"
-#include "TestExecReadRequest.hpp"
-#include "RequestWithResultSetParameters.hpp"
+#include "Common.hpp"
+
+#include <string>
+#include <iostream>

using std::wstring;
using std::endl;
@@ -38,13 +40,12 @@
wstring fctName(L"TestExecReadRequest::testReadBadRequest");
try
{
- RequestWithResultSetParameters readReq(L"dummy request");
- readReq.setEscapeProcessing(false).setTimeoutInSeconds(2);
+ Statement* statementPtr = connectionPtr->createStatement();
if (isInfoEnabled())
{
- logInfo(fctName, L"Executing read - this should fail");
+ logInfo(fctName, L"Executing dummy read - should fail");
}
- connectionPtr->statementExecuteQuery(readReq);
+ statementPtr->executeQuery(L"dummy request");
// We should receive an exception instead of coming here
CPPUNIT_ASSERT(false);
}
@@ -52,7 +53,8 @@
{
if (isErrorEnabled())
{
- logError(fctName, L"Read failed (this is ok). Exception:
"+ce.description());
+ logError(fctName, L"Read failed (this is ok). Exception: "
+ + ce.description());
}
}
}
@@ -62,14 +64,12 @@
wstring fctName(L"TestExecReadRequest::testReadBadTable");
try
{
- RequestWithResultSetParameters readReq(L"select * from dummy");
- readReq.setEscapeProcessing(false).setTimeoutInSeconds(2);
-
+ Statement* statementPtr = connectionPtr->createStatement();
if (isInfoEnabled())
{
- logInfo(fctName, L"Executing read - this should fail");
+ logInfo(fctName, L"Executing bad table read - should fail");
}
- connectionPtr->statementExecuteQuery(readReq);
+ statementPtr->executeQuery(L"select * from dummy");
// We should receive an exception instead of coming here
CPPUNIT_ASSERT(false);
}
@@ -86,23 +86,34 @@
void TestExecReadRequest::testReadGood()
{
wstring fctName(L"TestExecReadRequest::testReadGood");
- RequestWithResultSetParameters readReq(L"select * from product");
- readReq.setEscapeProcessing(false).setTimeoutInSeconds(2);
+
+
+ Statement* statementPtr = connectionPtr->createStatement();
if (isInfoEnabled())
{
- logInfo(fctName, L"Executing read - this should succeed");
+ logInfo(fctName, L"Executing read - should succeed");
}
- DriverResultSet* drsPtr = connectionPtr->statementExecuteQuery(readReq);
+ statementPtr->setFetchSize(1);
+ DriverResultSet* drsPtr = statementPtr->executeQuery(
+ L"select * from address");
if (isInfoEnabled())
{
logInfo(fctName, L"Read succeeded. Displaying 50 rows:");
}
- //Display 50 rows for debugging...
-
-// wcerr<<L"Row\tId\tName\t\tCost"<<endl;
+ //Display 50 rows using metadata and toString
+ ResultSetMetaData rsmd(drsPtr);
std::wostringstream buffer;
- buffer<<L"Row\tId\tFirstName\tLastName"<<endl;
- for (int i=0; i<50; i++)
+ buffer<<L"25 first rows got as strings"<<endl;
+ for (int i=0; i<25; i++)
+ {
+ drsPtr->next();
+ buffer<<i+1<<L"\t";
+ for (int j=0; j<rsmd.getColumnCount(); j++)
+ buffer<<drsPtr->getAsString(j+1)<<L"\t";
+ buffer<<endl;
+ }
+ buffer<<L"25 next rows got as Int32, String and AsString"<<endl;
+ for (int i=25; i<50; i++)
{
drsPtr->next();
buffer<<i+1<<L"\t"<<drsPtr->getInt32(1)
@@ -110,11 +121,38 @@
<<L"\t\t"<<drsPtr->getAsString(3)<<endl;
}
if (isInfoEnabled())
+ logInfo(fctName, buffer.str());
+}
+
+void TestExecReadRequest::testReadWithMaxRows()
+{
+ wstring fctName(L"TestStatement::testReadWithMaxRows");
+ Statement* statementPtr = NULL;
+ statementPtr = connectionPtr->createStatement();
+ if (isInfoEnabled())
+ {
+ logInfo(fctName, L"Executing read with max rows = 1");
+ }
+ statementPtr->setMaxRows(1);
+ DriverResultSet* drsPtr = statementPtr->executeQuery(
+ L"select * from address");
+ if (isInfoEnabled())
+ {
+ logInfo(fctName, L"executeQuery succeeded. Displaying first row.");
+ }
+ //wcerr<<L"Row\tId\tName\t\tCost"<<endl;
+ std::wostringstream buffer;
+ buffer<<L"Id\tFirstName\tLastName"<<endl;
+ CPPUNIT_ASSERT(drsPtr->next() == true);
+ buffer<<drsPtr->getInt32(1)
+ <<L"\t"<<drsPtr->getString(2)
+ <<L"\t\t"<<drsPtr->getString(3)<<endl;
+ if (isInfoEnabled())
{
logInfo(fctName, buffer.str());
}
- //We have to free the allocated result...
- delete drsPtr;
+ //This next() should return false because we asked just 1 row
+ CPPUNIT_ASSERT(drsPtr->next() == false);
}

CppUnit::Test* TestExecReadRequest::suite()
@@ -129,6 +167,9 @@
suiteOfTests->addTest(new CppUnit::TestCaller<TestExecReadRequest>(
"testReadGood",
&TestExecReadRequest::testReadGood));
+ suiteOfTests->addTest(new CppUnit::TestCaller<TestExecReadRequest>(
+ "testReadWithMaxRows",
+ &TestExecReadRequest::testReadWithMaxRows));

return suiteOfTests;
}
Index: carob/test/30-ResultSet/TestExecReadRequest.hpp
diff -u carob/test/30-ResultSet/TestExecReadRequest.hpp:1.1
carob/test/30-ResultSet/TestExecReadRequest.hpp:1.2
--- carob/test/30-ResultSet/TestExecReadRequest.hpp:1.1 Fri Feb 24 19:07:41 2006
+++ carob/test/30-ResultSet/TestExecReadRequest.hpp Mon Feb 27 15:41:38 2006
@@ -51,6 +51,11 @@
* error. Also displays a part of the result for manual check.
*/
void testReadGood();
+ /**
+ * Tests a read with max rows to 1 and checks that the second call to next()
+ * returns false
+ */
+ void testReadWithMaxRows();
};

#endif /*TESTEXECREADREQUEST_H_*/
Index: carob/test/35-ResultList/TestExec.cpp
diff -u /dev/null carob/test/35-ResultList/TestExec.cpp:1.1
--- /dev/null Mon Feb 27 15:41:38 2006
+++ carob/test/35-ResultList/TestExec.cpp Mon Feb 27 15:41:37 2006
@@ -0,0 +1,184 @@
+/*
+ * Sequoia: Database clustering technology.
+ * Copyright (C) 2005-2006 Continuent, Inc.
+ * Contact: sequoia-NAAfj4rwCWAYtQj7fl1lsA@xxxxxxxxxxxxxxxx
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Initial developer(s): Gilles Rayrat
+ * Contributor(s):
+ */
+
+#include "TestExec.hpp"
+
+#include "ResultSetMetaData.hpp"
+#include "Statement.hpp"
+
+#include "CarobException.hpp"
+#include "Common.hpp"
+
+#include <string>
+#include <iostream>
+
+using std::wstring;
+using std::endl;
+
+using namespace CarobNS;
+
+void TestExec::testExecuteBadRequests()
+{
+ wstring fctName(L"TestStatement::testExecuteBadRequests");
+ Statement* statementPtr = NULL;
+ if (isInfoEnabled())
+ {
+ logInfo(fctName, L"Testing execute with bad query \"dummy\" (should
fail)");
+ }
+ try
+ {
+ statementPtr = connectionPtr->createStatement();
+ statementPtr->execute(L"dummy");
+ // We should receive an exception instead of coming here
+ CPPUNIT_ASSERT(false);
+ }
+ catch (BackendException be)
+ {
+ if (isErrorEnabled())
+ {
+ logError(fctName, L"Read failed (this is ok). Exception: "
+ + be.description());
+ }
+ }
+ if (isInfoEnabled())
+ {
+ logInfo(fctName, L"Testing execute with bad query \"SELECT * FROM dummy\"
(should fail)");
+ }
+ try
+ {
+ statementPtr->execute(L"SELECT * FROM dummy");
+ // We should receive an exception instead of coming here
+ CPPUNIT_ASSERT(false);
+ }
+ catch (BackendException be)
+ {
+ if (isErrorEnabled())
+ {
+ logError(fctName, L"Read failed (this is ok). Exception: "
+ + be.description());
+ }
+ }
+}
+
+void TestExec::testExecuteWithSelect()
+{
+ wstring fctName(L"TestExec::testExecuteWithSelect");
+ Statement* statementPtr = NULL;
+ statementPtr = connectionPtr->createStatement();
+ if (isInfoEnabled())
+ {
+ logInfo(fctName, L"Executing execute(SELECT * FROM address) - should
succeed");
+ }
+ bool isRS = statementPtr->execute(L"SELECT * FROM address");
+ CPPUNIT_ASSERT(isRS);
+
+ DriverResultSet* drsPtr = statementPtr->getResultSet();
+ if (isInfoEnabled())
+ {
+ logInfo(fctName, L"Read succeeded. Displaying 50 rows:");
+ }
+ //Display 50 rows using metadata and toString
+ ResultSetMetaData rsmd(drsPtr);
+ std::wostringstream buffer;
+ for (int i=0; i<50; i++)
+ {
+ drsPtr->next();
+ buffer<<i+1<<L"\t";
+ for (int j=0; j<rsmd.getColumnCount(); j++)
+ buffer<<drsPtr->getAsString(j+1)<<L"\t";
+ buffer<<endl;
+ }
+ if (isInfoEnabled())
+ {
+ logInfo(fctName, buffer.str());
+ }
+}
+void TestExec::testExecuteWithUpdate()
+{
+ wstring fctName(L"TestExec::testExecuteWithUpdate");
+ Statement* statementPtr = NULL;
+ statementPtr = connectionPtr->createStatement();
+ if (isInfoEnabled())
+ {
+ logInfo(fctName, L"Executing execute(UPDATE FROM address...) - should
succeed");
+ }
+ bool isRS = statementPtr->execute(L"UPDATE product SET name='changed by
testExecuteWithUpdate' WHERE id=0");
+ CPPUNIT_ASSERT(!isRS);
+ if (isInfoEnabled())
+ {
+ logInfo(fctName, L"Update with execute succeeded. Number of affected rows
= "
+ + toWString(statementPtr->getUpdateCount()));
+ }
+ CPPUNIT_ASSERT(statementPtr->getUpdateCount() == 1);
+}
+
+void TestExec::testExecuteWithSelectStreamed()
+{
+ wstring fctName(L"TestExec::testExecuteWithSelectStreamed");
+ Statement* statementPtr = NULL;
+ statementPtr = connectionPtr->createStatement();
+ if (isInfoEnabled())
+ {
+ logInfo(fctName, L"Executing streamed execute(SELECT * FROM address) -
should succeed");
+ }
+ statementPtr->setFetchSize(1);
+ bool isRS = statementPtr->execute(L"SELECT * FROM address");
+ CPPUNIT_ASSERT(isRS);
+
+ DriverResultSet* drsPtr = statementPtr->getResultSet();
+ ResultSetMetaData rsmd(drsPtr);
+ if (isInfoEnabled())
+ {
+ logInfo(fctName, L"Read succeeded. Displaying 50 rows:");
+ }
+ //Display rows using metadata and toString
+ std::wostringstream buffer;
+ while (drsPtr->next())
+ {
+ ResultSetMetaData rsmd(drsPtr);
+ for (int j=0; j<rsmd.getColumnCount(); j++)
+ buffer<<drsPtr->getAsString(j+1)<<L"\t";
+ buffer<<endl;
+ }
+ if (isInfoEnabled())
+ {
+ logInfo(fctName, buffer.str());
+ }
+}
+
+CppUnit::Test* TestExec::suite()
+{
+ CppUnit::TestSuite *suiteOfTests = new CppUnit::TestSuite( "TestExec" );
+ suiteOfTests->addTest(new CppUnit::TestCaller<TestExec>(
+ "testExecuteBadRequests",
+ &TestExec::testExecuteBadRequests));
+ suiteOfTests->addTest(new CppUnit::TestCaller<TestExec>(
+ "testExecuteWithSelect",
+ &TestExec::testExecuteWithSelect));
+ suiteOfTests->addTest(new CppUnit::TestCaller<TestExec>(
+ "testExecuteWithUpdate",
+ &TestExec::testExecuteWithUpdate));
+ suiteOfTests->addTest(new CppUnit::TestCaller<TestExec>(
+ "testExecuteWithSelectStreamed",
+ &TestExec::testExecuteWithSelectStreamed));
+
+ return suiteOfTests;
+}
Index: carob/test/35-ResultList/TestExec.hpp
diff -u /dev/null carob/test/35-ResultList/TestExec.hpp:1.1
--- /dev/null Mon Feb 27 15:41:38 2006
+++ carob/test/35-ResultList/TestExec.hpp Mon Feb 27 15:41:38 2006
@@ -0,0 +1,57 @@
+/*
+ * Sequoia: Database clustering technology.
+ * Copyright (C) 2005-2006 Continuent, Inc.
+ * Contact: sequoia-NAAfj4rwCWAYtQj7fl1lsA@xxxxxxxxxxxxxxxx
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Initial developer(s): Gilles Rayrat
+ * Contributor(s):
+ */
+
+#ifndef TESTEXEC_H_
+#define TESTEXEC_H_
+
+#include "../ConnectionSetup.hpp"
+
+/**
+ * Test class for Statement class.
+ * This is basically a copy of exec read and exec write commands testing
+ * A controller *MUST* run locally for test success !!!
+ */
+class TestExec : public ConnectionSetup
+{
+public:
+ /** Suite of tests to be run */
+ static CppUnit::Test* suite();
+
+ /**
+ * Tests execute function with bad query of different forms (bad query, wrong
+ * table)
+ */
+ void testExecuteBadRequests();
+ /**
+ * Tests execute function with a select statement
+ */
+ void testExecuteWithSelect();
+ /**
+ * Tests execute function with an update statement
+ */
+ void testExecuteWithUpdate();
+ /**
+ * Tests execute function with a select statement and max rows set to 1
+ */
+ void testExecuteWithSelectStreamed();
+};
+
+#endif /*TESTEXEC_H_*/
Index: carob/test/CarobTestLauncher.cpp
diff -u carob/test/CarobTestLauncher.cpp:1.24
carob/test/CarobTestLauncher.cpp:1.25
--- carob/test/CarobTestLauncher.cpp:1.24 Fri Feb 24 19:07:41 2006
+++ carob/test/CarobTestLauncher.cpp Mon Feb 27 15:41:37 2006
@@ -39,14 +39,14 @@

#include "TestBeginCommitRollback.hpp"
#include "TestDriverResultSet.hpp"
-#include "TestExecWriteRequest.hpp"
-#include "TestStatement.hpp"
#include "01-Unit/TestStringCodecs.hpp"
#include "10-Connection/TestConnect.hpp"
#include "10-Connection/TestControllerConnectPolicy.hpp"
#include "10-Connection/TestFailOver.hpp"
+#include "20-Write/TestExecWriteRequest.hpp"
#include "30-ResultSet/TestSimpleUnicode.hpp"
#include "30-ResultSet/TestExecReadRequest.hpp"
+#include "35-ResultList/TestExec.hpp"
#include "40-Parameter-PreparedStatement/TestParameterStatement.hpp"
#include "40-Parameter-PreparedStatement/TestPreparedStatement.hpp"
#include "40-Parameter-PreparedStatement/TestIEEE754.hpp"
@@ -72,8 +72,8 @@
runner.addTest(TestConnect::suite());
runner.addTest(TestExecWriteRequest::suite());
runner.addTest(TestExecReadRequest::suite());
+ runner.addTest(TestExec::suite());
runner.addTest(TestBeginCommitRollback::suite());
- runner.addTest(TestStatement::suite());
runner.addTest(TestDriverResultSet::suite());
runner.addTest(TestStringCodecs::suite());
runner.addTest(TestSimpleUnicode::suite());
Index: carob/test/TestExecWriteRequest.cpp
diff -u carob/test/TestExecWriteRequest.cpp:1.17
carob/test/TestExecWriteRequest.cpp:removed
--- carob/test/TestExecWriteRequest.cpp:1.17 Tue Feb 14 18:35:47 2006
+++ carob/test/TestExecWriteRequest.cpp Mon Feb 27 15:41:38 2006
@@ -1,145 +0,0 @@
-/*
- * Sequoia: Database clustering technology.
- * Copyright (C) 2005 Emic Networks
- * Contact: sequoia-NAAfj4rwCWAYtQj7fl1lsA@xxxxxxxxxxxxxxxx
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Initial developer(s): Gilles Rayrat
- * Contributor(s):
- */
-
-#include "Common.hpp"
-#include "Connection.hpp"
-#include "CarobException.hpp"
-#include "DriverResultSet.hpp"
-#include "TestExecWriteRequest.hpp"
-#include "Request.hpp"
-
-using std::wstring;
-
-using namespace CarobNS;
-
-void TestExecWriteRequest::testWriteBadRequest()
-{
- wstring fctName(L"TestExecWriteRequest::testWriteBadRequest");
- try
- {
- Request updtReq(L"dummy request");
- updtReq.setEscapeProcessing(false).setTimeoutInSeconds(2);
- if (isInfoEnabled())
- {
- logInfo(fctName, L"Executing write - should fail");
- }
- connectionPtr->statementExecuteUpdate(updtReq);
- // We should receive an exception instead of coming here
- CPPUNIT_ASSERT(false);
- }
- catch (ControllerException ce)
- {
- if (isErrorEnabled())
- {
- logError(fctName, L"Write failed (this is ok). Exception:"
- + ce.description());
- }
- CPPUNIT_ASSERT(true);
- }
-}
-
-void TestExecWriteRequest::testWriteBadTable()
-{
- wstring fctName(L"TestExecWriteRequest::testWriteBadTable");
- try
- {
- Request updtReq(L"update dummy set name='gotit' where id=0");
- updtReq.setEscapeProcessing(false).setTimeoutInSeconds(2);
- if (isInfoEnabled())
- {
- logInfo(fctName, L"Executing write - should fail");
- }
- connectionPtr->statementExecuteUpdate(updtReq);
- // We should receive an exception instead of coming here
- CPPUNIT_ASSERT(false);
- }
- catch (BackendException be)
- {
- if (isErrorEnabled())
- {
- logError(fctName, L"Write failed (this is ok). Exception:"
- + be.description());
- }
- }
-}
-
-void TestExecWriteRequest::testWriteGood()
-{
- wstring fctName(L"TestExecWriteRequest::testWriteGood");
- Request updtReq(L"update product set name='changed' where id=0");
- updtReq.setEscapeProcessing(false).setTimeoutInSeconds(2);
- if (isInfoEnabled())
- {
- logInfo(fctName, L"Executing write - should succeed");
- }
- int nbRowsAffected = connectionPtr->statementExecuteUpdate(updtReq);
- if (isInfoEnabled())
- {
- logInfo(fctName, L"Write succeed. Number of rows updated:"
- + toWString(nbRowsAffected));
- }
- CPPUNIT_ASSERT(nbRowsAffected == 1);
-}
-
-void TestExecWriteRequest::testWriteThousandGood()
-{
- wstring fctName(L"TestExecWriteRequest::testWriteGood");
- wstring requestBegin = L"UPDATE product SET cost=";
- wstring requestEnd = L" where id=";
-
- Request updtReq(L"");
- updtReq.setEscapeProcessing(false).setTimeoutInSeconds(2);
- if (isInfoEnabled())
- {
- logInfo(fctName, L"Executing 1000 writes");
- }
- for (int i=0; i<1000; i++)
- {
- updtReq.setSqlQueryOrTemplate(requestBegin + toWString(i)
- + requestEnd + toWString(i%50));
- int nbRowsAffected = connectionPtr->statementExecuteUpdate(updtReq);
- CPPUNIT_ASSERT(nbRowsAffected == 1);
- }
- if (isInfoEnabled())
- {
- logInfo(fctName, L"1000 writes succeeded");
- }
-}
-
-CppUnit::Test* TestExecWriteRequest::suite()
-{
- CppUnit::TestSuite *suiteOfTests = new CppUnit::TestSuite(
"TestExecWriteRequest" );
-
- suiteOfTests->addTest(new CppUnit::TestCaller<TestExecWriteRequest>(
- "testWriteBadRequest",
- &TestExecWriteRequest::testWriteBadRequest));
- suiteOfTests->addTest(new CppUnit::TestCaller<TestExecWriteRequest>(
- "testWriteBadTable",
- &TestExecWriteRequest::testWriteBadTable));
- suiteOfTests->addTest(new CppUnit::TestCaller<TestExecWriteRequest>(
- "testWriteGood",
- &TestExecWriteRequest::testWriteGood));
-/* suiteOfTests->addTest(new CppUnit::TestCaller<TestExecWriteRequest>(
- "testWriteThousandGood",
-
&TestExecWriteRequest::testWriteThousandGood));
-*/
- return suiteOfTests;
-}
Index: carob/test/TestExecWriteRequest.hpp
diff -u carob/test/TestExecWriteRequest.hpp:1.7
carob/test/TestExecWriteRequest.hpp:removed
--- carob/test/TestExecWriteRequest.hpp:1.7 Fri Dec 16 17:41:08 2005
+++ carob/test/TestExecWriteRequest.hpp Mon Feb 27 15:41:38 2006
@@ -1,61 +0,0 @@
-/*
- * Sequoia: Database clustering technology.
- * Copyright (C) 2005 Emic Networks
- * Contact: sequoia-NAAfj4rwCWAYtQj7fl1lsA@xxxxxxxxxxxxxxxx
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Initial developer(s): Gilles Rayrat
- * Contributor(s):
- */
-
-#ifndef TESTEXECWRITEREQUEST_H_
-#define TESTEXECWRITEREQUEST_H_
-
-#include "ConnectionSetup.hpp"
-
-/**
- * Test class for ExecWriteRequest command.
- * Tries to run a dummy request, then a request on a dummy table, then a
- * correct request and finally a correct request played 1000 times
- * A controller *MUST* run locally for test success !!!
- */
-class TestExecWriteRequest : public ConnectionSetup
-{
-public:
- /** Suite of tests to be run */
- static CppUnit::Test* suite();
-
- /**
- * Tries to send a dummy write request to the controller and checks that the
- * error is consistent.
- */
- void testWriteBadRequest();
- /**
- * Tries to do a good write request on a dummy table and checks that the
- * error is consistent.
- */
- void testWriteBadTable();
- /**
- * Sends a valid update request to the controller and checks that there is no
- * error.
- */
- void testWriteGood();
- /**
- * Sends 1000 valid update requests to the controller and checks that there
is
- * no error.
- */
- void testWriteThousandGood();
-};
-
-#endif /*TESTEXECWRITEREQUEST_H_*/
Index: carob/test/TestStatement.cpp
diff -u carob/test/TestStatement.cpp:1.21 carob/test/TestStatement.cpp:removed
--- carob/test/TestStatement.cpp:1.21 Tue Feb 14 18:35:47 2006
+++ carob/test/TestStatement.cpp Mon Feb 27 15:41:38 2006
@@ -1,391 +0,0 @@
-/*
- * Sequoia: Database clustering technology.
- * Copyright (C) 2005 Emic Networks
- * Contact: sequoia-NAAfj4rwCWAYtQj7fl1lsA@xxxxxxxxxxxxxxxx
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Initial developer(s): Gilles Rayrat
- * Contributor(s):
- */
-
-#include <iostream>
-
-#include "Common.hpp"
-#include "Connection.hpp"
-#include "CarobException.hpp"
-#include "DriverResultSet.hpp"
-#include "TestStatement.hpp"
-#include "RequestWithResultSetParameters.hpp"
-#include "ResultSetMetaData.hpp"
-#include "Statement.hpp"
-
-using std::wstring;
-using std::endl;
-
-using namespace CarobNS;
-
-//EXECUTE QUERY
-void TestStatement::testExecuteQueryBadRequest()
-{
- wstring fctName(L"TestStatement::testExecuteQueryBadRequest");
- Statement* statementPtr = NULL;
- try
- {
- statementPtr = connectionPtr->createStatement();
- if (isInfoEnabled())
- {
- logInfo(fctName, L"Executing dummy read - should fail");
- }
- statementPtr->executeQuery(L"dummy request");
- // We should receive an exception instead of coming here
- CPPUNIT_ASSERT(false);
- }
- catch (ControllerException ce)
- {
- if (isErrorEnabled())
- {
- logError(fctName, L"Read failed (this is ok). Exception: "
- + ce.description());
- }
- }
-}
-
-void TestStatement::testExecuteQueryBadTable()
-{
- wstring fctName(L"testExecuteQueryBadTable");
- Statement* statementPtr = NULL;
- try
- {
- statementPtr = connectionPtr->createStatement();
- if (isInfoEnabled())
- {
- logInfo(fctName, L"Executing bad table read - should fail");
- }
- statementPtr->executeQuery(L"select * from dummy");
- // We should receive an exception instead of coming here
- CPPUNIT_ASSERT(false);
- }
- catch (BackendException be)
- {
- if (isErrorEnabled())
- {
- logError(fctName, L"Read failed (this is ok). Exception: "
- + be.description());
- }
- }
-}
-
-void TestStatement::testExecuteQueryGood()
-{
- wstring fctName(L"TestStatement::testExecuteQueryGood");
- Statement* statementPtr = NULL;
- statementPtr = connectionPtr->createStatement();
- if (isInfoEnabled())
- {
- logInfo(fctName, L"Executing read - should succeed");
- }
- statementPtr->setFetchSize(1);
- DriverResultSet* drsPtr = statementPtr->executeQuery(
- L"select * from address");
- if (isInfoEnabled())
- {
- logInfo(fctName, L"Read succeeded. Displaying 50 rows:");
- }
- //Display 50 rows using metadata and toString
- ResultSetMetaData rsmd(drsPtr);
- std::wostringstream buffer;
- for (int i=0; i<50; i++)
- {
- drsPtr->next();
- buffer<<i+1<<L"\t";
- for (int j=0; j<rsmd.getColumnCount(); j++)
- buffer<<drsPtr->getAsString(j+1)<<L"\t";
- buffer<<endl;
- }
- if (isInfoEnabled())
- logInfo(fctName, buffer.str());
-
-}
-
-
-//EXECUTE UPDATE
-
-void TestStatement::testExecuteUpdateBadRequest()
-{
- wstring fctName(L"TestStatement::testExecuteUpdateBadRequest");
- Statement* statementPtr = NULL;
- try
- {
- statementPtr = connectionPtr->createStatement();
- if (isInfoEnabled())
- {
- logInfo(fctName, L"Executing dummy update - should fail");
- }
- statementPtr->executeUpdate(L"dummy request");
- // We should receive an exception instead of coming here
- CPPUNIT_ASSERT(false);
- }
- catch (ControllerException ce)
- {
- if (isErrorEnabled())
- {
- logError(fctName, L"Update failed (this is ok). Exception: "
- + ce.description());
- }
- }
-}
-
-void TestStatement::testExecuteUpdateBadTable()
-{
- wstring fctName(L"testExecuteUpdateBadTable");
- Statement* statementPtr = NULL;
- try
- {
- statementPtr = connectionPtr->createStatement();
- if (isInfoEnabled())
- {
- logInfo(fctName, L"Executing bad table update - this should fail");
- }
- statementPtr->executeUpdate(L"update dummy set name='gotit' where id=0");
- // We should receive an exception instead of coming here
- CPPUNIT_ASSERT(false);
- }
- catch (BackendException be)
- {
- if (isErrorEnabled())
- {
- logError(fctName, L"Update failed (this is ok). Exception: "
- + be.description());
- }
- }
-}
-
-void TestStatement::testExecuteUpdateGood()
-{
- wstring fctName(L"TestStatement::testExecuteUpdateGood");
- Statement* statementPtr = NULL;
- statementPtr = connectionPtr->createStatement();
- if (isInfoEnabled())
- {
- logInfo(fctName, L"Executing update - should succeed");
- }
- int nbRowsAffected = statementPtr->executeUpdate(
- L"update product set name='changed by testExecuteUpdateGood' where
id=0");
- if (isInfoEnabled())
- {
- logInfo(fctName, L"Update succeeded. Number of affected rows = "
- + toWString(nbRowsAffected));
- }
- CPPUNIT_ASSERT(nbRowsAffected == 1);
-}
-
-void TestStatement::testExecuteQueryWithMaxRows()
-{
- wstring fctName(L"TestStatement::testExecuteQueryWithMaxRows");
- Statement* statementPtr = NULL;
- statementPtr = connectionPtr->createStatement();
- if (isInfoEnabled())
- {
- logInfo(fctName, L"Executing read with max rows = 1");
- }
- statementPtr->setMaxRows(1);
- DriverResultSet* drsPtr = statementPtr->executeQuery(
- L"select * from address");
- if (isInfoEnabled())
- {
- logInfo(fctName, L"executeQuery succeeded. Displaying first row.");
- }
- //wcerr<<L"Row\tId\tName\t\tCost"<<endl;
- std::wostringstream buffer;
- buffer<<L"Id\tFirstName\tLastName"<<endl;
- CPPUNIT_ASSERT(drsPtr->next() == true);
- buffer<<drsPtr->getInt32(1)
- <<L"\t"<<drsPtr->getString(2)
- <<L"\t\t"<<drsPtr->getString(3)<<endl;
- if (isInfoEnabled())
- {
- logInfo(fctName, buffer.str());
- }
- //This next() should return false because we asked just 1 row
- CPPUNIT_ASSERT(drsPtr->next() == false);
-}
-
-void TestStatement::testExecuteBadRequests()
-{
- wstring fctName(L"TestStatement::testExecuteBadRequests");
- Statement* statementPtr = NULL;
- if (isInfoEnabled())
- {
- logInfo(fctName, L"Testing execute with bad query \"dummy\" (should
fail)");
- }
- try
- {
- statementPtr = connectionPtr->createStatement();
- statementPtr->execute(L"dummy");
- // We should receive an exception instead of coming here
- CPPUNIT_ASSERT(false);
- }
- catch (BackendException be)
- {
- if (isErrorEnabled())
- {
- logError(fctName, L"Read failed (this is ok). Exception: "
- + be.description());
- }
- }
- if (isInfoEnabled())
- {
- logInfo(fctName, L"Testing execute with bad query \"SELECT * FROM dummy\"
(should fail)");
- }
- try
- {
- statementPtr->execute(L"SELECT * FROM dummy");
- // We should receive an exception instead of coming here
- CPPUNIT_ASSERT(false);
- }
- catch (BackendException be)
- {
- if (isErrorEnabled())
- {
- logError(fctName, L"Read failed (this is ok). Exception: "
- + be.description());
- }
- }
-}
-
-void TestStatement::testExecuteWithSelect()
-{
- wstring fctName(L"TestStatement::testExecuteWithSelect");
- Statement* statementPtr = NULL;
- statementPtr = connectionPtr->createStatement();
- if (isInfoEnabled())
- {
- logInfo(fctName, L"Executing execute(SELECT * FROM address) - should
succeed");
- }
- bool isRS = statementPtr->execute(L"SELECT * FROM address");
- CPPUNIT_ASSERT(isRS);
-
- DriverResultSet* drsPtr = statementPtr->getResultSet();
- if (isInfoEnabled())
- {
- logInfo(fctName, L"Read succeeded. Displaying 50 rows:");
- }
- //Display 50 rows using metadata and toString
- ResultSetMetaData rsmd(drsPtr);
- std::wostringstream buffer;
- for (int i=0; i<50; i++)
- {
- drsPtr->next();
- buffer<<i+1<<L"\t";
- for (int j=0; j<rsmd.getColumnCount(); j++)
- buffer<<drsPtr->getAsString(j+1)<<L"\t";
- buffer<<endl;
- }
- if (isInfoEnabled())
- {
- logInfo(fctName, buffer.str());
- }
-}
-void TestStatement::testExecuteWithUpdate()
-{
- wstring fctName(L"TestStatement::testExecuteWithUpdate");
- Statement* statementPtr = NULL;
- statementPtr = connectionPtr->createStatement();
- if (isInfoEnabled())
- {
- logInfo(fctName, L"Executing execute(UPDATE FROM address...) - should
succeed");
- }
- bool isRS = statementPtr->execute(L"UPDATE product SET name='changed by
testExecuteWithUpdate' WHERE id=0");
- CPPUNIT_ASSERT(!isRS);
- if (isInfoEnabled())
- {
- logInfo(fctName, L"Update with execute succeeded. Number of affected rows
= "
- + toWString(statementPtr->getUpdateCount()));
- }
- CPPUNIT_ASSERT(statementPtr->getUpdateCount() == 1);
-}
-
-void TestStatement::testExecuteWithSelectStreamed()
-{
- wstring fctName(L"TestStatement::testExecuteWithSelectStreamed");
- Statement* statementPtr = NULL;
- statementPtr = connectionPtr->createStatement();
- if (isInfoEnabled())
- {
- logInfo(fctName, L"Executing streamed execute(SELECT * FROM address) -
should succeed");
- }
- statementPtr->setFetchSize(1);
- bool isRS = statementPtr->execute(L"SELECT * FROM address");
- CPPUNIT_ASSERT(isRS);
-
- DriverResultSet* drsPtr = statementPtr->getResultSet();
- ResultSetMetaData rsmd(drsPtr);
- if (isInfoEnabled())
- {
- logInfo(fctName, L"Read succeeded. Displaying 50 rows:");
- }
- //Display rows using metadata and toString
- std::wostringstream buffer;
- while (drsPtr->next())
- {
- ResultSetMetaData rsmd(drsPtr);
- for (int j=0; j<rsmd.getColumnCount(); j++)
- buffer<<drsPtr->getAsString(j+1)<<L"\t";
- buffer<<endl;
- }
- if (isInfoEnabled())
- {
- logInfo(fctName, buffer.str());
- }
-}
-
-CppUnit::Test* TestStatement::suite()
-{
- CppUnit::TestSuite *suiteOfTests = new CppUnit::TestSuite( "TestStatement" );
- suiteOfTests->addTest(new CppUnit::TestCaller<TestStatement>(
- "testExecuteQueryBadRequest",
- &TestStatement::testExecuteQueryBadRequest));
- suiteOfTests->addTest(new CppUnit::TestCaller<TestStatement>(
- "testExecuteQueryBadTable",
- &TestStatement::testExecuteQueryBadTable));
- suiteOfTests->addTest(new CppUnit::TestCaller<TestStatement>(
- "testExecuteQueryGood",
- &TestStatement::testExecuteQueryGood));
- suiteOfTests->addTest(new CppUnit::TestCaller<TestStatement>(
- "testExecuteUpdateBadRequest",
- &TestStatement::testExecuteUpdateBadRequest));
- suiteOfTests->addTest(new CppUnit::TestCaller<TestStatement>(
- "testExecuteUpdateBadTable",
- &TestStatement::testExecuteUpdateBadTable));
- suiteOfTests->addTest(new CppUnit::TestCaller<TestStatement>(
- "testExecuteUpdateGood",
- &TestStatement::testExecuteUpdateGood));
- suiteOfTests->addTest(new CppUnit::TestCaller<TestStatement>(
- "testExecuteQueryWithMaxRows",
- &TestStatement::testExecuteQueryWithMaxRows));
- suiteOfTests->addTest(new CppUnit::TestCaller<TestStatement>(
- "testExecuteBadRequests",
- &TestStatement::testExecuteBadRequests));
- suiteOfTests->addTest(new CppUnit::TestCaller<TestStatement>(
- "testExecuteWithSelect",
- &TestStatement::testExecuteWithSelect));
- suiteOfTests->addTest(new CppUnit::TestCaller<TestStatement>(
- "testExecuteWithUpdate",
- &TestStatement::testExecuteWithUpdate));
- suiteOfTests->addTest(new CppUnit::TestCaller<TestStatement>(
- "testExecuteWithSelectStreamed",
-
&TestStatement::testExecuteWithSelectStreamed));
-
- return suiteOfTests;
-}
Index: carob/test/TestStatement.hpp
diff -u carob/test/TestStatement.hpp:1.6 carob/test/TestStatement.hpp:removed
--- carob/test/TestStatement.hpp:1.6 Fri Dec 16 17:41:08 2005
+++ carob/test/TestStatement.hpp Mon Feb 27 15:41:38 2006
@@ -1,96 +0,0 @@
-/*
- * Sequoia: Database clustering technology.
- * Copyright (C) 2005 Emic Networks
- * Contact: sequoia-NAAfj4rwCWAYtQj7fl1lsA@xxxxxxxxxxxxxxxx
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Initial developer(s): Gilles Rayrat
- * Contributor(s):
- */
-
-#ifndef TESTSTATEMENT_H_
-#define TESTSTATEMENT_H_
-
-#include "ConnectionSetup.hpp"
-
-/**
- * Test class for Statement class.
- * This is basically a copy of exec read and exec write commands testing
- * A controller *MUST* run locally for test success !!!
- */
-class TestStatement : public ConnectionSetup
-{
-public:
- /** Suite of tests to be run */
- static CppUnit::Test* suite();
-
- //EXECUTE QUERY
- /**
- * Tries to send a dummy read request via a Statement to the controller and
- * checks that the error is consistent.
- */
- void testExecuteQueryBadRequest();
- /**
- * Tries to do a good read request on a dummy table via a Statement and
- * checks that the error is consistent.
- */
- void testExecuteQueryBadTable();
- /**
- * Sends a valid select request to the controller via a Statement and checks
- * that there is no error. Also displays a part of the result for manual
- * checking.
- */
- void testExecuteQueryGood();
-
- //EXECUTE UPDATE
- /**
- * Tries to send a dummy write request to the controller via a Statement and
- * checks that the error is consistent.
- */
- void testExecuteUpdateBadRequest();
- /**
- * Tries to do a good write request on a dummy table via a Statement and
- * checks that the error is consistent.
- */
- void testExecuteUpdateBadTable();
- /**
- * Sends a valid update request to the controller via a Statement and checks
- * that there is no error.
- */
- void testExecuteUpdateGood();
- /**
- * Tests a read with max rows to 1 and checks that the second call to next()
- * returns false
- */
- void testExecuteQueryWithMaxRows();
- /**
- * Tests execute function with bad query of different forms (bad query, wrong
- * table)
- */
- void testExecuteBadRequests();
- /**
- * Tests execute function with a select statement
- */
- void testExecuteWithSelect();
- /**
- * Tests execute function with an update statement
- */
- void testExecuteWithUpdate();
- /**
- * Tests execute function with a select statement and max rows set to 1
- */
- void testExecuteWithSelectStreamed();
-};
-
-#endif /*TESTSTATEMENT_H_*/


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation

Home | advertise | OSDir is an inevitable website. super tiny logo