4
%% Copyright Ericsson AB 1998-2010. All Rights Reserved.
6
%% The contents of this file are subject to the Erlang Public License,
7
%% Version 1.1, (the "License"); you may not use this file except in
8
%% compliance with the License. You should have received a copy of the
9
%% Erlang Public License along with this software. If not, it can be
10
%% retrieved online at http://www.erlang.org/.
12
%% Software distributed under the License is distributed on an "AS IS"
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
%% the License for the specific language governing rights and limitations
21
-module(iiop_module_do_test_impl).
24
-export([run_all/3, run_userexception/2, run_systemexception/2]).
25
-export([createTestContext/0]).
27
-export([start/0, stop/0]).
28
-export([init/1, terminate/2]).
34
terminate(Reason, _State) ->
35
io:format("~p terminating with reason ~p~n", [?MODULE, Reason]),
38
createTestContext() ->
39
NS = corba:resolve_initial_references("NameService"),
40
NC = lname_component:set_id(lname_component:create(), "iiop_test"),
41
N = lname:insert_component(lname:create(), 1, NC),
42
'CosNaming_NamingContext':bind_new_context(NS, N).
45
SFok = corba:create('iiop_module_do_test', "IDL:iiop_module/do_test:1.0"),
46
NS = corba:resolve_initial_references("NameService"),
47
NC1 = lname_component:set_id(lname_component:create(), "iiop_test"),
48
NC2 = lname_component:set_id(lname_component:create(), "erl_dotest"),
49
N = lname:insert_component(lname:create(), 1, NC1),
50
N1 = lname:insert_component(N, 2, NC2),
51
'CosNaming_NamingContext':bind(NS, N1, SFok),
55
NS = corba:resolve_initial_references("NameService"),
56
NC1 = lname_component:set_id(lname_component:create(), "iiop_test"),
57
NC2 = lname_component:set_id(lname_component:create(), "erl_dotest"),
58
N = lname:insert_component(lname:create(), 1, NC1),
59
N1 = lname:insert_component(N, 2, NC2),
60
'CosNaming_NamingContext':unbind(NS, N1).
63
ok = iiop_module_test:send_void(X),
64
{tk_short, P1} = lists:nth(1, TL),
65
{R1, IO1, O1} = iiop_module_test:send_short(X, P1, P1),
66
RL1= [{tk_short, R1}],
67
IOL1= [{tk_short, IO1}],
68
OL1= [{tk_short, O1}],
69
{tk_ushort, P2} = lists:nth(2, TL),
70
{R2, IO2, O2} = iiop_module_test:send_ushort(X, P2, P2),
71
RL2= [{tk_ushort, R2}|RL1],
72
IOL2= [{tk_ushort, IO2}|IOL1],
73
OL2= [{tk_ushort, O2}|OL1],
74
{tk_long, P3} = lists:nth(3, TL),
75
{R3, IO3, O3} = iiop_module_test:send_long(X, P3, P3),
76
RL3= [{tk_long, R3}|RL2],
77
IOL3= [{tk_long, IO3}|IOL2],
78
OL3= [{tk_long, O3}|OL2],
79
{tk_ulong, P4} = lists:nth(4, TL),
80
{R4, IO4, O4} = iiop_module_test:send_ulong(X, P4, P4),
81
RL4= [{tk_ulong, R4}|RL3],
82
IOL4= [{tk_ulong, IO4}|IOL3],
83
OL4= [{tk_ulong, O4}|OL3],
84
{tk_float, P5} = lists:nth(5, TL),
85
{R5, IO5, O5} = iiop_module_test:send_float(X, P5, P5),
86
RL5= [{tk_float, R5}|RL4],
87
IOL5= [{tk_float, IO5}|IOL4],
88
OL5= [{tk_float, O5}|OL4],
89
{tk_double, P6} = lists:nth(6, TL),
90
{R6, IO6, O6} = iiop_module_test:send_double(X, P6, P6),
91
RL6= [{tk_double, R6}|RL5],
92
IOL6= [{tk_double, IO6}|IOL5],
93
OL6= [{tk_double, O6}|OL5],
94
{tk_boolean, P7} = lists:nth(7, TL),
95
{R7, IO7, O7} = iiop_module_test:send_boolean(X, P7, P7),
96
RL7= [{tk_boolean, R7}|RL6],
97
IOL7= [{tk_boolean, IO7}|IOL6],
98
OL7= [{tk_boolean, O7}|OL6],
99
{tk_char, P8} = lists:nth(8, TL),
100
{R8, IO8, O8} = iiop_module_test:send_char(X, P8, P8),
101
RL= [{tk_char, R8} |RL7],
102
IOL= [{tk_char, IO8} |IOL7],
103
OL= [{tk_char, O8} |OL7],
104
{{lists:reverse(RL),lists:reverse(IOL),lists:reverse(OL)}, S}.
106
run_systemexception(S, X) ->
107
iiop_module_test:ret_systemexception(X),
110
run_userexception(S, X) ->
111
iiop_module_test:ret_userexception(X),