Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / CORBA_e_Implicit_Activation / server.cpp
blobd8d1b94047d55d0bc18ee8d3910beae181584d99
1 #include "Hello.h"
2 #include "ace/OS_NS_stdio.h"
4 int
5 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
7 int status = 1;
8 try
10 CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
12 CORBA::Object_var poa_object =
13 orb->resolve_initial_references("RootPOA");
15 PortableServer::POA_var root_poa =
16 PortableServer::POA::_narrow (poa_object.in ());
18 if (CORBA::is_nil (root_poa.in ()))
19 ACE_ERROR_RETURN ((LM_ERROR,
20 " (%P|%t) Panic: nil RootPOA\n"),
21 1);
23 Hello *hello_impl = 0;
24 ACE_NEW_RETURN (hello_impl,
25 Hello (),
26 1);
27 PortableServer::ServantBase_var owner_transfer(hello_impl);
29 Test::Hello_var hello = hello_impl->_this ();
31 ACE_ERROR ((LM_ERROR,
32 "ERROR: Implicit activation should have "
33 "thrown an exception with CORBA e compact.\n"));
35 root_poa->destroy (1, 1);
36 orb->destroy ();
38 catch (const PortableServer::POA::WrongPolicy&)
40 ACE_DEBUG ((LM_DEBUG, "This test passes.\n"));
41 status = 0;
43 catch (const CORBA::Exception& ex)
45 ex._tao_print_exception ("Exception caught:");
48 return status;