Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tests / Bug_3566_Regression / Bug_3566_Regression_Test.cpp
blob6a2afc315a4668644ee0bd9f1f5baa41c6a28ff0
1 #include "tao/ORB.h"
2 #include "tao/ORB_Core.h"
3 #include "tao/Client_Strategy_Factory.h"
4 #include "ace/Get_Opt.h"
5 #include "ace/Log_Msg.h"
6 #include "ace/OS_NS_stdio.h"
7 #include "ace/ACE.h"
9 int
10 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
12 int result = 0;
13 int extra_argc = 4;
14 int second_extra_argc = 3;
15 int largc = argc;
16 int second_largc = argc;
18 try
20 ACE_TCHAR **extra = 0;
21 ACE_TCHAR **second_extra = 0;
22 ACE_NEW_RETURN (extra, ACE_TCHAR *[extra_argc], -1);
23 ACE_NEW_RETURN (second_extra, ACE_TCHAR *[second_extra_argc], -1);
24 extra[0] = ACE::strnew (ACE_TEXT ("-ORBGestalt"));
25 extra[1] = ACE::strnew (ACE_TEXT ("Local"));
26 extra[2] = ACE::strnew (ACE_TEXT ("-ORBSvcConfDirective"));
27 extra[3] = ACE::strnew (ACE_TEXT ("static Client_Strategy_Factory '-ORBReplyDispatcherTableSize 333'"));
29 second_extra[0] = ACE::strnew (ACE_TEXT ("-ORBGestalt"));
30 second_extra[1] = ACE::strnew (ACE_TEXT ("Local"));
31 second_extra[2] = ACE::strnew (ACE_TEXT ("-ORBSvcConfDirective \"static Client_Strategy_Factory '-ORBReplyDispatcherTableSize 666'\""));
33 ACE_TCHAR **largv = new ACE_TCHAR *[largc+extra_argc];
34 for (int i = 0; i < largc; i++)
35 largv[i] = argv[i];
37 ACE_TCHAR **second_largv = new ACE_TCHAR *[second_largc+second_extra_argc];
38 for (int i = 0; i < second_largc; i++)
39 second_largv[i] = argv[i];
41 for (int i = 0; i < extra_argc; i++)
43 largv[argc+i] = extra[i];
45 for (int i = 0; i < second_extra_argc; i++)
47 second_largv[argc+i] = second_extra[i];
50 largc += extra_argc;
51 second_largc += second_extra_argc;
53 CORBA::ORB_var orb = CORBA::ORB_init (largc, largv, "FirstORB");
55 if (orb->orb_core()->client_factory()->reply_dispatcher_table_size () != 333)
57 ++result;
60 orb->destroy ();
61 orb = CORBA::ORB::_nil ();
63 CORBA::ORB_var second_orb = CORBA::ORB_init (second_largc, second_largv, "SecondORB");
65 if (second_orb->orb_core()->client_factory()->reply_dispatcher_table_size () != 666)
67 ++result;
70 second_orb->destroy ();
71 second_orb = CORBA::ORB::_nil ();
73 for (int i = 0; i < extra_argc; i++)
74 ACE::strdelete (extra[i]);
75 for (int i2 = 0; i2 < second_extra_argc; i2++)
76 ACE::strdelete (second_extra[i2]);
77 delete [] extra;
78 delete [] largv;
79 delete [] second_extra;
80 delete [] second_largv;
82 catch (const CORBA::Exception& ex)
84 ex._tao_print_exception ("Exception caught:");
87 if (result == 0)
88 ACE_DEBUG ((LM_DEBUG,
89 ACE_TEXT ("Test passed!")));
90 else
91 ACE_ERROR ((LM_ERROR,
92 ACE_TEXT ("Test failed. Result: %d\n"),
93 result));
94 return result;