diff options
author | iliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2008-04-06 00:14:50 +0000 |
---|---|---|
committer | iliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2008-04-06 00:14:50 +0000 |
commit | 67a6ea0f331a81d7f094b2cf512a0ae2046306fd (patch) | |
tree | 5b7d3662035f6a01469be6730320b836a62003dd | |
parent | 6939df7520284e8c46bc1c9a9934b2c002827330 (diff) | |
download | ATCD-67a6ea0f331a81d7f094b2cf512a0ae2046306fd.tar.gz |
ChangeLogTag: Sun Apr 6 00:03:27 UTC 2008 Iliyan Jeliazkov <iliyan@ociweb.com>
-rw-r--r-- | TAO/ChangeLog | 13 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Notify/Bug_3252_Regression/server.cpp | 33 | ||||
-rw-r--r-- | TAO/tests/ORB_Local_Config/Bug_1459/Test.cpp | 22 | ||||
-rw-r--r-- | TAO/tests/ORB_Local_Config/Bunch/Test.cpp | 37 | ||||
-rw-r--r-- | TAO/tests/ORB_Local_Config/Separation/Test.cpp | 27 | ||||
-rw-r--r-- | TAO/tests/ORB_Local_Config/Service_Dependency/Test.cpp | 41 | ||||
-rw-r--r-- | TAO/tests/ORB_Local_Config/Shared/Test.cpp | 29 | ||||
-rw-r--r-- | TAO/tests/ORB_Local_Config/Simple/Test.cpp | 16 |
8 files changed, 113 insertions, 105 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 38dd523dda8..40c4b5d9692 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,16 @@ +Sun Apr 6 00:03:27 UTC 2008 Iliyan Jeliazkov <iliyan@ociweb.com> + + * orbsvcs/tests/Notify/Bug_3252_Regression/server.cpp: + * tests/ORB_Local_Config/Bug_1459/Test.cpp: + * tests/ORB_Local_Config/Bunch/Test.cpp: + * tests/ORB_Local_Config/Separation/Test.cpp: + * tests/ORB_Local_Config/Service_Dependency/Test.cpp: + * tests/ORB_Local_Config/Shared/Test.cpp: + * tests/ORB_Local_Config/Simple/Test.cpp: + + Changes to account for the intrusive-recounted-ness of + ACE_Service_Gestalt instances. + Fri Apr 4 22:15:16 UTC 2008 Iliyan Jeliazkov <iliyan@ociweb.com> This is the first batch of changes related to the refactoring of diff --git a/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/server.cpp b/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/server.cpp index a66dad23b81..baca150ccfd 100644 --- a/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/server.cpp +++ b/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/server.cpp @@ -148,8 +148,6 @@ ACE_TMAIN(int, ACE_TCHAR ** argv) { int result = 0; - ACE_Service_Config serviceConfig; - char signum[64]; ACE_OS::sprintf(signum, "%d", SIGUSR1); @@ -158,13 +156,14 @@ ACE_TMAIN(int, ACE_TCHAR ** argv) args.add("-s"); args.add(signum); - result = serviceConfig.open ( - args.argc(), + ACE_Service_Config &serviceConfig = *ACE_Service_Config::singleton (); + + result = serviceConfig.open (args.argc(), args.argv(), ACE_DEFAULT_LOGGER_KEY, - 1, // ignore_static_svcs = 1, - 1, // ignore_default_svc_conf_file = 0, - 0 // ignore_debug_flag = 0 + true, // ignore_static_svcs = 1, + true, // ignore_default_svc_conf_file = 0, + false // ignore_debug_flag = 0 ); if(0 != result) @@ -174,6 +173,8 @@ ACE_TMAIN(int, ACE_TCHAR ** argv) } ACE_DEBUG ((LM_INFO, ACE_TEXT ("serviceConfig.open done\n"))); + + for(int i = 0; i < 5; ++i) { ACE_DEBUG ((LM_INFO, ACE_TEXT ("loadOrb ...\n"))); @@ -215,23 +216,5 @@ ACE_TMAIN(int, ACE_TCHAR ** argv) ACE_DEBUG ((LM_INFO, ACE_TEXT ("unloadOrb done\n"))); } - ACE_DEBUG ((LM_INFO, ACE_TEXT ("serviceConfig.fini_svcs ...\n"))); - result = serviceConfig.fini_svcs(); - if(0 != result) - { - ACE_DEBUG ((LM_ERROR, ACE_TEXT ("serviceConfig.fini_svcs failed\n"))); - return result; - } - ACE_DEBUG ((LM_INFO, ACE_TEXT ("serviceConfig.fini_svcs done\n"))); - - ACE_DEBUG ((LM_INFO, ACE_TEXT ("serviceConfig.close ...\n"))); - result = serviceConfig.close(); - if(0 != result) - { - ACE_DEBUG ((LM_ERROR, ACE_TEXT ("serviceConfig.close failed\n"))); - return result; - } - ACE_DEBUG ((LM_INFO, ACE_TEXT ("serviceConfig.close done\n"))); - return 0; } diff --git a/TAO/tests/ORB_Local_Config/Bug_1459/Test.cpp b/TAO/tests/ORB_Local_Config/Bug_1459/Test.cpp index 67e2daea54a..01e654fb0cf 100644 --- a/TAO/tests/ORB_Local_Config/Bug_1459/Test.cpp +++ b/TAO/tests/ORB_Local_Config/Bug_1459/Test.cpp @@ -28,7 +28,7 @@ const char argA[] = "AAA -ORBGestalt LOCAL -ORBId ORB-A -ORBSvcConf a.conf"; // dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() "-SSLAuthenticate SERVER_AND_CLIENT -SSLPrivateKey PEM:server_key.pem -SSLCertificate PEM:server_cert.pem"; // static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" -const char argB[] = "BBB -ORBGestalt LOCAL -ORBSvcConf b.conf"; +const char argB[] = "BBB -ORBGestalt LOCAL -ORBId ORB-A -ORBSvcConf b.conf"; // dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() "-SSLAuthenticate SERVER_AND_CLIENT -SSLPrivateKey PEM:client_key.pem -SSLCertificate PEM:client_cert.pem" // static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" @@ -76,7 +76,21 @@ testBug1459 (int , ACE_TCHAR *[]) ACE_UNUSED_ARG (argM); #endif /* MORB_AM */ +#ifdef MORB_MB + int n = 0; + ACE_ARGV arg0(argM); + n = arg0.argc(); + CORBA::ORB_var ORBA = CORBA::ORB_init(n, arg0.argv()); + if (ORBA.in () == 0) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected to get an ORB\n")), -1); + ACE_ARGV arg1(argB); + n = arg1.argc(); + CORBA::ORB_var ORBB = CORBA::ORB_init(n, arg1.argv()); +#else + ACE_UNUSED_ARG (argB); + ACE_UNUSED_ARG (argM); +#endif /* MORB_MB */ #ifdef MORB_MA int n = 0; @@ -89,6 +103,11 @@ testBug1459 (int , ACE_TCHAR *[]) ACE_ARGV arg1(argA); n = arg1.argc(); CORBA::ORB_var ORBB = CORBA::ORB_init(n, arg1.argv()); +#else + ACE_UNUSED_ARG (argA); + ACE_UNUSED_ARG (argM); +#endif /* MORB_MA */ + if (ORBB.in () == 0) ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected to get a second ORB\n")), -1); @@ -126,7 +145,6 @@ testBug1459 (int , ACE_TCHAR *[]) if (error > 0) return -1; -#endif /* MORB_MA */ } catch(const CORBA::Exception& ex) diff --git a/TAO/tests/ORB_Local_Config/Bunch/Test.cpp b/TAO/tests/ORB_Local_Config/Bunch/Test.cpp index 313f9904e86..9098c08edb4 100644 --- a/TAO/tests/ORB_Local_Config/Bunch/Test.cpp +++ b/TAO/tests/ORB_Local_Config/Bunch/Test.cpp @@ -7,6 +7,7 @@ #include "ace/ARGV.h" #include "ace/Service_Config.h" +#include "ace/Intrusive_Auto_Ptr.h" #include "ace/Dynamic_Service.h" ACE_RCSID (tests, server, "$Id$") @@ -14,15 +15,13 @@ ACE_RCSID (tests, server, "$Id$") #include "Service_Configuration_Per_ORB.h" -// @brief The "new" interfaces must be compatible with the "old" ones - int testCompatibility (int , ACE_TCHAR *[]) { ACE_TRACE ("testCompatibility"); // This uses the same default ACE_Service_Repository - ACE_Service_Gestalt_Test glob; + ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt_Test> glob (new ACE_Service_Gestalt_Test()); // Use the "old" interface if (0 != ACE_Service_Config::process_directive @@ -37,38 +36,38 @@ testCompatibility (int , ACE_TCHAR *[]) { // This uses the same default ACE_Service_Repository - ACE_Service_Gestalt_Test one; + ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt_Test> one (new ACE_Service_Gestalt_Test()); svcname = "CORBANAME_Parser"; - ACE_Service_Object* p20 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&one, svcname); - if ((p20 == 0)) - ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected %s locally, in one\n"), svcname), -1); + ACE_Service_Object* p20 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), svcname); + if (p20 == 0) + ACE_ERROR_RETURN ((LM_DEBUG, + ACE_TEXT("Expected %s locally, in one\n"), svcname), -1); svcname = "CORBALOC_Parser"; - ACE_Service_Object* p21 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&one, svcname); + ACE_Service_Object* p21 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), svcname); if ((p21 == 0)) - ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected %s locally, in one\n"), svcname), -1); + ACE_ERROR_RETURN ((LM_DEBUG, + ACE_TEXT("Expected %s locally, in one\n"), svcname), -1); // Exiting this scope should fini all services in the glob ... } svcname = "CORBANAME_Parser"; - ACE_Service_Object* p20 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&glob, svcname); + ACE_Service_Object* p20 = ACE_Dynamic_Service<ACE_Service_Object>::instance (glob.get (), svcname); if ((p20 != 0)) - ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected %s globally, too\n"), svcname), -1); + ACE_ERROR_RETURN ((LM_DEBUG, + ACE_TEXT("Expected %s globally, too\n"), svcname), -1); svcname = "CORBALOC_Parser"; - ACE_Service_Object* p21 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&glob, svcname); + ACE_Service_Object* p21 = ACE_Dynamic_Service<ACE_Service_Object>::instance (glob.get (), svcname); if ((p21 != 0)) - ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected %s globally, too\n"), svcname), -1); + ACE_ERROR_RETURN ((LM_DEBUG, + ACE_TEXT("Expected %s globally, too\n"), svcname), -1); return 0; } @@ -126,7 +125,7 @@ testTSSGestalt (int , ACE_TCHAR *[]) ACE_Service_Gestalt_Test one (10); // Localized ones go here - ACE_Service_Gestalt *global_instance = ACE_Service_Config::instance (); + ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> global_instance = ACE_Service_Config::instance (); // Sanity check if (global_instance == &one) @@ -136,7 +135,7 @@ testTSSGestalt (int , ACE_TCHAR *[]) // Make one be the ACE_Service_Config::instance () ... ACE_Service_Config_Guard temporary (&one); - ACE_Service_Gestalt *global_instance2 = ACE_Service_Config::instance (); + ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> global_instance2 = ACE_Service_Config::instance (); if (global_instance == global_instance2) ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected to see a different global from before\n")), -1); diff --git a/TAO/tests/ORB_Local_Config/Separation/Test.cpp b/TAO/tests/ORB_Local_Config/Separation/Test.cpp index 043b68087ea..8055b7d2d89 100644 --- a/TAO/tests/ORB_Local_Config/Separation/Test.cpp +++ b/TAO/tests/ORB_Local_Config/Separation/Test.cpp @@ -5,6 +5,7 @@ #include "tao/IIOP_Factory.h" #include "ace/Service_Config.h" +#include "ace/Intrusive_Auto_Ptr.h" #include "ace/Dynamic_Service.h" #include "Service_Configuration_Per_ORB.h" @@ -17,45 +18,39 @@ testSeparation(int , ACE_TCHAR *[]) { ACE_TRACE ("testSeparation"); - ACE_Service_Gestalt_Test one (10); - one.process_directive (ace_svc_desc_TAO_CORBANAME_Parser); + ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> one (new ACE_Service_Gestalt_Test (10)); + one->process_directive (ace_svc_desc_TAO_CORBANAME_Parser); - ACE_Service_Gestalt_Test two (10); - two.process_directive (ace_svc_desc_TAO_CORBALOC_Parser); + ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> two (new ACE_Service_Gestalt_Test (10)); + two->process_directive (ace_svc_desc_TAO_CORBALOC_Parser); const ACE_TCHAR * svcname = "IIOP_Factory"; - TAO_Protocol_Factory* p10 = - ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (&one, svcname); + TAO_Protocol_Factory* p10 = ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (one.get (), svcname); if (p10 != 0) ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally in one\n"), svcname), -1); - TAO_Protocol_Factory* p11 = - ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (&two, "IIOP_Factory"); + TAO_Protocol_Factory* p11 = ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (two.get (), "IIOP_Factory"); if (p11 != 0) ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally in two\n"), svcname), -1); svcname = "CORBANAME_Parser"; - ACE_Service_Object* p20 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&one, svcname); + ACE_Service_Object* p20 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), svcname); if (p20 == 0) ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected %s locally, in one\n"), svcname), -1); - ACE_Service_Object* p31 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&two, svcname); + ACE_Service_Object* p31 = ACE_Dynamic_Service<ACE_Service_Object>::instance (two.get (), svcname); if (p31 != 0) ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally, in two\n"), svcname), -1); svcname = "CORBALOC_Parser"; - ACE_Service_Object* p21 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&one, svcname); + ACE_Service_Object* p21 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), svcname); if (p21 != 0) ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally, in one\n"), svcname), -1); - ACE_Service_Object* p30 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&two, svcname); + ACE_Service_Object* p30 = ACE_Dynamic_Service<ACE_Service_Object>::instance (two.get (), svcname); if (p30 == 0) ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected %s locally, in two\n"), svcname), -1); diff --git a/TAO/tests/ORB_Local_Config/Service_Dependency/Test.cpp b/TAO/tests/ORB_Local_Config/Service_Dependency/Test.cpp index 79991afccc0..becdb20c1ee 100644 --- a/TAO/tests/ORB_Local_Config/Service_Dependency/Test.cpp +++ b/TAO/tests/ORB_Local_Config/Service_Dependency/Test.cpp @@ -9,6 +9,7 @@ #include "ace/Dynamic_Service.h" #include "ace/Dynamic_Service_Dependency.h" #include "ace/Thread_Manager.h" +#include "ace/Intrusive_Auto_Ptr.h" #include "Service_Configuration_Per_ORB.h" @@ -108,11 +109,13 @@ testORBInitializer_Registry (int , ACE_TCHAR *[]) { ACE_TRACE ("testORBInitializer_Registry"); - ACE_Service_Gestalt_Test glob; // for global service registrations - ACE_Service_Gestalt_Test one (10); // Localized ones go here + // for global service registrations + ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt_Test> glob (new ACE_Service_Gestalt_Test ()); - size_t glob_size = glob.services_count (); - size_t loca_size = one.services_count (); + ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt_Test> one (new ACE_Service_Gestalt_Test (10)); + + size_t glob_size = glob->services_count (); + size_t loca_size = one->services_count (); // It is expected to be empty at this point since it is not using // the global repo @@ -125,7 +128,7 @@ testORBInitializer_Registry (int , ACE_TCHAR *[]) // Lookup it up. TAO::ORBInitializer_Registry_Adapter* oir = ACE_Dynamic_Service<TAO::ORBInitializer_Registry_Adapter>::instance - (&one, "ORBInitializer_Registry"); + (one.get (), "ORBInitializer_Registry"); #if defined (TAO_AS_STATIC_LIBS) if ((oir == 0)) @@ -148,14 +151,14 @@ testORBInitializer_Registry (int , ACE_TCHAR *[]) // output an error then. if (oir == 0) { - one.process_directive ( + one->process_directive ( ACE_DYNAMIC_SERVICE_DIRECTIVE("ORBInitializer_Registry", "TAO_PI", "_make_ORBInitializer_Registry", "")); oir = ACE_Dynamic_Service<TAO::ORBInitializer_Registry_Adapter>::instance - (&one, "ORBInitializer_Registry"); + (one.get (), "ORBInitializer_Registry"); } if (oir == 0) { @@ -165,12 +168,12 @@ testORBInitializer_Registry (int , ACE_TCHAR *[]) #endif - if (glob_size != glob.services_count ()) + if (glob_size != glob->services_count ()) { ACE_ERROR ((LM_ERROR, "Expected %d local static service registrations, found %d\n", glob_size, - glob.services_count ())); + glob->services_count ())); return -1; } @@ -181,7 +184,7 @@ testORBInitializer_Registry (int , ACE_TCHAR *[]) // ClientRequestInterceptor_Adapter_Factory and PICurrent_Loader are // registred explicitely, while CodecFactory_Loader - indirectly. - if (loca_size == one.services_count ()) + if (loca_size == one->services_count ()) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Expected to find additional services present\n"))); return -1; @@ -210,7 +213,7 @@ testORBInitializer_Registry (int , ACE_TCHAR *[]) // Try to instantiate the dynamic service from the local repository ... TAO::ORBInitializer_Registry_Adapter* oir2 = ACE_Dynamic_Service<TAO::ORBInitializer_Registry_Adapter>::instance - (&one, "ORBInitializer_Registry"); + (one.get (), "ORBInitializer_Registry"); // Right! That's local. if (oir2 == 0) @@ -227,7 +230,7 @@ testORBInitializer_Registry (int , ACE_TCHAR *[]) // registrations, those may end up in the wrong (global) gestalt and will // be in memory, which may not be mapped by finalization time! { - ACE_Service_Config_Guard guard (&one); + ACE_Service_Config_Guard guard (one.get ()); oir2->init (0,0); } @@ -237,7 +240,7 @@ testORBInitializer_Registry (int , ACE_TCHAR *[]) // ... and also one of the dependent static services if (0 == ACE_Dynamic_Service <ACE_Service_Object>::instance - (&one, "CodecFactory_Loader")) + (one.get (), "CodecFactory_Loader")) ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT ("Expected to find CodecFactory_Loader locally\n")), -1); @@ -247,7 +250,7 @@ testORBInitializer_Registry (int , ACE_TCHAR *[]) "(%P|%t) Explicitely dynamic_service PolicyFactory_Loader" " (although ORBInitializer_Registry already did it) ...\n")); - one.process_directive + one->process_directive (ACE_DYNAMIC_SERVICE_DIRECTIVE("PolicyFactory_Loader", "TAO_PI", "_make_TAO_PolicyFactory_Loader", @@ -255,7 +258,7 @@ testORBInitializer_Registry (int , ACE_TCHAR *[]) if (0 == ACE_Dynamic_Service <ACE_Service_Object>::instance - (&one, "PolicyFactory_Loader")) + (one.get (), "PolicyFactory_Loader")) ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT ("Expected to find PolicyFactory_Loader locally\n")), -1); @@ -285,9 +288,9 @@ testServiceDependency (int , ACE_TCHAR *[]) { // Start a block to limit the lifespan of a gestalt - ACE_Service_Gestalt_Test one (10); + ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt_Test> one (new ACE_Service_Gestalt_Test (10)); - int result = one.process_directive + int result = one->process_directive (ACE_DYNAMIC_SERVICE_DIRECTIVE("TAO_Codeset", "TAO_Codeset", "_make_TAO_Codeset_Manager_Factory", @@ -299,7 +302,7 @@ testServiceDependency (int , ACE_TCHAR *[]) TAO_Codeset_Manager_Factory_Base *factory = ACE_Dynamic_Service<TAO_Codeset_Manager_Factory_Base>::instance - (&one, "TAO_Codeset"); + (one.get (), "TAO_Codeset"); if (factory == 0) ACE_ERROR_RETURN((LM_ERROR, @@ -316,7 +319,7 @@ testServiceDependency (int , ACE_TCHAR *[]) // Stating that a thing depends on that dynamic service. Why? // Read on ... - pdep = new ACE_Dynamic_Service_Dependency (&one, "TAO_Codeset"); + pdep = new ACE_Dynamic_Service_Dependency (one.get (), "TAO_Codeset"); // This would ordinarily cause the dynamic services to get // unloaded and their DLL's unmapped ... diff --git a/TAO/tests/ORB_Local_Config/Shared/Test.cpp b/TAO/tests/ORB_Local_Config/Shared/Test.cpp index 9aefa087a93..950121f9f2c 100644 --- a/TAO/tests/ORB_Local_Config/Shared/Test.cpp +++ b/TAO/tests/ORB_Local_Config/Shared/Test.cpp @@ -4,6 +4,7 @@ #include "tao/CORBALOC_Parser.h" #include "tao/Protocol_Factory.h" #include "ace/Dynamic_Service.h" +#include "ace/Intrusive_Auto_Ptr.h" #include "Service_Configuration_Per_ORB.h" @@ -16,13 +17,14 @@ testReusingGlobals (int , ACE_TCHAR *[]) ACE_TRACE ("testReusingGlobals"); { - ACE_Service_Gestalt/*_Test*/ one (10, false) ; // The ACE_Service_Gestalt_Test will teardown all! - one.process_directive (ace_svc_desc_TAO_CORBANAME_Parser); - one.process_directive (ace_svc_desc_TAO_CORBALOC_Parser); + ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> one (new ACE_Service_Gestalt (10, false)); + + // The ACE_Service_Gestalt_Test will teardown all! + one->process_directive (ace_svc_desc_TAO_CORBANAME_Parser); + one->process_directive (ace_svc_desc_TAO_CORBALOC_Parser); const ACE_TCHAR *svcname = ACE_TEXT ("IIOP_Factory"); - TAO_Protocol_Factory* p1 = - ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (&one, svcname); + TAO_Protocol_Factory* p1 = ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (one.get (), svcname); if (p1 != 0) { @@ -31,8 +33,7 @@ testReusingGlobals (int , ACE_TCHAR *[]) } svcname = ACE_TEXT ("CORBANAME_Parser"); - ACE_Service_Object* p2 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&one, svcname); + ACE_Service_Object* p2 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), svcname); if (p2 == 0) { @@ -41,8 +42,7 @@ testReusingGlobals (int , ACE_TCHAR *[]) } svcname = ACE_TEXT ("CORBALOC_Parser"); - ACE_Service_Object* p3 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&one, svcname); + ACE_Service_Object* p3 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), svcname); if (p3 == 0) { @@ -52,11 +52,11 @@ testReusingGlobals (int , ACE_TCHAR *[]) } - ACE_Service_Gestalt_Test two; // Use the ACE_Service_Repository::instance () + ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> two (new ACE_Service_Gestalt_Test (10)); + // ACE_Service_Gestalt_Test two; // Use the ACE_Service_Repository::instance () const ACE_TCHAR *svcname = ACE_TEXT ("IIOP_Factory"); - TAO_Protocol_Factory* p1 = - ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (&two, svcname); + TAO_Protocol_Factory* p1 = ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (two.get (), svcname); if (p1 != 0) { @@ -65,10 +65,9 @@ testReusingGlobals (int , ACE_TCHAR *[]) } svcname = ACE_TEXT ("CORBANAME_Parser"); - ACE_Service_Object* p2 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&two, svcname); + ACE_Service_Object* p2 = ACE_Dynamic_Service<ACE_Service_Object>::instance (two.get (), svcname); - if (p2 == 0) // You should be able to find the same stuff here, too + if (p2 == 0) // You should be able to find the same stuff here, too`` { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Not expected to find %s in the global repo\n"), svcname)); return -1; diff --git a/TAO/tests/ORB_Local_Config/Simple/Test.cpp b/TAO/tests/ORB_Local_Config/Simple/Test.cpp index a93e129d932..b2db8cc4308 100644 --- a/TAO/tests/ORB_Local_Config/Simple/Test.cpp +++ b/TAO/tests/ORB_Local_Config/Simple/Test.cpp @@ -4,6 +4,7 @@ #include "tao/CORBALOC_Parser.h" #include "tao/Protocol_Factory.h" #include "ace/Dynamic_Service.h" +#include "ace/Intrusive_Auto_Ptr.h" #include "Service_Configuration_Per_ORB.h" @@ -13,25 +14,22 @@ int ACE_TMAIN (int, ACE_TCHAR *[]) { - ACE_Service_Gestalt_Test one; // Use the ACE_Service_Repository::instance () + ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> one (new ACE_Service_Gestalt()); - one.process_directive (ace_svc_desc_TAO_CORBANAME_Parser); - one.process_directive (ace_svc_desc_TAO_CORBALOC_Parser); + one->process_directive (ace_svc_desc_TAO_CORBANAME_Parser); + one->process_directive (ace_svc_desc_TAO_CORBALOC_Parser); - TAO_Protocol_Factory* p1 = - ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (&one, "IIOP_Factory"); + TAO_Protocol_Factory* p1 = ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (one.get (), "IIOP_Factory"); if (p1 != 0) ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Unexpected to find IIOP_Factory\n")), -1); - ACE_Service_Object* p2 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&one, "CORBANAME_Parser"); + ACE_Service_Object* p2 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), "CORBANAME_Parser"); if (p2 == 0) ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected to find CORBANAME_Parser\n")), -1); - ACE_Service_Object* p3 = - ACE_Dynamic_Service<ACE_Service_Object>::instance (&one, "CORBALOC_Parser"); + ACE_Service_Object* p3 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), "CORBALOC_Parser"); if (p3 == 0) ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected to find CORBALOC_Parser\n")), -1); |