Date: Thursday, August 3, 2006 @ 11:00:54
Author: gilles
Path: /cvsroot/carob/carob/test/10-Connection
Removed: TestControllerConnectPolicy.cpp (1.4)
TestControllerConnectPolicy.hpp (1.3)
Removed remaining files from controller pool refactoring (forgot to remove the
tests)
---------------------------------+
TestControllerConnectPolicy.cpp | 159 --------------------------------------
TestControllerConnectPolicy.hpp | 70 ----------------
2 files changed, 229 deletions(-)
Index: carob/test/10-Connection/TestControllerConnectPolicy.cpp
diff -u carob/test/10-Connection/TestControllerConnectPolicy.cpp:1.4
carob/test/10-Connection/TestControllerConnectPolicy.cpp:removed
--- carob/test/10-Connection/TestControllerConnectPolicy.cpp:1.4 Wed Jun
21 18:43:21 2006
+++ carob/test/10-Connection/TestControllerConnectPolicy.cpp Thu Aug 3
11:00:54 2006
@@ -1,159 +0,0 @@
-/*
- * 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 "TestControllerConnectPolicy.hpp"
-
-// not to derive: just to get default parameters
-#include "../ConnectionSetup.hpp"
-
-#include "ControllerConnectPolicy.hpp"
-#include "Statement.hpp"
-#include "Connection.hpp"
-
-#include "Common.hpp"
-
-#include <string>
-#include <iostream>
-
-using std::wstring;
-
-using namespace CarobNS;
-
-void TestControllerConnectPolicy::setUp()
-{
-}
-
-void TestControllerConnectPolicy::tearDown()
-{
-}
-
-void TestControllerConnectPolicy::testRoundRobinSequence()
-{
- wstring fctName(L"TestControllerConnectPolicy::testSuspectListUpdate");
-
- ControllerInfo c1(ConnectionSetup::DEFAULT_HOST, 4000);
- ControllerInfo c2(ConnectionSetup::DEFAULT_HOST, 4001);
- ControllerInfo c3(ConnectionSetup::DEFAULT_HOST, 4002);
- ControllerInfo c4(ConnectionSetup::DEFAULT_HOST, 4003);
-
- std::vector<ControllerInfo> v;
- v.push_back(c1);
- v.push_back(c2);
- v.push_back(c3);
- v.push_back(c4);
-
- RoundRobinConnectPolicy cp(v);
- CPPUNIT_ASSERT(cp.getController() == c1);
- cp.suspectControllerOfFailure(c2);
- cp.suspectControllerOfFailure(c4);
- CPPUNIT_ASSERT(cp.getController() == c3);
- CPPUNIT_ASSERT(cp.getController() == c1);
- //clean up suspect list
- cp.removeControllerFromSuspectList(c2);
- cp.removeControllerFromSuspectList(c4);
-
-}
-
-void TestControllerConnectPolicy::testNoMoreController()
-{
- wstring fctName(L"TestControllerConnectPolicy::testNoMoreController");
-
- ControllerInfo c1(ConnectionSetup::DEFAULT_HOST, 4000);
- ControllerInfo c2(ConnectionSetup::DEFAULT_HOST, 4001);
- ControllerInfo c3(ConnectionSetup::DEFAULT_HOST, 4002);
- ControllerInfo c4(ConnectionSetup::DEFAULT_HOST, 4003);
-
- std::vector<ControllerInfo> v;
- v.push_back(c1);
- v.push_back(c2);
- v.push_back(c3);
- v.push_back(c4);
-
- RoundRobinConnectPolicy cp(v);
- cp.suspectControllerOfFailure(c1);
- cp.suspectControllerOfFailure(c2);
- cp.suspectControllerOfFailure(c3);
- cp.suspectControllerOfFailure(c4);
-
- try
- {
- if (isInfoEnabled())
- logInfo(fctName, L"Trying to get controller - should fail");
- cp.getController();
- CPPUNIT_ASSERT(false); //should have thrown an exception
- }
- catch (NoMoreControllerException nmce)
- {
- if (isErrorEnabled())
- logError(fctName, L"getController() failed (this is ok). Exception: "
- + nmce.description());
- }
- //clean up suspect list
- cp.removeControllerFromSuspectList(c1);
- cp.removeControllerFromSuspectList(c2);
- cp.removeControllerFromSuspectList(c3);
- cp.removeControllerFromSuspectList(c4);
-}
-
-
-void TestControllerConnectPolicy::testSuspectListUpdate()
-{
- wstring fctName(L"TestControllerConnectPolicy::testSuspectListUpdate");
- std::wcerr<<L"Launch 4 servers on localhost:4000-4003 and press
<return>"<<std::endl;
- std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
-
- ControllerInfo c1(ConnectionSetup::DEFAULT_HOST, 4000);
- ControllerInfo c2(ConnectionSetup::DEFAULT_HOST, 4001);
- ControllerInfo c3(ConnectionSetup::DEFAULT_HOST, 4002);
- ControllerInfo c4(ConnectionSetup::DEFAULT_HOST, 4003);
-
- std::vector<ControllerInfo> v;
- v.push_back(c1);
- v.push_back(c2);
- v.push_back(c3);
- v.push_back(c4);
-
- RoundRobinConnectPolicy cp(v);
- cp.suspectControllerOfFailure(c1);
- cp.suspectControllerOfFailure(c2);
- CPPUNIT_ASSERT(cp.getController() == c3);
- CPPUNIT_ASSERT(cp.getController() == c4);
- cp.updateSuspectList();
- CPPUNIT_ASSERT(cp.getController() == c1);
- CPPUNIT_ASSERT(cp.getController() == c2);
-}
-
-CppUnit::Test* TestControllerConnectPolicy::suite()
-{
- CppUnit::TestSuite *suiteOfTests = new CppUnit::TestSuite(
"TestControllerConnectPolicy" );
- suiteOfTests->addTest(new CppUnit::TestCaller<TestControllerConnectPolicy>(
-
"TestControllerConnectPolicy::testRoundRobinSequence",
-
&TestControllerConnectPolicy::testRoundRobinSequence));
- suiteOfTests->addTest(new CppUnit::TestCaller<TestControllerConnectPolicy>(
-
"TestControllerConnectPolicy::testNoMoreController",
-
&TestControllerConnectPolicy::testNoMoreController));
-//Test disabled, needs user interaction
-/* suiteOfTests->addTest(new CppUnit::TestCaller<TestControllerConnectPolicy>(
-
"TestControllerConnectPolicy::testSuspectListUpdate",
-
&TestControllerConnectPolicy::testSuspectListUpdate));
-*/
- return suiteOfTests;
-}
Index: carob/test/10-Connection/TestControllerConnectPolicy.hpp
diff -u carob/test/10-Connection/TestControllerConnectPolicy.hpp:1.3
carob/test/10-Connection/TestControllerConnectPolicy.hpp:removed
--- carob/test/10-Connection/TestControllerConnectPolicy.hpp:1.3 Thu Mar
23 17:10:04 2006
+++ carob/test/10-Connection/TestControllerConnectPolicy.hpp Thu Aug 3
11:00:54 2006
@@ -1,70 +0,0 @@
-/*
- * 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 TESTCONTROLLERCONNECTPOLICY_H_
-#define TESTCONTROLLERCONNECTPOLICY_H_
-
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/TestCase.h>
-#include <cppunit/TestSuite.h>
-#include <cppunit/TestCaller.h>
-
-#include "ControllerConnectPolicy.hpp"
-
-/**
- * Test class for controller connection policy
- * Tests suspected controller queuing and update
- * A controller *MUST* run locally for test success !!!
- */
-class TestControllerConnectPolicy : CppUnit::TestFixture
-{
-public:
- /** Suite of tests to be run */
- static CppUnit::Test* suite();
-
- /** Nothing to setup */
- void setUp();
- /** Nothing to tearDown */
- void tearDown();
- /**
- * Adds 2 out of 4 controllers to the list of suspects and checks that the
- * getController function returns the non suspect controller in the good
order
- */
- void testRoundRobinSequence();
- /**
- * Adds all controllers to the list of suspects and checks that an error is
- * thrown when asking for another controller (NoMoreControllerException)
- */
- void testNoMoreController();
- /**
- * USER INTERACTION NEEDED !
- * Adds valid controllers to the list of suspects and checks that they come
up
- * again. Note: this test needs 4 (basic) servers to run locally !!! (user
- * input is asked when servers are ready). These servers can be simulated by
- * Lenart Janos's socket utility ("socket -s <port>" command)
- * See http://packages.debian.org/stable/net/socket for more info
- */
- void testSuspectListUpdate();
-private:
-};
-
-#endif /*TESTCONTROLLERCONNECTPOLICY_H_*/
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits