diff options
Diffstat (limited to 'cpp')
174 files changed, 10427 insertions, 60 deletions
diff --git a/cpp/allTests.py b/cpp/allTests.py index 2a9bdf02958..d8502e15001 100755 --- a/cpp/allTests.py +++ b/cpp/allTests.py @@ -17,9 +17,14 @@ for toplevel in ["", "..", os.path.join("..", ".."), os.path.join("..", "..", ". else: raise "can't find toplevel directory!" -for name in ["parser", "operations", "exceptions", "inheritance", "faultTolerance", "locationForward"]: +for i in [ ("Slice", "errorDetection"), \ + ("Ice", "operations"), \ + ("Ice", "exceptions"), \ + ("Ice", "inheritance"), \ + ("Ice", "faultTolerance"), \ + ("Ice", "locationForward")]: - dir = os.path.join(toplevel, "test", name) + dir = os.path.join(toplevel, "test", *i) print print "*** running tests in " + dir + ":" diff --git a/cpp/demo/Ice/hello/.depend b/cpp/demo/Ice/hello/.depend new file mode 100644 index 00000000000..d4476a6393c --- /dev/null +++ b/cpp/demo/Ice/hello/.depend @@ -0,0 +1,4 @@ +Hello.o: Hello.cpp Hello.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Shared.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/LocalObject.h ../../include/Ice/LocalException.h +Client.o: Client.cpp ../../include/Ice/Ice.h ../../include/Ice/Communicator.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PicklerF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ValueFactoryF.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/ValueFactory.h ../../include/Ice/Pickler.h ../../include/Ice/Initialize.h Hello.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h +HelloI.o: HelloI.cpp ../../include/Ice/Ice.h ../../include/Ice/Communicator.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PicklerF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ValueFactoryF.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/ValueFactory.h ../../include/Ice/Pickler.h ../../include/Ice/Initialize.h HelloI.h Hello.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h +Server.o: Server.cpp ../../include/Ice/Ice.h ../../include/Ice/Communicator.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PicklerF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ValueFactoryF.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/ValueFactory.h ../../include/Ice/Pickler.h ../../include/Ice/Initialize.h HelloI.h Hello.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h diff --git a/cpp/demo/Ice/hello/Client.cpp b/cpp/demo/Ice/hello/Client.cpp new file mode 100644 index 00000000000..5575853015a --- /dev/null +++ b/cpp/demo/Ice/hello/Client.cpp @@ -0,0 +1,110 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <Hello.h> + +using namespace std; + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + Ice::PropertiesPtr properties = communicator->getProperties(); + std::string ref = properties->getProperty("Hello.Hello"); + Ice::ObjectPrx base = communicator->stringToProxy(ref); + + HelloPrx hello = HelloPrx::checkedCast(base); + if (!hello) + { + cerr << argv[0] << ": invalid object reference" << endl; + return EXIT_FAILURE; + } + + HelloPrx timeout = HelloPrx::uncheckedCast(hello->_timeout(2000)); + HelloPrx secure = HelloPrx::uncheckedCast(hello->_secure()); + HelloPrx oneway = HelloPrx::uncheckedCast(hello->_oneway()); + HelloPrx datagram = HelloPrx::uncheckedCast(hello->_datagram()); + + cout << "h: hello" << endl; + cout << "t: hello w/ 2s timeout" << endl; + cout << "o: hello as oneway" << endl; + cout << "e: hello w/ secure connection" << endl; + cout << "d: hello as datagram" << endl; + cout << "s: shutdown" << endl; + cout << "x: exit" << endl; + + char c; + do + { + cout << "==> "; + cin >> c; + if (c == 'h') + { + hello->hello(); + } + else if (c == 't') + { + timeout->hello(); + } + else if (c == 'o') + { + oneway->hello(); + } + else if (c == 'e') + { + secure->hello(); + } + else if (c == 'd') + { + datagram->hello(); + } + else if (c == 's') + { + hello->shutdown(); + } + } + while (cin.good() && c != 'x'); + + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + Ice::PropertiesPtr properties = Ice::loadProperties("config"); + communicator = Ice::initializeWithProperties(argc, argv, properties); + status = run(argc, argv, communicator); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/demo/Ice/hello/Hello.ice b/cpp/demo/Ice/hello/Hello.ice new file mode 100644 index 00000000000..d0bf7f4b664 --- /dev/null +++ b/cpp/demo/Ice/hello/Hello.ice @@ -0,0 +1,20 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef HELLO_ICE +#define HELLO_ICE + +class Hello +{ + void hello(); + void shutdown(); +}; + +#endif diff --git a/cpp/demo/Ice/hello/HelloI.cpp b/cpp/demo/Ice/hello/HelloI.cpp new file mode 100644 index 00000000000..40bb272f25c --- /dev/null +++ b/cpp/demo/Ice/hello/HelloI.cpp @@ -0,0 +1,32 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <HelloI.h> + +using namespace std; + +HelloI::HelloI(const Ice::CommunicatorPtr& communicator) : + _communicator(communicator) +{ +} + +void +HelloI::hello() +{ + cout << "Hello World!" << endl; +} + +void +HelloI::shutdown() +{ + cout << "Shutting down..." << endl; + _communicator->shutdown(); +} diff --git a/cpp/demo/Ice/hello/HelloI.h b/cpp/demo/Ice/hello/HelloI.h new file mode 100644 index 00000000000..7597638414c --- /dev/null +++ b/cpp/demo/Ice/hello/HelloI.h @@ -0,0 +1,30 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef HELLO_I_H +#define HELLO_I_H + +#include <Hello.h> + +class HelloI : public Hello +{ +public: + + HelloI(const Ice::CommunicatorPtr&); + + virtual void hello(); + virtual void shutdown(); + +private: + + Ice::CommunicatorPtr _communicator; +}; + +#endif diff --git a/cpp/demo/Ice/hello/Makefile b/cpp/demo/Ice/hello/Makefile new file mode 100644 index 00000000000..8e1d3073738 --- /dev/null +++ b/cpp/demo/Ice/hello/Makefile @@ -0,0 +1,48 @@ +# ********************************************************************** +# +# Copyright (c) 2001 +# MutableRealms, Inc. +# Huntsville, AL, USA +# +# All Rights Reserved +# +# ********************************************************************** + +top_srcdir = ../../.. + +CLIENT = client +SERVER = server + +TARGETS = $(CLIENT) $(SERVER) + +OBJS = Hello.o + +COBJS = Client.o + +SOBJS = HelloI.o \ + Server.o + +SRCS = $(OBJS:.o=.cpp) \ + $(COBJS:.o=.cpp) \ + $(SOBJS:.o=.cpp) + +include $(top_srcdir)/config/Make.rules + +CPPFLAGS := -I. $(CPPFLAGS) + +$(CLIENT): $(OBJS) $(COBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(COBJS) $(LIBS) + +$(SERVER): $(OBJS) $(SOBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(SOBJS) $(LIBS) + +Hello.h Hello.cpp: Hello.ice $(SLICE) + rm -f Hello.h Hello.cpp + $(SLICE) Hello.ice + +clean:: + rm -f Hello.h Hello.cpp + +include .depend diff --git a/cpp/demo/Ice/hello/Server.cpp b/cpp/demo/Ice/hello/Server.cpp new file mode 100644 index 00000000000..5a93ea767e8 --- /dev/null +++ b/cpp/demo/Ice/hello/Server.cpp @@ -0,0 +1,59 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <HelloI.h> + +using namespace std; + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("HelloAdapter"); + Ice::ObjectPtr object = new HelloI(communicator); + adapter->add(object, "hello"); + adapter->activate(); + communicator->waitForShutdown(); + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + Ice::PropertiesPtr properties = Ice::loadProperties("config"); + communicator = Ice::initializeWithProperties(argc, argv, properties); + status = run(argc, argv, communicator); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/demo/Ice/hello/helloC.dsp b/cpp/demo/Ice/hello/helloC.dsp new file mode 100644 index 00000000000..28680acbec7 --- /dev/null +++ b/cpp/demo/Ice/hello/helloC.dsp @@ -0,0 +1,153 @@ +# Microsoft Developer Studio Project File - Name="helloC" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=helloC - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "helloC.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "helloC.mak" CFG="helloC - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "helloC - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "helloC - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "helloC - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 jtc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"client.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "helloC - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 jtcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"client.exe" /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "helloC - Win32 Release"
+# Name "helloC - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Hello.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Hello.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Hello.ice
+
+!IF "$(CFG)" == "helloC - Win32 Release"
+
+USERDEP__HELLO="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Hello.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Hello.ice \
+
+
+"Hello.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Hello.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "helloC - Win32 Debug"
+
+USERDEP__HELLO="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Hello.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Hello.ice \
+
+
+"Hello.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Hello.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/demo/Ice/hello/helloS.dsp b/cpp/demo/Ice/hello/helloS.dsp new file mode 100644 index 00000000000..ff69604112c --- /dev/null +++ b/cpp/demo/Ice/hello/helloS.dsp @@ -0,0 +1,161 @@ +# Microsoft Developer Studio Project File - Name="helloS" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=helloS - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "helloS.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "helloS.mak" CFG="helloS - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "helloS - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "helloS - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "helloS - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 jtc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"server.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "helloS - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 jtcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"server.exe" /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "helloS - Win32 Release"
+# Name "helloS - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Hello.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\HelloI.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Server.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Hello.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\HelloI.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Hello.ice
+
+!IF "$(CFG)" == "helloS - Win32 Release"
+
+USERDEP__HELLO="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Hello.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Hello.ice \
+
+
+"Hello.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Hello.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "helloS - Win32 Debug"
+
+USERDEP__HELLO="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Hello.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Hello.ice \
+
+
+"Hello.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Hello.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/demo/Ice/latency/.depend b/cpp/demo/Ice/latency/.depend new file mode 100644 index 00000000000..ac587bd1367 --- /dev/null +++ b/cpp/demo/Ice/latency/.depend @@ -0,0 +1,4 @@ +Latency.o: Latency.cpp Latency.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Shared.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/LocalObject.h ../../include/Ice/LocalException.h +Client.o: Client.cpp ../../include/Ice/Ice.h ../../include/Ice/Communicator.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PicklerF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ValueFactoryF.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/ValueFactory.h ../../include/Ice/Pickler.h ../../include/Ice/Initialize.h Latency.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h +LatencyI.o: LatencyI.cpp ../../include/Ice/Ice.h ../../include/Ice/Communicator.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PicklerF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ValueFactoryF.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/ValueFactory.h ../../include/Ice/Pickler.h ../../include/Ice/Initialize.h LatencyI.h Latency.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h +Server.o: Server.cpp ../../include/Ice/Ice.h ../../include/Ice/Communicator.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PicklerF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ValueFactoryF.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/ValueFactory.h ../../include/Ice/Pickler.h ../../include/Ice/Initialize.h LatencyI.h Latency.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h diff --git a/cpp/demo/Ice/latency/Client.cpp b/cpp/demo/Ice/latency/Client.cpp new file mode 100644 index 00000000000..9445e11f48a --- /dev/null +++ b/cpp/demo/Ice/latency/Client.cpp @@ -0,0 +1,115 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <Latency.h> +#ifdef WIN32 +# include <sys/timeb.h> +#else +# include <sys/time.h> +#endif + +using namespace std; + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + Ice::PropertiesPtr properties = communicator->getProperties(); + std::string ref = properties->getProperty("Latency.Ping"); + Ice::ObjectPrx base = communicator->stringToProxy(ref); + + PingPrx ping = PingPrx::checkedCast(base); + if (!ping) + { + cerr << argv[0] << ": invalid object reference" << endl; + return EXIT_FAILURE; + } + + timeval tv1; +#ifdef WIN32 + struct _timeb tb1; + _ftime(&tb1); + tv1.tv_sec = tb1.time; + tv1.tv_usec = tb1.millitm * 1000; +#else + gettimeofday(&tv1, 0); +#endif + + const int repetitions = 100000; + cout << "pinging server " << repetitions << " times (this may take a while)" << endl; + for (int i = 0; i < repetitions; ++i) + ping->ping(); + + timeval tv2; +#ifdef WIN32 + struct _timeb tb2; + _ftime(&tb2); + tv2.tv_sec = tb2.time; + tv2.tv_usec = tb2.millitm * 1000; +#else + gettimeofday(&tv2, 0); +#endif + + timeval tv; + + tv.tv_sec = tv2.tv_sec - tv1.tv_sec; + tv.tv_usec = tv2.tv_usec - tv1.tv_usec; + + tv.tv_sec += tv.tv_usec / 1000000; + tv.tv_usec = tv.tv_usec % 1000000; + + if (tv.tv_usec < 0) + { + tv.tv_usec += 1000000; + tv.tv_sec -= 1; + } + + double total = (tv.tv_sec * 1000000.0 + tv.tv_usec) / 1000.0; + double perPing = total / repetitions; + + cout << "time for " << repetitions << " pings: " << total << "ms" << endl; + cout << "time per ping: " << perPing << "ms" << endl; + + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + Ice::PropertiesPtr properties = Ice::loadProperties("config"); + communicator = Ice::initializeWithProperties(argc, argv, properties); + status = run(argc, argv, communicator); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/demo/Ice/latency/Latency.ice b/cpp/demo/Ice/latency/Latency.ice new file mode 100644 index 00000000000..c2ff682ab17 --- /dev/null +++ b/cpp/demo/Ice/latency/Latency.ice @@ -0,0 +1,19 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef LATENCY_ICE +#define LATENCY_ICE + +class Ping +{ + void ping(); +}; + +#endif diff --git a/cpp/demo/Ice/latency/LatencyI.cpp b/cpp/demo/Ice/latency/LatencyI.cpp new file mode 100644 index 00000000000..16f5b11c8ce --- /dev/null +++ b/cpp/demo/Ice/latency/LatencyI.cpp @@ -0,0 +1,17 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <LatencyI.h> + +void +PingI::ping() +{ +} diff --git a/cpp/demo/Ice/latency/LatencyI.h b/cpp/demo/Ice/latency/LatencyI.h new file mode 100644 index 00000000000..7345d88ff02 --- /dev/null +++ b/cpp/demo/Ice/latency/LatencyI.h @@ -0,0 +1,23 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef LATENCY_I_H +#define LATENCY_I_H + +#include <Latency.h> + +class PingI : public Ping +{ +public: + + virtual void ping(); +}; + +#endif diff --git a/cpp/demo/Ice/latency/Makefile b/cpp/demo/Ice/latency/Makefile new file mode 100644 index 00000000000..71a665c1d36 --- /dev/null +++ b/cpp/demo/Ice/latency/Makefile @@ -0,0 +1,48 @@ +# ********************************************************************** +# +# Copyright (c) 2001 +# MutableRealms, Inc. +# Huntsville, AL, USA +# +# All Rights Reserved +# +# ********************************************************************** + +top_srcdir = ../../.. + +CLIENT = client +SERVER = server + +TARGETS = $(CLIENT) $(SERVER) + +OBJS = Latency.o + +COBJS = Client.o + +SOBJS = LatencyI.o \ + Server.o + +SRCS = $(OBJS:.o=.cpp) \ + $(COBJS:.o=.cpp) \ + $(SOBJS:.o=.cpp) + +include $(top_srcdir)/config/Make.rules + +CPPFLAGS := -I. $(CPPFLAGS) + +$(CLIENT): $(OBJS) $(COBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(COBJS) $(LIBS) + +$(SERVER): $(OBJS) $(SOBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(SOBJS) $(LIBS) + +Latency.h Latency.cpp: Latency.ice $(SLICE) + rm -f Latency.h Latency.cpp + $(SLICE) Latency.ice + +clean:: + rm -f Latency.h Latency.cpp + +include .depend diff --git a/cpp/demo/Ice/latency/Server.cpp b/cpp/demo/Ice/latency/Server.cpp new file mode 100644 index 00000000000..5ec63450707 --- /dev/null +++ b/cpp/demo/Ice/latency/Server.cpp @@ -0,0 +1,59 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <LatencyI.h> + +using namespace std; + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("LatencyAdapter"); + Ice::ObjectPtr object = new PingI; + adapter->add(object, "ping"); + adapter->activate(); + communicator->waitForShutdown(); + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + Ice::PropertiesPtr properties = Ice::loadProperties("config"); + communicator = Ice::initializeWithProperties(argc, argv, properties); + status = run(argc, argv, communicator); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/demo/Ice/latency/latencyC.dsp b/cpp/demo/Ice/latency/latencyC.dsp new file mode 100644 index 00000000000..53bcea1ff20 --- /dev/null +++ b/cpp/demo/Ice/latency/latencyC.dsp @@ -0,0 +1,153 @@ +# Microsoft Developer Studio Project File - Name="latencyC" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=latencyC - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "latencyC.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "latencyC.mak" CFG="latencyC - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "latencyC - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "latencyC - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "latencyC - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 jtc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"client.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "latencyC - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 jtcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"client.exe" /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "latencyC - Win32 Release"
+# Name "latencyC - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Latency.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Latency.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Latency.ice
+
+!IF "$(CFG)" == "latencyC - Win32 Release"
+
+USERDEP__LATENCY="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Latency.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Latency.ice \
+
+
+"Latency.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Latency.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "latencyC - Win32 Debug"
+
+USERDEP__LATENCY="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Latency.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Latency.ice \
+
+
+"Latency.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Latency.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/demo/Ice/latency/latencyS.dsp b/cpp/demo/Ice/latency/latencyS.dsp new file mode 100644 index 00000000000..4826de3ce88 --- /dev/null +++ b/cpp/demo/Ice/latency/latencyS.dsp @@ -0,0 +1,161 @@ +# Microsoft Developer Studio Project File - Name="latencyS" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=latencyS - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "latencyS.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "latencyS.mak" CFG="latencyS - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "latencyS - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "latencyS - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "latencyS - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 jtc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"server.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "latencyS - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 jtcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"server.exe" /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "latencyS - Win32 Release"
+# Name "latencyS - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Latency.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\LatencyI.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Server.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Latency.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\LatencyI.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Latency.ice
+
+!IF "$(CFG)" == "latencyS - Win32 Release"
+
+USERDEP__LATENCY="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Latency.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Latency.ice \
+
+
+"Latency.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Latency.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "latencyS - Win32 Debug"
+
+USERDEP__LATENCY="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Latency.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Latency.ice \
+
+
+"Latency.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Latency.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/demo/Ice/pickle/.depend b/cpp/demo/Ice/pickle/.depend new file mode 100644 index 00000000000..46f4d5da6e8 --- /dev/null +++ b/cpp/demo/Ice/pickle/.depend @@ -0,0 +1,4 @@ +Pickle.o: Pickle.cpp Pickle.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Shared.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/LocalObject.h ../../include/Ice/LocalException.h +Reader.o: Reader.cpp ../../include/Ice/Ice.h ../../include/Ice/Communicator.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PicklerF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ValueFactoryF.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/ValueFactory.h ../../include/Ice/Pickler.h ../../include/Ice/Initialize.h Pickle.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h Factory.h +Factory.o: Factory.cpp ../../include/Ice/Ice.h ../../include/Ice/Communicator.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PicklerF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ValueFactoryF.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/ValueFactory.h ../../include/Ice/Pickler.h ../../include/Ice/Initialize.h Factory.h Pickle.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h +Writer.o: Writer.cpp ../../include/Ice/Ice.h ../../include/Ice/Communicator.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PicklerF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ValueFactoryF.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/ValueFactory.h ../../include/Ice/Pickler.h ../../include/Ice/Initialize.h Pickle.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h diff --git a/cpp/demo/Ice/pickle/Factory.cpp b/cpp/demo/Ice/pickle/Factory.cpp new file mode 100644 index 00000000000..be24fc0cea8 --- /dev/null +++ b/cpp/demo/Ice/pickle/Factory.cpp @@ -0,0 +1,25 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <Factory.h> +#include <Pickle.h> + +using namespace std; + +Ice::ObjectPtr +Factory::create(const string& id) +{ + if (id == "::Persistent") + return new Persistent; + + assert(false); + return 0; +} diff --git a/cpp/demo/Ice/pickle/Factory.h b/cpp/demo/Ice/pickle/Factory.h new file mode 100644 index 00000000000..fbb42aef397 --- /dev/null +++ b/cpp/demo/Ice/pickle/Factory.h @@ -0,0 +1,21 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef FACTORY_H +#define FACTORY_H + +class Factory : public Ice::ValueFactory +{ +public: + + virtual Ice::ObjectPtr create(const std::string&); +}; + +#endif diff --git a/cpp/demo/Ice/pickle/Makefile b/cpp/demo/Ice/pickle/Makefile new file mode 100644 index 00000000000..38e81fc1815 --- /dev/null +++ b/cpp/demo/Ice/pickle/Makefile @@ -0,0 +1,48 @@ +# ********************************************************************** +# +# Copyright (c) 2001 +# MutableRealms, Inc. +# Huntsville, AL, USA +# +# All Rights Reserved +# +# ********************************************************************** + +top_srcdir = ../../.. + +READER = reader +WRITER = writer + +TARGETS = $(READER) $(WRITER) + +OBJS = Pickle.o \ + +ROBJS = Reader.o \ + Factory.o + +WOBJS = Writer.o + +SRCS = $(OBJS:.o=.cpp) \ + $(ROBJS:.o=.cpp) \ + $(WOBJS:.o=.cpp) + +include $(top_srcdir)/config/Make.rules + +CPPFLAGS := -I. $(CPPFLAGS) + +$(READER): $(OBJS) $(ROBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(ROBJS) $(LIBS) + +$(WRITER): $(OBJS) $(WOBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(WOBJS) $(LIBS) + +Pickle.h Pickle.cpp: Pickle.ice $(SLICE) + rm -f Pickle.h Pickle.cpp + $(SLICE) Pickle.ice + +clean:: + rm -f Pickle.h Pickle.cpp + +include .depend diff --git a/cpp/demo/Ice/pickle/Pickle.ice b/cpp/demo/Ice/pickle/Pickle.ice new file mode 100644 index 00000000000..212ceb6876c --- /dev/null +++ b/cpp/demo/Ice/pickle/Pickle.ice @@ -0,0 +1,20 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef PICKLE_ICE +#define PICKLE_ICE + +class Persistent +{ + string aString; + double aDouble; +}; + +#endif diff --git a/cpp/demo/Ice/pickle/Reader.cpp b/cpp/demo/Ice/pickle/Reader.cpp new file mode 100644 index 00000000000..9f1b3a08ff7 --- /dev/null +++ b/cpp/demo/Ice/pickle/Reader.cpp @@ -0,0 +1,73 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <Pickle.h> +#include <Factory.h> +#include <fstream> + +using namespace std; + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + Ice::ValueFactoryPtr factory = new Factory; + communicator->installValueFactory(factory, "::Persistent"); + + ifstream in("persistent"); + if (!in) + { + cerr << argv[0] << ": can't open file \"persistent\" for reading: " + << strerror(errno) << endl; + return EXIT_FAILURE; + } + + Ice::PicklerPtr pickler = communicator->getPickler(); + Ice::ObjectPtr base = pickler->unpickle(in); + PersistentPtr persistent = dynamic_cast<Persistent*>(base.get()); + + cout << "aString = \"" << persistent->aString << "\"" << endl; + cout << "aDouble = " << persistent->aDouble << endl; + + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + communicator = Ice::initialize(argc, argv); + status = run(argc, argv, communicator); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/demo/Ice/pickle/Writer.cpp b/cpp/demo/Ice/pickle/Writer.cpp new file mode 100644 index 00000000000..9319db1a184 --- /dev/null +++ b/cpp/demo/Ice/pickle/Writer.cpp @@ -0,0 +1,69 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <Pickle.h> +#include <fstream> + +using namespace std; + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + PersistentPtr persistent = new Persistent; + persistent->aString = "this is the persistent string"; + persistent->aDouble = 3.14; + + ofstream out("persistent"); + if (!out) + { + cerr << argv[0] << ": can't open file \"persistent\" for writing: " + << strerror(errno) << endl; + return EXIT_FAILURE; + } + + Ice::PicklerPtr pickler = communicator->getPickler(); + pickler->pickle(persistent.get(), out); + + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + communicator = Ice::initialize(argc, argv); + status = run(argc, argv, communicator); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/demo/Ice/pickle/pickleR.dsp b/cpp/demo/Ice/pickle/pickleR.dsp new file mode 100644 index 00000000000..e4c98b887ff --- /dev/null +++ b/cpp/demo/Ice/pickle/pickleR.dsp @@ -0,0 +1,161 @@ +# Microsoft Developer Studio Project File - Name="pickleR" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=pickleR - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "pickleR.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "pickleR.mak" CFG="pickleR - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "pickleR - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "pickleR - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "pickleR - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 jtc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"reader.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "pickleR - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 jtcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"reader.exe" /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "pickleR - Win32 Release"
+# Name "pickleR - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Factory.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Pickle.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Reader.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Factory.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Pickle.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Pickle.ice
+
+!IF "$(CFG)" == "pickleR - Win32 Release"
+
+USERDEP__PICKL="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Pickle.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Pickle.ice \
+
+
+"Pickle.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Pickle.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "pickleR - Win32 Debug"
+
+USERDEP__PICKL="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Pickle.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Pickle.ice \
+
+
+"Pickle.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Pickle.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/demo/Ice/pickle/pickleW.dsp b/cpp/demo/Ice/pickle/pickleW.dsp new file mode 100644 index 00000000000..085e702d245 --- /dev/null +++ b/cpp/demo/Ice/pickle/pickleW.dsp @@ -0,0 +1,153 @@ +# Microsoft Developer Studio Project File - Name="pickleW" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=pickleW - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "pickleW.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "pickleW.mak" CFG="pickleW - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "pickleW - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "pickleW - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "pickleW - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 jtc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"writer.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "pickleW - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 jtcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"writer.exe" /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "pickleW - Win32 Release"
+# Name "pickleW - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Pickle.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Writer.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Pickle.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Pickle.ice
+
+!IF "$(CFG)" == "pickleW - Win32 Release"
+
+USERDEP__PICKL="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Pickle.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Pickle.ice \
+
+
+"Pickle.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Pickle.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "pickleW - Win32 Debug"
+
+USERDEP__PICKL="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Pickle.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Pickle.ice \
+
+
+"Pickle.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Pickle.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/demo/Ice/value/.depend b/cpp/demo/Ice/value/.depend new file mode 100644 index 00000000000..c8b34696b00 --- /dev/null +++ b/cpp/demo/Ice/value/.depend @@ -0,0 +1,5 @@ +Value.o: Value.cpp Value.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Shared.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/LocalObject.h ../../include/Ice/LocalException.h +ValueI.o: ValueI.cpp ../../include/Ice/Ice.h ../../include/Ice/Communicator.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PicklerF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ValueFactoryF.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/ValueFactory.h ../../include/Ice/Pickler.h ../../include/Ice/Initialize.h ValueI.h Value.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h +Client.o: Client.cpp ../../include/Ice/Ice.h ../../include/Ice/Communicator.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PicklerF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ValueFactoryF.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/ValueFactory.h ../../include/Ice/Pickler.h ../../include/Ice/Initialize.h Value.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h Factory.h +Factory.o: Factory.cpp ../../include/Ice/Ice.h ../../include/Ice/Communicator.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PicklerF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ValueFactoryF.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/ValueFactory.h ../../include/Ice/Pickler.h ../../include/Ice/Initialize.h Factory.h ValueI.h Value.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h +Server.o: Server.cpp ../../include/Ice/Ice.h ../../include/Ice/Communicator.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PicklerF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ValueFactoryF.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/ValueFactory.h ../../include/Ice/Pickler.h ../../include/Ice/Initialize.h ValueI.h Value.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h diff --git a/cpp/demo/Ice/value/Client.cpp b/cpp/demo/Ice/value/Client.cpp new file mode 100644 index 00000000000..c687dd4342b --- /dev/null +++ b/cpp/demo/Ice/value/Client.cpp @@ -0,0 +1,194 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <Value.h> +#include <Factory.h> + +using namespace std; + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + Ice::PropertiesPtr properties = communicator->getProperties(); + string ref = properties->getProperty("Value.Initial"); + Ice::ObjectPrx base = communicator->stringToProxy(ref); + + InitialPrx initial = InitialPrx::checkedCast(base); + if (!initial) + { + cerr << argv[0] << ": invalid object reference" << endl; + return EXIT_FAILURE; + } + + char c; + + cout << '\n' + << "Let's first transfer a simple value, for a class without\n" + << "operations. No factory is required for this.\n" + << "[press enter]\n"; + cin.getline(&c, 1); + + SimplePtr simple = initial->simple(); + cout << "==> " << simple->_message << endl; + + cout << '\n' + << "Ok, this worked. Now let's try to transfer a value for a class\n" + << "with operations, without first installing a factory. This\n" + << "should give us a `no factory' exception.\n" + << "[press enter]\n"; + cin.getline(&c, 1); + + PrinterPtr printer; + PrinterPrx printerProxy; + try + { + initial->printer(printer, printerProxy); + } + catch(const Ice::NoFactoryException& ex) + { + cout << "==> " << ex << endl; + } + + cout << '\n' + << "Yep, that's what we expected. Now let's try again, but with\n" + << "installing an appropriate factory first.\n" + << "[press enter]\n"; + cin.getline(&c, 1); + + Ice::ValueFactoryPtr factory = new Factory; + communicator->installValueFactory(factory, "::Printer"); + + initial->printer(printer, printerProxy); + cout << "==> " << printer->_message << endl; + + cout << '\n' + << "Cool, it worked! Let's try calling the printBackwards() method\n" + << "locally.\n" + << "[press enter]\n"; + cin.getline(&c, 1); + + cout << "==> "; + printer->printBackwards(); + + cout << '\n' + << "Now we call the same method on the remote object. Watch the\n" + << "server's output.\n" + << "[press enter]\n"; + cin.getline(&c, 1); + + printerProxy->printBackwards(); + + cout << '\n' + << "Next, we transfer a derived object from the server as base\n" + << "object. Since we didn't install a factory for the derived\n" + << "class, our object will be truncated, and a dynamic_cast<> to\n" + << "get the derived object from the base object will fail.\n" + << "[press enter]\n"; + cin.getline(&c, 1); + + PrinterPtr derivedAsBase = initial->derivedPrinter(); + assert(!DerivedPrinterPtr::dynamicCast(derivedAsBase)); + cout << "==> dynamic_cast<> to derived object failed" << endl; + + cout << '\n' + << "We can of course still use the derived object as base object.\n" + << "[press enter]\n"; + cin.getline(&c, 1); + + cout << "==> " << derivedAsBase->_message << endl; + cout << "==> "; + derivedAsBase->printBackwards(); + + cout << '\n' + << "Now we install the factory for the derived object, and try\n" + << "again.\n" + << "[press enter]\n"; + cin.getline(&c, 1); + + communicator->installValueFactory(factory, "::DerivedPrinter"); + + derivedAsBase = initial->derivedPrinter(); + DerivedPrinterPtr derived = DerivedPrinterPtr::dynamicCast(derivedAsBase); + assert(derived); + + cout << "==> dynamic_cast<> to derived object succeded" << endl; + + cout << '\n' + << "Let's print the message contained in the derived object, and\n" + << "call the operation printUppercase() on the derived object\n" + << "locally.\n" + << "[press enter]\n"; + cin.getline(&c, 1); + + cout << "==> " << derived->_derivedMessage << endl; + cout << "==> "; + derived->printUppercase(); + + cout << '\n' + << "Finally, we try the same again, but instead of returning the\n" + << "derived object, we throw it as an exception.\n" + << "[press enter]\n"; + cin.getline(&c, 1); + + try + { + initial->throwDerivedPrinter(); + } + catch(const PrinterPtrE& ex) + { + const PrinterPtr& p = ex; + derived = DerivedPrinterPtr::dynamicCast(p); + assert(derived); + } + + cout << "==> " << derived->_derivedMessage << endl; + cout << "==> "; + derived->printUppercase(); + + cout << '\n' + << "That's it for this demo. Have fun with Ice!\n"; + + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + Ice::PropertiesPtr properties = Ice::loadProperties("config"); + communicator = Ice::initializeWithProperties(argc, argv, properties); + status = run(argc, argv, communicator); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/demo/Ice/value/Factory.cpp b/cpp/demo/Ice/value/Factory.cpp new file mode 100644 index 00000000000..a94b94dec81 --- /dev/null +++ b/cpp/demo/Ice/value/Factory.cpp @@ -0,0 +1,28 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <Factory.h> +#include <ValueI.h> + +using namespace std; + +Ice::ObjectPtr +Factory::create(const string& id) +{ + if (id == "::Printer") + return new PrinterI; + + if (id == "::DerivedPrinter") + return new DerivedPrinterI; + + assert(false); + return 0; +} diff --git a/cpp/demo/Ice/value/Factory.h b/cpp/demo/Ice/value/Factory.h new file mode 100644 index 00000000000..fbb42aef397 --- /dev/null +++ b/cpp/demo/Ice/value/Factory.h @@ -0,0 +1,21 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef FACTORY_H +#define FACTORY_H + +class Factory : public Ice::ValueFactory +{ +public: + + virtual Ice::ObjectPtr create(const std::string&); +}; + +#endif diff --git a/cpp/demo/Ice/value/Makefile b/cpp/demo/Ice/value/Makefile new file mode 100644 index 00000000000..3c241e2ffab --- /dev/null +++ b/cpp/demo/Ice/value/Makefile @@ -0,0 +1,49 @@ +# ********************************************************************** +# +# Copyright (c) 2001 +# MutableRealms, Inc. +# Huntsville, AL, USA +# +# All Rights Reserved +# +# ********************************************************************** + +top_srcdir = ../../.. + +CLIENT = client +SERVER = server + +TARGETS = $(CLIENT) $(SERVER) + +OBJS = Value.o \ + ValueI.o + +COBJS = Client.o \ + Factory.o + +SOBJS = Server.o + +SRCS = $(OBJS:.o=.cpp) \ + $(COBJS:.o=.cpp) \ + $(SOBJS:.o=.cpp) + +include $(top_srcdir)/config/Make.rules + +CPPFLAGS := -I. $(CPPFLAGS) + +$(CLIENT): $(OBJS) $(COBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(COBJS) $(LIBS) + +$(SERVER): $(OBJS) $(SOBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(SOBJS) $(LIBS) + +Value.h Value.cpp: Value.ice $(SLICE) + rm -f Value.h Value.cpp + $(SLICE) Value.ice + +clean:: + rm -f Value.h Value.cpp + +include .depend diff --git a/cpp/demo/Ice/value/Server.cpp b/cpp/demo/Ice/value/Server.cpp new file mode 100644 index 00000000000..62a21ce9186 --- /dev/null +++ b/cpp/demo/Ice/value/Server.cpp @@ -0,0 +1,59 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <ValueI.h> + +using namespace std; + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("ValueAdapter"); + Ice::ObjectPtr object = new InitialI(adapter); + adapter->add(object, "initial"); + adapter->activate(); + communicator->waitForShutdown(); + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + Ice::PropertiesPtr properties = Ice::loadProperties("config"); + communicator = Ice::initializeWithProperties(argc, argv, properties); + status = run(argc, argv, communicator); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/demo/Ice/value/Value.ice b/cpp/demo/Ice/value/Value.ice new file mode 100644 index 00000000000..8ba974ecf6d --- /dev/null +++ b/cpp/demo/Ice/value/Value.ice @@ -0,0 +1,39 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef VALUE_ICE +#define VALUE_ICE + +class Simple +{ + string _message; +}; + +class Printer +{ + string _message; + void printBackwards(); +}; + +class DerivedPrinter extends Printer +{ + string _derivedMessage; + void printUppercase(); +}; + +class Initial +{ + Simple simple(); + void printer(; Printer impl, Printer* proxy); + Printer derivedPrinter(); + void throwDerivedPrinter() throws Printer; +}; + +#endif diff --git a/cpp/demo/Ice/value/ValueI.cpp b/cpp/demo/Ice/value/ValueI.cpp new file mode 100644 index 00000000000..03440a4fd7e --- /dev/null +++ b/cpp/demo/Ice/value/ValueI.cpp @@ -0,0 +1,74 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <ValueI.h> + +using namespace std; + +InitialI::InitialI(const Ice::ObjectAdapterPtr& adapter) : + _adapter(adapter) +{ + _simple = new Simple; + _simple->_message = "a message 4 u"; + + _printer = new PrinterI; + _printer->_message = "Ice rulez!"; + adapter->addTemporary(_printer); + _printerProxy = PrinterPrx::uncheckedCast(adapter->objectToProxy(_printer)); + + _derivedPrinter = new DerivedPrinterI; + _derivedPrinter->_message = _printer->_message; + _derivedPrinter->_derivedMessage = "Coming soon: the ultimate online game from MutableRealms!"; + adapter->addTemporary(_printer); +} + +SimplePtr +InitialI::simple() +{ + return _simple; +} + +void +InitialI::printer(PrinterPtr& impl, PrinterPrx& proxy) +{ + impl = _printer; + proxy = _printerProxy; +} + +PrinterPtr +InitialI::derivedPrinter() +{ + return _derivedPrinter; +} + +void +InitialI::throwDerivedPrinter() +{ + _derivedPrinter->_throw(); +} + +void +PrinterI::printBackwards() +{ + string s; + s.resize(_message.length()); + reverse_copy(_message.begin(), _message.end(), s.begin()); + cout << s << endl; +} + +void +DerivedPrinterI::printUppercase() +{ + string s; + s.resize(_derivedMessage.length()); + transform(_derivedMessage.begin(), _derivedMessage.end(), s.begin(), toupper); + cout << s << endl; +} diff --git a/cpp/demo/Ice/value/ValueI.h b/cpp/demo/Ice/value/ValueI.h new file mode 100644 index 00000000000..4803ddde372 --- /dev/null +++ b/cpp/demo/Ice/value/ValueI.h @@ -0,0 +1,50 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef VALUE_I_H +#define VALUE_I_H + +#include <Value.h> + +class InitialI : public Initial +{ +public: + + InitialI(const Ice::ObjectAdapterPtr&); + + virtual SimplePtr simple(); + virtual void printer(PrinterPtr&, PrinterPrx&); + virtual PrinterPtr derivedPrinter(); + virtual void throwDerivedPrinter(); + +private: + + Ice::ObjectAdapterPtr _adapter; + SimplePtr _simple; + PrinterPtr _printer; + PrinterPrx _printerProxy; + DerivedPrinterPtr _derivedPrinter; +}; + +class PrinterI : virtual public Printer +{ +public: + + virtual void printBackwards(); +}; + +class DerivedPrinterI : virtual public DerivedPrinter, virtual public PrinterI +{ +public: + + virtual void printUppercase(); +}; + +#endif diff --git a/cpp/demo/Ice/value/valueC.dsp b/cpp/demo/Ice/value/valueC.dsp new file mode 100644 index 00000000000..11587ce75cd --- /dev/null +++ b/cpp/demo/Ice/value/valueC.dsp @@ -0,0 +1,169 @@ +# Microsoft Developer Studio Project File - Name="valueC" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=valueC - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "valueC.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "valueC.mak" CFG="valueC - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "valueC - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "valueC - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "valueC - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 jtc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"client.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "valueC - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 jtcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"client.exe" /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "valueC - Win32 Release"
+# Name "valueC - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Factory.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Value.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ValueI.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Factory.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Value.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ValueI.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Value.ice
+
+!IF "$(CFG)" == "valueC - Win32 Release"
+
+USERDEP__VALUE="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Value.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Value.ice \
+
+
+"Value.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Value.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "valueC - Win32 Debug"
+
+USERDEP__VALUE="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Value.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Value.ice \
+
+
+"Value.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Value.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/demo/Ice/value/valueS.dsp b/cpp/demo/Ice/value/valueS.dsp new file mode 100644 index 00000000000..f2a77e033d8 --- /dev/null +++ b/cpp/demo/Ice/value/valueS.dsp @@ -0,0 +1,161 @@ +# Microsoft Developer Studio Project File - Name="valueS" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=valueS - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "valueS.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "valueS.mak" CFG="valueS - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "valueS - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "valueS - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "valueS - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 jtc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"server.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "valueS - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 jtcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"server.exe" /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "valueS - Win32 Release"
+# Name "valueS - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Value.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ValueI.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Server.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Value.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ValueI.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Value.ice
+
+!IF "$(CFG)" == "valueS - Win32 Release"
+
+USERDEP__VALUE="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Value.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Value.ice \
+
+
+"Value.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Value.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "valueS - Win32 Debug"
+
+USERDEP__VALUE="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Value.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Value.ice \
+
+
+"Value.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Value.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/demo/Makefile b/cpp/demo/Makefile index 3d7cebf66c4..0027b52197d 100644 --- a/cpp/demo/Makefile +++ b/cpp/demo/Makefile @@ -12,7 +12,7 @@ top_srcdir = .. include $(top_srcdir)/config/Make.rules -SUBDIRS = hello value latency pickle +SUBDIRS = Ice $(EVERYTHING):: @for subdir in $(SUBDIRS); \ diff --git a/cpp/doc/Properties.sgml b/cpp/doc/Properties.sgml index 5d1845a13f0..df2521374ae 100644 --- a/cpp/doc/Properties.sgml +++ b/cpp/doc/Properties.sgml @@ -12,11 +12,11 @@ All Rights Reserved <section><title>Tracing</title> <!-- ********************************************************************** --> -<section><title>ice.trace.network</title> +<section><title>Ice.Trace.Network</title> <section><title>Synopsis</title> <synopsis> -ice.trace.network=<replaceable>num</replaceable> +Ice.Trace.Network=<replaceable>num</replaceable> </synopsis> </section> @@ -51,11 +51,11 @@ The network tracing level: </section> -<section><title>ice.trace.protocol</title> +<section><title>Ice.Trace.Protocol</title> <section><title>Synopsis</title> <synopsis> -ice.trace.protocol=<replaceable>num</replaceable> +Ice.Trace.Protocol=<replaceable>num</replaceable> </synopsis> </section> @@ -82,11 +82,11 @@ The protocol tracing level: </section> -<section><title>ice.trace.retry</title> +<section><title>Ice.Trace.Retry</title> <section><title>Synopsis</title> <synopsis> -ice.trace.retry=<replaceable>num</replaceable> +Ice.Trace.Retry=<replaceable>num</replaceable> </synopsis> </section> @@ -123,11 +123,11 @@ The request retry tracing level: <section><title>Object Adapter</title> <!-- ********************************************************************** --> -<section><title>ice.adapter.<replaceable>name</replaceable>.endpoints</title> +<section><title>Ice.Adapter.<replaceable>name</replaceable>.Endpoints</title> <section><title>Synopsis</title> <synopsis> -ice.adapter.<replaceable>name</replaceable>.endpoints=<replaceable>endpoint_list</replaceable> +Ice.Adapter.<replaceable>name</replaceable>.Endpoints=<replaceable>endpoints</replaceable> </synopsis> </section> @@ -148,11 +148,11 @@ Sets the endpoints for the object adapter <section><title>Thread Pool</title> <!-- ********************************************************************** --> -<section><title>ice.thread_pool.size</title> +<section><title>Ice.ThreadPool.Size</title> <section><title>Synopsis</title> <synopsis> -ice.thread_pool.size=<replaceable>num</replaceable> +Ice.ThreadPool.Size=<replaceable>num</replaceable> </synopsis> </section> diff --git a/cpp/include/Ice/Initialize.h b/cpp/include/Ice/Initialize.h index 05514a2ee1c..9f5a0bcaa74 100644 --- a/cpp/include/Ice/Initialize.h +++ b/cpp/include/Ice/Initialize.h @@ -15,10 +15,9 @@ namespace Ice { ICE_API CommunicatorPtr initialize(int&, char*[], Int = ICE_INT_VERSION); -ICE_API CommunicatorPtr initializeWithProperties(int&, char*[], - const PropertiesPtr&, - Int = ICE_INT_VERSION); +ICE_API CommunicatorPtr initializeWithProperties(int&, char*[], const PropertiesPtr&, Int = ICE_INT_VERSION); +ICE_API PropertiesPtr getDefaultProperties(); ICE_API PropertiesPtr createProperties(); ICE_API PropertiesPtr loadProperties(const std::string&); diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h index b5c88793cd2..d8a9349ac9a 100644 --- a/cpp/include/Ice/Proxy.h +++ b/cpp/include/Ice/Proxy.h @@ -54,6 +54,7 @@ public: bool operator==(const Object&) const; bool operator!=(const Object&) const; + bool operator<(const Object&) const; ::Ice::ObjectPrx _twoway() const; ::Ice::ObjectPrx _oneway() const; diff --git a/cpp/slice/Ice/ObjectAdapter.ice b/cpp/slice/Ice/ObjectAdapter.ice index 2275d54f845..c00b5eb07b7 100644 --- a/cpp/slice/Ice/ObjectAdapter.ice +++ b/cpp/slice/Ice/ObjectAdapter.ice @@ -298,8 +298,10 @@ local class ObjectLocator /** * - * Called by the Object Adapter after a request, provided that - * <literal>locate</literal> did not return null. This operation + * Called by the Object Adapter after a request. This operation is + * only called if <literal>locate</literal> did not return null, + * or if <literal>locate</literal> threw a + * <literal>LocationForward</literal> exception. This operation * can be used for cleanup after a request. * * @param adapter The Object Adapter that calls the locator. diff --git a/cpp/slice/Ice/Properties.ice b/cpp/slice/Ice/Properties.ice index 5275da23319..c0a52a2191c 100644 --- a/cpp/slice/Ice/Properties.ice +++ b/cpp/slice/Ice/Properties.ice @@ -14,10 +14,50 @@ module Ice { +/** + * + * A property set to configure Ice and applications based on + * Ice. Properties are key/value pairs, with both keys and values + * being strings. By conventions, property keys should have the form + * <replaceable>application-name</replaceable>[[.<replaceable>category</replaceable>].<replaceable>sub-category</replaceable>].<replaceable>name</replaceable>. + * + **/ local class Properties { + /** + * + * Get a property by key. If the property does not exist, an empty + * string is returned. + * + * @param key The property key. + * + * @return The property value. + * + * @see setProperty + * + **/ string getProperty(string key); + + /** + * + * Set a property. + * + * @param key The property key. + * @param value The property value. + * + * @see getProperty + * + **/ void setProperty(string key, string value); + + /** + * + * Create a copy of this property set. + * + * @return A copy of this property set. + * + **/ + Properties clone(); }; }; diff --git a/cpp/slice/IcePack/Admin.ice b/cpp/slice/IcePack/Admin.ice index ae6e194be35..e5e9ffa190f 100644 --- a/cpp/slice/IcePack/Admin.ice +++ b/cpp/slice/IcePack/Admin.ice @@ -105,6 +105,20 @@ class Admin * **/ void remove(Object* object); + + /** + * + * Find a server and objects implemented by that server from IcePack. + * + * @param object Must match the field <literal>object</literal> of + * the <literal>ServerDescription</literal> data to find. + * + * @return The server description, or null if no description was found. + * + * @see add + * + **/ + ServerDescription find(Object* object); }; }; diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp index b7a1a324960..02ff7d95913 100644 --- a/cpp/src/Ice/CommunicatorI.cpp +++ b/cpp/src/Ice/CommunicatorI.cpp @@ -80,7 +80,7 @@ Ice::CommunicatorI::createObjectAdapter(const string& name) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } - string endpts = _instance->properties()->getProperty("ice.adapter." + name + ".endpoints"); + string endpts = _instance->properties()->getProperty("Ice.Adapter." + name + ".Endpoints"); return createObjectAdapterWithEndpoints(name, endpts); } @@ -173,13 +173,7 @@ Ice::initialize(int&, char*[], Int version) } #endif - PropertiesPtr properties; - const char* file = getenv("ICE_CONFIG"); - if (file && *file != '\0') - properties = new PropertiesI(file); - else - properties = new PropertiesI; - return new CommunicatorI(properties); + return new CommunicatorI(getDefaultProperties()); } CommunicatorPtr @@ -196,6 +190,22 @@ Ice::initializeWithProperties(int&, char*[], const PropertiesPtr& properties, In } PropertiesPtr +Ice::getDefaultProperties() +{ + PropertiesPtr properties; + const char* file = getenv("ICE_CONFIG"); + if (file && *file != '\0') + { + properties = new PropertiesI(file); + } + else + { + properties = new PropertiesI; + } + return properties; +} + +PropertiesPtr Ice::createProperties() { return new PropertiesI; diff --git a/cpp/src/Ice/CommunicatorI.h b/cpp/src/Ice/CommunicatorI.h index bb75f1c6ba4..626c72e4e61 100644 --- a/cpp/src/Ice/CommunicatorI.h +++ b/cpp/src/Ice/CommunicatorI.h @@ -29,11 +29,9 @@ public: virtual ObjectPrx stringToProxy(const std::string&); virtual ObjectAdapterPtr createObjectAdapter(const std::string&); - virtual ObjectAdapterPtr createObjectAdapterWithEndpoints( - const std::string&, const std::string&); + virtual ObjectAdapterPtr createObjectAdapterWithEndpoints(const std::string&, const std::string&); - virtual void installValueFactory(const ValueFactoryPtr&, - const std::string&); + virtual void installValueFactory(const ValueFactoryPtr&, const std::string&); virtual PropertiesPtr getProperties(); @@ -48,8 +46,7 @@ private: virtual ~CommunicatorI(); friend ICE_API CommunicatorPtr initialize(int&, char*[], Int); - friend ICE_API CommunicatorPtr initializeWithProperties( - int&, char*[], const PropertiesPtr&, Int); + friend ICE_API CommunicatorPtr initializeWithProperties(int&, char*[], const PropertiesPtr&, Int); ::IceInternal::InstancePtr _instance; }; diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp index 58d4e2c123c..7da7efd958e 100644 --- a/cpp/src/Ice/PropertiesI.cpp +++ b/cpp/src/Ice/PropertiesI.cpp @@ -21,9 +21,13 @@ Ice::PropertiesI::getProperty(const string& key) { map<string, string>::const_iterator p = _properties.find(key); if (p != _properties.end()) + { return p->second; + } else + { return string(); + } } void @@ -32,6 +36,14 @@ Ice::PropertiesI::setProperty(const string& key, const string& value) _properties[key] = value; } +PropertiesPtr +Ice::PropertiesI::clone() +{ + PropertiesI* p = new PropertiesI; + p->_properties=_properties; + return p; +} + Ice::PropertiesI::PropertiesI() { } @@ -46,7 +58,9 @@ Ice::PropertiesI::load(const std::string& file) { ifstream in(file.c_str()); if (!in) + { throw SystemException(__FILE__, __LINE__); + } parse(in); } @@ -62,29 +76,41 @@ Ice::PropertiesI::parse(istream& in) string::size_type idx = s.find('#'); if (idx != string::npos) + { s.erase(idx); + } idx = s.find_last_not_of(delim); if (idx != string::npos && idx + 1 < s.length()) + { s.erase(idx + 1); + } string::size_type beg = s.find_first_not_of(delim); if (beg == string::npos) + { continue; + } string::size_type end = s.find_first_of(delim + "=", beg); if (end == string::npos) + { continue; + } string key = s.substr(beg, end - beg); end = s.find('=', end); if (end == string::npos) + { continue; + } beg = s.find_first_not_of(delim + "=", end); if (beg == string::npos) + { continue; + } end = s.length(); diff --git a/cpp/src/Ice/PropertiesI.h b/cpp/src/Ice/PropertiesI.h index b1f51163121..eafeda007e1 100644 --- a/cpp/src/Ice/PropertiesI.h +++ b/cpp/src/Ice/PropertiesI.h @@ -12,7 +12,6 @@ #define ICE_PROPERTIES_I_H #include <Ice/Properties.h> -#include <Ice/CommunicatorF.h> #include <map> namespace Ice @@ -22,15 +21,16 @@ class ICE_API PropertiesI : public Properties { public: - std::string getProperty(const std::string&); - void setProperty(const std::string&, const std::string&); + virtual std::string getProperty(const std::string&); + virtual void setProperty(const std::string&, const std::string&); + virtual PropertiesPtr clone(); private: PropertiesI(); PropertiesI(const std::string&); - friend ICE_API CommunicatorPtr initialize(int&, char*[], Int); + friend ICE_API PropertiesPtr getDefaultProperties(); friend ICE_API PropertiesPtr createProperties(); friend ICE_API PropertiesPtr loadProperties(const std::string&); diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index 9f368327613..e818d04df6a 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -145,6 +145,12 @@ IceProxy::Ice::Object::operator!=(const Object& r) const return _reference->identity != r._reference->identity; } +bool +IceProxy::Ice::Object::operator<(const Object& r) const +{ + return _reference->identity < r._reference->identity; +} + ObjectPrx IceProxy::Ice::Object::_twoway() const { diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp index 014311c8c2f..4484d8ea99d 100644 --- a/cpp/src/Ice/ThreadPool.cpp +++ b/cpp/src/Ice/ThreadPool.cpp @@ -28,7 +28,9 @@ IceInternal::ThreadPool::_register(int fd, const EventHandlerPtr& handler) { JTCSyncT<JTCMonitorT<JTCMutex> > sync(*this); if (handler->server()) + { ++_servers; + } _adds.push_back(make_pair(fd, handler)); setInterrupt(); } @@ -58,7 +60,7 @@ IceInternal::ThreadPool::waitUntilServerFinished() { wait(); } - catch(const JTCInterruptedException&) + catch (const JTCInterruptedException&) { } } @@ -75,7 +77,7 @@ IceInternal::ThreadPool::waitUntilFinished() { wait(); } - catch(const JTCInterruptedException&) + catch (const JTCInterruptedException&) { } } @@ -114,12 +116,14 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance) : try { int threadNum = 10; - string value = _instance->properties()->getProperty("ice.thread_pool.size"); + string value = _instance->properties()->getProperty("Ice.ThreadPool.Size"); if (!value.empty()) { threadNum = atoi(value.c_str()); if (threadNum < 1) + { threadNum = 1; + } } for (int i = 0 ; i < threadNum ; ++i) @@ -129,7 +133,7 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance) : _threads.push_back(thread); } } - catch(const JTCException&) + catch (const JTCException&) { destroy(); throw; @@ -192,7 +196,9 @@ IceInternal::ThreadPool::run() if (::select(_maxFd + 1, &fdSet, 0, 0, 0) == SOCKET_ERROR) { if (interrupted()) + { goto repeatSelect; + } _threadMutex.unlock(); throw SocketException(__FILE__, __LINE__); @@ -259,20 +265,28 @@ IceInternal::ThreadPool::run() #endif q->second->finished(); if (q->second->server()) + { --_servers; + } _handlers.erase(q); } _removes.clear(); _maxFd = _fdIntrRead; if (!_handlers.empty()) + { _maxFd = max(_maxFd, (--_handlers.end())->first); + } again = true; if (_handlers.empty() || _servers == 0) + { notifyAll(); // For waitUntil...Finished() methods + } } if (again) + { goto repeatSelect; + } // // Round robin for the filedescriptors @@ -280,7 +294,9 @@ IceInternal::ThreadPool::run() do { if (++_lastFd > _maxFd) + { _lastFd = 0; + } } while (!FD_ISSET(_lastFd, &fdSet)); @@ -299,11 +315,11 @@ IceInternal::ThreadPool::run() { read(handler); } - catch(const TimeoutException&) // Expected + catch (const TimeoutException&) // Expected { goto repeatSelect; } - catch(const LocalException& ex) + catch (const LocalException& ex) { handler->exception(ex); goto repeatSelect; @@ -332,7 +348,9 @@ IceInternal::ThreadPool::read(const EventHandlerPtr& handler) handler->read(stream); if (stream.i != stream.b.end()) + { return; + } } if (stream.b.size() >= 8) // Interpret header? @@ -345,23 +363,31 @@ IceInternal::ThreadPool::read(const EventHandlerPtr& handler) Byte protVer; stream.read(protVer); if (protVer != 0) + { throw UnsupportedProtocolException(__FILE__, __LINE__); + } Byte encVer; stream.read(encVer); if (encVer != 0) + { throw UnsupportedEncodingException(__FILE__, __LINE__); + } Byte messageType; stream.read(messageType); Int size; stream.read(size); if (size > 1024 * 1024) // TODO: configurable + { throw ::Ice::MemoryLimitException(__FILE__, __LINE__); + } stream.b.resize(size); stream.i = stream.b.begin() + pos; } if (stream.b.size() > 8 && stream.i != stream.b.end()) + { handler->read(stream); + } } void @@ -371,15 +397,15 @@ IceInternal::ThreadPool::EventHandlerThread::run() { _pool->run(); } - catch(const LocalException& ex) + catch (const LocalException& ex) { cerr << ex << endl; } - catch(const JTCException& ex) + catch (const JTCException& ex) { cerr << ex << endl; } - catch(...) + catch (...) { cerr << "unknown exception" << endl; } diff --git a/cpp/src/Ice/TraceLevels.cpp b/cpp/src/Ice/TraceLevels.cpp index 7e454ff7dc5..e35c30c3a96 100644 --- a/cpp/src/Ice/TraceLevels.cpp +++ b/cpp/src/Ice/TraceLevels.cpp @@ -20,14 +20,14 @@ void IceInternal::decRef(TraceLevels* p) { p->__decRef(); } IceInternal::TraceLevels::TraceLevels(const PropertiesPtr& properties) : network(0), - networkCat("network"), + networkCat("Network"), protocol(0), - protocolCat("protocol"), + protocolCat("Protocol"), retry(0), - retryCat("retry") + retryCat("Retry") { string value; - const string keyBase = "ice.trace."; + const string keyBase = "Ice.Trace."; value = properties->getProperty(keyBase + networkCat); if (!value.empty()) diff --git a/cpp/src/IcePack/.depend b/cpp/src/IcePack/.depend index 6fe0e0596bc..be209f9bb99 100644 --- a/cpp/src/IcePack/.depend +++ b/cpp/src/IcePack/.depend @@ -1 +1,5 @@ Admin.o: Admin.cpp ../../include/IcePack/Admin.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Shared.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/LocalObject.h ../../include/Ice/LocalException.h +Client.o: Client.cpp ../../include/Ice/Ice.h ../../include/Ice/Communicator.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PicklerF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ValueFactoryF.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/ValueFactory.h ../../include/Ice/Pickler.h ../../include/Ice/Initialize.h AdminI.h ../../include/IcePack/Admin.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h Forward.h +Server.o: Server.cpp ../../include/Ice/Ice.h ../../include/Ice/Communicator.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PicklerF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ValueFactoryF.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/ValueFactory.h ../../include/Ice/Pickler.h ../../include/Ice/Initialize.h AdminI.h ../../include/IcePack/Admin.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h Forward.h +Forward.o: Forward.cpp ../../include/Ice/Ice.h ../../include/Ice/Communicator.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PicklerF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ValueFactoryF.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/ValueFactory.h ../../include/Ice/Pickler.h ../../include/Ice/Initialize.h Forward.h ../../include/IcePack/Admin.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h +AdminI.o: AdminI.cpp ../../include/Ice/Ice.h ../../include/Ice/Communicator.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/Shared.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PicklerF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ValueFactoryF.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/ValueFactory.h ../../include/Ice/Pickler.h ../../include/Ice/Initialize.h AdminI.h ../../include/IcePack/Admin.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h diff --git a/cpp/src/IcePack/AdminI.cpp b/cpp/src/IcePack/AdminI.cpp new file mode 100644 index 00000000000..663cccd106b --- /dev/null +++ b/cpp/src/IcePack/AdminI.cpp @@ -0,0 +1,57 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <AdminI.h> + +using namespace std; +using namespace Ice; +using namespace IcePack; + +AdminI::AdminI() +{ +} + +void +AdminI::add(const ServerDescriptionPtr& p) +{ + JTCSyncT<JTCMutex> sync(*this); + + if (p && p->object) + { + _map[p->object] = p; + } +} + +void +AdminI::remove(const ObjectPrx& p) +{ + JTCSyncT<JTCMutex> sync(*this); + + if (p) + { + _map.erase(p); + } +} + +ServerDescriptionPtr +AdminI::find(const ObjectPrx& p) +{ + JTCSyncT<JTCMutex> sync(*this); + + if (p) + { + return _map.find(p)->second; + } + else + { + return 0; + } +} diff --git a/cpp/src/IcePack/AdminI.h b/cpp/src/IcePack/AdminI.h new file mode 100644 index 00000000000..111f8efd118 --- /dev/null +++ b/cpp/src/IcePack/AdminI.h @@ -0,0 +1,32 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef ADMIN_I_H +#define ADMIN_I_H + +#include <IcePack/Admin.h> +#include <map> + +class AdminI : public IcePack::Admin, public JTCMutex +{ +public: + + AdminI(); + + virtual void add(const IcePack::ServerDescriptionPtr&); + virtual void remove(const Ice::ObjectPrx&); + virtual IcePack::ServerDescriptionPtr find(const Ice::ObjectPrx&); + +private: + + std::map<Ice::ObjectPrx, IcePack::ServerDescriptionPtr> _map; +}; + +#endif diff --git a/cpp/src/IcePack/Client.cpp b/cpp/src/IcePack/Client.cpp new file mode 100644 index 00000000000..a2d94c3d1d5 --- /dev/null +++ b/cpp/src/IcePack/Client.cpp @@ -0,0 +1,168 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <AdminI.h> +#include <Forward.h> + +using namespace std; +using namespace Ice; +using namespace IcePack; + +void +usage(const char* n) +{ + cerr << "Usage: " << n << " [options] add|remove reference...\n"; + cerr << + "Options:\n" + "-h, --help Show this message.\n" + "-v, --version Display the Ice version.\n" + "--admin ENDPOINTS Use ENDPOINTS as administrative endpoints.\n" + ; +} + +int +run(int argc, char* argv[], CommunicatorPtr communicator) +{ + + PropertiesPtr properties = communicator->getProperties(); + + string adminEndpoints = properties->getProperty("Ice.Adapter.Admin.Endpoints"); + if(adminEndpoints.length() == 0) + { + cerr << argv[0] << ": `Ice.Adapter.Admin.Endpoints' property is not set" << endl; + return EXIT_FAILURE; + } + + if (argc < 2) + { + cerr << argv[0] << ": no command" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + + string cmd = argv[1]; + + if (argc < 3) + { + cerr << argv[0] << ": no reference" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + + Ice::ObjectPrx adminBase = communicator->stringToProxy("admin:" + adminEndpoints); + AdminPrx admin = AdminPrx::checkedCast(adminBase); + if (!admin) + { + cerr << argv[0] << ": `" << adminEndpoints << "' are no valid administrative endpoints" << endl; + return EXIT_FAILURE; + } + + if (cmd == "add") + { + for (int i = 2; i < argc; ++i) + { + ServerDescriptionPtr desc = new ServerDescription; + desc->object = communicator->stringToProxy(argv[i]); + admin->add(desc); + } + } + else if (cmd == "remove") + { + for (int i = 2; i < argc; ++i) + { + admin->remove(communicator->stringToProxy(argv[i])); + } + } + else + { + cerr << argv[0] << ": invalid command `" << cmd << "'" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + PropertiesPtr properties = getDefaultProperties(); + + int idx = 1; + while (idx < argc) + { + if (strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0) + { + usage(argv[0]); + return EXIT_SUCCESS; + } + else if (strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0) + { + cout << ICE_STRING_VERSION << endl; + return EXIT_SUCCESS; + } + else if (strcmp(argv[idx], "--admin") == 0) + { + if (idx + 1 >= argc) + { + cerr << argv[0] << ": argument expected for`" << argv[idx] << "'" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + + properties->setProperty("Ice.Adapter.Admin.Endpoints", argv[idx + 1]); + for (int i = idx ; i + 2 < argc ; ++i) + { + argv[i] = argv[i + 2]; + } + argc -= 2; + } + else if (argv[idx][0] == '-') + { + cerr << argv[0] << ": unknown option `" << argv[idx] << "'" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + else + { + ++idx; + } + } + + int status; + CommunicatorPtr communicator; + + try + { + communicator = initializeWithProperties(argc, argv, properties); + status = run(argc, argv, communicator); + } + catch(const LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/src/IcePack/Forward.cpp b/cpp/src/IcePack/Forward.cpp new file mode 100644 index 00000000000..ffce65f468f --- /dev/null +++ b/cpp/src/IcePack/Forward.cpp @@ -0,0 +1,40 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <Forward.h> + +using namespace std; +using namespace Ice; +using namespace IcePack; + +Forward::Forward(const AdminPtr& admin) : + _admin(admin) +{ +} + +ObjectPtr +Forward::locate(const ObjectAdapterPtr& adapter, const string& identity, ObjectPtr&) +{ + ObjectPrx proxy = adapter->identityToProxy(identity); + ServerDescriptionPtr desc = _admin->find(proxy); + if (desc) + { + assert(desc->object); + throw LocationForward(proxy); + } + return 0; +} + +void +Forward::finished(const ObjectAdapterPtr&, const string&, const ObjectPtr&, const ObjectPtr&) +{ + // Nothing to do +} diff --git a/cpp/src/IcePack/Forward.h b/cpp/src/IcePack/Forward.h new file mode 100644 index 00000000000..2a2cbdd44be --- /dev/null +++ b/cpp/src/IcePack/Forward.h @@ -0,0 +1,32 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef FORWARD_H +#define FORWARD_H + +#include <IcePack/Admin.h> +#include <map> + +class Forward : public Ice::ObjectLocator +{ +public: + + Forward(const IcePack::AdminPtr&); + + virtual Ice::ObjectPtr locate(const Ice::ObjectAdapterPtr&, const std::string&, Ice::ObjectPtr&); + virtual void finished(const Ice::ObjectAdapterPtr&, const std::string&, const Ice::ObjectPtr&, + const Ice::ObjectPtr&); + +private: + + IcePack::AdminPtr _admin; +}; + +#endif diff --git a/cpp/src/IcePack/Makefile b/cpp/src/IcePack/Makefile index 109c105dc99..a6b07224c52 100644 --- a/cpp/src/IcePack/Makefile +++ b/cpp/src/IcePack/Makefile @@ -16,11 +16,22 @@ VERSIONED_BASE = $(BASE).$(VERSION) NAME = $(top_srcdir)/lib/$(BASE) VERSIONED_NAME = $(top_srcdir)/lib/$(VERSIONED_BASE) -TARGETS = $(NAME) $(VERSIONED_NAME) +CLIENT = $(top_srcdir)/bin/icepackadmin +SERVER = $(top_srcdir)/bin/icepack + +TARGETS = $(NAME) $(VERSIONED_NAME) $(CLIENT) $(SERVER) OBJS = Admin.o -SRCS = $(OBJS:.o=.cpp) +COBJS = Client.o + +SOBJS = Server.o \ + Forward.o \ + AdminI.o + +SRCS = $(OBJS:.o=.cpp) \ + $(COBJS:.o=.cpp) \ + $(SOBJS:.o=.cpp) HDIR = $(includedir)/IcePack IDIR = $(slicedir)/IcePack @@ -28,7 +39,7 @@ SLICECMD = $(SLICE) --include-dir IcePack --dll-export ICE_PACK_API -I$(slicedir include $(top_srcdir)/config/Make.rules -CPPFLAGS := -I.. $(CPPFLAGS) +CPPFLAGS := -I. -I.. $(CPPFLAGS) $(VERSIONED_NAME): $(OBJS) rm -f $@ @@ -38,6 +49,14 @@ $(NAME): $(VERSIONED_NAME) rm -f $@ ln -s $(VERSIONED_BASE) $@ +$(CLIENT): $(COBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(COBJS) -lIcePack $(LIBS) + +$(SERVER): $(SOBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(SOBJS) -lIcePack $(LIBS) + $(HDIR)/Admin.h Admin.cpp: $(IDIR)/Admin.ice $(SLICE) rm -f $(HDIR)/Admin.h Admin.cpp $(SLICECMD) $(IDIR)/Admin.ice diff --git a/cpp/src/IcePack/Server.cpp b/cpp/src/IcePack/Server.cpp new file mode 100644 index 00000000000..cfc5c19904c --- /dev/null +++ b/cpp/src/IcePack/Server.cpp @@ -0,0 +1,143 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <AdminI.h> +#include <Forward.h> + +using namespace std; +using namespace Ice; +using namespace IcePack; + +void +usage(const char* n) +{ + cerr << "Usage: " << n << " [options]\n"; + cerr << + "Options:\n" + "-h, --help Show this message.\n" + "-v, --version Display the Ice version.\n" + "--forward ENDPOINTS Use ENDPOINTS as endpoints for the forwarder.\n" + "--admin ENDPOINTS Enable administrative endpoints and set them to ENDPOINTS.\n" + ; +} + +int +run(int argc, char* argv[], CommunicatorPtr communicator) +{ + PropertiesPtr properties = communicator->getProperties(); + + string adminEndpoints = properties->getProperty("Ice.Adapter.Admin.Endpoints"); + if(adminEndpoints.length() != 0) + { + cerr << argv[0] << ": warning: administrative endpoints `Ice.Adapter.Admin.Endpoints' enabled" << endl; + } + + string forwardEndpoints = properties->getProperty("Ice.Adapter.Forward.Endpoints"); + if(forwardEndpoints.length() == 0) + { + cerr << argv[0] << ": `Ice.Adapter.Forward.Endpoints' property is not set" << endl; + return EXIT_FAILURE; + } + + AdminPtr admin = new AdminI; + ObjectLocatorPtr forward = new Forward(admin); + + if (adminEndpoints.length() != 0) + { + ObjectAdapterPtr adminAdapter = communicator->createObjectAdapter("Admin"); + adminAdapter->add(admin, "admin"); + adminAdapter->activate(); + } + + ObjectAdapterPtr forwardAdapter = communicator->createObjectAdapter("Forward"); + forwardAdapter->setObjectLocator(forward); + forwardAdapter->activate(); + + communicator->waitForShutdown(); + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + PropertiesPtr properties = getDefaultProperties(); + + for (int i = 1; i < argc; ++i) + { + if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) + { + usage(argv[0]); + return EXIT_SUCCESS; + } + else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0) + { + cout << ICE_STRING_VERSION << endl; + return EXIT_SUCCESS; + } + else if (strcmp(argv[i], "--forward") == 0) + { + if (i + 1 >= argc) + { + cerr << argv[0] << ": argument expected for`" << argv[i] << "'" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + + properties->setProperty("Ice.Adapter.Forward.Endpoints", argv[++i]); + } + else if (strcmp(argv[i], "--admin") == 0) + { + if (i + 1 >= argc) + { + cerr << argv[0] << ": argument expected for`" << argv[i] << "'" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + + properties->setProperty("Ice.Adapter.Admin.Endpoints", argv[++i]); + } + else + { + cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + } + + int status; + CommunicatorPtr communicator; + + try + { + communicator = initializeWithProperties(argc, argv, properties); + status = run(argc, argv, communicator); + } + catch(const LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/src/slice2cpp/GenUtil.cpp b/cpp/src/slice2cpp/GenUtil.cpp index 8de9550af30..4249d7a7cda 100644 --- a/cpp/src/slice2cpp/GenUtil.cpp +++ b/cpp/src/slice2cpp/GenUtil.cpp @@ -142,9 +142,9 @@ Slice::outputTypeToString(const TypePtr& type) "::Ice::Double&", "::std::string&", "::std::wstring&", - "::Ice::ObjectPtr", - "::Ice::ObjectPrx", - "::Ice::LocalObjectPtr" + "::Ice::ObjectPtr&", + "::Ice::ObjectPrx&", + "::Ice::LocalObjectPtr&" }; BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); diff --git a/cpp/test/Ice/Makefile b/cpp/test/Ice/Makefile new file mode 100644 index 00000000000..e753056f8b7 --- /dev/null +++ b/cpp/test/Ice/Makefile @@ -0,0 +1,26 @@ +# ********************************************************************** +# +# Copyright (c) 2001 +# MutableRealms, Inc. +# Huntsville, AL, USA +# +# All Rights Reserved +# +# ********************************************************************** + +top_srcdir = ../.. + +include $(top_srcdir)/config/Make.rules + +SUBDIRS = operations \ + inheritance \ + exceptions \ + faultTolerance \ + locationForward + +$(EVERYTHING):: + @for subdir in $(SUBDIRS); \ + do \ + echo "making $@ in $$subdir"; \ + ( cd $$subdir && $(MAKE) $@ ) || exit 1; \ + done diff --git a/cpp/test/Ice/exceptions/.depend b/cpp/test/Ice/exceptions/.depend new file mode 100644 index 00000000000..26824bca9b3 --- /dev/null +++ b/cpp/test/Ice/exceptions/.depend @@ -0,0 +1,8 @@ +Test.o: Test.cpp Test.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Shared.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/LocalObject.h ../../../include/Ice/LocalException.h +Client.o: Client.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h ../../include/TestCommon.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +AllTests.o: AllTests.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h ../../include/TestCommon.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +TestI.o: TestI.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h TestI.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +Server.o: Server.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h TestI.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +TestI.o: TestI.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h TestI.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +Collocated.o: Collocated.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h TestI.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +AllTests.o: AllTests.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h ../../include/TestCommon.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h diff --git a/cpp/test/Ice/exceptions/AllTests.cpp b/cpp/test/Ice/exceptions/AllTests.cpp new file mode 100644 index 00000000000..c80231c67e9 --- /dev/null +++ b/cpp/test/Ice/exceptions/AllTests.cpp @@ -0,0 +1,188 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestCommon.h> +#include <Test.h> + +using namespace std; + +ThrowerPrx +allTests(Ice::CommunicatorPtr communicator) +{ + cout << "testing stringToProxy... " << flush; + string ref("thrower:tcp -p 12345 -t 2000"); + Ice::ObjectPrx base = communicator->stringToProxy(ref); + test(base); + cout << "ok" << endl; + + cout << "testing checked cast... " << flush; + ThrowerPrx thrower = ThrowerPrx::checkedCast(base); + test(thrower); + test(thrower == base); + cout << "ok" << endl; + + cout << "catching exact types by value... " << flush; + try + { + thrower->throwAasA(1); + test(false); + } + catch(const APtrE& ex) + { + test(ex->a == 1); + const APtr& p = ex; + test(p->a == 1); + } + catch(...) + { + assert(false); + } + try + { + thrower->throwBasB(1, 2); + test(false); + } + catch(const BPtrE& ex) + { + test(ex->a == 1); + test(ex->b == 2); + const BPtr& p = ex; + test(p->a == 1); + test(p->b == 2); + } + catch(...) + { + assert(false); + } + try + { + thrower->throwCasC(1, 2, 3); + test(false); + } + catch(const CPtrE& ex) + { + test(ex->a == 1); + test(ex->b == 2); + test(ex->c == 3); + const CPtr& p = ex; + test(p->a == 1); + test(p->b == 2); + test(p->c == 3); + } + catch(...) + { + assert(false); + } + cout << "ok" << endl; + + cout << "catching base types by value... " << flush; + try + { + thrower->throwBasB(1, 2); + test(false); + } + catch(const APtrE& ex) + { + test(ex->a == 1); + const APtr& p = ex; + test(p->a == 1); + } + catch(...) + { + assert(false); + } + try + { + thrower->throwCasC(1, 2, 3); + test(false); + } + catch(const BPtrE& ex) + { + test(ex->a == 1); + test(ex->b == 2); + const BPtr& p = ex; + test(p->a == 1); + test(p->b == 2); + } + catch(...) + { + assert(false); + } + cout << "ok" << endl; + + cout << "catching exact types by proxy... " << flush; + try + { + thrower->throwAasAproxy(); + test(false); + } + catch(const APrxE&) + { + } + catch(...) + { + assert(false); + } + try + { + thrower->throwBasBproxy(); + test(false); + } + catch(const BPrxE&) + { + } + catch(...) + { + assert(false); + } + try + { + thrower->throwCasCproxy(); + test(false); + } + catch(const CPrxE&) + { + } + catch(...) + { + assert(false); + } + cout << "ok" << endl; + + cout << "catching base types by proxy... " << flush; + try + { + thrower->throwBasBproxy(); + test(false); + } + catch(const APrxE&) + { + } + catch(...) + { + assert(false); + } + try + { + thrower->throwCasCproxy(); + test(false); + } + catch(const BPrxE&) + { + } + catch(...) + { + assert(false); + } + cout << "ok" << endl; + + return thrower; +} diff --git a/cpp/test/Ice/exceptions/Client.cpp b/cpp/test/Ice/exceptions/Client.cpp new file mode 100644 index 00000000000..033e9929d48 --- /dev/null +++ b/cpp/test/Ice/exceptions/Client.cpp @@ -0,0 +1,57 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestCommon.h> +#include <Test.h> + +using namespace std; + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + ThrowerPrx allTests(Ice::CommunicatorPtr); + ThrowerPrx thrower = allTests(communicator); + thrower->shutdown(); + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + communicator = Ice::initialize(argc, argv); + status = run(argc, argv, communicator); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/test/Ice/exceptions/Collocated.cpp b/cpp/test/Ice/exceptions/Collocated.cpp new file mode 100644 index 00000000000..ac8866e440d --- /dev/null +++ b/cpp/test/Ice/exceptions/Collocated.cpp @@ -0,0 +1,62 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestI.h> + +using namespace std; + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + string endpts("tcp -p 12345 -t 2000"); + Ice::ObjectAdapterPtr adapter = communicator -> + createObjectAdapterWithEndpoints("testadapter", endpts); + Ice::ObjectPtr object = new ThrowerI(adapter); + adapter->add(object, "thrower"); + + ThrowerPrx allTests(Ice::CommunicatorPtr); + allTests(communicator); + + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + communicator = Ice::initialize(argc, argv); + status = run(argc, argv, communicator); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/test/Ice/exceptions/Makefile b/cpp/test/Ice/exceptions/Makefile new file mode 100644 index 00000000000..672ebacc640 --- /dev/null +++ b/cpp/test/Ice/exceptions/Makefile @@ -0,0 +1,59 @@ +# ********************************************************************** +# +# Copyright (c) 2001 +# MutableRealms, Inc. +# Huntsville, AL, USA +# +# All Rights Reserved +# +# ********************************************************************** + +top_srcdir = ../../.. + +CLIENT = client +SERVER = server +COLLOCATED = collocated + +TARGETS = $(CLIENT) $(SERVER) $(COLLOCATED) + +OBJS = Test.o \ + +COBJS = Client.o \ + AllTests.o + +SOBJS = TestI.o \ + Server.o + +COLOBJS = TestI.o \ + Collocated.o \ + AllTests.o + +SRCS = $(OBJS:.o=.cpp) \ + $(COBJS:.o=.cpp) \ + $(SOBJS:.o=.cpp) \ + $(COLOBJS:.o=.cpp) + +include $(top_srcdir)/config/Make.rules + +CPPFLAGS := -I. -I../../include $(CPPFLAGS) + +$(CLIENT): $(OBJS) $(COBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(COBJS) $(LIBS) + +$(SERVER): $(OBJS) $(SOBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(SOBJS) $(LIBS) + +$(COLLOCATED): $(OBJS) $(COLOBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(COLOBJS) $(LIBS) + +Test.h Test.cpp: Test.ice $(SLICE) + rm -f Test.h Test.cpp + $(SLICE) Test.ice + +clean:: + rm -f Test.h Test.cpp + +include .depend diff --git a/cpp/test/Ice/exceptions/Server.cpp b/cpp/test/Ice/exceptions/Server.cpp new file mode 100644 index 00000000000..c4bd9f29870 --- /dev/null +++ b/cpp/test/Ice/exceptions/Server.cpp @@ -0,0 +1,84 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestI.h> + +using namespace std; + +void +usage(const char* n) +{ + cerr << "Usage: " << n << " [--pid]\n"; +} + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + bool pid = false; + for (int i = 1; i < argc; ++i) + { + if(strcmp(argv[i], "--pid") == 0) + { + pid = true; + } + else + { + cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + } + + string endpts("tcp -p 12345 -t 2000"); + Ice::ObjectAdapterPtr adapter = communicator -> createObjectAdapterWithEndpoints("testadapter", endpts); + Ice::ObjectPtr object = new ThrowerI(adapter); + adapter->add(object, "thrower"); + adapter->activate(); + if (pid) + { + cout << getpid() << endl; + } + communicator->waitForShutdown(); + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + communicator = Ice::initialize(argc, argv); + status = run(argc, argv, communicator); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/test/Ice/exceptions/Test.ice b/cpp/test/Ice/exceptions/Test.ice new file mode 100644 index 00000000000..60d9c4ca1b7 --- /dev/null +++ b/cpp/test/Ice/exceptions/Test.ice @@ -0,0 +1,46 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef TEST_ICE +#define TEST_ICE + +class A +{ + int a; +}; + +class B extends A +{ + int b; +}; + +class C extends B +{ + int c; +}; + +class Thrower +{ + void shutdown(); + void throwAasA(int a) throws A; + void throwAasAproxy() throws A*; + void throwBasA(int a, int b) throws A; + void throwBasAproxy() throws A*; + void throwCasA(int a, int b, int c) throws A; + void throwCasAproxy() throws A*; + void throwBasB(int a, int b) throws B; + void throwBasBproxy() throws B*; + void throwCasB(int a, int b, int c) throws B; + void throwCasBproxy() throws B*; + void throwCasC(int a, int b, int c) throws C; + void throwCasCproxy() throws C*; +}; + +#endif diff --git a/cpp/test/Ice/exceptions/TestI.cpp b/cpp/test/Ice/exceptions/TestI.cpp new file mode 100644 index 00000000000..53ce1565f13 --- /dev/null +++ b/cpp/test/Ice/exceptions/TestI.cpp @@ -0,0 +1,115 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestI.h> + +ThrowerI::ThrowerI(const Ice::ObjectAdapterPtr& adapter) : + _adapter(adapter) +{ + APtr a = new A; + _adapter->addTemporary(a); + _a = APrx::uncheckedCast(_adapter->objectToProxy(a)); + + BPtr b = new B; + _adapter->addTemporary(b); + _b = BPrx::uncheckedCast(_adapter->objectToProxy(b)); + + CPtr c = new C; + _adapter->addTemporary(c); + _c = CPrx::uncheckedCast(_adapter->objectToProxy(c)); +} + +void +ThrowerI::shutdown() +{ + _adapter->getCommunicator()->shutdown(); +} + +void +ThrowerI::throwAasA(Ice::Int a) +{ + APtr p = new A; + p->a = a; + p->_throw(); +} + +void +ThrowerI::throwAasAproxy() +{ + _a->_throw(); +} + +void +ThrowerI::throwBasA(Ice::Int a, Ice::Int b) +{ + throwBasB(a, b); +} + +void +ThrowerI::throwBasAproxy() +{ + throwBasBproxy(); +} + +void +ThrowerI::throwCasA(Ice::Int a, Ice::Int b, Ice::Int c) +{ + throwCasC(a, b, c); +} + +void +ThrowerI::throwCasAproxy() +{ + throwCasCproxy(); +} + +void +ThrowerI::throwBasB(Ice::Int a, Ice::Int b) +{ + BPtr p = new B; + p->a = a; + p->b = b; + p->_throw(); +} + +void +ThrowerI::throwBasBproxy() +{ + _b->_throw(); +} + +void +ThrowerI::throwCasB(Ice::Int a, Ice::Int b, Ice::Int c) +{ + throwCasC(a, b, c); +} + +void +ThrowerI::throwCasBproxy() +{ + throwCasCproxy(); +} + +void +ThrowerI::throwCasC(Ice::Int a, Ice::Int b, Ice::Int c) +{ + CPtr p = new C; + p->a = a; + p->b = b; + p->c = c; + p->_throw(); +} + +void +ThrowerI::throwCasCproxy() +{ + _c->_throw(); +} diff --git a/cpp/test/Ice/exceptions/TestI.h b/cpp/test/Ice/exceptions/TestI.h new file mode 100644 index 00000000000..4d3d931f671 --- /dev/null +++ b/cpp/test/Ice/exceptions/TestI.h @@ -0,0 +1,44 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef TEST_I_H +#define TEST_I_H + +#include <Test.h> + +class ThrowerI : public Thrower +{ +public: + + ThrowerI(const Ice::ObjectAdapterPtr&); + + virtual void shutdown(); + virtual void throwAasA(Ice::Int); + virtual void throwAasAproxy(); + virtual void throwBasA(Ice::Int, Ice::Int); + virtual void throwBasAproxy(); + virtual void throwCasA(Ice::Int, Ice::Int, Ice::Int); + virtual void throwCasAproxy(); + virtual void throwBasB(Ice::Int, Ice::Int); + virtual void throwBasBproxy(); + virtual void throwCasB(Ice::Int, Ice::Int, Ice::Int); + virtual void throwCasBproxy(); + virtual void throwCasC(Ice::Int, Ice::Int, Ice::Int); + virtual void throwCasCproxy(); + +private: + + Ice::ObjectAdapterPtr _adapter; + APrx _a; + BPrx _b; + CPrx _c; +}; + +#endif diff --git a/cpp/test/Ice/exceptions/exceptionsC.dsp b/cpp/test/Ice/exceptions/exceptionsC.dsp new file mode 100644 index 00000000000..df68d5e9e06 --- /dev/null +++ b/cpp/test/Ice/exceptions/exceptionsC.dsp @@ -0,0 +1,157 @@ +# Microsoft Developer Studio Project File - Name="exceptionsC" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=exceptionsC - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "exceptionsC.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "exceptionsC.mak" CFG="exceptionsC - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "exceptionsC - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "exceptionsC - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "exceptionsC - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 jtc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"client.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "exceptionsC - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 jtcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"client.exe" /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "exceptionsC - Win32 Release"
+# Name "exceptionsC - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\AllTests.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Test.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Test.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Test.ice
+
+!IF "$(CFG)" == "exceptionsC - Win32 Release"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "exceptionsC - Win32 Debug"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/test/Ice/exceptions/exceptionsCOL.dsp b/cpp/test/Ice/exceptions/exceptionsCOL.dsp new file mode 100644 index 00000000000..84a07e1f770 --- /dev/null +++ b/cpp/test/Ice/exceptions/exceptionsCOL.dsp @@ -0,0 +1,165 @@ +# Microsoft Developer Studio Project File - Name="exceptionsCOL" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=exceptionsCOL - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "exceptionsCOL.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "exceptionsCOL.mak" CFG="exceptionsCOL - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "exceptionsCOL - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "exceptionsCOL - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "exceptionsCOL - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 jtc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"collocated.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "exceptionsCOL - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 jtcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"collocated.exe" /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "exceptionsCOL - Win32 Release"
+# Name "exceptionsCOL - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\AllTests.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Collocated.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Test.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestI.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Test.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestI.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Test.ice
+
+!IF "$(CFG)" == "exceptionsCOL - Win32 Release"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "exceptionsCOL - Win32 Debug"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/test/Ice/exceptions/exceptionsS.dsp b/cpp/test/Ice/exceptions/exceptionsS.dsp new file mode 100644 index 00000000000..a29a74f770a --- /dev/null +++ b/cpp/test/Ice/exceptions/exceptionsS.dsp @@ -0,0 +1,161 @@ +# Microsoft Developer Studio Project File - Name="exceptionsS" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=exceptionsS - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "exceptionsS.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "exceptionsS.mak" CFG="exceptionsS - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "exceptionsS - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "exceptionsS - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "exceptionsS - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 jtc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"server.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "exceptionsS - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 jtcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"server.exe" /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "exceptionsS - Win32 Release"
+# Name "exceptionsS - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Server.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Test.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestI.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Test.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestI.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Test.ice
+
+!IF "$(CFG)" == "exceptionsS - Win32 Release"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "exceptionsS - Win32 Debug"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/test/Ice/exceptions/run.py b/cpp/test/Ice/exceptions/run.py new file mode 100755 index 00000000000..c6390222383 --- /dev/null +++ b/cpp/test/Ice/exceptions/run.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2001 +# MutableRealms, Inc. +# Huntsville, AL, USA +# +# All Rights Reserved +# +# ********************************************************************** + +import os, sys + +for toplevel in ["", "..", os.path.join("..", ".."), os.path.join("..", "..", "..")]: + 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("Ice", "exceptions") +TestUtil.clientServerTest(toplevel, name) +TestUtil.collocatedTest(toplevel, name) +sys.exit(1) diff --git a/cpp/test/Ice/faultTolerance/.depend b/cpp/test/Ice/faultTolerance/.depend new file mode 100644 index 00000000000..d2c3e3d6bef --- /dev/null +++ b/cpp/test/Ice/faultTolerance/.depend @@ -0,0 +1,5 @@ +Test.o: Test.cpp Test.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Shared.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/LocalObject.h ../../../include/Ice/LocalException.h +Client.o: Client.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h ../../include/TestCommon.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +AllTests.o: AllTests.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h ../../include/TestCommon.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +TestI.o: TestI.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h TestI.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +Server.o: Server.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h TestI.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h diff --git a/cpp/test/Ice/faultTolerance/AllTests.cpp b/cpp/test/Ice/faultTolerance/AllTests.cpp new file mode 100644 index 00000000000..8acbf478e9d --- /dev/null +++ b/cpp/test/Ice/faultTolerance/AllTests.cpp @@ -0,0 +1,96 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestCommon.h> +#include <Test.h> +#include <sstream> + +using namespace std; + +void +allTests(Ice::CommunicatorPtr communicator, const vector<int>& ports) +{ + cout << "testing stringToProxy... " << flush; + ostringstream ref; + ref << "test"; + for (vector<int>::const_iterator p = ports.begin(); p != ports.end(); ++p) + { + ref << ":tcp -t 2000 -p " << *p; + } + Ice::ObjectPrx base = communicator->stringToProxy(ref.str()); + test(base); + cout << "ok" << endl; + + cout << "testing checked cast... " << flush; + TestPrx obj = TestPrx::checkedCast(base); + test(obj); + test(obj == base); + cout << "ok" << endl; + + int oldPid = 0; + for (unsigned int i = 1, j = 0; i <= ports.size(); ++i, j = j >= 2 ? 0 : j + 1) + { + cout << "testing server #" << i << "... " << flush; + int pid = obj->pid(); + test(pid != oldPid); + cout << "ok" << endl; + oldPid = pid; + + if (j == 0) + { + cout << "shutting down server #" << i << "... " << flush; + obj->shutdown(); + cout << "ok" << endl; + } + else if(j == 1 || i + 1 > ports.size()) + { + cout << "aborting server #" << i << "... " << flush; + try + { + obj->abort(); + test(false); + } + catch(const Ice::SocketException&) + { + cout << "ok" << endl; + } + } + else if(j == 2) + { + cout << "aborting server #" << i << " and #" << i + 1 << " with nonmutating call... " << flush; + try + { + obj->nonmutatingAbort(); + test(false); + } + catch(const Ice::SocketException&) + { + cout << "ok" << endl; + } + ++i; + } + else + { + assert(false); + } + } + + cout << "testing whether all servers are gone... " << flush; + try + { + obj->_ping(); + test(false); + } + catch(const Ice::SocketException&) + { + cout << "ok" << endl; + } +} diff --git a/cpp/test/Ice/faultTolerance/Client.cpp b/cpp/test/Ice/faultTolerance/Client.cpp new file mode 100644 index 00000000000..a5c488e9486 --- /dev/null +++ b/cpp/test/Ice/faultTolerance/Client.cpp @@ -0,0 +1,82 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestCommon.h> +#include <Test.h> + +using namespace std; + +void +usage(const char* n) +{ + cerr << "Usage: " << n << " port...\n"; +} + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + vector<int> ports; + for (int i = 1; i < argc; ++i) + { + if (argv[i][0] == '-') + { + cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + + ports.push_back(atoi(argv[i])); + } + + if (ports.empty()) + { + cerr << argv[0] << ": no ports specified" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + + void allTests(Ice::CommunicatorPtr, const vector<int>&); + allTests(communicator, ports); + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + communicator = Ice::initialize(argc, argv); + status = run(argc, argv, communicator); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/test/Ice/faultTolerance/Makefile b/cpp/test/Ice/faultTolerance/Makefile new file mode 100644 index 00000000000..448610411ed --- /dev/null +++ b/cpp/test/Ice/faultTolerance/Makefile @@ -0,0 +1,49 @@ +# ********************************************************************** +# +# Copyright (c) 2001 +# MutableRealms, Inc. +# Huntsville, AL, USA +# +# All Rights Reserved +# +# ********************************************************************** + +top_srcdir = ../../.. + +CLIENT = client +SERVER = server + +TARGETS = $(CLIENT) $(SERVER) + +OBJS = Test.o \ + +COBJS = Client.o \ + AllTests.o + +SOBJS = TestI.o \ + Server.o + +SRCS = $(OBJS:.o=.cpp) \ + $(COBJS:.o=.cpp) \ + $(SOBJS:.o=.cpp) + +include $(top_srcdir)/config/Make.rules + +CPPFLAGS := -I. -I../../include $(CPPFLAGS) + +$(CLIENT): $(OBJS) $(COBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(COBJS) $(LIBS) + +$(SERVER): $(OBJS) $(SOBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(SOBJS) $(LIBS) + +Test.h Test.cpp: Test.ice $(SLICE) + rm -f Test.h Test.cpp + $(SLICE) Test.ice + +clean:: + rm -f Test.h Test.cpp + +include .depend diff --git a/cpp/test/Ice/faultTolerance/Server.cpp b/cpp/test/Ice/faultTolerance/Server.cpp new file mode 100644 index 00000000000..00fcdbea2e8 --- /dev/null +++ b/cpp/test/Ice/faultTolerance/Server.cpp @@ -0,0 +1,104 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestI.h> +#include <sstream> + +using namespace std; + +void +usage(const char* n) +{ + cerr << "Usage: " << n << " [--pid] port\n"; +} + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + int port = 0; + bool pid = false; + for (int i = 1; i < argc; ++i) + { + if(strcmp(argv[i], "--pid") == 0) + { + pid = true; + } + else if (argv[i][0] == '-') + { + cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + + if (port > 0) + { + cerr << argv[0] << ": only one port can be specified" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + + port = atoi(argv[i]); + } + + if (port <= 0) + { + cerr << argv[0] << ": no port specified" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + + ostringstream endpts; + endpts << "tcp -p " << port; + Ice::ObjectAdapterPtr adapter = communicator -> createObjectAdapterWithEndpoints("testadapter", endpts.str()); + Ice::ObjectPtr object = new TestI(adapter); + adapter->add(object, "test"); + adapter->activate(); + if (pid) + { + cout << getpid() << endl; + } + communicator->waitForShutdown(); + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + communicator = Ice::initialize(argc, argv); + status = run(argc, argv, communicator); + + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/test/Ice/faultTolerance/Test.ice b/cpp/test/Ice/faultTolerance/Test.ice new file mode 100644 index 00000000000..f41ff8aa109 --- /dev/null +++ b/cpp/test/Ice/faultTolerance/Test.ice @@ -0,0 +1,22 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef TEST_ICE +#define TEST_ICE + +interface Test +{ + void shutdown(); + void abort(); + nonmutating void nonmutatingAbort(); + int pid(); +}; + +#endif diff --git a/cpp/test/Ice/faultTolerance/TestI.cpp b/cpp/test/Ice/faultTolerance/TestI.cpp new file mode 100644 index 00000000000..74a5e5d37a1 --- /dev/null +++ b/cpp/test/Ice/faultTolerance/TestI.cpp @@ -0,0 +1,41 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestI.h> + +TestI::TestI(const Ice::ObjectAdapterPtr& adapter) : + _adapter(adapter) +{ +} + +void +TestI::shutdown() +{ + _adapter->getCommunicator()->shutdown(); +} + +void +TestI::abort() +{ + exit(1); +} + +void +TestI::nonmutatingAbort() +{ + exit(1); +} + +Ice::Int +TestI::pid() +{ + return getpid(); +} diff --git a/cpp/test/Ice/faultTolerance/TestI.h b/cpp/test/Ice/faultTolerance/TestI.h new file mode 100644 index 00000000000..fef682f3d7e --- /dev/null +++ b/cpp/test/Ice/faultTolerance/TestI.h @@ -0,0 +1,32 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef TEST_I_H +#define TEST_I_H + +#include <Test.h> + +class TestI : public Test +{ +public: + + TestI(const Ice::ObjectAdapterPtr&); + + virtual void shutdown(); + virtual void abort(); + virtual void nonmutatingAbort(); + virtual Ice::Int pid(); + +private: + + Ice::ObjectAdapterPtr _adapter; +}; + +#endif diff --git a/cpp/test/Ice/faultTolerance/faulttoleranceC.dsp b/cpp/test/Ice/faultTolerance/faulttoleranceC.dsp new file mode 100644 index 00000000000..70e4a6ddf51 --- /dev/null +++ b/cpp/test/Ice/faultTolerance/faulttoleranceC.dsp @@ -0,0 +1,157 @@ +# Microsoft Developer Studio Project File - Name="faultToleranceC" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=faultToleranceC - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "faultToleranceC.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "faultToleranceC.mak" CFG="faultToleranceC - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "faultToleranceC - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "faultToleranceC - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "faultToleranceC - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 jtc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"client.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "faultToleranceC - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 jtcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"client.exe" /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "faultToleranceC - Win32 Release"
+# Name "faultToleranceC - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\AllTests.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Test.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Test.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Test.ice
+
+!IF "$(CFG)" == "faultToleranceC - Win32 Release"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "faultToleranceC - Win32 Debug"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/test/Ice/faultTolerance/faulttoleranceS.dsp b/cpp/test/Ice/faultTolerance/faulttoleranceS.dsp new file mode 100644 index 00000000000..c9226e83bc3 --- /dev/null +++ b/cpp/test/Ice/faultTolerance/faulttoleranceS.dsp @@ -0,0 +1,161 @@ +# Microsoft Developer Studio Project File - Name="faultToleranceS" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=faultToleranceS - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "faultToleranceS.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "faultToleranceS.mak" CFG="faultToleranceS - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "faultToleranceS - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "faultToleranceS - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "faultToleranceS - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 jtc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"server.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "faultToleranceS - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 jtcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"server.exe" /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "faultToleranceS - Win32 Release"
+# Name "faultToleranceS - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Server.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Test.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestI.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Test.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestI.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Test.ice
+
+!IF "$(CFG)" == "faultToleranceS - Win32 Release"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "faultToleranceS - Win32 Debug"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/test/Ice/faultTolerance/run.py b/cpp/test/Ice/faultTolerance/run.py new file mode 100755 index 00000000000..13f5b0a432b --- /dev/null +++ b/cpp/test/Ice/faultTolerance/run.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2001 +# MutableRealms, Inc. +# Huntsville, AL, USA +# +# All Rights Reserved +# +# ********************************************************************** + +import os, sys + +for toplevel in ["", "..", os.path.join("..", ".."), os.path.join("..", "..", "..")]: + 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("Ice", "faultTolerance") + +testdir = os.path.join(toplevel, "test", name) +server = os.path.join(testdir, "server") +client = os.path.join(testdir, "client") + +num = 8 +base = 12340 + +serverPipes = { } +for i in range(0, num): + print "starting server #%d..." % (i + 1), + serverPipes[i] = os.popen(os.path.join(testdir, "server --pid %d" % (base + i))) + output = serverPipes[i].readline().strip() + if not output: + print "failed!" + sys.exit(0) + TestUtil.serverPids.append(int(output)) + print "ok" + +print "starting client...", +ports = "" +for i in range(0, num): + ports = "%s %d" % (ports, base + i) +clientPipe = os.popen(os.path.join(testdir, "client" + ports)) +output = clientPipe.readline() +if not output: + print "failed!" + TestUtil.killServers() + sys.exit(0) +print "ok" +print output, +while 1: + output = clientPipe.readline() + if not output: + break; + print output, + +sys.exit(1) diff --git a/cpp/test/Ice/inheritance/.depend b/cpp/test/Ice/inheritance/.depend new file mode 100644 index 00000000000..26824bca9b3 --- /dev/null +++ b/cpp/test/Ice/inheritance/.depend @@ -0,0 +1,8 @@ +Test.o: Test.cpp Test.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Shared.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/LocalObject.h ../../../include/Ice/LocalException.h +Client.o: Client.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h ../../include/TestCommon.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +AllTests.o: AllTests.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h ../../include/TestCommon.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +TestI.o: TestI.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h TestI.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +Server.o: Server.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h TestI.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +TestI.o: TestI.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h TestI.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +Collocated.o: Collocated.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h TestI.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +AllTests.o: AllTests.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h ../../include/TestCommon.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h diff --git a/cpp/test/Ice/inheritance/AllTests.cpp b/cpp/test/Ice/inheritance/AllTests.cpp new file mode 100644 index 00000000000..4b3a680d0b9 --- /dev/null +++ b/cpp/test/Ice/inheritance/AllTests.cpp @@ -0,0 +1,226 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestCommon.h> +#include <Test.h> + +using namespace std; + +InitialPrx +allTests(Ice::CommunicatorPtr communicator) +{ + cout << "testing stringToProxy... " << flush; + string ref("initial:tcp -p 12345 -t 2000"); + Ice::ObjectPrx base = communicator->stringToProxy(ref); + test(base); + cout << "ok" << endl; + + cout << "testing checked cast... " << flush; + InitialPrx initial = InitialPrx::checkedCast(base); + test(initial); + test(initial == base); + cout << "ok" << endl; + + cout << "getting proxies for class hierarchy... " << flush; + M_A::C_APrx ca = initial->c_a(); + M_B::C_BPrx cb = initial->c_b(); + M_A::C_CPrx cc = initial->c_c(); + M_A::C_DPrx cd = initial->c_d(); + test(ca != cb); + test(ca != cc); + test(ca != cd); + test(cb != cc); + test(cb != cd); + test(cc != cd); + cout << "ok" << endl; + + cout << "getting proxies for interface hierarchy... " << flush; + M_A::I_APrx ia = initial->i_a(); + M_B::I_B1Prx ib1 = initial->i_b1(); + M_B::I_B2Prx ib2 = initial->i_b2(); + M_A::I_CPrx ic = initial->i_c(); + test(ia != ib1); + test(ia != ib2); + test(ia != ic); + test(ib1 != ib2); + test(ib1 != ic); + test(ib2 != ic); + cout << "ok" << endl; + + cout << "invoking proxy operations on class hierarchy... " << flush; + M_A::C_APrx cao; + M_B::C_BPrx cbo; + M_A::C_CPrx cco; + + cao = ca->ca(ca); + test(cao == ca); + cao = ca->ca(cb); + test(cao == cb); + cao = ca->ca(cc); + test(cao == cc); + cao = cb->ca(ca); + test(cao == ca); + cao = cb->ca(cb); + test(cao == cb); + cao = cb->ca(cc); + test(cao == cc); + cao = cc->ca(ca); + test(cao == ca); + cao = cc->ca(cb); + test(cao == cb); + cao = cc->ca(cc); + test(cao == cc); + + cao = cb->cb(cb); + test(cao == cb); + cbo = cb->cb(cb); + test(cbo == cb); + cao = cb->cb(cc); + test(cao == cc); + cbo = cb->cb(cc); + test(cbo == cc); + cao = cc->cb(cb); + test(cao == cb); + cbo = cc->cb(cb); + test(cbo == cb); + cao = cc->cb(cc); + test(cao == cc); + cbo = cc->cb(cc); + test(cbo == cc); + + cao = cc->cc(cc); + test(cao == cc); + cbo = cc->cc(cc); + test(cbo == cc); + cco = cc->cc(cc); + test(cco == cc); + + cout << "ok" << endl; + + cout << "ditto, but for interface hierarchy... " << flush; + M_A::I_APrx iao; + M_B::I_B1Prx ib1o; + M_B::I_B2Prx ib2o; + M_A::I_CPrx ico; + + iao = ia->ia(ia); + test(iao == ia); + iao = ia->ia(ib1); + test(iao == ib1); + iao = ia->ia(ib2); + test(iao == ib2); + iao = ia->ia(ic); + test(iao == ic); + iao = ib1->ia(ia); + test(iao == ia); + iao = ib1->ia(ib1); + test(iao == ib1); + iao = ib1->ia(ib2); + test(iao == ib2); + iao = ib1->ia(ic); + test(iao == ic); + iao = ib2->ia(ia); + test(iao == ia); + iao = ib2->ia(ib1); + test(iao == ib1); + iao = ib2->ia(ib2); + test(iao == ib2); + iao = ib2->ia(ic); + test(iao == ic); + iao = ic->ia(ia); + test(iao == ia); + iao = ic->ia(ib1); + test(iao == ib1); + iao = ic->ia(ib2); + test(iao == ib2); + iao = ic->ia(ic); + test(iao == ic); + + iao = ib1->ib1(ib1); + test(iao == ib1); + ib1o = ib1->ib1(ib1); + test(ib1o == ib1); + iao = ib1->ib1(ic); + test(iao == ic); + ib1o = ib1->ib1(ic); + test(ib1o == ic); + iao = ic->ib1(ib1); + test(iao == ib1); + ib1o = ic->ib1(ib1); + test(ib1o == ib1); + iao = ic->ib1(ic); + test(iao == ic); + ib1o = ic->ib1(ic); + test(ib1o == ic); + + iao = ib2->ib2(ib2); + test(iao == ib2); + ib2o = ib2->ib2(ib2); + test(ib2o == ib2); + iao = ib2->ib2(ic); + test(iao == ic); + ib2o = ib2->ib2(ic); + test(ib2o == ic); + iao = ic->ib2(ib2); + test(iao == ib2); + ib2o = ic->ib2(ib2); + test(ib2o == ib2); + iao = ic->ib2(ic); + test(iao == ic); + ib2o = ic->ib2(ic); + test(ib2o == ic); + + iao = ic->ic(ic); + test(iao == ic); + ib1o = ic->ic(ic); + test(ib1o == ic); + ib2o = ic->ic(ic); + test(ib2o == ic); + ico = ic->ic(ic); + test(ico == ic); + + cout << "ok" << endl; + + cout << "ditto, but for class implementing interfaces... " << flush; + M_A::C_DPrx cdo; + + cao = cd->ca(cd); + test(cao == cd); + cbo = cd->cb(cd); + test(cbo == cd); + cco = cd->cc(cd); + test(cco == cd); + + iao = cd->ia(cd); + test(iao == cd); + ib1o = cd->ib1(cd); + test(ib1o == cd); + ib2o = cd->ib2(cd); + test(ib2o == cd); + + cao = cd->cd(cd); + test(cao == cd); + cbo = cd->cd(cd); + test(cbo == cd); + cco = cd->cd(cd); + test(cco == cd); + + iao = cd->cd(cd); + test(iao == cd); + ib1o = cd->cd(cd); + test(ib1o == cd); + ib2o = cd->cd(cd); + test(ib2o == cd); + + cout << "ok" << endl; + + return initial; +} diff --git a/cpp/test/Ice/inheritance/Client.cpp b/cpp/test/Ice/inheritance/Client.cpp new file mode 100644 index 00000000000..28aa409f55e --- /dev/null +++ b/cpp/test/Ice/inheritance/Client.cpp @@ -0,0 +1,57 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestCommon.h> +#include <Test.h> + +using namespace std; + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + InitialPrx allTests(Ice::CommunicatorPtr); + InitialPrx initial = allTests(communicator); + initial->shutdown(); + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + communicator = Ice::initialize(argc, argv); + status = run(argc, argv, communicator); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/test/Ice/inheritance/Collocated.cpp b/cpp/test/Ice/inheritance/Collocated.cpp new file mode 100644 index 00000000000..e0ef8cb6e98 --- /dev/null +++ b/cpp/test/Ice/inheritance/Collocated.cpp @@ -0,0 +1,62 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestI.h> + +using namespace std; + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + string endpts("tcp -p 12345 -t 2000"); + Ice::ObjectAdapterPtr adapter = communicator -> + createObjectAdapterWithEndpoints("testadapter", endpts); + Ice::ObjectPtr object = new InitialI(adapter); + adapter->add(object, "initial"); + + InitialPrx allTests(Ice::CommunicatorPtr); + allTests(communicator); + + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + communicator = Ice::initialize(argc, argv); + status = run(argc, argv, communicator); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/test/Ice/inheritance/Makefile b/cpp/test/Ice/inheritance/Makefile new file mode 100644 index 00000000000..672ebacc640 --- /dev/null +++ b/cpp/test/Ice/inheritance/Makefile @@ -0,0 +1,59 @@ +# ********************************************************************** +# +# Copyright (c) 2001 +# MutableRealms, Inc. +# Huntsville, AL, USA +# +# All Rights Reserved +# +# ********************************************************************** + +top_srcdir = ../../.. + +CLIENT = client +SERVER = server +COLLOCATED = collocated + +TARGETS = $(CLIENT) $(SERVER) $(COLLOCATED) + +OBJS = Test.o \ + +COBJS = Client.o \ + AllTests.o + +SOBJS = TestI.o \ + Server.o + +COLOBJS = TestI.o \ + Collocated.o \ + AllTests.o + +SRCS = $(OBJS:.o=.cpp) \ + $(COBJS:.o=.cpp) \ + $(SOBJS:.o=.cpp) \ + $(COLOBJS:.o=.cpp) + +include $(top_srcdir)/config/Make.rules + +CPPFLAGS := -I. -I../../include $(CPPFLAGS) + +$(CLIENT): $(OBJS) $(COBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(COBJS) $(LIBS) + +$(SERVER): $(OBJS) $(SOBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(SOBJS) $(LIBS) + +$(COLLOCATED): $(OBJS) $(COLOBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(COLOBJS) $(LIBS) + +Test.h Test.cpp: Test.ice $(SLICE) + rm -f Test.h Test.cpp + $(SLICE) Test.ice + +clean:: + rm -f Test.h Test.cpp + +include .depend diff --git a/cpp/test/Ice/inheritance/Server.cpp b/cpp/test/Ice/inheritance/Server.cpp new file mode 100644 index 00000000000..14e985c66e3 --- /dev/null +++ b/cpp/test/Ice/inheritance/Server.cpp @@ -0,0 +1,84 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestI.h> + +using namespace std; + +void +usage(const char* n) +{ + cerr << "Usage: " << n << " [--pid]\n"; +} + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + bool pid = false; + for (int i = 1; i < argc; ++i) + { + if(strcmp(argv[i], "--pid") == 0) + { + pid = true; + } + else + { + cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + } + + string endpts("tcp -p 12345 -t 2000"); + Ice::ObjectAdapterPtr adapter = communicator -> createObjectAdapterWithEndpoints("testadapter", endpts); + Ice::ObjectPtr object = new InitialI(adapter); + adapter->add(object, "initial"); + adapter->activate(); + if (pid) + { + cout << getpid() << endl; + } + communicator->waitForShutdown(); + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + communicator = Ice::initialize(argc, argv); + status = run(argc, argv, communicator); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/test/Ice/inheritance/Test.ice b/cpp/test/Ice/inheritance/Test.ice new file mode 100644 index 00000000000..b05492b092e --- /dev/null +++ b/cpp/test/Ice/inheritance/Test.ice @@ -0,0 +1,82 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef TEST_ICE +#define TEST_ICE + +module M_A +{ + +interface I_A +{ + I_A* ia(I_A* p); +}; + +class C_A +{ + C_A* ca(C_A* p); +}; + +}; + +module M_B +{ + +interface I_B1 extends M_A::I_A +{ + I_B1* ib1(I_B1* p); +}; + +interface I_B2 extends M_A::I_A +{ + I_B2* ib2(I_B2* p); +}; + +class C_B extends M_A::C_A +{ + C_B* cb(C_B* p); +}; + +}; + +module M_A +{ + +interface I_C extends M_B::I_B1, M_B::I_B2 +{ + I_C* ic(I_C* p); +}; + +class C_C extends M_B::C_B +{ + C_C* cc(C_C* p); +}; + +class C_D extends C_C implements M_B::I_B1, M_B::I_B2 +{ + C_D* cd(C_D* p); +}; + +}; + +interface Initial +{ + void shutdown(); + M_A::C_A* c_a(); + M_B::C_B* c_b(); + M_A::C_C* c_c(); + M_A::C_D* c_d(); + M_A::I_A* i_a(); + M_B::I_B1* i_b1(); + M_B::I_B2* i_b2(); + M_A::I_C* i_c(); +}; + +#endif diff --git a/cpp/test/Ice/inheritance/TestI.cpp b/cpp/test/Ice/inheritance/TestI.cpp new file mode 100644 index 00000000000..9023a1731e3 --- /dev/null +++ b/cpp/test/Ice/inheritance/TestI.cpp @@ -0,0 +1,150 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestI.h> + +M_A::C_APrx +C_A_I::ca(const M_A::C_APrx& p) +{ + return p; +} + +M_B::C_BPrx +C_B_I::cb(const M_B::C_BPrx& p) +{ + return p; +} + +M_A::C_CPrx +C_C_I::cc(const M_A::C_CPrx& p) +{ + return p; +} + +M_A::C_DPrx +C_D_I::cd(const M_A::C_DPrx& p) +{ + return p; +} + +M_A::I_APrx +I_A_I::ia(const M_A::I_APrx& p) +{ + return p; +} + +M_B::I_B1Prx +I_B1_I::ib1(const M_B::I_B1Prx& p) +{ + return p; +} + +M_B::I_B2Prx +I_B2_I::ib2(const M_B::I_B2Prx& p) +{ + return p; +} + +M_A::I_CPrx +I_C_I::ic(const M_A::I_CPrx& p) +{ + return p; +} + +InitialI::InitialI(const Ice::ObjectAdapterPtr& adapter) : + _adapter(adapter) +{ + Ice::ObjectPtr cai = new C_A_I; + _adapter->addTemporary(cai); + _ca = M_A::C_APrx::uncheckedCast(_adapter->objectToProxy(cai)); + + Ice::ObjectPtr cbi = new C_B_I; + _adapter->addTemporary(cbi); + _cb = M_B::C_BPrx::uncheckedCast(_adapter->objectToProxy(cbi)); + + Ice::ObjectPtr cci = new C_C_I; + _adapter->addTemporary(cci); + _cc = M_A::C_CPrx::uncheckedCast(_adapter->objectToProxy(cci)); + + Ice::ObjectPtr cdi = new C_D_I; + _adapter->addTemporary(cdi); + _cd = M_A::C_DPrx::uncheckedCast(_adapter->objectToProxy(cdi)); + + Ice::ObjectPtr iai = new I_A_I; + _adapter->addTemporary(iai); + _ia = M_A::I_APrx::uncheckedCast(_adapter->objectToProxy(iai)); + + Ice::ObjectPtr ib1i = new I_B1_I; + _adapter->addTemporary(ib1i); + _ib1 = M_B::I_B1Prx::uncheckedCast(_adapter->objectToProxy(ib1i)); + + Ice::ObjectPtr ib2i = new I_B2_I; + _adapter->addTemporary(ib2i); + _ib2 = M_B::I_B2Prx::uncheckedCast(_adapter->objectToProxy(ib2i)); + + Ice::ObjectPtr ici = new I_C_I; + _adapter->addTemporary(ici); + _ic = M_A::I_CPrx::uncheckedCast(_adapter->objectToProxy(ici)); +} + +void +InitialI::shutdown() +{ + _adapter->getCommunicator()->shutdown(); +} + +M_A::C_APrx +InitialI::c_a() +{ + return _ca; +} + +M_B::C_BPrx +InitialI::c_b() +{ + return _cb; +} + +M_A::C_CPrx +InitialI::c_c() +{ + return _cc; +} + +M_A::C_DPrx +InitialI::c_d() +{ + return _cd; +} + +M_A::I_APrx +InitialI::i_a() +{ + return _ia; +} + +M_B::I_B1Prx +InitialI::i_b1() +{ + return _ib1; +} + +M_B::I_B2Prx +InitialI::i_b2() +{ + return _ib2; +} + +M_A::I_CPrx +InitialI::i_c() +{ + return _ic; +} diff --git a/cpp/test/Ice/inheritance/TestI.h b/cpp/test/Ice/inheritance/TestI.h new file mode 100644 index 00000000000..222374aa263 --- /dev/null +++ b/cpp/test/Ice/inheritance/TestI.h @@ -0,0 +1,102 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef TEST_I_H +#define TEST_I_H + +#include <Test.h> + +class InitialI : public Initial +{ +public: + + InitialI(const Ice::ObjectAdapterPtr&); + + virtual void shutdown(); + + virtual M_A::C_APrx c_a(); + virtual M_B::C_BPrx c_b(); + virtual M_A::C_CPrx c_c(); + virtual M_A::C_DPrx c_d(); + virtual M_A::I_APrx i_a(); + virtual M_B::I_B1Prx i_b1(); + virtual M_B::I_B2Prx i_b2(); + virtual M_A::I_CPrx i_c(); + +private: + + Ice::ObjectAdapterPtr _adapter; + M_A::C_APrx _ca; + M_B::C_BPrx _cb; + M_A::C_CPrx _cc; + M_A::C_DPrx _cd; + M_A::I_APrx _ia; + M_B::I_B1Prx _ib1; + M_B::I_B2Prx _ib2; + M_A::I_CPrx _ic; +}; + +class C_A_I : virtual public M_A::C_A +{ +public: + + virtual M_A::C_APrx ca(const M_A::C_APrx&); +}; + +class C_B_I : virtual public M_B::C_B, virtual public C_A_I +{ +public: + + virtual M_B::C_BPrx cb(const M_B::C_BPrx&); +}; + +class C_C_I : virtual public M_A::C_C, virtual public C_B_I +{ +public: + + virtual M_A::C_CPrx cc(const M_A::C_CPrx&); +}; + +class I_A_I : virtual public M_A::I_A +{ +public: + + virtual M_A::I_APrx ia(const M_A::I_APrx&); +}; + +class I_B1_I : virtual public M_B::I_B1, virtual public I_A_I +{ +public: + + virtual M_B::I_B1Prx ib1(const M_B::I_B1Prx&); +}; + +class I_B2_I : virtual public M_B::I_B2, virtual public I_A_I +{ +public: + + virtual M_B::I_B2Prx ib2(const M_B::I_B2Prx&); +}; + +class I_C_I : virtual public M_A::I_C, virtual public I_B1_I, virtual public I_B2_I +{ +public: + + virtual M_A::I_CPrx ic(const M_A::I_CPrx&); +}; + +class C_D_I : virtual public M_A::C_D, virtual public C_C_I, virtual public I_B1_I, virtual public I_B2_I +{ +public: + + virtual M_A::C_DPrx cd(const M_A::C_DPrx&); +}; + +#endif diff --git a/cpp/test/Ice/inheritance/inheritanceC.dsp b/cpp/test/Ice/inheritance/inheritanceC.dsp new file mode 100644 index 00000000000..6b40a2102e4 --- /dev/null +++ b/cpp/test/Ice/inheritance/inheritanceC.dsp @@ -0,0 +1,157 @@ +# Microsoft Developer Studio Project File - Name="inheritanceC" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=inheritanceC - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "inheritanceC.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "inheritanceC.mak" CFG="inheritanceC - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "inheritanceC - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "inheritanceC - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "inheritanceC - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 jtc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"client.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "inheritanceC - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 jtcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"client.exe" /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "inheritanceC - Win32 Release"
+# Name "inheritanceC - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\AllTests.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Test.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Test.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Test.ice
+
+!IF "$(CFG)" == "inheritanceC - Win32 Release"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "inheritanceC - Win32 Debug"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/test/Ice/inheritance/inheritanceCOL.dsp b/cpp/test/Ice/inheritance/inheritanceCOL.dsp new file mode 100644 index 00000000000..b15f0b1fea3 --- /dev/null +++ b/cpp/test/Ice/inheritance/inheritanceCOL.dsp @@ -0,0 +1,165 @@ +# Microsoft Developer Studio Project File - Name="inheritanceCOL" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=inheritanceCOL - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "inheritanceCOL.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "inheritanceCOL.mak" CFG="inheritanceCOL - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "inheritanceCOL - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "inheritanceCOL - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "inheritanceCOL - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 jtc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"collocated.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "inheritanceCOL - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 jtcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"collocated.exe" /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "inheritanceCOL - Win32 Release"
+# Name "inheritanceCOL - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\AllTests.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Collocated.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Test.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestI.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Test.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestI.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Test.ice
+
+!IF "$(CFG)" == "inheritanceCOL - Win32 Release"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "inheritanceCOL - Win32 Debug"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/test/Ice/inheritance/inheritanceS.dsp b/cpp/test/Ice/inheritance/inheritanceS.dsp new file mode 100644 index 00000000000..d62e88a93b8 --- /dev/null +++ b/cpp/test/Ice/inheritance/inheritanceS.dsp @@ -0,0 +1,161 @@ +# Microsoft Developer Studio Project File - Name="inheritanceS" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=inheritanceS - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "inheritanceS.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "inheritanceS.mak" CFG="inheritanceS - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "inheritanceS - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "inheritanceS - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "inheritanceS - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 jtc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"server.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "inheritanceS - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 jtcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"server.exe" /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "inheritanceS - Win32 Release"
+# Name "inheritanceS - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Server.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Test.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestI.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Test.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestI.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Test.ice
+
+!IF "$(CFG)" == "inheritanceS - Win32 Release"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "inheritanceS - Win32 Debug"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/test/Ice/inheritance/run.py b/cpp/test/Ice/inheritance/run.py new file mode 100755 index 00000000000..11efe6c5045 --- /dev/null +++ b/cpp/test/Ice/inheritance/run.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2001 +# MutableRealms, Inc. +# Huntsville, AL, USA +# +# All Rights Reserved +# +# ********************************************************************** + +import os, sys + +for toplevel in ["", "..", os.path.join("..", ".."), os.path.join("..", "..", "..")]: + 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("Ice", "inheritance") +TestUtil.clientServerTest(toplevel, name) +TestUtil.collocatedTest(toplevel, name) +sys.exit(1) diff --git a/cpp/test/Ice/locationForward/.depend b/cpp/test/Ice/locationForward/.depend new file mode 100644 index 00000000000..d2c3e3d6bef --- /dev/null +++ b/cpp/test/Ice/locationForward/.depend @@ -0,0 +1,5 @@ +Test.o: Test.cpp Test.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Shared.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/LocalObject.h ../../../include/Ice/LocalException.h +Client.o: Client.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h ../../include/TestCommon.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +AllTests.o: AllTests.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h ../../include/TestCommon.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +TestI.o: TestI.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h TestI.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +Server.o: Server.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h TestI.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h diff --git a/cpp/test/Ice/locationForward/AllTests.cpp b/cpp/test/Ice/locationForward/AllTests.cpp new file mode 100644 index 00000000000..c8bb3a865f1 --- /dev/null +++ b/cpp/test/Ice/locationForward/AllTests.cpp @@ -0,0 +1,55 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestCommon.h> +#include <Test.h> +#include <sstream> + +using namespace std; + +void +allTests(Ice::CommunicatorPtr communicator, int port, int lastPort) +{ + cout << "testing stringToProxy... " << flush; + ostringstream ref; + ref << "test:tcp -t 2000 -p " << port; + Ice::ObjectPrx base = communicator->stringToProxy(ref.str()); + test(base); + ostringstream lastRef; + lastRef << "test:tcp -t 2000 -p " << lastPort; + Ice::ObjectPrx lastBase = communicator->stringToProxy(lastRef.str()); + test(lastBase); + cout << "ok" << endl; + + cout << "testing checked cast... " << flush; + TestPrx obj = TestPrx::checkedCast(base); + test(obj); + test(obj == base); + TestPrx lastObj = TestPrx::checkedCast(lastBase); + test(lastObj); + test(lastObj == lastBase); + cout << "ok" << endl; + + cout << "shutting down all servers with single call... " << flush; + obj->shutdown(); + cout << "ok" << endl; + + cout << "testing whether all servers are gone... " << flush; + try + { + lastObj->_ping(); + test(false); + } + catch(const Ice::SocketException&) + { + cout << "ok" << endl; + } +} diff --git a/cpp/test/Ice/locationForward/Client.cpp b/cpp/test/Ice/locationForward/Client.cpp new file mode 100644 index 00000000000..266789f30a0 --- /dev/null +++ b/cpp/test/Ice/locationForward/Client.cpp @@ -0,0 +1,96 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestCommon.h> +#include <Test.h> + +using namespace std; + +void +usage(const char* n) +{ + cerr << "Usage: " << n << " port port\n"; +} + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + int port = 0; + int lastPort = 0; + for (int i = 1; i < argc; ++i) + { + if (argv[i][0] == '-') + { + cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + + if (port == 0) + { + port = atoi(argv[i]); + } + else if(lastPort == 0) + { + lastPort = atoi(argv[i]); + } + else + { + cerr << argv[0] << ": only one two ports can be specified" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + } + + if (port == 0 || lastPort == 0) + { + cerr << argv[0] << ": no ports specified" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + + void allTests(Ice::CommunicatorPtr, int, int); + allTests(communicator, port, lastPort); + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + communicator = Ice::initialize(argc, argv); + status = run(argc, argv, communicator); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/test/Ice/locationForward/Makefile b/cpp/test/Ice/locationForward/Makefile new file mode 100644 index 00000000000..448610411ed --- /dev/null +++ b/cpp/test/Ice/locationForward/Makefile @@ -0,0 +1,49 @@ +# ********************************************************************** +# +# Copyright (c) 2001 +# MutableRealms, Inc. +# Huntsville, AL, USA +# +# All Rights Reserved +# +# ********************************************************************** + +top_srcdir = ../../.. + +CLIENT = client +SERVER = server + +TARGETS = $(CLIENT) $(SERVER) + +OBJS = Test.o \ + +COBJS = Client.o \ + AllTests.o + +SOBJS = TestI.o \ + Server.o + +SRCS = $(OBJS:.o=.cpp) \ + $(COBJS:.o=.cpp) \ + $(SOBJS:.o=.cpp) + +include $(top_srcdir)/config/Make.rules + +CPPFLAGS := -I. -I../../include $(CPPFLAGS) + +$(CLIENT): $(OBJS) $(COBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(COBJS) $(LIBS) + +$(SERVER): $(OBJS) $(SOBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(SOBJS) $(LIBS) + +Test.h Test.cpp: Test.ice $(SLICE) + rm -f Test.h Test.cpp + $(SLICE) Test.ice + +clean:: + rm -f Test.h Test.cpp + +include .depend diff --git a/cpp/test/Ice/locationForward/Server.cpp b/cpp/test/Ice/locationForward/Server.cpp new file mode 100644 index 00000000000..c87e0c26150 --- /dev/null +++ b/cpp/test/Ice/locationForward/Server.cpp @@ -0,0 +1,116 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestI.h> +#include <sstream> + +using namespace std; + +void +usage(const char* n) +{ + cerr << "Usage: " << n << " [--pid] [--fwd reference] port\n"; +} + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + int port = 0; + bool pid = false; + Ice::ObjectPrx fwd; + for (int i = 1; i < argc; ++i) + { + if(strcmp(argv[i], "--pid") == 0) + { + pid = true; + } + else if (strcmp(argv[i], "--fwd") == 0) + { + if (i + 1 >= argc) + { + cerr << argv[0] << ": argument expected for`" << argv[i] << "'" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + + fwd = communicator->stringToProxy(argv[++i]); + } + else if (argv[i][0] == '-') + { + cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + + if (port > 0) + { + cerr << argv[0] << ": only one port can be specified" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + + port = atoi(argv[i]); + } + + if (port <= 0) + { + cerr << argv[0] << ": no port specified" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + + ostringstream endpts; + endpts << "tcp -p " << port; + Ice::ObjectAdapterPtr adapter = communicator -> createObjectAdapterWithEndpoints("testadapter", endpts.str()); + Ice::ObjectPtr object = new TestI(adapter, fwd); + adapter->add(object, "test"); + adapter->activate(); + if (pid) + { + cout << getpid() << endl; + } + communicator->waitForShutdown(); + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + communicator = Ice::initialize(argc, argv); + status = run(argc, argv, communicator); + + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/test/Ice/locationForward/Test.ice b/cpp/test/Ice/locationForward/Test.ice new file mode 100644 index 00000000000..e154679d6a5 --- /dev/null +++ b/cpp/test/Ice/locationForward/Test.ice @@ -0,0 +1,19 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef TEST_ICE +#define TEST_ICE + +interface Test +{ + void shutdown(); +}; + +#endif diff --git a/cpp/test/Ice/locationForward/TestI.cpp b/cpp/test/Ice/locationForward/TestI.cpp new file mode 100644 index 00000000000..1b67b65a649 --- /dev/null +++ b/cpp/test/Ice/locationForward/TestI.cpp @@ -0,0 +1,28 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestI.h> + +TestI::TestI(const Ice::ObjectAdapterPtr& adapter, const Ice::ObjectPrx fwd) : + _adapter(adapter), + _fwd(fwd) +{ +} + +void +TestI::shutdown() +{ + _adapter->getCommunicator()->shutdown(); + if (_fwd) + { + throw Ice::LocationForward(_fwd); + } +} diff --git a/cpp/test/Ice/locationForward/TestI.h b/cpp/test/Ice/locationForward/TestI.h new file mode 100644 index 00000000000..47bf08726fa --- /dev/null +++ b/cpp/test/Ice/locationForward/TestI.h @@ -0,0 +1,30 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef TEST_I_H +#define TEST_I_H + +#include <Test.h> + +class TestI : public Test +{ +public: + + TestI(const Ice::ObjectAdapterPtr&, const Ice::ObjectPrx); + + virtual void shutdown(); + +private: + + Ice::ObjectAdapterPtr _adapter; + Ice::ObjectPrx _fwd; +}; + +#endif diff --git a/cpp/test/Ice/locationForward/locationforwardC.dsp b/cpp/test/Ice/locationForward/locationforwardC.dsp new file mode 100644 index 00000000000..105ee8bafce --- /dev/null +++ b/cpp/test/Ice/locationForward/locationforwardC.dsp @@ -0,0 +1,157 @@ +# Microsoft Developer Studio Project File - Name="locationForwardC" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=locationForwardC - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "locationForwardC.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "locationForwardC.mak" CFG="locationForwardC - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "locationForwardC - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "locationForwardC - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "locationForwardC - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 jtc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"client.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "locationForwardC - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 jtcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"client.exe" /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "locationForwardC - Win32 Release"
+# Name "locationForwardC - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\AllTests.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Test.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Test.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Test.ice
+
+!IF "$(CFG)" == "locationForwardC - Win32 Release"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "locationForwardC - Win32 Debug"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/test/Ice/locationForward/locationforwardS.dsp b/cpp/test/Ice/locationForward/locationforwardS.dsp new file mode 100644 index 00000000000..8c5bafcd7d1 --- /dev/null +++ b/cpp/test/Ice/locationForward/locationforwardS.dsp @@ -0,0 +1,161 @@ +# Microsoft Developer Studio Project File - Name="locationForwardS" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=locationForwardS - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "locationForwardS.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "locationForwardS.mak" CFG="locationForwardS - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "locationForwardS - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "locationForwardS - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "locationForwardS - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 jtc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"server.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "locationForwardS - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 jtcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"server.exe" /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "locationForwardS - Win32 Release"
+# Name "locationForwardS - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Server.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Test.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestI.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Test.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestI.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Test.ice
+
+!IF "$(CFG)" == "locationForwardS - Win32 Release"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "locationForwardS - Win32 Debug"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/test/Ice/locationForward/run.py b/cpp/test/Ice/locationForward/run.py new file mode 100755 index 00000000000..f09af503ef4 --- /dev/null +++ b/cpp/test/Ice/locationForward/run.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2001 +# MutableRealms, Inc. +# Huntsville, AL, USA +# +# All Rights Reserved +# +# ********************************************************************** + +import os, sys + +for toplevel in ["", "..", os.path.join("..", ".."), os.path.join("..", "..", "..")]: + 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("Ice", "locationForward") + +testdir = os.path.join(toplevel, "test", name) +server = os.path.join(testdir, "server") +client = os.path.join(testdir, "client") + +num = 5 +base = 12340 + +serverPipes = { } +for i in range(0, num): + print "starting server #%d..." % (i + 1), + if i + 1 < num: + s = "server --pid --fwd \"test:tcp -t 2000 -p %d\" %d" % ((base + i + 1), (base + i)) + else: + s = "server --pid %d" % (base + i) + serverPipes[i] = os.popen(os.path.join(testdir, s)) + output = serverPipes[i].readline().strip() + if not output: + print "failed!" + sys.exit(0) + TestUtil.serverPids.append(int(output)) + print "ok" + +print "starting client...", +s = "client %d %d" % (base, (base + num - 1)) +clientPipe = os.popen(os.path.join(testdir, s)) +output = clientPipe.readline() +if not output: + print "failed!" + TestUtil.killServers() + sys.exit(0) +print "ok" +print output, +while 1: + output = clientPipe.readline() + if not output: + break; + print output, + +sys.exit(1) diff --git a/cpp/test/Ice/operations/.depend b/cpp/test/Ice/operations/.depend new file mode 100644 index 00000000000..ab83ee3dbf0 --- /dev/null +++ b/cpp/test/Ice/operations/.depend @@ -0,0 +1,12 @@ +Test.o: Test.cpp Test.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Shared.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/LocalObject.h ../../../include/Ice/LocalException.h +Client.o: Client.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h ../../include/TestCommon.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +AllTests.o: AllTests.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h ../../include/TestCommon.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +Twoways.o: Twoways.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h ../../include/TestCommon.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +Exceptions.o: Exceptions.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h ../../include/TestCommon.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +TestI.o: TestI.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h TestI.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +Server.o: Server.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h TestI.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +TestI.o: TestI.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h TestI.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +Collocated.o: Collocated.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h TestI.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +AllTests.o: AllTests.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h ../../include/TestCommon.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +Twoways.o: Twoways.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h ../../include/TestCommon.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h +Exceptions.o: Exceptions.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Communicator.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Native.h ../../../include/Ice/LocalObject.h ../../../include/Ice/Shared.h ../../../include/Ice/LoggerF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/PicklerF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/ValueFactoryF.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/ValueFactory.h ../../../include/Ice/Pickler.h ../../../include/Ice/Initialize.h ../../include/TestCommon.h Test.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/EmitterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/Ice/Stream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h diff --git a/cpp/test/Ice/operations/AllTests.cpp b/cpp/test/Ice/operations/AllTests.cpp new file mode 100644 index 00000000000..2b9ca0e1558 --- /dev/null +++ b/cpp/test/Ice/operations/AllTests.cpp @@ -0,0 +1,49 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestCommon.h> +#include <Test.h> + +using namespace std; + +Test::MyClassPrx +allTests(Ice::CommunicatorPtr communicator) +{ + cout << "testing stringToProxy... " << flush; + string ref("test:tcp -p 12345 -t 2000"); + Ice::ObjectPrx base = communicator->stringToProxy(ref); + test(base); + cout << "ok" << endl; + + cout << "testing checked cast... " << flush; + 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); + cout << "ok" << endl; + + cout << "testing twoway operations... " << flush; + void twoways(Test::MyClassPrx); + twoways(cl); + twoways(derived); + derived->opDerived(); + cout << "ok" << endl; + + cout << "testing exceptions... " << flush; + void exceptions(Test::MyClassPrx); + exceptions(cl); + cout << "ok" << endl; + + return cl; +} diff --git a/cpp/test/Ice/operations/Client.cpp b/cpp/test/Ice/operations/Client.cpp new file mode 100644 index 00000000000..75572304ace --- /dev/null +++ b/cpp/test/Ice/operations/Client.cpp @@ -0,0 +1,73 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestCommon.h> +#include <Test.h> + +using namespace std; + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + Test::MyClassPrx allTests(Ice::CommunicatorPtr); + Test::MyClassPrx myClass = allTests(communicator); + + cout << "testing server shutdown... " << flush; + myClass->shutdown(); + try + { + myClass->opVoid(); + test(false); + } + catch(const Ice::CloseConnectionException&) // TODO: Should not be thrown + { // if retry is implemented + cout << "ok" << endl; + } + catch(const Ice::ConnectFailedException&) + { + cout << "ok" << endl; + } + + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + communicator = Ice::initialize(argc, argv); + status = run(argc, argv, communicator); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/test/Ice/operations/Collocated.cpp b/cpp/test/Ice/operations/Collocated.cpp new file mode 100644 index 00000000000..4a34c33bdad --- /dev/null +++ b/cpp/test/Ice/operations/Collocated.cpp @@ -0,0 +1,62 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestI.h> + +using namespace std; + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + string endpts("tcp -p 12345 -t 2000"); + Ice::ObjectAdapterPtr adapter = communicator -> + createObjectAdapterWithEndpoints("testadapter", endpts); + Ice::ObjectPtr object = new MyDerivedClassI(adapter); + adapter->add(object, "test"); + + Test::MyClassPrx allTests(Ice::CommunicatorPtr); + allTests(communicator); + + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + communicator = Ice::initialize(argc, argv); + status = run(argc, argv, communicator); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/test/Ice/operations/Exceptions.cpp b/cpp/test/Ice/operations/Exceptions.cpp new file mode 100644 index 00000000000..7d480bf0dd1 --- /dev/null +++ b/cpp/test/Ice/operations/Exceptions.cpp @@ -0,0 +1,339 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestCommon.h> +#include <Test.h> + +using namespace std; + +void +exceptions(Test::MyClassPrx p) +{ + p->opEx(0); + + try + { + p->opEx(1); + test(false); + } + catch(Ice::Byte ex) + { + test(ex == 0x1f); + } + + try + { + p->opEx(2); + } + catch(bool ex) + { + test(ex == true); + } + + try + { + p->opEx(3); + } + catch(Ice::Short ex) + { + test(ex == 123); + } + + try + { + p->opEx(4); + } + catch(Ice::Int ex) + { + test(ex == 456); + } + + try + { + p->opEx(5); + } + catch(Ice::Long ex) + { + test(ex == 789); + } + + try + { + p->opEx(6); + } + catch(Ice::Float ex) + { + test(ex == Ice::Float(10.1112)); + } + + try + { + p->opEx(7); + } + catch(Ice::Double ex) + { + test(ex == Ice::Double(13.1415)); + } + + try + { + p->opEx(8); + } + catch(const string& ex) + { + test(ex == "abc"); + } + + try + { + p->opEx(9); + } + catch(const wstring& ex) + { + test(ex == L"def"); + } + + try + { + p->opEx(10); + } + catch(const Test::ByteV& ex) + { + test(ex.size() == 2); + test(ex[0] == Ice::Byte(0x0f)); + test(ex[1] == Ice::Byte(0xf0)); + } + + try + { + p->opEx(11); + } + catch(const Test::BoolV& ex) + { + test(ex.size() == 2); + test(ex[0] == true); + test(ex[1] == false); + } + + try + { + p->opEx(12); + } + catch(const Test::ShortV& ex) + { + test(ex.size() == 2); + test(ex[0] == 1); + test(ex[1] == 2); + } + + try + { + p->opEx(13); + } + catch(const Test::IntV& ex) + { + test(ex.size() == 2); + test(ex[0] == 3); + test(ex[1] == 4); + } + + try + { + p->opEx(14); + } + catch(const Test::LongV& ex) + { + test(ex.size() == 2); + test(ex[0] == 5); + test(ex[1] == 6); + } + + try + { + p->opEx(15); + } + catch(const Test::FloatV& ex) + { + test(ex.size() == 2); + test(ex[0] == Ice::Float(7.7)); + test(ex[1] == Ice::Float(8.8)); + } + + try + { + p->opEx(16); + } + catch(const Test::DoubleV& ex) + { + test(ex.size() == 2); + test(ex[0] == Ice::Double(9.9)); + test(ex[1] == Ice::Double(10.10)); + } + + try + { + p->opEx(17); + } + catch(const Test::StringV& ex) + { + test(ex.size() == 2); + test(ex[0] == "abc"); + test(ex[1] == "def"); + } + + try + { + p->opEx(18); + } + catch(const Test::WStringV& ex) + { + test(ex.size() == 2); + test(ex[0] == L"xxx"); + test(ex[1] == L"XXX"); + } + + try + { + p->opEx(19); + } + catch(const Test::ByteVV& ex) + { + test(ex.size() == 2); + test(ex[0].size() == 1); + test(ex[1].size() == 2); + test(ex[0][0] == Ice::Byte(0x01)); + test(ex[1][0] == Ice::Byte(0x10)); + test(ex[1][1] == Ice::Byte(0x11)); + } + + try + { + p->opEx(20); + } + catch(const Test::BoolVV& ex) + { + test(ex.size() == 2); + test(ex[0].size() == 1); + test(ex[1].size() == 2); + test(ex[0][0] == true); + test(ex[1][0] == false); + test(ex[1][1] == true); + } + + try + { + p->opEx(21); + } + catch(const Test::ShortVV& ex) + { + test(ex.size() == 2); + test(ex[0].size() == 1); + test(ex[1].size() == 2); + test(ex[0][0] == 1); + test(ex[1][0] == 2); + test(ex[1][1] == 3); + } + + try + { + p->opEx(22); + } + catch(const Test::IntVV& ex) + { + test(ex.size() == 2); + test(ex[0].size() == 1); + test(ex[1].size() == 2); + test(ex[0][0] == 4); + test(ex[1][0] == 5); + test(ex[1][1] == 6); + } + + try + { + p->opEx(23); + } + catch(const Test::LongVV& ex) + { + test(ex.size() == 2); + test(ex[0].size() == 1); + test(ex[1].size() == 2); + test(ex[0][0] == 7); + test(ex[1][0] == 8); + test(ex[1][1] == 9); + } + + try + { + p->opEx(24); + } + catch(const Test::FloatVV& ex) + { + test(ex.size() == 2); + test(ex[0].size() == 1); + test(ex[1].size() == 2); + test(ex[0][0] == Ice::Float(10.10)); + test(ex[1][0] == Ice::Float(11.11)); + test(ex[1][1] == Ice::Float(12.12)); + } + + try + { + p->opEx(25); + } + catch(const Test::DoubleVV& ex) + { + test(ex.size() == 2); + test(ex[0].size() == 1); + test(ex[1].size() == 2); + test(ex[0][0] == Ice::Double(13.13)); + test(ex[1][0] == Ice::Double(14.14)); + test(ex[1][1] == Ice::Double(15.15)); + } + + try + { + p->opEx(26); + } + catch(const Test::StringVV& ex) + { + test(ex.size() == 2); + test(ex[0].size() == 1); + test(ex[1].size() == 2); + test(ex[0][0] == "aaa"); + test(ex[1][0] == "bbb"); + test(ex[1][1] == "ccc"); + } + + try + { + p->opEx(27); + } + catch(const Test::WStringVV& ex) + { + test(ex.size() == 2); + test(ex[0].size() == 1); + test(ex[1].size() == 2); + test(ex[0][0] == L"aaa"); + test(ex[1][0] == L"bbb"); + test(ex[1][1] == L"ccc"); + } + + try + { + p->opEx(28); + } + catch(const Test::MyClassPrxE& ex) + { + test(ex == p); + ex->opVoid(); + } + +} diff --git a/cpp/test/Ice/operations/Makefile b/cpp/test/Ice/operations/Makefile new file mode 100644 index 00000000000..9684914f0bb --- /dev/null +++ b/cpp/test/Ice/operations/Makefile @@ -0,0 +1,63 @@ +# ********************************************************************** +# +# Copyright (c) 2001 +# MutableRealms, Inc. +# Huntsville, AL, USA +# +# All Rights Reserved +# +# ********************************************************************** + +top_srcdir = ../../.. + +CLIENT = client +SERVER = server +COLLOCATED = collocated + +TARGETS = $(CLIENT) $(SERVER) $(COLLOCATED) + +OBJS = Test.o \ + +COBJS = Client.o \ + AllTests.o \ + Twoways.o \ + Exceptions.o + +SOBJS = TestI.o \ + Server.o + +COLOBJS = TestI.o \ + Collocated.o \ + AllTests.o \ + Twoways.o \ + Exceptions.o + +SRCS = $(OBJS:.o=.cpp) \ + $(COBJS:.o=.cpp) \ + $(SOBJS:.o=.cpp) \ + $(COLOBJS:.o=.cpp) + +include $(top_srcdir)/config/Make.rules + +CPPFLAGS := -I. -I../../include $(CPPFLAGS) + +$(CLIENT): $(OBJS) $(COBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(COBJS) $(LIBS) + +$(SERVER): $(OBJS) $(SOBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(SOBJS) $(LIBS) + +$(COLLOCATED): $(OBJS) $(COLOBJS) + rm -f $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(COLOBJS) $(LIBS) + +Test.h Test.cpp: Test.ice $(SLICE) + rm -f Test.h Test.cpp + $(SLICE) Test.ice + +clean:: + rm -f Test.h Test.cpp + +include .depend diff --git a/cpp/test/Ice/operations/Server.cpp b/cpp/test/Ice/operations/Server.cpp new file mode 100644 index 00000000000..1d0c8526de3 --- /dev/null +++ b/cpp/test/Ice/operations/Server.cpp @@ -0,0 +1,85 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestI.h> + +using namespace std; + +void +usage(const char* n) +{ + cerr << "Usage: " << n << " [--pid]\n"; +} + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + bool pid = false; + for (int i = 1; i < argc; ++i) + { + if(strcmp(argv[i], "--pid") == 0) + { + pid = true; + } + else + { + cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + } + + string endpts("tcp -p 12345 -t 2000"); + Ice::ObjectAdapterPtr adapter = communicator -> createObjectAdapterWithEndpoints("testadapter", endpts); + Ice::ObjectPtr object = new MyDerivedClassI(adapter); + adapter->add(object, "test"); + adapter->activate(); + if (pid) + { + cout << getpid() << endl; + } + communicator->waitForShutdown(); + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + communicator = Ice::initialize(argc, argv); + status = run(argc, argv, communicator); + + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} diff --git a/cpp/test/Ice/operations/Test.ice b/cpp/test/Ice/operations/Test.ice new file mode 100644 index 00000000000..57a6aff81a7 --- /dev/null +++ b/cpp/test/Ice/operations/Test.ice @@ -0,0 +1,159 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef TEST_ICE +#define TEST_ICE + +module Test +{ + +enum MyEnum +{ + enum1, + enum2, + enum3 +}; + +class MyClass; + +vector<byte> ByteV; +vector<bool> BoolV; +vector<short> ShortV; +vector<int> IntV; +vector<long> LongV; +vector<float> FloatV; +vector<double> DoubleV; +vector<string> StringV; +vector<wstring> WStringV; +vector<MyEnum> MyEnumV; +vector<MyClass*> MyClassV; + +vector<ByteV> ByteVV; +vector<BoolV> BoolVV; +vector<ShortV> ShortVV; +vector<IntV> IntVV; +vector<LongV> LongVV; +vector<FloatV> FloatVV; +vector<DoubleV> DoubleVV; +vector<StringV> StringVV; +vector<WStringV> WStringVV; +vector<MyEnumV> MyEnumVV; +vector<MyClassV> MyClassVV; + +class MyClass +{ + void shutdown(); + + void opVoid(); + + byte opByte(byte p1, byte p2; + byte p3); + + bool opBool(bool p1, bool p2; + bool p3); + + long opShortIntLong(short p1, int p2, long p3; + short p4, int p5, long p6); + + double opFloatDouble(float p1, double p2; + float p3, double p4); + + string opString(string p1, string p2; + string p3); + + wstring opWString(wstring p1, wstring p2; + wstring p3); + + MyEnum opMyEnum(MyEnum p1; MyEnum p2); + + MyClass* opMyClass(MyClass* p1; MyClass* p2); + + ByteV opByteV(ByteV p1, ByteV p2; + ByteV p3); + + BoolV opBoolV(BoolV p1, BoolV p2; + BoolV p3); + + LongV opShortIntLongV(Test::ShortV p1, IntV p2, LongV p3; + ::Test::ShortV p4, IntV p5, LongV p6); + + DoubleV opFloatDoubleV(FloatV p1, DoubleV p2; + FloatV p3, DoubleV p4); + + StringV opStringV(StringV p1, StringV p2; + StringV p3); + + WStringV opWStringV(WStringV p1, WStringV p2; + WStringV p3); + + ByteVV opByteVV(ByteVV p1, ByteVV p2; + ByteVV p3); + + BoolVV opBoolVV(BoolVV p1, BoolVV p2; + BoolVV p3); + + LongVV opShortIntLongVV(ShortVV p1, IntVV p2, LongVV p3; + ShortVV p4, IntVV p5, LongVV p6); + + + DoubleVV opFloatDoubleVV(FloatVV p1, DoubleVV p2; + FloatVV p3, DoubleVV p4); + + StringVV opStringVV(StringVV p1, StringVV p2; + StringVV p3); + + WStringVV opWStringVV(WStringVV p1, WStringVV p2; + WStringVV p3); + + void opEx(int p) throws byte, bool, short, int, long, float, double, + string, wstring, ByteV, BoolV, ShortV, IntV, LongV, FloatV, DoubleV, + StringV, WStringV, ByteVV, BoolVV, ShortVV, IntVV, LongVV, FloatVV, + DoubleVV, StringVV, WStringVV, MyClass*; + +/* + bool bool_; + short short_; + int int_; + long long_; + float float_; + double double_; + string string_; + wstring wstring_; + + ByteV ByteV_; + BoolV BoolV_; + ShortV ShortV_; + IntV IntV_; + LongV LongV_; + FloatV FloatV_; + DoubleV DoubleV_; + StringV StringV_; + WStringV WStringV_; + + ByteVV ByteVV_; + BoolVV BoolVV_; + ShortVV ShortVV_; + IntVV IntVV_; + LongVV LongVV_; + FloatVV FloatVV_; + DoubleVV DoubleVV_; + StringVV StringVV_; + WStringVV WStringVV_; +*/ +}; + +class MyDerivedClass extends MyClass +{ + void opDerived(); +}; + +}; + +#endif diff --git a/cpp/test/Ice/operations/TestI.cpp b/cpp/test/Ice/operations/TestI.cpp new file mode 100644 index 00000000000..f2a55800a3f --- /dev/null +++ b/cpp/test/Ice/operations/TestI.cpp @@ -0,0 +1,524 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestI.h> + +MyDerivedClassI::MyDerivedClassI(const Ice::ObjectAdapterPtr& adapter) : + _adapter(adapter) +{ +} + +void +MyDerivedClassI::shutdown() +{ + _adapter->getCommunicator()->shutdown(); +} + +void +MyDerivedClassI::opVoid() +{ +} + +Ice::Byte +MyDerivedClassI::opByte(Ice::Byte p1, + Ice::Byte p2, + Ice::Byte& p3) +{ + p3 = p1 ^ p2; + return p1; +} + +bool +MyDerivedClassI::opBool(bool p1, + bool p2, + bool& p3) +{ + p3 = p1; + return p2; +} + +Ice::Long +MyDerivedClassI::opShortIntLong(Ice::Short p1, + Ice::Int p2, + Ice::Long p3, + Ice::Short& p4, + Ice::Int& p5, + Ice::Long& p6) +{ + p4 = p1; + p5 = p2; + p6 = p3; + return p3; +} + +Ice::Double +MyDerivedClassI::opFloatDouble(Ice::Float p1, + Ice::Double p2, + Ice::Float& p3, + Ice::Double& p4) +{ + p3 = p1; + p4 = p2; + return p2; +} + +std::string +MyDerivedClassI::opString(const std::string& p1, + const std::string& p2, + std::string& p3) +{ + p3 = p2 + " " + p1; + return p1 + " " + p2; +} + +std::wstring +MyDerivedClassI::opWString(const std::wstring& p1, + const std::wstring& p2, + std::wstring& p3) +{ + p3 = p2 + L" " + p1; + return p1 + L" " + p2; +} + +Test::MyEnum +MyDerivedClassI::opMyEnum(Test::MyEnum p1, + Test::MyEnum& p2) +{ + p2 = p1; + return Test::enum3; +} + +Test::MyClassPrx +MyDerivedClassI::opMyClass(const Test::MyClassPrx& p1, + Test::MyClassPrx& p2) +{ + p2 = p1; + return Test::MyClassPrx::uncheckedCast(_adapter->objectToProxy(this)); +} + +Test::ByteV +MyDerivedClassI::opByteV(const Test::ByteV& p1, + const Test::ByteV& p2, + Test::ByteV& p3) +{ + p3.resize(p1.size()); + std::reverse_copy(p1.begin(), p1.end(), p3.begin()); + Test::ByteV r = p1; + std::copy(p2.begin(), p2.end(), std::back_inserter(r)); + return r; +} + +Test::BoolV +MyDerivedClassI::opBoolV(const Test::BoolV& p1, + const Test::BoolV& p2, + Test::BoolV& p3) +{ + p3 = p1; + std::copy(p2.begin(), p2.end(), std::back_inserter(p3)); + Test::BoolV r; + r.resize(p1.size()); + std::reverse_copy(p1.begin(), p1.end(), r.begin()); + return r; +} + +Test::LongV +MyDerivedClassI::opShortIntLongV(const Test::ShortV& p1, + const Test::IntV& p2, + const Test::LongV& p3, + Test::ShortV& p4, + Test::IntV& p5, + Test::LongV& p6) +{ + p4 = p1; + p5.resize(p2.size()); + std::reverse_copy(p2.begin(), p2.end(), p5.begin()); + p6 = p3; + std::copy(p3.begin(), p3.end(), std::back_inserter(p6)); + return p3; +} + +Test::DoubleV +MyDerivedClassI::opFloatDoubleV(const Test::FloatV& p1, + const Test::DoubleV& p2, + Test::FloatV& p3, + Test::DoubleV& p4) +{ + p3 = p1; + p4.resize(p2.size()); + std::reverse_copy(p2.begin(), p2.end(), p4.begin()); + Test::DoubleV r = p2; + std::copy(p1.begin(), p1.end(), std::back_inserter(r)); + return r; +} + +Test::StringV +MyDerivedClassI::opStringV(const Test::StringV& p1, + const Test::StringV& p2, + Test::StringV& p3) +{ + p3 = p1; + std::copy(p2.begin(), p2.end(), std::back_inserter(p3)); + Test::StringV r; + r.resize(p1.size()); + std::reverse_copy(p1.begin(), p1.end(), r.begin()); + return r; +} + +Test::WStringV +MyDerivedClassI::opWStringV(const Test::WStringV& p1, + const Test::WStringV& p2, + Test::WStringV& p3) +{ + p3 = p1; + std::copy(p2.begin(), p2.end(), std::back_inserter(p3)); + Test::WStringV r; + r.resize(p1.size()); + std::reverse_copy(p1.begin(), p1.end(), r.begin()); + return r; +} + +Test::ByteVV +MyDerivedClassI::opByteVV(const Test::ByteVV& p1, + const Test::ByteVV& p2, + Test::ByteVV& p3) +{ + p3.resize(p1.size()); + std::reverse_copy(p1.begin(), p1.end(), p3.begin()); + Test::ByteVV r = p1; + std::copy(p2.begin(), p2.end(), std::back_inserter(r)); + return r; +} + +Test::BoolVV +MyDerivedClassI::opBoolVV(const Test::BoolVV& p1, + const Test::BoolVV& p2, + Test::BoolVV& p3) +{ + p3 = p1; + std::copy(p2.begin(), p2.end(), std::back_inserter(p3)); + Test::BoolVV r; + r.resize(p1.size()); + std::reverse_copy(p1.begin(), p1.end(), r.begin()); + return r; +} + +Test::LongVV +MyDerivedClassI::opShortIntLongVV(const Test::ShortVV& p1, + const Test::IntVV& p2, + const Test::LongVV& p3, + Test::ShortVV& p4, + Test::IntVV& p5, + Test::LongVV& p6) +{ + p4 = p1; + p5.resize(p2.size()); + std::reverse_copy(p2.begin(), p2.end(), p5.begin()); + p6 = p3; + std::copy(p3.begin(), p3.end(), std::back_inserter(p6)); + return p3; +} + +Test::DoubleVV +MyDerivedClassI::opFloatDoubleVV(const Test::FloatVV& p1, + const Test::DoubleVV& p2, + Test::FloatVV& p3, + Test::DoubleVV& p4) +{ + p3 = p1; + p4.resize(p2.size()); + std::reverse_copy(p2.begin(), p2.end(), p4.begin()); + Test::DoubleVV r = p2; + std::copy(p2.begin(), p2.end(), std::back_inserter(r)); + return r; +} + +Test::StringVV +MyDerivedClassI::opStringVV(const Test::StringVV& p1, + const Test::StringVV& p2, + Test::StringVV& p3) +{ + p3 = p1; + std::copy(p2.begin(), p2.end(), std::back_inserter(p3)); + Test::StringVV r; + r.resize(p2.size()); + std::reverse_copy(p2.begin(), p2.end(), r.begin()); + return r; +} + +Test::WStringVV +MyDerivedClassI::opWStringVV(const Test::WStringVV& p1, + const Test::WStringVV& p2, + Test::WStringVV& p3) +{ + p3 = p1; + std::copy(p2.begin(), p2.end(), std::back_inserter(p3)); + Test::WStringVV r; + r.resize(p2.size()); + std::reverse_copy(p2.begin(), p2.end(), r.begin()); + return r; +} + +void +MyDerivedClassI::opEx(Ice::Int p) +{ + switch (p) + { + case 0: + { + break; + } + + case 1: + { + throw Ice::Byte(0x1f); + } + + case 2: + { + throw bool(true); + } + + case 3: + { + throw Ice::Short(123); + } + + case 4: + { + throw Ice::Int(456); + } + + case 5: + { + throw Ice::Long(789); + } + + case 6: + { + throw Ice::Float(10.1112); + } + + case 7: + { + throw Ice::Double(13.1415); + } + + case 8: + { + throw std::string("abc"); + } + + case 9: + { + throw std::wstring(L"def"); + } + + case 10: + { + Test::ByteV ex; + ex.push_back(Ice::Byte(0x0f)); + ex.push_back(Ice::Byte(0xf0)); + throw ex; + } + + case 11: + { + Test::BoolV ex; + ex.push_back(true); + ex.push_back(false); + throw ex; + } + + case 12: + { + Test::ShortV ex; + ex.push_back(1); + ex.push_back(2); + throw ex; + } + + case 13: + { + Test::IntV ex; + ex.push_back(3); + ex.push_back(4); + throw ex; + } + + case 14: + { + Test::LongV ex; + ex.push_back(5); + ex.push_back(6); + throw ex; + } + + case 15: + { + Test::FloatV ex; + ex.push_back(Ice::Float(7.7)); + ex.push_back(Ice::Float(8.8)); + throw ex; + } + + case 16: + { + Test::DoubleV ex; + ex.push_back(Ice::Double(9.9)); + ex.push_back(Ice::Double(10.10)); + throw ex; + } + + case 17: + { + Test::StringV ex; + ex.push_back("abc"); + ex.push_back("def"); + throw ex; + } + + case 18: + { + Test::WStringV ex; + ex.push_back(L"xxx"); + ex.push_back(L"XXX"); + throw ex; + } + + case 19: + { + Test::ByteV v1; + Test::ByteV v2; + v1.push_back(Ice::Byte(0x01)); + v2.push_back(Ice::Byte(0x10)); + v2.push_back(Ice::Byte(0x11)); + Test::ByteVV ex; + ex.push_back(v1); + ex.push_back(v2); + throw ex; + } + + case 20: + { + Test::BoolV v1; + Test::BoolV v2; + v1.push_back(true); + v2.push_back(false); + v2.push_back(true); + Test::BoolVV ex; + ex.push_back(v1); + ex.push_back(v2); + throw ex; + } + + case 21: + { + Test::ShortV v1; + Test::ShortV v2; + v1.push_back(1); + v2.push_back(2); + v2.push_back(3); + Test::ShortVV ex; + ex.push_back(v1); + ex.push_back(v2); + throw ex; + } + + case 22: + { + Test::IntV v1; + Test::IntV v2; + v1.push_back(4); + v2.push_back(5); + v2.push_back(6); + Test::IntVV ex; + ex.push_back(v1); + ex.push_back(v2); + throw ex; + } + + case 23: + { + Test::LongV v1; + Test::LongV v2; + v1.push_back(7); + v2.push_back(8); + v2.push_back(9); + Test::LongVV ex; + ex.push_back(v1); + ex.push_back(v2); + throw ex; + } + + case 24: + { + Test::FloatV v1; + Test::FloatV v2; + v1.push_back(Ice::Float(10.10)); + v2.push_back(Ice::Float(11.11)); + v2.push_back(Ice::Float(12.12)); + Test::FloatVV ex; + ex.push_back(v1); + ex.push_back(v2); + throw ex; + } + + case 25: + { + Test::DoubleV v1; + Test::DoubleV v2; + v1.push_back(Ice::Double(13.13)); + v2.push_back(Ice::Double(14.14)); + v2.push_back(Ice::Double(15.15)); + Test::DoubleVV ex; + ex.push_back(v1); + ex.push_back(v2); + throw ex; + } + + case 26: + { + Test::StringV v1; + Test::StringV v2; + v1.push_back("aaa"); + v2.push_back("bbb"); + v2.push_back("ccc"); + Test::StringVV ex; + ex.push_back(v1); + ex.push_back(v2); + throw ex; + } + + case 27: + { + Test::WStringV v1; + Test::WStringV v2; + v1.push_back(L"aaa"); + v2.push_back(L"bbb"); + v2.push_back(L"ccc"); + Test::WStringVV ex; + ex.push_back(v1); + ex.push_back(v2); + throw ex; + } + + case 28: + { + Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast(_adapter->objectToProxy(this)); + p->_throw(); + } + } +} + +void +MyDerivedClassI::opDerived() +{ +}; diff --git a/cpp/test/Ice/operations/TestI.h b/cpp/test/Ice/operations/TestI.h new file mode 100644 index 00000000000..0ac00a69816 --- /dev/null +++ b/cpp/test/Ice/operations/TestI.h @@ -0,0 +1,125 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef TEST_I_H +#define TEST_I_H + +#include <Test.h> + +class MyDerivedClassI : public Test::MyDerivedClass +{ +public: + + MyDerivedClassI(const Ice::ObjectAdapterPtr&); + + virtual void shutdown(); + + virtual void opVoid(); + + virtual Ice::Byte opByte(Ice::Byte, + Ice::Byte, + Ice::Byte&); + + virtual bool opBool(bool, + bool, + bool&); + + virtual Ice::Long opShortIntLong(Ice::Short, + Ice::Int, + Ice::Long, + Ice::Short&, + Ice::Int&, + Ice::Long&); + + virtual Ice::Double opFloatDouble(Ice::Float, + Ice::Double, + Ice::Float&, + Ice::Double&); + + virtual std::string opString(const std::string&, + const std::string&, + std::string&); + + virtual std::wstring opWString(const std::wstring&, + const std::wstring&, + std::wstring&); + + virtual Test::MyEnum opMyEnum(Test::MyEnum, + Test::MyEnum&); + + virtual Test::MyClassPrx opMyClass(const Test::MyClassPrx&, + Test::MyClassPrx&); + + virtual Test::ByteV opByteV(const Test::ByteV&, + const Test::ByteV&, + Test::ByteV&); + + virtual Test::BoolV opBoolV(const Test::BoolV&, + const Test::BoolV&, + Test::BoolV&); + + virtual Test::LongV opShortIntLongV(const Test::ShortV&, + const Test::IntV&, + const Test::LongV&, + Test::ShortV&, + Test::IntV&, + Test::LongV&); + + virtual Test::DoubleV opFloatDoubleV(const Test::FloatV&, + const Test::DoubleV&, + Test::FloatV&, + Test::DoubleV&); + + virtual Test::StringV opStringV(const Test::StringV&, + const Test::StringV&, + Test::StringV&); + + virtual Test::WStringV opWStringV(const Test::WStringV&, + const Test::WStringV&, + Test::WStringV&); + + virtual Test::ByteVV opByteVV(const Test::ByteVV&, + const Test::ByteVV&, + Test::ByteVV&); + + virtual Test::BoolVV opBoolVV(const Test::BoolVV&, + const Test::BoolVV&, + Test::BoolVV&); + + virtual Test::LongVV opShortIntLongVV(const Test::ShortVV&, + const Test::IntVV&, + const Test::LongVV&, + Test::ShortVV&, + Test::IntVV&, + Test::LongVV&); + + virtual Test::DoubleVV opFloatDoubleVV(const Test::FloatVV&, + const Test::DoubleVV&, + Test::FloatVV&, + Test::DoubleVV&); + + virtual Test::StringVV opStringVV(const Test::StringVV&, + const Test::StringVV&, + Test::StringVV&); + + virtual Test::WStringVV opWStringVV(const Test::WStringVV&, + const Test::WStringVV&, + Test::WStringVV&); + + virtual void opEx(Ice::Int); + + virtual void opDerived(); + +private: + + Ice::ObjectAdapterPtr _adapter; +}; + +#endif diff --git a/cpp/test/Ice/operations/Twoways.cpp b/cpp/test/Ice/operations/Twoways.cpp new file mode 100644 index 00000000000..015199cb7ee --- /dev/null +++ b/cpp/test/Ice/operations/Twoways.cpp @@ -0,0 +1,475 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestCommon.h> +#include <Test.h> +#include <limits> + +// +// Stupid Visual C++ defines min and max as macros :-( +// +#ifdef min +# undef min +#endif +#ifdef max +# undef max +#endif + +using namespace std; + +void +twoways(Test::MyClassPrx p) +{ + { + p->opVoid(); + } + + { + 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)); + } + + { + bool b; + bool 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::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; + + r = p->opString("hello", "world", s); + test(s == "world hello"); + test(r == "hello world"); + } + + { + wstring s; + wstring r; + + r = p->opWString(L"hello", L"world", s); + test(s == L"world hello"); + test(r == L"hello world"); + } + + { + Test::MyEnum e; + Test::MyEnum r; + + r = p->opMyEnum(Test::enum2, e); + test(e == Test::enum2); + test(r == Test::enum3); + } + + { + Test::MyClassPrx c; + Test::MyClassPrx r; + + r = p->opMyClass(p, c); + test(c == p); + test(r == p); + c->opVoid(); + r->opVoid(); + + r = p->opMyClass(0, c); + test(c == 0); + test(r == p); + r->opVoid(); + } + + { + Test::ByteV bvi1; + Test::ByteV bvi2; + + bvi1.push_back(Ice::Byte(0x01)); + bvi1.push_back(Ice::Byte(0x11)); + bvi1.push_back(Ice::Byte(0x12)); + bvi1.push_back(Ice::Byte(0x22)); + + bvi2.push_back(Ice::Byte(0xf1)); + bvi2.push_back(Ice::Byte(0xf2)); + bvi2.push_back(Ice::Byte(0xf3)); + bvi2.push_back(Ice::Byte(0xf4)); + + Test::ByteV bvo; + Test::ByteV rvo; + + rvo = p->opByteV(bvi1, bvi2, bvo); + test(bvo.size() == 4); + test(bvo[0] == Ice::Byte(0x22)); + test(bvo[1] == Ice::Byte(0x12)); + test(bvo[2] == Ice::Byte(0x11)); + test(bvo[3] == Ice::Byte(0x01)); + test(rvo.size() == 8); + test(rvo[0] == Ice::Byte(0x01)); + test(rvo[1] == Ice::Byte(0x11)); + test(rvo[2] == Ice::Byte(0x12)); + test(rvo[3] == Ice::Byte(0x22)); + test(rvo[4] == Ice::Byte(0xf1)); + test(rvo[5] == Ice::Byte(0xf2)); + test(rvo[6] == Ice::Byte(0xf3)); + test(rvo[7] == Ice::Byte(0xf4)); + } + + { + Test::BoolV bvi1; + Test::BoolV bvi2; + + bvi1.push_back(true); + bvi1.push_back(true); + bvi1.push_back(false); + + bvi2.push_back(false); + + Test::BoolV bvo; + Test::BoolV rvo; + + rvo = p->opBoolV(bvi1, bvi2, bvo); + test(bvo.size() == 4); + test(bvo[0]); + test(bvo[1]); + test(!bvo[2]); + test(!bvo[3]); + test(rvo.size() == 3); + test(!rvo[0]); + test(rvo[1]); + test(rvo[2]); + } + + { + Test::ShortV svi; + Test::IntV ivi; + Test::LongV lvi; + + svi.push_back(1); + svi.push_back(2); + svi.push_back(3); + + ivi.push_back(5); + ivi.push_back(6); + ivi.push_back(7); + ivi.push_back(8); + + lvi.push_back(10); + lvi.push_back(30); + lvi.push_back(20); + + Test::ShortV svo; + Test::IntV ivo; + Test::LongV lvo; + Test::LongV rvo; + + rvo = p->opShortIntLongV(svi, ivi, lvi, svo, ivo, lvo); + test(svo.size() == 3); + test(svo[0] == 1); + test(svo[1] == 2); + test(svo[2] == 3); + test(ivo.size() == 4); + test(ivo[0] == 8); + test(ivo[1] == 7); + test(ivo[2] == 6); + test(ivo[3] == 5); + test(lvo.size() == 6); + test(lvo[0] == 10); + test(lvo[1] == 30); + test(lvo[2] == 20); + test(lvo[3] == 10); + test(lvo[4] == 30); + test(lvo[5] == 20); + test(rvo.size() == 3); + test(rvo[0] == 10); + test(rvo[1] == 30); + test(rvo[2] == 20); + } + + { + Test::FloatV fvi; + Test::DoubleV dvi; + + fvi.push_back(Ice::Float(3.14)); + fvi.push_back(Ice::Float(1.11)); + + dvi.push_back(Ice::Double(1.1E10)); + dvi.push_back(Ice::Double(1.2E10)); + dvi.push_back(Ice::Double(1.3E10)); + + Test::FloatV fvo; + Test::DoubleV dvo; + Test::DoubleV rvo; + + rvo = p->opFloatDoubleV(fvi, dvi, fvo, dvo); + test(fvo.size() == 2); + test(fvo[0] == ::Ice::Float(3.14)); + test(fvo[1] == ::Ice::Float(1.11)); + test(dvo.size() == 3); + test(dvo[0] == ::Ice::Double(1.3E10)); + test(dvo[1] == ::Ice::Double(1.2E10)); + test(dvo[2] == ::Ice::Double(1.1E10)); + test(rvo.size() == 5); + test(rvo[0] == ::Ice::Double(1.1E10)); + test(rvo[1] == ::Ice::Double(1.2E10)); + test(rvo[2] == ::Ice::Double(1.3E10)); + test(::Ice::Float(rvo[3]) == ::Ice::Float(3.14)); + test(::Ice::Float(rvo[4]) == ::Ice::Float(1.11)); + } + + { + Test::StringV svi1; + Test::StringV svi2; + + svi1.push_back("abc"); + svi1.push_back("de"); + svi1.push_back("fghi"); + + svi2.push_back("xyz"); + + Test::StringV svo; + Test::StringV rvo; + + rvo = p->opStringV(svi1, svi2, svo); + test(svo.size() == 4); + test(svo[0] == "abc"); + test(svo[1] == "de"); + test(svo[2] == "fghi"); + test(svo[3] == "xyz"); + test(rvo.size() == 3); + test(rvo[0] == "fghi"); + test(rvo[1] == "de"); + test(rvo[2] == "abc"); + } + + { + Test::WStringV svi1; + Test::WStringV svi2; + + svi1.push_back(L"abc"); + svi1.push_back(L"de"); + svi1.push_back(L"fghi"); + + svi2.push_back(L"xyz"); + + Test::WStringV svo; + Test::WStringV rvo; + + rvo = p->opWStringV(svi1, svi2, svo); + test(svo.size() == 4); + test(svo[0] == L"abc"); + test(svo[1] == L"de"); + test(svo[2] == L"fghi"); + test(svo[3] == L"xyz"); + test(rvo.size() == 3); + test(rvo[0] == L"fghi"); + test(rvo[1] == L"de"); + test(rvo[2] == L"abc"); + } + + { + Test::ByteVV bvi1; + bvi1.resize(2); + Test::ByteVV bvi2; + bvi2.resize(2); + + bvi1[0].push_back(Ice::Byte(0x01)); + bvi1[0].push_back(Ice::Byte(0x11)); + bvi1[0].push_back(Ice::Byte(0x12)); + bvi1[1].push_back(Ice::Byte(0xff)); + + bvi2[0].push_back(Ice::Byte(0x0e)); + bvi2[1].push_back(Ice::Byte(0xf2)); + bvi2[1].push_back(Ice::Byte(0xf1)); + + Test::ByteVV bvo; + Test::ByteVV rvo; + + rvo = p->opByteVV(bvi1, bvi2, bvo); + test(bvo.size() == 2); + test(bvo[0].size() == 1); + test(bvo[0][0] == Ice::Byte(0xff)); + test(bvo[1].size() == 3); + test(bvo[1][0] == Ice::Byte(0x01)); + test(bvo[1][1] == Ice::Byte(0x11)); + test(bvo[1][2] == Ice::Byte(0x12)); + test(rvo.size() == 4); + test(rvo[0].size() == 3); + test(rvo[0][0] == Ice::Byte(0x01)); + test(rvo[0][1] == Ice::Byte(0x11)); + test(rvo[0][2] == Ice::Byte(0x12)); + test(rvo[1].size() == 1); + test(rvo[1][0] == Ice::Byte(0xff)); + test(rvo[2].size() == 1); + test(rvo[2][0] == Ice::Byte(0x0e)); + test(rvo[3].size() == 2); + test(rvo[3][0] == Ice::Byte(0xf2)); + test(rvo[3][1] == Ice::Byte(0xf1)); + } + + { + Test::FloatVV fvi; + fvi.resize(3); + Test::DoubleVV dvi; + dvi.resize(1); + + fvi[0].push_back(Ice::Float(3.14)); + fvi[1].push_back(Ice::Float(1.11)); + + dvi[0].push_back(Ice::Double(1.1E10)); + dvi[0].push_back(Ice::Double(1.2E10)); + dvi[0].push_back(Ice::Double(1.3E10)); + + Test::FloatVV fvo; + Test::DoubleVV dvo; + Test::DoubleVV rvo; + + rvo = p->opFloatDoubleVV(fvi, dvi, fvo, dvo); + test(fvo.size() == 3); + test(fvo[0].size() == 1); + test(fvo[0][0] == ::Ice::Float(3.14)); + test(fvo[1].size() == 1); + test(fvo[1][0] == ::Ice::Float(1.11)); + test(fvo[2].size() == 0); + test(dvo.size() == 1); + test(dvo[0].size() == 3); + test(dvo[0][0] == ::Ice::Double(1.1E10)); + test(dvo[0][1] == ::Ice::Double(1.2E10)); + test(dvo[0][2] == ::Ice::Double(1.3E10)); + test(rvo.size() == 2); + test(rvo[0].size() == 3); + test(rvo[0][0] == ::Ice::Double(1.1E10)); + test(rvo[0][1] == ::Ice::Double(1.2E10)); + test(rvo[0][2] == ::Ice::Double(1.3E10)); + test(rvo[1].size() == 3); + test(rvo[1][0] == ::Ice::Double(1.1E10)); + test(rvo[1][1] == ::Ice::Double(1.2E10)); + test(rvo[1][2] == ::Ice::Double(1.3E10)); + } + + { + Test::StringVV svi1; + svi1.resize(2); + Test::StringVV svi2; + svi2.resize(3); + + svi1[0].push_back("abc"); + svi1[1].push_back("de"); + svi1[1].push_back("fghi"); + + svi2[2].push_back("xyz"); + + Test::StringVV svo; + Test::StringVV rvo; + + rvo = p->opStringVV(svi1, svi2, svo); + test(svo.size() == 5); + test(svo[0].size() == 1); + test(svo[0][0] == "abc"); + test(svo[1].size() == 2); + test(svo[1][0] == "de"); + test(svo[1][1] == "fghi"); + test(svo[2].size() == 0); + test(svo[3].size() == 0); + test(svo[4].size() == 1); + test(svo[4][0] == "xyz"); + test(rvo.size() == 3); + test(rvo[0].size() == 1); + test(rvo[0][0] == "xyz"); + test(rvo[1].size() == 0); + test(rvo[2].size() == 0); + } + + { + Test::WStringVV svi1; + svi1.resize(2); + Test::WStringVV svi2; + svi2.resize(3); + + svi1[0].push_back(L"abc"); + svi1[1].push_back(L"de"); + svi1[1].push_back(L"fghi"); + + svi2[2].push_back(L"xyz"); + + Test::WStringVV svo; + Test::WStringVV rvo; + + rvo = p->opWStringVV(svi1, svi2, svo); + test(svo.size() == 5); + test(svo[0].size() == 1); + test(svo[0][0] == L"abc"); + test(svo[1].size() == 2); + test(svo[1][0] == L"de"); + test(svo[1][1] == L"fghi"); + test(svo[2].size() == 0); + test(svo[3].size() == 0); + test(svo[4].size() == 1); + test(svo[4][0] == L"xyz"); + test(rvo.size() == 3); + test(rvo[0].size() == 1); + test(rvo[0][0] == L"xyz"); + test(rvo[1].size() == 0); + test(rvo[2].size() == 0); + } +} diff --git a/cpp/test/Ice/operations/operationsC.dsp b/cpp/test/Ice/operations/operationsC.dsp new file mode 100644 index 00000000000..950e55b56bd --- /dev/null +++ b/cpp/test/Ice/operations/operationsC.dsp @@ -0,0 +1,165 @@ +# Microsoft Developer Studio Project File - Name="operationsC" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=operationsC - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "operationsC.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "operationsC.mak" CFG="operationsC - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "operationsC - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "operationsC - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "operationsC - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 jtc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"client.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "operationsC - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 jtcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"client.exe" /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "operationsC - Win32 Release"
+# Name "operationsC - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\AllTests.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Exceptions.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Test.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Twoways.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Test.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Test.ice
+
+!IF "$(CFG)" == "operationsC - Win32 Release"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "operationsC - Win32 Debug"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/test/Ice/operations/operationsCOL.dsp b/cpp/test/Ice/operations/operationsCOL.dsp new file mode 100644 index 00000000000..1d550a5f985 --- /dev/null +++ b/cpp/test/Ice/operations/operationsCOL.dsp @@ -0,0 +1,173 @@ +# Microsoft Developer Studio Project File - Name="operationsCOL" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=operationsCOL - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "operationsCOL.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "operationsCOL.mak" CFG="operationsCOL - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "operationsCOL - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "operationsCOL - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "operationsCOL - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 jtc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"collocated.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "operationsCOL - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 jtcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"collocated.exe" /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "operationsCOL - Win32 Release"
+# Name "operationsCOL - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\AllTests.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Collocated.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Exceptions.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Test.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestI.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Twoways.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Test.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestI.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Test.ice
+
+!IF "$(CFG)" == "operationsCOL - Win32 Release"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "operationsCOL - Win32 Debug"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/test/Ice/operations/operationsS.dsp b/cpp/test/Ice/operations/operationsS.dsp new file mode 100644 index 00000000000..e85693296ca --- /dev/null +++ b/cpp/test/Ice/operations/operationsS.dsp @@ -0,0 +1,161 @@ +# Microsoft Developer Studio Project File - Name="operationsS" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=operationsS - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "operationsS.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "operationsS.mak" CFG="operationsS - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "operationsS - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "operationsS - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "operationsS - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 jtc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"server.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "operationsS - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "." /I "../../../include" /I "../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 jtcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"server.exe" /pdbtype:sept /libpath:"../../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "operationsS - Win32 Release"
+# Name "operationsS - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Server.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Test.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestI.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Test.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestI.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Test.ice
+
+!IF "$(CFG)" == "operationsS - Win32 Release"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "operationsS - Win32 Debug"
+
+USERDEP__TEST_="../../../bin/slice2cpp.exe"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\..\lib \
+ ..\..\..\bin\slice2cpp.exe Test.ice \
+
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/test/Ice/operations/run.py b/cpp/test/Ice/operations/run.py new file mode 100755 index 00000000000..166c21d0430 --- /dev/null +++ b/cpp/test/Ice/operations/run.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2001 +# MutableRealms, Inc. +# Huntsville, AL, USA +# +# All Rights Reserved +# +# ********************************************************************** + +import os, sys + +for toplevel in ["", "..", os.path.join("..", ".."), os.path.join("..", "..", "..")]: + 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("Ice", "operations") +TestUtil.clientServerTest(toplevel, name) +TestUtil.collocatedTest(toplevel, name) +sys.exit(1) diff --git a/cpp/test/Makefile b/cpp/test/Makefile index cfc3f03c0bb..0027b52197d 100644 --- a/cpp/test/Makefile +++ b/cpp/test/Makefile @@ -12,11 +12,7 @@ top_srcdir = .. include $(top_srcdir)/config/Make.rules -SUBDIRS = operations \ - inheritance \ - exceptions \ - faultTolerance \ - locationForward +SUBDIRS = Ice $(EVERYTHING):: @for subdir in $(SUBDIRS); \ diff --git a/cpp/test/Slice/errorDetection/ClassRedefinition.err b/cpp/test/Slice/errorDetection/ClassRedefinition.err new file mode 100644 index 00000000000..870a9ac4ea1 --- /dev/null +++ b/cpp/test/Slice/errorDetection/ClassRedefinition.err @@ -0,0 +1,2 @@ +ClassRedefinition.ice:12 error: redefinition of class `Class1' +ClassRedefinition.ice:16 error: redefinition of class `Class2' diff --git a/cpp/test/Slice/errorDetection/ClassRedefinition.ice b/cpp/test/Slice/errorDetection/ClassRedefinition.ice new file mode 100644 index 00000000000..8367e558a2c --- /dev/null +++ b/cpp/test/Slice/errorDetection/ClassRedefinition.ice @@ -0,0 +1,17 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +class Class1 { }; +class Class1 { }; +class Class1; + +local class Class2 { }; +local class Class2 { }; +local class Class2; diff --git a/cpp/test/Slice/errorDetection/DataMemberRedefinition.err b/cpp/test/Slice/errorDetection/DataMemberRedefinition.err new file mode 100644 index 00000000000..d838fc64725 --- /dev/null +++ b/cpp/test/Slice/errorDetection/DataMemberRedefinition.err @@ -0,0 +1 @@ +DataMemberRedefinition.ice:14 error: redefinition of data member `member' diff --git a/cpp/test/Slice/errorDetection/DataMemberRedefinition.ice b/cpp/test/Slice/errorDetection/DataMemberRedefinition.ice new file mode 100644 index 00000000000..df7e400ade9 --- /dev/null +++ b/cpp/test/Slice/errorDetection/DataMemberRedefinition.ice @@ -0,0 +1,15 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +class Class +{ + int member; + int member; +}; diff --git a/cpp/test/Slice/errorDetection/EnumRedefinition.err b/cpp/test/Slice/errorDetection/EnumRedefinition.err new file mode 100644 index 00000000000..53f84ad9bf2 --- /dev/null +++ b/cpp/test/Slice/errorDetection/EnumRedefinition.err @@ -0,0 +1 @@ +EnumRedefinition.ice:12 error: redefinition of enum `Enum' diff --git a/cpp/test/Slice/errorDetection/EnumRedefinition.ice b/cpp/test/Slice/errorDetection/EnumRedefinition.ice new file mode 100644 index 00000000000..362556e87a2 --- /dev/null +++ b/cpp/test/Slice/errorDetection/EnumRedefinition.ice @@ -0,0 +1,12 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +enum Enum { A, B, C }; +enum Enum { D, E, F }; diff --git a/cpp/test/Slice/errorDetection/EnumeratorRedefinition.err b/cpp/test/Slice/errorDetection/EnumeratorRedefinition.err new file mode 100644 index 00000000000..0c4994e19cd --- /dev/null +++ b/cpp/test/Slice/errorDetection/EnumeratorRedefinition.err @@ -0,0 +1,2 @@ +EnumeratorRedefinition.ice:12 error: redefinition of enumerator `B' +EnumeratorRedefinition.ice:12 error: redefinition of enumerator `A' diff --git a/cpp/test/Slice/errorDetection/EnumeratorRedefinition.ice b/cpp/test/Slice/errorDetection/EnumeratorRedefinition.ice new file mode 100644 index 00000000000..daed9fbf86e --- /dev/null +++ b/cpp/test/Slice/errorDetection/EnumeratorRedefinition.ice @@ -0,0 +1,12 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +enum Enum1 { A, B, C }; +enum Enum2 { A, B, E }; diff --git a/cpp/test/Slice/errorDetection/InterfaceMismatch.err b/cpp/test/Slice/errorDetection/InterfaceMismatch.err new file mode 100644 index 00000000000..1d0c1c784bc --- /dev/null +++ b/cpp/test/Slice/errorDetection/InterfaceMismatch.err @@ -0,0 +1,6 @@ +InterfaceMismatch.ice:12 error: class `Foo1' was declared as interface +InterfaceMismatch.ice:13 error: class `Foo1' was declared as interface +InterfaceMismatch.ice:16 error: class `Foo2' was defined as interface +InterfaceMismatch.ice:19 error: interface `Foo3' was declared as class +InterfaceMismatch.ice:20 error: interface `Foo3' was declared as class +InterfaceMismatch.ice:23 error: interface `Foo4' was defined as class diff --git a/cpp/test/Slice/errorDetection/InterfaceMismatch.ice b/cpp/test/Slice/errorDetection/InterfaceMismatch.ice new file mode 100644 index 00000000000..1cf75cdbbb2 --- /dev/null +++ b/cpp/test/Slice/errorDetection/InterfaceMismatch.ice @@ -0,0 +1,23 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +interface Foo1; +class Foo1; +class Foo1 { }; + +interface Foo2 { }; +class Foo2; + +class Foo3; +interface Foo3; +interface Foo3 { }; + +class Foo4 { }; +interface Foo4; diff --git a/cpp/test/Slice/errorDetection/InterfaceRedefinition.err b/cpp/test/Slice/errorDetection/InterfaceRedefinition.err new file mode 100644 index 00000000000..9a1f2ed03ae --- /dev/null +++ b/cpp/test/Slice/errorDetection/InterfaceRedefinition.err @@ -0,0 +1,2 @@ +InterfaceRedefinition.ice:12 error: redefinition of interface `Intf1' +InterfaceRedefinition.ice:16 error: redefinition of interface `Intf2' diff --git a/cpp/test/Slice/errorDetection/InterfaceRedefinition.ice b/cpp/test/Slice/errorDetection/InterfaceRedefinition.ice new file mode 100644 index 00000000000..c5f23d3660f --- /dev/null +++ b/cpp/test/Slice/errorDetection/InterfaceRedefinition.ice @@ -0,0 +1,17 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +interface Intf1 { }; +interface Intf1 { }; +interface Intf1; + +local interface Intf2 { }; +local interface Intf2 { }; +local interface Intf2; diff --git a/cpp/test/Slice/errorDetection/LocalMistmatch.err b/cpp/test/Slice/errorDetection/LocalMistmatch.err new file mode 100644 index 00000000000..7b9567b508a --- /dev/null +++ b/cpp/test/Slice/errorDetection/LocalMistmatch.err @@ -0,0 +1,12 @@ +LocalMistmatch.ice:12 error: local `Intf1' was declared non-local +LocalMistmatch.ice:13 error: local `Intf1' was declared non-local +LocalMistmatch.ice:16 error: local `Intf2' was defined non-local +LocalMistmatch.ice:19 error: non-local `Intf3' was declared local +LocalMistmatch.ice:20 error: non-local `Intf3' was declared local +LocalMistmatch.ice:23 error: non-local `Intf4' was defined local +LocalMistmatch.ice:26 error: local `Class1' was declared non-local +LocalMistmatch.ice:27 error: local `Class1' was declared non-local +LocalMistmatch.ice:30 error: local `Class2' was defined non-local +LocalMistmatch.ice:33 error: non-local `Class3' was declared local +LocalMistmatch.ice:34 error: non-local `Class3' was declared local +LocalMistmatch.ice:37 error: non-local `Class4' was defined local diff --git a/cpp/test/Slice/errorDetection/LocalMistmatch.ice b/cpp/test/Slice/errorDetection/LocalMistmatch.ice new file mode 100644 index 00000000000..c005d18fb69 --- /dev/null +++ b/cpp/test/Slice/errorDetection/LocalMistmatch.ice @@ -0,0 +1,37 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +interface Intf1; +local interface Intf1; +local interface Intf1 { }; + +interface Intf2 { }; +local interface Intf2; + +local interface Intf3; +interface Intf3; +interface Intf3 { }; + +local interface Intf4 { }; +interface Intf4; + +interface Class1; +local interface Class1; +local interface Class1 { }; + +interface Class2 { }; +local interface Class2; + +local interface Class3; +interface Class3; +interface Class3 { }; + +local interface Class4 { }; +interface Class4; diff --git a/cpp/test/Slice/errorDetection/NativeRedefinition.err b/cpp/test/Slice/errorDetection/NativeRedefinition.err new file mode 100644 index 00000000000..9ed1e3c4a1d --- /dev/null +++ b/cpp/test/Slice/errorDetection/NativeRedefinition.err @@ -0,0 +1 @@ +NativeRedefinition.ice:12 error: redefinition of native `Native' diff --git a/cpp/test/Slice/errorDetection/NativeRedefinition.ice b/cpp/test/Slice/errorDetection/NativeRedefinition.ice new file mode 100644 index 00000000000..cb5f2fab335 --- /dev/null +++ b/cpp/test/Slice/errorDetection/NativeRedefinition.ice @@ -0,0 +1,12 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +native Native; +native Native; diff --git a/cpp/test/Slice/errorDetection/NotClassOrInterface.err b/cpp/test/Slice/errorDetection/NotClassOrInterface.err new file mode 100644 index 00000000000..d48d8f62b9e --- /dev/null +++ b/cpp/test/Slice/errorDetection/NotClassOrInterface.err @@ -0,0 +1,9 @@ +NotClassOrInterface.ice:15 error: `Vector' is not an interface +NotClassOrInterface.ice:16 error: `Vector' is not a class +NotClassOrInterface.ice:17 error: `Vector3' is not an interface +NotClassOrInterface.ice:17 error: `Vector2' is not an interface +NotClassOrInterface.ice:17 error: `Vector1' is not an interface +NotClassOrInterface.ice:18 error: `Vector' is not a class +NotClassOrInterface.ice:18 error: `Vector3' is not an interface +NotClassOrInterface.ice:18 error: `Vector2' is not an interface +NotClassOrInterface.ice:18 error: `Vector1' is not an interface diff --git a/cpp/test/Slice/errorDetection/NotClassOrInterface.ice b/cpp/test/Slice/errorDetection/NotClassOrInterface.ice new file mode 100644 index 00000000000..61830eaf074 --- /dev/null +++ b/cpp/test/Slice/errorDetection/NotClassOrInterface.ice @@ -0,0 +1,18 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +vector<int> Vector; +vector<int> Vector1; +vector<int> Vector2; +vector<int> Vector3; +interface BarIntf extends Vector { }; +class BarClass1 extends Vector { }; +class BarClass2 implements Vector1, Vector2, Vector3 { }; +class BarClass3 extends Vector implements Vector1, Vector2, Vector3 { }; diff --git a/cpp/test/Slice/errorDetection/NotType.err b/cpp/test/Slice/errorDetection/NotType.err new file mode 100644 index 00000000000..04b37362c28 --- /dev/null +++ b/cpp/test/Slice/errorDetection/NotType.err @@ -0,0 +1,10 @@ +NotType.ice:17 error: `Module' is not a type +NotType.ice:18 error: `Module' is not a type +NotType.ice:19 error: `Module' is not a type +NotType.ice:20 error: `Module3' is not a type +NotType.ice:20 error: `Module2' is not a type +NotType.ice:20 error: `Module1' is not a type +NotType.ice:21 error: `Module' is not a type +NotType.ice:21 error: `Module3' is not a type +NotType.ice:21 error: `Module2' is not a type +NotType.ice:21 error: `Module1' is not a type diff --git a/cpp/test/Slice/errorDetection/NotType.ice b/cpp/test/Slice/errorDetection/NotType.ice new file mode 100644 index 00000000000..2ad86aa608e --- /dev/null +++ b/cpp/test/Slice/errorDetection/NotType.ice @@ -0,0 +1,23 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +module Module1 { }; +module Module2 { }; +module Module3 { }; +module Module +{ + +vector<Module> Vector; +interface BarIntf extends Module { }; +class BarClass1 extends Module { }; +class BarClass2 implements Module1, Module2, Module3 { }; +class BarClass3 extends Module implements Module1, Module2, Module3 { }; + +}; diff --git a/cpp/test/Slice/errorDetection/OperationRedefinition.err b/cpp/test/Slice/errorDetection/OperationRedefinition.err new file mode 100644 index 00000000000..ef0b255726f --- /dev/null +++ b/cpp/test/Slice/errorDetection/OperationRedefinition.err @@ -0,0 +1 @@ +OperationRedefinition.ice:14 error: redefinition of operation `operation' diff --git a/cpp/test/Slice/errorDetection/OperationRedefinition.ice b/cpp/test/Slice/errorDetection/OperationRedefinition.ice new file mode 100644 index 00000000000..07d4cca3a83 --- /dev/null +++ b/cpp/test/Slice/errorDetection/OperationRedefinition.ice @@ -0,0 +1,15 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +class Class +{ + void operation(); + void operation(); +}; diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsClass.err b/cpp/test/Slice/errorDetection/RedefinitionAsClass.err new file mode 100644 index 00000000000..c99fb95e30d --- /dev/null +++ b/cpp/test/Slice/errorDetection/RedefinitionAsClass.err @@ -0,0 +1,2 @@ +RedefinitionAsClass.ice:12 error: declaration of already defined `Vector1' as class +RedefinitionAsClass.ice:15 error: redefinition of `Vector2' as class diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsClass.ice b/cpp/test/Slice/errorDetection/RedefinitionAsClass.ice new file mode 100644 index 00000000000..5835e1ae3a9 --- /dev/null +++ b/cpp/test/Slice/errorDetection/RedefinitionAsClass.ice @@ -0,0 +1,15 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +vector<int> Vector1; +class Vector1; + +vector<int> Vector2; +class Vector2 { }; diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsDataMember.err b/cpp/test/Slice/errorDetection/RedefinitionAsDataMember.err new file mode 100644 index 00000000000..fe1a425c543 --- /dev/null +++ b/cpp/test/Slice/errorDetection/RedefinitionAsDataMember.err @@ -0,0 +1 @@ +RedefinitionAsDataMember.ice:14 error: redefinition of `operation' as data member diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsDataMember.ice b/cpp/test/Slice/errorDetection/RedefinitionAsDataMember.ice new file mode 100644 index 00000000000..db7ae798417 --- /dev/null +++ b/cpp/test/Slice/errorDetection/RedefinitionAsDataMember.ice @@ -0,0 +1,15 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +class Class +{ + void operation(); + int operation; +}; diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsEnum.err b/cpp/test/Slice/errorDetection/RedefinitionAsEnum.err new file mode 100644 index 00000000000..4abeb75e4d8 --- /dev/null +++ b/cpp/test/Slice/errorDetection/RedefinitionAsEnum.err @@ -0,0 +1 @@ +RedefinitionAsEnum.ice:12 error: redefinition of `Class' as enum diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsEnum.ice b/cpp/test/Slice/errorDetection/RedefinitionAsEnum.ice new file mode 100644 index 00000000000..9029f93e434 --- /dev/null +++ b/cpp/test/Slice/errorDetection/RedefinitionAsEnum.ice @@ -0,0 +1,12 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +class Class { }; +enum Class { A, B, C }; diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsEnumerator.err b/cpp/test/Slice/errorDetection/RedefinitionAsEnumerator.err new file mode 100644 index 00000000000..9445f69c0d2 --- /dev/null +++ b/cpp/test/Slice/errorDetection/RedefinitionAsEnumerator.err @@ -0,0 +1,2 @@ +RedefinitionAsEnumerator.ice:13 error: redefinition of `Vector' as enumerator +RedefinitionAsEnumerator.ice:13 error: redefinition of `Class' as enumerator diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsEnumerator.ice b/cpp/test/Slice/errorDetection/RedefinitionAsEnumerator.ice new file mode 100644 index 00000000000..97f3ff85dbe --- /dev/null +++ b/cpp/test/Slice/errorDetection/RedefinitionAsEnumerator.ice @@ -0,0 +1,13 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +class Class { }; +vector<int> Vector; +enum Enum { Class, Vector }; diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsInterface.err b/cpp/test/Slice/errorDetection/RedefinitionAsInterface.err new file mode 100644 index 00000000000..7bdb8dfecb0 --- /dev/null +++ b/cpp/test/Slice/errorDetection/RedefinitionAsInterface.err @@ -0,0 +1,2 @@ +RedefinitionAsInterface.ice:12 error: declaration of already defined `Vector1' as interface +RedefinitionAsInterface.ice:15 error: redefinition of `Vector2' as interface diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsInterface.ice b/cpp/test/Slice/errorDetection/RedefinitionAsInterface.ice new file mode 100644 index 00000000000..b8041e946c1 --- /dev/null +++ b/cpp/test/Slice/errorDetection/RedefinitionAsInterface.ice @@ -0,0 +1,15 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +vector<int> Vector1; +interface Vector1; + +vector<int> Vector2; +interface Vector2 { }; diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsModule.err b/cpp/test/Slice/errorDetection/RedefinitionAsModule.err new file mode 100644 index 00000000000..fb9665455ea --- /dev/null +++ b/cpp/test/Slice/errorDetection/RedefinitionAsModule.err @@ -0,0 +1 @@ +RedefinitionAsModule.ice:12 error: redefinition of `Vector' as module diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsModule.ice b/cpp/test/Slice/errorDetection/RedefinitionAsModule.ice new file mode 100644 index 00000000000..9d9db1c412f --- /dev/null +++ b/cpp/test/Slice/errorDetection/RedefinitionAsModule.ice @@ -0,0 +1,14 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +vector<int> Vector; +module Vector { }; +module Module { }; +module Module { }; diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsNative.err b/cpp/test/Slice/errorDetection/RedefinitionAsNative.err new file mode 100644 index 00000000000..34de406fee9 --- /dev/null +++ b/cpp/test/Slice/errorDetection/RedefinitionAsNative.err @@ -0,0 +1 @@ +RedefinitionAsNative.ice:12 error: redefinition of `Class' as native diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsNative.ice b/cpp/test/Slice/errorDetection/RedefinitionAsNative.ice new file mode 100644 index 00000000000..058ee8856b4 --- /dev/null +++ b/cpp/test/Slice/errorDetection/RedefinitionAsNative.ice @@ -0,0 +1,12 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +class Class { }; +native Class; diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsOperation.err b/cpp/test/Slice/errorDetection/RedefinitionAsOperation.err new file mode 100644 index 00000000000..f91636e2eb6 --- /dev/null +++ b/cpp/test/Slice/errorDetection/RedefinitionAsOperation.err @@ -0,0 +1 @@ +RedefinitionAsOperation.ice:14 error: redefinition of `member' as operation diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsOperation.ice b/cpp/test/Slice/errorDetection/RedefinitionAsOperation.ice new file mode 100644 index 00000000000..43602b32ca6 --- /dev/null +++ b/cpp/test/Slice/errorDetection/RedefinitionAsOperation.ice @@ -0,0 +1,15 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +class Class +{ + int member; + void member(); +}; diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsVector.err b/cpp/test/Slice/errorDetection/RedefinitionAsVector.err new file mode 100644 index 00000000000..72250a5a452 --- /dev/null +++ b/cpp/test/Slice/errorDetection/RedefinitionAsVector.err @@ -0,0 +1 @@ +RedefinitionAsVector.ice:12 error: redefinition of `Class' as vector diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsVector.ice b/cpp/test/Slice/errorDetection/RedefinitionAsVector.ice new file mode 100644 index 00000000000..c42deee5afb --- /dev/null +++ b/cpp/test/Slice/errorDetection/RedefinitionAsVector.ice @@ -0,0 +1,12 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +class Class { }; +vector<int> Class; diff --git a/cpp/test/Slice/errorDetection/Undefined.err b/cpp/test/Slice/errorDetection/Undefined.err new file mode 100644 index 00000000000..55a50680da6 --- /dev/null +++ b/cpp/test/Slice/errorDetection/Undefined.err @@ -0,0 +1,10 @@ +Undefined.ice:11 error: `Foo' is not defined +Undefined.ice:12 error: `Foo' is not defined +Undefined.ice:13 error: `Foo' is not defined +Undefined.ice:14 error: `Foo3' is not defined +Undefined.ice:14 error: `Foo2' is not defined +Undefined.ice:14 error: `Foo1' is not defined +Undefined.ice:15 error: `Foo' is not defined +Undefined.ice:15 error: `Foo3' is not defined +Undefined.ice:15 error: `Foo2' is not defined +Undefined.ice:15 error: `Foo1' is not defined diff --git a/cpp/test/Slice/errorDetection/Undefined.ice b/cpp/test/Slice/errorDetection/Undefined.ice new file mode 100644 index 00000000000..5af1b47b834 --- /dev/null +++ b/cpp/test/Slice/errorDetection/Undefined.ice @@ -0,0 +1,15 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +vector<Foo> FooVector; +interface BarIntf extends Foo { }; +class BarClass1 extends Foo { }; +class BarClass2 implements Foo1, Foo2, Foo3 { }; +class BarClass3 extends Foo implements Foo1, Foo2, Foo3 { }; diff --git a/cpp/test/Slice/errorDetection/VectorRedefinition.err b/cpp/test/Slice/errorDetection/VectorRedefinition.err new file mode 100644 index 00000000000..33675a9f621 --- /dev/null +++ b/cpp/test/Slice/errorDetection/VectorRedefinition.err @@ -0,0 +1 @@ +VectorRedefinition.ice:12 error: redefinition of vector `Vector' diff --git a/cpp/test/Slice/errorDetection/VectorRedefinition.ice b/cpp/test/Slice/errorDetection/VectorRedefinition.ice new file mode 100644 index 00000000000..2248c565df3 --- /dev/null +++ b/cpp/test/Slice/errorDetection/VectorRedefinition.ice @@ -0,0 +1,12 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +vector<int> Vector; +vector<int> Vector; diff --git a/cpp/test/Slice/errorDetection/WrongProxyType.err b/cpp/test/Slice/errorDetection/WrongProxyType.err new file mode 100644 index 00000000000..835b4a08b17 --- /dev/null +++ b/cpp/test/Slice/errorDetection/WrongProxyType.err @@ -0,0 +1,3 @@ +WrongProxyType.ice:15 error: `Vector' must be class or interface +WrongProxyType.ice:16 error: `Vector' must be class or interface +WrongProxyType.ice:17 error: `Vector' must be class or interface diff --git a/cpp/test/Slice/errorDetection/WrongProxyType.ice b/cpp/test/Slice/errorDetection/WrongProxyType.ice new file mode 100644 index 00000000000..0d8c2eff8cd --- /dev/null +++ b/cpp/test/Slice/errorDetection/WrongProxyType.ice @@ -0,0 +1,18 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +vector<int> Vector; + +interface I +{ + Vector* f1(); + void f2(Vector*); + void f3(;Vector*); +}; diff --git a/cpp/test/Slice/errorDetection/run.py b/cpp/test/Slice/errorDetection/run.py new file mode 100755 index 00000000000..ac04ed0e0dd --- /dev/null +++ b/cpp/test/Slice/errorDetection/run.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2001 +# MutableRealms, Inc. +# Huntsville, AL, USA +# +# All Rights Reserved +# +# ********************************************************************** + +import os, sys, re + +for toplevel in ["", "..", os.path.join("..", ".."), os.path.join("..", "..", "..")]: + if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): + break +else: + raise "can't find toplevel directory!" + +directory = os.path.join(toplevel, "test", "Slice", "parser") +slice2cpp = os.path.join(toplevel, "bin", "slice2cpp") + +regex1 = re.compile(r".ice$", re.IGNORECASE) +files = [] +for file in os.listdir(directory): + if(regex1.search(file)): + files.append(file) + +for file in files: + + print file + "...", + + stdin, stdout, stderr = os.popen3(slice2cpp + " " + os.path.join(directory, file)) + lines1 = stderr.readlines() + lines2 = open(os.path.join(directory, regex1.sub(".err", file)), "r").readlines() + + if len(lines1) != len(lines2): + print "failed!" + continue + + regex2 = re.compile(r"^.*(?=" + file + ")") + diffs = "" + i = 0 + while i < len(lines1) and i < len(lines2): + line1 = regex2.sub("", lines1[i]) + line2 = regex2.sub("", lines2[i]) + if line1 != line2: + print "failed!" + break + i += 1 + else: + print "ok" |