diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-07-22 21:34:42 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-07-22 21:34:42 +0000 |
commit | c154d8297c94f74b69a0bc332084a13ac516cdc5 (patch) | |
tree | 4692975fb95ffee4ccd56022ce4fd128d6363438 | |
parent | 27935247203dd2b75559c6e39e4ce756ecba1aaf (diff) | |
download | ATCD-c154d8297c94f74b69a0bc332084a13ac516cdc5.tar.gz |
ChangeLogTag: Sat Jul 22 16:30:39 2000 Jeff Parsons <parsons@cs.wustl.edu>
13 files changed, 730 insertions, 21 deletions
diff --git a/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/Admin_Client.cpp b/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/Admin_Client.cpp index bb1de963436..b2c0653a633 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/Admin_Client.cpp +++ b/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/Admin_Client.cpp @@ -988,7 +988,7 @@ Admin_Client::struct_test (CORBA::Environment &ACE_TRY_ENV) members[1].name = CORBA::string_dup ("array_mem"); members[1].type_def = this->repo_->create_array (5, - members[0].type_def, + members[0].type_def.in (), ACE_TRY_ENV); ACE_CHECK; members[1].type = members[1].type_def->type (ACE_TRY_ENV); @@ -1567,7 +1567,7 @@ Admin_Client::exception_test (CORBA::Environment &ACE_TRY_ENV) members[1].name = CORBA::string_dup ("array_mem"); IR::ArrayDef_ptr a_ptr = this->repo_->create_array (5, - members[0].type_def, + members[0].type_def.in (), ACE_TRY_ENV); ACE_CHECK; members[1].type_def = a_ptr; @@ -1766,7 +1766,7 @@ Admin_Client::exception_test (CORBA::Environment &ACE_TRY_ENV) if (kind == IR::dk_Exception) { cont_desc[i].value >>= ed; - CORBA::TypeCode_ptr tc = ed->type; + CORBA::TypeCode_ptr tc = ed->type.in (); length = tc->member_count (ACE_TRY_ENV); ACE_CHECK; @@ -1792,7 +1792,7 @@ Admin_Client::exception_test (CORBA::Environment &ACE_TRY_ENV) else { cont_desc[i].value >>= td; - CORBA::TypeCode_ptr tc = td->type; + CORBA::TypeCode_ptr tc = td->type.in (); length = tc->member_count (ACE_TRY_ENV); ACE_CHECK; diff --git a/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/IFR_Test.dsp b/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/IFR_Test.dsp index 28b8e5eb9cd..358e2a3af7c 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/IFR_Test.dsp +++ b/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/IFR_Test.dsp @@ -37,11 +37,12 @@ RSC=rc.exe # PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir ""
-# PROP Intermediate_Dir ""
+# 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 "..\..\..\..\\" /I "..\..\..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\..\\" /I "..\..\..\..\..\\" /I "..\..\..\..\..\..\\" /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
@@ -49,7 +50,7 @@ BSC32=bscmake.exe # 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 ace.lib TAO.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\..\tao" /libpath:"..\..\..\..\..\ace"
+# ADD LINK32 ace.lib TAO.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\..\..\tao" /libpath:"..\..\..\..\..\..\ace"
!ELSEIF "$(CFG)" == "IFR_Test - Win32 Debug"
@@ -61,7 +62,7 @@ LINK32=link.exe # PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ""
-# PROP Intermediate_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
diff --git a/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/README b/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/README index b12c98a5000..3be98348733 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/README +++ b/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/README @@ -28,13 +28,6 @@ MSVC users) the line #define TAO_HAS_INTERFACE_REPOSITORY 1 uncommented in TAO/tao/orbconf.h. In addition, the Interface Repository requires the TAO_Svc_Utils library in TAO/orbsvcs/orbsvcs. -At present the test client gets a reference for the Interface -Repository by reading the IOR from a file used for this purpose -by the IFR service. Future additions to this test will include -an option to get the object reference via multicast, DII requests -constructed from IFR information on an existing object, and testing -of a persistent Interface Repository. - To run this test, either use the Perl script run_test.pl, or @@ -42,9 +35,9 @@ To run this test, either use the Perl script run_test.pl, or (Windows) start the Interface Repository by typing - IFR_Service + ..\..\..\IFR_Service\IFR_Service -in the IFR's home directory (TAO/orbsvcs/IFR_Service), then (in this directory) +in one window, then (in another window) IFR_Test @@ -118,7 +111,7 @@ should be stopped and restarted to avoid a BAD_PARAM exception. The IFR server is started in this test with locking enabled. Even though the test itself is single-threaded, using this option will -ensure that future modifications to IFR code dont' cause deadlocks. +ensure that future modifications to IFR code don't cause deadlocks. More information about the Interface Repository can be found in TAO/docs/releasenotes.index.html. diff --git a/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/run_test.pl b/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/run_test.pl index cdd2d727dd6..bf81ece0806 100755 --- a/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/run_test.pl +++ b/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/run_test.pl @@ -13,9 +13,11 @@ use Cwd; $cwd = getcwd(); ACE::checkForTarget($cwd); +$locking = "-m"; + $if_repo_server = $EXEPREFIX."..".$DIR_SEPARATOR."..".$DIR_SEPARATOR. "..".$DIR_SEPARATOR."IFR_Service".$DIR_SEPARATOR. - "IFR_Service".$EXE_EXT, " -m"; + "IFR_Service".$EXE_EXT, " $locking"; $init_ref = diff --git a/TAO/orbsvcs/tests/InterfaceRepo/InterfaceRepo.dsw b/TAO/orbsvcs/tests/InterfaceRepo/InterfaceRepo.dsw index 728ccd716f0..e92efbfdaa8 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/InterfaceRepo.dsw +++ b/TAO/orbsvcs/tests/InterfaceRepo/InterfaceRepo.dsw @@ -15,6 +15,18 @@ Package=<4> ###############################################################################
+Project: "Persistence_Test"=.\Persistence_Test\Persistence_Test.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
Global:
Package=<5>
diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Makefile b/TAO/orbsvcs/tests/InterfaceRepo/Makefile index d780b4ebb39..5b623202291 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/Makefile +++ b/TAO/orbsvcs/tests/InterfaceRepo/Makefile @@ -8,7 +8,8 @@ # Local macros #---------------------------------------------------------------------------- -DIRS = IFR_Test +DIRS = IFR_Test \ + Persistence_Test ifndef TAO_ROOT TAO_ROOT = $(ACE_ROOT)/TAO diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/Makefile b/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/Makefile new file mode 100644 index 00000000000..06697431b71 --- /dev/null +++ b/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/Makefile @@ -0,0 +1,59 @@ +#---------------------------------------------------------------------------- +# +# $Id$ +# +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Local macros +#---------------------------------------------------------------------------- + +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif # ! TAO_ROOT + +LDLIBS = -lTAO + +PROG_SRCS = test.cpp Ptest.cpp + +SRC = $(PROG_SRCS) + +PERSISTENCE_TEST_OBJS = test.o Ptest.o + +BIN_UNCHECKED = Persistence_Test + +#---------------------------------------------------------------------------- +# 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 ($(interface_repo),1) + BIN=$(BIN_UNCHECKED) +endif # interface_repo + +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU +include $(TAO_ROOT)/taoconfig.mk + +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- + +LDFLAGS += -L$(TAO_ROOT)/tao + +Persistence_Test: $(addprefix $(VDIR),$(PERSISTENCE_TEST_OBJS)) + $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) + +realclean: clean + +#---------------------------------------------------------------------------- +# Dependencies +#---------------------------------------------------------------------------- + +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. + diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/Persistence_Test.dsp b/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/Persistence_Test.dsp new file mode 100644 index 00000000000..5fde1528cd6 --- /dev/null +++ b/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/Persistence_Test.dsp @@ -0,0 +1,106 @@ +# Microsoft Developer Studio Project File - Name="Persistence_Test" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Persistence_Test - 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 "Persistence_Test.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 "Persistence_Test.mak" CFG="Persistence_Test - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Persistence_Test - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Persistence_Test - 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)" == "Persistence_Test - 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 "..\..\..\..\..\\" /I "..\..\..\..\..\..\\" /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 ace.lib TAO.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\..\..\tao" /libpath:"..\..\..\..\..\..\ace"
+
+!ELSEIF "$(CFG)" == "Persistence_Test - 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 "..\..\..\..\\" /I "..\..\..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /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 aced.lib TAOd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\tao" /libpath:"..\..\..\..\..\ace"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Persistence_Test - Win32 Release"
+# Name "Persistence_Test - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Ptest.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=.\Ptest.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/Ptest.cpp b/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/Ptest.cpp new file mode 100644 index 00000000000..b8a3f9a4eda --- /dev/null +++ b/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/Ptest.cpp @@ -0,0 +1,258 @@ +// -*- C++ -*- +// $Id$ + +#include "Ptest.h" +#include "ace/Get_Opt.h" + +ACE_RCSID(Persistence_Test, Ptest, "$Id$") + +Ptest::Ptest (void) + : debug_ (0), + query_ (0) +{ +} + +Ptest::~Ptest (void) +{ +} + +int +Ptest::init (int argc, + char *argv[]) +{ + ACE_TRY_NEW_ENV + { + this->orb_ = CORBA::ORB_init (argc, + argv, + 0, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + CORBA::Object_var object = + this->orb_->resolve_initial_references ("RootPOA", + ACE_TRY_ENV); + ACE_TRY_CHECK; + + this->root_poa_ = + PortableServer::POA::_narrow (object.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + + int retval = this->parse_args (argc, + argv); + + if (retval != 0) + return retval; + + object = + this->orb_->resolve_initial_references ("InterfaceRepository", + ACE_TRY_ENV); + ACE_TRY_CHECK; + + if (CORBA::is_nil (object.in ())) + { + ACE_ERROR_RETURN (( + LM_ERROR, + "Null objref from resolve_initial_references\n" + ), + -1 + ); + } + + this->repo_ = + IR::Repository::_narrow (object.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + + if (CORBA::is_nil (this->repo_.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "IR::Repository::_narrow failed\n"), + -1); + } + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Ptest::init"); + return -1; + } + ACE_ENDTRY; + + return 0; +} + +int +Ptest::run (void) +{ + ACE_TRY_NEW_ENV + { + if (this->query_ == 1) + { + this->query (ACE_TRY_ENV); + } + else + { + this->populate (ACE_TRY_ENV); + } + + this->root_poa_->destroy (1, + 1, + ACE_TRY_ENV); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Ptest::run"); + return -1; + } + ACE_ENDTRY; + + return 0; +} + +int +Ptest::parse_args (int argc, + char *argv[]) +{ + ACE_Get_Opt opts (argc, argv, "dq"); + int c; + + while ((c = opts ()) != -1) + switch (c) + { + case 'd': // debug flag + this->debug_ = 1; + break; + case 'q': // query toggle + this->query_ = 1; + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s" + " [-d]" + " [-q]" + "\n", + argv [0]), + -1); + } + + return 0; +} + +void +Ptest::populate (CORBA::Environment &ACE_TRY_ENV) +{ + ACE_DEBUG (( + LM_DEBUG, + ACE_TEXT ("\n============== POPULATE ==============\n\n") + )); + + IR::StructMemberSeq members (2); + members.length (2); + members[0].name = CORBA::string_dup ("long_mem"); + members[0].type_def = this->repo_->get_primitive (IR::pk_long, + ACE_TRY_ENV); + ACE_CHECK; + members[0].type = members[0].type_def->type (ACE_TRY_ENV); + ACE_CHECK; + + members[1].name = CORBA::string_dup ("array_mem"); + members[1].type_def = this->repo_->create_array (5, + members[0].type_def.in (), + ACE_TRY_ENV); + ACE_CHECK; + members[1].type = members[1].type_def->type (ACE_TRY_ENV); + ACE_CHECK; + + + IR::StructDef_var svar = this->repo_->create_struct ("IDL:my_struct:1.0", + "my_struct", + "1.0", + members, + ACE_TRY_ENV); + ACE_CHECK; + + IR::EnumMemberSeq def_members (2); + def_members.length (2); + + def_members[0] = CORBA::string_dup ("ZERO"); + def_members[1] = CORBA::string_dup ("ONE"); + + IR::EnumDef_var e_def_var = svar->create_enum ("IDL:my_def_enum:1.0", + "my_enum", + "1.0", + def_members, + ACE_TRY_ENV); + ACE_CHECK; +} + +void +Ptest::query (CORBA::Environment &ACE_TRY_ENV) +{ + ACE_DEBUG (( + LM_DEBUG, + ACE_TEXT ("\n============== QUERY ==============\n\n") + )); + + const char *members[] = + { + "long_mem", + "array_mem", + "my_enum" + }; + + IR::ContainedSeq_var contents = this->repo_->contents (IR::dk_all, + 0, + ACE_TRY_ENV); + ACE_CHECK; + + CORBA::ULong length = contents->length (); + + if (this->debug_) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Repository::contents::length: %d\n"), + length)); + + ACE_ASSERT (length == 1); + + CORBA::ULong i = 0; + + IR::StructDef_var svar = IR::StructDef::_narrow (contents[i], + ACE_TRY_ENV); + ACE_CHECK; + + ACE_ASSERT (!CORBA::is_nil (svar.in ())); + + IR::StructMemberSeq_var out_members = svar->members (ACE_TRY_ENV); + ACE_CHECK; + + length = out_members->length (); + + if (this->debug_) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\nStructDef::members::length: %d\n"), + length)); + + ACE_ASSERT (length == 3); + + for (i = 0; i < length; i++) + { + if (this->debug_) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("StructDef::members[%d]::name: %s\n"), + i, + out_members[i].name.in ())); + + if (i == length - 1) + ACE_ASSERT (!ACE_OS::strcmp (out_members[i].name, "my_enum")); + else + ACE_ASSERT (!ACE_OS::strcmp (out_members[i].name, members[i])); + } + + svar->destroy (ACE_TRY_ENV); + ACE_CHECK; +} + diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/Ptest.h b/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/Ptest.h new file mode 100644 index 00000000000..86dbe0fd5bc --- /dev/null +++ b/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/Ptest.h @@ -0,0 +1,77 @@ +// -*- C++ -*- +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/orbsvcs/tests/InterfaceRepo +// +// = FILENAME +// Ptest.h +// +// = DESCRIPTION +// This code tests the persistence of the IFR by inserting +// IR objects into the repository with one function, and querying the +// repository with another, with a repository shutdown in between. +// +// = AUTHORS +// Jeff Parsons <parsons@cs.wustl.edu> +// +// ============================================================================ + +#if !defined (PTEST_H) +#define PTEST_H + +#include "tao/corba.h" + +class Ptest +{ + // = TITLE + // IFR Persistence test Implementation + // + // = DESCRIPTION + // Class wrapper for code which either populates or queries the + // Interface Repository. Designed to be used with a Perl script + // which can start and stop both this process and the repository + // process in the necessary order. +public: + Ptest (void); + // Constructor + + ~Ptest (void); + // Destructor + + int init (int argc, + char *argv[]); + // Initialize the ORB and get the IFR object reference. + + int run (void); + // Execute test code. + +private: + void populate (CORBA::Environment &ACE_TRY_ENV); + void query (CORBA::Environment &ACE_TRY_ENV); + // The two IFR tests. + + int parse_args (int argc, + char *argv[]); + // Process the command line arguments. + + CORBA::Boolean debug_; + // Flag to output results of IFR queries. + + CORBA::Boolean query_; + // Are we populating a new IFR or querying a persistent one? + + CORBA::ORB_var orb_; + // Storage of the ORB reference. + + PortableServer::POA_var root_poa_; + // Storage of the root POA reference. + + IR::Repository_var repo_; + // Storage of the IFR reference. +}; + +#endif /* PTEST_H */ + diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/README b/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/README new file mode 100644 index 00000000000..57d01e95b7e --- /dev/null +++ b/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/README @@ -0,0 +1,71 @@ +$Id$ + +This test addresses the functionality of persistence in the +Interface Repository. + +Ptest is a class wrapper for the test code. The class contains +two functions: populate() and query(). + +To build this test, the TAO library, the TypeCodeFactory +library, the Interface Repository (the last two found in +TAO/orbsvcs/IFR_Service), must be previously built, and all +either with the compiler option 'interface_repo=1' or (for +MSVC users) the line #define TAO_HAS_INTERFACE_REPOSITORY 1 +uncommented in TAO/tao/orbconf.h. In addition, the Interface +Repository requires the TAO_Svc_Utils library in TAO/orbsvcs/orbsvcs. + +It is far easier to run the test with the provided Perl script +run_test.pl, but to do it by hand, first start the IFR with +(Windows users remember to use backslashes instead): + +../../../IFR_Service/IFR_Service -p + +Then execute the test code with + +Persistence_Test + +This will populate the IFR with a few IFR objects. +After the test finishes, stop the IFR. Then start it again +with the same command line option. Then run the +test code again with the query option: + +Persistence_Test -q + +You may also add the option -d to this second run of the test +code to see the results of the IFR queries (this option will +have the same effect if used with the Perl script). + +After the query run of the test code, before starting again, you must +delete the IFR backing store file ("ifr_default_backing_store"). If you +like you can use another persistence file by starting the IFR both times with +the command line option '-p <filename>'. Just as with the default backing +file, it must be deleted before starting the test over. + +The query run of the test code will also destroy all IFR objects that were +created - the repository will be left empty except for the primitive kinds +which are always there (and cannot be destroyed). + +If for some reason IP multicast is not available or enabled on your platform, +then add + + -ORBInitRef InterfaceRepository=file://if_repo.ior + +to the client's command line. If the IFR_Service has been started with the +command line option -o <filename> (see the README file in the IFR_Service +directory), then instead add + + -ORBInitRef InterfaceRepository=file://<filename> + +to the client's command line. + +ACE_ASSERT is used to check each result, so an incorrect result +will cause test execution to halt immediately. If a test function +is halted for this or any other reason, it is likely that the +destroy() call(s) at the end of the function were not exectuted. +Before running the test again, the Interface Repository process +should be stopped and restarted to avoid a BAD_PARAM exception. + +More information about the Interface Repository can be found in +TAO/docs/releasenotes.index.html. + +-Jeff Parsons <parsons@cs.wustl.edu>
\ No newline at end of file diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/run_test.pl b/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/run_test.pl new file mode 100755 index 00000000000..3d569d52833 --- /dev/null +++ b/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/run_test.pl @@ -0,0 +1,108 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "../../../../../bin"; + +require ACEutils; +use Cwd; + +$cwd = getcwd(); +ACE::checkForTarget($cwd); + +$persistent = "-p"; + +$ifr_service = $EXEPREFIX."..".$DIR_SEPARATOR."..".$DIR_SEPARATOR. + "..".$DIR_SEPARATOR."IFR_Service".$DIR_SEPARATOR. + "IFR_Service".$EXE_EXT, " $persistent"; + +$init_ref = + "-ORBInitRef InterfaceRepository=file://if_repo.ior"; + +$iorfile = "$cwd$DIR_SEPARATOR" . "if_repo.ior"; +$backing_file = "$cwd$DIR_SEPARATOR" . "ifr_default_backing_store"; + +$debug = ""; +$query_opt = "-q"; +$other = ""; + +for ($i = 0; $i <= $#ARGV; $i++) +{ + SWITCH: + { + if ($ARGV[$i] eq "-d") + { + $debug = "-d"; + last SWITCH; + } + $other .= $ARGV[$i]; + } +} + +unlink $iorfile; +unlink $backing_file; + +print "\t IFR Persistence Test\n\n"; + +$NEW_IFR = Process::Create ($EXEPREFIX."..".$DIR_SEPARATOR."..".$DIR_SEPARATOR. + "..".$DIR_SEPARATOR."IFR_Service".$DIR_SEPARATOR. + "IFR_Service".$EXE_EXT, " $persistent"); + +if (ACE::waitforfile_timed ($iorfile, 15) == -1) +{ + print STDERR "ERROR: cannot find file <$iorfile>\n"; + $NEW_IFR->Kill (); + $NEW_IFR->TimedWait (1); + exit 1; +} + +$POPULATE = Process::Create ($EXEPREFIX."Persistence_Test".$EXE_EXT, + " $init_ref"); + +$populate = $POPULATE->TimedWait (60); +if ($populate == -1) +{ + print STDERR "ERROR: populate timedout\n"; + $POPULATE->Kill (); + $POPULATE->TimedWait (1); +} + +$NEW_IFR->Kill (); +$NEW_IFR->TimedWait (1); + +unlink $iorfile; + +$FILE_IFR = Process::Create ($EXEPREFIX."..".$DIR_SEPARATOR."..".$DIR_SEPARATOR. + "..".$DIR_SEPARATOR."IFR_Service".$DIR_SEPARATOR. + "IFR_Service".$EXE_EXT, " $persistent"); + +if (ACE::waitforfile_timed ($iorfile, 15) == -1) +{ + print STDERR "ERROR: cannot find file <$iorfile>\n"; + $FILE_IFR->Kill (); + $FILE_IFR->TimedWait (1); + exit 1; +} + +$QUERY = Process::Create ($EXEPREFIX."Persistence_Test".$EXE_EXT, + " $init_ref $debug $query_opt"); + +$query = $QUERY->TimedWait (60); +if ($query == -1) +{ + print STDERR "ERROR: query timedout\n"; + $QUERY->Kill (); + $QUERY->TimedWait (1); +} + +$FILE_IFR->Kill (); +$FILE_IFR->TimedWait (1); + +#unlink $iorfile; +#unlink $backing_file; + +exit 0; + diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/test.cpp b/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/test.cpp new file mode 100644 index 00000000000..27aa6d31b2a --- /dev/null +++ b/TAO/orbsvcs/tests/InterfaceRepo/Persistence_Test/test.cpp @@ -0,0 +1,21 @@ +// -*- C++ -*- +// $Id$ + +#include "Ptest.h" + +ACE_RCSID(Persistence_Test, test, "$Id$") + +int main (int argc, char *argv[]) +{ + Ptest ptest; + + int retval = ptest.init (argc, + argv); + + if (retval == -1) + return 1; + + retval = ptest.run (); + + return retval; +} |