source: trunk/ORBit2-2.14.0/test/poa/poatest-basic02.c

Last change on this file was 92, checked in by cinc, 19 years ago

Orbit2 modified for use with NOM

File size: 2.4 KB
Line 
1/*
2 * CORBA POA tests
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2, or (at your option) any
7 * later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * Author: Mark McLoughlin <mark@skynet.ie>
19 */
20
21/*
22 * Test 2 : poatest-basic02.c
23 * o Root POA.
24 * o implicitly activated object with servant_to_reference.
25 */
26
27#include <stdio.h>
28#include <stdlib.h>
29
30#include <orbit/orbit.h>
31
32#include "poatest-basic-shell.h"
33
34static void
35poatest_test_impl (PortableServer_Servant servant, CORBA_Environment *ev) { }
36
37PortableServer_ServantBase__epv base_epv = {
38 NULL, /* _private */
39 NULL, /* finalize */
40 NULL /* default_POA */
41};
42
43POA_poatest__epv poatest_epv = {
44 NULL, /* _private */
45 poatest_test_impl /* test */
46};
47
48POA_poatest__vepv poatest_vepv = {
49 &base_epv, /* _base_epv */
50 &poatest_epv /* poatest_epv */
51};
52
53POA_poatest poatest_servant = {
54 NULL, /* _private */
55 &poatest_vepv /* vepv */
56};
57
58poatest
59poatest_run (PortableServer_POA rootpoa,
60 PortableServer_POAManager rootpoa_mgr)
61{
62 CORBA_Environment ev;
63 poatest poatest_obj;
64
65 CORBA_exception_init( &ev );
66
67 /*
68 * Initialise the servant.
69 */
70 POA_poatest__init (&poatest_servant, &ev);
71 if (POATEST_EX (&ev)) {
72 POATEST_PRINT_EX ("POA_poatest__init : ", &ev);
73 return CORBA_OBJECT_NIL;
74 }
75
76 /*
77 * Imlicitly activate the Object.
78 * See sections 11.2.7 and 11.3.8.21.
79 */
80 poatest_obj = PortableServer_POA_servant_to_reference (rootpoa, &poatest_servant, &ev);
81 if (POATEST_EX (&ev)) {
82 POATEST_PRINT_EX ("servant_to_reference : ", &ev);
83 return CORBA_OBJECT_NIL;
84 }
85
86 /*
87 * Activate the POAManager. POA will now accept requests
88 */
89 PortableServer_POAManager_activate (rootpoa_mgr, &ev);
90 if (POATEST_EX (&ev)) {
91 POATEST_PRINT_EX ("POAManager_activate : ", &ev);
92 return CORBA_OBJECT_NIL;
93 }
94
95 return poatest_obj;
96}
Note: See TracBrowser for help on using the repository browser.