diff options
Diffstat (limited to 'TAO/orbsvcs/tests')
4 files changed, 404 insertions, 0 deletions
diff --git a/TAO/orbsvcs/tests/FaultTolerance/IOGRManipulation/IOGRManipulation.dsw b/TAO/orbsvcs/tests/FaultTolerance/IOGRManipulation/IOGRManipulation.dsw new file mode 100644 index 00000000000..a2ce5880836 --- /dev/null +++ b/TAO/orbsvcs/tests/FaultTolerance/IOGRManipulation/IOGRManipulation.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "IOGRTest"=.\IOGRTest.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/TAO/orbsvcs/tests/FaultTolerance/IOGRManipulation/IOGRTest.cpp b/TAO/orbsvcs/tests/FaultTolerance/IOGRManipulation/IOGRTest.cpp new file mode 100644 index 00000000000..72b515be9e7 --- /dev/null +++ b/TAO/orbsvcs/tests/FaultTolerance/IOGRManipulation/IOGRTest.cpp @@ -0,0 +1,209 @@ +// $Id$ + +//======================================================================== +// +// = LIBRARY +// TAO/tests/IORManipulation +// +// +// = FILENAME +// IORTest.cpp +// +// = DESCRIPTION +// This program tests the basic functionality FT IOGR implementation +// +// = AUTHOR +// Fred Kuhns +// +//========================================================================= + +#include "tao/corbafwd.h" +#include "tao/ORB.h" +#include "tao/IORManipulation/IORC.h" +#include "tao/corbafwd.h" +#include "tao/ORB.h" +#include "orbsvcs/FT_CORBAC.h" +#include "orbsvcs/FaultTolerance/FT_IOGR_Property.h" + + +ACE_RCSID(IORManipluation, IORTest, "$Id$") + +int +main (int argc, char *argv[]) +{ + + ACE_DEBUG ((LM_DEBUG, "---------------------------------------------\n")); + ACE_DEBUG ((LM_DEBUG, "Running the IOGRManipulation Tests.\n")); + + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + // Retrieve the ORB. + CORBA::ORB_var orb_ = CORBA::ORB_init (argc, + argv, + 0, + ACE_TRY_ENV); + ACE_TRY_CHECK; + // ********************************************************************** + + // Get an object reference for the ORBs IORManipulation object! + CORBA::Object_var IORM = + orb_->resolve_initial_references (TAO_OBJID_IORMANIPULATION, + 0, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + TAO_IOP::TAO_IOR_Manipulation_var iorm = + TAO_IOP::TAO_IOR_Manipulation::_narrow (IORM.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + // ********************************************************************** + + // Create a few fictitious IORs + CORBA::Object_var name1 = + orb_->string_to_object ("iiop://acme.cs.wustl.edu:6060/xyz", + ACE_TRY_ENV); + ACE_TRY_CHECK; + CORBA::Object_var name2 = + orb_->string_to_object ("iiop://tango.cs.wustl.edu:7070/xyz", + ACE_TRY_ENV); + ACE_TRY_CHECK; + + // ********************************************************************** + // Create IOR list for use with merge_iors. + TAO_IOP::TAO_IOR_Manipulation::IORList iors (2); + iors.length (2); + iors [0] = name1; + iors [1] = name2; + // ********************************************************************** + + CORBA::Object_var merged = + iorm->merge_iors (iors, ACE_TRY_ENV); + ACE_TRY_CHECK; + + // Check for set and get primaries + // Make a dummy property set + FT::TagFTGroupTaggedComponent ft_tag_component; + TAO_FT_IOGR_Property prop (ft_tag_component); + + CORBA::Boolean retval = + iorm->set_primary (&prop, name2.in (), merged.in (), ACE_TRY_ENV); + ACE_TRY_CHECK; + + if (retval != 0) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\tThe primary has been set\n"))); + else + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\tError in setting primary\n"))); + return -1; + } + + // Check whether a primary has been set + retval = iorm->is_primary_set (&prop, + merged.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + + if (retval) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\tis_primary_set () returned true\n"))); + else + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\tis_primary_set () returned false\n"))); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\tSo Exiting\n"))); + return -1; + } + + // Get the primary + CORBA::Object_var prim = + iorm->get_primary (&prop, + merged.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + + // Check whether we got back the right primary + if (prim->_is_equivalent (name2.in ())) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\tWe got the right primary back\n"))); + } + else + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\tWe have a problem in getting the right primary\n"))); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\tSo exiting\n"))); + return -1; + } + // ********************************************************************** + // Set properties + // Property values + + // Major and Minor revision numbers + ft_tag_component.version.major = (CORBA::Octet) 1; + ft_tag_component.version.minor = (CORBA::Octet) 0; + + // Domain id + const char *id = "iogr_regression"; + ft_tag_component.ft_domain_id = id; + + // Object group id + ft_tag_component.object_group_id = + (CORBA::ULongLong) 10; + + // Version + ft_tag_component.object_group_ref_version = + (CORBA::ULong) 5; + + // Set the property + retval = iorm->set_property (&prop, + merged.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + + if (retval) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\tWe have set the property\n"))); + } + ACE_CATCH (TAO_IOP::NotFound, userex) + { + ACE_PRINT_EXCEPTION (userex, + ACE_TEXT ("Unexpected NotFound Exception!\n")); + return -1; + } + ACE_CATCH (TAO_IOP::Duplicate, userex) + { + ACE_PRINT_EXCEPTION (userex, + "Unexpected Duplicate Exception!\n"); + return -1; + } + ACE_CATCH (TAO_IOP::Invalid_IOR, userex) + { + ACE_PRINT_EXCEPTION (userex, + "Unexpected Invalid_IOR Exception!\n"); + return -1; + } + ACE_CATCH (CORBA::SystemException, sysex) + { + ACE_PRINT_EXCEPTION (sysex, + "Unexpected system Exception!!\n"); + return -1; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Unexpected ACE_CATCHANY Exception!\n"); + return -1; + } + ACE_ENDTRY; + + ACE_DEBUG ((LM_DEBUG, "IORManipulation Tests Successfully Completed!\n")); + ACE_DEBUG ((LM_DEBUG, "---------------------------------------------\n")); + + return 0; +} diff --git a/TAO/orbsvcs/tests/FaultTolerance/IOGRManipulation/IOGRTest.dsp b/TAO/orbsvcs/tests/FaultTolerance/IOGRManipulation/IOGRTest.dsp new file mode 100644 index 00000000000..65da098d3be --- /dev/null +++ b/TAO/orbsvcs/tests/FaultTolerance/IOGRManipulation/IOGRTest.dsp @@ -0,0 +1,104 @@ +# Microsoft Developer Studio Project File - Name="IOGRTest" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=IOGRTest - 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 "IOGRTest.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 "IOGRTest.mak" CFG="IOGRTest - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "IOGRTest - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "IOGRTest - 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)" == "IOGRTest - 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 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 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:"..\..\..\ace" /libpath:"..\..\tao"
+
+!ELSEIF "$(CFG)" == "IOGRTest - 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" /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 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 TAO_IORManipd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\tao" /libpath:"..\..\tao\IORManipulation" /libpath:"..\..\..\ace"
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "IOGRTest - Win32 Release"
+# Name "IOGRTest - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\IOGRTest.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/TAO/orbsvcs/tests/FaultTolerance/IOGRManipulation/Makefile b/TAO/orbsvcs/tests/FaultTolerance/IOGRManipulation/Makefile new file mode 100644 index 00000000000..c979f9e0b27 --- /dev/null +++ b/TAO/orbsvcs/tests/FaultTolerance/IOGRManipulation/Makefile @@ -0,0 +1,62 @@ +#---------------------------------------------------------------------------- +# +# $Id$ +# +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Local macros +#---------------------------------------------------------------------------- + +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif # ! TAO_ROOT + +LDLIBS = -lTAO_CosNaming -lTAO_CosNotification -lTAO_FaultTolerance -lTAO -lTAO_IORManip + +PROG_SRCS = IOGRTest.cpp + +SRC = $(PROG_SRCS) + +SIMPLE_CLT_OBJS = IOGRTest.o +SIMPLE_SVR_OBJS = + +BIN2 = IOGRTest + +#### If the TAO orbsvcs library wasn't built with sufficient components, +#### don't try to build here. + BIN = $(BIN2) + +#---------------------------------------------------------------------------- +# 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 +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 -L$(ACE_ROOT)/ace +CPPFLAGS += -I$(TAO_ROOT)/orbsvcs + +.PRECIOUS: + +IOGRTest: $(addprefix $(VDIR),$(SIMPLE_CLT_OBJS)) + $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) + +realclean: clean + -$(RM) -rf IOGRTest + +#---------------------------------------------------------------------------- +# Dependencies +#---------------------------------------------------------------------------- + +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. |