Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tests / ORB_Local_Config / Bug_1459 / Test.cpp
blob644fe35008507ce0ad5f7c54c36d7953d322161d
1 // @author Jeff Mirwaisi <jeff_mirwaisi@yahoo.com>
2 // @author Iliyan Jeliazkov <iliyan2ociweb.com>
4 // the following is a simplification of the above problems (see
5 // bugzilla 1459) and the different scenarios minus the creation of
6 // the servant the service manager or threads even without the servant
7 // to demonstrate that the server is capable of responding (which in
8 // some cases it isnt) problems can already be seen in the multiple
9 // orb scenarios
12 #include "tao/corba.h"
13 #include "ace/ARGV.h"
14 #include "ace/Dynamic_Service.h"
15 #include "Service_Configuration_Per_ORB.h"
17 // Currently there is no way to test SSLIOP in this test due to a problem
18 // described in bug 3418.
19 //#define DO_1459_SSLIOP_TEST 1
21 // UIOP
22 const ACE_TCHAR argStrA[] = ACE_TEXT ("AAA -ORBGestalt LOCAL -ORBId ORB-A -ORBSvcConf a.conf");
24 #if defined (DO_1459_SSLIOP_TEST)
25 // SSLIOP
26 const ACE_TCHAR argStrB[] = ACE_TEXT ("BBB -ORBGestalt LOCAL -ORBId ORB-B -ORBSvcConf b.conf");
27 #endif
29 // UIPMC
30 const ACE_TCHAR argStrC[] = ACE_TEXT ("CCC -ORBGestalt LOCAL -ORBId ORB-C -ORBSvcConf m1.conf");
32 // DIOP
33 const ACE_TCHAR argStrD[] = ACE_TEXT ("DDD -ORBGestalt LOCAL -ORBId ORB-D -ORBSvcConf d.conf");
35 // empty file
36 const ACE_TCHAR argStrM[] = ACE_TEXT ("MMM -ORBGestalt LOCAL -ORBId ORB-M -ORBSvcConf m.conf");
38 int
39 testBug1459 (int, ACE_TCHAR *[])
41 ACE_TRACE ("testBug1459");
43 try
45 int n, error = 0;
47 ACE_ARGV argM (argStrM);
48 n = argM.argc ();
49 CORBA::ORB_var ORBM =
50 CORBA::ORB_init (n, argM.argv ());
52 if (CORBA::is_nil (ORBM.in ()))
53 ACE_ERROR_RETURN ((LM_DEBUG,
54 ACE_TEXT("Expected to get an ORB\n")),
55 -1);
57 #if TAO_HAS_UIOP == 1
58 // UIOP
59 ACE_ARGV argA (argStrA);
60 n = argA.argc ();
61 CORBA::ORB_var ORBA =
62 CORBA::ORB_init (n, argA.argv ());
64 if (CORBA::is_nil (ORBA.in ()))
65 ACE_ERROR_RETURN ((LM_DEBUG,
66 ACE_TEXT("Expected to get an ORB\n")),
67 -1);
68 #endif /* TAO_HAS_UIOP */
70 #if defined (DO_1459_SSLIOP_TEST)
71 // SSLIOP
72 ACE_ARGV argB (argStrB);
73 n = argB.argc ();
74 CORBA::ORB_var ORBB =
75 CORBA::ORB_init (n, argB.argv ());
77 if (CORBA::is_nil (ORBB.in ()))
78 ACE_ERROR_RETURN ((LM_DEBUG,
79 ACE_TEXT("Expected to get an ORB\n")),
80 -1);
81 #endif
83 // MIOP
84 ACE_ARGV argC (argStrC);
85 n = argC.argc ();
86 CORBA::ORB_var ORBC =
87 CORBA::ORB_init (n, argC.argv ());
89 if (CORBA::is_nil (ORBC.in ()))
90 ACE_ERROR_RETURN ((LM_DEBUG,
91 ACE_TEXT("Expected to get an ORB\n")),
92 -1);
94 // DIOP
95 ACE_ARGV argD (argStrD);
96 n = argD.argc ();
97 CORBA::ORB_var ORBD =
98 CORBA::ORB_init (n, argD.argv ());
100 if (CORBA::is_nil (ORBD.in ()))
101 ACE_ERROR_RETURN ((LM_DEBUG,
102 ACE_TEXT("Expected to get an ORB\n")),
103 -1);
105 if (
106 // SSLIOP
107 #if defined (DO_1459_SSLIOP_TEST)
108 ORBM.in () == ORBB.in () ||
109 #if TAO_HAS_UIOP == 1
110 ORBA.in () == ORBB.in () ||
111 #endif
112 ORBC.in () == ORBB.in () ||
113 ORBD.in () == ORBB.in () ||
114 #endif
115 // UIOP
116 #if TAO_HAS_UIOP
117 ORBM.in () == ORBA.in () ||
118 ORBC.in () == ORBA.in () ||
119 ORBD.in () == ORBA.in () ||
120 #endif
121 // MIOP
122 ORBM.in () == ORBC.in () ||
123 ORBD.in () == ORBC.in () ||
124 // DIOP
125 ORBM.in () == ORBD.in ()
127 ACE_ERROR_RETURN ((LM_DEBUG,
128 ACE_TEXT("Unexpected to find the two ORBs are the same\n")),
129 -1);
131 // Since each svc conf file causes the ORB to load the services in
132 // its own service space no services are reachable through the
133 // global service repo
135 #if TAO_HAS_UIOP == 1
136 // UIOP
137 ACE_Service_Object *uiop_so =
138 ACE_Dynamic_Service<ACE_Service_Object>::instance ("UIOP_Factory");
139 if (uiop_so != 0)
141 ++error;
142 ACE_ERROR ((LM_DEBUG,
143 ACE_TEXT("Unexpected to find ")
144 ACE_TEXT("UIOP_Factory globally\n")));
146 #endif /* TAO_HAS_UIOP */
148 #if defined (DO_1459_SSLIOP_TEST)
149 // SSLIOP
150 ACE_Service_Object *ssliop_so =
151 ACE_Dynamic_Service<ACE_Service_Object>::instance ("SSLIOP_Factory");
152 if (ssliop_so != 0)
154 ++error;
155 ACE_ERROR ((LM_DEBUG,
156 ACE_TEXT("Unexpected to find ")
157 ACE_TEXT("SSLIOP_Factory globally\n")));
159 #endif
161 // MIOP
162 ACE_Service_Object *uipmc_so =
163 ACE_Dynamic_Service<ACE_Service_Object>::instance ("UIPMC_Factory");
164 if (uipmc_so != 0)
166 ++error;
167 ACE_ERROR ((LM_DEBUG,
168 ACE_TEXT("Unexpected to find ")
169 ACE_TEXT("UIPMC_Factory globally\n")));
172 // DIOP
173 ACE_Service_Object *diop_so =
174 ACE_Dynamic_Service<ACE_Service_Object>::instance ("DIOP_Factory");
175 if (diop_so != 0)
177 ++error;
178 ACE_ERROR ((LM_DEBUG,
179 ACE_TEXT("Unexpected to find ")
180 ACE_TEXT("DIOP_Factory globally\n")));
183 ORBM->destroy();
185 #if TAO_HAS_UIOP == 1
186 ORBA->destroy();
187 #endif /* TAO_HAS_UIOP */
189 #if defined (DO_1459_SSLIOP_TEST)
190 ORBB->destroy();
191 #endif
193 ORBC->destroy();
195 ORBD->destroy();
197 if (error > 0)
198 return -1;
200 catch(const CORBA::Exception& ex)
202 ex._tao_print_exception ("Unhandled exception caught");
203 return -1;
206 return 0;
209 // @brief the main driver
212 ACE_TMAIN (int argc, ACE_TCHAR *argv[])
214 return testBug1459(argc, argv);