Merge pull request #2222 from jwillemsen/jwi-dllexportwarning
[ACE_TAO.git] / TAO / tests / Bug_2243_Regression / ORB_object_to_string.cpp
blobf3ed3df0aacb12b3ed89c3834b20295722a4880c
1 // -*- C++ -*-
2 // Adapted by Jules Colding <colding@omesc.com>
4 #include "tao/ORB.h"
5 #include "tao/Object.h"
6 #include "tao/SystemException.h"
8 #include "ace/Log_Msg.h"
10 // Valid test IOR.
11 // Do not attempt to narrow the object represented by this IOR, nor
12 // should you modify the IOR unless you replace it with another
13 // valid one!
14 static const char IOR[] =
15 "IOR:010000001600000049444c3a43756269745f466163746f72793a312e30000000010000000000000090000000010102cd14000000616e647572696c2e6563652e7563692e6564750057fecdcd2d00000014010f004e5550000000130000000001000000006368696c645f706f61000000000001000000666163746f7279cdcdcd03000000000000000800000001cdcdcd004f4154010000001400000001cdcdcd01000100000000000901010000000000004f41540400000001cd0000";
17 static const char ORBIT2_IOR[] =
18 "IOR:010000002600000049444c3a6f6d632e6272757475732f4252555455532f427275747573436865636b3a312e30000000040000000054424f580000000101020005000000554e495800000000100000006f6d632d322e6f6d6573632e636f6d00290000002f746d702f6f726269742d65766f2f6c696e632d313534642d302d343561373635656463306432640000000000000000000000004000000001010200100000006f6d632d322e6f6d6573632e636f6d003c8000001c00000000000000c080313dc3caa1c3462024c0964c4d0501000000e1b8086800000000caaedfba5400000001010200290000002f746d702f6f726269742d65766f2f6c696e632d313534642d302d34356137363565646330643264000000001c00000000000000c080313dc3caa1c3462024c0964c4d0501000000e1b8086801000000480000000100000002000000050000001c00000000000000c080313dc3caa1c3462024c0964c4d0501000000e1b8086801000000140000000100000001000105000000000901010000000000";
20 int
21 ACE_TMAIN (int argc, ACE_TCHAR *argv[])
23 try
25 CORBA::ORB_var orb =
26 CORBA::ORB_init (argc, argv);
28 // --------------------------------------------------------
29 // Create an object (but don't narrow() it) so we can test
30 // that we can stringify it later
31 // --------------------------------------------------------
33 CORBA::Object_var object = orb->string_to_object (IOR);
34 CORBA::String_var object_ref_str = orb->object_to_string (object.in());
35 if (0 == object_ref_str.in())
37 ACE_DEBUG ((LM_ERROR,
38 "\n"
39 "ORB_object_to_string test failed with TAO test IOR.\n"));
40 return 1;
42 else
44 ACE_DEBUG ((LM_INFO,
45 "\n"
46 "ORB_object_to_string test passed with TAO test IOR."));
49 object = orb->string_to_object (ORBIT2_IOR);
50 object_ref_str = orb->object_to_string (object.in());
51 if (0 == object_ref_str.in())
53 ACE_DEBUG ((LM_ERROR,
54 "\n"
55 "ORB_object_to_string test failed with ORBit2 test IOR.\n"));
56 return 1;
58 else
60 ACE_DEBUG ((LM_INFO,
61 "\n"
62 "ORB_object_to_string test passed with ORBit2 test IOR."));
65 orb->destroy ();
67 catch (const CORBA::Exception& ex)
69 ex._tao_print_exception ("Exception caught:");
70 ACE_DEBUG ((LM_ERROR,
71 "\n"
72 "ORB_object_to_string test failed.\n"));
73 return 1;
76 ACE_DEBUG ((LM_INFO,
77 "\n"
78 "ORB_object_to_string test completed successfully.\n"));
80 return 0;