diff options
author | Mark Spruiell <mes@zeroc.com> | 2008-06-03 19:32:20 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2008-06-03 19:32:20 -0700 |
commit | 3d649bed4328992f41f567136025f58a019a5159 (patch) | |
tree | 470be901fbbfe5c6cd4269884412b0d36b48dc92 /cppe/test | |
parent | local interface fixes for slice2javae (diff) | |
download | ice-3d649bed4328992f41f567136025f58a019a5159.tar.bz2 ice-3d649bed4328992f41f567136025f58a019a5159.tar.xz ice-3d649bed4328992f41f567136025f58a019a5159.zip |
Various Ice-E fixes:
- Bug fix in slice2javae for local interfaces/classes
- Added Ice.LocalObjectHolder
- Reviewed Java/C++ demos and aligned with Ice
- Source code clean up (removed tabs, etc.)
Diffstat (limited to 'cppe/test')
73 files changed, 2670 insertions, 2670 deletions
diff --git a/cppe/test/Common/TestCommon.cpp b/cppe/test/Common/TestCommon.cpp index c3988919070..1986f42b3d6 100644 --- a/cppe/test/Common/TestCommon.cpp +++ b/cppe/test/Common/TestCommon.cpp @@ -29,53 +29,53 @@ public: virtual void print(const string& message) { - IceUtil::StaticMutex::Lock sync(globalMutex); - tprintf("%s\n", message.c_str()); + IceUtil::StaticMutex::Lock sync(globalMutex); + tprintf("%s\n", message.c_str()); } virtual void trace(const string& category, const string& message) { - IceUtil::StaticMutex::Lock sync(globalMutex); - string s = "[ "; - { - char buf[1024]; + IceUtil::StaticMutex::Lock sync(globalMutex); + string s = "[ "; + { + char buf[1024]; #ifdef _WIN32 - sprintf(buf, "%ld", GetTickCount()); + sprintf(buf, "%ld", GetTickCount()); #else - sprintf(buf, "%lu", (long)IceUtil::Time::now().toMilliSeconds()); + sprintf(buf, "%lu", (long)IceUtil::Time::now().toMilliSeconds()); #endif - s += buf; - } - s += ' '; - - if(!category.empty()) - { - s += category + ": "; - } - s += message + " ]"; - - string::size_type idx = 0; - while((idx = s.find("\n", idx)) != string::npos) - { - s.insert(idx + 1, " "); - ++idx; - } - tprintf("%s\n", s.c_str()); + s += buf; + } + s += ' '; + + if(!category.empty()) + { + s += category + ": "; + } + s += message + " ]"; + + string::size_type idx = 0; + while((idx = s.find("\n", idx)) != string::npos) + { + s.insert(idx + 1, " "); + ++idx; + } + tprintf("%s\n", s.c_str()); } virtual void warning(const string& message) { - IceUtil::StaticMutex::Lock sync(globalMutex); - tprintf("warning: %s\n", message.c_str()); + IceUtil::StaticMutex::Lock sync(globalMutex); + tprintf("warning: %s\n", message.c_str()); } virtual void error(const string& message) { - IceUtil::StaticMutex::Lock sync(globalMutex); - tprintf("error: %s\n", message.c_str()); + IceUtil::StaticMutex::Lock sync(globalMutex); + tprintf("error: %s\n", message.c_str()); } }; @@ -86,7 +86,7 @@ static bool appTerminated= false; const TCHAR windowClassName[] = L"Test Driver"; -#define IDC_MAIN_EDIT 101 +#define IDC_MAIN_EDIT 101 class TestSuiteFailed { @@ -110,9 +110,9 @@ tprintf(const char* fmt, ...) if(_tprintfp) { - fwrite(buf, strlen(buf), 1, _tprintfp); - fflush(_tprintfp); - return; + fwrite(buf, strlen(buf), 1, _tprintfp); + fflush(_tprintfp); + return; } char* start = buf; @@ -120,49 +120,49 @@ tprintf(const char* fmt, ...) char* curr = start; while(curr < end) { - bool nl = false; - while(curr < end && *curr != '\n') - { - // Not designed to handle \r - assert(*curr != '\r'); - ++curr; - } - if(*curr == '\n') - { - nl = true; - } - *curr = '\0'; - static TCHAR nlStr[] = L"\r\n"; - - // - // If the thread is not the main thread we have to post a message - // to the main thread to do the EM_REPLACESEL. Calling SendMessage - // from a thread other than main is not permitted. - // - if(IceUtil::ThreadControl() != mainThread) - { - wchar_t* wtext = new wchar_t[sizeof(wchar_t) * (curr - start)+1]; - mbstowcs(wtext, start, (curr - start) + 1); - ::PostMessage(mainWnd, WM_USER, (WPARAM)FALSE, (LPARAM)wtext); - if(nl) - { - wchar_t* wtext = new wchar_t[sizeof(nlStr)]; - wcscpy(wtext, nlStr); - ::PostMessage(mainWnd, WM_USER, (WPARAM)FALSE, (LPARAM)wtext); - } - } - else - { - TCHAR wtext[1024]; - mbstowcs(wtext, start, (curr - start) + 1); - ::SendMessage(hEdit, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)wtext); - if(nl) - { - ::SendMessage(hEdit, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)nlStr); - } - } - ++curr; - start = curr; + bool nl = false; + while(curr < end && *curr != '\n') + { + // Not designed to handle \r + assert(*curr != '\r'); + ++curr; + } + if(*curr == '\n') + { + nl = true; + } + *curr = '\0'; + static TCHAR nlStr[] = L"\r\n"; + + // + // If the thread is not the main thread we have to post a message + // to the main thread to do the EM_REPLACESEL. Calling SendMessage + // from a thread other than main is not permitted. + // + if(IceUtil::ThreadControl() != mainThread) + { + wchar_t* wtext = new wchar_t[sizeof(wchar_t) * (curr - start)+1]; + mbstowcs(wtext, start, (curr - start) + 1); + ::PostMessage(mainWnd, WM_USER, (WPARAM)FALSE, (LPARAM)wtext); + if(nl) + { + wchar_t* wtext = new wchar_t[sizeof(nlStr)]; + wcscpy(wtext, nlStr); + ::PostMessage(mainWnd, WM_USER, (WPARAM)FALSE, (LPARAM)wtext); + } + } + else + { + TCHAR wtext[1024]; + mbstowcs(wtext, start, (curr - start) + 1); + ::SendMessage(hEdit, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)wtext); + if(nl) + { + ::SendMessage(hEdit, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)nlStr); + } + } + ++curr; + start = curr; } // @@ -170,12 +170,12 @@ tprintf(const char* fmt, ...) // if(IceUtil::ThreadControl() == mainThread) { - MSG Msg; - while(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE)) - { - TranslateMessage(&Msg); - DispatchMessage(&Msg); - } + MSG Msg; + while(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE)) + { + TranslateMessage(&Msg); + DispatchMessage(&Msg); + } } } @@ -186,50 +186,50 @@ WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { case WM_USER: { - // tprint from a thread other than main. lParam holds a pointer to the text. - ::SendMessage(hEdit, EM_REPLACESEL, (WPARAM)wParam, (LPARAM)lParam); - wchar_t* text = (wchar_t*)lParam; - delete[] text; + // tprint from a thread other than main. lParam holds a pointer to the text. + ::SendMessage(hEdit, EM_REPLACESEL, (WPARAM)wParam, (LPARAM)lParam); + wchar_t* text = (wchar_t*)lParam; + delete[] text; } break; case WM_CREATE: { - RECT rcClient; - GetClientRect(hWnd, &rcClient); - hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, L"EDIT", L"", - WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE, - 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, - hWnd, (HMENU)IDC_MAIN_EDIT, GetModuleHandle(NULL), NULL); - assert(hEdit != NULL); + RECT rcClient; + GetClientRect(hWnd, &rcClient); + hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, L"EDIT", L"", + WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE, + 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, + hWnd, (HMENU)IDC_MAIN_EDIT, GetModuleHandle(NULL), NULL); + assert(hEdit != NULL); } break; case WM_SIZE: { - RECT rcClient; - GetClientRect(hWnd, &rcClient); - SetWindowPos(hEdit, NULL, 0, 0, rcClient.right, rcClient.bottom, SWP_NOZORDER); + RECT rcClient; + GetClientRect(hWnd, &rcClient); + SetWindowPos(hEdit, NULL, 0, 0, rcClient.right, rcClient.bottom, SWP_NOZORDER); } break; case WM_CLOSE: { - DestroyWindow(hWnd); - break; + DestroyWindow(hWnd); + break; } case WM_QUIT: case WM_DESTROY: { - PostQuitMessage(0); - IceUtil::StaticMutex::Lock sync(terminatedMutex); - appTerminated = true; - break; + PostQuitMessage(0); + IceUtil::StaticMutex::Lock sync(terminatedMutex); + appTerminated = true; + break; } default: - return DefWindowProc(hWnd, msg, wParam, lParam); + return DefWindowProc(hWnd, msg, wParam, lParam); } return 0; } @@ -239,33 +239,33 @@ TestApplication::main(HINSTANCE hInstance) { WNDCLASS wc; - wc.style = CS_HREDRAW|CS_VREDRAW; - wc.lpfnWndProc = (WNDPROC)WndProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = hInstance; - wc.hIcon = LoadIcon(NULL, 0); - wc.hCursor = 0; - wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); + wc.style = CS_HREDRAW|CS_VREDRAW; + wc.lpfnWndProc = (WNDPROC)WndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon(NULL, 0); + wc.hCursor = 0; + wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = windowClassName; if(!RegisterClass(&wc)) { - MessageBox(NULL, L"Window Registration Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK); - return 0; + MessageBox(NULL, L"Window Registration Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK); + return 0; } wchar_t wName[1024] = L"Test"; if(_name.size() > 0) { - int len = _name.size(); - if(len > 1023) - { - len = 1023; - } + int len = _name.size(); + if(len > 1023) + { + len = 1023; + } mbstowcs(wName, _name.c_str(), len); - wName[len] = L'\0'; + wName[len] = L'\0'; } RECT rect; @@ -273,20 +273,20 @@ TestApplication::main(HINSTANCE hInstance) int width = rect.right - rect.left; if(width > 320) { - width = 320; + width = 320; } int height = rect.bottom - rect.top; if(height > 200) { - height = 200; + height = 200; } mainWnd = CreateWindow(windowClassName, wName, WS_VISIBLE|WS_OVERLAPPED|WS_SYSMENU|WS_SIZEBOX, - CW_USEDEFAULT, CW_USEDEFAULT, width, height, - NULL, NULL, hInstance, NULL); + CW_USEDEFAULT, CW_USEDEFAULT, width, height, + NULL, NULL, hInstance, NULL); if(mainWnd == NULL) { - MessageBox(NULL, L"Window Creation Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK); - return 0; + MessageBox(NULL, L"Window Creation Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK); + return 0; } ShowWindow(mainWnd, SW_SHOW); @@ -295,59 +295,59 @@ TestApplication::main(HINSTANCE hInstance) try { - extern int __argc; - extern char **__argv; - status = run(__argc, __argv); + extern int __argc; + extern char **__argv; + status = run(__argc, __argv); } catch(const TestSuiteFailed&) { - tprintf("test failed\n"); + tprintf("test failed\n"); } catch(const Exception& ex) { - tprintf("%s\n", ex.toString().c_str()); - status = EXIT_FAILURE; + tprintf("%s\n", ex.toString().c_str()); + status = EXIT_FAILURE; } catch(const std::exception& ex) { - tprintf("std::exception: %s\n", ex.what()); - status = EXIT_FAILURE; + tprintf("std::exception: %s\n", ex.what()); + status = EXIT_FAILURE; } catch(const string& msg) { - tprintf("std::string: %s\n", msg.c_str()); - status = EXIT_FAILURE; + tprintf("std::string: %s\n", msg.c_str()); + status = EXIT_FAILURE; } catch(const char* msg) { - tprintf("const char*: %s\n", msg); - status = EXIT_FAILURE; + tprintf("const char*: %s\n", msg); + status = EXIT_FAILURE; } catch(...) { - tprintf("unknown exception\n"); - status = EXIT_FAILURE; + tprintf("unknown exception\n"); + status = EXIT_FAILURE; } MSG Msg; while(GetMessage(&Msg, NULL, 0, 0) > 0) { - TranslateMessage(&Msg); - DispatchMessage(&Msg); + TranslateMessage(&Msg); + DispatchMessage(&Msg); } if(_communicator) { - try - { - _communicator->destroy(); - } - catch(const Exception& ex) - { - tprintf("communicator::destroy() failed: %s\n", ex.toString().c_str()); - status = EXIT_FAILURE; - } - _communicator = 0; + try + { + _communicator->destroy(); + } + catch(const Exception& ex) + { + tprintf("communicator::destroy() failed: %s\n", ex.toString().c_str()); + status = EXIT_FAILURE; + } + _communicator = 0; } return status; @@ -366,18 +366,18 @@ TestApplication::loadConfig(const PropertiesPtr& properties) HANDLE h = FindFirstFile(L"config", &data); if(h == INVALID_HANDLE_VALUE) { - config = "config.txt"; - HANDLE h = FindFirstFile(L"config.txt", &data); - if(h == INVALID_HANDLE_VALUE) - { - return; - } + config = "config.txt"; + HANDLE h = FindFirstFile(L"config.txt", &data); + if(h == INVALID_HANDLE_VALUE) + { + return; + } } FindClose(h); try { - properties->load(config); + properties->load(config); } catch(const FileException&) { @@ -407,45 +407,45 @@ TestApplication::main(int ac, char* av[]) int status; try { - status = run(ac, av); + status = run(ac, av); } catch(const Exception& ex) { - tprintf("%s\n", ex.toString().c_str()); - status = EXIT_FAILURE; + tprintf("%s\n", ex.toString().c_str()); + status = EXIT_FAILURE; } catch(const std::exception& ex) { - tprintf("std::exception: %s\n", ex.what()); - status = EXIT_FAILURE; + tprintf("std::exception: %s\n", ex.what()); + status = EXIT_FAILURE; } catch(const string& msg) { - tprintf("std::string: %s\n", msg.c_str()); - status = EXIT_FAILURE; + tprintf("std::string: %s\n", msg.c_str()); + status = EXIT_FAILURE; } catch(const char* msg) { - tprintf("const char*: %s\n", msg); - status = EXIT_FAILURE; + tprintf("const char*: %s\n", msg); + status = EXIT_FAILURE; } catch(...) { - tprintf("unknown exception\n"); - status = EXIT_FAILURE; + tprintf("unknown exception\n"); + status = EXIT_FAILURE; } if(_communicator) { - try - { - _communicator->destroy(); - } - catch(const Exception& ex) - { - tprintf("communicator::destroy() failed: %s\n", ex.toString().c_str()); - status = EXIT_FAILURE; - } - _communicator = 0; + try + { + _communicator->destroy(); + } + catch(const Exception& ex) + { + tprintf("communicator::destroy() failed: %s\n", ex.toString().c_str()); + status = EXIT_FAILURE; + } + _communicator = 0; } return status; @@ -456,17 +456,17 @@ TestApplication::loadConfig(const PropertiesPtr& properties) { try { - properties->load("config"); + properties->load("config"); } catch(const FileException&) { - try - { - properties->load("config.txt"); - } - catch(const FileException&) - { - } + try + { + properties->load("config.txt"); + } + catch(const FileException&) + { + } } } @@ -490,7 +490,7 @@ TestApplication::setCommunicator(const CommunicatorPtr& communicator) #ifdef _WIN32_WCE if(communicator->getProperties()->getPropertyWithDefault("LogToFile", "0") != "0") { - _tprintfp = fopen(("log-" + _name + ".txt").c_str(), "w"); + _tprintfp = fopen(("log-" + _name + ".txt").c_str(), "w"); } #endif diff --git a/cppe/test/IceE/adapterDeactivation/AllTests.cpp b/cppe/test/IceE/adapterDeactivation/AllTests.cpp index 6a79adc8808..757d6a8b4f9 100644 --- a/cppe/test/IceE/adapterDeactivation/AllTests.cpp +++ b/cppe/test/IceE/adapterDeactivation/AllTests.cpp @@ -37,7 +37,7 @@ allTests(const CommunicatorPtr& communicator) try { communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9998"); - test(false); + test(false); } catch(const AlreadyRegisteredException&) { @@ -59,12 +59,12 @@ allTests(const CommunicatorPtr& communicator) printf("testing whether server is gone..."); try { - obj->ice_ping(); - test(false); + obj->ice_ping(); + test(false); } catch(const LocalException&) { - printf("ok\n"); + printf("ok\n"); } return obj; diff --git a/cppe/test/IceE/adapterDeactivation/Client.cpp b/cppe/test/IceE/adapterDeactivation/Client.cpp index 26ac34eb9ea..d9fe3d3a7bd 100644 --- a/cppe/test/IceE/adapterDeactivation/Client.cpp +++ b/cppe/test/IceE/adapterDeactivation/Client.cpp @@ -27,10 +27,10 @@ public: virtual int run(int argc, char* argv[]) { - Ice::InitializationData initData; + Ice::InitializationData initData; initData.properties = Ice::createProperties(); - loadConfig(initData.properties); - initData.logger = getLogger(); + loadConfig(initData.properties); + initData.logger = getLogger(); setCommunicator(Ice::initialize(argc, argv, initData)); TestIntfPrx allTests(const CommunicatorPtr&); diff --git a/cppe/test/IceE/adapterDeactivation/Collocated.cpp b/cppe/test/IceE/adapterDeactivation/Collocated.cpp index 4f250056786..3d7ea8af838 100644 --- a/cppe/test/IceE/adapterDeactivation/Collocated.cpp +++ b/cppe/test/IceE/adapterDeactivation/Collocated.cpp @@ -29,10 +29,10 @@ public: { Ice::InitializationData initData; initData.properties = Ice::createProperties(); - initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); loadConfig(initData.properties); - initData.logger = getLogger(); + initData.logger = getLogger(); setCommunicator(Ice::initialize(argc, argv, initData)); Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter"); diff --git a/cppe/test/IceE/adapterDeactivation/Server.cpp b/cppe/test/IceE/adapterDeactivation/Server.cpp index 1d9966a9584..e5157db546e 100644 --- a/cppe/test/IceE/adapterDeactivation/Server.cpp +++ b/cppe/test/IceE/adapterDeactivation/Server.cpp @@ -32,7 +32,7 @@ public: initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); loadConfig(initData.properties); - initData.logger = getLogger(); + initData.logger = getLogger(); setCommunicator(Ice::initialize(argc, argv, initData)); Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter"); diff --git a/cppe/test/IceE/adapterDeactivation/TestI.cpp b/cppe/test/IceE/adapterDeactivation/TestI.cpp index e75be7a8bb2..31b08d7ba6f 100644 --- a/cppe/test/IceE/adapterDeactivation/TestI.cpp +++ b/cppe/test/IceE/adapterDeactivation/TestI.cpp @@ -19,7 +19,7 @@ TestI::transient(const Current& current) CommunicatorPtr communicator = current.adapter->getCommunicator(); ObjectAdapterPtr adapter = - communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999"); + communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999"); adapter->activate(); adapter->deactivate(); adapter->waitForDeactivate(); diff --git a/cppe/test/IceE/custom/AllTests.cpp b/cppe/test/IceE/custom/AllTests.cpp index 813749e7c8e..24394e1b86d 100644 --- a/cppe/test/IceE/custom/AllTests.cpp +++ b/cppe/test/IceE/custom/AllTests.cpp @@ -20,7 +20,7 @@ allTests(const Ice::CommunicatorPtr& communicator) { tprintf("testing stringToProxy... "); string ref = communicator->getProperties()->getPropertyWithDefault( - "Custom.Proxy", "test:default -p 12010 -t 10000"); + "Custom.Proxy", "test:default -p 12010 -t 10000"); Ice::ObjectPrx base = communicator->stringToProxy(ref); test(base); tprintf("ok\n"); @@ -35,428 +35,428 @@ allTests(const Ice::CommunicatorPtr& communicator) { Test::BoolSeq in(5); - in[0] = false; - in[1] = true; - in[2] = true; - in[3] = false; - in[4] = true; - bool inArray[5]; - for(int i = 0; i < 5; ++i) - { - inArray[i] = in[i]; - } - pair<const bool*, const bool*> inPair(inArray, inArray + 5); - - Test::BoolSeq out; - Test::BoolSeq ret = t->opBoolArray(inPair, out); - test(out == in); - test(ret == in); + in[0] = false; + in[1] = true; + in[2] = true; + in[3] = false; + in[4] = true; + bool inArray[5]; + for(int i = 0; i < 5; ++i) + { + inArray[i] = in[i]; + } + pair<const bool*, const bool*> inPair(inArray, inArray + 5); + + Test::BoolSeq out; + Test::BoolSeq ret = t->opBoolArray(inPair, out); + test(out == in); + test(ret == in); } { Test::ByteList in; - Ice::Byte inArray[5]; - inArray[0] = '1'; - in.push_back(inArray[0]); - inArray[1] = '2'; - in.push_back(inArray[1]); - inArray[2] = '3'; - in.push_back(inArray[2]); - inArray[3] = '4'; - in.push_back(inArray[3]); - inArray[4] = '5'; - in.push_back(inArray[4]); - pair<const Ice::Byte*, const Ice::Byte*> inPair(inArray, inArray + 5); - - Test::ByteList out; - Test::ByteList ret = t->opByteArray(inPair, out); - test(out == in); - test(ret == in); + Ice::Byte inArray[5]; + inArray[0] = '1'; + in.push_back(inArray[0]); + inArray[1] = '2'; + in.push_back(inArray[1]); + inArray[2] = '3'; + in.push_back(inArray[2]); + inArray[3] = '4'; + in.push_back(inArray[3]); + inArray[4] = '5'; + in.push_back(inArray[4]); + pair<const Ice::Byte*, const Ice::Byte*> inPair(inArray, inArray + 5); + + Test::ByteList out; + Test::ByteList ret = t->opByteArray(inPair, out); + test(out == in); + test(ret == in); } { Test::VariableList in; - Test::Variable inArray[5]; - inArray[0].s = "These"; - in.push_back(inArray[0]); - inArray[1].s = "are"; - in.push_back(inArray[1]); - inArray[2].s = "five"; - in.push_back(inArray[2]); - inArray[3].s = "short"; - in.push_back(inArray[3]); - inArray[4].s = "strings."; - in.push_back(inArray[4]); - pair<const Test::Variable*, const Test::Variable*> inPair(inArray, inArray + 5); - - Test::VariableList out; - Test::VariableList ret = t->opVariableArray(inPair, out); - test(out == in); - test(ret == in); + Test::Variable inArray[5]; + inArray[0].s = "These"; + in.push_back(inArray[0]); + inArray[1].s = "are"; + in.push_back(inArray[1]); + inArray[2].s = "five"; + in.push_back(inArray[2]); + inArray[3].s = "short"; + in.push_back(inArray[3]); + inArray[4].s = "strings."; + in.push_back(inArray[4]); + pair<const Test::Variable*, const Test::Variable*> inPair(inArray, inArray + 5); + + Test::VariableList out; + Test::VariableList ret = t->opVariableArray(inPair, out); + test(out == in); + test(ret == in); } { Test::BoolSeq in(5); - in[0] = false; - in[1] = true; - in[2] = true; - in[3] = false; - in[4] = true; - pair<Test::BoolSeq::const_iterator, Test::BoolSeq::const_iterator> inPair(in.begin(), in.end()); - - Test::BoolSeq out; - Test::BoolSeq ret = t->opBoolRange(inPair, out); - test(out == in); - test(ret == in); + in[0] = false; + in[1] = true; + in[2] = true; + in[3] = false; + in[4] = true; + pair<Test::BoolSeq::const_iterator, Test::BoolSeq::const_iterator> inPair(in.begin(), in.end()); + + Test::BoolSeq out; + Test::BoolSeq ret = t->opBoolRange(inPair, out); + test(out == in); + test(ret == in); } { Test::ByteList in; - in.push_back('1'); - in.push_back('2'); - in.push_back('3'); - in.push_back('4'); - in.push_back('5'); - pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator> inPair(in.begin(), in.end()); - - Test::ByteList out; - Test::ByteList ret = t->opByteRange(inPair, out); - test(out == in); - test(ret == in); + in.push_back('1'); + in.push_back('2'); + in.push_back('3'); + in.push_back('4'); + in.push_back('5'); + pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator> inPair(in.begin(), in.end()); + + Test::ByteList out; + Test::ByteList ret = t->opByteRange(inPair, out); + test(out == in); + test(ret == in); } { Test::VariableList in; - Test::Variable v; - v.s = "These"; - in.push_back(v); - v.s = "are"; - in.push_back(v); - v.s = "five"; - in.push_back(v); - v.s = "short"; - in.push_back(v); - v.s = "strings."; - in.push_back(v); - pair<Test::VariableList::const_iterator, Test::VariableList::const_iterator> inPair(in.begin(), in.end()); - - Test::VariableList out; - Test::VariableList ret = t->opVariableRange(inPair, out); - test(out == in); - test(ret == in); + Test::Variable v; + v.s = "These"; + in.push_back(v); + v.s = "are"; + in.push_back(v); + v.s = "five"; + in.push_back(v); + v.s = "short"; + in.push_back(v); + v.s = "strings."; + in.push_back(v); + pair<Test::VariableList::const_iterator, Test::VariableList::const_iterator> inPair(in.begin(), in.end()); + + Test::VariableList out; + Test::VariableList ret = t->opVariableRange(inPair, out); + test(out == in); + test(ret == in); } { Test::BoolSeq in(5); - in[0] = false; - in[1] = true; - in[2] = true; - in[3] = false; - in[4] = true; - bool inArray[5]; - for(int i = 0; i < 5; ++i) - { - inArray[i] = in[i]; - } - pair<const bool*, const bool*> inPair(inArray, inArray + 5); - - Test::BoolSeq out; - Test::BoolSeq ret = t->opBoolRangeType(inPair, out); - test(out == in); - test(ret == in); + in[0] = false; + in[1] = true; + in[2] = true; + in[3] = false; + in[4] = true; + bool inArray[5]; + for(int i = 0; i < 5; ++i) + { + inArray[i] = in[i]; + } + pair<const bool*, const bool*> inPair(inArray, inArray + 5); + + Test::BoolSeq out; + Test::BoolSeq ret = t->opBoolRangeType(inPair, out); + test(out == in); + test(ret == in); } { Test::ByteList in; - in.push_back('1'); - in.push_back('2'); - in.push_back('3'); - in.push_back('4'); - in.push_back('5'); - pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator> inPair(in.begin(), in.end()); - - Test::ByteList out; - Test::ByteList ret = t->opByteRangeType(inPair, out); - test(out == in); - test(ret == in); + in.push_back('1'); + in.push_back('2'); + in.push_back('3'); + in.push_back('4'); + in.push_back('5'); + pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator> inPair(in.begin(), in.end()); + + Test::ByteList out; + Test::ByteList ret = t->opByteRangeType(inPair, out); + test(out == in); + test(ret == in); } { Test::VariableList in; - deque<Test::Variable> inSeq; - Test::Variable v; - v.s = "These"; - in.push_back(v); - inSeq.push_back(v); - v.s = "are"; - in.push_back(v); - inSeq.push_back(v); - v.s = "five"; - in.push_back(v); - inSeq.push_back(v); - v.s = "short"; - in.push_back(v); - inSeq.push_back(v); - v.s = "strings."; - in.push_back(v); - inSeq.push_back(v); - pair<deque<Test::Variable>::const_iterator, deque<Test::Variable>::const_iterator> - inPair(inSeq.begin(), inSeq.end()); - - Test::VariableList out; - Test::VariableList ret = t->opVariableRangeType(inPair, out); - test(out == in); - test(ret == in); + deque<Test::Variable> inSeq; + Test::Variable v; + v.s = "These"; + in.push_back(v); + inSeq.push_back(v); + v.s = "are"; + in.push_back(v); + inSeq.push_back(v); + v.s = "five"; + in.push_back(v); + inSeq.push_back(v); + v.s = "short"; + in.push_back(v); + inSeq.push_back(v); + v.s = "strings."; + in.push_back(v); + inSeq.push_back(v); + pair<deque<Test::Variable>::const_iterator, deque<Test::Variable>::const_iterator> + inPair(inSeq.begin(), inSeq.end()); + + Test::VariableList out; + Test::VariableList ret = t->opVariableRangeType(inPair, out); + test(out == in); + test(ret == in); } { deque<bool> in(5); - in[0] = false; - in[1] = true; - in[2] = true; - in[3] = false; - in[4] = true; - - deque<bool> out; - deque<bool> ret = t->opBoolSeq(in, out); - test(out == in); - test(ret == in); + in[0] = false; + in[1] = true; + in[2] = true; + in[3] = false; + in[4] = true; + + deque<bool> out; + deque<bool> ret = t->opBoolSeq(in, out); + test(out == in); + test(ret == in); } { list<bool> in; - in.push_back(false); - in.push_back(true); - in.push_back(true); - in.push_back(false); - in.push_back(true); - - list<bool> out; - list<bool> ret = t->opBoolList(in, out); - test(out == in); - test(ret == in); + in.push_back(false); + in.push_back(true); + in.push_back(true); + in.push_back(false); + in.push_back(true); + + list<bool> out; + list<bool> ret = t->opBoolList(in, out); + test(out == in); + test(ret == in); } { deque< ::Ice::Byte> in(5); - in[0] = '1'; - in[1] = '2'; - in[2] = '3'; - in[3] = '4'; - in[4] = '5'; - - deque< ::Ice::Byte> out; - deque< ::Ice::Byte> ret = t->opByteSeq(in, out); - test(out == in); - test(ret == in); + in[0] = '1'; + in[1] = '2'; + in[2] = '3'; + in[3] = '4'; + in[4] = '5'; + + deque< ::Ice::Byte> out; + deque< ::Ice::Byte> ret = t->opByteSeq(in, out); + test(out == in); + test(ret == in); } { list< ::Ice::Byte> in; - in.push_back('1'); - in.push_back('2'); - in.push_back('3'); - in.push_back('4'); - in.push_back('5'); - - list< ::Ice::Byte> out; - list< ::Ice::Byte> ret = t->opByteList(in, out); - test(out == in); - test(ret == in); + in.push_back('1'); + in.push_back('2'); + in.push_back('3'); + in.push_back('4'); + in.push_back('5'); + + list< ::Ice::Byte> out; + list< ::Ice::Byte> ret = t->opByteList(in, out); + test(out == in); + test(ret == in); } { MyByteSeq in(5); - int i = 0; - for(MyByteSeq::iterator p = in.begin(); p != in.end(); ++p) - { - *p = '1' + i++; - } - - MyByteSeq out; - MyByteSeq ret = t->opMyByteSeq(in, out); - test(out == in); - test(ret == in); + int i = 0; + for(MyByteSeq::iterator p = in.begin(); p != in.end(); ++p) + { + *p = '1' + i++; + } + + MyByteSeq out; + MyByteSeq ret = t->opMyByteSeq(in, out); + test(out == in); + test(ret == in); } { deque<string> in(5); - in[0] = "These"; - in[1] = "are"; - in[2] = "five"; - in[3] = "short"; - in[4] = "strings."; - - deque<string> out; - deque<string> ret = t->opStringSeq(in, out); - test(out == in); - test(ret == in); + in[0] = "These"; + in[1] = "are"; + in[2] = "five"; + in[3] = "short"; + in[4] = "strings."; + + deque<string> out; + deque<string> ret = t->opStringSeq(in, out); + test(out == in); + test(ret == in); } { list<string> in; - in.push_back("These"); - in.push_back("are"); - in.push_back("five"); - in.push_back("short"); - in.push_back("strings."); - - list<string> out; - list<string> ret = t->opStringList(in, out); - test(out == in); - test(ret == in); + in.push_back("These"); + in.push_back("are"); + in.push_back("five"); + in.push_back("short"); + in.push_back("strings."); + + list<string> out; + list<string> ret = t->opStringList(in, out); + test(out == in); + test(ret == in); } { deque<Test::Fixed> in(5); - in[0].s = 1; - in[1].s = 2; - in[2].s = 3; - in[3].s = 4; - in[4].s = 5; - - deque<Test::Fixed> out; - deque<Test::Fixed> ret = t->opFixedSeq(in, out); - test(out == in); - test(ret == in); + in[0].s = 1; + in[1].s = 2; + in[2].s = 3; + in[3].s = 4; + in[4].s = 5; + + deque<Test::Fixed> out; + deque<Test::Fixed> ret = t->opFixedSeq(in, out); + test(out == in); + test(ret == in); } { list<Test::Fixed> in(5); - short num = 1; - for(list<Test::Fixed>::iterator p = in.begin(); p != in.end(); ++p) - { - (*p).s = num++; - } - - list<Test::Fixed> out; - list<Test::Fixed> ret = t->opFixedList(in, out); - test(out == in); - test(ret == in); + short num = 1; + for(list<Test::Fixed>::iterator p = in.begin(); p != in.end(); ++p) + { + (*p).s = num++; + } + + list<Test::Fixed> out; + list<Test::Fixed> ret = t->opFixedList(in, out); + test(out == in); + test(ret == in); } { deque<Test::Variable> in(5); - in[0].s = "These"; - in[1].s = "are"; - in[2].s = "five"; - in[3].s = "short"; - in[4].s = "strings."; - - deque<Test::Variable> out; - deque<Test::Variable> ret = t->opVariableSeq(in, out); - test(out == in); - test(ret == in); + in[0].s = "These"; + in[1].s = "are"; + in[2].s = "five"; + in[3].s = "short"; + in[4].s = "strings."; + + deque<Test::Variable> out; + deque<Test::Variable> ret = t->opVariableSeq(in, out); + test(out == in); + test(ret == in); } { list<Test::Variable> in; - Test::Variable v; - v.s = "These"; - in.push_back(v); - v.s = "are"; - in.push_back(v); - v.s = "five"; - in.push_back(v); - v.s = "short"; - in.push_back(v); - v.s = "strings."; - in.push_back(v); - - list<Test::Variable> out; - list<Test::Variable> ret = t->opVariableList(in, out); - test(out == in); - test(ret == in); + Test::Variable v; + v.s = "These"; + in.push_back(v); + v.s = "are"; + in.push_back(v); + v.s = "five"; + in.push_back(v); + v.s = "short"; + in.push_back(v); + v.s = "strings."; + in.push_back(v); + + list<Test::Variable> out; + list<Test::Variable> ret = t->opVariableList(in, out); + test(out == in); + test(ret == in); } { deque<Test::StringStringDict> in(5); - in[0]["A"] = "a"; - in[1]["B"] = "b"; - in[2]["C"] = "c"; - in[3]["D"] = "d"; - in[4]["E"] = "e"; - - deque<Test::StringStringDict> out; - deque<Test::StringStringDict> ret = t->opStringStringDictSeq(in, out); - test(out == in); - test(ret == in); + in[0]["A"] = "a"; + in[1]["B"] = "b"; + in[2]["C"] = "c"; + in[3]["D"] = "d"; + in[4]["E"] = "e"; + + deque<Test::StringStringDict> out; + deque<Test::StringStringDict> ret = t->opStringStringDictSeq(in, out); + test(out == in); + test(ret == in); } { list<Test::StringStringDict> in; - Test::StringStringDict ssd; - ssd["A"] = "a"; - in.push_back(ssd); - ssd["B"] = "b"; - in.push_back(ssd); - ssd["C"] = "c"; - in.push_back(ssd); - ssd["D"] = "d"; - in.push_back(ssd); - ssd["E"] = "e"; - in.push_back(ssd); - - list<Test::StringStringDict> out; - list<Test::StringStringDict> ret = t->opStringStringDictList(in, out); - test(out == in); - test(ret == in); + Test::StringStringDict ssd; + ssd["A"] = "a"; + in.push_back(ssd); + ssd["B"] = "b"; + in.push_back(ssd); + ssd["C"] = "c"; + in.push_back(ssd); + ssd["D"] = "d"; + in.push_back(ssd); + ssd["E"] = "e"; + in.push_back(ssd); + + list<Test::StringStringDict> out; + list<Test::StringStringDict> ret = t->opStringStringDictList(in, out); + test(out == in); + test(ret == in); } { deque<Test::E> in(5); - in[0] = Test::E1; - in[1] = Test::E2; - in[2] = Test::E3; - in[3] = Test::E1; - in[4] = Test::E3; - - deque<Test::E> out; - deque<Test::E> ret = t->opESeq(in, out); - test(out == in); - test(ret == in); + in[0] = Test::E1; + in[1] = Test::E2; + in[2] = Test::E3; + in[3] = Test::E1; + in[4] = Test::E3; + + deque<Test::E> out; + deque<Test::E> ret = t->opESeq(in, out); + test(out == in); + test(ret == in); } { list<Test::E> in; - in.push_back(Test::E1); - in.push_back(Test::E2); - in.push_back(Test::E3); - in.push_back(Test::E1); - in.push_back(Test::E3); - - list<Test::E> out; - list<Test::E> ret = t->opEList(in, out); - test(out == in); - test(ret == in); + in.push_back(Test::E1); + in.push_back(Test::E2); + in.push_back(Test::E3); + in.push_back(Test::E1); + in.push_back(Test::E3); + + list<Test::E> out; + list<Test::E> ret = t->opEList(in, out); + test(out == in); + test(ret == in); } { deque<Test::CPrx> in(5); - in[0] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C1:default -p 12010 -t 10000")); - in[1] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C2:default -p 12010 -t 10001")); - in[2] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C3:default -p 12010 -t 10002")); - in[3] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C4:default -p 12010 -t 10003")); - in[4] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C5:default -p 12010 -t 10004")); - - deque<Test::CPrx> out; - deque<Test::CPrx> ret = t->opCPrxSeq(in, out); - test(out == in); - test(ret == in); + in[0] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C1:default -p 12010 -t 10000")); + in[1] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C2:default -p 12010 -t 10001")); + in[2] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C3:default -p 12010 -t 10002")); + in[3] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C4:default -p 12010 -t 10003")); + in[4] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C5:default -p 12010 -t 10004")); + + deque<Test::CPrx> out; + deque<Test::CPrx> ret = t->opCPrxSeq(in, out); + test(out == in); + test(ret == in); } { list<Test::CPrx> in; - in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C1:default -p 12010 -t 10000"))); - in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C2:default -p 12010 -t 10001"))); - in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C3:default -p 12010 -t 10002"))); - in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C4:default -p 12010 -t 10003"))); - in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C5:default -p 12010 -t 10004"))); - - list<Test::CPrx> out; - list<Test::CPrx> ret = t->opCPrxList(in, out); - test(out == in); - test(ret == in); + in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C1:default -p 12010 -t 10000"))); + in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C2:default -p 12010 -t 10001"))); + in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C3:default -p 12010 -t 10002"))); + in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C4:default -p 12010 -t 10003"))); + in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C5:default -p 12010 -t 10004"))); + + list<Test::CPrx> out; + list<Test::CPrx> ret = t->opCPrxList(in, out); + test(out == in); + test(ret == in); } tprintf("ok\n"); diff --git a/cppe/test/IceE/custom/Client.cpp b/cppe/test/IceE/custom/Client.cpp index cc2e0e9ca97..cf26bbd15eb 100644 --- a/cppe/test/IceE/custom/Client.cpp +++ b/cppe/test/IceE/custom/Client.cpp @@ -28,15 +28,15 @@ public: run(int argc, char* argv[]) { Ice::InitializationData initData; - initData.properties = Ice::createProperties(); + initData.properties = Ice::createProperties(); #ifdef ICEE_HAS_WSTRING initData.stringConverter = new Test::StringConverterI(); initData.wstringConverter = new Test::WstringConverterI(); #endif - loadConfig(initData.properties); - initData.logger = getLogger(); - setCommunicator(Ice::initialize(argc, argv, initData)); + loadConfig(initData.properties); + initData.logger = getLogger(); + setCommunicator(Ice::initialize(argc, argv, initData)); Test::TestIntfPrx allTests(const Ice::CommunicatorPtr&); Test::TestIntfPrx test = allTests(communicator()); diff --git a/cppe/test/IceE/custom/Collocated.cpp b/cppe/test/IceE/custom/Collocated.cpp index 80ce3d19e08..59a5193fd4a 100644 --- a/cppe/test/IceE/custom/Collocated.cpp +++ b/cppe/test/IceE/custom/Collocated.cpp @@ -28,21 +28,21 @@ public: run(int argc, char* argv[]) { Ice::InitializationData initData; - initData.properties = Ice::createProperties(); + initData.properties = Ice::createProperties(); - initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); - //initData.properties->setProperty("Ice.Trace.Network", "5"); - //initData.properties->setProperty("Ice.Trace.Protocol", "5"); + initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + //initData.properties->setProperty("Ice.Trace.Network", "5"); + //initData.properties->setProperty("Ice.Trace.Protocol", "5"); - loadConfig(initData.properties); - initData.logger = getLogger(); - setCommunicator(Ice::initialize(argc, argv, initData)); + loadConfig(initData.properties); + initData.logger = getLogger(); + setCommunicator(Ice::initialize(argc, argv, initData)); Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter"); adapter->add(new TestIntfI(communicator()), communicator()->stringToIdentity("test")); #ifdef ICEE_HAS_WSTRING - adapter->add(new Test1::WstringClassI, communicator()->stringToIdentity("wstring1")); - adapter->add(new Test2::WstringClassI, communicator()->stringToIdentity("wstring2")); + adapter->add(new Test1::WstringClassI, communicator()->stringToIdentity("wstring1")); + adapter->add(new Test2::WstringClassI, communicator()->stringToIdentity("wstring2")); #endif adapter->activate(); diff --git a/cppe/test/IceE/custom/MyByteSeq.cpp b/cppe/test/IceE/custom/MyByteSeq.cpp index 8a24df1026b..d8d346879d9 100644 --- a/cppe/test/IceE/custom/MyByteSeq.cpp +++ b/cppe/test/IceE/custom/MyByteSeq.cpp @@ -32,7 +32,7 @@ MyByteSeq::MyByteSeq(const MyByteSeq& seq) if(_size != 0) { _data = (Ice::Byte*)malloc(_size); - memcpy(_data, seq._data, _size); + memcpy(_data, seq._data, _size); } else { @@ -83,13 +83,13 @@ MyByteSeq::operator=(const MyByteSeq& rhs) if(_data != 0) { free(_data); - _data = 0; + _data = 0; } _size = rhs._size; if(_size != 0) { _data = (Ice::Byte*)malloc(_size); - memcpy(_data, rhs._data, _size); + memcpy(_data, rhs._data, _size); } } diff --git a/cppe/test/IceE/custom/Server.cpp b/cppe/test/IceE/custom/Server.cpp index 30e7fb7bcb4..7c6c556880a 100644 --- a/cppe/test/IceE/custom/Server.cpp +++ b/cppe/test/IceE/custom/Server.cpp @@ -29,27 +29,27 @@ public: run(int argc, char* argv[]) { Ice::InitializationData initData; - initData.properties = Ice::createProperties(); + initData.properties = Ice::createProperties(); #ifdef ICEE_HAS_WSTRING initData.stringConverter = new Test::StringConverterI(); initData.wstringConverter = new Test::WstringConverterI(); #endif - initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); - //initData.properties->setProperty("Ice.Trace.Network", "5"); - //initData.properties->setProperty("Ice.Trace.Protocol", "5"); + initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + //initData.properties->setProperty("Ice.Trace.Network", "5"); + //initData.properties->setProperty("Ice.Trace.Protocol", "5"); - loadConfig(initData.properties); - initData.logger = getLogger(); - setCommunicator(Ice::initialize(argc, argv, initData)); - + loadConfig(initData.properties); + initData.logger = getLogger(); + setCommunicator(Ice::initialize(argc, argv, initData)); + Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter"); adapter->add(new TestIntfI(communicator()), communicator()->stringToIdentity("test")); #ifdef ICEE_HAS_WSTRING - adapter->add(new Test1::WstringClassI, communicator()->stringToIdentity("wstring1")); - adapter->add(new Test2::WstringClassI, communicator()->stringToIdentity("wstring2")); + adapter->add(new Test1::WstringClassI, communicator()->stringToIdentity("wstring1")); + adapter->add(new Test2::WstringClassI, communicator()->stringToIdentity("wstring2")); #endif - adapter->activate(); + adapter->activate(); #ifndef _WIN32_WCE communicator()->waitForShutdown(); diff --git a/cppe/test/IceE/custom/StringConverterI.cpp b/cppe/test/IceE/custom/StringConverterI.cpp index 52357b5d9c8..e606044ed70 100644 --- a/cppe/test/IceE/custom/StringConverterI.cpp +++ b/cppe/test/IceE/custom/StringConverterI.cpp @@ -34,7 +34,7 @@ Test::StringConverterI::toUTF8(const char* sourceStart, const char* sourceEnd, I void Test::StringConverterI::fromUTF8(const Ice::Byte* sourceStart, const Ice::Byte* sourceEnd, - string& target) const + string& target) const { size_t size = static_cast<size_t>(sourceEnd - sourceStart); target.resize(size); @@ -67,7 +67,7 @@ Test::WstringConverterI::toUTF8(const wchar_t* sourceStart, const wchar_t* sourc void Test::WstringConverterI::fromUTF8(const Ice::Byte* sourceStart, const Ice::Byte* sourceEnd, - wstring& target) const + wstring& target) const { size_t size = static_cast<size_t>(sourceEnd - sourceStart); string s; diff --git a/cppe/test/IceE/custom/StringConverterI.h b/cppe/test/IceE/custom/StringConverterI.h index c264ce5e5fc..1981729dc7f 100644 --- a/cppe/test/IceE/custom/StringConverterI.h +++ b/cppe/test/IceE/custom/StringConverterI.h @@ -30,7 +30,7 @@ public: virtual Ice::Byte* toUTF8(const char*, const char*, Ice::UTF8Buffer&) const; virtual void fromUTF8(const Ice::Byte* sourceStart, const Ice::Byte* sourceEnd, - std::string& target) const; + std::string& target) const; }; class WstringConverterI : public Ice::WstringConverter @@ -39,7 +39,7 @@ public: virtual Ice::Byte* toUTF8(const wchar_t*, const wchar_t*, Ice::UTF8Buffer&) const; virtual void fromUTF8(const Ice::Byte* sourceStart, const Ice::Byte* sourceEnd, - std::wstring& target) const; + std::wstring& target) const; }; } diff --git a/cppe/test/IceE/custom/Test.ice b/cppe/test/IceE/custom/Test.ice index 0fb6800313f..bfa77fb7f58 100644 --- a/cppe/test/IceE/custom/Test.ice +++ b/cppe/test/IceE/custom/Test.ice @@ -114,7 +114,7 @@ class TestIntf ["cpp:type:std::deque< ::Ice::Byte>"] ByteSeq opByteSeq(["cpp:type:std::deque< ::Ice::Byte>"] ByteSeq inSeq, - out ["cpp:type:std::deque< ::Ice::Byte>"] ByteSeq outSeq); + out ["cpp:type:std::deque< ::Ice::Byte>"] ByteSeq outSeq); ByteList opByteList(ByteList inSeq, out ByteList outSeq); @@ -123,7 +123,7 @@ class TestIntf ["cpp:type:std::deque<std::string>"] StringSeq opStringSeq(["cpp:type:std::deque<std::string>"] StringSeq inSeq, - out ["cpp:type:std::deque<std::string>"] StringSeq outSeq); + out ["cpp:type:std::deque<std::string>"] StringSeq outSeq); StringList opStringList(StringList inSeq, out StringList outSeq); @@ -135,13 +135,13 @@ class TestIntf ["cpp:type:std::deque< ::Test::Variable>"] VariableSeq opVariableSeq(["cpp:type:std::deque< ::Test::Variable>"] VariableSeq inSeq, - out ["cpp:type:std::deque< ::Test::Variable>"] VariableSeq outSeq); + out ["cpp:type:std::deque< ::Test::Variable>"] VariableSeq outSeq); VariableList opVariableList(VariableList inSeq, out VariableList outSeq); ["cpp:type:std::deque< ::Test::StringStringDict>"] StringStringDictSeq opStringStringDictSeq(["cpp:type:std::deque< ::Test::StringStringDict>"] StringStringDictSeq inSeq, - out ["cpp:type:std::deque< ::Test::StringStringDict>"] StringStringDictSeq outSeq); + out ["cpp:type:std::deque< ::Test::StringStringDict>"] StringStringDictSeq outSeq); StringStringDictList opStringStringDictList(StringStringDictList inSeq, out StringStringDictList outSeq); @@ -152,7 +152,7 @@ class TestIntf ["cpp:type:std::deque< ::Test::CPrx>"] CPrxSeq opCPrxSeq(["cpp:type:std::deque< ::Test::CPrx>"] CPrxSeq inSeq, - out ["cpp:type:std::deque< ::Test::CPrx>"] CPrxSeq outSeq); + out ["cpp:type:std::deque< ::Test::CPrx>"] CPrxSeq outSeq); CPrxList opCPrxList(CPrxList inSeq, out CPrxList outSeq); diff --git a/cppe/test/IceE/custom/TestI.cpp b/cppe/test/IceE/custom/TestI.cpp index 4e5a8753ed0..26b38f05282 100644 --- a/cppe/test/IceE/custom/TestI.cpp +++ b/cppe/test/IceE/custom/TestI.cpp @@ -17,8 +17,8 @@ TestIntfI::TestIntfI(const Ice::CommunicatorPtr& communicator) Test::BoolSeq TestIntfI::opBoolArray(const std::pair<const bool*, const bool*>& inSeq, - Test::BoolSeq& outSeq, - const Ice::Current& current) + Test::BoolSeq& outSeq, + const Ice::Current& current) { Test::BoolSeq(inSeq.first, inSeq.second).swap(outSeq); return outSeq; @@ -26,8 +26,8 @@ TestIntfI::opBoolArray(const std::pair<const bool*, const bool*>& inSeq, Test::ByteList TestIntfI::opByteArray(const std::pair<const Ice::Byte*, const Ice::Byte*>& inSeq, - Test::ByteList& outSeq, - const Ice::Current& current) + Test::ByteList& outSeq, + const Ice::Current& current) { Test::ByteList(inSeq.first, inSeq.second).swap(outSeq); return outSeq; @@ -35,8 +35,8 @@ TestIntfI::opByteArray(const std::pair<const Ice::Byte*, const Ice::Byte*>& inSe Test::VariableList TestIntfI::opVariableArray(const std::pair<const Test::Variable*, const Test::Variable*>& inSeq, - Test::VariableList& outSeq, - const Ice::Current& current) + Test::VariableList& outSeq, + const Ice::Current& current) { Test::VariableList(inSeq.first, inSeq.second).swap(outSeq); return outSeq; @@ -44,8 +44,8 @@ TestIntfI::opVariableArray(const std::pair<const Test::Variable*, const Test::Va Test::BoolSeq TestIntfI::opBoolRange(const std::pair<Test::BoolSeq::const_iterator, Test::BoolSeq::const_iterator>& inSeq, - Test::BoolSeq& outSeq, - const Ice::Current&) + Test::BoolSeq& outSeq, + const Ice::Current&) { Test::BoolSeq(inSeq.first, inSeq.second).swap(outSeq); return outSeq; @@ -53,8 +53,8 @@ TestIntfI::opBoolRange(const std::pair<Test::BoolSeq::const_iterator, Test::Bool Test::ByteList TestIntfI::opByteRange(const std::pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator>& inSeq, - Test::ByteList& outSeq, - const Ice::Current&) + Test::ByteList& outSeq, + const Ice::Current&) { Test::ByteList(inSeq.first, inSeq.second).swap(outSeq); return outSeq; @@ -62,9 +62,9 @@ TestIntfI::opByteRange(const std::pair<Test::ByteList::const_iterator, Test::Byt Test::VariableList TestIntfI::opVariableRange( - const std::pair<Test::VariableList::const_iterator, Test::VariableList::const_iterator>& inSeq, - Test::VariableList& outSeq, - const Ice::Current&) + const std::pair<Test::VariableList::const_iterator, Test::VariableList::const_iterator>& inSeq, + Test::VariableList& outSeq, + const Ice::Current&) { Test::VariableList(inSeq.first, inSeq.second).swap(outSeq); return outSeq; @@ -72,8 +72,8 @@ TestIntfI::opVariableRange( Test::BoolSeq TestIntfI::opBoolRangeType(const std::pair<const bool*, const bool*>& inSeq, - Test::BoolSeq& outSeq, - const Ice::Current&) + Test::BoolSeq& outSeq, + const Ice::Current&) { Test::BoolSeq(inSeq.first, inSeq.second).swap(outSeq); return outSeq; @@ -81,8 +81,8 @@ TestIntfI::opBoolRangeType(const std::pair<const bool*, const bool*>& inSeq, Test::ByteList TestIntfI::opByteRangeType(const std::pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator>& inSeq, - Test::ByteList& outSeq, - const Ice::Current&) + Test::ByteList& outSeq, + const Ice::Current&) { Test::ByteList(inSeq.first, inSeq.second).swap(outSeq); return outSeq; @@ -90,9 +90,9 @@ TestIntfI::opByteRangeType(const std::pair<Test::ByteList::const_iterator, Test: Test::VariableList TestIntfI::opVariableRangeType( - const std::pair<std::deque<Test::Variable>::const_iterator, std::deque<Test::Variable>::const_iterator>& inSeq, - Test::VariableList& outSeq, - const Ice::Current&) + const std::pair<std::deque<Test::Variable>::const_iterator, std::deque<Test::Variable>::const_iterator>& inSeq, + Test::VariableList& outSeq, + const Ice::Current&) { Test::VariableList(inSeq.first, inSeq.second).swap(outSeq); return outSeq; @@ -100,8 +100,8 @@ TestIntfI::opVariableRangeType( std::deque<bool> TestIntfI::opBoolSeq(const std::deque<bool>& inSeq, - std::deque<bool>& outSeq, - const Ice::Current& current) + std::deque<bool>& outSeq, + const Ice::Current& current) { outSeq = inSeq; return inSeq; @@ -109,8 +109,8 @@ TestIntfI::opBoolSeq(const std::deque<bool>& inSeq, std::list<bool> TestIntfI::opBoolList(const std::list<bool>& inSeq, - std::list<bool>& outSeq, - const Ice::Current& current) + std::list<bool>& outSeq, + const Ice::Current& current) { outSeq = inSeq; return inSeq; @@ -118,8 +118,8 @@ TestIntfI::opBoolList(const std::list<bool>& inSeq, std::deque< ::Ice::Byte> TestIntfI::opByteSeq(const std::deque< ::Ice::Byte>& inSeq, - std::deque< ::Ice::Byte>& outSeq, - const Ice::Current& current) + std::deque< ::Ice::Byte>& outSeq, + const Ice::Current& current) { outSeq = inSeq; return inSeq; @@ -127,8 +127,8 @@ TestIntfI::opByteSeq(const std::deque< ::Ice::Byte>& inSeq, std::list< ::Ice::Byte> TestIntfI::opByteList(const std::list< ::Ice::Byte>& inSeq, - std::list< ::Ice::Byte>& outSeq, - const Ice::Current& current) + std::list< ::Ice::Byte>& outSeq, + const Ice::Current& current) { outSeq = inSeq; return inSeq; @@ -136,8 +136,8 @@ TestIntfI::opByteList(const std::list< ::Ice::Byte>& inSeq, MyByteSeq TestIntfI::opMyByteSeq(const MyByteSeq& inSeq, - MyByteSeq& outSeq, - const Ice::Current& current) + MyByteSeq& outSeq, + const Ice::Current& current) { outSeq = inSeq; return inSeq; @@ -145,8 +145,8 @@ TestIntfI::opMyByteSeq(const MyByteSeq& inSeq, std::deque< ::std::string> TestIntfI::opStringSeq(const std::deque< ::std::string>& inSeq, - std::deque< ::std::string>& outSeq, - const Ice::Current& current) + std::deque< ::std::string>& outSeq, + const Ice::Current& current) { outSeq = inSeq; return inSeq; @@ -154,8 +154,8 @@ TestIntfI::opStringSeq(const std::deque< ::std::string>& inSeq, std::list< ::std::string> TestIntfI::opStringList(const std::list< ::std::string>& inSeq, - std::list< ::std::string>& outSeq, - const Ice::Current& current) + std::list< ::std::string>& outSeq, + const Ice::Current& current) { outSeq = inSeq; return inSeq; @@ -163,8 +163,8 @@ TestIntfI::opStringList(const std::list< ::std::string>& inSeq, std::deque< ::Test::Fixed> TestIntfI::opFixedSeq(const std::deque< ::Test::Fixed>& inSeq, - std::deque< ::Test::Fixed>& outSeq, - const Ice::Current& current) + std::deque< ::Test::Fixed>& outSeq, + const Ice::Current& current) { outSeq = inSeq; return inSeq; @@ -172,8 +172,8 @@ TestIntfI::opFixedSeq(const std::deque< ::Test::Fixed>& inSeq, std::list< ::Test::Fixed> TestIntfI::opFixedList(const std::list< ::Test::Fixed>& inSeq, - std::list< ::Test::Fixed>& outSeq, - const Ice::Current& current) + std::list< ::Test::Fixed>& outSeq, + const Ice::Current& current) { outSeq = inSeq; return inSeq; @@ -181,8 +181,8 @@ TestIntfI::opFixedList(const std::list< ::Test::Fixed>& inSeq, std::deque< ::Test::Variable> TestIntfI::opVariableSeq(const std::deque< ::Test::Variable>& inSeq, - std::deque< ::Test::Variable>& outSeq, - const Ice::Current& current) + std::deque< ::Test::Variable>& outSeq, + const Ice::Current& current) { outSeq = inSeq; return inSeq; @@ -190,8 +190,8 @@ TestIntfI::opVariableSeq(const std::deque< ::Test::Variable>& inSeq, std::list< ::Test::Variable> TestIntfI::opVariableList(const std::list< ::Test::Variable>& inSeq, - std::list< ::Test::Variable>& outSeq, - const Ice::Current& current) + std::list< ::Test::Variable>& outSeq, + const Ice::Current& current) { outSeq = inSeq; return inSeq; diff --git a/cppe/test/IceE/custom/TestI.h b/cppe/test/IceE/custom/TestI.h index f9b95108f21..a9e5f529415 100644 --- a/cppe/test/IceE/custom/TestI.h +++ b/cppe/test/IceE/custom/TestI.h @@ -19,88 +19,88 @@ public: TestIntfI(const Ice::CommunicatorPtr&); virtual Test::BoolSeq opBoolArray(const std::pair<const bool*, const bool*>&, - Test::BoolSeq&, - const Ice::Current&); + Test::BoolSeq&, + const Ice::Current&); virtual Test::ByteList opByteArray(const std::pair<const Ice::Byte*, const Ice::Byte*>&, - Test::ByteList&, - const Ice::Current&); + Test::ByteList&, + const Ice::Current&); virtual Test::VariableList opVariableArray(const std::pair<const Test::Variable*, const Test::Variable*>&, - Test::VariableList&, - const Ice::Current&); + Test::VariableList&, + const Ice::Current&); virtual Test::BoolSeq opBoolRange(const std::pair<Test::BoolSeq::const_iterator, Test::BoolSeq::const_iterator>&, - Test::BoolSeq&, - const Ice::Current&); + Test::BoolSeq&, + const Ice::Current&); virtual Test::ByteList opByteRange(const std::pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator>&, - Test::ByteList&, - const Ice::Current&); + Test::ByteList&, + const Ice::Current&); virtual Test::VariableList opVariableRange(const std::pair<Test::VariableList::const_iterator, Test::VariableList::const_iterator>&, - Test::VariableList&, - const Ice::Current&); + Test::VariableList&, + const Ice::Current&); virtual Test::BoolSeq opBoolRangeType(const std::pair<const bool*, const bool*>&, - Test::BoolSeq&, - const Ice::Current&); + Test::BoolSeq&, + const Ice::Current&); virtual Test::ByteList opByteRangeType(const std::pair<Test::ByteList::const_iterator, - Test::ByteList::const_iterator>&, - Test::ByteList&, - const Ice::Current&); + Test::ByteList::const_iterator>&, + Test::ByteList&, + const Ice::Current&); virtual Test::VariableList opVariableRangeType(const std::pair<std::deque<Test::Variable>::const_iterator, - std::deque<Test::Variable>::const_iterator>&, - Test::VariableList&, - const Ice::Current&); + std::deque<Test::Variable>::const_iterator>&, + Test::VariableList&, + const Ice::Current&); virtual std::deque<bool> opBoolSeq(const std::deque<bool>&, - std::deque<bool>&, - const Ice::Current&); + std::deque<bool>&, + const Ice::Current&); virtual std::list<bool> opBoolList(const std::list<bool>&, - std::list<bool>&, - const Ice::Current&); + std::list<bool>&, + const Ice::Current&); virtual std::deque< ::Ice::Byte> opByteSeq(const std::deque< ::Ice::Byte>&, - std::deque< ::Ice::Byte>&, - const Ice::Current&); + std::deque< ::Ice::Byte>&, + const Ice::Current&); virtual std::list< ::Ice::Byte> opByteList(const std::list< ::Ice::Byte>&, - std::list< ::Ice::Byte>&, - const Ice::Current&); + std::list< ::Ice::Byte>&, + const Ice::Current&); virtual MyByteSeq opMyByteSeq(const MyByteSeq&, - MyByteSeq&, - const Ice::Current&); + MyByteSeq&, + const Ice::Current&); virtual std::deque< ::std::string> opStringSeq(const std::deque< ::std::string>&, - std::deque< ::std::string>&, - const Ice::Current&); + std::deque< ::std::string>&, + const Ice::Current&); virtual std::list< ::std::string> opStringList(const std::list< ::std::string>&, - std::list< ::std::string>&, - const Ice::Current&); + std::list< ::std::string>&, + const Ice::Current&); virtual std::deque< ::Test::Fixed> opFixedSeq(const std::deque< ::Test::Fixed>&, - std::deque< ::Test::Fixed>&, - const Ice::Current&); + std::deque< ::Test::Fixed>&, + const Ice::Current&); virtual std::list< ::Test::Fixed> opFixedList(const std::list< ::Test::Fixed>&, - std::list< ::Test::Fixed>&, - const Ice::Current&); + std::list< ::Test::Fixed>&, + const Ice::Current&); virtual std::deque< ::Test::Variable> opVariableSeq(const std::deque< ::Test::Variable>&, - std::deque< ::Test::Variable>&, - const Ice::Current&); + std::deque< ::Test::Variable>&, + const Ice::Current&); virtual std::list< ::Test::Variable> opVariableList(const std::list< ::Test::Variable>&, - std::list< ::Test::Variable>&, - const Ice::Current&); + std::list< ::Test::Variable>&, + const Ice::Current&); virtual std::deque< ::Test::StringStringDict> opStringStringDictSeq(const std::deque< ::Test::StringStringDict>&, std::deque< ::Test::StringStringDict>&, diff --git a/cppe/test/IceE/custom/WstringI.cpp b/cppe/test/IceE/custom/WstringI.cpp index 46b2208fc9d..05e5fd94e57 100644 --- a/cppe/test/IceE/custom/WstringI.cpp +++ b/cppe/test/IceE/custom/WstringI.cpp @@ -15,8 +15,8 @@ ::std::wstring Test1::WstringClassI::opString(const ::std::wstring& s1, - ::std::wstring& s2, - const Ice::Current& current) + ::std::wstring& s2, + const Ice::Current& current) { s2 = s1; return s1; @@ -24,8 +24,8 @@ Test1::WstringClassI::opString(const ::std::wstring& s1, ::Test1::WstringStruct Test1::WstringClassI::opStruct(const ::Test1::WstringStruct& s1, - ::Test1::WstringStruct& s2, - const Ice::Current& current) + ::Test1::WstringStruct& s2, + const Ice::Current& current) { s2 = s1; return s1; @@ -33,7 +33,7 @@ Test1::WstringClassI::opStruct(const ::Test1::WstringStruct& s1, void Test1::WstringClassI::throwExcept(const ::std::wstring& reason, - const Ice::Current& current) + const Ice::Current& current) { Test1::WstringException ex; ex.reason = reason; @@ -42,8 +42,8 @@ Test1::WstringClassI::throwExcept(const ::std::wstring& reason, ::std::wstring Test2::WstringClassI::opString(const ::std::wstring& s1, - ::std::wstring& s2, - const Ice::Current& current) + ::std::wstring& s2, + const Ice::Current& current) { s2 = s1; return s1; @@ -51,8 +51,8 @@ Test2::WstringClassI::opString(const ::std::wstring& s1, ::Test2::WstringStruct Test2::WstringClassI::opStruct(const ::Test2::WstringStruct& s1, - ::Test2::WstringStruct& s2, - const Ice::Current& current) + ::Test2::WstringStruct& s2, + const Ice::Current& current) { s2 = s1; return s1; @@ -60,7 +60,7 @@ Test2::WstringClassI::opStruct(const ::Test2::WstringStruct& s1, void Test2::WstringClassI::throwExcept(const ::std::wstring& reason, - const Ice::Current& current) + const Ice::Current& current) { Test2::WstringException ex; ex.reason = reason; diff --git a/cppe/test/IceE/custom/WstringI.h b/cppe/test/IceE/custom/WstringI.h index 7b5104a6ae8..3077a1b3f58 100644 --- a/cppe/test/IceE/custom/WstringI.h +++ b/cppe/test/IceE/custom/WstringI.h @@ -24,15 +24,15 @@ class WstringClassI : virtual public WstringClass public: virtual ::std::wstring opString(const ::std::wstring&, - ::std::wstring&, - const Ice::Current&); + ::std::wstring&, + const Ice::Current&); virtual ::Test1::WstringStruct opStruct(const ::Test1::WstringStruct&, - ::Test1::WstringStruct&, - const Ice::Current&); + ::Test1::WstringStruct&, + const Ice::Current&); virtual void throwExcept(const ::std::wstring&, - const Ice::Current&); + const Ice::Current&); }; } @@ -45,15 +45,15 @@ class WstringClassI : virtual public WstringClass public: virtual ::std::wstring opString(const ::std::wstring&, - ::std::wstring&, - const Ice::Current&); + ::std::wstring&, + const Ice::Current&); virtual ::Test2::WstringStruct opStruct(const ::Test2::WstringStruct&, - ::Test2::WstringStruct&, - const Ice::Current&); + ::Test2::WstringStruct&, + const Ice::Current&); virtual void throwExcept(const ::std::wstring&, - const Ice::Current&); + const Ice::Current&); }; } diff --git a/cppe/test/IceE/exceptions/AllTests.cpp b/cppe/test/IceE/exceptions/AllTests.cpp index f9c3fbc7ebc..142ffc13218 100644 --- a/cppe/test/IceE/exceptions/AllTests.cpp +++ b/cppe/test/IceE/exceptions/AllTests.cpp @@ -23,7 +23,7 @@ class CallbackBase : public IceUtil::Monitor<IceUtil::Mutex> public: CallbackBase() : - _called(false) + _called(false) { } @@ -33,26 +33,26 @@ public: bool check() { - IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); - while(!_called) - { - if(!timedWait(IceUtil::Time::seconds(5))) - { - return false; - } - } - _called = false; - return true; + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + while(!_called) + { + if(!timedWait(IceUtil::Time::seconds(5))) + { + return false; + } + } + _called = false; + return true; } protected: void called() { - IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); - assert(!_called); - _called = true; - notify(); + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + assert(!_called); + _called = true; + notify(); } private: @@ -90,67 +90,67 @@ allTests(const Ice::CommunicatorPtr& communicator) tprintf("testing object adapter registration exceptions... "); { - Ice::ObjectAdapterPtr first = communicator->createObjectAdapter("TestAdapter0"); - try - { - Ice::ObjectAdapterPtr second = communicator->createObjectAdapter("TestAdapter0"); - test(false); - } - catch(const Ice::AlreadyRegisteredException&) - { - // Expected - } - - communicator->getProperties()->setProperty("TestAdapter0.Endpoints", ""); - try - { - Ice::ObjectAdapterPtr second = - communicator->createObjectAdapterWithEndpoints("TestAdapter0", "ssl -h foo -p 12011 -t 10000"); - test(false); - } - catch(const Ice::AlreadyRegisteredException&) - { - // Expected. - } - // - // Properties must remain unaffected if an exception occurs. - // - test(communicator->getProperties()->getProperty("TestAdapter0.Endpoints") == ""); - first->deactivate(); + Ice::ObjectAdapterPtr first = communicator->createObjectAdapter("TestAdapter0"); + try + { + Ice::ObjectAdapterPtr second = communicator->createObjectAdapter("TestAdapter0"); + test(false); + } + catch(const Ice::AlreadyRegisteredException&) + { + // Expected + } + + communicator->getProperties()->setProperty("TestAdapter0.Endpoints", ""); + try + { + Ice::ObjectAdapterPtr second = + communicator->createObjectAdapterWithEndpoints("TestAdapter0", "ssl -h foo -p 12011 -t 10000"); + test(false); + } + catch(const Ice::AlreadyRegisteredException&) + { + // Expected. + } + // + // Properties must remain unaffected if an exception occurs. + // + test(communicator->getProperties()->getProperty("TestAdapter0.Endpoints") == ""); + first->deactivate(); } tprintf("ok\n"); tprintf("testing servant registration exceptions..."); { - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter1"); - Ice::ObjectPtr obj = new EmptyI; - adapter->add(obj, communicator->stringToIdentity("x")); - try - { - adapter->add(obj, communicator->stringToIdentity("x")); - test(false); - } - catch(const Ice::AlreadyRegisteredException&) - { - } - - adapter->remove(communicator->stringToIdentity("x")); - try - { - adapter->remove(communicator->stringToIdentity("x")); - test(false); - } - catch(const Ice::NotRegisteredException&) - { - } - - adapter->deactivate(); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter1"); + Ice::ObjectPtr obj = new EmptyI; + adapter->add(obj, communicator->stringToIdentity("x")); + try + { + adapter->add(obj, communicator->stringToIdentity("x")); + test(false); + } + catch(const Ice::AlreadyRegisteredException&) + { + } + + adapter->remove(communicator->stringToIdentity("x")); + try + { + adapter->remove(communicator->stringToIdentity("x")); + test(false); + } + catch(const Ice::NotRegisteredException&) + { + } + + adapter->deactivate(); } tprintf("ok\n"); tprintf("testing stringToProxy..."); string ref = communicator->getProperties()->getPropertyWithDefault( - "Exception.Proxy", "thrower:default -p 12010 -t 10000"); + "Exception.Proxy", "thrower:default -p 12010 -t 10000"); Ice::ObjectPrx base = communicator->stringToProxy(ref); test(base); tprintf("ok\n"); @@ -165,80 +165,80 @@ allTests(const Ice::CommunicatorPtr& communicator) try { - thrower->throwAasA(1); - test(false); + thrower->throwAasA(1); + test(false); } catch(const A& ex) { - test(ex.aMem == 1); + test(ex.aMem == 1); } catch(const Ice::Exception& ex) { - tprintf("%s\n", ex.toString().c_str()); - test(false); + tprintf("%s\n", ex.toString().c_str()); + test(false); } catch(...) { - test(false); + test(false); } try { - thrower->throwAorDasAorD(1); - test(false); + thrower->throwAorDasAorD(1); + test(false); } catch(const A& ex) { - test(ex.aMem == 1); + test(ex.aMem == 1); } catch(...) { - test(false); + test(false); } try { - thrower->throwAorDasAorD(-1); - test(false); + thrower->throwAorDasAorD(-1); + test(false); } catch(const D& ex) { - test(ex.dMem == -1); + test(ex.dMem == -1); } catch(...) { - test(false); + test(false); } try { - thrower->throwBasB(1, 2); - test(false); + thrower->throwBasB(1, 2); + test(false); } catch(const B& ex) { - test(ex.aMem == 1); - test(ex.bMem == 2); + test(ex.aMem == 1); + test(ex.bMem == 2); } catch(...) { - test(false); + test(false); } try { - thrower->throwCasC(1, 2, 3); - test(false); + thrower->throwCasC(1, 2, 3); + test(false); } catch(const C& ex) { - test(ex.aMem == 1); - test(ex.bMem == 2); - test(ex.cMem == 3); + test(ex.aMem == 1); + test(ex.bMem == 2); + test(ex.cMem == 3); } catch(...) { - test(false); + test(false); } #if (!defined(_MSC_VER) || _MSC_VER >= 1300) @@ -247,23 +247,23 @@ allTests(const Ice::CommunicatorPtr& communicator) // try { - thrower->throwModA(1, 2); - test(false); + thrower->throwModA(1, 2); + test(false); } catch(const Mod::A& ex) { - test(ex.aMem == 1); - test(ex.a2Mem == 2); + test(ex.aMem == 1); + test(ex.a2Mem == 2); } catch(const Ice::OperationNotExistException&) { - // + // // This operation is not supported in Java. // } catch(...) { - test(false); + test(false); } #endif @@ -273,31 +273,31 @@ allTests(const Ice::CommunicatorPtr& communicator) try { - thrower->throwBasB(1, 2); - test(false); + thrower->throwBasB(1, 2); + test(false); } catch(const A& ex) { - test(ex.aMem == 1); + test(ex.aMem == 1); } catch(...) { - test(false); + test(false); } try { - thrower->throwCasC(1, 2, 3); - test(false); + thrower->throwCasC(1, 2, 3); + test(false); } catch(const B& ex) { - test(ex.aMem == 1); - test(ex.bMem == 2); + test(ex.aMem == 1); + test(ex.bMem == 2); } catch(...) { - test(false); + test(false); } #if (!defined(_MSC_VER) || _MSC_VER >= 1300) @@ -306,122 +306,122 @@ allTests(const Ice::CommunicatorPtr& communicator) // try { - thrower->throwModA(1, 2); - test(false); + thrower->throwModA(1, 2); + test(false); } catch(const A& ex) { - test(ex.aMem == 1); + test(ex.aMem == 1); } catch(const Ice::OperationNotExistException&) { - // + // // This operation is not supported in Java. // } catch(...) { - test(false); + test(false); } #endif tprintf("ok\n"); tprintf("catching derived types..."); - + try { - thrower->throwBasA(1, 2); - test(false); + thrower->throwBasA(1, 2); + test(false); } catch(const B& ex) { - test(ex.aMem == 1); - test(ex.bMem == 2); + test(ex.aMem == 1); + test(ex.bMem == 2); } catch(...) { - test(false); + test(false); } try { - thrower->throwCasA(1, 2, 3); - test(false); + thrower->throwCasA(1, 2, 3); + test(false); } catch(const C& ex) { - test(ex.aMem == 1); - test(ex.bMem == 2); - test(ex.cMem == 3); + test(ex.aMem == 1); + test(ex.bMem == 2); + test(ex.cMem == 3); } catch(...) { - test(false); + test(false); } try { - thrower->throwCasB(1, 2, 3); - test(false); + thrower->throwCasB(1, 2, 3); + test(false); } catch(const C& ex) { - test(ex.aMem == 1); - test(ex.bMem == 2); - test(ex.cMem == 3); + test(ex.aMem == 1); + test(ex.bMem == 2); + test(ex.cMem == 3); } catch(...) { - test(false); + test(false); } tprintf("ok\n"); if(thrower->supportsUndeclaredExceptions()) { - tprintf("catching unknown user exception..."); - - try - { - thrower->throwUndeclaredA(1); - test(false); - } - catch(const Ice::UnknownUserException&) - { - } - catch(...) - { - test(false); - } - - try - { - thrower->throwUndeclaredB(1, 2); - test(false); - } - catch(const Ice::UnknownUserException&) - { - } - catch(...) - { - test(false); - } - - try - { - thrower->throwUndeclaredC(1, 2, 3); - test(false); - } - catch(const Ice::UnknownUserException&) - { - } - catch(...) - { - test(false); - } - - tprintf("ok\n"); + tprintf("catching unknown user exception..."); + + try + { + thrower->throwUndeclaredA(1); + test(false); + } + catch(const Ice::UnknownUserException&) + { + } + catch(...) + { + test(false); + } + + try + { + thrower->throwUndeclaredB(1, 2); + test(false); + } + catch(const Ice::UnknownUserException&) + { + } + catch(...) + { + test(false); + } + + try + { + thrower->throwUndeclaredC(1, 2, 3); + test(false); + } + catch(const Ice::UnknownUserException&) + { + } + catch(...) + { + test(false); + } + + tprintf("ok\n"); } tprintf("catching object not exist exception..."); @@ -429,18 +429,18 @@ allTests(const Ice::CommunicatorPtr& communicator) Ice::Identity id = communicator->stringToIdentity("does not exist"); try { - ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower->ice_identity(id)); - thrower2->throwAasA(1); -// thrower2->ice_ping(); - test(false); + ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower->ice_identity(id)); + thrower2->throwAasA(1); +// thrower2->ice_ping(); + test(false); } catch(const Ice::ObjectNotExistException& ex) { - test(ex.id == id); + test(ex.id == id); } catch(...) { - test(false); + test(false); } tprintf("ok\n"); @@ -450,12 +450,12 @@ allTests(const Ice::CommunicatorPtr& communicator) ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower, "no such facet"); try { - thrower2->ice_ping(); - test(false); + thrower2->ice_ping(); + test(false); } catch(const Ice::FacetNotExistException& ex) { - test(ex.facet == "no such facet"); + test(ex.facet == "no such facet"); } tprintf("ok\n"); @@ -463,17 +463,17 @@ allTests(const Ice::CommunicatorPtr& communicator) try { - WrongOperationPrx thrower2 = WrongOperationPrx::uncheckedCast(thrower); - thrower2->noSuchOperation(); - test(false); + WrongOperationPrx thrower2 = WrongOperationPrx::uncheckedCast(thrower); + thrower2->noSuchOperation(); + test(false); } catch(const Ice::OperationNotExistException& ex) { - test(ex.operation == "noSuchOperation"); + test(ex.operation == "noSuchOperation"); } catch(...) { - test(false); + test(false); } tprintf("ok\n"); @@ -482,15 +482,15 @@ allTests(const Ice::CommunicatorPtr& communicator) try { - thrower->throwLocalException(); - test(false); + thrower->throwLocalException(); + test(false); } catch(const Ice::UnknownLocalException&) { } catch(...) { - test(false); + test(false); } tprintf("ok\n"); @@ -499,15 +499,15 @@ allTests(const Ice::CommunicatorPtr& communicator) try { - thrower->throwNonIceException(); - test(false); + thrower->throwNonIceException(); + test(false); } catch(const Ice::UnknownException&) { } catch(...) { - assert(false); + assert(false); } tprintf("ok\n"); diff --git a/cppe/test/IceE/exceptions/Client.cpp b/cppe/test/IceE/exceptions/Client.cpp index db5a032376c..8eb51491752 100644 --- a/cppe/test/IceE/exceptions/Client.cpp +++ b/cppe/test/IceE/exceptions/Client.cpp @@ -29,7 +29,7 @@ public: Ice::InitializationData initData; initData.properties = Ice::createProperties(); loadConfig(initData.properties); - initData.logger = getLogger(); + initData.logger = getLogger(); setCommunicator(Ice::initialize(argc, argv, initData)); ThrowerPrx allTests(const Ice::CommunicatorPtr&); diff --git a/cppe/test/IceE/exceptions/Collocated.cpp b/cppe/test/IceE/exceptions/Collocated.cpp index 840c87b2cac..1f782485520 100644 --- a/cppe/test/IceE/exceptions/Collocated.cpp +++ b/cppe/test/IceE/exceptions/Collocated.cpp @@ -27,13 +27,13 @@ public: run(int argc, char* argv[]) { Ice::InitializationData initData; - initData.properties = Ice::createProperties(); + initData.properties = Ice::createProperties(); - initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); initData.properties->setProperty("Ice.Warn.Dispatch", "0"); loadConfig(initData.properties); - initData.logger = getLogger(); + initData.logger = getLogger(); setCommunicator(Ice::initialize(argc, argv, initData)); Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter"); diff --git a/cppe/test/IceE/exceptions/Server.cpp b/cppe/test/IceE/exceptions/Server.cpp index 74d40626abd..3766b81011f 100644 --- a/cppe/test/IceE/exceptions/Server.cpp +++ b/cppe/test/IceE/exceptions/Server.cpp @@ -26,12 +26,12 @@ public: run(int argc, char* argv[]) { Ice::InitializationData initData; - initData.properties = Ice::createProperties(); + initData.properties = Ice::createProperties(); initData.properties->setProperty("Ice.Warn.Dispatch", "0"); initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); loadConfig(initData.properties); - initData.logger = getLogger(); + initData.logger = getLogger(); setCommunicator(Ice::initialize(argc, argv, initData)); Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter"); @@ -40,7 +40,7 @@ public: adapter->activate(); #ifndef _WIN32_WCE - communicator()->waitForShutdown(); + communicator()->waitForShutdown(); #endif return EXIT_SUCCESS; diff --git a/cppe/test/IceE/exceptions/Test.ice b/cppe/test/IceE/exceptions/Test.ice index aaa85038674..a8446418555 100644 --- a/cppe/test/IceE/exceptions/Test.ice +++ b/cppe/test/IceE/exceptions/Test.ice @@ -43,7 +43,7 @@ module Mod { exception A extends ::Test::A { - int a2Mem; + int a2Mem; }; }; diff --git a/cppe/test/IceE/exceptions/TestI.cpp b/cppe/test/IceE/exceptions/TestI.cpp index addf3c3bdae..72a0547cf6d 100644 --- a/cppe/test/IceE/exceptions/TestI.cpp +++ b/cppe/test/IceE/exceptions/TestI.cpp @@ -52,15 +52,15 @@ ThrowerI::throwAorDasAorD(Ice::Int a, const Ice::Current&) { if(a > 0) { - A ex; - ex.aMem = a; - throw ex; + A ex; + ex.aMem = a; + throw ex; } else { - D ex; - ex.dMem = a; - throw ex; + D ex; + ex.dMem = a; + throw ex; } } diff --git a/cppe/test/IceE/facets/AllTests.cpp b/cppe/test/IceE/facets/AllTests.cpp index 1618d592b48..4c33df3c372 100644 --- a/cppe/test/IceE/facets/AllTests.cpp +++ b/cppe/test/IceE/facets/AllTests.cpp @@ -28,8 +28,8 @@ allTests(const Ice::CommunicatorPtr& communicator) adapter->addFacet(obj, communicator->stringToIdentity("d"), "facetABCD"); try { - adapter->addFacet(obj, communicator->stringToIdentity("d"), "facetABCD"); - test(false); + adapter->addFacet(obj, communicator->stringToIdentity("d"), "facetABCD"); + test(false); } catch(Ice::AlreadyRegisteredException&) { @@ -37,8 +37,8 @@ allTests(const Ice::CommunicatorPtr& communicator) adapter->removeFacet(communicator->stringToIdentity("d"), "facetABCD"); try { - adapter->removeFacet(communicator->stringToIdentity("d"), "facetABCD"); - test(false); + adapter->removeFacet(communicator->stringToIdentity("d"), "facetABCD"); + test(false); } catch(Ice::NotRegisteredException&) { @@ -60,8 +60,8 @@ allTests(const Ice::CommunicatorPtr& communicator) test(fm["f2"] == obj2); try { - adapter->removeAllFacets(communicator->stringToIdentity("id1")); - test(false); + adapter->removeAllFacets(communicator->stringToIdentity("id1")); + test(false); } catch(Ice::NotRegisteredException&) { diff --git a/cppe/test/IceE/facets/Client.cpp b/cppe/test/IceE/facets/Client.cpp index 648bb51f897..759ff89500d 100644 --- a/cppe/test/IceE/facets/Client.cpp +++ b/cppe/test/IceE/facets/Client.cpp @@ -29,7 +29,7 @@ public: Ice::InitializationData initData; initData.properties = Ice::createProperties(); loadConfig(initData.properties); - initData.logger = getLogger(); + initData.logger = getLogger(); setCommunicator(Ice::initialize(argc, argv, initData)); GPrx allTests(const Ice::CommunicatorPtr&); diff --git a/cppe/test/IceE/facets/Collocated.cpp b/cppe/test/IceE/facets/Collocated.cpp index 5dd2b53ba2b..6783c38ef8c 100644 --- a/cppe/test/IceE/facets/Collocated.cpp +++ b/cppe/test/IceE/facets/Collocated.cpp @@ -27,11 +27,11 @@ public: run(int argc, char* argv[]) { Ice::InitializationData initData; - initData.properties = Ice::createProperties(); - initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + initData.properties = Ice::createProperties(); + initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); loadConfig(initData.properties); - initData.logger = getLogger(); + initData.logger = getLogger(); setCommunicator(Ice::initialize(argc, argv, initData)); Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter"); diff --git a/cppe/test/IceE/facets/Server.cpp b/cppe/test/IceE/facets/Server.cpp index 56761890a34..d19453c2418 100644 --- a/cppe/test/IceE/facets/Server.cpp +++ b/cppe/test/IceE/facets/Server.cpp @@ -26,11 +26,11 @@ public: run(int argc, char* argv[]) { Ice::InitializationData initData; - initData.properties = Ice::createProperties(); - initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + initData.properties = Ice::createProperties(); + initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); loadConfig(initData.properties); - initData.logger = getLogger(); + initData.logger = getLogger(); setCommunicator(Ice::initialize(argc, argv, initData)); Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter"); @@ -45,7 +45,7 @@ public: adapter->activate(); #ifndef _WIN32_WCE - communicator()->waitForShutdown(); + communicator()->waitForShutdown(); #endif return EXIT_SUCCESS; diff --git a/cppe/test/IceE/faultTolerance/AllTests.cpp b/cppe/test/IceE/faultTolerance/AllTests.cpp index 6419c459288..00ae6a200d9 100644 --- a/cppe/test/IceE/faultTolerance/AllTests.cpp +++ b/cppe/test/IceE/faultTolerance/AllTests.cpp @@ -20,7 +20,7 @@ class CallbackBase : public IceUtil::Monitor<IceUtil::Mutex> public: CallbackBase() : - _called(false) + _called(false) { } @@ -30,26 +30,26 @@ public: bool check() { - IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); - while(!_called) - { - if(!timedWait(IceUtil::Time::seconds(30))) - { - return false; - } - } - _called = false; - return true; + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + while(!_called) + { + if(!timedWait(IceUtil::Time::seconds(30))) + { + return false; + } + } + _called = false; + return true; } protected: void called() { - IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); - assert(!_called); - _called = true; - notify(); + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + assert(!_called); + _called = true; + notify(); } private: @@ -67,7 +67,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const vector<int>& ports) for(vector<int>::const_iterator p = ports.begin(); p != ports.end(); ++p) { sprintf(buf, ":default -t 60000 -p %d", *p); - ref += buf; + ref += buf; } Ice::ObjectPrx base = communicator->stringToProxy(ref); test(base); @@ -82,73 +82,73 @@ allTests(const Ice::CommunicatorPtr& communicator, const vector<int>& ports) int oldPid = 0; for(unsigned int i = 1, j = 0; i <= ports.size(); ++i, ++j) { - if(j > 3) - { - j = 0; - } - - tprintf("testing server #%d...", i); - int pid = obj->pid(); - test(pid != oldPid); - tprintf("ok\n"); - oldPid = pid; - - if(j == 0) - { - tprintf("shutting down server #%d...", i); - obj->shutdown(); - tprintf("ok\n"); - } - else if(j == 1 || i + 1 > ports.size()) - { - tprintf("aborting server #%d...", i); - try - { - obj->abort(); - test(false); - } - catch(const Ice::ConnectionLostException&) - { - tprintf("ok\n"); - } - catch(const Ice::ConnectFailedException&) - { - tprintf("ok\n"); - } - } - else if(j == 2 || j == 3) - { - tprintf("aborting server #%d and #%d with idempotent call...", i, i + 1); - try - { - obj->idempotentAbort(); - test(false); - } - catch(const Ice::ConnectionLostException&) - { - tprintf("ok\n"); - } - catch(const Ice::ConnectFailedException&) - { - tprintf("ok\n"); - } - - ++i; - } - else - { - assert(false); - } + if(j > 3) + { + j = 0; + } + + tprintf("testing server #%d...", i); + int pid = obj->pid(); + test(pid != oldPid); + tprintf("ok\n"); + oldPid = pid; + + if(j == 0) + { + tprintf("shutting down server #%d...", i); + obj->shutdown(); + tprintf("ok\n"); + } + else if(j == 1 || i + 1 > ports.size()) + { + tprintf("aborting server #%d...", i); + try + { + obj->abort(); + test(false); + } + catch(const Ice::ConnectionLostException&) + { + tprintf("ok\n"); + } + catch(const Ice::ConnectFailedException&) + { + tprintf("ok\n"); + } + } + else if(j == 2 || j == 3) + { + tprintf("aborting server #%d and #%d with idempotent call...", i, i + 1); + try + { + obj->idempotentAbort(); + test(false); + } + catch(const Ice::ConnectionLostException&) + { + tprintf("ok\n"); + } + catch(const Ice::ConnectFailedException&) + { + tprintf("ok\n"); + } + + ++i; + } + else + { + assert(false); + } } tprintf("testing whether all servers are gone..."); try { - obj->ice_ping(); - test(false); + obj->ice_ping(); + test(false); } catch(const Ice::LocalException&) { - tprintf("ok\n"); + tprintf("ok\n"); } } diff --git a/cppe/test/IceE/faultTolerance/Client.cpp b/cppe/test/IceE/faultTolerance/Client.cpp index 0ec60e1dc98..2b02da88245 100644 --- a/cppe/test/IceE/faultTolerance/Client.cpp +++ b/cppe/test/IceE/faultTolerance/Client.cpp @@ -31,45 +31,45 @@ public: virtual int run(int argc, char* argv[]) { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(); + Ice::InitializationData initData; + initData.properties = Ice::createProperties(); loadConfig(initData.properties); - // - // This test aborts servers, so we don't want warnings. - // - setCommunicator(Ice::initialize(argc, argv, initData)); - communicator()->getProperties()->setProperty("Ice.Warn.Connections", "0"); + // + // This test aborts servers, so we don't want warnings. + // + setCommunicator(Ice::initialize(argc, argv, initData)); + communicator()->getProperties()->setProperty("Ice.Warn.Connections", "0"); vector<int> ports; for(int i = 1; i < argc; ++i) { - if(argv[i][0] == '-') - { - tprintf("%s: unknown option `%s'\n", argv[0], argv[i]); - usage(argv[0]); - return EXIT_FAILURE; - } + if(argv[i][0] == '-') + { + tprintf("%s: unknown option `%s'\n", argv[0], argv[i]); + usage(argv[0]); + return EXIT_FAILURE; + } - ports.push_back(atoi(argv[i])); + ports.push_back(atoi(argv[i])); } if(ports.empty()) { - tprintf("%s: no ports specified\n", argv[0]); - usage(argv[0]); - return EXIT_FAILURE; + tprintf("%s: no ports specified\n", argv[0]); + usage(argv[0]); + return EXIT_FAILURE; } try { - void allTests(const Ice::CommunicatorPtr&, const vector<int>&); - allTests(communicator(), ports); + void allTests(const Ice::CommunicatorPtr&, const vector<int>&); + allTests(communicator(), ports); } catch(const Ice::Exception& ex) { - tprintf("%s\n", ex.toString().c_str()); - test(false); + tprintf("%s\n", ex.toString().c_str()); + test(false); } return EXIT_SUCCESS; diff --git a/cppe/test/IceE/faultTolerance/Server.cpp b/cppe/test/IceE/faultTolerance/Server.cpp index dd40afbf034..b5aa9db8cc1 100644 --- a/cppe/test/IceE/faultTolerance/Server.cpp +++ b/cppe/test/IceE/faultTolerance/Server.cpp @@ -35,34 +35,34 @@ public: Ice::InitializationData initData; initData.properties = Ice::createProperties(); loadConfig(initData.properties); - initData.logger = getLogger(); + initData.logger = getLogger(); setCommunicator(Ice::initialize(argc, argv, initData)); int port = 0; for(int i = 1; i < argc; ++i) { - if(argv[i][0] == '-') - { - tprintf("%s: unknown option `%s'\n", argv[0], argv[i]); - usage(argv[0]); - return EXIT_FAILURE; - } + if(argv[i][0] == '-') + { + tprintf("%s: unknown option `%s'\n", argv[0], argv[i]); + usage(argv[0]); + return EXIT_FAILURE; + } - if(port > 0) - { - tprintf("%s: only one port can be specified\n", argv[0]); - usage(argv[0]); - return EXIT_FAILURE; - } + if(port > 0) + { + tprintf("%s: only one port can be specified\n", argv[0]); + usage(argv[0]); + return EXIT_FAILURE; + } - port = atoi(argv[i]); + port = atoi(argv[i]); } if(port <= 0) { - tprintf("%s: no port specified\n", argv[0]); - usage(argv[0]); - return EXIT_FAILURE; + tprintf("%s: no port specified\n", argv[0]); + usage(argv[0]); + return EXIT_FAILURE; } char buf[32]; diff --git a/cppe/test/IceE/inheritance/AllTests.cpp b/cppe/test/IceE/inheritance/AllTests.cpp index 2717bd60594..3b5c26becf4 100644 --- a/cppe/test/IceE/inheritance/AllTests.cpp +++ b/cppe/test/IceE/inheritance/AllTests.cpp @@ -19,7 +19,7 @@ allTests(const Ice::CommunicatorPtr& communicator) { tprintf("testing stringToProxy..."); string ref = communicator->getProperties()->getPropertyWithDefault( - "Inheritance.Proxy", "initial:default -p 12010 -t 10000"); + "Inheritance.Proxy", "initial:default -p 12010 -t 10000"); Ice::ObjectPrx base = communicator->stringToProxy(ref); test(base); tprintf("ok\n"); diff --git a/cppe/test/IceE/inheritance/Client.cpp b/cppe/test/IceE/inheritance/Client.cpp index a070bb15aef..252454ded15 100644 --- a/cppe/test/IceE/inheritance/Client.cpp +++ b/cppe/test/IceE/inheritance/Client.cpp @@ -29,7 +29,7 @@ public: Ice::InitializationData initData; initData.properties = Ice::createProperties(); loadConfig(initData.properties); - initData.logger = getLogger(); + initData.logger = getLogger(); setCommunicator(Ice::initialize(argc, argv, initData)); InitialPrx allTests(const Ice::CommunicatorPtr&); diff --git a/cppe/test/IceE/inheritance/Collocated.cpp b/cppe/test/IceE/inheritance/Collocated.cpp index 279f6e6334d..009cf007a60 100644 --- a/cppe/test/IceE/inheritance/Collocated.cpp +++ b/cppe/test/IceE/inheritance/Collocated.cpp @@ -27,11 +27,11 @@ public: run(int argc, char* argv[]) { Ice::InitializationData initData; - initData.properties = Ice::createProperties(); + initData.properties = Ice::createProperties(); initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); loadConfig(initData.properties); - initData.logger = getLogger(); + initData.logger = getLogger(); setCommunicator(Ice::initialize(argc, argv, initData)); Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter"); diff --git a/cppe/test/IceE/inheritance/Server.cpp b/cppe/test/IceE/inheritance/Server.cpp index 819a636903c..1ef7faa4849 100644 --- a/cppe/test/IceE/inheritance/Server.cpp +++ b/cppe/test/IceE/inheritance/Server.cpp @@ -25,12 +25,12 @@ public: virtual int run(int argc, char* argv[]) { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(); + Ice::InitializationData initData; + initData.properties = Ice::createProperties(); initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); loadConfig(initData.properties); - initData.logger = getLogger(); + initData.logger = getLogger(); setCommunicator(Ice::initialize(argc, argv, initData)); Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter"); @@ -39,7 +39,7 @@ public: adapter->activate(); #ifndef _WIN32_WCE - communicator()->waitForShutdown(); + communicator()->waitForShutdown(); #endif return EXIT_SUCCESS; diff --git a/cppe/test/IceE/inheritance/TestI.h b/cppe/test/IceE/inheritance/TestI.h index c6142467982..44d23af9e69 100644 --- a/cppe/test/IceE/inheritance/TestI.h +++ b/cppe/test/IceE/inheritance/TestI.h @@ -74,7 +74,7 @@ class IB1I : virtual public Test::MB::IB1, virtual public IAI { public: - virtual Test::MB::IB1Prx ib1op(const Test::MB::IB1Prx&, const Ice::Current&); + virtual Test::MB::IB1Prx ib1op(const Test::MB::IB1Prx&, const Ice::Current&); }; class IB2I : virtual public Test::MB::IB2, virtual public IAI diff --git a/cppe/test/IceE/location/AllTests.cpp b/cppe/test/IceE/location/AllTests.cpp index 4d751fd8c57..7d423792675 100644 --- a/cppe/test/IceE/location/AllTests.cpp +++ b/cppe/test/IceE/location/AllTests.cpp @@ -27,9 +27,9 @@ void allTests(const Ice::CommunicatorPtr& communicator) { ServerManagerPrx manager = ServerManagerPrx::checkedCast( - communicator->stringToProxy( - communicator->getProperties()->getPropertyWithDefault( - "Location.Proxy", "ServerManager:default -p 12010 -t 10000"))); + communicator->stringToProxy( + communicator->getProperties()->getPropertyWithDefault( + "Location.Proxy", "ServerManager:default -p 12010 -t 10000"))); Ice::LocatorPrx locator = Ice::LocatorPrx::uncheckedCast(communicator->getDefaultLocator()); test(manager); @@ -102,12 +102,12 @@ allTests(const Ice::CommunicatorPtr& communicator) manager->startServer(); try { - obj2 = TestIntfPrx::checkedCast(base2); - obj2->ice_ping(); + obj2 = TestIntfPrx::checkedCast(base2); + obj2->ice_ping(); } catch(const Ice::LocalException&) { - test(false); + test(false); } tprintf("ok\n"); @@ -116,12 +116,12 @@ allTests(const Ice::CommunicatorPtr& communicator) manager->startServer(); try { - obj6 = TestIntfPrx::checkedCast(base6); - obj6->ice_ping(); + obj6 = TestIntfPrx::checkedCast(base6); + obj6->ice_ping(); } catch(const Ice::LocalException&) { - test(false); + test(false); } tprintf("ok\n"); @@ -130,115 +130,115 @@ allTests(const Ice::CommunicatorPtr& communicator) manager->startServer(); try { - obj3 = TestIntfPrx::checkedCast(base3); - obj3->ice_ping(); + obj3 = TestIntfPrx::checkedCast(base3); + obj3->ice_ping(); } catch(const Ice::LocalException&) { - test(false); + test(false); } try { - obj2 = TestIntfPrx::checkedCast(base2); - obj2->ice_ping(); + obj2 = TestIntfPrx::checkedCast(base2); + obj2->ice_ping(); } catch(const Ice::LocalException&) { - test(false); + test(false); } obj->shutdown(); manager->startServer(); try { - obj2 = TestIntfPrx::checkedCast(base2); - obj2->ice_ping(); + obj2 = TestIntfPrx::checkedCast(base2); + obj2->ice_ping(); } catch(const Ice::LocalException&) { - test(false); + test(false); } try { - obj3 = TestIntfPrx::checkedCast(base3); - obj3->ice_ping(); + obj3 = TestIntfPrx::checkedCast(base3); + obj3->ice_ping(); } catch(const Ice::LocalException&) { - test(false); + test(false); } obj->shutdown(); manager->startServer(); try { - obj2 = TestIntfPrx::checkedCast(base2); - obj2->ice_ping(); + obj2 = TestIntfPrx::checkedCast(base2); + obj2->ice_ping(); } catch(const Ice::LocalException&) { - test(false); + test(false); } obj->shutdown(); manager->startServer(); try { - obj3 = TestIntfPrx::checkedCast(base3); - obj3->ice_ping(); + obj3 = TestIntfPrx::checkedCast(base3); + obj3->ice_ping(); } catch(const Ice::LocalException&) { - test(false); + test(false); } obj->shutdown(); manager->startServer(); try { - obj2 = TestIntfPrx::checkedCast(base2); - obj2->ice_ping(); + obj2 = TestIntfPrx::checkedCast(base2); + obj2->ice_ping(); } catch(const Ice::LocalException&) { - test(false); + test(false); } obj->shutdown(); manager->startServer(); try { - obj5 = TestIntfPrx::checkedCast(base5); - obj5->ice_ping(); + obj5 = TestIntfPrx::checkedCast(base5); + obj5->ice_ping(); } catch(const Ice::LocalException&) { - test(false); + test(false); } tprintf("ok\n"); tprintf("testing reference with unknown identity..."); try { - base = communicator->stringToProxy("unknown/unknown"); - base->ice_ping(); - test(false); + base = communicator->stringToProxy("unknown/unknown"); + base->ice_ping(); + test(false); } catch (const Ice::NotRegisteredException& ex) { - test(ex.kindOfObject == "object"); - test(ex.id == "unknown/unknown"); + test(ex.kindOfObject == "object"); + test(ex.id == "unknown/unknown"); } tprintf("ok\n"); tprintf("testing reference with unknown adapter..."); try { - base = communicator->stringToProxy("test @ TestAdapterUnknown"); - base->ice_ping(); - test(false); + base = communicator->stringToProxy("test @ TestAdapterUnknown"); + base->ice_ping(); + test(false); } catch (const Ice::NotRegisteredException& ex) { - test(ex.kindOfObject == "object adapter"); - test(ex.id == "TestAdapterUnknown"); + test(ex.kindOfObject == "object adapter"); + test(ex.id == "TestAdapterUnknown"); } tprintf("ok\n"); @@ -274,24 +274,24 @@ allTests(const Ice::CommunicatorPtr& communicator) tprintf("testing whether server is gone..."); try { - obj2->ice_ping(); - test(false); + obj2->ice_ping(); + test(false); } catch(const Ice::LocalException&) { } try { - obj3->ice_ping(); - test(false); + obj3->ice_ping(); + test(false); } catch(const Ice::LocalException&) { } try { - obj5->ice_ping(); - test(false); + obj5->ice_ping(); + test(false); } catch(const Ice::LocalException&) { diff --git a/cppe/test/IceE/location/Client.cpp b/cppe/test/IceE/location/Client.cpp index 9e4b52d9410..e0c06ab82d8 100644 --- a/cppe/test/IceE/location/Client.cpp +++ b/cppe/test/IceE/location/Client.cpp @@ -29,25 +29,25 @@ public: run(int argc, char* argv[]) { Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + initData.properties = Ice::createProperties(argc, argv); loadConfig(initData.properties); - // - // For blocking client change retry interval from default. - // - if(initData.properties->getPropertyAsInt("Ice.Blocking") > 0) - { - initData.properties->setProperty("Ice.RetryIntervals", "0 0"); - initData.properties->setProperty("Ice.Warn.Connections", "0"); - } - - initData.properties->setProperty("Ice.Default.Locator", - initData.properties->getPropertyWithDefault("Location.Locator", "locator:default -p 12010")); - initData.logger = getLogger(); + // + // For blocking client change retry interval from default. + // + if(initData.properties->getPropertyAsInt("Ice.Blocking") > 0) + { + initData.properties->setProperty("Ice.RetryIntervals", "0 0"); + initData.properties->setProperty("Ice.Warn.Connections", "0"); + } + + initData.properties->setProperty("Ice.Default.Locator", + initData.properties->getPropertyWithDefault("Location.Locator", "locator:default -p 12010")); + initData.logger = getLogger(); setCommunicator(Ice::initialize(argc, argv, initData)); void allTests(const Ice::CommunicatorPtr&); - allTests(communicator()); + allTests(communicator()); return EXIT_SUCCESS; } diff --git a/cppe/test/IceE/location/Server.cpp b/cppe/test/IceE/location/Server.cpp index d600275c265..21d6d1c23eb 100644 --- a/cppe/test/IceE/location/Server.cpp +++ b/cppe/test/IceE/location/Server.cpp @@ -29,34 +29,34 @@ public: virtual int run(int argc, char* argv[]) { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData; + initData.properties = Ice::createProperties(argc, argv); initData.properties->setProperty("ServerManager.Endpoints", "default -p 12010"); loadConfig(initData.properties); - // - // For blocking client test, set timeout so CloseConnection send will - // return quickly. Otherwise server will hang since client is not - // listening for these messages. - // - if(initData.properties->getPropertyAsInt("Ice.Blocking") > 0) - { - initData.properties->setProperty("Ice.Override.Timeout", "100"); - initData.properties->setProperty("Ice.Warn.Connections", "0"); - } - - // - // These properties cannot be overridden. The OAs started by - // the ServerManager must be local. - // - initData.properties->setProperty("TestAdapter.Endpoints", "default"); - initData.properties->setProperty("TestAdapter.AdapterId", "TestAdapter"); - initData.properties->setProperty("TestAdapter.ReplicaGroupId", "ReplicatedAdapter"); - initData.properties->setProperty("TestAdapter2.Endpoints", "default"); - initData.properties->setProperty("TestAdapter2.AdapterId", "TestAdapter2"); - - initData.logger = getLogger(); + // + // For blocking client test, set timeout so CloseConnection send will + // return quickly. Otherwise server will hang since client is not + // listening for these messages. + // + if(initData.properties->getPropertyAsInt("Ice.Blocking") > 0) + { + initData.properties->setProperty("Ice.Override.Timeout", "100"); + initData.properties->setProperty("Ice.Warn.Connections", "0"); + } + + // + // These properties cannot be overridden. The OAs started by + // the ServerManager must be local. + // + initData.properties->setProperty("TestAdapter.Endpoints", "default"); + initData.properties->setProperty("TestAdapter.AdapterId", "TestAdapter"); + initData.properties->setProperty("TestAdapter.ReplicaGroupId", "ReplicatedAdapter"); + initData.properties->setProperty("TestAdapter2.Endpoints", "default"); + initData.properties->setProperty("TestAdapter2.AdapterId", "TestAdapter2"); + + initData.logger = getLogger(); setCommunicator(Ice::initialize(argc, argv, initData)); // @@ -78,7 +78,7 @@ public: adapter->add(object, communicator()->stringToIdentity("ServerManager")); Ice::LocatorRegistryPrx registryPrx = - Ice::LocatorRegistryPrx::uncheckedCast(adapter->add(registry, communicator()->stringToIdentity("registry"))); + Ice::LocatorRegistryPrx::uncheckedCast(adapter->add(registry, communicator()->stringToIdentity("registry"))); Ice::LocatorPtr locator = new ServerLocator(registry, registryPrx); adapter->add(locator, communicator()->stringToIdentity("locator")); @@ -86,7 +86,7 @@ public: adapter->activate(); #ifndef _WIN32_WCE - communicator()->waitForShutdown(); + communicator()->waitForShutdown(); #endif return EXIT_SUCCESS; diff --git a/cppe/test/IceE/location/ServerLocator.cpp b/cppe/test/IceE/location/ServerLocator.cpp index 03b5aec3986..32ca76d6925 100644 --- a/cppe/test/IceE/location/ServerLocator.cpp +++ b/cppe/test/IceE/location/ServerLocator.cpp @@ -23,14 +23,14 @@ ServerLocatorRegistry::ServerLocatorRegistry() void ServerLocatorRegistry::setAdapterDirectProxy(const ::std::string& adapter, const ::Ice::ObjectPrx& object, - const ::Ice::Current&) + const ::Ice::Current&) { _adapters[adapter] = object; } void ServerLocatorRegistry::setReplicatedAdapterDirectProxy(const std::string& adapter, const std::string& replicaId, - const ::Ice::ObjectPrx& object, const ::Ice::Current&) + const ::Ice::ObjectPrx& object, const ::Ice::Current&) { _adapters[adapter] = object; _adapters[replicaId] = object; @@ -42,7 +42,7 @@ ServerLocatorRegistry::getAdapter(const ::std::string& adapter) const ::std::map< string, ::Ice::ObjectPrx>::const_iterator p = _adapters.find(adapter); if(_adapters.find(adapter) == _adapters.end()) { - throw Ice::AdapterNotFoundException(); + throw Ice::AdapterNotFoundException(); } return p->second; } @@ -53,7 +53,7 @@ ServerLocatorRegistry::getObject(const ::Ice::Identity& id) const ::std::map< ::Ice::Identity, ::Ice::ObjectPrx>::const_iterator p = _objects.find(id); if(p == _objects.end()) { - throw Ice::ObjectNotFoundException(); + throw Ice::ObjectNotFoundException(); } return p->second; diff --git a/cppe/test/IceE/location/ServerLocator.h b/cppe/test/IceE/location/ServerLocator.h index de2aa01ed89..f9282b9b6d0 100644 --- a/cppe/test/IceE/location/ServerLocator.h +++ b/cppe/test/IceE/location/ServerLocator.h @@ -25,7 +25,7 @@ public: virtual void setAdapterDirectProxy(const ::std::string&, const ::Ice::ObjectPrx&, const ::Ice::Current&); virtual void setReplicatedAdapterDirectProxy(const std::string&, const ::std::string&, const ::Ice::ObjectPrx&, - const ::Ice::Current&); + const ::Ice::Current&); // // Internal method diff --git a/cppe/test/IceE/location/TestI.cpp b/cppe/test/IceE/location/TestI.cpp index 98e03f4cd53..7ad7e25aec6 100644 --- a/cppe/test/IceE/location/TestI.cpp +++ b/cppe/test/IceE/location/TestI.cpp @@ -19,7 +19,7 @@ using namespace Test; ServerManagerI::ServerManagerI(const Ice::ObjectAdapterPtr& adapter, const ServerLocatorRegistryPtr& registry, - const Ice::InitializationData& initData) : + const Ice::InitializationData& initData) : _adapter(adapter), _registry(registry), _initData(initData) { @@ -32,8 +32,8 @@ ServerManagerI::startServer(const Ice::Current&) { for(::std::vector<Ice::CommunicatorPtr>::const_iterator i = _communicators.begin(); i != _communicators.end(); ++i) { - (*i)->waitForShutdown(); - (*i)->destroy(); + (*i)->waitForShutdown(); + (*i)->destroy(); } _communicators.clear(); @@ -78,7 +78,7 @@ ServerManagerI::shutdown(const Ice::Current&) // for(::std::vector<Ice::CommunicatorPtr>::const_iterator i = _communicators.begin(); i != _communicators.end(); ++i) { - (*i)->destroy(); + (*i)->destroy(); } _adapter->getCommunicator()->shutdown(); #ifdef _WIN32_WCE @@ -87,8 +87,8 @@ ServerManagerI::shutdown(const Ice::Current&) } TestI::TestI(const Ice::ObjectAdapterPtr& adapter, - const Ice::ObjectAdapterPtr& adapter2, - const ServerLocatorRegistryPtr& registry) : + const Ice::ObjectAdapterPtr& adapter2, + const ServerLocatorRegistryPtr& registry) : _adapter1(adapter), _adapter2(adapter2), _registry(registry) { _registry->addObject(_adapter1->add(new HelloI(), _adapter1->getCommunicator()->stringToIdentity("hello"))); @@ -104,7 +104,7 @@ HelloPrx TestI::getHello(const Ice::Current&) { return HelloPrx::uncheckedCast(_adapter1->createIndirectProxy( - _adapter1->getCommunicator()->stringToIdentity("hello"))); + _adapter1->getCommunicator()->stringToIdentity("hello"))); } HelloPrx @@ -119,11 +119,11 @@ TestI::migrateHello(const Ice::Current&) const Ice::Identity id = _adapter1->getCommunicator()->stringToIdentity("hello"); try { - _registry->addObject(_adapter2->add(_adapter1->remove(id), id)); + _registry->addObject(_adapter2->add(_adapter1->remove(id), id)); } catch(Ice::NotRegisteredException&) { - _registry->addObject(_adapter1->add(_adapter2->remove(id), id)); + _registry->addObject(_adapter1->add(_adapter2->remove(id), id)); } } diff --git a/cppe/test/IceE/location/TestI.h b/cppe/test/IceE/location/TestI.h index 1cd4f1264b0..2b0286faa9b 100644 --- a/cppe/test/IceE/location/TestI.h +++ b/cppe/test/IceE/location/TestI.h @@ -23,7 +23,7 @@ class ServerManagerI : public Test::ServerManager public: ServerManagerI(const Ice::ObjectAdapterPtr&, const ServerLocatorRegistryPtr&, - const Ice::InitializationData&); + const Ice::InitializationData&); virtual void startServer(const Ice::Current&); virtual void shutdown(const Ice::Current&); diff --git a/cppe/test/IceE/operations/AllTests.cpp b/cppe/test/IceE/operations/AllTests.cpp index 81533420a85..668658ddbc7 100644 --- a/cppe/test/IceE/operations/AllTests.cpp +++ b/cppe/test/IceE/operations/AllTests.cpp @@ -18,7 +18,7 @@ Test::MyClassPrx allTests(const Ice::CommunicatorPtr& communicator, const Ice::InitializationData& initData) { string ref = communicator->getProperties()->getPropertyWithDefault( - "Operations.Proxy", "test:default -p 12010 -t 10000"); + "Operations.Proxy", "test:default -p 12010 -t 10000"); Ice::ObjectPrx base = communicator->stringToProxy(ref); Test::MyClassPrx cl = Test::MyClassPrx::checkedCast(base); Test::MyDerivedClassPrx derived = Test::MyDerivedClassPrx::checkedCast(cl); @@ -27,8 +27,8 @@ allTests(const Ice::CommunicatorPtr& communicator, const Ice::InitializationData Test::MyClassPrx clTimeout = Test::MyClassPrx::uncheckedCast(cl->ice_timeout(500)); try { - clTimeout->opSleep(2000); - test(false); + clTimeout->opSleep(2000); + test(false); } catch(const Ice::TimeoutException&) { diff --git a/cppe/test/IceE/operations/BatchOneways.cpp b/cppe/test/IceE/operations/BatchOneways.cpp index 289ac8b10a1..e06f351826e 100644 --- a/cppe/test/IceE/operations/BatchOneways.cpp +++ b/cppe/test/IceE/operations/BatchOneways.cpp @@ -22,32 +22,32 @@ batchOneways(const Test::MyClassPrx& p) try { - p->opByteSOneway(bs1); - test(true); + p->opByteSOneway(bs1); + test(true); } catch(const Ice::MemoryLimitException&) { - test(false); + test(false); } try { - p->opByteSOneway(bs2); - test(true); + p->opByteSOneway(bs2); + test(true); } catch(const Ice::MemoryLimitException&) { - test(false); + test(false); } try { - p->opByteSOneway(bs3); - test(false); + p->opByteSOneway(bs3); + test(false); } catch(const Ice::MemoryLimitException&) { - test(true); + test(true); } Test::MyClassPrx batch = Test::MyClassPrx::uncheckedCast(p->ice_batchOneway()); @@ -56,15 +56,15 @@ batchOneways(const Test::MyClassPrx& p) for(i = 0 ; i < 30 ; ++i) { - try - { - batch->opByteSOneway(bs1); - test(true); - } - catch(const Ice::MemoryLimitException&) - { - test(false); - } + try + { + batch->opByteSOneway(bs1); + test(true); + } + catch(const Ice::MemoryLimitException&) + { + test(false); + } } batch->ice_getConnection()->flushBatchRequests(); diff --git a/cppe/test/IceE/operations/Client.cpp b/cppe/test/IceE/operations/Client.cpp index f20f755f089..9f5b7d23266 100644 --- a/cppe/test/IceE/operations/Client.cpp +++ b/cppe/test/IceE/operations/Client.cpp @@ -26,29 +26,29 @@ public: virtual int run(int argc, char* argv[]) { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(); - // - // We must set MessageSizeMax to an explicit values, because - // we run tests to check whether Ice.MemoryLimitException is - // raised as expected. - // - initData.properties->setProperty("Ice.MessageSizeMax", "100"); - - loadConfig(initData.properties); - - // - // Now parse argc/argv into initData - // - initData.properties = Ice::createProperties(argc, argv, initData.properties); - - initData.logger = getLogger(); - setCommunicator(Ice::initialize(argc, argv, initData)); - - // - // We don't want connection warnings because of the timeout test. - // - communicator()->getProperties()->setProperty("Ice.Warn.Connections", "0"); + Ice::InitializationData initData; + initData.properties = Ice::createProperties(); + // + // We must set MessageSizeMax to an explicit values, because + // we run tests to check whether Ice.MemoryLimitException is + // raised as expected. + // + initData.properties->setProperty("Ice.MessageSizeMax", "100"); + + loadConfig(initData.properties); + + // + // Now parse argc/argv into initData + // + initData.properties = Ice::createProperties(argc, argv, initData.properties); + + initData.logger = getLogger(); + setCommunicator(Ice::initialize(argc, argv, initData)); + + // + // We don't want connection warnings because of the timeout test. + // + communicator()->getProperties()->setProperty("Ice.Warn.Connections", "0"); Test::MyClassPrx allTests(const Ice::CommunicatorPtr&, const Ice::InitializationData&); Test::MyClassPrx myClass = allTests(communicator(), initData); @@ -57,8 +57,8 @@ public: myClass->shutdown(); try { - myClass->opVoid(); - test(false); + myClass->opVoid(); + test(false); } catch(const Ice::LocalException&) { diff --git a/cppe/test/IceE/operations/Collocated.cpp b/cppe/test/IceE/operations/Collocated.cpp index 467ce78063f..4285fbac0d2 100644 --- a/cppe/test/IceE/operations/Collocated.cpp +++ b/cppe/test/IceE/operations/Collocated.cpp @@ -26,26 +26,26 @@ public: virtual int run(int argc, char* argv[]) { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(); - - // - // We must set MessageSizeMax to an explicit values, because - // we run tests to check whether Ice.MemoryLimitException is - // raised as expected. - // - initData.properties->setProperty("Ice.MessageSizeMax", "100"); - initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); - - loadConfig(initData.properties); - - // - // Now parse argc/argv into initData.properties - // - initData.properties = Ice::createProperties(argc, argv, initData.properties); - - initData.logger = getLogger(); - setCommunicator(Ice::initialize(argc, argv, initData)); + Ice::InitializationData initData; + initData.properties = Ice::createProperties(); + + // + // We must set MessageSizeMax to an explicit values, because + // we run tests to check whether Ice.MemoryLimitException is + // raised as expected. + // + initData.properties->setProperty("Ice.MessageSizeMax", "100"); + initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + + loadConfig(initData.properties); + + // + // Now parse argc/argv into initData.properties + // + initData.properties = Ice::createProperties(argc, argv, initData.properties); + + initData.logger = getLogger(); + setCommunicator(Ice::initialize(argc, argv, initData)); Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter"); adapter->add(new MyDerivedClassI, communicator()->stringToIdentity("test")); diff --git a/cppe/test/IceE/operations/Server.cpp b/cppe/test/IceE/operations/Server.cpp index 3230ea5f079..8f52f004698 100644 --- a/cppe/test/IceE/operations/Server.cpp +++ b/cppe/test/IceE/operations/Server.cpp @@ -27,16 +27,16 @@ public: run(int argc, char* argv[]) { Ice::InitializationData initData; - initData.properties = Ice::createProperties(); + initData.properties = Ice::createProperties(); - initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); - //initData.properties->setProperty("Ice.Trace.Network", "5"); - //initData.properties->setProperty("Ice.Trace.Protocol", "5"); + initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + //initData.properties->setProperty("Ice.Trace.Network", "5"); + //initData.properties->setProperty("Ice.Trace.Protocol", "5"); - loadConfig(initData.properties); - initData.logger = getLogger(); - setCommunicator(Ice::initialize(argc, argv, initData)); - + loadConfig(initData.properties); + initData.logger = getLogger(); + setCommunicator(Ice::initialize(argc, argv, initData)); + Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter"); adapter->add(new MyDerivedClassI, communicator()->stringToIdentity("test")); adapter->activate(); diff --git a/cppe/test/IceE/operations/Test.ice b/cppe/test/IceE/operations/Test.ice index 16769c4f97b..8363b373ac1 100644 --- a/cppe/test/IceE/operations/Test.ice +++ b/cppe/test/IceE/operations/Test.ice @@ -73,75 +73,75 @@ class MyClass void opSleep(int duration); byte opByte(byte p1, byte p2, - out byte p3); + out byte p3); bool opBool(bool p1, bool p2, - out bool p3); + out bool p3); long opShortIntLong(short p1, int p2, long p3, - out short p4, out int p5, out long p6); + out short p4, out int p5, out long p6); double opFloatDouble(float p1, double p2, - out float p3, out double p4); + out float p3, out double p4); string opString(string p1, string p2, - out string p3); + out string p3); MyEnum opMyEnum(MyEnum p1, out MyEnum p2); MyClass* opMyClass(MyClass* p1, out MyClass* p2, out MyClass* p3); Structure opStruct(Structure p1, Structure p2, - out Structure p3); + out Structure p3); ByteS opByteS(ByteS p1, ByteS p2, - out ByteS p3); + out ByteS p3); BoolS opBoolS(BoolS p1, BoolS p2, - out BoolS p3); + out BoolS p3); LongS opShortIntLongS(Test::ShortS p1, IntS p2, LongS p3, - out ::Test::ShortS p4, out IntS p5, out LongS p6); + out ::Test::ShortS p4, out IntS p5, out LongS p6); DoubleS opFloatDoubleS(FloatS p1, DoubleS p2, - out FloatS p3, out DoubleS p4); + out FloatS p3, out DoubleS p4); StringS opStringS(StringS p1, StringS p2, - out StringS p3); + out StringS p3); ByteSS opByteSS(ByteSS p1, ByteSS p2, - out ByteSS p3); + out ByteSS p3); BoolSS opBoolSS(BoolSS p1, BoolSS p2, - out BoolSS p3); + out BoolSS p3); LongSS opShortIntLongSS(ShortSS p1, IntSS p2, LongSS p3, - out ShortSS p4, out IntSS p5, out LongSS p6); + out ShortSS p4, out IntSS p5, out LongSS p6); DoubleSS opFloatDoubleSS(FloatSS p1, DoubleSS p2, - out FloatSS p3, out DoubleSS p4); + out FloatSS p3, out DoubleSS p4); StringSS opStringSS(StringSS p1, StringSS p2, - out StringSS p3); + out StringSS p3); StringSSS opStringSSS(StringSSS p1, StringSSS p2, - out StringSSS p3); + out StringSSS p3); ByteBoolD opByteBoolD(ByteBoolD p1, ByteBoolD p2, - out ByteBoolD p3); + out ByteBoolD p3); ShortIntD opShortIntD(ShortIntD p1, ShortIntD p2, - out ShortIntD p3); + out ShortIntD p3); LongFloatD opLongFloatD(LongFloatD p1, LongFloatD p2, - out LongFloatD p3); + out LongFloatD p3); StringStringD opStringStringD(StringStringD p1, StringStringD p2, - out StringStringD p3); + out StringStringD p3); StringMyEnumD opStringMyEnumD(StringMyEnumD p1, StringMyEnumD p2, - out StringMyEnumD p3); + out StringMyEnumD p3); IntS opIntS(IntS s); diff --git a/cppe/test/IceE/operations/TestI.cpp b/cppe/test/IceE/operations/TestI.cpp index 014b607afd1..d52d31051a1 100644 --- a/cppe/test/IceE/operations/TestI.cpp +++ b/cppe/test/IceE/operations/TestI.cpp @@ -38,9 +38,9 @@ MyDerivedClassI::opSleep(int duration, const Ice::Current&) Ice::Byte MyDerivedClassI::opByte(Ice::Byte p1, - Ice::Byte p2, - Ice::Byte& p3, - const Ice::Current&) + Ice::Byte p2, + Ice::Byte& p3, + const Ice::Current&) { p3 = p1 ^ p2; return p1; @@ -48,9 +48,9 @@ MyDerivedClassI::opByte(Ice::Byte p1, bool MyDerivedClassI::opBool(bool p1, - bool p2, - bool& p3, - const Ice::Current&) + bool p2, + bool& p3, + const Ice::Current&) { p3 = p1; return p2; @@ -58,12 +58,12 @@ MyDerivedClassI::opBool(bool p1, Ice::Long MyDerivedClassI::opShortIntLong(Ice::Short p1, - Ice::Int p2, - Ice::Long p3, - Ice::Short& p4, - Ice::Int& p5, - Ice::Long& p6, - const Ice::Current&) + Ice::Int p2, + Ice::Long p3, + Ice::Short& p4, + Ice::Int& p5, + Ice::Long& p6, + const Ice::Current&) { p4 = p1; p5 = p2; @@ -73,10 +73,10 @@ MyDerivedClassI::opShortIntLong(Ice::Short p1, Ice::Double MyDerivedClassI::opFloatDouble(Ice::Float p1, - Ice::Double p2, - Ice::Float& p3, - Ice::Double& p4, - const Ice::Current&) + Ice::Double p2, + Ice::Float& p3, + Ice::Double& p4, + const Ice::Current&) { p3 = p1; p4 = p2; @@ -85,9 +85,9 @@ MyDerivedClassI::opFloatDouble(Ice::Float p1, std::string MyDerivedClassI::opString(const std::string& p1, - const std::string& p2, - std::string& p3, - const Ice::Current&) + const std::string& p2, + std::string& p3, + const Ice::Current&) { p3 = p2 + " " + p1; return p1 + " " + p2; @@ -95,8 +95,8 @@ MyDerivedClassI::opString(const std::string& p1, Test::MyEnum MyDerivedClassI::opMyEnum(Test::MyEnum p1, - Test::MyEnum& p2, - const Ice::Current&) + Test::MyEnum& p2, + const Ice::Current&) { p2 = p1; return Test::enum3; @@ -104,21 +104,21 @@ MyDerivedClassI::opMyEnum(Test::MyEnum p1, Test::MyClassPrx MyDerivedClassI::opMyClass(const Test::MyClassPrx& p1, - Test::MyClassPrx& p2, - Test::MyClassPrx& p3, - const Ice::Current& current) + Test::MyClassPrx& p2, + Test::MyClassPrx& p3, + const Ice::Current& current) { p2 = p1; p3 = Test::MyClassPrx::uncheckedCast(current.adapter->createProxy( - current.adapter->getCommunicator()->stringToIdentity("noSuchIdentity"))); + current.adapter->getCommunicator()->stringToIdentity("noSuchIdentity"))); return Test::MyClassPrx::uncheckedCast(current.adapter->createProxy(current.id)); } Test::Structure MyDerivedClassI::opStruct(const Test::Structure& p1, - const ::Test::Structure& p2, - ::Test::Structure& p3, - const Ice::Current&) + const ::Test::Structure& p2, + ::Test::Structure& p3, + const Ice::Current&) { p3 = p1; p3.s.s = "a new string"; @@ -127,9 +127,9 @@ MyDerivedClassI::opStruct(const Test::Structure& p1, Test::ByteS MyDerivedClassI::opByteS(const Test::ByteS& p1, - const Test::ByteS& p2, - Test::ByteS& p3, - const Ice::Current&) + const Test::ByteS& p2, + Test::ByteS& p3, + const Ice::Current&) { p3.resize(p1.size()); std::reverse_copy(p1.begin(), p1.end(), p3.begin()); @@ -140,9 +140,9 @@ MyDerivedClassI::opByteS(const Test::ByteS& p1, Test::BoolS MyDerivedClassI::opBoolS(const Test::BoolS& p1, - const Test::BoolS& p2, - Test::BoolS& p3, - const Ice::Current&) + const Test::BoolS& p2, + Test::BoolS& p3, + const Ice::Current&) { p3 = p1; std::copy(p2.begin(), p2.end(), std::back_inserter(p3)); @@ -154,12 +154,12 @@ MyDerivedClassI::opBoolS(const Test::BoolS& p1, Test::LongS MyDerivedClassI::opShortIntLongS(const Test::ShortS& p1, - const Test::IntS& p2, - const Test::LongS& p3, - Test::ShortS& p4, - Test::IntS& p5, - Test::LongS& p6, - const Ice::Current&) + const Test::IntS& p2, + const Test::LongS& p3, + Test::ShortS& p4, + Test::IntS& p5, + Test::LongS& p6, + const Ice::Current&) { p4 = p1; p5.resize(p2.size()); @@ -171,10 +171,10 @@ MyDerivedClassI::opShortIntLongS(const Test::ShortS& p1, Test::DoubleS MyDerivedClassI::opFloatDoubleS(const Test::FloatS& p1, - const Test::DoubleS& p2, - Test::FloatS& p3, - Test::DoubleS& p4, - const Ice::Current&) + const Test::DoubleS& p2, + Test::FloatS& p3, + Test::DoubleS& p4, + const Ice::Current&) { p3 = p1; p4.resize(p2.size()); @@ -186,9 +186,9 @@ MyDerivedClassI::opFloatDoubleS(const Test::FloatS& p1, Test::StringS MyDerivedClassI::opStringS(const Test::StringS& p1, - const Test::StringS& p2, - Test::StringS& p3, - const Ice::Current&) + const Test::StringS& p2, + Test::StringS& p3, + const Ice::Current&) { p3 = p1; std::copy(p2.begin(), p2.end(), std::back_inserter(p3)); @@ -200,9 +200,9 @@ MyDerivedClassI::opStringS(const Test::StringS& p1, Test::ByteSS MyDerivedClassI::opByteSS(const Test::ByteSS& p1, - const Test::ByteSS& p2, - Test::ByteSS& p3, - const Ice::Current&) + const Test::ByteSS& p2, + Test::ByteSS& p3, + const Ice::Current&) { p3.resize(p1.size()); std::reverse_copy(p1.begin(), p1.end(), p3.begin()); @@ -213,9 +213,9 @@ MyDerivedClassI::opByteSS(const Test::ByteSS& p1, Test::BoolSS MyDerivedClassI::opBoolSS(const Test::BoolSS& p1, - const Test::BoolSS& p2, - Test::BoolSS& p3, - const Ice::Current&) + const Test::BoolSS& p2, + Test::BoolSS& p3, + const Ice::Current&) { p3 = p1; std::copy(p2.begin(), p2.end(), std::back_inserter(p3)); @@ -227,12 +227,12 @@ MyDerivedClassI::opBoolSS(const Test::BoolSS& p1, Test::LongSS MyDerivedClassI::opShortIntLongSS(const Test::ShortSS& p1, - const Test::IntSS& p2, - const Test::LongSS& p3, - Test::ShortSS& p4, - Test::IntSS& p5, - Test::LongSS& p6, - const Ice::Current&) + const Test::IntSS& p2, + const Test::LongSS& p3, + Test::ShortSS& p4, + Test::IntSS& p5, + Test::LongSS& p6, + const Ice::Current&) { p4 = p1; p5.resize(p2.size()); @@ -244,10 +244,10 @@ MyDerivedClassI::opShortIntLongSS(const Test::ShortSS& p1, Test::DoubleSS MyDerivedClassI::opFloatDoubleSS(const Test::FloatSS& p1, - const Test::DoubleSS& p2, - Test::FloatSS& p3, - Test::DoubleSS& p4, - const Ice::Current&) + const Test::DoubleSS& p2, + Test::FloatSS& p3, + Test::DoubleSS& p4, + const Ice::Current&) { p3 = p1; p4.resize(p2.size()); @@ -259,9 +259,9 @@ MyDerivedClassI::opFloatDoubleSS(const Test::FloatSS& p1, Test::StringSS MyDerivedClassI::opStringSS(const Test::StringSS& p1, - const Test::StringSS& p2, - Test::StringSS& p3, - const Ice::Current&) + const Test::StringSS& p2, + Test::StringSS& p3, + const Ice::Current&) { p3 = p1; std::copy(p2.begin(), p2.end(), std::back_inserter(p3)); @@ -273,9 +273,9 @@ MyDerivedClassI::opStringSS(const Test::StringSS& p1, Test::StringSSS MyDerivedClassI::opStringSSS(const Test::StringSSS& p1, - const Test::StringSSS& p2, - Test::StringSSS& p3, - const ::Ice::Current&) + const Test::StringSSS& p2, + Test::StringSSS& p3, + const ::Ice::Current&) { p3 = p1; std::copy(p2.begin(), p2.end(), std::back_inserter(p3)); @@ -287,9 +287,9 @@ MyDerivedClassI::opStringSSS(const Test::StringSSS& p1, Test::ByteBoolD MyDerivedClassI::opByteBoolD(const Test::ByteBoolD& p1, - const Test::ByteBoolD& p2, - Test::ByteBoolD& p3, - const Ice::Current&) + const Test::ByteBoolD& p2, + Test::ByteBoolD& p3, + const Ice::Current&) { p3 = p1; Test::ByteBoolD r = p1; @@ -299,9 +299,9 @@ MyDerivedClassI::opByteBoolD(const Test::ByteBoolD& p1, Test::ShortIntD MyDerivedClassI::opShortIntD(const Test::ShortIntD& p1, - const Test::ShortIntD& p2, - Test::ShortIntD& p3, - const Ice::Current&) + const Test::ShortIntD& p2, + Test::ShortIntD& p3, + const Ice::Current&) { p3 = p1; Test::ShortIntD r = p1; @@ -311,9 +311,9 @@ MyDerivedClassI::opShortIntD(const Test::ShortIntD& p1, Test::LongFloatD MyDerivedClassI::opLongFloatD(const Test::LongFloatD& p1, - const Test::LongFloatD& p2, - Test::LongFloatD& p3, - const Ice::Current&) + const Test::LongFloatD& p2, + Test::LongFloatD& p3, + const Ice::Current&) { p3 = p1; Test::LongFloatD r = p1; @@ -323,9 +323,9 @@ MyDerivedClassI::opLongFloatD(const Test::LongFloatD& p1, Test::StringStringD MyDerivedClassI::opStringStringD(const Test::StringStringD& p1, - const Test::StringStringD& p2, - Test::StringStringD& p3, - const Ice::Current&) + const Test::StringStringD& p2, + Test::StringStringD& p3, + const Ice::Current&) { p3 = p1; Test::StringStringD r = p1; @@ -335,9 +335,9 @@ MyDerivedClassI::opStringStringD(const Test::StringStringD& p1, Test::StringMyEnumD MyDerivedClassI::opStringMyEnumD(const Test::StringMyEnumD& p1, - const Test::StringMyEnumD& p2, - Test::StringMyEnumD& p3, - const Ice::Current&) + const Test::StringMyEnumD& p2, + Test::StringMyEnumD& p3, + const Ice::Current&) { p3 = p1; Test::StringMyEnumD r = p1; diff --git a/cppe/test/IceE/operations/TestI.h b/cppe/test/IceE/operations/TestI.h index 7cb8b910adf..a8b92b30549 100644 --- a/cppe/test/IceE/operations/TestI.h +++ b/cppe/test/IceE/operations/TestI.h @@ -25,128 +25,128 @@ public: virtual void opSleep(int, const Ice::Current&); virtual Ice::Byte opByte(Ice::Byte, - Ice::Byte, - Ice::Byte&, - const Ice::Current&); + Ice::Byte, + Ice::Byte&, + const Ice::Current&); virtual bool opBool(bool, - bool, - bool&, - const Ice::Current&); + bool, + bool&, + const Ice::Current&); virtual Ice::Long opShortIntLong(Ice::Short, - Ice::Int, - Ice::Long, - Ice::Short&, - Ice::Int&, - Ice::Long&, - const Ice::Current&); + Ice::Int, + Ice::Long, + Ice::Short&, + Ice::Int&, + Ice::Long&, + const Ice::Current&); virtual Ice::Double opFloatDouble(Ice::Float, - Ice::Double, - Ice::Float&, - Ice::Double&, - const Ice::Current&); + Ice::Double, + Ice::Float&, + Ice::Double&, + const Ice::Current&); virtual std::string opString(const std::string&, - const std::string&, - std::string&, - const Ice::Current&); + const std::string&, + std::string&, + const Ice::Current&); virtual Test::MyEnum opMyEnum(Test::MyEnum, - Test::MyEnum&, - const Ice::Current&); + Test::MyEnum&, + const Ice::Current&); virtual Test::MyClassPrx opMyClass(const Test::MyClassPrx&, - Test::MyClassPrx&, Test::MyClassPrx&, - const Ice::Current&); + Test::MyClassPrx&, Test::MyClassPrx&, + const Ice::Current&); virtual Test::Structure opStruct(const Test::Structure&, const Test::Structure&, - Test::Structure&, - const Ice::Current&); + Test::Structure&, + const Ice::Current&); virtual Test::ByteS opByteS(const Test::ByteS&, - const Test::ByteS&, - Test::ByteS&, - const Ice::Current&); + const Test::ByteS&, + Test::ByteS&, + const Ice::Current&); virtual Test::BoolS opBoolS(const Test::BoolS&, - const Test::BoolS&, - Test::BoolS&, - const Ice::Current&); + const Test::BoolS&, + Test::BoolS&, + const Ice::Current&); virtual Test::LongS opShortIntLongS(const Test::ShortS&, - const Test::IntS&, - const Test::LongS&, - Test::ShortS&, - Test::IntS&, - Test::LongS&, - const Ice::Current&); + const Test::IntS&, + const Test::LongS&, + Test::ShortS&, + Test::IntS&, + Test::LongS&, + const Ice::Current&); virtual Test::DoubleS opFloatDoubleS(const Test::FloatS&, - const Test::DoubleS&, - Test::FloatS&, - Test::DoubleS&, - const Ice::Current&); + const Test::DoubleS&, + Test::FloatS&, + Test::DoubleS&, + const Ice::Current&); virtual Test::StringS opStringS(const Test::StringS&, - const Test::StringS&, - Test::StringS&, - const Ice::Current&); + const Test::StringS&, + Test::StringS&, + const Ice::Current&); virtual Test::ByteSS opByteSS(const Test::ByteSS&, - const Test::ByteSS&, - Test::ByteSS&, - const Ice::Current&); + const Test::ByteSS&, + Test::ByteSS&, + const Ice::Current&); virtual Test::BoolSS opBoolSS(const Test::BoolSS&, - const Test::BoolSS&, - Test::BoolSS&, - const Ice::Current&); + const Test::BoolSS&, + Test::BoolSS&, + const Ice::Current&); virtual Test::LongSS opShortIntLongSS(const Test::ShortSS&, - const Test::IntSS&, - const Test::LongSS&, - Test::ShortSS&, - Test::IntSS&, - Test::LongSS&, - const Ice::Current&); + const Test::IntSS&, + const Test::LongSS&, + Test::ShortSS&, + Test::IntSS&, + Test::LongSS&, + const Ice::Current&); virtual Test::DoubleSS opFloatDoubleSS(const Test::FloatSS&, - const Test::DoubleSS&, - Test::FloatSS&, - Test::DoubleSS&, - const Ice::Current&); + const Test::DoubleSS&, + Test::FloatSS&, + Test::DoubleSS&, + const Ice::Current&); virtual Test::StringSS opStringSS(const Test::StringSS&, - const Test::StringSS&, - Test::StringSS&, - const Ice::Current&); + const Test::StringSS&, + Test::StringSS&, + const Ice::Current&); virtual Test::StringSSS opStringSSS(const Test::StringSSS&, - const Test::StringSSS&, - Test::StringSSS&, - const ::Ice::Current&); + const Test::StringSSS&, + Test::StringSSS&, + const ::Ice::Current&); virtual Test::ByteBoolD opByteBoolD(const Test::ByteBoolD&, const Test::ByteBoolD&, - Test::ByteBoolD&, - const Ice::Current&); + Test::ByteBoolD&, + const Ice::Current&); virtual Test::ShortIntD opShortIntD(const Test::ShortIntD&, const Test::ShortIntD&, - Test::ShortIntD&, - const Ice::Current&); + Test::ShortIntD&, + const Ice::Current&); virtual Test::LongFloatD opLongFloatD(const Test::LongFloatD&, const Test::LongFloatD&, - Test::LongFloatD&, - const Ice::Current&); + Test::LongFloatD&, + const Ice::Current&); virtual Test::StringStringD opStringStringD(const Test::StringStringD&, const Test::StringStringD&, - Test::StringStringD&, - const Ice::Current&); + Test::StringStringD&, + const Ice::Current&); virtual Test::StringMyEnumD opStringMyEnumD(const Test::StringMyEnumD&, const Test::StringMyEnumD&, - Test::StringMyEnumD&, - const Ice::Current&); + Test::StringMyEnumD&, + const Ice::Current&); virtual Test::IntS opIntS(const Test::IntS&, const Ice::Current&); diff --git a/cppe/test/IceE/operations/Twoways.cpp b/cppe/test/IceE/operations/Twoways.cpp index e3717c7877c..c1e14970c18 100644 --- a/cppe/test/IceE/operations/Twoways.cpp +++ b/cppe/test/IceE/operations/Twoways.cpp @@ -26,645 +26,645 @@ using namespace std; void twoways(const Ice::CommunicatorPtr& communicator, - const Ice::InitializationData& initializationData, const Test::MyClassPrx& p) + const Ice::InitializationData& initializationData, const Test::MyClassPrx& p) { { - p->opVoid(); + p->opVoid(); } { - Ice::Byte b; - Ice::Byte r; + Ice::Byte b; + Ice::Byte r; - r = p->opByte(Ice::Byte(0xff), Ice::Byte(0x0f), b); - test(b == Ice::Byte(0xf0)); - test(r == Ice::Byte(0xff)); + r = p->opByte(Ice::Byte(0xff), Ice::Byte(0x0f), b); + test(b == Ice::Byte(0xf0)); + test(r == Ice::Byte(0xff)); } { - bool b; - bool r; + bool b; + bool r; - r = p->opBool(true, false, b); - test(b); - test(!r); + r = p->opBool(true, false, b); + test(b); + test(!r); } { - Ice::Short s; - Ice::Int i; - Ice::Long l; - Ice::Long r; - - r = p->opShortIntLong(10, 11, 12, s, i, l); - test(s == 10); - test(i == 11); - test(l == 12); - test(r == 12); - - r = p->opShortIntLong(numeric_limits<Ice::Short>::min(), numeric_limits<Ice::Int>::min(), - numeric_limits<Ice::Long>::min(), s, i, l); - test(s == numeric_limits<Ice::Short>::min()); - test(i == numeric_limits<Ice::Int>::min()); - test(l == numeric_limits<Ice::Long>::min()); - test(r == numeric_limits<Ice::Long>::min()); - - r = p->opShortIntLong(numeric_limits<Ice::Short>::max(), numeric_limits<Ice::Int>::max(), - numeric_limits<Ice::Long>::max(), s, i, l); - test(s == numeric_limits<Ice::Short>::max()); - test(i == numeric_limits<Ice::Int>::max()); - test(l == numeric_limits<Ice::Long>::max()); - test(r == numeric_limits<Ice::Long>::max()); + Ice::Short s; + Ice::Int i; + Ice::Long l; + Ice::Long r; + + r = p->opShortIntLong(10, 11, 12, s, i, l); + test(s == 10); + test(i == 11); + test(l == 12); + test(r == 12); + + r = p->opShortIntLong(numeric_limits<Ice::Short>::min(), numeric_limits<Ice::Int>::min(), + numeric_limits<Ice::Long>::min(), s, i, l); + test(s == numeric_limits<Ice::Short>::min()); + test(i == numeric_limits<Ice::Int>::min()); + test(l == numeric_limits<Ice::Long>::min()); + test(r == numeric_limits<Ice::Long>::min()); + + r = p->opShortIntLong(numeric_limits<Ice::Short>::max(), numeric_limits<Ice::Int>::max(), + numeric_limits<Ice::Long>::max(), s, i, l); + test(s == numeric_limits<Ice::Short>::max()); + test(i == numeric_limits<Ice::Int>::max()); + test(l == numeric_limits<Ice::Long>::max()); + test(r == numeric_limits<Ice::Long>::max()); } { - Ice::Float f; - Ice::Double d; - Ice::Double r; - - r = p->opFloatDouble(Ice::Float(3.14), Ice::Double(1.1E10), f, d); - test(f == Ice::Float(3.14)); - test(d == Ice::Double(1.1E10)); - test(r == Ice::Double(1.1E10)); - - r = p->opFloatDouble(numeric_limits<Ice::Float>::min(), numeric_limits<Ice::Double>::min(), f, d); - test(f == numeric_limits<Ice::Float>::min()); - test(d == numeric_limits<Ice::Double>::min()); - test(r == numeric_limits<Ice::Double>::min()); - - r = p->opFloatDouble(numeric_limits<Ice::Float>::max(), numeric_limits<Ice::Double>::max(), f, d); - test(f == numeric_limits<Ice::Float>::max()); - test(d == numeric_limits<Ice::Double>::max()); - test(r == numeric_limits<Ice::Double>::max()); + Ice::Float f; + Ice::Double d; + Ice::Double r; + + r = p->opFloatDouble(Ice::Float(3.14), Ice::Double(1.1E10), f, d); + test(f == Ice::Float(3.14)); + test(d == Ice::Double(1.1E10)); + test(r == Ice::Double(1.1E10)); + + r = p->opFloatDouble(numeric_limits<Ice::Float>::min(), numeric_limits<Ice::Double>::min(), f, d); + test(f == numeric_limits<Ice::Float>::min()); + test(d == numeric_limits<Ice::Double>::min()); + test(r == numeric_limits<Ice::Double>::min()); + + r = p->opFloatDouble(numeric_limits<Ice::Float>::max(), numeric_limits<Ice::Double>::max(), f, d); + test(f == numeric_limits<Ice::Float>::max()); + test(d == numeric_limits<Ice::Double>::max()); + test(r == numeric_limits<Ice::Double>::max()); } { - string s; - string r; + string s; + string r; - r = p->opString("hello", "world", s); - test(s == "world hello"); - test(r == "hello world"); + r = p->opString("hello", "world", s); + test(s == "world hello"); + test(r == "hello world"); } { - Test::MyEnum e; - Test::MyEnum r; - - r = p->opMyEnum(Test::enum2, e); - test(e == Test::enum2); - test(r == Test::enum3); + Test::MyEnum e; + Test::MyEnum r; + + r = p->opMyEnum(Test::enum2, e); + test(e == Test::enum2); + test(r == Test::enum3); } { - Test::MyClassPrx c1; - Test::MyClassPrx c2; - Test::MyClassPrx r; - - r = p->opMyClass(p, c1, c2); - test(Ice::proxyIdentityAndFacetEqual(c1, p)); - test(!Ice::proxyIdentityAndFacetEqual(c2, p)); - test(Ice::proxyIdentityAndFacetEqual(r, p)); - test(c1->ice_getIdentity() == communicator->stringToIdentity("test")); - test(c2->ice_getIdentity() == communicator->stringToIdentity("noSuchIdentity")); - test(r->ice_getIdentity() == communicator->stringToIdentity("test")); - r->opVoid(); - c1->opVoid(); - try - { - c2->opVoid(); - test(false); - } - catch(const Ice::ObjectNotExistException&) - { - } - - r = p->opMyClass(0, c1, c2); - test(c1 == 0); - test(c2 != 0); - test(Ice::proxyIdentityAndFacetEqual(r, p)); - r->opVoid(); + Test::MyClassPrx c1; + Test::MyClassPrx c2; + Test::MyClassPrx r; + + r = p->opMyClass(p, c1, c2); + test(Ice::proxyIdentityAndFacetEqual(c1, p)); + test(!Ice::proxyIdentityAndFacetEqual(c2, p)); + test(Ice::proxyIdentityAndFacetEqual(r, p)); + test(c1->ice_getIdentity() == communicator->stringToIdentity("test")); + test(c2->ice_getIdentity() == communicator->stringToIdentity("noSuchIdentity")); + test(r->ice_getIdentity() == communicator->stringToIdentity("test")); + r->opVoid(); + c1->opVoid(); + try + { + c2->opVoid(); + test(false); + } + catch(const Ice::ObjectNotExistException&) + { + } + + r = p->opMyClass(0, c1, c2); + test(c1 == 0); + test(c2 != 0); + test(Ice::proxyIdentityAndFacetEqual(r, p)); + r->opVoid(); } { - Test::Structure si1; - si1.p = p; - si1.e = Test::enum3; - si1.s.s = "abc"; - Test::Structure si2; - si2.p = 0; - si2.e = Test::enum2; - si2.s.s = "def"; - - Test::Structure so; - Test::Structure rso = p->opStruct(si1, si2, so); - test(rso.p == 0); - test(rso.e == Test::enum2); - test(rso.s.s == "def"); - test(so.p == p); - test(so.e == Test::enum3); - test(so.s.s == "a new string"); - so.p->opVoid(); + Test::Structure si1; + si1.p = p; + si1.e = Test::enum3; + si1.s.s = "abc"; + Test::Structure si2; + si2.p = 0; + si2.e = Test::enum2; + si2.s.s = "def"; + + Test::Structure so; + Test::Structure rso = p->opStruct(si1, si2, so); + test(rso.p == 0); + test(rso.e == Test::enum2); + test(rso.s.s == "def"); + test(so.p == p); + test(so.e == Test::enum3); + test(so.s.s == "a new string"); + so.p->opVoid(); } { - Test::ByteS bsi1; - Test::ByteS bsi2; - - bsi1.push_back(Ice::Byte(0x01)); - bsi1.push_back(Ice::Byte(0x11)); - bsi1.push_back(Ice::Byte(0x12)); - bsi1.push_back(Ice::Byte(0x22)); - - bsi2.push_back(Ice::Byte(0xf1)); - bsi2.push_back(Ice::Byte(0xf2)); - bsi2.push_back(Ice::Byte(0xf3)); - bsi2.push_back(Ice::Byte(0xf4)); - - Test::ByteS bso; - Test::ByteS rso; - - rso = p->opByteS(bsi1, bsi2, bso); - test(bso.size() == 4); - test(bso[0] == Ice::Byte(0x22)); - test(bso[1] == Ice::Byte(0x12)); - test(bso[2] == Ice::Byte(0x11)); - test(bso[3] == Ice::Byte(0x01)); - test(rso.size() == 8); - test(rso[0] == Ice::Byte(0x01)); - test(rso[1] == Ice::Byte(0x11)); - test(rso[2] == Ice::Byte(0x12)); - test(rso[3] == Ice::Byte(0x22)); - test(rso[4] == Ice::Byte(0xf1)); - test(rso[5] == Ice::Byte(0xf2)); - test(rso[6] == Ice::Byte(0xf3)); - test(rso[7] == Ice::Byte(0xf4)); + Test::ByteS bsi1; + Test::ByteS bsi2; + + bsi1.push_back(Ice::Byte(0x01)); + bsi1.push_back(Ice::Byte(0x11)); + bsi1.push_back(Ice::Byte(0x12)); + bsi1.push_back(Ice::Byte(0x22)); + + bsi2.push_back(Ice::Byte(0xf1)); + bsi2.push_back(Ice::Byte(0xf2)); + bsi2.push_back(Ice::Byte(0xf3)); + bsi2.push_back(Ice::Byte(0xf4)); + + Test::ByteS bso; + Test::ByteS rso; + + rso = p->opByteS(bsi1, bsi2, bso); + test(bso.size() == 4); + test(bso[0] == Ice::Byte(0x22)); + test(bso[1] == Ice::Byte(0x12)); + test(bso[2] == Ice::Byte(0x11)); + test(bso[3] == Ice::Byte(0x01)); + test(rso.size() == 8); + test(rso[0] == Ice::Byte(0x01)); + test(rso[1] == Ice::Byte(0x11)); + test(rso[2] == Ice::Byte(0x12)); + test(rso[3] == Ice::Byte(0x22)); + test(rso[4] == Ice::Byte(0xf1)); + test(rso[5] == Ice::Byte(0xf2)); + test(rso[6] == Ice::Byte(0xf3)); + test(rso[7] == Ice::Byte(0xf4)); } { - Test::BoolS bsi1; - Test::BoolS bsi2; - - bsi1.push_back(true); - bsi1.push_back(true); - bsi1.push_back(false); - - bsi2.push_back(false); - - Test::BoolS bso; - Test::BoolS rso; - - rso = p->opBoolS(bsi1, bsi2, bso); - test(bso.size() == 4); - test(bso[0]); - test(bso[1]); - test(!bso[2]); - test(!bso[3]); - test(rso.size() == 3); - test(!rso[0]); - test(rso[1]); - test(rso[2]); + Test::BoolS bsi1; + Test::BoolS bsi2; + + bsi1.push_back(true); + bsi1.push_back(true); + bsi1.push_back(false); + + bsi2.push_back(false); + + Test::BoolS bso; + Test::BoolS rso; + + rso = p->opBoolS(bsi1, bsi2, bso); + test(bso.size() == 4); + test(bso[0]); + test(bso[1]); + test(!bso[2]); + test(!bso[3]); + test(rso.size() == 3); + test(!rso[0]); + test(rso[1]); + test(rso[2]); } { - Test::ShortS ssi; - Test::IntS isi; - Test::LongS lsi; - - ssi.push_back(1); - ssi.push_back(2); - ssi.push_back(3); - - isi.push_back(5); - isi.push_back(6); - isi.push_back(7); - isi.push_back(8); - - lsi.push_back(10); - lsi.push_back(30); - lsi.push_back(20); - - Test::ShortS sso; - Test::IntS iso; - Test::LongS lso; - Test::LongS rso; - - rso = p->opShortIntLongS(ssi, isi, lsi, sso, iso, lso); - test(sso.size() == 3); - test(sso[0] == 1); - test(sso[1] == 2); - test(sso[2] == 3); - test(iso.size() == 4); - test(iso[0] == 8); - test(iso[1] == 7); - test(iso[2] == 6); - test(iso[3] == 5); - test(lso.size() == 6); - test(lso[0] == 10); - test(lso[1] == 30); - test(lso[2] == 20); - test(lso[3] == 10); - test(lso[4] == 30); - test(lso[5] == 20); - test(rso.size() == 3); - test(rso[0] == 10); - test(rso[1] == 30); - test(rso[2] == 20); + Test::ShortS ssi; + Test::IntS isi; + Test::LongS lsi; + + ssi.push_back(1); + ssi.push_back(2); + ssi.push_back(3); + + isi.push_back(5); + isi.push_back(6); + isi.push_back(7); + isi.push_back(8); + + lsi.push_back(10); + lsi.push_back(30); + lsi.push_back(20); + + Test::ShortS sso; + Test::IntS iso; + Test::LongS lso; + Test::LongS rso; + + rso = p->opShortIntLongS(ssi, isi, lsi, sso, iso, lso); + test(sso.size() == 3); + test(sso[0] == 1); + test(sso[1] == 2); + test(sso[2] == 3); + test(iso.size() == 4); + test(iso[0] == 8); + test(iso[1] == 7); + test(iso[2] == 6); + test(iso[3] == 5); + test(lso.size() == 6); + test(lso[0] == 10); + test(lso[1] == 30); + test(lso[2] == 20); + test(lso[3] == 10); + test(lso[4] == 30); + test(lso[5] == 20); + test(rso.size() == 3); + test(rso[0] == 10); + test(rso[1] == 30); + test(rso[2] == 20); } { - Test::FloatS fsi; - Test::DoubleS dsi; - - fsi.push_back(Ice::Float(3.14)); - fsi.push_back(Ice::Float(1.11)); - - dsi.push_back(Ice::Double(1.1E10)); - dsi.push_back(Ice::Double(1.2E10)); - dsi.push_back(Ice::Double(1.3E10)); - - Test::FloatS fso; - Test::DoubleS dso; - Test::DoubleS rso; - - rso = p->opFloatDoubleS(fsi, dsi, fso, dso); - test(fso.size() == 2); - test(fso[0] == ::Ice::Float(3.14)); - test(fso[1] == ::Ice::Float(1.11)); - test(dso.size() == 3); - test(dso[0] == ::Ice::Double(1.3E10)); - test(dso[1] == ::Ice::Double(1.2E10)); - test(dso[2] == ::Ice::Double(1.1E10)); - test(rso.size() == 5); - test(rso[0] == ::Ice::Double(1.1E10)); - test(rso[1] == ::Ice::Double(1.2E10)); - test(rso[2] == ::Ice::Double(1.3E10)); - test(::Ice::Float(rso[3]) == ::Ice::Float(3.14)); - test(::Ice::Float(rso[4]) == ::Ice::Float(1.11)); + Test::FloatS fsi; + Test::DoubleS dsi; + + fsi.push_back(Ice::Float(3.14)); + fsi.push_back(Ice::Float(1.11)); + + dsi.push_back(Ice::Double(1.1E10)); + dsi.push_back(Ice::Double(1.2E10)); + dsi.push_back(Ice::Double(1.3E10)); + + Test::FloatS fso; + Test::DoubleS dso; + Test::DoubleS rso; + + rso = p->opFloatDoubleS(fsi, dsi, fso, dso); + test(fso.size() == 2); + test(fso[0] == ::Ice::Float(3.14)); + test(fso[1] == ::Ice::Float(1.11)); + test(dso.size() == 3); + test(dso[0] == ::Ice::Double(1.3E10)); + test(dso[1] == ::Ice::Double(1.2E10)); + test(dso[2] == ::Ice::Double(1.1E10)); + test(rso.size() == 5); + test(rso[0] == ::Ice::Double(1.1E10)); + test(rso[1] == ::Ice::Double(1.2E10)); + test(rso[2] == ::Ice::Double(1.3E10)); + test(::Ice::Float(rso[3]) == ::Ice::Float(3.14)); + test(::Ice::Float(rso[4]) == ::Ice::Float(1.11)); } { - Test::StringS ssi1; - Test::StringS ssi2; - - ssi1.push_back("abc"); - ssi1.push_back("de"); - ssi1.push_back("fghi"); - - ssi2.push_back("xyz"); - - Test::StringS sso; - Test::StringS rso; - - rso = p->opStringS(ssi1, ssi2, sso); - test(sso.size() == 4); - test(sso[0] == "abc"); - test(sso[1] == "de"); - test(sso[2] == "fghi"); - test(sso[3] == "xyz"); - test(rso.size() == 3); - test(rso[0] == "fghi"); - test(rso[1] == "de"); - test(rso[2] == "abc"); + Test::StringS ssi1; + Test::StringS ssi2; + + ssi1.push_back("abc"); + ssi1.push_back("de"); + ssi1.push_back("fghi"); + + ssi2.push_back("xyz"); + + Test::StringS sso; + Test::StringS rso; + + rso = p->opStringS(ssi1, ssi2, sso); + test(sso.size() == 4); + test(sso[0] == "abc"); + test(sso[1] == "de"); + test(sso[2] == "fghi"); + test(sso[3] == "xyz"); + test(rso.size() == 3); + test(rso[0] == "fghi"); + test(rso[1] == "de"); + test(rso[2] == "abc"); } { - Test::ByteSS bsi1; - bsi1.resize(2); - Test::ByteSS bsi2; - bsi2.resize(2); - - bsi1[0].push_back(Ice::Byte(0x01)); - bsi1[0].push_back(Ice::Byte(0x11)); - bsi1[0].push_back(Ice::Byte(0x12)); - bsi1[1].push_back(Ice::Byte(0xff)); - - bsi2[0].push_back(Ice::Byte(0x0e)); - bsi2[1].push_back(Ice::Byte(0xf2)); - bsi2[1].push_back(Ice::Byte(0xf1)); - - Test::ByteSS bso; - Test::ByteSS rso; - - rso = p->opByteSS(bsi1, bsi2, bso); - test(bso.size() == 2); - test(bso[0].size() == 1); - test(bso[0][0] == Ice::Byte(0xff)); - test(bso[1].size() == 3); - test(bso[1][0] == Ice::Byte(0x01)); - test(bso[1][1] == Ice::Byte(0x11)); - test(bso[1][2] == Ice::Byte(0x12)); - test(rso.size() == 4); - test(rso[0].size() == 3); - test(rso[0][0] == Ice::Byte(0x01)); - test(rso[0][1] == Ice::Byte(0x11)); - test(rso[0][2] == Ice::Byte(0x12)); - test(rso[1].size() == 1); - test(rso[1][0] == Ice::Byte(0xff)); - test(rso[2].size() == 1); - test(rso[2][0] == Ice::Byte(0x0e)); - test(rso[3].size() == 2); - test(rso[3][0] == Ice::Byte(0xf2)); - test(rso[3][1] == Ice::Byte(0xf1)); + Test::ByteSS bsi1; + bsi1.resize(2); + Test::ByteSS bsi2; + bsi2.resize(2); + + bsi1[0].push_back(Ice::Byte(0x01)); + bsi1[0].push_back(Ice::Byte(0x11)); + bsi1[0].push_back(Ice::Byte(0x12)); + bsi1[1].push_back(Ice::Byte(0xff)); + + bsi2[0].push_back(Ice::Byte(0x0e)); + bsi2[1].push_back(Ice::Byte(0xf2)); + bsi2[1].push_back(Ice::Byte(0xf1)); + + Test::ByteSS bso; + Test::ByteSS rso; + + rso = p->opByteSS(bsi1, bsi2, bso); + test(bso.size() == 2); + test(bso[0].size() == 1); + test(bso[0][0] == Ice::Byte(0xff)); + test(bso[1].size() == 3); + test(bso[1][0] == Ice::Byte(0x01)); + test(bso[1][1] == Ice::Byte(0x11)); + test(bso[1][2] == Ice::Byte(0x12)); + test(rso.size() == 4); + test(rso[0].size() == 3); + test(rso[0][0] == Ice::Byte(0x01)); + test(rso[0][1] == Ice::Byte(0x11)); + test(rso[0][2] == Ice::Byte(0x12)); + test(rso[1].size() == 1); + test(rso[1][0] == Ice::Byte(0xff)); + test(rso[2].size() == 1); + test(rso[2][0] == Ice::Byte(0x0e)); + test(rso[3].size() == 2); + test(rso[3][0] == Ice::Byte(0xf2)); + test(rso[3][1] == Ice::Byte(0xf1)); } { - Test::FloatSS fsi; - fsi.resize(3); - Test::DoubleSS dsi; - dsi.resize(1); - - fsi[0].push_back(Ice::Float(3.14)); - fsi[1].push_back(Ice::Float(1.11)); - - dsi[0].push_back(Ice::Double(1.1E10)); - dsi[0].push_back(Ice::Double(1.2E10)); - dsi[0].push_back(Ice::Double(1.3E10)); - - Test::FloatSS fso; - Test::DoubleSS dso; - Test::DoubleSS rso; - - rso = p->opFloatDoubleSS(fsi, dsi, fso, dso); - test(fso.size() == 3); - test(fso[0].size() == 1); - test(fso[0][0] == ::Ice::Float(3.14)); - test(fso[1].size() == 1); - test(fso[1][0] == ::Ice::Float(1.11)); - test(fso[2].size() == 0); - test(dso.size() == 1); - test(dso[0].size() == 3); - test(dso[0][0] == ::Ice::Double(1.1E10)); - test(dso[0][1] == ::Ice::Double(1.2E10)); - test(dso[0][2] == ::Ice::Double(1.3E10)); - test(rso.size() == 2); - test(rso[0].size() == 3); - test(rso[0][0] == ::Ice::Double(1.1E10)); - test(rso[0][1] == ::Ice::Double(1.2E10)); - test(rso[0][2] == ::Ice::Double(1.3E10)); - test(rso[1].size() == 3); - test(rso[1][0] == ::Ice::Double(1.1E10)); - test(rso[1][1] == ::Ice::Double(1.2E10)); - test(rso[1][2] == ::Ice::Double(1.3E10)); + Test::FloatSS fsi; + fsi.resize(3); + Test::DoubleSS dsi; + dsi.resize(1); + + fsi[0].push_back(Ice::Float(3.14)); + fsi[1].push_back(Ice::Float(1.11)); + + dsi[0].push_back(Ice::Double(1.1E10)); + dsi[0].push_back(Ice::Double(1.2E10)); + dsi[0].push_back(Ice::Double(1.3E10)); + + Test::FloatSS fso; + Test::DoubleSS dso; + Test::DoubleSS rso; + + rso = p->opFloatDoubleSS(fsi, dsi, fso, dso); + test(fso.size() == 3); + test(fso[0].size() == 1); + test(fso[0][0] == ::Ice::Float(3.14)); + test(fso[1].size() == 1); + test(fso[1][0] == ::Ice::Float(1.11)); + test(fso[2].size() == 0); + test(dso.size() == 1); + test(dso[0].size() == 3); + test(dso[0][0] == ::Ice::Double(1.1E10)); + test(dso[0][1] == ::Ice::Double(1.2E10)); + test(dso[0][2] == ::Ice::Double(1.3E10)); + test(rso.size() == 2); + test(rso[0].size() == 3); + test(rso[0][0] == ::Ice::Double(1.1E10)); + test(rso[0][1] == ::Ice::Double(1.2E10)); + test(rso[0][2] == ::Ice::Double(1.3E10)); + test(rso[1].size() == 3); + test(rso[1][0] == ::Ice::Double(1.1E10)); + test(rso[1][1] == ::Ice::Double(1.2E10)); + test(rso[1][2] == ::Ice::Double(1.3E10)); } { - Test::StringSS ssi1; - ssi1.resize(2); - Test::StringSS ssi2; - ssi2.resize(3); - - ssi1[0].push_back("abc"); - ssi1[1].push_back("de"); - ssi1[1].push_back("fghi"); - - ssi2[2].push_back("xyz"); - - Test::StringSS sso; - Test::StringSS rso; - - rso = p->opStringSS(ssi1, ssi2, sso); - test(sso.size() == 5); - test(sso[0].size() == 1); - test(sso[0][0] == "abc"); - test(sso[1].size() == 2); - test(sso[1][0] == "de"); - test(sso[1][1] == "fghi"); - test(sso[2].size() == 0); - test(sso[3].size() == 0); - test(sso[4].size() == 1); - test(sso[4][0] == "xyz"); - test(rso.size() == 3); - test(rso[0].size() == 1); - test(rso[0][0] == "xyz"); - test(rso[1].size() == 0); - test(rso[2].size() == 0); + Test::StringSS ssi1; + ssi1.resize(2); + Test::StringSS ssi2; + ssi2.resize(3); + + ssi1[0].push_back("abc"); + ssi1[1].push_back("de"); + ssi1[1].push_back("fghi"); + + ssi2[2].push_back("xyz"); + + Test::StringSS sso; + Test::StringSS rso; + + rso = p->opStringSS(ssi1, ssi2, sso); + test(sso.size() == 5); + test(sso[0].size() == 1); + test(sso[0][0] == "abc"); + test(sso[1].size() == 2); + test(sso[1][0] == "de"); + test(sso[1][1] == "fghi"); + test(sso[2].size() == 0); + test(sso[3].size() == 0); + test(sso[4].size() == 1); + test(sso[4][0] == "xyz"); + test(rso.size() == 3); + test(rso[0].size() == 1); + test(rso[0][0] == "xyz"); + test(rso[1].size() == 0); + test(rso[2].size() == 0); } { - Test::StringSSS sssi1; - sssi1.resize(2); - sssi1[0].resize(2); - sssi1[0][0].push_back("abc"); - sssi1[0][0].push_back("de"); - sssi1[0][1].push_back("xyz"); - sssi1[1].resize(1); - sssi1[1][0].push_back("hello"); - - Test::StringSSS sssi2; - sssi2.resize(3); - sssi2[0].resize(2); - sssi2[0][0].push_back(""); - sssi2[0][0].push_back(""); - sssi2[0][1].push_back("abcd"); - sssi2[1].resize(1); - sssi2[1][0].push_back(""); - - Test::StringSSS ssso; - Test::StringSSS rsso; - - rsso = p->opStringSSS(sssi1, sssi2, ssso); - test(ssso.size() == 5); - test(ssso[0].size() == 2); - test(ssso[0][0].size() == 2); - test(ssso[0][1].size() == 1); - test(ssso[1].size() == 1); - test(ssso[1][0].size() == 1); - test(ssso[2].size() == 2); - test(ssso[2][0].size() == 2); - test(ssso[2][1].size() == 1); - test(ssso[3].size() == 1); - test(ssso[3][0].size() == 1); - test(ssso[4].size() == 0); - test(ssso[0][0][0] == "abc"); - test(ssso[0][0][1] == "de"); - test(ssso[0][1][0] == "xyz"); - test(ssso[1][0][0] == "hello"); - test(ssso[2][0][0] == ""); - test(ssso[2][0][1] == ""); - test(ssso[2][1][0] == "abcd"); - test(ssso[3][0][0] == ""); - - test(rsso.size() == 3); - test(rsso[0].size() == 0); - test(rsso[1].size() == 1); - test(rsso[1][0].size() == 1); - test(rsso[2].size() == 2); - test(rsso[2][0].size() == 2); - test(rsso[2][1].size() == 1); - test(rsso[1][0][0] == ""); - test(rsso[2][0][0] == ""); - test(rsso[2][0][1] == ""); - test(rsso[2][1][0] == "abcd"); + Test::StringSSS sssi1; + sssi1.resize(2); + sssi1[0].resize(2); + sssi1[0][0].push_back("abc"); + sssi1[0][0].push_back("de"); + sssi1[0][1].push_back("xyz"); + sssi1[1].resize(1); + sssi1[1][0].push_back("hello"); + + Test::StringSSS sssi2; + sssi2.resize(3); + sssi2[0].resize(2); + sssi2[0][0].push_back(""); + sssi2[0][0].push_back(""); + sssi2[0][1].push_back("abcd"); + sssi2[1].resize(1); + sssi2[1][0].push_back(""); + + Test::StringSSS ssso; + Test::StringSSS rsso; + + rsso = p->opStringSSS(sssi1, sssi2, ssso); + test(ssso.size() == 5); + test(ssso[0].size() == 2); + test(ssso[0][0].size() == 2); + test(ssso[0][1].size() == 1); + test(ssso[1].size() == 1); + test(ssso[1][0].size() == 1); + test(ssso[2].size() == 2); + test(ssso[2][0].size() == 2); + test(ssso[2][1].size() == 1); + test(ssso[3].size() == 1); + test(ssso[3][0].size() == 1); + test(ssso[4].size() == 0); + test(ssso[0][0][0] == "abc"); + test(ssso[0][0][1] == "de"); + test(ssso[0][1][0] == "xyz"); + test(ssso[1][0][0] == "hello"); + test(ssso[2][0][0] == ""); + test(ssso[2][0][1] == ""); + test(ssso[2][1][0] == "abcd"); + test(ssso[3][0][0] == ""); + + test(rsso.size() == 3); + test(rsso[0].size() == 0); + test(rsso[1].size() == 1); + test(rsso[1][0].size() == 1); + test(rsso[2].size() == 2); + test(rsso[2][0].size() == 2); + test(rsso[2][1].size() == 1); + test(rsso[1][0][0] == ""); + test(rsso[2][0][0] == ""); + test(rsso[2][0][1] == ""); + test(rsso[2][1][0] == "abcd"); } { - Test::ByteBoolD di1; - di1[10] = true; - di1[100] = false; - Test::ByteBoolD di2; - di2[10] = true; - di2[11] = false; - di2[101] = true; - - Test::ByteBoolD _do; - Test::ByteBoolD ro = p->opByteBoolD(di1, di2, _do); - - test(_do == di1); - test(ro.size() == 4); - test(ro[10] == true); - test(ro[11] == false); - test(ro[100] == false); - test(ro[101] == true); + Test::ByteBoolD di1; + di1[10] = true; + di1[100] = false; + Test::ByteBoolD di2; + di2[10] = true; + di2[11] = false; + di2[101] = true; + + Test::ByteBoolD _do; + Test::ByteBoolD ro = p->opByteBoolD(di1, di2, _do); + + test(_do == di1); + test(ro.size() == 4); + test(ro[10] == true); + test(ro[11] == false); + test(ro[100] == false); + test(ro[101] == true); } { - Test::ShortIntD di1; - di1[110] = -1; - di1[1100] = 123123; - Test::ShortIntD di2; - di2[110] = -1; - di2[111] = -100; - di2[1101] = 0; - - Test::ShortIntD _do; - Test::ShortIntD ro = p->opShortIntD(di1, di2, _do); - - test(_do == di1); - test(ro.size() == 4); - test(ro[110] == -1); - test(ro[111] == -100); - test(ro[1100] == 123123); - test(ro[1101] == 0); + Test::ShortIntD di1; + di1[110] = -1; + di1[1100] = 123123; + Test::ShortIntD di2; + di2[110] = -1; + di2[111] = -100; + di2[1101] = 0; + + Test::ShortIntD _do; + Test::ShortIntD ro = p->opShortIntD(di1, di2, _do); + + test(_do == di1); + test(ro.size() == 4); + test(ro[110] == -1); + test(ro[111] == -100); + test(ro[1100] == 123123); + test(ro[1101] == 0); } { - Test::LongFloatD di1; - di1[999999110] = Ice::Float(-1.1); - di1[999999111] = Ice::Float(123123.2); - Test::LongFloatD di2; - di2[999999110] = Ice::Float(-1.1); - di2[999999120] = Ice::Float(-100.4); - di2[999999130] = Ice::Float(0.5); - - Test::LongFloatD _do; - Test::LongFloatD ro = p->opLongFloatD(di1, di2, _do); - - test(_do == di1); - test(ro.size() == 4); - test(ro[999999110] == Ice::Float(-1.1)); - test(ro[999999120] == Ice::Float(-100.4)); - test(ro[999999111] == Ice::Float(123123.2)); - test(ro[999999130] == Ice::Float(0.5)); + Test::LongFloatD di1; + di1[999999110] = Ice::Float(-1.1); + di1[999999111] = Ice::Float(123123.2); + Test::LongFloatD di2; + di2[999999110] = Ice::Float(-1.1); + di2[999999120] = Ice::Float(-100.4); + di2[999999130] = Ice::Float(0.5); + + Test::LongFloatD _do; + Test::LongFloatD ro = p->opLongFloatD(di1, di2, _do); + + test(_do == di1); + test(ro.size() == 4); + test(ro[999999110] == Ice::Float(-1.1)); + test(ro[999999120] == Ice::Float(-100.4)); + test(ro[999999111] == Ice::Float(123123.2)); + test(ro[999999130] == Ice::Float(0.5)); } { - Test::StringStringD di1; - di1["foo"] = "abc -1.1"; - di1["bar"] = "abc 123123.2"; - Test::StringStringD di2; - di2["foo"] = "abc -1.1"; - di2["FOO"] = "abc -100.4"; - di2["BAR"] = "abc 0.5"; - - Test::StringStringD _do; - Test::StringStringD ro = p->opStringStringD(di1, di2, _do); - - test(_do == di1); - test(ro.size() == 4); - test(ro["foo"] == "abc -1.1"); - test(ro["FOO"] == "abc -100.4"); - test(ro["bar"] == "abc 123123.2"); - test(ro["BAR"] == "abc 0.5"); + Test::StringStringD di1; + di1["foo"] = "abc -1.1"; + di1["bar"] = "abc 123123.2"; + Test::StringStringD di2; + di2["foo"] = "abc -1.1"; + di2["FOO"] = "abc -100.4"; + di2["BAR"] = "abc 0.5"; + + Test::StringStringD _do; + Test::StringStringD ro = p->opStringStringD(di1, di2, _do); + + test(_do == di1); + test(ro.size() == 4); + test(ro["foo"] == "abc -1.1"); + test(ro["FOO"] == "abc -100.4"); + test(ro["bar"] == "abc 123123.2"); + test(ro["BAR"] == "abc 0.5"); } { - Test::StringMyEnumD di1; - di1["abc"] = Test::enum1; - di1[""] = Test::enum2; - Test::StringMyEnumD di2; - di2["abc"] = Test::enum1; - di2["qwerty"] = Test::enum3; - di2["Hello!!"] = Test::enum2; - - Test::StringMyEnumD _do; - Test::StringMyEnumD ro = p->opStringMyEnumD(di1, di2, _do); - - test(_do == di1); - test(ro.size() == 4); - test(ro["abc"] == Test::enum1); - test(ro["qwerty"] == Test::enum3); - test(ro[""] == Test::enum2); - test(ro["Hello!!"] == Test::enum2); + Test::StringMyEnumD di1; + di1["abc"] = Test::enum1; + di1[""] = Test::enum2; + Test::StringMyEnumD di2; + di2["abc"] = Test::enum1; + di2["qwerty"] = Test::enum3; + di2["Hello!!"] = Test::enum2; + + Test::StringMyEnumD _do; + Test::StringMyEnumD ro = p->opStringMyEnumD(di1, di2, _do); + + test(_do == di1); + test(ro.size() == 4); + test(ro["abc"] == Test::enum1); + test(ro["qwerty"] == Test::enum3); + test(ro[""] == Test::enum2); + test(ro["Hello!!"] == Test::enum2); } { - const int lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 }; - - for(int l = 0; l != sizeof(lengths) / sizeof(*lengths); ++l) - { - Test::IntS s; - for(int i = 0; i < lengths[l]; ++i) - { - s.push_back(i); - } - Test::IntS r = p->opIntS(s); - test(r.size() == static_cast<size_t>(lengths[l])); - for(int j = 0; j < static_cast<int>(r.size()); ++j) - { - test(r[j] == -j); - } - } + const int lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 }; + + for(int l = 0; l != sizeof(lengths) / sizeof(*lengths); ++l) + { + Test::IntS s; + for(int i = 0; i < lengths[l]; ++i) + { + s.push_back(i); + } + Test::IntS r = p->opIntS(s); + test(r.size() == static_cast<size_t>(lengths[l])); + for(int j = 0; j < static_cast<int>(r.size()); ++j) + { + test(r[j] == -j); + } + } } { - Ice::Context ctx; - ctx["one"] = "ONE"; - ctx["two"] = "TWO"; - ctx["three"] = "THREE"; - { - Test::StringStringD r = p->opContext(); - test(p->ice_getContext().empty()); - test(r != ctx); - } - { - Test::StringStringD r = p->opContext(ctx); - test(p->ice_getContext().empty()); - test(r == ctx); - } - { - Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_context(ctx)); - test(p2->ice_getContext() == ctx); - Test::StringStringD r = p2->opContext(); - test(r == ctx); - r = p2->opContext(ctx); - test(r == ctx); - } - - { - // - // Test proxy context - // + Ice::Context ctx; + ctx["one"] = "ONE"; + ctx["two"] = "TWO"; + ctx["three"] = "THREE"; + { + Test::StringStringD r = p->opContext(); + test(p->ice_getContext().empty()); + test(r != ctx); + } + { + Test::StringStringD r = p->opContext(ctx); + test(p->ice_getContext().empty()); + test(r == ctx); + } + { + Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_context(ctx)); + test(p2->ice_getContext() == ctx); + Test::StringStringD r = p2->opContext(); + test(r == ctx); + r = p2->opContext(ctx); + test(r == ctx); + } + + { + // + // Test proxy context + // string ref = communicator->getProperties()->getPropertyWithDefault( "Operations.Proxy", "test:default -p 12010 -t 10000"); Test::MyClassPrx c = Test::MyClassPrx::checkedCast(communicator->stringToProxy(ref)); - Ice::Context dflt; - dflt["a"] = "b"; - Test::MyClassPrx c2 = Test::MyClassPrx::uncheckedCast(c->ice_context(dflt)); - test(c2->opContext()["a"] == "b"); + Ice::Context dflt; + dflt["a"] = "b"; + Test::MyClassPrx c2 = Test::MyClassPrx::uncheckedCast(c->ice_context(dflt)); + test(c2->opContext()["a"] == "b"); - dflt.clear(); - Test::MyClassPrx c3 = Test::MyClassPrx::uncheckedCast(c2->ice_context(dflt)); - Ice::Context tmp = c3->opContext(); - test(tmp.find("a") == tmp.end()); - } + dflt.clear(); + Test::MyClassPrx c3 = Test::MyClassPrx::uncheckedCast(c2->ice_context(dflt)); + Ice::Context tmp = c3->opContext(); + test(tmp.find("a") == tmp.end()); + } } { Ice::Double d = 1278312346.0 / 13.0; - Test::DoubleS ds(5, d); - p->opDoubleMarshaling(d, ds); + Test::DoubleS ds(5, d); + p->opDoubleMarshaling(d, ds); } } diff --git a/cppe/test/IceE/proxy/Client.cpp b/cppe/test/IceE/proxy/Client.cpp index f784087c6c1..409c225fc7b 100644 --- a/cppe/test/IceE/proxy/Client.cpp +++ b/cppe/test/IceE/proxy/Client.cpp @@ -36,16 +36,16 @@ public: initData.properties->setProperty("Ice.ThreadPool.Client.Size", "2"); initData.properties->setProperty("Ice.ThreadPool.Client.SizeWarn", "0"); - loadConfig(initData.properties); + loadConfig(initData.properties); - // - // Now parse argc/argv into initData - // - initData.properties = Ice::createProperties(argc, argv, initData.properties); + // + // Now parse argc/argv into initData + // + initData.properties = Ice::createProperties(argc, argv, initData.properties); - initData.logger = getLogger(); - setCommunicator(Ice::initialize(argc, argv, initData)); - + initData.logger = getLogger(); + setCommunicator(Ice::initialize(argc, argv, initData)); + // // We don't want connection warnings because of the timeout test. // diff --git a/cppe/test/IceE/proxy/Collocated.cpp b/cppe/test/IceE/proxy/Collocated.cpp index fca190babce..48680607cd2 100644 --- a/cppe/test/IceE/proxy/Collocated.cpp +++ b/cppe/test/IceE/proxy/Collocated.cpp @@ -26,17 +26,17 @@ public: virtual int run(int argc, char* argv[]) { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(); + Ice::InitializationData initData; + initData.properties = Ice::createProperties(); initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); - loadConfig(initData.properties); - // - // Now parse argc/argv into initData.properties - // - initData.properties = Ice::createProperties(argc, argv, initData.properties); - initData.logger = getLogger(); - setCommunicator(Ice::initialize(argc, argv, initData)); + loadConfig(initData.properties); + // + // Now parse argc/argv into initData.properties + // + initData.properties = Ice::createProperties(argc, argv, initData.properties); + initData.logger = getLogger(); + setCommunicator(Ice::initialize(argc, argv, initData)); Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter"); adapter->add(new MyDerivedClassI, communicator()->stringToIdentity("test")); diff --git a/cppe/test/IceE/proxy/Server.cpp b/cppe/test/IceE/proxy/Server.cpp index c928a86ae17..d2a7a73614c 100644 --- a/cppe/test/IceE/proxy/Server.cpp +++ b/cppe/test/IceE/proxy/Server.cpp @@ -31,9 +31,9 @@ public: initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); initData.properties->setProperty("Ice.Warn.Connections", "0"); - loadConfig(initData.properties); - initData.logger = getLogger(); - setCommunicator(Ice::initialize(argc, argv, initData)); + loadConfig(initData.properties); + initData.logger = getLogger(); + setCommunicator(Ice::initialize(argc, argv, initData)); Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter"); adapter->add(new MyDerivedClassI, communicator()->stringToIdentity("test")); diff --git a/cppe/test/IceE/retry/AllTests.cpp b/cppe/test/IceE/retry/AllTests.cpp index f2227de7c3c..557a27b773e 100644 --- a/cppe/test/IceE/retry/AllTests.cpp +++ b/cppe/test/IceE/retry/AllTests.cpp @@ -42,12 +42,12 @@ allTests(const Ice::CommunicatorPtr& communicator) tprintf("calling operation to kill connection with second proxy... "); try { - retry2->op(true); - test(false); + retry2->op(true); + test(false); } catch(Ice::ConnectionLostException) { - tprintf("ok\n"); + tprintf("ok\n"); } tprintf("calling regular operation with first proxy again... "); diff --git a/cppe/test/IceE/retry/Client.cpp b/cppe/test/IceE/retry/Client.cpp index 0cbafc1b3cd..45ddd78d996 100644 --- a/cppe/test/IceE/retry/Client.cpp +++ b/cppe/test/IceE/retry/Client.cpp @@ -28,23 +28,23 @@ public: { Ice::InitializationData initData; initData.properties = Ice::createProperties(); - //initData.properties->setProperty("Ice.Trace.Network", "5"); - //initData.properties->setProperty("Ice.Trace.Protocol", "5"); + //initData.properties->setProperty("Ice.Trace.Network", "5"); + //initData.properties->setProperty("Ice.Trace.Protocol", "5"); - loadConfig(initData.properties); + loadConfig(initData.properties); - // - // For this test, we want to disable retries. - // - initData.properties->setProperty("Ice.RetryIntervals", "-1"); + // + // For this test, we want to disable retries. + // + initData.properties->setProperty("Ice.RetryIntervals", "-1"); - initData.logger = getLogger(); - setCommunicator(Ice::initialize(argc, argv, initData)); + initData.logger = getLogger(); + setCommunicator(Ice::initialize(argc, argv, initData)); - // - // This test kills connections, so we don't want warnings. - // - communicator()->getProperties()->setProperty("Ice.Warn.Connections", "0"); + // + // This test kills connections, so we don't want warnings. + // + communicator()->getProperties()->setProperty("Ice.Warn.Connections", "0"); Test::RetryPrx allTests(const Ice::CommunicatorPtr&); Test::RetryPrx retry = allTests(communicator()); diff --git a/cppe/test/IceE/retry/Server.cpp b/cppe/test/IceE/retry/Server.cpp index fba90fdde84..bd4e16a2dc9 100644 --- a/cppe/test/IceE/retry/Server.cpp +++ b/cppe/test/IceE/retry/Server.cpp @@ -26,16 +26,16 @@ public: virtual int run(int argc, char* argv[]) { - Ice::InitializationData initData; + Ice::InitializationData initData; initData.properties = Ice::createProperties(); - initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); - //initData.properties->setProperty("Ice.Trace.Network", "5"); - //initData.properties->setProperty("Ice.Trace.Protocol", "5"); + initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + //initData.properties->setProperty("Ice.Trace.Network", "5"); + //initData.properties->setProperty("Ice.Trace.Protocol", "5"); - loadConfig(initData.properties); - initData.logger = getLogger(); - setCommunicator(Ice::initialize(argc, argv, initData)); + loadConfig(initData.properties); + initData.logger = getLogger(); + setCommunicator(Ice::initialize(argc, argv, initData)); Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter"); Ice::ObjectPtr object = new RetryI; diff --git a/cppe/test/IceE/retry/TestI.cpp b/cppe/test/IceE/retry/TestI.cpp index c6429890591..d4d9666dc37 100644 --- a/cppe/test/IceE/retry/TestI.cpp +++ b/cppe/test/IceE/retry/TestI.cpp @@ -16,7 +16,7 @@ RetryI::op(bool kill, const Ice::Current& current) { if(kill) { - current.con->close(true); + current.con->close(true); } } diff --git a/cppe/test/IceE/slicing/AllTests.cpp b/cppe/test/IceE/slicing/AllTests.cpp index 8172ce850fe..9e7f7301b0f 100644 --- a/cppe/test/IceE/slicing/AllTests.cpp +++ b/cppe/test/IceE/slicing/AllTests.cpp @@ -19,7 +19,7 @@ class CallbackBase : public IceUtil::Monitor<IceUtil::Mutex> public: CallbackBase() : - _called(false) + _called(false) { } @@ -29,26 +29,26 @@ public: bool check() { - IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); - while(!_called) - { - if(!timedWait(IceUtil::Time::seconds(5))) - { - return false; - } - } - _called = false; - return true; + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + while(!_called) + { + if(!timedWait(IceUtil::Time::seconds(5))) + { + return false; + } + } + _called = false; + return true; } protected: void called() { - IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); - assert(!_called); - _called = true; - notify(); + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + assert(!_called); + _called = true; + notify(); } private: @@ -65,260 +65,260 @@ allTests(const Ice::CommunicatorPtr& communicator) tprintf("base... "); fflush(stdout); { - try - { - test->baseAsBase(); - test(false); - } - catch(const Base& b) - { - test(b.b == "Base.b"); - test(b.ice_name() =="Test::Base"); - } - catch(...) - { - test(false); - } + try + { + test->baseAsBase(); + test(false); + } + catch(const Base& b) + { + test(b.b == "Base.b"); + test(b.ice_name() =="Test::Base"); + } + catch(...) + { + test(false); + } } tprintf("ok\n"); tprintf("slicing of unknown derived... "); fflush(stdout); { - try - { - test->unknownDerivedAsBase(); - test(false); - } - catch(const Base& b) - { - test(b.b == "UnknownDerived.b"); - test(b.ice_name() =="Test::Base"); - } - catch(...) - { - test(false); - } + try + { + test->unknownDerivedAsBase(); + test(false); + } + catch(const Base& b) + { + test(b.b == "UnknownDerived.b"); + test(b.ice_name() =="Test::Base"); + } + catch(...) + { + test(false); + } } tprintf("ok\n"); tprintf("non-slicing of known derived as base... "); fflush(stdout); { - try - { - test->knownDerivedAsBase(); - test(false); - } - catch(const KnownDerived& k) - { - test(k.b == "KnownDerived.b"); - test(k.kd == "KnownDerived.kd"); - test(k.ice_name() =="Test::KnownDerived"); - } - catch(...) - { - test(false); - } + try + { + test->knownDerivedAsBase(); + test(false); + } + catch(const KnownDerived& k) + { + test(k.b == "KnownDerived.b"); + test(k.kd == "KnownDerived.kd"); + test(k.ice_name() =="Test::KnownDerived"); + } + catch(...) + { + test(false); + } } tprintf("ok\n"); tprintf("non-slicing of known derived as derived... "); fflush(stdout); { - try - { - test->knownDerivedAsKnownDerived(); - test(false); - } - catch(const KnownDerived& k) - { - test(k.b == "KnownDerived.b"); - test(k.kd == "KnownDerived.kd"); - test(k.ice_name() =="Test::KnownDerived"); - } - catch(...) - { - test(false); - } + try + { + test->knownDerivedAsKnownDerived(); + test(false); + } + catch(const KnownDerived& k) + { + test(k.b == "KnownDerived.b"); + test(k.kd == "KnownDerived.kd"); + test(k.ice_name() =="Test::KnownDerived"); + } + catch(...) + { + test(false); + } } tprintf("ok\n"); tprintf("slicing of unknown intermediate as base... "); fflush(stdout); { - try - { - test->unknownIntermediateAsBase(); - test(false); - } - catch(const Base& b) - { - test(b.b == "UnknownIntermediate.b"); - test(b.ice_name() =="Test::Base"); - } - catch(...) - { - test(false); - } + try + { + test->unknownIntermediateAsBase(); + test(false); + } + catch(const Base& b) + { + test(b.b == "UnknownIntermediate.b"); + test(b.ice_name() =="Test::Base"); + } + catch(...) + { + test(false); + } } tprintf("ok\n"); tprintf("slicing of known intermediate as base... "); fflush(stdout); { - try - { - test->knownIntermediateAsBase(); - test(false); - } - catch(const KnownIntermediate& ki) - { - test(ki.b == "KnownIntermediate.b"); - test(ki.ki == "KnownIntermediate.ki"); - test(ki.ice_name() =="Test::KnownIntermediate"); - } - catch(...) - { - test(false); - } + try + { + test->knownIntermediateAsBase(); + test(false); + } + catch(const KnownIntermediate& ki) + { + test(ki.b == "KnownIntermediate.b"); + test(ki.ki == "KnownIntermediate.ki"); + test(ki.ice_name() =="Test::KnownIntermediate"); + } + catch(...) + { + test(false); + } } tprintf("ok\n"); tprintf("slicing of known most derived as base... "); fflush(stdout); { - try - { - test->knownMostDerivedAsBase(); - test(false); - } - catch(const KnownMostDerived& kmd) - { - test(kmd.b == "KnownMostDerived.b"); - test(kmd.ki == "KnownMostDerived.ki"); - test(kmd.kmd == "KnownMostDerived.kmd"); - test(kmd.ice_name() =="Test::KnownMostDerived"); - } - catch(...) - { - test(false); - } + try + { + test->knownMostDerivedAsBase(); + test(false); + } + catch(const KnownMostDerived& kmd) + { + test(kmd.b == "KnownMostDerived.b"); + test(kmd.ki == "KnownMostDerived.ki"); + test(kmd.kmd == "KnownMostDerived.kmd"); + test(kmd.ice_name() =="Test::KnownMostDerived"); + } + catch(...) + { + test(false); + } } tprintf("ok\n"); tprintf("non-slicing of known intermediate as intermediate... "); fflush(stdout); { - try - { - test->knownIntermediateAsKnownIntermediate(); - test(false); - } - catch(const KnownIntermediate& ki) - { - test(ki.b == "KnownIntermediate.b"); - test(ki.ki == "KnownIntermediate.ki"); - test(ki.ice_name() =="Test::KnownIntermediate"); - } - catch(...) - { - test(false); - } + try + { + test->knownIntermediateAsKnownIntermediate(); + test(false); + } + catch(const KnownIntermediate& ki) + { + test(ki.b == "KnownIntermediate.b"); + test(ki.ki == "KnownIntermediate.ki"); + test(ki.ice_name() =="Test::KnownIntermediate"); + } + catch(...) + { + test(false); + } } tprintf("ok\n"); tprintf("non-slicing of known most derived exception as intermediate... "); fflush(stdout); { - try - { - test->knownMostDerivedAsKnownIntermediate(); - test(false); - } - catch(const KnownMostDerived& kmd) - { - test(kmd.b == "KnownMostDerived.b"); - test(kmd.ki == "KnownMostDerived.ki"); - test(kmd.kmd == "KnownMostDerived.kmd"); - test(kmd.ice_name() =="Test::KnownMostDerived"); - } - catch(...) - { - test(false); - } + try + { + test->knownMostDerivedAsKnownIntermediate(); + test(false); + } + catch(const KnownMostDerived& kmd) + { + test(kmd.b == "KnownMostDerived.b"); + test(kmd.ki == "KnownMostDerived.ki"); + test(kmd.kmd == "KnownMostDerived.kmd"); + test(kmd.ice_name() =="Test::KnownMostDerived"); + } + catch(...) + { + test(false); + } } tprintf("ok\n"); tprintf("non-slicing of known most derived as most derived... "); fflush(stdout); { - try - { - test->knownMostDerivedAsKnownMostDerived(); - test(false); - } - catch(const KnownMostDerived& kmd) - { - test(kmd.b == "KnownMostDerived.b"); - test(kmd.ki == "KnownMostDerived.ki"); - test(kmd.kmd == "KnownMostDerived.kmd"); - test(kmd.ice_name() =="Test::KnownMostDerived"); - } - catch(...) - { - test(false); - } + try + { + test->knownMostDerivedAsKnownMostDerived(); + test(false); + } + catch(const KnownMostDerived& kmd) + { + test(kmd.b == "KnownMostDerived.b"); + test(kmd.ki == "KnownMostDerived.ki"); + test(kmd.kmd == "KnownMostDerived.kmd"); + test(kmd.ice_name() =="Test::KnownMostDerived"); + } + catch(...) + { + test(false); + } } tprintf("ok\n"); tprintf("slicing of unknown most derived, known intermediate as base... "); fflush(stdout); { - try - { - test->unknownMostDerived1AsBase(); - test(false); - } - catch(const KnownIntermediate& ki) - { - test(ki.b == "UnknownMostDerived1.b"); - test(ki.ki == "UnknownMostDerived1.ki"); - test(ki.ice_name() =="Test::KnownIntermediate"); - } - catch(...) - { - test(false); - } + try + { + test->unknownMostDerived1AsBase(); + test(false); + } + catch(const KnownIntermediate& ki) + { + test(ki.b == "UnknownMostDerived1.b"); + test(ki.ki == "UnknownMostDerived1.ki"); + test(ki.ice_name() =="Test::KnownIntermediate"); + } + catch(...) + { + test(false); + } } tprintf("ok\n"); tprintf("slicing of unknown most derived, known intermediate as intermediate... "); fflush(stdout); { - try - { - test->unknownMostDerived1AsKnownIntermediate(); - test(false); - } - catch(const KnownIntermediate& ki) - { - test(ki.b == "UnknownMostDerived1.b"); - test(ki.ki == "UnknownMostDerived1.ki"); - test(ki.ice_name() =="Test::KnownIntermediate"); - } - catch(...) - { - test(false); - } + try + { + test->unknownMostDerived1AsKnownIntermediate(); + test(false); + } + catch(const KnownIntermediate& ki) + { + test(ki.b == "UnknownMostDerived1.b"); + test(ki.ki == "UnknownMostDerived1.ki"); + test(ki.ice_name() =="Test::KnownIntermediate"); + } + catch(...) + { + test(false); + } } tprintf("ok\n"); tprintf("slicing of unknown most derived, unknown intermediate as base... "); fflush(stdout); { - try - { - test->unknownMostDerived2AsBase(); - test(false); - } - catch(const Base& b) - { - test(b.b == "UnknownMostDerived2.b"); - test(b.ice_name() =="Test::Base"); - } - catch(...) - { - test(false); - } + try + { + test->unknownMostDerived2AsBase(); + test(false); + } + catch(const Base& b) + { + test(b.b == "UnknownMostDerived2.b"); + test(b.ice_name() =="Test::Base"); + } + catch(...) + { + test(false); + } } tprintf("ok\n"); diff --git a/cppe/test/IceE/slicing/Client.cpp b/cppe/test/IceE/slicing/Client.cpp index 62f10a5ca01..7ae8414a960 100644 --- a/cppe/test/IceE/slicing/Client.cpp +++ b/cppe/test/IceE/slicing/Client.cpp @@ -29,7 +29,7 @@ public: Ice::InitializationData initData; initData.properties = Ice::createProperties(); loadConfig(initData.properties); - initData.logger = getLogger(); + initData.logger = getLogger(); setCommunicator(Ice::initialize(argc, argv, initData)); TestIntfPrx allTests(const Ice::CommunicatorPtr&); diff --git a/cppe/test/IceE/slicing/Server.cpp b/cppe/test/IceE/slicing/Server.cpp index 3d21896dbf2..479b3db1982 100644 --- a/cppe/test/IceE/slicing/Server.cpp +++ b/cppe/test/IceE/slicing/Server.cpp @@ -31,7 +31,7 @@ public: initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); loadConfig(initData.properties); - initData.logger = getLogger(); + initData.logger = getLogger(); setCommunicator(Ice::initialize(argc, argv, initData)); Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter"); @@ -40,7 +40,7 @@ public: adapter->activate(); #ifndef _WIN32_WCE - communicator()->waitForShutdown(); + communicator()->waitForShutdown(); #endif return EXIT_SUCCESS; diff --git a/cppe/test/IceE/thread/AliveTest.cpp b/cppe/test/IceE/thread/AliveTest.cpp index 8961b07157f..eda4e37e7a6 100644 --- a/cppe/test/IceE/thread/AliveTest.cpp +++ b/cppe/test/IceE/thread/AliveTest.cpp @@ -21,24 +21,24 @@ class CondVar : public IceUtil::Monitor<IceUtil::RecMutex> public: CondVar() : - _done(false) + _done(false) { } void waitForSignal() { - IceUtil::Monitor<IceUtil::RecMutex>::Lock lock(*this); - while(!_done) - { - wait(); - } + IceUtil::Monitor<IceUtil::RecMutex>::Lock lock(*this); + while(!_done) + { + wait(); + } } void signal() { - IceUtil::Monitor<IceUtil::RecMutex>::Lock lock(*this); - _done = true; - notify(); + IceUtil::Monitor<IceUtil::RecMutex>::Lock lock(*this); + _done = true; + notify(); } private: @@ -51,20 +51,20 @@ class AliveTestThread : public Thread public: AliveTestThread(CondVar& childCreated, CondVar& parentReady) : - _childCreated(childCreated), _parentReady(parentReady) + _childCreated(childCreated), _parentReady(parentReady) { } virtual void run() { - try - { - _childCreated.signal(); - _parentReady.waitForSignal(); - } - catch(IceUtil::ThreadLockedException &) - { - } + try + { + _childCreated.signal(); + _parentReady.waitForSignal(); + } + catch(IceUtil::ThreadLockedException &) + { + } } private: diff --git a/cppe/test/IceE/thread/Client.cpp b/cppe/test/IceE/thread/Client.cpp index 7c38af8b853..a0a25c350bc 100644 --- a/cppe/test/IceE/thread/Client.cpp +++ b/cppe/test/IceE/thread/Client.cpp @@ -27,21 +27,21 @@ public: virtual int run(int argc, char* argv[]) { - try - { - initializeTestSuite(); + try + { + initializeTestSuite(); - for(list<TestBasePtr>::const_iterator p = allTests.begin(); p != allTests.end(); ++p) - { - (*p)->start(); - } - } - catch(const TestFailed& e) - { - tprintf("test %s failed\n", e.name.c_str()); - return EXIT_FAILURE; - } - return EXIT_SUCCESS; + for(list<TestBasePtr>::const_iterator p = allTests.begin(); p != allTests.end(); ++p) + { + (*p)->start(); + } + } + catch(const TestFailed& e) + { + tprintf("test %s failed\n", e.name.c_str()); + return EXIT_FAILURE; + } + return EXIT_SUCCESS; } }; diff --git a/cppe/test/IceE/thread/CreateTest.cpp b/cppe/test/IceE/thread/CreateTest.cpp index 9bee30ac317..70ff6513d7d 100644 --- a/cppe/test/IceE/thread/CreateTest.cpp +++ b/cppe/test/IceE/thread/CreateTest.cpp @@ -25,13 +25,13 @@ class CreateTestThread : public Thread public: CreateTestThread() : - threadran(false) + threadran(false) { } virtual void run() { - threadran = true; + threadran = true; } bool threadran; @@ -56,22 +56,22 @@ CreateTest::run() #endif for(int i = 0; i < nthreads ; ++i) { - CreateTestThreadPtr t = new CreateTestThread(); - ThreadControl control = t->start(); - control.join(); - test(t->threadran); + CreateTestThreadPtr t = new CreateTestThread(); + ThreadControl control = t->start(); + control.join(); + test(t->threadran); #ifdef _WIN32_WCE - if((i % 32) == 0) - { - tprintf("."); - } + if((i % 32) == 0) + { + tprintf("."); + } #else - if((i % 256) == 0) - { - char buf[5]; - sprintf(buf, "%04d", i); - tprintf("%s", buf); - } + if((i % 256) == 0) + { + char buf[5]; + sprintf(buf, "%04d", i); + tprintf("%s", buf); + } #endif } #ifndef _WIN32_WCE diff --git a/cppe/test/IceE/thread/MonitorMutexTest.cpp b/cppe/test/IceE/thread/MonitorMutexTest.cpp index d987205033f..55dbf5531b3 100644 --- a/cppe/test/IceE/thread/MonitorMutexTest.cpp +++ b/cppe/test/IceE/thread/MonitorMutexTest.cpp @@ -20,33 +20,33 @@ class MonitorMutexTestThread : public Thread public: MonitorMutexTestThread(Monitor<Mutex>& m) : - _monitor(m), - _tryLock(false) + _monitor(m), + _tryLock(false) { } virtual void run() { - Monitor<Mutex>::TryLock tlock(_monitor); - test(!tlock.acquired()); - - { - Mutex::Lock lock(_tryLockMutex); - _tryLock = true; - } - _tryLockCond.signal(); - - Monitor<Mutex>::Lock lock(_monitor); + Monitor<Mutex>::TryLock tlock(_monitor); + test(!tlock.acquired()); + + { + Mutex::Lock lock(_tryLockMutex); + _tryLock = true; + } + _tryLockCond.signal(); + + Monitor<Mutex>::Lock lock(_monitor); } void waitTryLock() { - Mutex::Lock lock(_tryLockMutex); - while(!_tryLock) - { - _tryLockCond.wait(lock); - } + Mutex::Lock lock(_tryLockMutex); + while(!_tryLock) + { + _tryLockCond.wait(lock); + } } private: @@ -67,16 +67,16 @@ class MonitorMutexTestThread2 : public Thread public: MonitorMutexTestThread2(Monitor<Mutex>& monitor) : - finished(false), - _monitor(monitor) + finished(false), + _monitor(monitor) { } virtual void run() { - Monitor<Mutex>::Lock lock(_monitor); - _monitor.wait(); - finished = true; + Monitor<Mutex>::Lock lock(_monitor); + _monitor.wait(); + finished = true; } bool finished; @@ -106,23 +106,23 @@ MonitorMutexTest::run() ThreadControl control2; { - Monitor<Mutex>::Lock lock(monitor); - - try - { - Monitor<Mutex>::TryLock tlock(monitor); - test(!tlock.acquired()); - } - catch(const ThreadLockedException&) - { - } - - // TEST: Start thread, try to acquire the mutex. - t = new MonitorMutexTestThread(monitor); - control = t->start(); - - // TEST: Wait until the tryLock has been tested. - t->waitTryLock(); + Monitor<Mutex>::Lock lock(monitor); + + try + { + Monitor<Mutex>::TryLock tlock(monitor); + test(!tlock.acquired()); + } + catch(const ThreadLockedException&) + { + } + + // TEST: Start thread, try to acquire the mutex. + t = new MonitorMutexTestThread(monitor); + control = t->start(); + + // TEST: Wait until the tryLock has been tested. + t->waitTryLock(); } // @@ -141,8 +141,8 @@ MonitorMutexTest::run() ThreadControl::sleep(Time::seconds(1)); { - Monitor<Mutex>::Lock lock(monitor); - monitor.notify(); + Monitor<Mutex>::Lock lock(monitor); + monitor.notify(); } // Give one thread time to terminate @@ -151,8 +151,8 @@ MonitorMutexTest::run() test((t2->finished && !t3->finished) || (t3->finished && !t2->finished)); { - Monitor<Mutex>::Lock lock(monitor); - monitor.notify(); + Monitor<Mutex>::Lock lock(monitor); + monitor.notify(); } control.join(); control2.join(); @@ -167,8 +167,8 @@ MonitorMutexTest::run() ThreadControl::sleep(Time::seconds(1)); { - Monitor<Mutex>::Lock lock(monitor); - monitor.notifyAll(); + Monitor<Mutex>::Lock lock(monitor); + monitor.notifyAll(); } control.join(); @@ -176,7 +176,7 @@ MonitorMutexTest::run() // TEST: timedWait { - Monitor<Mutex>::Lock lock(monitor); - test(!monitor.timedWait(Time::milliSeconds(500))); + Monitor<Mutex>::Lock lock(monitor); + test(!monitor.timedWait(Time::milliSeconds(500))); } } diff --git a/cppe/test/IceE/thread/MonitorRecMutexTest.cpp b/cppe/test/IceE/thread/MonitorRecMutexTest.cpp index ca4c5072a5b..8cd2e1854cd 100644 --- a/cppe/test/IceE/thread/MonitorRecMutexTest.cpp +++ b/cppe/test/IceE/thread/MonitorRecMutexTest.cpp @@ -20,34 +20,34 @@ class MonitorRecMutexTestThread : public Thread public: MonitorRecMutexTestThread(Monitor<RecMutex>& m) : - _monitor(m), - _tryLock(false) + _monitor(m), + _tryLock(false) { } virtual void run() { - - Monitor<RecMutex>::TryLock tlock(_monitor); - test(!tlock.acquired()); - - { - Mutex::Lock lock(_tryLockMutex); - _tryLock = true; - } - _tryLockCond.signal(); - - Monitor<RecMutex>::Lock lock(_monitor); + + Monitor<RecMutex>::TryLock tlock(_monitor); + test(!tlock.acquired()); + + { + Mutex::Lock lock(_tryLockMutex); + _tryLock = true; + } + _tryLockCond.signal(); + + Monitor<RecMutex>::Lock lock(_monitor); } void waitTryLock() { - Mutex::Lock lock(_tryLockMutex); - while(!_tryLock) - { - _tryLockCond.wait(lock); - } + Mutex::Lock lock(_tryLockMutex); + while(!_tryLock) + { + _tryLockCond.wait(lock); + } } private: @@ -68,16 +68,16 @@ class MonitorRecMutexTestThread2 : public Thread, public Monitor<RecMutex> public: MonitorRecMutexTestThread2(Monitor<RecMutex>& monitor) : - finished(false), - _monitor(monitor) + finished(false), + _monitor(monitor) { } virtual void run() { - Monitor<RecMutex>::Lock lock(_monitor); - _monitor.wait(); - finished = true; + Monitor<RecMutex>::Lock lock(_monitor); + _monitor.wait(); + finished = true; } bool finished; @@ -108,22 +108,22 @@ MonitorRecMutexTest::run() { - Monitor<RecMutex>::Lock lock(monitor); - - Monitor<RecMutex>::TryLock lock2(monitor); - test(lock2.acquired()); - - // TEST: TryLock - - Monitor<RecMutex>::TryLock tlock(monitor); - test(tlock.acquired()); - - // TEST: Start thread, try to acquire the mutex. - t = new MonitorRecMutexTestThread(monitor); - control = t->start(); - - // TEST: Wait until the tryLock has been tested. - t->waitTryLock(); + Monitor<RecMutex>::Lock lock(monitor); + + Monitor<RecMutex>::TryLock lock2(monitor); + test(lock2.acquired()); + + // TEST: TryLock + + Monitor<RecMutex>::TryLock tlock(monitor); + test(tlock.acquired()); + + // TEST: Start thread, try to acquire the mutex. + t = new MonitorRecMutexTestThread(monitor); + control = t->start(); + + // TEST: Wait until the tryLock has been tested. + t->waitTryLock(); } // @@ -142,8 +142,8 @@ MonitorRecMutexTest::run() ThreadControl::sleep(Time::seconds(1)); { - Monitor<RecMutex>::Lock lock(monitor); - monitor.notify(); + Monitor<RecMutex>::Lock lock(monitor); + monitor.notify(); } // Give one thread time to terminate @@ -152,8 +152,8 @@ MonitorRecMutexTest::run() test((t2->finished && !t3->finished) || (t3->finished && !t2->finished)); { - Monitor<RecMutex>::Lock lock(monitor); - monitor.notify(); + Monitor<RecMutex>::Lock lock(monitor); + monitor.notify(); } control.join(); control2.join(); @@ -168,8 +168,8 @@ MonitorRecMutexTest::run() ThreadControl::sleep(Time::seconds(1)); { - Monitor<RecMutex>::Lock lock(monitor); - monitor.notifyAll(); + Monitor<RecMutex>::Lock lock(monitor); + monitor.notifyAll(); } control.join(); @@ -177,7 +177,7 @@ MonitorRecMutexTest::run() // TEST: timedWait { - Monitor<RecMutex>::Lock lock(monitor); - test(!monitor.timedWait(Time::milliSeconds(500))); + Monitor<RecMutex>::Lock lock(monitor); + test(!monitor.timedWait(Time::milliSeconds(500))); } } diff --git a/cppe/test/IceE/thread/MutexTest.cpp b/cppe/test/IceE/thread/MutexTest.cpp index b5a29e7e9b2..371af7d08a6 100644 --- a/cppe/test/IceE/thread/MutexTest.cpp +++ b/cppe/test/IceE/thread/MutexTest.cpp @@ -22,33 +22,33 @@ class MutexTestThread : public Thread public: MutexTestThread(Mutex& m) : - _mutex(m), - _tryLock(false) + _mutex(m), + _tryLock(false) { } virtual void run() - { - Mutex::TryLock tlock(_mutex); - test(!tlock.acquired()); + { + Mutex::TryLock tlock(_mutex); + test(!tlock.acquired()); - { - Mutex::Lock lock(_tryLockMutex); - _tryLock = true; - } - _tryLockCond.signal(); + { + Mutex::Lock lock(_tryLockMutex); + _tryLock = true; + } + _tryLockCond.signal(); - Mutex::Lock lock(_mutex); + Mutex::Lock lock(_mutex); } void waitTryLock() { - Mutex::Lock lock(_tryLockMutex); - while(!_tryLock) - { - _tryLockCond.wait(lock); - } + Mutex::Lock lock(_tryLockMutex); + while(!_tryLock) + { + _tryLockCond.wait(lock); + } } private: @@ -77,79 +77,79 @@ MutexTest::run() ThreadControl control; { - Mutex::Lock lock(mutex); - - // LockT testing: - // - - test(lock.acquired()); - - try - { - lock.acquire(); - test(false); - } - catch(const ThreadLockedException&) - { - // Expected - } - - try - { - lock.tryAcquire(); - test(false); - } - catch(const ThreadLockedException&) - { - // Expected - } - - test(lock.acquired()); - lock.release(); - test(!lock.acquired()); - - try - { - lock.release(); - test(false); - } - catch(const ThreadLockedException&) - { - // Expected - } - - Mutex::TryLock lock2(mutex); - try - { - test(lock.tryAcquire() == false); - } - catch(const IceUtil::ThreadLockedException&) - { - } - lock2.release(); - test(lock.tryAcquire() == true); - test(lock.acquired()); - - // Deadlock testing - // + Mutex::Lock lock(mutex); + + // LockT testing: + // + + test(lock.acquired()); + + try + { + lock.acquire(); + test(false); + } + catch(const ThreadLockedException&) + { + // Expected + } + + try + { + lock.tryAcquire(); + test(false); + } + catch(const ThreadLockedException&) + { + // Expected + } + + test(lock.acquired()); + lock.release(); + test(!lock.acquired()); + + try + { + lock.release(); + test(false); + } + catch(const ThreadLockedException&) + { + // Expected + } + + Mutex::TryLock lock2(mutex); + try + { + test(lock.tryAcquire() == false); + } + catch(const IceUtil::ThreadLockedException&) + { + } + lock2.release(); + test(lock.tryAcquire() == true); + test(lock.acquired()); + + // Deadlock testing + // #if !defined(NDEBUG) && !defined(_WIN32) - try - { - Mutex::Lock lock3(mutex); - test(false); - } - catch(const ThreadLockedException&) - { - } + try + { + Mutex::Lock lock3(mutex); + test(false); + } + catch(const ThreadLockedException&) + { + } #endif - // TEST: Start thread, try to acquire the mutex. - t = new MutexTestThread(mutex); - control = t->start(); - - // TEST: Wait until the tryLock has been tested. - t->waitTryLock(); + // TEST: Start thread, try to acquire the mutex. + t = new MutexTestThread(mutex); + control = t->start(); + + // TEST: Wait until the tryLock has been tested. + t->waitTryLock(); } // diff --git a/cppe/test/IceE/thread/RecMutexTest.cpp b/cppe/test/IceE/thread/RecMutexTest.cpp index 3d52bb13164..0e4d8c14fb7 100644 --- a/cppe/test/IceE/thread/RecMutexTest.cpp +++ b/cppe/test/IceE/thread/RecMutexTest.cpp @@ -22,34 +22,34 @@ class RecMutexTestThread : public Thread public: RecMutexTestThread(RecMutex& m) : - _mutex(m), - _tryLock(false) + _mutex(m), + _tryLock(false) { } virtual void run() { - - RecMutex::TryLock tlock(_mutex); - test(!tlock.acquired()); - - { - Mutex::Lock lock(_tryLockMutex); - _tryLock = true; - } - _tryLockCond.signal(); - - RecMutex::Lock lock(_mutex); + + RecMutex::TryLock tlock(_mutex); + test(!tlock.acquired()); + + { + Mutex::Lock lock(_tryLockMutex); + _tryLock = true; + } + _tryLockCond.signal(); + + RecMutex::Lock lock(_mutex); } void waitTryLock() { - Mutex::Lock lock(_tryLockMutex); - while(!_tryLock) - { - _tryLockCond.wait(lock); - } + Mutex::Lock lock(_tryLockMutex); + while(!_tryLock) + { + _tryLockCond.wait(lock); + } } private: @@ -78,22 +78,22 @@ RecMutexTest::run() ThreadControl control; { - RecMutex::Lock lock(mutex); - - // TEST: lock twice - RecMutex::Lock lock2(mutex); - - // TEST: TryLock - RecMutex::TryLock lock3(mutex); - test(lock3.acquired()); - - // TEST: Start thread, try to acquire the mutex. - t = new RecMutexTestThread(mutex); - control = t->start(); - - // TEST: Wait until the tryLock has been tested. - t->waitTryLock(); - + RecMutex::Lock lock(mutex); + + // TEST: lock twice + RecMutex::Lock lock2(mutex); + + // TEST: TryLock + RecMutex::TryLock lock3(mutex); + test(lock3.acquired()); + + // TEST: Start thread, try to acquire the mutex. + t = new RecMutexTestThread(mutex); + control = t->start(); + + // TEST: Wait until the tryLock has been tested. + t->waitTryLock(); + } // diff --git a/cppe/test/IceE/thread/StartTest.cpp b/cppe/test/IceE/thread/StartTest.cpp index fc19b8e1907..5545b1a737b 100644 --- a/cppe/test/IceE/thread/StartTest.cpp +++ b/cppe/test/IceE/thread/StartTest.cpp @@ -32,8 +32,8 @@ public: virtual void run() { - IceUtil::Mutex::Lock sync(threadCountMutex); - --threadCount; + IceUtil::Mutex::Lock sync(threadCountMutex); + --threadCount; } }; @@ -55,8 +55,8 @@ StartTest::run() control.join(); try { - t->start(); - test(false); + t->start(); + test(false); } catch(const ThreadStartedException&) { @@ -69,39 +69,39 @@ StartTest::run() #ifdef _WIN32_WCE for(int i = 0; i < 50; i++) { - for(int j = 0; j < 5; j++) - { - { - IceUtil::Mutex::Lock sync(threadCountMutex); - ++threadCount; - } - Thread* t = new StartTestThread; - t->start().detach(); - } + for(int j = 0; j < 5; j++) + { + { + IceUtil::Mutex::Lock sync(threadCountMutex); + ++threadCount; + } + Thread* t = new StartTestThread; + t->start().detach(); + } - // Wait for the threads to all terminate. I don't want to use - // a monitor here, since monitor hasn't been tested yet. - while(true) - { - { - IceUtil::Mutex::Lock sync(threadCountMutex); - if(threadCount == 0) - { - break; - } - } - ThreadControl::sleep(Time::milliSeconds(5)); - } + // Wait for the threads to all terminate. I don't want to use + // a monitor here, since monitor hasn't been tested yet. + while(true) + { + { + IceUtil::Mutex::Lock sync(threadCountMutex); + if(threadCount == 0) + { + break; + } + } + ThreadControl::sleep(Time::milliSeconds(5)); + } } #else for(int i = 0; i < 50; i++) { - for(int j = 0; j < 50; j++) - { - Thread* t = new StartTestThread; - t->start().detach(); - } - ThreadControl::sleep(Time::milliSeconds(5)); + for(int j = 0; j < 50; j++) + { + Thread* t = new StartTestThread; + t->start().detach(); + } + ThreadControl::sleep(Time::milliSeconds(5)); } #endif } diff --git a/cppe/test/IceE/thread/StaticMutexTest.cpp b/cppe/test/IceE/thread/StaticMutexTest.cpp index f7c40712bc7..e1133d04dde 100644 --- a/cppe/test/IceE/thread/StaticMutexTest.cpp +++ b/cppe/test/IceE/thread/StaticMutexTest.cpp @@ -25,32 +25,32 @@ class StaticMutexTestThread : public Thread public: StaticMutexTestThread() : - _tryLock(false) + _tryLock(false) { } virtual void run() - { - StaticMutex::TryLock tlock(staticMutex); - test(!tlock.acquired()); + { + StaticMutex::TryLock tlock(staticMutex); + test(!tlock.acquired()); - { - Mutex::Lock lock(_tryLockMutex); - _tryLock = true; - } - _tryLockCond.signal(); + { + Mutex::Lock lock(_tryLockMutex); + _tryLock = true; + } + _tryLockCond.signal(); - StaticMutex::Lock lock(staticMutex); + StaticMutex::Lock lock(staticMutex); } void waitTryLock() { - Mutex::Lock lock(_tryLockMutex); - while(!_tryLock) - { - _tryLockCond.wait(lock); - } + Mutex::Lock lock(_tryLockMutex); + while(!_tryLock) + { + _tryLockCond.wait(lock); + } } private: @@ -77,70 +77,70 @@ StaticMutexTest::run() ThreadControl control; { - StaticMutex::Lock lock(staticMutex); - - // LockT testing: - // - - test(lock.acquired()); - - try - { - lock.acquire(); - test(false); - } - catch(const ThreadLockedException&) - { - // Expected - } - - try - { - lock.tryAcquire(); - test(false); - } - catch(const ThreadLockedException&) - { - // Expected - } - - test(lock.acquired()); - lock.release(); - test(!lock.acquired()); - - try - { - lock.release(); - test(false); - } - catch(const ThreadLockedException&) - { - // Expected - } - - StaticMutex::TryLock lock2(staticMutex); - // - // Under WinCE tryAcquire() does not do recursion checks. - // + StaticMutex::Lock lock(staticMutex); + + // LockT testing: + // + + test(lock.acquired()); + + try + { + lock.acquire(); + test(false); + } + catch(const ThreadLockedException&) + { + // Expected + } + + try + { + lock.tryAcquire(); + test(false); + } + catch(const ThreadLockedException&) + { + // Expected + } + + test(lock.acquired()); + lock.release(); + test(!lock.acquired()); + + try + { + lock.release(); + test(false); + } + catch(const ThreadLockedException&) + { + // Expected + } + + StaticMutex::TryLock lock2(staticMutex); + // + // Under WinCE tryAcquire() does not do recursion checks. + // #ifndef _WIN32_WCE - try - { - test(lock.tryAcquire() == false); - } - catch(const IceUtil::ThreadLockedException&) - { - } - lock2.release(); - test(lock.tryAcquire() == true); - test(lock.acquired()); + try + { + test(lock.tryAcquire() == false); + } + catch(const IceUtil::ThreadLockedException&) + { + } + lock2.release(); + test(lock.tryAcquire() == true); + test(lock.acquired()); #endif - // TEST: Start thread, try to acquire the mutex. - t = new StaticMutexTestThread; - control = t->start(); - - // TEST: Wait until the tryLock has been tested. - t->waitTryLock(); + // TEST: Start thread, try to acquire the mutex. + t = new StaticMutexTestThread; + control = t->start(); + + // TEST: Wait until the tryLock has been tested. + t->waitTryLock(); } // diff --git a/cppe/test/IceE/thread/TestBase.cpp b/cppe/test/IceE/thread/TestBase.cpp index 7fdb25442eb..6628ad2f3c4 100644 --- a/cppe/test/IceE/thread/TestBase.cpp +++ b/cppe/test/IceE/thread/TestBase.cpp @@ -38,12 +38,12 @@ TestBase::start() tprintf("running %s test... ", _name.c_str()); try { - run(); + run(); } catch(const IceUtil::Exception& e) { tprintf("%s failed\n", e.toString().c_str()); - throw TestFailed(_name); + throw TestFailed(_name); } tprintf("ok\n"); } diff --git a/cppe/test/IceE/uuid/Client.cpp b/cppe/test/IceE/uuid/Client.cpp index ae3645ba9b4..62daa8a64b2 100644 --- a/cppe/test/IceE/uuid/Client.cpp +++ b/cppe/test/IceE/uuid/Client.cpp @@ -31,36 +31,36 @@ class CountedBarrier : public Shared, public Monitor<Mutex> public: CountedBarrier(int count) : - _count(count) + _count(count) { } void decrement() { - Lock sync(*this); - --_count; - if(_count == 0) - { - notifyAll(); - } + Lock sync(*this); + --_count; + if(_count == 0) + { + notifyAll(); + } } void waitZero() { - Lock sync(*this); - while(_count != 0) - { - wait(); - } + Lock sync(*this); + while(_count != 0) + { + wait(); + } } bool isZero() const { - Lock sync(*this); - return _count == 0; + Lock sync(*this); + return _count == 0; } private: @@ -74,63 +74,63 @@ class InsertThread : public Thread, public Mutex public: InsertThread(const CountedBarrierPtr& start, const CountedBarrierPtr& stop, int threadId, set<string>& uuidSet, long howMany, bool verbose) - : _start(start), _stop(stop), _threadId(threadId), _uuidSet(uuidSet), _howMany(howMany), _verbose(verbose), _destroyed(false) + : _start(start), _stop(stop), _threadId(threadId), _uuidSet(uuidSet), _howMany(howMany), _verbose(verbose), _destroyed(false) { } virtual void run() { - _start->decrement(); - _start->waitZero(); - - for(long i = 0; i < _howMany && !destroyed(); i++) - { - string uuid = generateUUID(); - { - StaticMutex::Lock lock(staticMutex); - pair<set<string>::iterator, bool> ok = _uuidSet.insert(uuid); - if(!ok.second) - { - tprintf("******* iteration %d\n", i); - tprintf("******* Duplicate UUID: %s\n", (*ok.first).c_str()); - } - - test(ok.second); - } + _start->decrement(); + _start->waitZero(); + + for(long i = 0; i < _howMany && !destroyed(); i++) + { + string uuid = generateUUID(); + { + StaticMutex::Lock lock(staticMutex); + pair<set<string>::iterator, bool> ok = _uuidSet.insert(uuid); + if(!ok.second) + { + tprintf("******* iteration %d\n", i); + tprintf("******* Duplicate UUID: %s\n", (*ok.first).c_str()); + } + + test(ok.second); + } #ifdef _WIN32_WCE - if(i > 0 && (i % 100) == 0) - { - tprintf("."); - } + if(i > 0 && (i % 100) == 0) + { + tprintf("."); + } #else - if(_verbose && i > 0 && (i % 100000 == 0)) - { - tprintf("Thread %d: generated %d UUIDs.\n", _threadId, i); - } + if(_verbose && i > 0 && (i % 100000 == 0)) + { + tprintf("Thread %d: generated %d UUIDs.\n", _threadId, i); + } #endif - } + } - _stop->decrement(); + _stop->decrement(); #ifdef _WIN32_WCE - // This will cause the main thread to wake. - tprintf("."); + // This will cause the main thread to wake. + tprintf("."); #endif } void destroy() { - Lock sync(*this); - _destroyed = true; + Lock sync(*this); + _destroyed = true; } bool destroyed() const { - Lock sync(*this); - return _destroyed; + Lock sync(*this); + return _destroyed; } private: @@ -166,56 +166,56 @@ public: if(argc > 3) { - usage(argv[0]); - return EXIT_FAILURE; + usage(argv[0]); + return EXIT_FAILURE; } else if(argc == 3) { - howMany = atol(argv[1]); - if (howMany == 0) - { - usage(argv[0]); - return EXIT_FAILURE; - } - threadCount = atoi(argv[2]); - if(threadCount <= 0) - { - usage(argv[0]); - return EXIT_FAILURE; - } - verbose = true; + howMany = atol(argv[1]); + if (howMany == 0) + { + usage(argv[0]); + return EXIT_FAILURE; + } + threadCount = atoi(argv[2]); + if(threadCount <= 0) + { + usage(argv[0]); + return EXIT_FAILURE; + } + verbose = true; } else if(argc == 2) { - howMany = atol(argv[1]); - if (howMany == 0) - { - usage(argv[0]); - return EXIT_FAILURE; - } + howMany = atol(argv[1]); + if (howMany == 0) + { + usage(argv[0]); + return EXIT_FAILURE; + } } - tprintf("Generating %d UUIDs", howMany); + tprintf("Generating %d UUIDs", howMany); tprintf("... "); if(verbose) { - tprintf("\n"); + tprintf("\n"); } - // - // First measure raw time to produce UUIDs. - // + // + // First measure raw time to produce UUIDs. + // Time startTime = Time::now(); - long i; - for(i = 0; i < howMany; i++) - { - generateUUID(); - } + long i; + for(i = 0; i < howMany; i++) + { + generateUUID(); + } #ifdef _WIN32_WCE - if(terminated()) - { - return EXIT_SUCCESS; - } + if(terminated()) + { + return EXIT_SUCCESS; + } #endif Time finish = Time::now(); @@ -227,73 +227,73 @@ public: #endif { tprintf("Each UUID took an average of %.04f ms to generate and insert into a set<string>.\n", - ((double) ((finish - startTime).toMilliSeconds())) / howMany); + ((double) ((finish - startTime).toMilliSeconds())) / howMany); } tprintf("Generating %d UUIDs using %d thread", howMany, threadCount); if(threadCount > 1) { - tprintf("s"); + tprintf("s"); } tprintf("... "); if(verbose) { - tprintf("\n"); + tprintf("\n"); } - set<string> uuidSet; + set<string> uuidSet; - startTime = Time::now(); - vector<InsertThreadPtr> threads; + startTime = Time::now(); + vector<InsertThreadPtr> threads; - CountedBarrierPtr stop = new CountedBarrier(threadCount); - CountedBarrierPtr start = new CountedBarrier(threadCount); + CountedBarrierPtr stop = new CountedBarrier(threadCount); + CountedBarrierPtr start = new CountedBarrier(threadCount); for(i = 0; i < threadCount; i++) { - InsertThreadPtr t = new InsertThread(start, stop, i, uuidSet, howMany / threadCount, verbose); - t->start(); - threads.push_back(t); + InsertThreadPtr t = new InsertThread(start, stop, i, uuidSet, howMany / threadCount, verbose); + t->start(); + threads.push_back(t); } vector<InsertThreadPtr>::iterator p; #ifdef _WIN32_WCE - while(!stop->isZero() && !terminated()) - { - MSG Msg; - if(GetMessage(&Msg, NULL, 0, 0)) - { - // - // Process all pending events. - // - do - { - TranslateMessage(&Msg); - DispatchMessage(&Msg); - } - while(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE)); - } - } - - // - // If the user terminated the app, the destroy all the - // threads. This loop will end once all the threads have gone. - // - if(terminated()) - { - for(p = threads.begin(); p != threads.end(); ++p) - { - (*p)->destroy(); - } - } + while(!stop->isZero() && !terminated()) + { + MSG Msg; + if(GetMessage(&Msg, NULL, 0, 0)) + { + // + // Process all pending events. + // + do + { + TranslateMessage(&Msg); + DispatchMessage(&Msg); + } + while(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE)); + } + } + + // + // If the user terminated the app, the destroy all the + // threads. This loop will end once all the threads have gone. + // + if(terminated()) + { + for(p = threads.begin(); p != threads.end(); ++p) + { + (*p)->destroy(); + } + } #endif - stop->waitZero(); + stop->waitZero(); finish = Time::now(); - for(p = threads.begin(); p != threads.end(); ++p) + for(p = threads.begin(); p != threads.end(); ++p) { - (*p)->getThreadControl().join(); + (*p)->getThreadControl().join(); } tprintf("ok\n"); @@ -303,7 +303,7 @@ public: #endif { tprintf("Each UUID took an average of %.04f ms to generate and insert into a set<string>.\n", - ((double) ((finish - startTime).toMilliSeconds())) / howMany); + ((double) ((finish - startTime).toMilliSeconds())) / howMany); } return EXIT_SUCCESS; |