1 #include "ace/Get_Opt.h"
2 #include "Client_ORBInitializer.h"
3 #include "tao/ORBInitializer_Registry.h"
6 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
8 Client_ORBInitializer
* initializer1
= 0;
9 Client_ORBInitializer
* initializer2
= 0;
10 bool caught_exception
= false;
12 ACE_NEW_RETURN (initializer1
,
13 Client_ORBInitializer
,
14 -1); // No exceptions yet!
16 ACE_NEW_RETURN (initializer2
,
17 Client_ORBInitializer
,
18 -1); // No exceptions yet!
20 PortableInterceptor::ORBInitializer_var initializer_var1
= initializer1
;
21 PortableInterceptor::ORBInitializer_var initializer_var2
= initializer2
;
25 PortableInterceptor::register_orb_initializer (initializer_var1
.in ());
27 PortableInterceptor::register_orb_initializer (initializer_var2
.in ());
29 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
31 catch (const CORBA::NO_MEMORY
&)
33 // Initializer1 throws this exception and we should get it here
34 caught_exception
= true;
36 catch (const CORBA::Exception
& ex
)
38 ex
._tao_print_exception ("Caught exception in client:");
42 // Only the pre init for initalizer 1 must be called, other initializers
43 // shouldn't be caught
44 if (initializer1
->pre_init_called
!= true)
46 ACE_ERROR_RETURN ((LM_ERROR
,
47 "Pre init not called for 1\n"),
50 if (initializer2
->pre_init_called
!= false)
52 ACE_ERROR_RETURN ((LM_ERROR
,
53 "Pre init called for 2\n"),
56 if (initializer1
->post_init_called
!= false)
58 ACE_ERROR_RETURN ((LM_ERROR
,
59 "Post init not called for 1\n"),
62 if (initializer2
->post_init_called
!= false)
64 ACE_ERROR_RETURN ((LM_ERROR
,
65 "Post init not called for 1\n"),
68 if (caught_exception
!= true)
70 ACE_ERROR_RETURN ((LM_ERROR
,
71 "Excep not caught\n"),