source: trunk/ORBit2-2.14.0/test/everything/contextServer.c

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

Orbit2 modified for use with NOM

File size: 2.2 KB
Line 
1/*
2 * CORBA C language mapping 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: Michael Meeks <michael@ximian.com>
19 */
20
21#include "everything.h"
22#include "constants.h"
23#include <stdio.h>
24
25static
26CORBA_Object
27ContextServer_opWithContext (PortableServer_Servant _servant,
28 const CORBA_Object inArg,
29 CORBA_Object *inoutArg,
30 CORBA_Object *outArg,
31 CORBA_Context ctx,
32 CORBA_Environment *ev)
33{
34 CORBA_NVList nvout;
35 CORBA_NamedValue *nv;
36 char *val;
37 int i;
38
39 CORBA_Context_get_values (ctx, NULL, 0, "", &nvout, ev);
40
41 g_assert (ev->_major == CORBA_NO_EXCEPTION);
42 g_assert (nvout->list->len == 2);
43
44 for (i = 0; i < nvout->list->len; i++) {
45 nv = &g_array_index (nvout->list,
46 CORBA_NamedValue, 0);
47 if (!strcmp (nv->name, "bar")) {
48 val = * (char **) nv->argument._value;
49 g_assert (!strcmp (val, "baaaa"));
50 } else if (!strcmp (nv->name, "foo")) {
51 val = * (char **) nv->argument._value;
52 g_assert (!strcmp (val, "foo2"));
53 } else
54 g_error ("Unknown context property '%s'", nv->name);
55 }
56
57 CORBA_NVList_free (nvout, ev);
58 g_assert (ev->_major == CORBA_NO_EXCEPTION);
59
60 *outArg = CORBA_OBJECT_NIL;
61
62 return CORBA_Object_duplicate (inArg, ev);
63}
64
65POA_test_ContextServer__epv ContextServer_epv = {
66 NULL,
67 ContextServer_opWithContext,
68};
69
70PortableServer_ServantBase__epv ContextServer_base_epv = {NULL, simple_finalize, NULL};
71POA_test_ContextServer__vepv ContextServer_vepv = { &ContextServer_base_epv, &ContextServer_epv };
Note: See TracBrowser for help on using the repository browser.