Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / Portable_Interceptors / Recursive_ORBInitializer / client.cpp
blob72bfcfa6065c382d3dba27e1a2949b5a396efdc1
1 #include "Client_ORBInitializer.h"
2 #include "tao/ORBInitializer_Registry.h"
4 int
5 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
7 Client_ORBInitializer* initializer1 = 0;
8 Client_ORBInitializer* initializer2 = 0;
10 ACE_NEW_RETURN (initializer2,
11 Client_ORBInitializer (0),
12 -1); // No exceptions yet!
14 ACE_NEW_RETURN (initializer1,
15 Client_ORBInitializer (initializer2),
16 -1); // No exceptions yet!
18 PortableInterceptor::ORBInitializer_var initializer_var1 =
19 initializer1;
21 PortableInterceptor::ORBInitializer_var initializer_var2 =
22 initializer2;
24 try
26 PortableInterceptor::register_orb_initializer (initializer_var1.in ());
28 CORBA::ORB_var orb =
29 CORBA::ORB_init (argc, argv);
31 CORBA::ORB_var orb2 =
32 CORBA::ORB_init (argc, argv, "SecondORB");
34 catch (const CORBA::Exception& ex)
36 ex._tao_print_exception ("Caught exception in client:");
37 return 1;
40 // The first ORBInitializer should be called twice, the second only once
41 ACE_ASSERT (initializer1->pre_init_called == 2);
42 ACE_ASSERT (initializer2->pre_init_called == 1);
43 ACE_ASSERT (initializer1->post_init_called == 2);
44 ACE_ASSERT (initializer2->post_init_called == 1);
46 return 0;