1 #include "ace/Log_Msg.h"
3 #include "orbsvcs/Notify/MonitorControl/Control.h"
5 #if defined (TAO_HAS_MONITOR_FRAMEWORK) && (TAO_HAS_MONITOR_FRAMEWORK == 1)
7 static ACE_CString command
;
9 class ControlTest
: public TAO_NS_Control
12 ControlTest (const ACE_CString
& name
)
13 : TAO_NS_Control (name
.c_str ())
17 virtual bool execute (const char* cmd
)
20 return (ACE_OS::strcmp (cmd
, TAO_NS_CONTROL_SHUTDOWN
) == 0);
25 error (const char* msg
)
27 ACE_ERROR ((LM_ERROR
, "%s\n", msg
));
31 #endif /* TAO_HAS_MONITOR_FRAMEWORK==1 */
34 ACE_TMAIN (int, ACE_TCHAR
*[])
36 #if defined (TAO_HAS_MONITOR_FRAMEWORK) && (TAO_HAS_MONITOR_FRAMEWORK == 1)
40 ACE_CString
name ("Control Test");
41 ControlTest
ct (name
);
43 if (name
!= ct
.name ())
45 error ("The TAO_NS_Control name does not work");
48 if (ct
.execute (TAO_NS_CONTROL_REMOVE_CONSUMER
))
50 error ("The control object should have returned false");
53 if (!ct
.execute (TAO_NS_CONTROL_SHUTDOWN
))
55 error ("The control object shouldn't have returned false");
58 if (command
!= TAO_NS_CONTROL_SHUTDOWN
)
60 error ("The TAO_NS_Control callback does not work");
65 error ("Caught an unexpected exception type");
68 #endif /* TAO_HAS_MONITOR_FRAMEWORK==1 */