Go to the documentation of this file.00001 #ifndef _BACITEST__H_
00002 #define _BACITEST__H_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00034 #ifndef __cplusplus
00035 #error This is a C++ include file and cannot be used from plain C
00036 #endif
00037
00038 #define ACS_TEST_INIT_LOGGING \
00039 { \
00040 LoggingProxy::init (m_logger); \
00041 ACS_SHORT_LOG((LM_INFO, "Logging proxy successfully created !")); \
00042 }
00043
00044 #define ACS_TEST_INIT_CORBA \
00045 { \
00046 ACE_TRY_EX (orb_block) \
00047 { \
00048 ACS_DEBUG("ACS_TEST_INIT_CORBA", "Initialising ORB ... "); \
00049 orb = CORBA::ORB_init (argc, argv, 0); \
00050 ACE_TRY_CHECK_EX (orb_block); \
00051 ACS_DEBUG ("ACS_TEST_INIT_CORBA", "ORB initialised !"); \
00052 } \
00053 ACE_CATCHANY \
00054 { \
00055 ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Failed to initalise ORB"); \
00056 return -1; \
00057 } \
00058 ACE_ENDTRY; \
00059 }
00060
00061 #define ACS_TEST_RESOLV_NAMING_SERVICE \
00062 { \
00063 ACE_TRY_EX (ce_log_block) \
00064 { \
00065 ACS_DEBUG ("errorServer", "Resolving Naming service ... "); \
00066 CORBA::Object_var naming_obj = \
00067 orb->resolve_initial_references ("NameService"); \
00068 ACE_TRY_CHECK_EX (ce_log_block); \
00069 if (!CORBA::is_nil (naming_obj.in ())) \
00070 { \
00071 CosNaming::NamingContext_var naming_context = \
00072 CosNaming::NamingContext::_narrow (naming_obj.in ()); \
00073 ACE_TRY_CHECK_EX (ce_log_block); \
00074 ACS_DEBUG ("errorServer", "Naming Service resolved !"); \
00075 ACS_DEBUG ("erorServer", "Resolving Logging Service from Naming service .... "); \
00076 CosNaming::Name name; \
00077 name.length(1); \
00078 name[0].id = CORBA::string_dup("Log"); \
00079 CORBA::Object_var log_obj = naming_context->resolve(name); \
00080 ACE_TRY_CHECK_EX (ce_log_block); \
00081 if (!CORBA::is_nil (log_obj.in())) \
00082 { \
00083 DsLogAdmin::Log_var logger = DsLogAdmin::Log::_narrow(log_obj.in()); \
00084 ACE_TRY_CHECK_EX (ce_log_block); \
00085 ACS_DEBUG ("errorServer", "Logging Service resolved !"); \
00086 m_logger->setCentralizedLogger(logger.in()); \
00087 } \
00088 else \
00089 { \
00090 ACS_DEBUG ("errorServer", "Failed to initialise the Logging Service!"); \
00091 } \
00092 } \
00093 else \
00094 { \
00095 ACS_DEBUG ("errorServer", "Failed to initialise the NameService!"); \
00096 } \
00097 } \
00098 ACE_CATCHANY \
00099 { \
00100 ACE_PRINT_EXCEPTION(ACE_ANY_EXCEPTION, "Failed to get and set the centralized logger"); \
00101 } \
00102 ACE_ENDTRY; \
00103 }
00104
00105 #endif
00106
00107