Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tests / ORB_Local_Config / Separation / Test.cpp
blob20b3d0df33e22d27fe082c2bee0e9a36236d5615
1 #include "tao/CORBANAME_Parser.h"
2 #include "tao/CORBALOC_Parser.h"
3 #include "tao/IIOP_Factory.h"
5 #include "ace/Service_Config.h"
6 #include "ace/Intrusive_Auto_Ptr.h"
7 #include "ace/Dynamic_Service.h"
9 #include "Service_Configuration_Per_ORB.h"
11 // @brief Services registered with separate repositories must remain separate
12 // and inaccesible through anyone but the one they were gegistered with
14 int
15 testSeparation (int , ACE_TCHAR *[])
17 ACE_TRACE ("testSeparation");
19 ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> one (new ACE_Service_Gestalt_Test (10));
20 one->process_directive (ace_svc_desc_TAO_CORBANAME_Parser);
22 ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> two (new ACE_Service_Gestalt_Test (10));
23 two->process_directive (ace_svc_desc_TAO_CORBALOC_Parser);
25 const ACE_TCHAR *svcname = ACE_TEXT ("IIOP_Factory");
27 TAO_Protocol_Factory* p10 = ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (one.get (), svcname);
28 if (p10 != 0)
29 ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally in one\n"), svcname), -1);
31 TAO_Protocol_Factory* p11 = ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (two.get (), "IIOP_Factory");
32 if (p11 != 0)
33 ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally in two\n"), svcname), -1);
35 svcname = ACE_TEXT ("CORBANAME_Parser");
37 ACE_Service_Object* p20 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), svcname);
38 if (p20 == 0)
39 ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected %s locally, in one\n"), svcname), -1);
41 ACE_Service_Object* p31 = ACE_Dynamic_Service<ACE_Service_Object>::instance (two.get (), svcname);
42 if (p31 != 0)
43 ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally, in two\n"), svcname), -1);
45 svcname = ACE_TEXT ("CORBALOC_Parser");
47 ACE_Service_Object* p21 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), svcname);
48 if (p21 != 0)
49 ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally, in one\n"), svcname), -1);
51 ACE_Service_Object* p30 = ACE_Dynamic_Service<ACE_Service_Object>::instance (two.get (), svcname);
52 if (p30 == 0)
53 ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected %s locally, in two\n"), svcname), -1);
55 return 0;
58 int
59 ACE_TMAIN (int argc, ACE_TCHAR *argv[])
61 return testSeparation (argc, argv);