blob: 0ca898c19ca1e1ec95ccd07643310859b5240bb7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
// -*- C++ -*-
//
// $Id$
//
#include "Server_ORBInitializer.h"
#include "test_i.h"
#include "tao/ORBInitializer_Registry.h"
#include "tao/ORB_Constants.h"
ACE_RCSID (Recursive_ORBInitializer,
Server_ORBInitializer,
"$Id$")
Server_ORBInitializer::Server_ORBInitializer (void)
{
}
void
Server_ORBInitializer::pre_init (
PortableInterceptor::ORBInitInfo_ptr orbinitinfo)
ACE_THROW_SPEC ((CORBA::SystemException))
{
POA_TestModule::test* test = 0;
ACE_NEW (test,
test_i);
CORBA::Object_ptr object = test->_this ();
orbinitinfo->register_initial_reference ("MyService",
object);
bool invalid_name = false;
try
{
// Registering with an empty string should give an exception
orbinitinfo->register_initial_reference ("",
object);
}
catch (const PortableInterceptor::ORBInitInfo::InvalidName& ex)
{
invalid_name = true;
}
catch (const CORBA::Exception& ex)
{
}
if (!invalid_name)
ACE_ERROR ((LM_ERROR, "ERROR: Registering with an empty string doesn't "
"throw an exception\n"));
bool duplicate_name = false;
try
{
// Registering with an duplicate string should give an exception
orbinitinfo->register_initial_reference ("MyService",
object);
}
catch (const PortableInterceptor::ORBInitInfo::InvalidName& ex)
{
duplicate_name = true;
}
catch (const CORBA::Exception& ex)
{
}
if (!duplicate_name)
ACE_ERROR ((LM_ERROR, "ERROR: Registering with a duplicate with ORBInitInfo "
"doesn't throw the expected exception\n"));
bool invalid_object = false;
try
{
// Registering with a nil object
orbinitinfo->register_initial_reference ("NilServer",
CORBA::Object::_nil());
}
catch (const CORBA::BAD_PARAM& ex)
{
if (ex.minor () == (CORBA::OMGVMCID | 27))
{
invalid_object = true;
}
}
catch (const CORBA::Exception& ex)
{
}
if (!invalid_object)
ACE_ERROR ((LM_ERROR, "ERROR: Registering with a nil object to ORBInitInfo "
"doesn't throw bad param with OMG minor code 27\n"));
}
void
Server_ORBInitializer::post_init (
PortableInterceptor::ORBInitInfo_ptr)
ACE_THROW_SPEC ((CORBA::SystemException))
{
}
|