diff options
author | Niclas Eklund <[email protected]> | 2010-09-20 13:25:26 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2010-09-21 15:35:34 +0200 |
commit | 5ddf44bb91540fd88e604f077d71482c40185cd8 (patch) | |
tree | a9fb6b22a3428444f684848accb1c5181bd32d70 /lib/orber/test/iiop_module_test_impl.erl | |
parent | cedcfd6364a9ee2f36ea09b5995613375d7ab9ae (diff) | |
download | otp-5ddf44bb91540fd88e604f077d71482c40185cd8.tar.gz otp-5ddf44bb91540fd88e604f077d71482c40185cd8.tar.bz2 otp-5ddf44bb91540fd88e604f077d71482c40185cd8.zip |
Add test suites for (most) CORBA applications
Diffstat (limited to 'lib/orber/test/iiop_module_test_impl.erl')
-rw-r--r-- | lib/orber/test/iiop_module_test_impl.erl | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/lib/orber/test/iiop_module_test_impl.erl b/lib/orber/test/iiop_module_test_impl.erl new file mode 100644 index 0000000000..fe334e1b26 --- /dev/null +++ b/lib/orber/test/iiop_module_test_impl.erl @@ -0,0 +1,128 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +%% + +-module(iiop_module_test_impl). +-include_lib("orber/include/corba.hrl"). +-include("idl_output/iiop_module.hrl"). + + +-export([send_void/1, send_short/3, send_ushort/3]). +-export([send_long/3, send_ulong/3, send_float/3]). +-export([send_double/3, send_boolean/3, send_char/3]). +-export([send_octet/3, send_any/3, send_object/3]). +-export([send_struct1/3, send_union1/3, send_enum1/3]). +-export([send_string/3, send_sequence1/3, send_array1/3]). +-export([ret_systemexception/1, ret_userexception/1]). + + + +-export([start/0, stop/0]). +-export([init/1, terminate/2]). + + +init(_) -> + {ok, []}. + +terminate(Reason, _State) -> + io:format("~p terminating with reason ~p~n", [?MODULE, Reason]), + ok. + + +start() -> + SFok = corba:create('iiop_module_test', "IDL:iiop_module/test:1.0"), + NS = corba:resolve_initial_references("NameService"), + NC1 = lname_component:set_id(lname_component:create(), "iiop_test"), + NC2 = lname_component:set_id(lname_component:create(), "erl_test"), + N = lname:insert_component(lname:create(), 1, NC1), + N1 = lname:insert_component(N, 2, NC2), + 'CosNaming_NamingContext':bind(NS, N1, SFok), + SFok. + +stop() -> + NS = corba:resolve_initial_references("NameService"), + NC1 = lname_component:set_id(lname_component:create(), "iiop_test"), + NC2 = lname_component:set_id(lname_component:create(), "erl_test"), + N = lname:insert_component(lname:create(), 1, NC1), + N1 = lname:insert_component(N, 2, NC2), + 'CosNaming_NamingContext':unbind(NS, N1). + + + +send_void(S) -> + {ok, S}. + +send_short(S, P1, P2) -> + {{P1, P1, P2}, S}. + +send_ushort(S, P1, P2) -> + {{P1, P1, P2}, S}. + +send_long(S, P1, P2) -> + {{P1, P1, P2}, S}. + +send_ulong(S, P1, P2) -> + {{P1, P1, P2}, S}. + +send_float(S, P1, P2) -> + {{P1, P1, P2}, S}. + +send_double(S, P1, P2) -> + {{P1, P1, P2}, S}. + +send_boolean(S, P1, P2) -> + {{P1, P1, P2}, S}. + +send_char(S, P1, P2) -> + {{P1, P1, P2}, S}. + +send_octet(S, P1, P2) -> + {{P1, P1, P2}, S}. + +send_any(S, P1, P2) -> + {{P1, P1, P2}, S}. + +send_object(S, P1, P2) -> + {{P1, P1, P2}, S}. + +send_struct1(S, P1, P2) -> + {{P1, P1, P2}, S}. + +send_union1(S, P1, P2) -> + {{P1, P1, P2}, S}. + +send_enum1(S, P1, P2) -> + {{P1, P1, P2}, S}. + +send_string(S, P1, P2) -> + {{P1, P1, P2}, S}. + +send_sequence1(S, P1, P2) -> + {{P1, P1, P2}, S}. + +send_array1(S, P1, P2) -> + {{P1, P1, P2}, S}. + +ret_systemexception(S) -> + throw(#'BAD_PARAM'{}), + {ok, S}. + +ret_userexception(S) -> + throw(#iiop_module_Except1{why="not readable",rest_of_name=["foo", "bar"]}), + {ok, S}. |