diff options
author | dhinton <dhinton@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-05-27 18:53:59 +0000 |
---|---|---|
committer | dhinton <dhinton@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-05-27 18:53:59 +0000 |
commit | 41d8656784be88e065136b8e0d52bd404bc52431 (patch) | |
tree | c350d374bb7fa246465a230364a1da86e36c34b8 /tests/Framework_Component_Test.cpp | |
parent | e88164ac755420b6025c3182ab48718058a8825d (diff) | |
download | ATCD-dll_singleton.tar.gz |
ChangeLogTag:Mon May 27 18:48:42 UTC 2002 Don Hinton <dhinton@ieee.org>dll_singleton
Diffstat (limited to 'tests/Framework_Component_Test.cpp')
-rw-r--r-- | tests/Framework_Component_Test.cpp | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/tests/Framework_Component_Test.cpp b/tests/Framework_Component_Test.cpp index f92935d8e18..2b7092a2256 100644 --- a/tests/Framework_Component_Test.cpp +++ b/tests/Framework_Component_Test.cpp @@ -25,6 +25,29 @@ ACE_RCSID(tests, Framework_Component_Test, "$Id$") +// Define a few macros--because they're so much fun, and keep the +// code below a little cleaner... +#if (ACE_USES_CLASSIC_SVC_CONF == 1) + +# define ADD_SERVICE(X) ACE_TEXT ( \ + "dynamic Server_" #X " Service_Object * " \ + "Framework_Component_DLL:_make_Server_" #X "() ''") + +# define REMOVE_SERVICE(X) ACE_TEXT ( \ + "remove Server_" #X) + +#else /* ACE_USES_CLASSIC_SVC_CONF */ + +# define ADD_SERVICE(X) ACE_TEXT ( \ + "<?xml version='1.0'?> <dynamic id='Server_" #X "' " \ + "type='service_object'> <initializer init='_make_Server_" #X "' " \ + "path='Framework_Component_DLL' params=''/> </dynamic>") + +# define REMOVE_SERVICE(X) ACE_TEXT ( \ + "<?xml version='1.0'?> <remove id='Server_" #X "'> </remove>") + +#endif /* ACE_USES_CLASSIC_SVC_CONF */ + int run_test (u_long unload_mask = 0) { @@ -42,34 +65,36 @@ run_test (u_long unload_mask = 0) args.add (ACE_TEXT ("Framework_Component_Test")); args.add (ACE_TEXT ("-n")); args.add (ACE_TEXT ("-d")); - args.add (ACE_TEXT ("-S")); - args.add (ACE_TEXT ("\"dynamic Server_1 Service_Object * " - "Framework_Component_DLL:_make_Server_1() 'xxx' \"")); - // Load it, should load a dll. + // Initialize Service Config. ACE_Service_Config::open (args.argc (), args.argv ()); - // And unload the first one, should *not* unload the dll. - ACE_Service_Config::process_directive (ACE_TEXT ("remove Server_1")); + // Now add server 1. + ACE_Service_Config::process_directive (ADD_SERVICE(1)); + + // And unload the first one, could unload the dll. + ACE_Service_Config::process_directive (REMOVE_SERVICE(1)); + + // Now readd server 1. + ACE_Service_Config::process_directive (ADD_SERVICE(1)); - // Now load another service from the same library. - ACE_Service_Config::process_directive - (ACE_TEXT ("dynamic Server_2 Service_Object * " - "Framework_Component_DLL:_make_Server_2() 'xxx' ")); + // And load another service from the same library. + ACE_Service_Config::process_directive (ADD_SERVICE(2)); - // And unload the first one, should *not* unload the dll. - //ACE_Service_Config::process_directive (ACE_TEXT ("remove Server_1")); + // Unload the first one again, should *not* unload the dll this time. + ACE_Service_Config::process_directive (REMOVE_SERVICE(1)); // And unload the second service. Since the ACE_DLL_Handle will no longer // have any references, the ACE_DLL_Manager will apply it's current unloading // strategy and either call ACE_OS::dlclose() immediately, schedule a timeout // the the reactor to call dlclose() some time in the future, or keep the // dll loaded until program termination. - ACE_Service_Config::process_directive (ACE_TEXT ("remove Server_2")); + ACE_Service_Config::process_directive (REMOVE_SERVICE(2)); // Force unloading so we'll be ready for the next test. ACE_DLL_Manager::instance ()->unload_strategy (ACE_DLL_Manager_Ex::DEFAULT); + ACE_Service_Config::close (); return 0; } |