diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-06-20 23:01:03 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-06-20 23:01:03 +0000 |
commit | 6df3a02a256bea8178610ed2998052a84277f388 (patch) | |
tree | 5205c9729aaa818853a40961310aced602265e04 /TAO/tests | |
parent | d6ff2bb940a8dd46fa118f68a058353772fe0897 (diff) | |
download | ATCD-6df3a02a256bea8178610ed2998052a84277f388.tar.gz |
ChangeLogTag: Thu Jun 20 17:57:23 2002 Irfan Pyarali <irfan@cs.wustl.edu>
Diffstat (limited to 'TAO/tests')
-rw-r--r-- | TAO/tests/POA/Makefile | 1 | ||||
-rw-r--r-- | TAO/tests/POA/Makefile.bor | 1 | ||||
-rw-r--r-- | TAO/tests/POA/Persistent_ID/Makefile | 59 | ||||
-rw-r--r-- | TAO/tests/POA/Persistent_ID/Makefile.bor | 7 | ||||
-rw-r--r-- | TAO/tests/POA/Persistent_ID/Persistent_ID.dsw | 41 | ||||
-rw-r--r-- | TAO/tests/POA/Persistent_ID/README | 21 | ||||
-rw-r--r-- | TAO/tests/POA/Persistent_ID/client.bor | 37 | ||||
-rw-r--r-- | TAO/tests/POA/Persistent_ID/client.cpp | 127 | ||||
-rw-r--r-- | TAO/tests/POA/Persistent_ID/client.dsp | 198 | ||||
-rwxr-xr-x | TAO/tests/POA/Persistent_ID/run_test.pl | 42 | ||||
-rw-r--r-- | TAO/tests/POA/Persistent_ID/server.bor | 38 | ||||
-rw-r--r-- | TAO/tests/POA/Persistent_ID/server.cpp | 282 | ||||
-rw-r--r-- | TAO/tests/POA/Persistent_ID/server.dsp | 206 | ||||
-rw-r--r-- | TAO/tests/POA/Persistent_ID/test.idl | 9 | ||||
-rw-r--r-- | TAO/tests/POA/README | 6 | ||||
-rw-r--r-- | TAO/tests/TAO_Tests.dsw | 24 |
16 files changed, 1099 insertions, 0 deletions
diff --git a/TAO/tests/POA/Makefile b/TAO/tests/POA/Makefile index a47d609bbb4..a49be3fb60c 100644 --- a/TAO/tests/POA/Makefile +++ b/TAO/tests/POA/Makefile @@ -17,6 +17,7 @@ DIRS = POA_Destruction \ Object_Reactivation \ Non_Servant_Upcalls \ Single_Threaded_POA \ + Persistent_ID \ Identity # The following test hasn't been updated yet diff --git a/TAO/tests/POA/Makefile.bor b/TAO/tests/POA/Makefile.bor index 5553bcc8ba9..df5dcda370d 100644 --- a/TAO/tests/POA/Makefile.bor +++ b/TAO/tests/POA/Makefile.bor @@ -10,6 +10,7 @@ DIRS = \ Identity \ Non_Servant_Upcalls \ Single_Threaded_POA \ + Persistent_ID \ wait_for_completion !include <$(ACE_ROOT)\include\makeinclude\recurse.bor> diff --git a/TAO/tests/POA/Persistent_ID/Makefile b/TAO/tests/POA/Persistent_ID/Makefile new file mode 100644 index 00000000000..2247cf9d28b --- /dev/null +++ b/TAO/tests/POA/Persistent_ID/Makefile @@ -0,0 +1,59 @@ +#---------------------------------------------------------------------------- +# +# $Id$ +# +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Local macros +#---------------------------------------------------------------------------- + +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif # ! TAO_ROOT + +LDLIBS = -lTAO + +IDL_FILES = test +IDL_SRC = testC.cpp testS.cpp +PROG_SRCS = $(IDL_SRC) server.cpp client.cpp + +LSRC = $(PROG_SRCS) + +SVR_OBJS = testC.o testS.o server.o +CLT_OBJS = testC.o client.o + +BIN_UNCHECKED = server client + +TAO_IDLFLAGS += -Ge 1 +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- + +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(TAO_ROOT)/rules.tao.GNU + +ifeq ($(minimum_corba),0) + BIN = $(BIN_UNCHECKED) +endif # minimum_corba + +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU +#include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU +include $(TAO_ROOT)/taoconfig.mk + +.PRECIOUS: testC.h testC.i testC.cpp testS.h testS.i testS.cpp + +server: $(addprefix $(VDIR),$(SVR_OBJS)) + $(LINK.cc) $(LDFLAGS) -o $@ $^ $(TAO_SRVR_LIBS) $(POSTLINK) + +client: $(addprefix $(VDIR),$(CLT_OBJS)) + $(LINK.cc) $(LDFLAGS) -o $@ $^ $(TAO_SRVR_LIBS) $(POSTLINK) + +realclean: clean + -$(RM) testC.* testS.* testS_T.* + +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. diff --git a/TAO/tests/POA/Persistent_ID/Makefile.bor b/TAO/tests/POA/Persistent_ID/Makefile.bor new file mode 100644 index 00000000000..b00d8d0de3b --- /dev/null +++ b/TAO/tests/POA/Persistent_ID/Makefile.bor @@ -0,0 +1,7 @@ +# +# Makefile for building the POA Forwarding examples +# + +MAKEFILES = server.bor client.bor + +!include <$(ACE_ROOT)\include\makeinclude\recurse.bor> diff --git a/TAO/tests/POA/Persistent_ID/Persistent_ID.dsw b/TAO/tests/POA/Persistent_ID/Persistent_ID.dsw new file mode 100644 index 00000000000..d17cf7c9604 --- /dev/null +++ b/TAO/tests/POA/Persistent_ID/Persistent_ID.dsw @@ -0,0 +1,41 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "client"=.\client.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "server"=.\server.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/TAO/tests/POA/Persistent_ID/README b/TAO/tests/POA/Persistent_ID/README new file mode 100644 index 00000000000..976de6c96e0 --- /dev/null +++ b/TAO/tests/POA/Persistent_ID/README @@ -0,0 +1,21 @@ +$Id$ + +This test checks the combination of PERSISTENT & SYSTEM_ID POA +policies. + +A servant is registered on the RootPOA. The client tells the server to +create a POA with PERSISTENT & SYSTEM_ID policies. The server does so +and returns a object created and registered in the child POA using a +system generated id. Before returning the object, the server saves the +system generated id. The client make a call on this new object to make +sure that the new object is valid. + +After this the client instructs the server to destroy the child POA. + +Then the client instructs the server to recreate the child POA. The +server does so and returns a object created and registered in the +child POA, but this time uses the previous generated id instead of +using a newly generated one. Before returning the object, the server +saves the system generated id. The client make a call on this new +object and on the previous object to make sure that the objects are +valid. diff --git a/TAO/tests/POA/Persistent_ID/client.bor b/TAO/tests/POA/Persistent_ID/client.bor new file mode 100644 index 00000000000..54fce49c0cd --- /dev/null +++ b/TAO/tests/POA/Persistent_ID/client.bor @@ -0,0 +1,37 @@ +# +# Makefile for building the POA Forwarding executable +# + +NAME = client + +TAO_IDL = $(CORE_BINDIR)\tao_idl -g $(CORE_BINDIR)\gperf.exe -Ge 1 + +OBJFILES = \ + $(OBJDIR)\testC.obj \ + $(OBJDIR)\client.obj + +CFLAGS = \ + $(ACE_CFLAGS) \ + $(TAO_CFLAGS) \ + $(TAO_PORTABLESERVER_CFLAGS) + +LIBFILES = \ + $(ACE_LIB) \ + $(TAO_LIB) \ + $(TAO_PORTABLESERVER_LIB) + +IDLFILES = \ + $(IDLDIR)\test.idl + +CPPDIR = . + +IDLDIR = . + +!include <$(ACE_ROOT)\include\makeinclude\build_exe.bor> + +# +# IDL Build rules +# + +$(IDLDIR)\testS.cpp $(IDLDIR)\testC.cpp: $(IDLDIR)\test.idl + $(TAO_IDL) $** diff --git a/TAO/tests/POA/Persistent_ID/client.cpp b/TAO/tests/POA/Persistent_ID/client.cpp new file mode 100644 index 00000000000..ff3f7c35255 --- /dev/null +++ b/TAO/tests/POA/Persistent_ID/client.cpp @@ -0,0 +1,127 @@ +// $Id$ + +// ================================================================ +// +// +// = FILENAME +// client.cpp +// +// = DESCRIPTION +// This is a client implementation. +// +// = AUTHOR +// Irfan Pyarali +// +// ================================================================ + +#include "ace/Get_Opt.h" +#include "testC.h" + +ACE_RCSID(Generic_Servant, client, "$Id$") + +static char *IOR = "file://ior"; +static int shutdown_server = 0; + +static int +parse_args (int argc, char **argv) +{ + ACE_Get_Opt get_opts (argc, argv, "k:x"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + IOR = ACE_OS::strdup (get_opts.opt_arg ()); + break; + + case 'x': + shutdown_server = 1; + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k IOR " + "-x shutdown server " + "\n", + argv [0]), + -1); + } + + if (IOR == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Please specify the IOR\n"), -1); + + return 0; +} + +int +main (int argc, char **argv) +{ + ACE_DECLARE_NEW_CORBA_ENV; + + ACE_TRY + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, + argv, + 0 + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + int parse_args_result = + parse_args (argc, argv); + if (parse_args_result != 0) + return parse_args_result; + + CORBA::Object_var object = + orb->string_to_object (IOR + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + test_var test1 = + test::_narrow (object.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + test1->method (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + test_var test2 = + test1->create_POA (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + test2->method (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + test1->destroy_POA (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + test_var test3 = + test1->create_POA (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + test2->method (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + test3->method (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (shutdown_server) + { + test1->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Error!"); + return -1; + } + ACE_ENDTRY; + ACE_CHECK_RETURN (-1); + + return 0; +} diff --git a/TAO/tests/POA/Persistent_ID/client.dsp b/TAO/tests/POA/Persistent_ID/client.dsp new file mode 100644 index 00000000000..ed87be92ca4 --- /dev/null +++ b/TAO/tests/POA/Persistent_ID/client.dsp @@ -0,0 +1,198 @@ +# Microsoft Developer Studio Project File - Name="POA Persistent ID Client" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=POA Persistent ID Client - 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 "client.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 "client.mak" CFG="POA Persistent ID Client - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "POA Persistent ID Client - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "POA Persistent ID Client - 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)" == "POA Persistent ID Client - 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 /GX /O2 /I "..\..\.." /I "..\..\..\.." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# 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 /nologo /subsystem:console /machine:I386
+# ADD LINK32 tao.lib ace.lib TAO_PortableServer.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "POA Persistent ID Client - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "client__"
+# PROP BASE Intermediate_Dir "client__"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# 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 /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\.." /I "..\..\..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D TAO_HAS_DLL=1 /FD /c
+# SUBTRACT CPP /YX
+# 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 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 TAOd.lib aced.lib TAO_PortableServerd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace"
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "POA Persistent ID Client - Win32 Release"
+# Name "POA Persistent ID Client - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\testC.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\testC.h
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\test.idl
+
+!IF "$(CFG)" == "POA Persistent ID Client - Win32 Release"
+
+USERDEP__TEST_I="..\..\..\..\bin\Release\tao_idl.exe"
+# Begin Custom Build - Invoking TAO_IDL Compiler on $(InputPath)
+InputPath=.\test.idl
+InputName=test
+
+BuildCmds= \
+ ..\..\..\..\bin\release\tao_idl -Ge 1 $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "POA Persistent ID Client - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+USERDEP__TEST_I="..\..\..\..\bin\tao_idl.exe"
+# Begin Custom Build - Invoking TAO_IDL Compiler on $(InputPath)
+InputPath=.\test.idl
+InputName=test
+
+BuildCmds= \
+ ..\..\..\..\bin\tao_idl -Ge 1 $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/tests/POA/Persistent_ID/run_test.pl b/TAO/tests/POA/Persistent_ID/run_test.pl new file mode 100755 index 00000000000..112bcce4e14 --- /dev/null +++ b/TAO/tests/POA/Persistent_ID/run_test.pl @@ -0,0 +1,42 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib '../../../../bin'; +use PerlACE::Run_Test; + +$status = 0; +$iorfile = "ior"; + +unlink $iorfile; + +$SV = new PerlACE::Process ("server"); +$CL = new PerlACE::Process ("client", "-x"); + +$SV->Spawn (); + +if (PerlACE::waitforfile_timed ($iorfile, 10) == -1) { + print STDERR "ERROR: cannot find file <$iorfile>\n"; + $SV->Kill (); + exit 1; +} + +$client = $CL->SpawnWaitKill (60); +$server = $SV->WaitKill (5); + +unlink $iorfile; + +if ($client != 0) { + print STDERR "ERROR: client returned $client\n"; + $status = 1; +} + +if ($server != 0) { + print STDERR "ERROR: server returned $server\n"; + $status = 1; +} + +exit $status; diff --git a/TAO/tests/POA/Persistent_ID/server.bor b/TAO/tests/POA/Persistent_ID/server.bor new file mode 100644 index 00000000000..101041f44cc --- /dev/null +++ b/TAO/tests/POA/Persistent_ID/server.bor @@ -0,0 +1,38 @@ +# +# Makefile for building the POA Forwarding executable +# + +NAME = server + +TAO_IDL = $(CORE_BINDIR)\tao_idl -g $(CORE_BINDIR)\gperf.exe -Ge 1 + +OBJFILES = \ + $(OBJDIR)\testC.obj \ + $(OBJDIR)\testS.obj \ + $(OBJDIR)\server.obj + +CFLAGS = \ + $(ACE_CFLAGS) \ + $(TAO_CFLAGS) \ + $(TAO_PORTABLESERVER_CFLAGS) + +LIBFILES = \ + $(ACE_LIB) \ + $(TAO_LIB) \ + $(TAO_PORTABLESERVER_LIB) + +IDLFILES = \ + $(IDLDIR)\test.idl + +CPPDIR = . + +IDLDIR = . + +!include <$(ACE_ROOT)\include\makeinclude\build_exe.bor> + +# +# IDL Build rules +# + +$(IDLDIR)\testS.cpp $(IDLDIR)\testC.cpp: $(IDLDIR)\test.idl + $(TAO_IDL) $** diff --git a/TAO/tests/POA/Persistent_ID/server.cpp b/TAO/tests/POA/Persistent_ID/server.cpp new file mode 100644 index 00000000000..78df5dd12c4 --- /dev/null +++ b/TAO/tests/POA/Persistent_ID/server.cpp @@ -0,0 +1,282 @@ +// $Id$ + +// ================================================================ +// +// = LIBRARY +// TAO/tests/POA/Persistent_ID +// +// = FILENAME +// server.cpp +// +// = DESCRIPTION +// In this example of using Persistent IDs. +// +// = AUTHOR +// Irfan Pyarali +// +// ================================================================ + +#include "ace/Get_Opt.h" +#include "testS.h" + +ACE_RCSID(Explicit_Activation, server, "$Id: ") + +class test_i : public virtual PortableServer::RefCountServantBase, + public virtual POA_test +{ +public: + test_i (CORBA::ORB_ptr orb_ptr, + PortableServer::POA_ptr poa); + + void method (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void shutdown (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + test_ptr create_POA (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void destroy_POA (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + PortableServer::POA_ptr _default_POA (ACE_ENV_SINGLE_ARG_DECL); + +protected: + CORBA::ORB_var orb_; + PortableServer::POA_var poa_; + PortableServer::POA_var child_poa_; + PortableServer::ObjectId_var oid_; +}; + +test_i::test_i (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa) + : orb_ (CORBA::ORB::_duplicate (orb)), + poa_ (PortableServer::POA::_duplicate (poa)) +{ +} + +void +test_i::method (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + CORBA::Object_var obj = + this->orb_->resolve_initial_references ("POACurrent"); + + PortableServer::Current_var current = + PortableServer::Current::_narrow (obj.in ()); + + PortableServer::POA_var poa = + current->get_POA (); + + CORBA::String_var poa_name = + poa->the_name (); + + ACE_DEBUG ((LM_DEBUG, + "Method invoked on servant in POA = %s\n", + poa_name.in ())); +} + +void +test_i::shutdown (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->orb_->shutdown (0 + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +PortableServer::POA_ptr +test_i::_default_POA (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +{ + return PortableServer::POA::_duplicate (this->poa_.in ()); +} + +test_ptr +test_i::create_POA (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + CORBA::PolicyList policies (2); + policies.length (2); + + policies[0] = + this->poa_->create_id_assignment_policy (PortableServer::SYSTEM_ID + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + policies[1] = + this->poa_->create_lifespan_policy (PortableServer::PERSISTENT + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + PortableServer::POAManager_var poa_manager = + this->poa_->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (test::_nil ()); + + ACE_CString name = "POA"; + this->child_poa_ = + this->poa_->create_POA (name.c_str (), + poa_manager.in (), + policies + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (test::_nil ()); + + test_i *servant = + new test_i (this->orb_.in (), + this->child_poa_.in ()); + + PortableServer::ServantBase_var safe_servant (servant); + + if (this->oid_.ptr () == 0) + { + this->oid_ = + this->child_poa_->activate_object (servant + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (test::_nil ()); + } + else + { + this->child_poa_->activate_object_with_id (this->oid_, + servant + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (test::_nil ()); + } + + test_var test = + servant->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (test::_nil ()); + + return test._retn (); +} + +void +test_i::destroy_POA (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->child_poa_->destroy (1, 0 + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; +} + +const char *ior_output_file = "ior"; + +static int +parse_args (int argc, char **argv) +{ + ACE_Get_Opt get_opts (argc, argv, "f:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'f': + ior_output_file = get_opts.opt_arg (); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-f ior_file" + "\n", + argv [0]), + -1); + } + + return 0; +} + +static int +write_ior_to_file (const char *ior, + const char *ior_file) +{ + FILE *output_file = + ACE_OS::fopen (ior_output_file, "w"); + + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, "Cannot open output files for writing IOR: %s\n", + ior_output_file), + -1); + + u_int result = 0; + + result = ACE_OS::fprintf (output_file, + "%s", + ior); + if (result != ACE_OS::strlen (ior)) + ACE_ERROR_RETURN ((LM_ERROR, + "ACE_OS::fprintf failed while writing %s to %s\n", + ior, + ior_output_file), + -1); + + ACE_OS::fclose (output_file); + + return 0; +} + +int +main (int argc, char **argv) +{ + ACE_DECLARE_NEW_CORBA_ENV; + + ACE_TRY + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, + argv, + 0 + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + int result = parse_args (argc, argv); + if (result != 0) + return result; + + CORBA::Object_var obj = + orb->resolve_initial_references ("RootPOA" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + test_i servant (orb.in (), + root_poa.in ()); + + test_var test = + servant._this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::String_var ior = + orb->object_to_string (test.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + int write_result = + write_ior_to_file (ior.in (), + ior_output_file); + if (write_result != 0) + return write_result; + + poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception caught"); + return -1; + } + ACE_ENDTRY; + ACE_CHECK_RETURN (-1); + + return 0; +} diff --git a/TAO/tests/POA/Persistent_ID/server.dsp b/TAO/tests/POA/Persistent_ID/server.dsp new file mode 100644 index 00000000000..d24f638028f --- /dev/null +++ b/TAO/tests/POA/Persistent_ID/server.dsp @@ -0,0 +1,206 @@ +# Microsoft Developer Studio Project File - Name="POA Persistent ID Server" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=POA Persistent ID Server - 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 "server.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 "server.mak" CFG="POA Persistent ID Server - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "POA Persistent ID Server - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "POA Persistent ID Server - 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)" == "POA Persistent ID Server - 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 /GX /O2 /I "..\..\.." /I "..\..\..\.." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# 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 /nologo /subsystem:console /machine:I386
+# ADD LINK32 tao.lib ace.lib TAO_PortableServer.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "POA Persistent ID Server - 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 ""
+# 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 /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\.." /I "..\..\..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D TAO_HAS_DLL=1 /FD /c
+# SUBTRACT CPP /YX
+# 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 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 TAOd.lib aced.lib TAO_PortableServerd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace"
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "POA Persistent ID Server - Win32 Release"
+# Name "POA Persistent ID Server - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\testC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\testS.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\server.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\testC.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\testS.h
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\test.idl
+
+!IF "$(CFG)" == "POA Persistent ID Server - Win32 Release"
+
+USERDEP__TEST_I="..\..\..\..\bin\Release\tao_idl.exe"
+# Begin Custom Build - Invoking TAO_IDL Compiler on $(InputPath)
+InputPath=.\test.idl
+InputName=test
+
+BuildCmds= \
+ ..\..\..\..\bin\release\tao_idl -Ge 1 $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "POA Persistent ID Server - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+USERDEP__TEST_I="..\..\..\..\bin\tao_idl.exe"
+# Begin Custom Build - Invoking TAO_IDL Compiler on $(InputPath)
+InputPath=.\test.idl
+InputName=test
+
+BuildCmds= \
+ ..\..\..\..\bin\tao_idl -Ge 1 $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/tests/POA/Persistent_ID/test.idl b/TAO/tests/POA/Persistent_ID/test.idl new file mode 100644 index 00000000000..5651d1d18f6 --- /dev/null +++ b/TAO/tests/POA/Persistent_ID/test.idl @@ -0,0 +1,9 @@ +// $Id$ + +interface test +{ + void method (); + test create_POA (); + void destroy_POA (); + void shutdown (); +}; diff --git a/TAO/tests/POA/README b/TAO/tests/POA/README index cab4477770f..6be28883212 100644 --- a/TAO/tests/POA/README +++ b/TAO/tests/POA/README @@ -53,3 +53,9 @@ Object Adapter (POA) interfaces and their usage scenarios. This program tests for deactivation and etherealization of reference counted and non reference counted servants. + + . Persistent_ID + + This test checks the combination of PERSISTENT & + SYSTEM_ID POA policies. + diff --git a/TAO/tests/TAO_Tests.dsw b/TAO/tests/TAO_Tests.dsw index 7c546fdddf1..753876c63b4 100644 --- a/TAO/tests/TAO_Tests.dsw +++ b/TAO/tests/TAO_Tests.dsw @@ -1383,6 +1383,30 @@ Package=<4> ###############################################################################
+Project: "POA Persistent_ID Client"=".\POA\Persistent_ID\client.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "POA Persistent_ID Server"=".\POA\Persistent_ID\server.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
Project: "POA Single_Threaded_POA"=".\POA\Single_Threaded_POA\Single_Threaded_POA.dsp" - Package Owner=<4>
Package=<5>
|