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

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

Orbit2 modified for use with NOM

File size: 2.7 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 1 : poatest-basic01.c
23 * o Root POA.
24 * o activated object with system assigned id.
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
37static PortableServer_ServantBase__epv base_epv = {
38 NULL, /* _private */
39 NULL, /* finalize */
40 NULL /* default_POA */
41};
42
43static POA_poatest__epv poatest_epv = {
44 NULL, /* _private */
45 poatest_test_impl /* test */
46};
47
48static POA_poatest__vepv poatest_vepv = {
49 &base_epv, /* _base_epv */
50 &poatest_epv /* poatest_epv */
51};
52
53static POA_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 PortableServer_ObjectId *objid;
65
66 CORBA_exception_init( &ev );
67
68 /*
69 * Initialise the servant.
70 */
71 POA_poatest__init (&poatest_servant, &ev);
72 if (POATEST_EX (&ev)) {
73 POATEST_PRINT_EX ("POA_poatest__init : ", &ev);
74 return CORBA_OBJECT_NIL;
75 }
76
77 /*
78 * Activate object. POA will assign an ObjectId.
79 */
80 objid = PortableServer_POA_activate_object (rootpoa, &poatest_servant, &ev);
81 if (POATEST_EX (&ev)) {
82 POATEST_PRINT_EX ("activate_object : ", &ev);
83 return CORBA_OBJECT_NIL;
84 }
85 CORBA_free (objid);
86
87 /*
88 * Get a reference for the activated Object.
89 */
90 poatest_obj = PortableServer_POA_servant_to_reference (rootpoa, &poatest_servant, &ev);
91 if (POATEST_EX (&ev)) {
92 POATEST_PRINT_EX ("servant_to_reference : ", &ev);
93 return CORBA_OBJECT_NIL;
94 }
95
96 /*
97 * Activate the POAManager. POA will now accept requests
98 */
99 PortableServer_POAManager_activate (rootpoa_mgr, &ev);
100 if (POATEST_EX (&ev)) {
101 POATEST_PRINT_EX ("POAManager_activate : ", &ev);
102 return CORBA_OBJECT_NIL;
103 }
104
105
106
107 return poatest_obj;
108}
Note: See TracBrowser for help on using the repository browser.