diff options
author | Matthew Newhook <matthew@zeroc.com> | 2007-05-04 06:44:32 +0000 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2007-05-04 06:44:32 +0000 |
commit | 5331a2d2a56116fff396599f70ec6f1611f7e110 (patch) | |
tree | aff4fbd5f2555c5fac64054a9b42e62180b76d8a /cppe | |
parent | http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=2181 (diff) | |
download | ice-5331a2d2a56116fff396599f70ec6f1611f7e110.tar.bz2 ice-5331a2d2a56116fff396599f70ec6f1611f7e110.tar.xz ice-5331a2d2a56116fff396599f70ec6f1611f7e110.zip |
added proxy test.
Diffstat (limited to 'cppe')
-rwxr-xr-x | cppe/allTests.py | 1 | ||||
-rw-r--r-- | cppe/demo/IceE/chat/ChatClientDlg.cpp | 2 | ||||
-rw-r--r-- | cppe/test/IceE/Makefile | 3 | ||||
-rw-r--r-- | cppe/test/IceE/Makefile.mak | 3 | ||||
-rw-r--r-- | cppe/test/IceE/proxy/.depend | 11 | ||||
-rw-r--r-- | cppe/test/IceE/proxy/AllTests.cpp | 524 | ||||
-rw-r--r-- | cppe/test/IceE/proxy/Client.cpp | 87 | ||||
-rw-r--r-- | cppe/test/IceE/proxy/Collocated.cpp | 70 | ||||
-rw-r--r-- | cppe/test/IceE/proxy/Makefile | 53 | ||||
-rw-r--r-- | cppe/test/IceE/proxy/Makefile.mak | 63 | ||||
-rw-r--r-- | cppe/test/IceE/proxy/Server.cpp | 68 | ||||
-rw-r--r-- | cppe/test/IceE/proxy/Test.ice | 31 | ||||
-rw-r--r-- | cppe/test/IceE/proxy/TestI.cpp | 39 | ||||
-rw-r--r-- | cppe/test/IceE/proxy/TestI.h | 30 | ||||
-rwxr-xr-x | cppe/test/IceE/proxy/run.py | 29 |
15 files changed, 1011 insertions, 3 deletions
diff --git a/cppe/allTests.py b/cppe/allTests.py index 1853008b459..c32eec960b7 100755 --- a/cppe/allTests.py +++ b/cppe/allTests.py @@ -76,6 +76,7 @@ def runTests(args, tests, num = 0): tests = [ "IceE/thread", "IceE/uuid", + "IceE/proxy", "IceE/operations", "IceE/exceptions", "IceE/inheritance", diff --git a/cppe/demo/IceE/chat/ChatClientDlg.cpp b/cppe/demo/IceE/chat/ChatClientDlg.cpp index 85ca4c60cc2..7a78f058531 100644 --- a/cppe/demo/IceE/chat/ChatClientDlg.cpp +++ b/cppe/demo/IceE/chat/ChatClientDlg.cpp @@ -12,7 +12,7 @@ #include <ChatClientDlg.h> #include <ChatConfigDlg.h> #include <Router.h> -#include <IceE/SafeStdio.h> +#include <IceE/IceE.h> #ifdef ICEE_HAS_ROUTER diff --git a/cppe/test/IceE/Makefile b/cppe/test/IceE/Makefile index 971635863c2..126d9837eaf 100644 --- a/cppe/test/IceE/Makefile +++ b/cppe/test/IceE/Makefile @@ -11,7 +11,8 @@ top_srcdir = ../.. include $(top_srcdir)/config/Make.rules -SUBDIRS = operations \ +SUBDIRS = proxy \ + operations \ exceptions \ inheritance \ facets \ diff --git a/cppe/test/IceE/Makefile.mak b/cppe/test/IceE/Makefile.mak index 1d0162fad01..be9f2715c7f 100644 --- a/cppe/test/IceE/Makefile.mak +++ b/cppe/test/IceE/Makefile.mak @@ -11,7 +11,8 @@ top_srcdir = ..\.. !include $(top_srcdir)\config\Make.rules.mak -SUBDIRS = operations \ +SUBDIRS = proxy \ + operations \ exceptions \ inheritance \ facets \ diff --git a/cppe/test/IceE/proxy/.depend b/cppe/test/IceE/proxy/.depend new file mode 100644 index 00000000000..ef99e9fb73b --- /dev/null +++ b/cppe/test/IceE/proxy/.depend @@ -0,0 +1,11 @@ +Test$(OBJEXT): Test.cpp Test.h ../../../include/IceE/ProxyF.h ../../../include/IceE/ProxyHandle.h ../../../include/IceE/Handle.h ../../../include/IceE/ExceptionBase.h ../../../include/IceE/Config.h ../../../include/IceE/ObjectF.h ../../../include/IceE/Shared.h ../../../include/IceE/Mutex.h ../../../include/IceE/Lock.h ../../../include/IceE/ThreadException.h ../../../include/IceE/Exception.h ../../../include/IceE/ScopedArray.h ../../../include/IceE/Proxy.h ../../../include/IceE/ProxyFactoryF.h ../../../include/IceE/ConnectionF.h ../../../include/IceE/ReferenceF.h ../../../include/IceE/CommunicatorF.h ../../../include/IceE/Identity.h ../../../include/IceE/UndefSysMacros.h ../../../include/IceE/OperationMode.h ../../../include/IceE/Outgoing.h ../../../include/IceE/BasicStream.h ../../../include/IceE/Buffer.h ../../../include/IceE/Protocol.h ../../../include/IceE/Unicode.h ../../../include/IceE/StringConverter.h ../../../include/IceE/Object.h ../../../include/IceE/Current.h ../../../include/IceE/ObjectAdapterF.h ../../../include/IceE/DispatchStatus.h ../../../include/IceE/Incoming.h ../../../include/IceE/InstanceF.h ../../../include/IceE/ServantManagerF.h ../../../include/IceE/Connection.h ../../../include/IceE/OutgoingConnectionFactoryF.h ../../../include/IceE/TransceiverF.h ../../../include/IceE/EndpointF.h ../../../include/IceE/LoggerF.h ../../../include/IceE/TraceLevelsF.h ../../../include/IceE/IncomingConnectionFactoryF.h ../../../include/IceE/Monitor.h ../../../include/IceE/Cond.h ../../../include/IceE/Time.h ../../../include/IceE/Thread.h ../../../include/IceE/LocalException.h ../../../include/IceE/BuiltinSequences.h ../../../include/IceE/Iterator.h +Client$(OBJEXT): Client.cpp ../../../include/IceE/IceE.h ../../../include/IceE/Initialize.h ../../../include/IceE/CommunicatorF.h ../../../include/IceE/Handle.h ../../../include/IceE/ExceptionBase.h ../../../include/IceE/Config.h ../../../include/IceE/Shared.h ../../../include/IceE/Mutex.h ../../../include/IceE/Lock.h ../../../include/IceE/ThreadException.h ../../../include/IceE/Exception.h ../../../include/IceE/PropertiesF.h ../../../include/IceE/LoggerF.h ../../../include/IceE/InstanceF.h ../../../include/IceE/BuiltinSequences.h ../../../include/IceE/ProxyF.h ../../../include/IceE/ProxyHandle.h ../../../include/IceE/ObjectF.h ../../../include/IceE/ScopedArray.h ../../../include/IceE/Proxy.h ../../../include/IceE/ProxyFactoryF.h ../../../include/IceE/ConnectionF.h ../../../include/IceE/ReferenceF.h ../../../include/IceE/Identity.h ../../../include/IceE/UndefSysMacros.h ../../../include/IceE/OperationMode.h ../../../include/IceE/Outgoing.h ../../../include/IceE/BasicStream.h ../../../include/IceE/Buffer.h ../../../include/IceE/Protocol.h ../../../include/IceE/Unicode.h ../../../include/IceE/StringConverter.h ../../../include/IceE/LocalException.h ../../../include/IceE/Properties.h ../../../include/IceE/Logger.h ../../../include/IceE/LoggerUtil.h ../../../include/IceE/Communicator.h ../../../include/IceE/RecMutex.h ../../../include/IceE/ObjectAdapter.h ../../../include/IceE/ObjectAdapterF.h ../../../include/IceE/ObjectAdapterFactoryF.h ../../../include/IceE/IncomingConnectionFactoryF.h ../../../include/IceE/ServantManagerF.h ../../../include/IceE/EndpointF.h ../../../include/IceE/RouterF.h ../../../include/IceE/Object.h ../../../include/IceE/Current.h ../../../include/IceE/DispatchStatus.h ../../../include/IceE/RouterInfoF.h ../../../include/IceE/LocatorF.h ../../../include/IceE/LocatorInfoF.h ../../../include/IceE/Monitor.h ../../../include/IceE/Cond.h ../../../include/IceE/Time.h ../../../include/IceE/Connection.h ../../../include/IceE/OutgoingConnectionFactoryF.h ../../../include/IceE/TransceiverF.h ../../../include/IceE/TraceLevelsF.h ../../../include/IceE/Incoming.h ../../../include/IceE/Thread.h ../../../include/IceE/Functional.h ../../include/TestCommon.h Test.h +AllTests$(OBJEXT): AllTests.cpp ../../../include/IceE/IceE.h ../../../include/IceE/Initialize.h ../../../include/IceE/CommunicatorF.h ../../../include/IceE/Handle.h ../../../include/IceE/ExceptionBase.h ../../../include/IceE/Config.h ../../../include/IceE/Shared.h ../../../include/IceE/Mutex.h ../../../include/IceE/Lock.h ../../../include/IceE/ThreadException.h ../../../include/IceE/Exception.h ../../../include/IceE/PropertiesF.h ../../../include/IceE/LoggerF.h ../../../include/IceE/InstanceF.h ../../../include/IceE/BuiltinSequences.h ../../../include/IceE/ProxyF.h ../../../include/IceE/ProxyHandle.h ../../../include/IceE/ObjectF.h ../../../include/IceE/ScopedArray.h ../../../include/IceE/Proxy.h ../../../include/IceE/ProxyFactoryF.h ../../../include/IceE/ConnectionF.h ../../../include/IceE/ReferenceF.h ../../../include/IceE/Identity.h ../../../include/IceE/UndefSysMacros.h ../../../include/IceE/OperationMode.h ../../../include/IceE/Outgoing.h ../../../include/IceE/BasicStream.h ../../../include/IceE/Buffer.h ../../../include/IceE/Protocol.h ../../../include/IceE/Unicode.h ../../../include/IceE/StringConverter.h ../../../include/IceE/LocalException.h ../../../include/IceE/Properties.h ../../../include/IceE/Logger.h ../../../include/IceE/LoggerUtil.h ../../../include/IceE/Communicator.h ../../../include/IceE/RecMutex.h ../../../include/IceE/ObjectAdapter.h ../../../include/IceE/ObjectAdapterF.h ../../../include/IceE/ObjectAdapterFactoryF.h ../../../include/IceE/IncomingConnectionFactoryF.h ../../../include/IceE/ServantManagerF.h ../../../include/IceE/EndpointF.h ../../../include/IceE/RouterF.h ../../../include/IceE/Object.h ../../../include/IceE/Current.h ../../../include/IceE/DispatchStatus.h ../../../include/IceE/RouterInfoF.h ../../../include/IceE/LocatorF.h ../../../include/IceE/LocatorInfoF.h ../../../include/IceE/Monitor.h ../../../include/IceE/Cond.h ../../../include/IceE/Time.h ../../../include/IceE/Connection.h ../../../include/IceE/OutgoingConnectionFactoryF.h ../../../include/IceE/TransceiverF.h ../../../include/IceE/TraceLevelsF.h ../../../include/IceE/Incoming.h ../../../include/IceE/Thread.h ../../../include/IceE/Functional.h ../../../include/IceE/Locator.h ../../../include/IceE/UserExceptionFactory.h ../../../include/IceE/FactoryTable.h ../../../include/IceE/FactoryTableDef.h ../../../include/IceE/UserExceptionFactoryF.h ../../../include/IceE/StaticMutex.h ../../../include/IceE/Router.h ../../include/TestCommon.h Test.h +Test$(OBJEXT): Test.cpp Test.h ../../../include/IceE/ProxyF.h ../../../include/IceE/ProxyHandle.h ../../../include/IceE/Handle.h ../../../include/IceE/ExceptionBase.h ../../../include/IceE/Config.h ../../../include/IceE/ObjectF.h ../../../include/IceE/Shared.h ../../../include/IceE/Mutex.h ../../../include/IceE/Lock.h ../../../include/IceE/ThreadException.h ../../../include/IceE/Exception.h ../../../include/IceE/ScopedArray.h ../../../include/IceE/Proxy.h ../../../include/IceE/ProxyFactoryF.h ../../../include/IceE/ConnectionF.h ../../../include/IceE/ReferenceF.h ../../../include/IceE/CommunicatorF.h ../../../include/IceE/Identity.h ../../../include/IceE/UndefSysMacros.h ../../../include/IceE/OperationMode.h ../../../include/IceE/Outgoing.h ../../../include/IceE/BasicStream.h ../../../include/IceE/Buffer.h ../../../include/IceE/Protocol.h ../../../include/IceE/Unicode.h ../../../include/IceE/StringConverter.h ../../../include/IceE/Object.h ../../../include/IceE/Current.h ../../../include/IceE/ObjectAdapterF.h ../../../include/IceE/DispatchStatus.h ../../../include/IceE/Incoming.h ../../../include/IceE/InstanceF.h ../../../include/IceE/ServantManagerF.h ../../../include/IceE/Connection.h ../../../include/IceE/OutgoingConnectionFactoryF.h ../../../include/IceE/TransceiverF.h ../../../include/IceE/EndpointF.h ../../../include/IceE/LoggerF.h ../../../include/IceE/TraceLevelsF.h ../../../include/IceE/IncomingConnectionFactoryF.h ../../../include/IceE/Monitor.h ../../../include/IceE/Cond.h ../../../include/IceE/Time.h ../../../include/IceE/Thread.h ../../../include/IceE/LocalException.h ../../../include/IceE/BuiltinSequences.h ../../../include/IceE/Iterator.h +TestI$(OBJEXT): TestI.cpp ../../../include/IceE/IceE.h ../../../include/IceE/Initialize.h ../../../include/IceE/CommunicatorF.h ../../../include/IceE/Handle.h ../../../include/IceE/ExceptionBase.h ../../../include/IceE/Config.h ../../../include/IceE/Shared.h ../../../include/IceE/Mutex.h ../../../include/IceE/Lock.h ../../../include/IceE/ThreadException.h ../../../include/IceE/Exception.h ../../../include/IceE/PropertiesF.h ../../../include/IceE/LoggerF.h ../../../include/IceE/InstanceF.h ../../../include/IceE/BuiltinSequences.h ../../../include/IceE/ProxyF.h ../../../include/IceE/ProxyHandle.h ../../../include/IceE/ObjectF.h ../../../include/IceE/ScopedArray.h ../../../include/IceE/Proxy.h ../../../include/IceE/ProxyFactoryF.h ../../../include/IceE/ConnectionF.h ../../../include/IceE/ReferenceF.h ../../../include/IceE/Identity.h ../../../include/IceE/UndefSysMacros.h ../../../include/IceE/OperationMode.h ../../../include/IceE/Outgoing.h ../../../include/IceE/BasicStream.h ../../../include/IceE/Buffer.h ../../../include/IceE/Protocol.h ../../../include/IceE/Unicode.h ../../../include/IceE/StringConverter.h ../../../include/IceE/LocalException.h ../../../include/IceE/Properties.h ../../../include/IceE/Logger.h ../../../include/IceE/LoggerUtil.h ../../../include/IceE/Communicator.h ../../../include/IceE/RecMutex.h ../../../include/IceE/ObjectAdapter.h ../../../include/IceE/ObjectAdapterF.h ../../../include/IceE/ObjectAdapterFactoryF.h ../../../include/IceE/IncomingConnectionFactoryF.h ../../../include/IceE/ServantManagerF.h ../../../include/IceE/EndpointF.h ../../../include/IceE/RouterF.h ../../../include/IceE/Object.h ../../../include/IceE/Current.h ../../../include/IceE/DispatchStatus.h ../../../include/IceE/RouterInfoF.h ../../../include/IceE/LocatorF.h ../../../include/IceE/LocatorInfoF.h ../../../include/IceE/Monitor.h ../../../include/IceE/Cond.h ../../../include/IceE/Time.h ../../../include/IceE/Connection.h ../../../include/IceE/OutgoingConnectionFactoryF.h ../../../include/IceE/TransceiverF.h ../../../include/IceE/TraceLevelsF.h ../../../include/IceE/Incoming.h ../../../include/IceE/Thread.h ../../../include/IceE/Functional.h TestI.h Test.h ../../include/TestCommon.h +Server$(OBJEXT): Server.cpp ../../../include/IceE/IceE.h ../../../include/IceE/Initialize.h ../../../include/IceE/CommunicatorF.h ../../../include/IceE/Handle.h ../../../include/IceE/ExceptionBase.h ../../../include/IceE/Config.h ../../../include/IceE/Shared.h ../../../include/IceE/Mutex.h ../../../include/IceE/Lock.h ../../../include/IceE/ThreadException.h ../../../include/IceE/Exception.h ../../../include/IceE/PropertiesF.h ../../../include/IceE/LoggerF.h ../../../include/IceE/InstanceF.h ../../../include/IceE/BuiltinSequences.h ../../../include/IceE/ProxyF.h ../../../include/IceE/ProxyHandle.h ../../../include/IceE/ObjectF.h ../../../include/IceE/ScopedArray.h ../../../include/IceE/Proxy.h ../../../include/IceE/ProxyFactoryF.h ../../../include/IceE/ConnectionF.h ../../../include/IceE/ReferenceF.h ../../../include/IceE/Identity.h ../../../include/IceE/UndefSysMacros.h ../../../include/IceE/OperationMode.h ../../../include/IceE/Outgoing.h ../../../include/IceE/BasicStream.h ../../../include/IceE/Buffer.h ../../../include/IceE/Protocol.h ../../../include/IceE/Unicode.h ../../../include/IceE/StringConverter.h ../../../include/IceE/LocalException.h ../../../include/IceE/Properties.h ../../../include/IceE/Logger.h ../../../include/IceE/LoggerUtil.h ../../../include/IceE/Communicator.h ../../../include/IceE/RecMutex.h ../../../include/IceE/ObjectAdapter.h ../../../include/IceE/ObjectAdapterF.h ../../../include/IceE/ObjectAdapterFactoryF.h ../../../include/IceE/IncomingConnectionFactoryF.h ../../../include/IceE/ServantManagerF.h ../../../include/IceE/EndpointF.h ../../../include/IceE/RouterF.h ../../../include/IceE/Object.h ../../../include/IceE/Current.h ../../../include/IceE/DispatchStatus.h ../../../include/IceE/RouterInfoF.h ../../../include/IceE/LocatorF.h ../../../include/IceE/LocatorInfoF.h ../../../include/IceE/Monitor.h ../../../include/IceE/Cond.h ../../../include/IceE/Time.h ../../../include/IceE/Connection.h ../../../include/IceE/OutgoingConnectionFactoryF.h ../../../include/IceE/TransceiverF.h ../../../include/IceE/TraceLevelsF.h ../../../include/IceE/Incoming.h ../../../include/IceE/Thread.h ../../../include/IceE/Functional.h TestI.h Test.h +Test$(OBJEXT): Test.cpp Test.h ../../../include/IceE/ProxyF.h ../../../include/IceE/ProxyHandle.h ../../../include/IceE/Handle.h ../../../include/IceE/ExceptionBase.h ../../../include/IceE/Config.h ../../../include/IceE/ObjectF.h ../../../include/IceE/Shared.h ../../../include/IceE/Mutex.h ../../../include/IceE/Lock.h ../../../include/IceE/ThreadException.h ../../../include/IceE/Exception.h ../../../include/IceE/ScopedArray.h ../../../include/IceE/Proxy.h ../../../include/IceE/ProxyFactoryF.h ../../../include/IceE/ConnectionF.h ../../../include/IceE/ReferenceF.h ../../../include/IceE/CommunicatorF.h ../../../include/IceE/Identity.h ../../../include/IceE/UndefSysMacros.h ../../../include/IceE/OperationMode.h ../../../include/IceE/Outgoing.h ../../../include/IceE/BasicStream.h ../../../include/IceE/Buffer.h ../../../include/IceE/Protocol.h ../../../include/IceE/Unicode.h ../../../include/IceE/StringConverter.h ../../../include/IceE/Object.h ../../../include/IceE/Current.h ../../../include/IceE/ObjectAdapterF.h ../../../include/IceE/DispatchStatus.h ../../../include/IceE/Incoming.h ../../../include/IceE/InstanceF.h ../../../include/IceE/ServantManagerF.h ../../../include/IceE/Connection.h ../../../include/IceE/OutgoingConnectionFactoryF.h ../../../include/IceE/TransceiverF.h ../../../include/IceE/EndpointF.h ../../../include/IceE/LoggerF.h ../../../include/IceE/TraceLevelsF.h ../../../include/IceE/IncomingConnectionFactoryF.h ../../../include/IceE/Monitor.h ../../../include/IceE/Cond.h ../../../include/IceE/Time.h ../../../include/IceE/Thread.h ../../../include/IceE/LocalException.h ../../../include/IceE/BuiltinSequences.h ../../../include/IceE/Iterator.h +TestI$(OBJEXT): TestI.cpp ../../../include/IceE/IceE.h ../../../include/IceE/Initialize.h ../../../include/IceE/CommunicatorF.h ../../../include/IceE/Handle.h ../../../include/IceE/ExceptionBase.h ../../../include/IceE/Config.h ../../../include/IceE/Shared.h ../../../include/IceE/Mutex.h ../../../include/IceE/Lock.h ../../../include/IceE/ThreadException.h ../../../include/IceE/Exception.h ../../../include/IceE/PropertiesF.h ../../../include/IceE/LoggerF.h ../../../include/IceE/InstanceF.h ../../../include/IceE/BuiltinSequences.h ../../../include/IceE/ProxyF.h ../../../include/IceE/ProxyHandle.h ../../../include/IceE/ObjectF.h ../../../include/IceE/ScopedArray.h ../../../include/IceE/Proxy.h ../../../include/IceE/ProxyFactoryF.h ../../../include/IceE/ConnectionF.h ../../../include/IceE/ReferenceF.h ../../../include/IceE/Identity.h ../../../include/IceE/UndefSysMacros.h ../../../include/IceE/OperationMode.h ../../../include/IceE/Outgoing.h ../../../include/IceE/BasicStream.h ../../../include/IceE/Buffer.h ../../../include/IceE/Protocol.h ../../../include/IceE/Unicode.h ../../../include/IceE/StringConverter.h ../../../include/IceE/LocalException.h ../../../include/IceE/Properties.h ../../../include/IceE/Logger.h ../../../include/IceE/LoggerUtil.h ../../../include/IceE/Communicator.h ../../../include/IceE/RecMutex.h ../../../include/IceE/ObjectAdapter.h ../../../include/IceE/ObjectAdapterF.h ../../../include/IceE/ObjectAdapterFactoryF.h ../../../include/IceE/IncomingConnectionFactoryF.h ../../../include/IceE/ServantManagerF.h ../../../include/IceE/EndpointF.h ../../../include/IceE/RouterF.h ../../../include/IceE/Object.h ../../../include/IceE/Current.h ../../../include/IceE/DispatchStatus.h ../../../include/IceE/RouterInfoF.h ../../../include/IceE/LocatorF.h ../../../include/IceE/LocatorInfoF.h ../../../include/IceE/Monitor.h ../../../include/IceE/Cond.h ../../../include/IceE/Time.h ../../../include/IceE/Connection.h ../../../include/IceE/OutgoingConnectionFactoryF.h ../../../include/IceE/TransceiverF.h ../../../include/IceE/TraceLevelsF.h ../../../include/IceE/Incoming.h ../../../include/IceE/Thread.h ../../../include/IceE/Functional.h TestI.h Test.h ../../include/TestCommon.h +Collocated$(OBJEXT): Collocated.cpp ../../../include/IceE/IceE.h ../../../include/IceE/Initialize.h ../../../include/IceE/CommunicatorF.h ../../../include/IceE/Handle.h ../../../include/IceE/ExceptionBase.h ../../../include/IceE/Config.h ../../../include/IceE/Shared.h ../../../include/IceE/Mutex.h ../../../include/IceE/Lock.h ../../../include/IceE/ThreadException.h ../../../include/IceE/Exception.h ../../../include/IceE/PropertiesF.h ../../../include/IceE/LoggerF.h ../../../include/IceE/InstanceF.h ../../../include/IceE/BuiltinSequences.h ../../../include/IceE/ProxyF.h ../../../include/IceE/ProxyHandle.h ../../../include/IceE/ObjectF.h ../../../include/IceE/ScopedArray.h ../../../include/IceE/Proxy.h ../../../include/IceE/ProxyFactoryF.h ../../../include/IceE/ConnectionF.h ../../../include/IceE/ReferenceF.h ../../../include/IceE/Identity.h ../../../include/IceE/UndefSysMacros.h ../../../include/IceE/OperationMode.h ../../../include/IceE/Outgoing.h ../../../include/IceE/BasicStream.h ../../../include/IceE/Buffer.h ../../../include/IceE/Protocol.h ../../../include/IceE/Unicode.h ../../../include/IceE/StringConverter.h ../../../include/IceE/LocalException.h ../../../include/IceE/Properties.h ../../../include/IceE/Logger.h ../../../include/IceE/LoggerUtil.h ../../../include/IceE/Communicator.h ../../../include/IceE/RecMutex.h ../../../include/IceE/ObjectAdapter.h ../../../include/IceE/ObjectAdapterF.h ../../../include/IceE/ObjectAdapterFactoryF.h ../../../include/IceE/IncomingConnectionFactoryF.h ../../../include/IceE/ServantManagerF.h ../../../include/IceE/EndpointF.h ../../../include/IceE/RouterF.h ../../../include/IceE/Object.h ../../../include/IceE/Current.h ../../../include/IceE/DispatchStatus.h ../../../include/IceE/RouterInfoF.h ../../../include/IceE/LocatorF.h ../../../include/IceE/LocatorInfoF.h ../../../include/IceE/Monitor.h ../../../include/IceE/Cond.h ../../../include/IceE/Time.h ../../../include/IceE/Connection.h ../../../include/IceE/OutgoingConnectionFactoryF.h ../../../include/IceE/TransceiverF.h ../../../include/IceE/TraceLevelsF.h ../../../include/IceE/Incoming.h ../../../include/IceE/Thread.h ../../../include/IceE/Functional.h TestI.h Test.h +AllTests$(OBJEXT): AllTests.cpp ../../../include/IceE/IceE.h ../../../include/IceE/Initialize.h ../../../include/IceE/CommunicatorF.h ../../../include/IceE/Handle.h ../../../include/IceE/ExceptionBase.h ../../../include/IceE/Config.h ../../../include/IceE/Shared.h ../../../include/IceE/Mutex.h ../../../include/IceE/Lock.h ../../../include/IceE/ThreadException.h ../../../include/IceE/Exception.h ../../../include/IceE/PropertiesF.h ../../../include/IceE/LoggerF.h ../../../include/IceE/InstanceF.h ../../../include/IceE/BuiltinSequences.h ../../../include/IceE/ProxyF.h ../../../include/IceE/ProxyHandle.h ../../../include/IceE/ObjectF.h ../../../include/IceE/ScopedArray.h ../../../include/IceE/Proxy.h ../../../include/IceE/ProxyFactoryF.h ../../../include/IceE/ConnectionF.h ../../../include/IceE/ReferenceF.h ../../../include/IceE/Identity.h ../../../include/IceE/UndefSysMacros.h ../../../include/IceE/OperationMode.h ../../../include/IceE/Outgoing.h ../../../include/IceE/BasicStream.h ../../../include/IceE/Buffer.h ../../../include/IceE/Protocol.h ../../../include/IceE/Unicode.h ../../../include/IceE/StringConverter.h ../../../include/IceE/LocalException.h ../../../include/IceE/Properties.h ../../../include/IceE/Logger.h ../../../include/IceE/LoggerUtil.h ../../../include/IceE/Communicator.h ../../../include/IceE/RecMutex.h ../../../include/IceE/ObjectAdapter.h ../../../include/IceE/ObjectAdapterF.h ../../../include/IceE/ObjectAdapterFactoryF.h ../../../include/IceE/IncomingConnectionFactoryF.h ../../../include/IceE/ServantManagerF.h ../../../include/IceE/EndpointF.h ../../../include/IceE/RouterF.h ../../../include/IceE/Object.h ../../../include/IceE/Current.h ../../../include/IceE/DispatchStatus.h ../../../include/IceE/RouterInfoF.h ../../../include/IceE/LocatorF.h ../../../include/IceE/LocatorInfoF.h ../../../include/IceE/Monitor.h ../../../include/IceE/Cond.h ../../../include/IceE/Time.h ../../../include/IceE/Connection.h ../../../include/IceE/OutgoingConnectionFactoryF.h ../../../include/IceE/TransceiverF.h ../../../include/IceE/TraceLevelsF.h ../../../include/IceE/Incoming.h ../../../include/IceE/Thread.h ../../../include/IceE/Functional.h ../../../include/IceE/Locator.h ../../../include/IceE/UserExceptionFactory.h ../../../include/IceE/FactoryTable.h ../../../include/IceE/FactoryTableDef.h ../../../include/IceE/UserExceptionFactoryF.h ../../../include/IceE/StaticMutex.h ../../../include/IceE/Router.h ../../include/TestCommon.h Test.h +Test.cpp: Test.ice diff --git a/cppe/test/IceE/proxy/AllTests.cpp b/cppe/test/IceE/proxy/AllTests.cpp new file mode 100644 index 00000000000..67c29f48f47 --- /dev/null +++ b/cppe/test/IceE/proxy/AllTests.cpp @@ -0,0 +1,524 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <IceE/IceE.h> +#ifdef ICEE_HAS_ROUTER +#include <IceE/Router.h> +#endif +#ifdef ICEE_HAS_LOCATOR +#include <IceE/Locator.h> +#endif +#include <TestCommon.h> +#include <Test.h> + +using namespace std; + +Test::MyClassPrx +allTests(const Ice::CommunicatorPtr& communicator) +{ + tprintf("testing stringToProxy... "); + string ref = "test:default -p 12010 -t 10000"; + Ice::ObjectPrx base = communicator->stringToProxy(ref); + test(base); + + Ice::ObjectPrx b1 = communicator->stringToProxy("test:tcp"); + test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category.empty() && + b1->ice_getFacet().empty()); + b1 = communicator->stringToProxy("test :tcp"); + test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category.empty() && + b1->ice_getFacet().empty()); + b1 = communicator->stringToProxy(" test :tcp"); + test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category.empty() && + b1->ice_getFacet().empty()); + b1 = communicator->stringToProxy(" test:tcp"); + test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category.empty() && + b1->ice_getFacet().empty()); + b1 = communicator->stringToProxy("'test -f facet':tcp"); + test(b1->ice_getIdentity().name == "test -f facet" && b1->ice_getIdentity().category.empty() && + b1->ice_getFacet().empty()); + try + { + b1 = communicator->stringToProxy("\"test -f facet':tcp"); + test(false); + } + catch(const Ice::ProxyParseException&) + { + } + b1 = communicator->stringToProxy("\"test -f facet\":tcp"); + test(b1->ice_getIdentity().name == "test -f facet" && b1->ice_getIdentity().category.empty() && + b1->ice_getFacet().empty()); + b1 = communicator->stringToProxy("\"test -f facet@test\":tcp"); + test(b1->ice_getIdentity().name == "test -f facet@test" && b1->ice_getIdentity().category.empty() && + b1->ice_getFacet().empty()); + b1 = communicator->stringToProxy("\"test -f facet@test @test\":tcp"); + test(b1->ice_getIdentity().name == "test -f facet@test @test" && b1->ice_getIdentity().category.empty() && + b1->ice_getFacet().empty()); + try + { + b1 = communicator->stringToProxy("test test:tcp"); + test(false); + } + catch(const Ice::ProxyParseException&) + { + } + b1 = communicator->stringToProxy("test\\040test:tcp"); + test(b1->ice_getIdentity().name == "test test" && b1->ice_getIdentity().category.empty()); + try + { + b1 = communicator->stringToProxy("test\\777:tcp"); + test(false); + } + catch(const Ice::IdentityParseException&) + { + } + b1 = communicator->stringToProxy("test\\40test:tcp"); + test(b1->ice_getIdentity().name == "test test"); + + // Test some octal and hex corner cases. + b1 = communicator->stringToProxy("test\\4test:tcp"); + test(b1->ice_getIdentity().name == "test\4test"); + b1 = communicator->stringToProxy("test\\04test:tcp"); + test(b1->ice_getIdentity().name == "test\4test"); + b1 = communicator->stringToProxy("test\\004test:tcp"); + test(b1->ice_getIdentity().name == "test\4test"); + b1 = communicator->stringToProxy("test\\1114test:tcp"); + test(b1->ice_getIdentity().name == "test\1114test"); + + b1 = communicator->stringToProxy("test\\b\\f\\n\\r\\t\\'\\\"\\\\test:tcp"); + test(b1->ice_getIdentity().name == "test\b\f\n\r\t\'\"\\test" && b1->ice_getIdentity().category.empty()); + + b1 = communicator->stringToProxy("category/test:tcp"); + test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category == "category"); + +#ifdef ICEE_HAS_LOCATOR + b1 = communicator->stringToProxy("test@adapter"); + test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category.empty() && + b1->ice_getAdapterId() == "adapter"); + try + { + b1 = communicator->stringToProxy("id@adapter test"); + test(false); + } + catch(const Ice::ProxyParseException&) + { + } + b1 = communicator->stringToProxy("category/test@adapter"); + test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category == "category" && + b1->ice_getAdapterId() == "adapter"); + b1 = communicator->stringToProxy("category/test@adapter:tcp"); + test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category == "category" && + b1->ice_getAdapterId() == "adapter:tcp"); + b1 = communicator->stringToProxy("'category 1/test'@adapter"); + test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category == "category 1" && + b1->ice_getAdapterId() == "adapter"); + b1 = communicator->stringToProxy("'category/test 1'@adapter"); + test(b1->ice_getIdentity().name == "test 1" && b1->ice_getIdentity().category == "category" && + b1->ice_getAdapterId() == "adapter"); + b1 = communicator->stringToProxy("'category/test'@'adapter 1'"); + test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category == "category" && + b1->ice_getAdapterId() == "adapter 1"); + b1 = communicator->stringToProxy("\"category \\/test@foo/test\"@adapter"); + test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category == "category /test@foo" && + b1->ice_getAdapterId() == "adapter"); + b1 = communicator->stringToProxy("\"category \\/test@foo/test\"@\"adapter:tcp\""); + test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category == "category /test@foo" && + b1->ice_getAdapterId() == "adapter:tcp"); +#endif + + b1 = communicator->stringToProxy("id -f facet:tcp"); + test(b1->ice_getIdentity().name == "id" && b1->ice_getIdentity().category.empty() && + b1->ice_getFacet() == "facet"); + b1 = communicator->stringToProxy("id -f 'facet x':tcp"); + test(b1->ice_getIdentity().name == "id" && b1->ice_getIdentity().category.empty() && + b1->ice_getFacet() == "facet x"); + b1 = communicator->stringToProxy("id -f \"facet x\":tcp"); + test(b1->ice_getIdentity().name == "id" && b1->ice_getIdentity().category.empty() && + b1->ice_getFacet() == "facet x"); + try + { + b1 = communicator->stringToProxy("id -f \"facet x:tcp"); + test(false); + } + catch(const Ice::ProxyParseException&) + { + } + try + { + b1 = communicator->stringToProxy("id -f \'facet x:tcp"); + test(false); + } + catch(const Ice::ProxyParseException&) + { + } + b1 = communicator->stringToProxy("test -f facet:tcp"); + test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category.empty() && + b1->ice_getFacet() == "facet"); + b1 = communicator->stringToProxy("test -f \"facet:tcp\":tcp"); + test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category.empty() && + b1->ice_getFacet() == "facet:tcp"); +#ifdef ICEE_HAS_LOCATOR + b1 = communicator->stringToProxy("test -f facet@test"); + test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category.empty() && + b1->ice_getFacet() == "facet" && b1->ice_getAdapterId() == "test"); + b1 = communicator->stringToProxy("test -f 'facet@test'"); + test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category.empty() && + b1->ice_getFacet() == "facet@test" && b1->ice_getAdapterId().empty()); + b1 = communicator->stringToProxy("test -f 'facet@test'@test"); + test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category.empty() && + b1->ice_getFacet() == "facet@test" && b1->ice_getAdapterId() == "test"); + try + { + b1 = communicator->stringToProxy("test -f facet@test @test"); + test(false); + } + catch(const Ice::ProxyParseException&) + { + } +#endif + b1 = communicator->stringToProxy("test:tcp"); + test(b1->ice_isTwoway()); + b1 = communicator->stringToProxy("test -t:tcp"); + test(b1->ice_isTwoway()); + b1 = communicator->stringToProxy("test -o:tcp:tcp"); + test(b1->ice_isOneway()); + b1 = communicator->stringToProxy("test -O:tcp"); + test(b1->ice_isBatchOneway()); + //b1 = communicator->stringToProxy("test -d:tcp"); + //test(b1->ice_isDatagram()); + //b1 = communicator->stringToProxy("test -D:tcp"); + //test(b1->ice_isBatchDatagram()); + //b1 = communicator->stringToProxy("test:tcp"); + //test(!b1->ice_isSecure()); + //b1 = communicator->stringToProxy("test -s:tcp"); + //test(b1->ice_isSecure()); + + try + { + b1 = communicator->stringToProxy("test:tcp@adapterId"); + test(false); + } + catch(const Ice::EndpointParseException&) + { + } + // This is an unknown endpoint warning, not a parse exception. + // + //try + //{ + // b1 = communicator->stringToProxy("test -f the:facet:tcp"); + // test(false); + //} + //catch(const Ice::EndpointParseException&) + //{ + //} + try + { + b1 = communicator->stringToProxy("test::tcp"); + test(false); + } + catch(const Ice::EndpointParseException&) + { + } + tprintf("ok\n"); + + tprintf("testing propertyToProxy... "); + Ice::PropertiesPtr prop = communicator->getProperties(); + string propertyPrefix = "Foo.Proxy"; + prop->setProperty(propertyPrefix, "test:default -p 12010 -t 10000"); + b1 = communicator->propertyToProxy(propertyPrefix); + test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category.empty() && + b1->ice_getFacet().empty()); + + // These two properties don't do anything to direct proxies so + // first we test that. +#ifdef ICEE_HAS_LOCATOR + string property = propertyPrefix + ".Locator"; + test(!b1->ice_getLocator()); + prop->setProperty(property, "locator:default -p 10000"); + b1 = communicator->propertyToProxy(propertyPrefix); + test(!b1->ice_getLocator()); + prop->setProperty(property, ""); +#endif + +/* + property = propertyPrefix + ".LocatorCacheTimeout"; + test(b1->ice_getLocatorCacheTimeout() == 0); + prop->setProperty(property, "1"); + b1 = communicator->propertyToProxy(propertyPrefix); + test(b1->ice_getLocatorCacheTimeout() == 0); + prop->setProperty(property, ""); + */ + + // Now retest with an indirect proxy. +#ifdef ICEE_HAS_LOCATOR + prop->setProperty(propertyPrefix, "test"); + property = propertyPrefix + ".Locator"; + prop->setProperty(property, "locator:default -p 10000"); + b1 = communicator->propertyToProxy(propertyPrefix); + test(b1->ice_getLocator() && b1->ice_getLocator()->ice_getIdentity().name == "locator"); + prop->setProperty(property, ""); +#endif + +/* + property = propertyPrefix + ".LocatorCacheTimeout"; + test(b1->ice_getLocatorCacheTimeout() == -1); + prop->setProperty(property, "1"); + b1 = communicator->propertyToProxy(propertyPrefix); + test(b1->ice_getLocatorCacheTimeout() == 1); + prop->setProperty(property, ""); + */ + + // This cannot be tested so easily because the property is cached + // on communicator initialization. + // + //prop->setProperty("Ice.Default.LocatorCacheTimeout", "60"); + //b1 = communicator->propertyToProxy(propertyPrefix); + //test(b1->ice_getLocatorCacheTimeout() == 60); + //prop->setProperty("Ice.Default.LocatorCacheTimeout", ""); + + prop->setProperty(propertyPrefix, "test:default -p 12010 -t 10000"); + +#ifdef ICEE_HAS_ROUTER + property = propertyPrefix + ".Router"; + test(!b1->ice_getRouter()); + prop->setProperty(property, "router:default -p 10000"); + b1 = communicator->propertyToProxy(propertyPrefix); + test(b1->ice_getRouter() && b1->ice_getRouter()->ice_getIdentity().name == "router"); + prop->setProperty(property, ""); +#endif + + /* + property = propertyPrefix + ".PreferSecure"; + test(!b1->ice_isPreferSecure()); + prop->setProperty(property, "1"); + b1 = communicator->propertyToProxy(propertyPrefix); + test(b1->ice_isPreferSecure()); + prop->setProperty(property, ""); + + property = propertyPrefix + ".ConnectionCached"; + test(b1->ice_isConnectionCached()); + prop->setProperty(property, "0"); + b1 = communicator->propertyToProxy(propertyPrefix); + test(!b1->ice_isConnectionCached()); + prop->setProperty(property, ""); + + property = propertyPrefix + ".EndpointSelection"; + test(b1->ice_getEndpointSelection() == Ice::Random); + prop->setProperty(property, "Random"); + b1 = communicator->propertyToProxy(propertyPrefix); + test(b1->ice_getEndpointSelection() == Ice::Random); + prop->setProperty(property, "Ordered"); + b1 = communicator->propertyToProxy(propertyPrefix); + test(b1->ice_getEndpointSelection() == Ice::Ordered); + prop->setProperty(property, ""); + + property = propertyPrefix + ".CollocationOptimization"; + test(b1->ice_isCollocationOptimized()); + prop->setProperty(property, "0"); + b1 = communicator->propertyToProxy(propertyPrefix); + test(!b1->ice_isCollocationOptimized()); + prop->setProperty(property, ""); + + property = propertyPrefix + ".ThreadPerConnection"; + test(!b1->ice_isThreadPerConnection()); + prop->setProperty(property, "1"); + b1 = communicator->propertyToProxy(propertyPrefix); + test(b1->ice_isThreadPerConnection()); + prop->setProperty(property, ""); +*/ + + tprintf("ok\n"); + + tprintf("testing ice_getCommunicator... "); + test(base->ice_getCommunicator() == communicator); + tprintf("ok\n"); + + tprintf("testing proxy methods... "); + test(communicator->identityToString(base->ice_identity(communicator->stringToIdentity("other"))->ice_getIdentity()) + == "other"); + test(base->ice_facet("facet")->ice_getFacet() == "facet"); +#ifdef ICEE_HAS_LOCATOR + test(base->ice_adapterId("id")->ice_getAdapterId() == "id"); +#endif + test(base->ice_twoway()->ice_isTwoway()); + test(base->ice_oneway()->ice_isOneway()); + test(base->ice_batchOneway()->ice_isBatchOneway()); + //test(base->ice_datagram()->ice_isDatagram()); + //test(base->ice_batchDatagram()->ice_isBatchDatagram()); + //test(base->ice_secure(true)->ice_isSecure()); + //test(!base->ice_secure(false)->ice_isSecure()); + //test(base->ice_collocationOptimized(true)->ice_isCollocationOptimized()); + //test(!base->ice_collocationOptimized(false)->ice_isCollocationOptimized()); + tprintf("ok\n"); + + tprintf("testing proxy comparison... "); + + test(communicator->stringToProxy("foo:tcp") == communicator->stringToProxy("foo:tcp")); + test(communicator->stringToProxy("foo:tcp") != communicator->stringToProxy("foo2:tcp")); + test(communicator->stringToProxy("foo:tcp") < communicator->stringToProxy("foo2:tcp")); + test(!(communicator->stringToProxy("foo2:tcp") < communicator->stringToProxy("foo:tcp"))); + + Ice::ObjectPrx compObj = communicator->stringToProxy("foo:tcp"); + + test(compObj->ice_facet("facet") == compObj->ice_facet("facet")); + test(compObj->ice_facet("facet") != compObj->ice_facet("facet1")); + test(compObj->ice_facet("facet") < compObj->ice_facet("facet1")); + test(!(compObj->ice_facet("facet") < compObj->ice_facet("facet"))); + + test(compObj->ice_oneway() == compObj->ice_oneway()); + test(compObj->ice_oneway() != compObj->ice_twoway()); + test(compObj->ice_twoway() < compObj->ice_oneway()); + test(!(compObj->ice_oneway() < compObj->ice_twoway())); + +/* + test(compObj->ice_secure(true) == compObj->ice_secure(true)); + test(compObj->ice_secure(false) != compObj->ice_secure(true)); + test(compObj->ice_secure(false) < compObj->ice_secure(true)); + test(!(compObj->ice_secure(true) < compObj->ice_secure(false))); + + test(compObj->ice_collocationOptimized(true) == compObj->ice_collocationOptimized(true)); + test(compObj->ice_collocationOptimized(false) != compObj->ice_collocationOptimized(true)); + test(compObj->ice_collocationOptimized(false) < compObj->ice_collocationOptimized(true)); + test(!(compObj->ice_collocationOptimized(true) < compObj->ice_collocationOptimized(false))); + + test(compObj->ice_connectionCached(true) == compObj->ice_connectionCached(true)); + test(compObj->ice_connectionCached(false) != compObj->ice_connectionCached(true)); + test(compObj->ice_connectionCached(false) < compObj->ice_connectionCached(true)); + test(!(compObj->ice_connectionCached(true) < compObj->ice_connectionCached(false))); + + test(compObj->ice_endpointSelection(Ice::Random) == compObj->ice_endpointSelection(Ice::Random)); + test(compObj->ice_endpointSelection(Ice::Random) != compObj->ice_endpointSelection(Ice::Ordered)); + test(compObj->ice_endpointSelection(Ice::Random) < compObj->ice_endpointSelection(Ice::Ordered)); + test(!(compObj->ice_endpointSelection(Ice::Ordered) < compObj->ice_endpointSelection(Ice::Random))); + + test(compObj->ice_connectionId("id2") == compObj->ice_connectionId("id2")); + test(compObj->ice_connectionId("id1") != compObj->ice_connectionId("id2")); + test(compObj->ice_connectionId("id1") < compObj->ice_connectionId("id2")); + test(!(compObj->ice_connectionId("id2") < compObj->ice_connectionId("id1"))); + + test(compObj->ice_compress(true) == compObj->ice_compress(true)); + test(compObj->ice_compress(false) != compObj->ice_compress(true)); + test(compObj->ice_compress(false) < compObj->ice_compress(true)); + test(!(compObj->ice_compress(true) < compObj->ice_compress(false))); +*/ + + test(compObj->ice_timeout(20) == compObj->ice_timeout(20)); + test(compObj->ice_timeout(10) != compObj->ice_timeout(20)); + test(compObj->ice_timeout(10) < compObj->ice_timeout(20)); + test(!(compObj->ice_timeout(20) < compObj->ice_timeout(10))); + + Ice::ObjectPrx compObj1 = communicator->stringToProxy("foo:tcp -h 127.0.0.1 -p 10000"); + Ice::ObjectPrx compObj2 = communicator->stringToProxy("foo:tcp -h 127.0.0.1 -p 10001"); + test(compObj1 != compObj2); + test(compObj1 < compObj2); + test(!(compObj2 < compObj1)); + +#ifdef ICEE_HAS_LOCATOR + compObj1 = communicator->stringToProxy("foo@MyAdapter1"); + compObj2 = communicator->stringToProxy("foo@MyAdapter2"); + test(compObj1 != compObj2); + test(compObj1 < compObj2); + test(!(compObj2 < compObj1)); +#endif + +/* + test(compObj1->ice_locatorCacheTimeout(20) == compObj1->ice_locatorCacheTimeout(20)); + test(compObj1->ice_locatorCacheTimeout(10) != compObj1->ice_locatorCacheTimeout(20)); + test(compObj1->ice_locatorCacheTimeout(10) < compObj1->ice_locatorCacheTimeout(20)); + test(!(compObj1->ice_locatorCacheTimeout(20) < compObj1->ice_locatorCacheTimeout(10))); +*/ + +#ifdef ICEE_HAS_LOCATOR + compObj1 = communicator->stringToProxy("foo:tcp -h 127.0.0.1 -p 1000"); + compObj2 = communicator->stringToProxy("foo@MyAdapter1"); + test(compObj1 != compObj2); + test(compObj1 < compObj2); + test(!(compObj2 < compObj1)); +#endif + + // + // TODO: Ideally we should also test comparison of fixed proxies. + // + + tprintf("ok\n"); + + tprintf("testing checked cast... "); + Test::MyClassPrx cl = Test::MyClassPrx::checkedCast(base); + test(cl); + + Test::MyDerivedClassPrx derived = Test::MyDerivedClassPrx::checkedCast(cl); + test(derived); + test(cl == base); + test(derived == base); + test(cl == derived); + +#ifdef ICEE_HAS_LOCATOR + Ice::LocatorPrx loc = Ice::LocatorPrx::checkedCast(base); + test(loc == 0); +#endif + + // + // Upcasting + // + Test::MyClassPrx cl2 = Test::MyClassPrx::checkedCast(derived); + Ice::ObjectPrx obj = Ice::ObjectPrx::checkedCast(derived); + test(cl2); + test(obj); + test(cl2 == obj); + test(cl2 == derived); + + // + // Now with alternate API + // + cl = checkedCast<Test::MyClassPrx>(base); + test(cl); + derived = checkedCast<Test::MyDerivedClassPrx>(cl); + test(derived); + test(cl == base); + test(derived == base); + test(cl == derived); + +#ifdef ICEE_HAS_LOCATOR + loc = checkedCast<Ice::LocatorPrx>(base); + test(loc == 0); +#endif + + cl2 = checkedCast<Test::MyClassPrx>(derived); + obj = checkedCast<Ice::ObjectPrx>(derived); + test(cl2); + test(obj); + test(cl2 == obj); + test(cl2 == derived); + + tprintf("ok\n"); + + tprintf("testing checked cast with context... "); + Ice::Context c = cl->getContext(); + test(c.size() == 0); + + c["one"] = "hello"; + c["two"] = "world"; + cl = Test::MyClassPrx::checkedCast(base, c); + Ice::Context c2 = cl->getContext(); + test(c == c2); + + // + // Now with alternate API + // + cl = checkedCast<Test::MyClassPrx>(base); + c = cl->getContext(); + test(c.size() == 0); + + cl = checkedCast<Test::MyClassPrx>(base, c); + c2 = cl->getContext(); + test(c == c2); + + tprintf("ok\n"); + + return cl; +} diff --git a/cppe/test/IceE/proxy/Client.cpp b/cppe/test/IceE/proxy/Client.cpp new file mode 100644 index 00000000000..29ac4493f94 --- /dev/null +++ b/cppe/test/IceE/proxy/Client.cpp @@ -0,0 +1,87 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. +// +// This copy of Ice-E is licensed to you under the terms described in the +// ICEE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <IceE/IceE.h> +#include <TestCommon.h> +#include <TestApplication.h> +#include <Test.h> + +using namespace std; + +class ProxyTestApplication : public TestApplication +{ +public: + + ProxyTestApplication() : + TestApplication("proxy client") + { + } + + virtual int + run(int argc, char* argv[]) + { + Ice::InitializationData initData; + initData.properties = Ice::createProperties(); + + // + // In this test, we need at least two threads in the + // client side thread pool for nested AMI. + // + initData.properties->setProperty("Ice.ThreadPool.Client.Size", "2"); + initData.properties->setProperty("Ice.ThreadPool.Client.SizeWarn", "0"); + + 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"); + + // + // Use a faster connection monitor timeout to test AMI + // timeouts. + // + communicator()->getProperties()->setProperty("Ice.MonitorConnections", "1"); + + Test::MyClassPrx allTests(const Ice::CommunicatorPtr&); + Test::MyClassPrx myClass = allTests(communicator()); + + myClass->shutdown(); + + return EXIT_SUCCESS; + } +}; + +#ifdef _WIN32_WCE + +int WINAPI +WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) +{ + ProxyTestApplication app; + return app.main(hInstance); +} + +#else + +int +main(int argc, char** argv) +{ + ProxyTestApplication app; + return app.main(argc, argv); +} + +#endif diff --git a/cppe/test/IceE/proxy/Collocated.cpp b/cppe/test/IceE/proxy/Collocated.cpp new file mode 100644 index 00000000000..34a066e4131 --- /dev/null +++ b/cppe/test/IceE/proxy/Collocated.cpp @@ -0,0 +1,70 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. +// +// This copy of Ice-E is licensed to you under the terms described in the +// ICEE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <IceE/IceE.h> +#include <TestCommon.h> +#include <TestApplication.h> +#include <TestI.h> + +using namespace std; + +class ProxyTestApplication : public TestApplication +{ +public: + + ProxyTestApplication() : + TestApplication("proxy collocated") + { + } + + virtual int + run(int argc, char* argv[]) + { + 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)); + + Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter"); + adapter->add(new MyDerivedClassI, communicator()->stringToIdentity("test")); + adapter->activate(); + + Test::MyClassPrx allTests(const Ice::CommunicatorPtr&); + allTests(communicator()); + + return EXIT_SUCCESS; + } +}; + +#ifdef _WIN32_WCE + +int WINAPI +WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) +{ + ProxyTestApplication app; + return app.main(hInstance); +} + +#else + +int +main(int argc, char** argv) +{ + ProxyTestApplication app; + return app.main(argc, argv); +} + +#endif diff --git a/cppe/test/IceE/proxy/Makefile b/cppe/test/IceE/proxy/Makefile new file mode 100644 index 00000000000..0d65ff1be1f --- /dev/null +++ b/cppe/test/IceE/proxy/Makefile @@ -0,0 +1,53 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. +# +# This copy of Ice-E is licensed to you under the terms described in the +# ICEE_LICENSE file included in this distribution. +# +# ********************************************************************** + +top_srcdir = ../../.. + +CLIENT = client +SERVER = server +COLLOCATED = collocated + +TARGETS = $(CLIENT) $(SERVER) $(COLLOCATED) + +COBJS = Test.o \ + Client.o \ + AllTests.o + +SOBJS = Test.o \ + TestI.o \ + Server.o + +COLOBJS = Test.o \ + TestI.o \ + Collocated.o \ + AllTests.o + +SRCS = $(COBJS:.o=.cpp) \ + $(SOBJS:.o=.cpp) \ + $(COLOBJS:.o=.cpp) + +SLICE_SRCS = Test.ice + +include $(top_srcdir)/config/Make.rules + +CPPFLAGS := -I. -I../../include $(CPPFLAGS) + +$(CLIENT): $(COBJS) + rm -f $@ + $(CXX) $(LDFLAGS) -o $@ $(COBJS) $(TESTLIBS) + +$(SERVER): $(SOBJS) + rm -f $@ + $(CXX) $(LDFLAGS) -o $@ $(SOBJS) $(TESTLIBS) + +$(COLLOCATED): $(COLOBJS) + rm -f $@ + $(CXX) $(LDFLAGS) -o $@ $(COLOBJS) $(TESTLIBS) + +include .depend diff --git a/cppe/test/IceE/proxy/Makefile.mak b/cppe/test/IceE/proxy/Makefile.mak new file mode 100644 index 00000000000..5a1e454a7bc --- /dev/null +++ b/cppe/test/IceE/proxy/Makefile.mak @@ -0,0 +1,63 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. +# +# This copy of Ice is licensed to you under the terms described in the +# ICE_LICENSE file included in this distribution. +# +# ********************************************************************** + +top_srcdir = ..\..\.. + +CLIENT = client.exe +SERVER = server.exe +COLLOCATED = collocated.exe + +TARGETS = $(CLIENT) $(SERVER) $(COLLOCATED) + +COBJS = Test.obj \ + Client.obj \ + AllTests.obj + +SOBJS = Test.obj \ + TestI.obj \ + Server.obj + +COLOBJS = Test.obj \ + TestI.obj \ + Collocated.obj \ + AllTests.obj + +SRCS = $(COBJS:.obj=.cpp) \ + $(SOBJS:.obj=.cpp) \ + $(COLOBJS:.obj=.cpp) + +!include $(top_srcdir)/config/Make.rules.mak + +CPPFLAGS = -I. -I../../include $(CPPFLAGS) -WX -DWIN32_LEAN_AND_MEAN + +!if "$(OPTIMIZE_SPEED)" != "yes" & "$(OPTIMIZE_SIZE)" != "yes" +CPDBFLAGS = /pdb:$(CLIENT:.exe=.pdb) +SPDBFLAGS = /pdb:$(SERVER:.exe=.pdb) +COPDBFLAGS = /pdb:$(COLLOCATED:.exe=.pdb) +!endif + +$(CLIENT): $(COBJS) + $(LINK) $(LDFLAGS) $(CPDBFLAGS) $(COBJS) /out:$@ $(TESTLIBS) + @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \ + $(MT) -nologo -manifest $@.manifest -outputresource:$@;#2 && del /q $@.manifest + +$(SERVER): $(SOBJS) + $(LINK) $(LDFLAGS) $(SPDBFLAGS) $(SOBJS) /out:$@ $(TESTLIBS) + @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \ + $(MT) -nologo -manifest $@.manifest -outputresource:$@;#2 && del /q $@.manifest + +$(COLLOCATED): $(COLOBJS) + $(LINK) $(LDFLAGS) $(COPDBFLAGS) $(COLOBJS) /out:$@ $(TESTLIBS) + @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \ + $(MT) -nologo -manifest $@.manifest -outputresource:$@;#2 && del /q $@.manifest + +clean:: + del /q Test.cpp Test.h + +!include .depend diff --git a/cppe/test/IceE/proxy/Server.cpp b/cppe/test/IceE/proxy/Server.cpp new file mode 100644 index 00000000000..307bbd3c870 --- /dev/null +++ b/cppe/test/IceE/proxy/Server.cpp @@ -0,0 +1,68 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. +// +// This copy of Ice-E is licensed to you under the terms described in the +// ICEE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <IceE/IceE.h> +#include <TestCommon.h> +#include <TestApplication.h> +#include <TestI.h> + +using namespace std; + +class ProxyTestApplication : public TestApplication +{ +public: + + ProxyTestApplication() : + TestApplication("proxy server") + { + } + + virtual int + run(int argc, char* argv[]) + { + Ice::InitializationData initData; + initData.properties = Ice::createProperties(); + 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)); + + Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter"); + adapter->add(new MyDerivedClassI, communicator()->stringToIdentity("test")); + adapter->activate(); + +#ifndef _WIN32_WCE + communicator()->waitForShutdown(); +#endif + + return EXIT_SUCCESS; + } +}; + +#ifdef _WIN32_WCE + +int WINAPI +WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) +{ + ProxyTestApplication app; + return app.main(hInstance); +} + +#else + +int +main(int argc, char** argv) +{ + ProxyTestApplication app; + return app.main(argc, argv); +} + +#endif diff --git a/cppe/test/IceE/proxy/Test.ice b/cppe/test/IceE/proxy/Test.ice new file mode 100644 index 00000000000..657adfbe99d --- /dev/null +++ b/cppe/test/IceE/proxy/Test.ice @@ -0,0 +1,31 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef TEST_ICE +#define TEST_ICE + +module Test +{ + +dictionary<string, string> Context; + +["ami"] class MyClass +{ + void shutdown(); + + Context getContext(); +}; + +["ami"] class MyDerivedClass extends MyClass +{ +}; + +}; + +#endif diff --git a/cppe/test/IceE/proxy/TestI.cpp b/cppe/test/IceE/proxy/TestI.cpp new file mode 100644 index 00000000000..be864b304e1 --- /dev/null +++ b/cppe/test/IceE/proxy/TestI.cpp @@ -0,0 +1,39 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <IceE/IceE.h> +#include <TestI.h> +#include <TestCommon.h> + +MyDerivedClassI::MyDerivedClassI() +{ +} + +void +MyDerivedClassI::shutdown(const Ice::Current& c) +{ + c.adapter->getCommunicator()->shutdown(); +} + +Ice::Context +MyDerivedClassI::getContext(const Ice::Current& c) +{ + return _ctx; +} + +bool +MyDerivedClassI::ice_isA(const std::string& s, const Ice::Current& current) const +{ + _ctx = current.ctx; +#ifdef __BCPLUSPLUS__ + return Test::MyDerivedClass::ice_isA(s, current); +#else + return MyDerivedClass::ice_isA(s, current); +#endif +} diff --git a/cppe/test/IceE/proxy/TestI.h b/cppe/test/IceE/proxy/TestI.h new file mode 100644 index 00000000000..a558e5b6823 --- /dev/null +++ b/cppe/test/IceE/proxy/TestI.h @@ -0,0 +1,30 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef TEST_I_H +#define TEST_I_H + +#include <Test.h> + +class MyDerivedClassI : public Test::MyDerivedClass +{ +public: + + MyDerivedClassI(); + + virtual void shutdown(const Ice::Current&); + virtual Ice::Context getContext(const Ice::Current&); + virtual bool ice_isA(const std::string&, const Ice::Current&) const; + +private: + + mutable Ice::Context _ctx; +}; + +#endif diff --git a/cppe/test/IceE/proxy/run.py b/cppe/test/IceE/proxy/run.py new file mode 100755 index 00000000000..70c868e9f69 --- /dev/null +++ b/cppe/test/IceE/proxy/run.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. +# +# This copy of Ice-E is licensed to you under the terms described in the +# ICEE_LICENSE file included in this distribution. +# +# ********************************************************************** + +import os, sys + +for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): + break +else: + raise "can't find toplevel directory!" + +sys.path.append(os.path.join(toplevel, "config")) +import TestUtil + +name = os.path.join("IceE", "proxy") + +print "tests with regular server." +TestUtil.clientServerTest(name) +print "tests with collocated server." +TestUtil.collocatedTest(name) +sys.exit(0) |