2 #include "MessageFactory.h"
5 #include "tao/AnyTypeCode/TypeCode.h"
15 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
17 MessageFactory
*mf
= new MessageFactory ();
18 CORBA::String_var id
= _tc_Message
->id ();
20 ACE_DEBUG ((LM_DEBUG
, "Registering factory reference\n"));
21 orb
->register_value_factory (id
.in (), mf
);
23 ACE_DEBUG ((LM_DEBUG
, "Unregistering factory reference\n"));
24 orb
->unregister_value_factory (id
.in ());
26 ACE_DEBUG ((LM_DEBUG
, "Value factory destructor flag: %i\n", MessageFactory::destructorInvoked_
));
28 ACE_DEBUG ((LM_DEBUG
, "Actively removing reference\n"));
31 ACE_DEBUG ((LM_DEBUG
, "Value factory destructor flag: %i\n", MessageFactory::destructorInvoked_
));
33 ACE_DEBUG ((LM_DEBUG
, "Shutting down / destroying ORB\n"));
37 if (MessageFactory::destructorInvoked_
== 1)
39 ACE_DEBUG ((LM_ERROR
, "Test passed: value factory destructor was invoked as expected\n"));
44 ACE_DEBUG ((LM_ERROR
, "Test failed: value factory destructor was not invoked\n"));
48 catch (const CORBA::Exception
& ex
)
50 ex
._tao_print_exception ("CORBA exception caught during execution");
55 ACE_DEBUG ((LM_ERROR
, "Non-CORBA exception caught during execution"));