Date: Monday, January 23, 2006 @ 17:17:59
Author: gilles
Path: /cvsroot/carob/carob
Added: test/10-Connection/TestConnect.cpp (1.1)
test/10-Connection/TestConnect.hpp (1.1)
Modified: include/Connection.hpp (1.50 -> 1.51) include/Request.hpp (1.13
-> 1.14) src/Connection.cpp (1.57 -> 1.58)
test/CarobTestLauncher.cpp (1.17 -> 1.18) test/README (1.2 ->
1.3)
Removed: test/TestConnect.cpp (1.12) test/TestConnect.hpp (1.7)
Updated to protocol version 38:
- Connection establishment now receives 2 acks, one for vdb, one for user/pass
- RetrieveExecute* now just provide the unique request id
- Added commented out reconnection code (reminder only)
- Modified and added connection tests to handle new ack behavior => moved
these tests to correct directory
------------------------------------+
include/Connection.hpp | 11 +
include/Request.hpp | 4
src/Connection.cpp | 70 +++++++---
test/10-Connection/TestConnect.cpp | 228 +++++++++++++++++++++++++++++++++++
test/10-Connection/TestConnect.hpp | 84 ++++++++++++
test/CarobTestLauncher.cpp | 4
test/README | 2
test/TestConnect.cpp | 165 -------------------------
test/TestConnect.hpp | 74 -----------
9 files changed, 376 insertions(+), 266 deletions(-)
Index: carob/include/Connection.hpp
diff -u carob/include/Connection.hpp:1.50 carob/include/Connection.hpp:1.51
--- carob/include/Connection.hpp:1.50 Fri Jan 13 12:51:47 2006
+++ carob/include/Connection.hpp Mon Jan 23 17:17:59 2006
@@ -33,7 +33,7 @@
#include "RequestWithResultSetParameters.hpp"
namespace {
-const int32_t ProtocolVersion = ((int32_t) 0/* major */ << 16) + 35/* minor */;
+const int32_t ProtocolVersion = ((int32_t) 0/* major */ << 16) + 38/* minor */;
}
namespace CarobNS {
@@ -53,6 +53,9 @@
#define RetrieveExecuteQueryResult 10
#define RetrieveExecuteUpdateResult 11
#define RetrieveExecuteResult 12
+//#define RetrieveExecuteUpdateWithKeysResult 13
+//#define RetrieveCommitResult 14
+//#define RetrieveRollbackResult 15
#define StatementExecute 6
#define Begin 20
#define Commit 21
@@ -322,12 +325,14 @@
* connection. [EMAIL PROTECTED] #initConnection(const
ConnectionParameters&)} must be
* called before this
* @return true upon successfull connection
+ * @throw ConnectionException if the virtual database is not available on the
+ * controller
* @throw AuthenticationException if the controller did not acknowledge or in
* case of i/o exception during finalization (premature close of
* connection)s
*/
- bool finalizeConnect() throw (AuthenticationException,
- UnexpectedException);
+ bool finalizeConnect() throw (ConnectionException,
+ AuthenticationException, UnexpectedException);
/**
* Closes a connection by sending appropriate commands to the controller.
Index: carob/include/Request.hpp
diff -u carob/include/Request.hpp:1.13 carob/include/Request.hpp:1.14
--- carob/include/Request.hpp:1.13 Wed Jan 4 11:53:51 2006
+++ carob/include/Request.hpp Mon Jan 23 17:17:59 2006
@@ -1,6 +1,6 @@
/*
* Sequoia: Database clustering technology.
- * Copyright (C) 2005 Emic Networks
+ * Copyright (C) 2005-2006 Continuent, Inc.
* Contact: [EMAIL PROTECTED]
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -108,7 +108,7 @@
* Returns the id value.
* @return the request identifier
*/
- int64_t getId() { return id; }
+ int64_t getId() const { return id; }
/**
* Sets the id value.
* @param idPrm to set
Index: carob/src/Connection.cpp
diff -u carob/src/Connection.cpp:1.57 carob/src/Connection.cpp:1.58
--- carob/src/Connection.cpp:1.57 Fri Jan 13 12:51:47 2006
+++ carob/src/Connection.cpp Mon Jan 23 17:17:59 2006
@@ -197,33 +197,40 @@
return true;
}
-bool Connection::finalizeConnect() throw (AuthenticationException,
+bool Connection::finalizeConnect() throw (ConnectionException,
AuthenticationException,
UnexpectedException)
{
wstring fctName(L"Connection::finalizeConnect");
- bool authenticated = false,
+ bool vdbFound = false,
+ vdbFoundRead = false,
+ authenticated = false,
authenticatedRead = false,
lineSeparatorSent = false,
persistentConnectionSent = false;
try
{
+ *driverSocketPtr >> vdbFound;
+ vdbFoundRead = true;
+ if (!vdbFound)
+ {
+ wstring vdbReason;
+ *driverSocketPtr >> vdbReason;
+ throw ConnectionException(L"Connection failed: "+vdbReason);
+ }
*driverSocketPtr >> authenticated;
authenticatedRead = true;
if (!authenticated)
{
- wstring reason;
- *driverSocketPtr >> reason;
- throw AuthenticationException(L"Authentication failed: "+reason);
- }
- else
- {
- // So the controller can correctly parse our requests
- *driverSocketPtr << LINE_SEPARATOR;
- lineSeparatorSent = true;
- *driverSocketPtr << persistent_connection;
- if (persistent_connection)
- *driverSocketPtr >> persistent_connection_id;
- }
+ wstring authReason;
+ *driverSocketPtr >> authReason;
+ throw AuthenticationException(L"Authentication failed: "+authReason);
+ }
+ // So the controller can correctly parse our requests
+ *driverSocketPtr << LINE_SEPARATOR;
+ lineSeparatorSent = true;
+ *driverSocketPtr << persistent_connection;
+ if (persistent_connection)
+ *driverSocketPtr >> persistent_connection_id;
}
catch (SocketIOException sockIOExcpt)
{
@@ -418,6 +425,31 @@
}
catch (SocketIOException e)
{
+ //TODO:
+ // Connection failed, try to reconnect and re-exec the commit
+ //try
+ //{
+ //reconnect();
+
+ //long acknowledgedTransactionId = retrieveCommitResult();
+ //if (acknowledgedTransactionId != transactionId)
+ //{
+ //throw new DriverSQLException(
+ //"Protocol error during commit rollback (acknowledge transaction
ID = "
+ //+ acknowledgedTransactionId + ", expected transaction ID = "
+ //+ transactionId + ")");
+ //}
+
+ // The controller will automatically redo the commit if it was not done
+ // earlier so we can safely return here, this is a success.
+ //return;
+ //}
+ //catch (DriverSQLException e1)
+ //{
+ // throw new DriverSQLException(
+ // "Connection lost during commit of transaction '" + transactionId
+ // + "' and automatic reconnect failed", e1);
+ //}
if (isWarningEnabled())
{
logWarning(fctName, L"I/O Error occured around commit of transaction '"
@@ -502,7 +534,7 @@
wstring fctName(L"Connection::PreparedStatementGetMetaData");
LockScope ls(&connectionCS);
-
+//TODO: try/catch/reconnect
sendCommand(*driverSocketPtr, PreparedStatementGetMetaData);
*driverSocketPtr << sqlTemplate;
@@ -849,7 +881,7 @@
ProtocolException, UnexpectedException)
{
sendCommand(*driverSocketPtr, RetrieveExecuteQueryResult);
- request.sendToStream(*driverSocketPtr);
+ *driverSocketPtr << request.getId();
return receiveResultSet();
}
@@ -858,7 +890,7 @@
ProtocolException, UnexpectedException)
{
sendCommand(*driverSocketPtr, RetrieveExecuteUpdateResult);
- request.sendToStream(*driverSocketPtr);
+ *driverSocketPtr << request.getId();
return (int)receiveIntOrException();
}
std::list<ResultSetOrUpdateCount> Connection::retrieveExecuteResult(const
Request &request)
@@ -866,7 +898,7 @@
ProtocolException, UnexpectedException)
{
sendCommand(*driverSocketPtr, RetrieveExecuteResult);
- request.sendToStream(*driverSocketPtr);
+ *driverSocketPtr << request.getId();
return fetchMultipleResultsFromStream();
}
Index: carob/test/10-Connection/TestConnect.cpp
diff -u /dev/null carob/test/10-Connection/TestConnect.cpp:1.1
--- /dev/null Mon Jan 23 17:17:59 2006
+++ carob/test/10-Connection/TestConnect.cpp Mon Jan 23 17:17:59 2006
@@ -0,0 +1,228 @@
+/*
+ * Sequoia: Database clustering technology.
+ * Copyright (C) 2005-2006 Continuent, Inc.
+ * Contact: [EMAIL PROTECTED]
+ *
+ * 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 "Connection.hpp"
+#include "Common.hpp"
+#include "ConnectionParameters.hpp"
+#include "CarobException.hpp"
+#include "TestConnect.hpp"
+
+using std::wstring;
+
+using namespace CarobNS;
+
+void TestConnect::setUp()
+{
+ connectionPtr = NULL;
+}
+
+void TestConnect::tearDown()
+{
+ if (connectionPtr)
+ delete connectionPtr;
+}
+
+void TestConnect::testConnectBadAddress()
+{
+ wstring fctName(L"TestConnect::testConnectBadAddress");
+ ConnectionParameters connectionPrms(L"dummyAddress",
+ 25322,
+ L"myDB",
+ L"user",
+ L"",
+ DEBUG_LEVEL_DEBUG);
+ try
+ {
+ if (isDebugEnabled())
+ {
+ logDebug(fctName, L"Connecting to controller - should fail");
+ }
+ connectionPtr = new Connection(connectionPrms);
+ // We should receive an exception instead of coming here
+ CPPUNIT_ASSERT(false);
+ }
+ catch (ConnectionException ce)
+ {
+ if (isErrorEnabled())
+ logError(fctName, L"Connection failed (this is ok). Exception: "
+ + ce.description());
+ CPPUNIT_ASSERT(true);
+ }
+}
+
+void TestConnect::testConnectBadPort()
+{
+ wstring fctName(L"TestConnect::testConnectBadPort");
+ ConnectionParameters connectionPrms(L"localhost",
+ 12345,
+ L"myDB",
+ L"user",
+ L"",
+ DEBUG_LEVEL_DEBUG);
+ try
+ {
+ if (isDebugEnabled())
+ {
+ logDebug(fctName, L"Connecting to controller - sould fail");
+ }
+ connectionPtr = new Connection(connectionPrms);
+ // We should receive an exception instead of coming here
+ CPPUNIT_ASSERT(false);
+ }
+ catch (ConnectionException ce)
+ {
+ if (isErrorEnabled())
+ logError(fctName, L"Connection failed (this is ok). Exception: "
+ + ce.description());
+ CPPUNIT_ASSERT(true);
+ }
+}
+void TestConnect::testConnectBadDB()
+{
+ wstring fctName(L"TestConnect::testConnectBadDB");
+ ConnectionParameters connectionPrms(L"localhost",
+ 25322,
+ L"dummyDB",
+ L"user",
+ L"",
+ DEBUG_LEVEL_DEBUG);
+ try
+ {
+ connectionPtr = new Connection(connectionPrms);
+ if (isDebugEnabled())
+ {
+ logDebug(fctName, L"Connecting to controller - sould fail");
+ }
+
+ // We should receive an exception instead of coming here
+ CPPUNIT_ASSERT(false);
+ }
+ catch (ConnectionException ce)
+ {
+ if (isErrorEnabled())
+ logError(fctName, L"Connection failed (this is ok). Exception: "
+ + ce.description());
+ CPPUNIT_ASSERT(true);
+ }
+}
+
+void TestConnect::testConnectBadUser()
+{
+ wstring fctName(L"TestConnect::testConnectBadUser");
+ ConnectionParameters connectionPrms(L"localhost",
+ 25322,
+ L"myDB",
+ L"dummyuser",
+ L"",
+ DEBUG_LEVEL_DEBUG);
+ try
+ {
+ connectionPtr = new Connection(connectionPrms);
+ if (isDebugEnabled())
+ {
+ logDebug(fctName, L"Connecting to controller - sould fail");
+ }
+
+ // We should receive an exception instead of coming here
+ CPPUNIT_ASSERT(false);
+ }
+ catch (AuthenticationException ae)
+ {
+ if (isErrorEnabled())
+ logError(fctName, L"Connection failed (this is ok). Exception: "
+ + ae.description());
+ CPPUNIT_ASSERT(true);
+ }
+}
+
+void TestConnect::testConnectBadPass()
+{
+ wstring fctName(L"TestConnect::testConnectBadPass");
+ ConnectionParameters connectionPrms(L"localhost",
+ 25322,
+ L"myDB",
+ L"user",
+ L"dummyPass",
+ DEBUG_LEVEL_DEBUG);
+ try
+ {
+ connectionPtr = new Connection(connectionPrms);
+ if (isDebugEnabled())
+ {
+ logDebug(fctName, L"Connecting to controller - sould fail");
+ }
+
+ // We should receive an exception instead of coming here
+ CPPUNIT_ASSERT(false);
+ }
+ catch (AuthenticationException ae)
+ {
+ if (isErrorEnabled())
+ logError(fctName, L"Connection failed (this is ok). Exception: "
+ + ae.description());
+ CPPUNIT_ASSERT(true);
+ }
+}
+
+void TestConnect::testConnectGood()
+{
+ wstring fctName(L"TestConnect::testConnectGood");
+ ConnectionParameters connectionPrms(L"localhost",
+ 25322,
+ L"myDB",
+ L"user",
+ L"",
+ DEBUG_LEVEL_DEBUG);
+ if (isDebugEnabled())
+ {
+ logDebug(fctName, L"Connecting to controller - this should succeed");
+ }
+ connectionPtr = new Connection(connectionPrms);
+ if (isDebugEnabled())
+ {
+ logDebug(fctName, L"Connection succeeded");
+ }
+}
+
+CppUnit::Test* TestConnect::suite()
+{
+ CppUnit::TestSuite *suiteOfTests = new CppUnit::TestSuite( "TestConnect" );
+ suiteOfTests->addTest(new CppUnit::TestCaller<TestConnect>(
+ "TestConnect::testConnectBadAddress",
+ &TestConnect::testConnectBadAddress));
+ suiteOfTests->addTest(new CppUnit::TestCaller<TestConnect>(
+ "TestConnect::testConnectBadPort",
+ &TestConnect::testConnectBadPort));
+ suiteOfTests->addTest(new CppUnit::TestCaller<TestConnect>(
+ "TestConnect::testConnectBadDB",
+ &TestConnect::testConnectBadDB));
+ suiteOfTests->addTest(new CppUnit::TestCaller<TestConnect>(
+ "TestConnect::testConnectBadUser",
+ &TestConnect::testConnectBadUser));
+ suiteOfTests->addTest(new CppUnit::TestCaller<TestConnect>(
+ "TestConnect::testConnectBadPass",
+ &TestConnect::testConnectBadPass));
+ suiteOfTests->addTest(new CppUnit::TestCaller<TestConnect>(
+ "Connects to a running controller",
+ &TestConnect::testConnectGood));
+
+ return suiteOfTests;
+}
Index: carob/test/10-Connection/TestConnect.hpp
diff -u /dev/null carob/test/10-Connection/TestConnect.hpp:1.1
--- /dev/null Mon Jan 23 17:17:59 2006
+++ carob/test/10-Connection/TestConnect.hpp Mon Jan 23 17:17:59 2006
@@ -0,0 +1,84 @@
+/*
+ * Sequoia: Database clustering technology.
+ * Copyright (C) 2005-2006 Continuent, Inc.
+ * Contact: [EMAIL PROTECTED]
+ *
+ * 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 TESTCONNECT_H_
+#define TESTCONNECT_H_
+
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/TestCase.h>
+#include <cppunit/TestSuite.h>
+#include <cppunit/TestCaller.h>
+
+#include "Connection.hpp"
+
+/**
+ * Test class for connection establishement.
+ * Tests connection establishment to bad address, bad port and finally to a
+ * running controller.
+ * A controller *MUST* run locally for test success !!!
+ */
+class TestConnect : CppUnit::TestFixture
+{
+public:
+ /** Suite of tests to be run */
+ static CppUnit::Test* suite();
+
+ /** Nothing to setup */
+ void setUp();
+ /** Destroys connection pointer if applicable */
+ void tearDown();
+ /**
+ * Tries to connect to a dummy controller address and checks that there is a
+ * failure.
+ */
+ void testConnectBadAddress();
+ /**
+ * Tries to connect to a controller on a dummy port and checks that there is
+ * a failure.
+ */
+ void testConnectBadPort();
+ /**
+ * Tries to connect to a controller on a dummy DB and checks that there is
+ * a failure.
+ */
+ void testConnectBadDB();
+ /**
+ * Tries to connect to a controller with a dummy username and checks that the
+ * correct exception is thrown.
+ */
+ void testConnectBadUser();
+ /**
+ * Tries to connect to a controller with a dummy password and checks that the
+ * correct exception is thrown.
+ */
+ void testConnectBadPass();
+ /**
+ * Connects to a controller on a local machine (that must be running !) with
+ * the default port and checks everything went good.
+ */
+ void testConnectGood();
+
+private:
+ CarobNS::Connection* connectionPtr;
+};
+
+#endif /*TESTCONNECT_H_*/
Index: carob/test/CarobTestLauncher.cpp
diff -u carob/test/CarobTestLauncher.cpp:1.17
carob/test/CarobTestLauncher.cpp:1.18
--- carob/test/CarobTestLauncher.cpp:1.17 Fri Jan 20 23:44:50 2006
+++ carob/test/CarobTestLauncher.cpp Mon Jan 23 17:17:59 2006
@@ -1,6 +1,6 @@
/*
* Sequoia: Database clustering technology.
- * Copyright (C) 2005 Emic Networks
+ * Copyright (C) 2005-2006 Continuent, Inc.
* Contact: [EMAIL PROTECTED]
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -31,12 +31,12 @@
#include "CarobProtector.hpp"
#include "TestBeginCommitRollback.hpp"
-#include "TestConnect.hpp"
#include "TestDriverResultSet.hpp"
#include "TestExecReadRequest.hpp"
#include "TestExecWriteRequest.hpp"
#include "TestStatement.hpp"
#include "01-Unit/TestStringCodecs.hpp"
+#include "10-Connection/TestConnect.hpp"
#include "30-ResultSet/TestSimpleUnicode.hpp"
#include "40-Parameter-PreparedStatement/TestParameterStatement.hpp"
#include "40-Parameter-PreparedStatement/TestPreparedStatement.hpp"
Index: carob/test/README
diff -u carob/test/README:1.2 carob/test/README:1.3
--- carob/test/README:1.2 Mon Jan 23 15:13:09 2006
+++ carob/test/README Mon Jan 23 17:17:59 2006
@@ -2,7 +2,7 @@
<root>
Code shared by all tests, abstract classes, etc.
-(TestOnValidConnection, CarobTestLauncher)
+(ConnectionSetup, CarobTestLauncher)
01-Unit
No controller needed. This one is special: put here all real _unit_
Index: carob/test/TestConnect.cpp
diff -u carob/test/TestConnect.cpp:1.12 carob/test/TestConnect.cpp:removed
--- carob/test/TestConnect.cpp:1.12 Mon Jan 2 17:19:52 2006
+++ carob/test/TestConnect.cpp Mon Jan 23 17:17:59 2006
@@ -1,165 +0,0 @@
-/*
- * Sequoia: Database clustering technology.
- * Copyright (C) 2005 Emic Networks
- * Contact: [EMAIL PROTECTED]
- *
- * 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 "Connection.hpp"
-#include "Common.hpp"
-#include "ConnectionParameters.hpp"
-#include "CarobException.hpp"
-#include "TestConnect.hpp"
-
-using std::wstring;
-
-using namespace CarobNS;
-
-void TestConnect::setUp()
-{
- connectionPtr = NULL;
-}
-
-void TestConnect::tearDown()
-{
- if (connectionPtr)
- delete connectionPtr;
-}
-
-void TestConnect::testConnectBadAddress()
-{
- wstring fctName(L"TestConnect::testConnectBadAddress");
- ConnectionParameters connectionPrms(L"dummyAddress",
- 25322,
- L"myDB",
- L"user",
- L"",
- DEBUG_LEVEL_DEBUG);
- try
- {
- if (isDebugEnabled())
- {
- logDebug(fctName, L"Connecting to controller - should fail");
- }
- connectionPtr = new Connection(connectionPrms);
- // We should receive an exception instead of coming here
- CPPUNIT_ASSERT(false);
- }
- catch (ConnectionException ce)
- {
- if (isErrorEnabled())
- logError(fctName, L"Connection failed (this is ok). Exception: "
- + ce.description());
- CPPUNIT_ASSERT(true);
- }
-}
-
-void TestConnect::testConnectBadPort()
-{
- wstring fctName(L"TestConnect::testConnectBadPort");
- ConnectionParameters connectionPrms(L"localhost",
- 12345,
- L"myDB",
- L"user",
- L"",
- DEBUG_LEVEL_DEBUG);
- try
- {
- if (isDebugEnabled())
- {
- logDebug(fctName, L"Connecting to controller - sould fail");
- }
- connectionPtr = new Connection(connectionPrms);
- // We should receive an exception instead of coming here
- CPPUNIT_ASSERT(false);
- }
- catch (ConnectionException ce)
- {
- if (isErrorEnabled())
- logError(fctName, L"Connection failed (this is ok). Exception: "
- + ce.description());
- CPPUNIT_ASSERT(true);
- }
-}
-void TestConnect::testConnectBadDB()
-{
- wstring fctName(L"TestConnect::testConnectBadDB");
- ConnectionParameters connectionPrms(L"localhost",
- 25322,
- L"dummyDB",
- L"user",
- L"",
- DEBUG_LEVEL_DEBUG);
- try
- {
- connectionPtr = new Connection(connectionPrms);
- if (isDebugEnabled())
- {
- logDebug(fctName, L"Connecting to controller - sould fail");
- }
-
- // We should receive an exception instead of coming here
- CPPUNIT_ASSERT(false);
- }
- catch (AuthenticationException ae)
- {
- if (isErrorEnabled())
- logError(fctName, L"Connection failed (this is ok). Exception: "
- + ae.description());
- CPPUNIT_ASSERT(true);
- }
-}
-
-void TestConnect::testConnectGood()
-{
- wstring fctName(L"TestConnect::testConnectGood");
- ConnectionParameters connectionPrms(L"localhost",
- 25322,
- L"myDB",
- L"user",
- L"",
- DEBUG_LEVEL_DEBUG);
- if (isDebugEnabled())
- {
- logDebug(fctName, L"Connecting to controller - this should succeed");
- }
- connectionPtr = new Connection(connectionPrms);
- if (isDebugEnabled())
- {
- logDebug(fctName, L"Connection succeeded");
- }
-}
-
-CppUnit::Test* TestConnect::suite()
-{
- CppUnit::TestSuite *suiteOfTests = new CppUnit::TestSuite( "TestConnect" );
- suiteOfTests->addTest(new CppUnit::TestCaller<TestConnect>(
- "Connects to a bad address",
- &TestConnect::testConnectBadAddress));
- suiteOfTests->addTest(new CppUnit::TestCaller<TestConnect>(
- "Connects to a correct address with bad
port",
- &TestConnect::testConnectBadPort));
-
- suiteOfTests->addTest(new CppUnit::TestCaller<TestConnect>(
- "Connects to a bad db",
- &TestConnect::testConnectBadDB));
- suiteOfTests->addTest(new CppUnit::TestCaller<TestConnect>(
- "Connects to a running controller",
- &TestConnect::testConnectGood));
-
- return suiteOfTests;
-}
Index: carob/test/TestConnect.hpp
diff -u carob/test/TestConnect.hpp:1.7 carob/test/TestConnect.hpp:removed
--- carob/test/TestConnect.hpp:1.7 Wed Dec 28 18:14:57 2005
+++ carob/test/TestConnect.hpp Mon Jan 23 17:17:59 2006
@@ -1,74 +0,0 @@
-/*
- * Sequoia: Database clustering technology.
- * Copyright (C) 2005 Emic Networks
- * Contact: [EMAIL PROTECTED]
- *
- * 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 TESTCONNECT_H_
-#define TESTCONNECT_H_
-
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/TestCase.h>
-#include <cppunit/TestSuite.h>
-#include <cppunit/TestCaller.h>
-
-#include "Connection.hpp"
-
-/**
- * Test class for connection establishement.
- * Tests connection establishment to bad address, bad port and finally to a
- * running controller.
- * A controller *MUST* run locally for test success !!!
- */
-class TestConnect : CppUnit::TestFixture
-{
-public:
- /** Suite of tests to be run */
- static CppUnit::Test* suite();
-
- /** Nothing to setup */
- void setUp();
- /** Destroys connection pointer if applicable */
- void tearDown();
- /**
- * Tries to connect to a dummy controller address and checks that there is a
- * failure.
- */
- void testConnectBadAddress();
- /**
- * Tries to connect to a controller on a dummy port and checks that there is
- * a failure.
- */
- void testConnectBadPort();
- /**
- * Tries to connect to a controller on a dummy DB and checks that there is
- * a failure.
- */
- void testConnectBadDB();
- /**
- * Connects to a controller on a local machine (that must be running !) with
- * the default port and checks everything went good.
- */
- void testConnectGood();
-
-private:
- CarobNS::Connection* connectionPtr;
-};
-
-#endif /*TESTCONNECT_H_*/
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits