summaryrefslogtreecommitdiff
path: root/tests/Framework_Component_Test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Framework_Component_Test.cpp')
-rw-r--r--tests/Framework_Component_Test.cpp51
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;
}