summaryrefslogtreecommitdiff
path: root/TAO/tests/Bug_3695_Regression/Bug_3695.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tests/Bug_3695_Regression/Bug_3695.cpp')
-rw-r--r--TAO/tests/Bug_3695_Regression/Bug_3695.cpp77
1 files changed, 77 insertions, 0 deletions
diff --git a/TAO/tests/Bug_3695_Regression/Bug_3695.cpp b/TAO/tests/Bug_3695_Regression/Bug_3695.cpp
new file mode 100644
index 00000000000..2d6e49eb0af
--- /dev/null
+++ b/TAO/tests/Bug_3695_Regression/Bug_3695.cpp
@@ -0,0 +1,77 @@
+// $Id$
+
+#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP == 0)
+
+#include "ace/OS_main.h"
+
+int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ return 0;
+}
+
+#else /* TAO_HAS_IIOP */
+
+#include "tao/IIOP_Profile.h"
+
+struct IIOP_Profile_var
+{
+ explicit IIOP_Profile_var (TAO_IIOP_Profile *pro)
+ : pro_ (pro)
+ {}
+
+ ~IIOP_Profile_var ()
+ {
+ this->pro_->_decr_refcnt ();
+ }
+
+ TAO_IIOP_Profile *operator->()
+ {
+ return this->pro_;
+ }
+
+ TAO_IIOP_Profile *get()
+ {
+ return this->pro_;
+ }
+
+ TAO_IIOP_Profile *pro_;
+};
+
+
+int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
+ TAO_ORB_Core *orb_core = orb->orb_core ();
+
+ // 1. Construct a profile with at least 2 *alternate* endpoints
+
+ ACE_INET_Addr addr (9238, "localhost"), addr2 (9239, "localhost"),
+ addr3 (9240, "localhost");
+ TAO::ObjectKey okey;
+ TAO_GIOP_Message_Version version;
+ IIOP_Profile_var test_profile (
+ new TAO_IIOP_Profile ("localhost", 9238, okey,
+ addr, version, orb_core));
+ test_profile->add_endpoint (new TAO_IIOP_Endpoint (addr2, 0));
+ test_profile->add_endpoint (new TAO_IIOP_Endpoint (addr3, 0));
+ test_profile->encode_alternate_endpoints ();
+
+
+ // 2. Marshal and demarshal it
+
+ TAO_OutputCDR stream;
+ test_profile->encode (stream);
+ TAO_InputCDR in_stream (stream);
+ in_stream.skip_ulong (); // tag
+ in_stream.skip_ulong (); // length
+ in_stream.skip_octet (); // byte order
+ IIOP_Profile_var test_profile2 (new TAO_IIOP_Profile (orb_core));
+ test_profile2->decode (in_stream);
+
+
+ // 3. The result of demarshalling should be equivalent to the original
+
+ return (test_profile->is_equivalent (test_profile2.get ()) ? 0 : 1);
+}
+
+#endif /* TAO_HAS_IIOP */