Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / tests / unit / Notify / MC / Control / Control.cpp
blob264fbd4c4d486eb80a88c92ca333701bf6d387cd
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
11 public:
12 ControlTest (const ACE_CString& name)
13 : TAO_NS_Control (name.c_str ())
17 virtual bool execute (const char* cmd)
19 command = cmd;
20 return (ACE_OS::strcmp (cmd, TAO_NS_CONTROL_SHUTDOWN) == 0);
24 void
25 error (const char* msg)
27 ACE_ERROR ((LM_ERROR, "%s\n", msg));
28 ACE_OS::exit (1);
31 #endif /* TAO_HAS_MONITOR_FRAMEWORK==1 */
33 int
34 ACE_TMAIN (int, ACE_TCHAR*[])
36 #if defined (TAO_HAS_MONITOR_FRAMEWORK) && (TAO_HAS_MONITOR_FRAMEWORK == 1)
38 try
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");
63 catch(...)
65 error ("Caught an unexpected exception type");
68 #endif /* TAO_HAS_MONITOR_FRAMEWORK==1 */
70 return 0;