1: %%
    2: %% %CopyrightBegin%
    3: %%
    4: %% Copyright Ericsson AB 1999-2011. All Rights Reserved.
    5: %%
    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/.
   11: %%
   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
   15: %% under the License.
   16: %%
   17: %% %CopyrightEnd%
   18: %%
   19: %%
   20: 
   21: -module(multi_ORB_SUITE).
   22: 
   23: -include_lib("test_server/include/test_server.hrl").
   24: -include_lib("orber/include/corba.hrl").
   25: -include_lib("orber/COSS/CosNaming/CosNaming.hrl").
   26: -include_lib("orber/src/orber_iiop.hrl").
   27: -include_lib("orber/src/ifr_objects.hrl").
   28: -include("idl_output/orber_test_server.hrl").
   29: -include_lib("orber/COSS/CosNaming/CosNaming_NamingContextExt.hrl").
   30: -include_lib("orber/COSS/CosNaming/CosNaming_NamingContext.hrl").
   31: 
   32: 
   33: -define(default_timeout, ?t:minutes(15)).
   34: 
   35: -define(match(ExpectedRes,Expr),
   36: 	fun() ->
   37: 	       AcTuAlReS = (catch (Expr)),
   38: 	       case AcTuAlReS of
   39: 		   ExpectedRes ->
   40: 		       io:format("------ CORRECT RESULT ------~n~p~n",
   41: 				 [AcTuAlReS]),
   42: 		       AcTuAlReS;
   43: 		   _ ->
   44: 		       io:format("###### ERROR ERROR ######~nRESULT:  ~p~n",
   45: 				 [AcTuAlReS]),
   46: 		       ?line exit(AcTuAlReS)
   47: 	       end
   48:        end()).
   49: 
   50: %%-----------------------------------------------------------------
   51: %% External exports
   52: %%-----------------------------------------------------------------
   53: -export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, cases/0,
   54: 	 init_per_suite/1, end_per_suite/1, basic_PI_api/1, multi_orber_api/1,
   55: 	 init_per_testcase/2, end_per_testcase/2, multi_pseudo_orber_api/1,
   56: 	 light_orber_api/1, light_orber2_api/1,
   57: 	 ssl_1_multi_orber_api/1, ssl_2_multi_orber_api/1, ssl_reconfigure_api/1,
   58: 	 iiop_timeout_api/1, iiop_timeout_added_api/1, setup_connection_timeout_api/1,
   59: 	 setup_multi_connection_timeout_api/1, setup_multi_connection_timeout_random_api/1,
   60: 	 setup_multi_connection_timeout_attempts_api/1,
   61: 	 fragments_server_api/1, fragments_max_server_api/1,
   62: 	 fragments_max_server_added_api/1, fragments_client_api/1,
   63: 	 light_ifr_api/1, max_requests_api/1, max_requests_added_api/1,
   64: 	 max_connections_api/1, max_packet_size_exceeded_api/1,
   65: 	 max_packet_size_ok_api/1, proxy_interface_api/1, proxy_interface_ipv6_api/1,
   66: 	 multiple_accept_api/1, implicit_context_api/1,
   67: 	 pseudo_implicit_context_api/1, pseudo_two_implicit_context_api/1,
   68: 	 oneway_implicit_context_api/1, implicit_context_roundtrip_api/1,
   69: 	 oneway_pseudo_implicit_context_api/1, flags_added_api/1,
   70: 	 oneway_pseudo_two_implicit_context_api/1,
   71: 	 local_interface_api/1, local_interface_ctx_override_api/1,
   72: 	 local_interface_acl_override_api/1, bad_giop_header_api/1,
   73: 	 bad_fragment_id_client_api/1, bad_id_cancel_request_api/1,
   74: 	 close_connections_api/1, close_connections_local_interface_api/1,
   75: 	 close_connections_local_interface_ctx_override_api/1,
   76: 	 ssl_1_multi_orber_generation_3_api/1, ssl_2_multi_orber_generation_3_api/1,
   77: 	 ssl_reconfigure_generation_3_api/1,
   78: 	 close_connections_alt_iiop_addr_api/1, close_connections_multiple_profiles_api/1]).
   79: 
   80: 
   81: %%-----------------------------------------------------------------
   82: %% Internal exports
   83: %%-----------------------------------------------------------------
   84: -export([pseudo_calls/2, pseudo_casts/2, create_fake_server_ORB/5, do_connect/3]).
   85: 
   86: %%-----------------------------------------------------------------
   87: %% Func: all/1
   88: %% Args:
   89: %% Returns:
   90: %%-----------------------------------------------------------------
   91: suite() -> [{ct_hooks,[ts_install_cth]}].
   92: 
   93: all() ->
   94:     cases().
   95: 
   96: groups() ->
   97:     [].
   98: 
   99: init_per_group(_GroupName, Config) ->
  100:     Config.
  101: 
  102: end_per_group(_GroupName, Config) ->
  103:     Config.
  104: 
  105: 
  106: %% NOTE - the fragment test cases must be first since we explicitly set a request
  107: %% id. Otherwise, the request-id counter would be increased and we cannot know
  108: %% what it is.
  109: cases() ->
  110:     [fragments_server_api, fragments_max_server_api,
  111:      fragments_max_server_added_api, fragments_client_api,
  112:      flags_added_api, bad_fragment_id_client_api,
  113:      bad_giop_header_api, bad_id_cancel_request_api,
  114:      implicit_context_api, pseudo_implicit_context_api,
  115:      pseudo_two_implicit_context_api,
  116:      implicit_context_roundtrip_api,
  117:      oneway_implicit_context_api,
  118:      oneway_pseudo_implicit_context_api,
  119:      oneway_pseudo_two_implicit_context_api,
  120:      proxy_interface_api, proxy_interface_ipv6_api,
  121:      local_interface_api, local_interface_ctx_override_api,
  122:      local_interface_acl_override_api, close_connections_api,
  123:      close_connections_local_interface_api,
  124:      close_connections_local_interface_ctx_override_api,
  125:      close_connections_alt_iiop_addr_api,
  126:      close_connections_multiple_profiles_api,
  127:      multiple_accept_api, max_requests_api,
  128:      max_requests_added_api, max_connections_api,
  129:      max_packet_size_exceeded_api, max_packet_size_ok_api,
  130:      light_ifr_api, multi_pseudo_orber_api, multi_orber_api,
  131:      light_orber_api, light_orber2_api, basic_PI_api,
  132:      iiop_timeout_api, iiop_timeout_added_api,
  133:      setup_connection_timeout_api,
  134:      setup_multi_connection_timeout_api,
  135:      setup_multi_connection_timeout_attempts_api,
  136:      setup_multi_connection_timeout_random_api,
  137:      ssl_1_multi_orber_api,
  138:      ssl_1_multi_orber_generation_3_api,
  139:      ssl_2_multi_orber_api,
  140:      ssl_2_multi_orber_generation_3_api,
  141:      ssl_reconfigure_api,
  142:      ssl_reconfigure_generation_3_api].
  143: 
  144: %%-----------------------------------------------------------------
  145: %% Init and cleanup functions.
  146: %%-----------------------------------------------------------------
  147: init_per_testcase(TC,Config)
  148:   when TC =:= ssl_1_multi_orber_api;
  149:        TC =:= ssl_2_multi_orber_api;
  150:        TC =:= ssl_reconfigure_api ->
  151:     init_ssl(Config);
  152: init_per_testcase(TC,Config)
  153:   when TC =:= ssl_1_multi_orber_generation_3_api;
  154:        TC =:= ssl_2_multi_orber_generation_3_api;
  155:        TC =:= ssl_reconfigure_generation_3_api ->
  156:     init_ssl_3(Config);
  157: init_per_testcase(_Case, Config) ->
  158:     init_all(Config).
  159: 
  160: init_ssl(Config) ->
  161:     case  ?config(crypto_started, Config) of
  162: 	true ->
  163: 	    case orber_test_lib:ssl_version() of
  164: 		no_ssl ->
  165: 		    {skip, "SSL is not installed!"};
  166: 		_ ->
  167: 		    init_all(Config)
  168: 	    end;
  169: 	false ->
  170: 	    {skip, "Crypto did not start"}
  171:     end.
  172: 
  173: init_ssl_3(Config) ->
  174:     case  ?config(crypto_started, Config) of
  175: 	true ->
  176: 	    case orber_test_lib:ssl_version() of
  177: 		3 ->
  178: 		    init_all(Config);
  179: 		2 ->
  180: 		    {skip, "Could not find the correct SSL version!"};
  181: 		no_ssl ->
  182: 		    {skip, "SSL is not installed!"}
  183: 	    end;
  184: 	false ->
  185: 	    {skip, "Crypto did not start"}
  186:     end.
  187: 
  188: init_all(Config) ->
  189:     Path = code:which(?MODULE),
  190:     code:add_pathz(filename:join(filename:dirname(Path), "idl_output")),
  191:     Dog=test_server:timetrap(?default_timeout),
  192:     orber:jump_start(0),
  193:     oe_orber_test_server:oe_register(),
  194:     [{watchdog, Dog}|Config].
  195: 
  196: 
  197: end_per_testcase(_Case, Config) ->
  198:     oe_orber_test_server:oe_unregister(),
  199:     orber:jump_stop(),
  200:     Path = code:which(?MODULE),
  201:     code:del_path(filename:join(filename:dirname(Path), "idl_output")),
  202:     Dog = ?config(watchdog, Config),
  203:     test_server:timetrap_cancel(Dog),
  204:     ok.
  205: 
  206: init_per_suite(Config) ->
  207:     if
  208: 	is_list(Config) ->
  209:             try crypto:start() of
  210:                 ok ->
  211: 		    [{crypto_started, true} | Config]
  212:             catch _:_ ->
  213: 	       [{crypto_started, false} | Config]
  214:             end;
  215: 	true ->
  216: 	    exit("Config not a list")
  217:     end.
  218: 
  219: end_per_suite(Config) ->
  220:     application:stop(crypto),    
  221:     Config.
  222: 
  223: %%-----------------------------------------------------------------
  224: %%  API tests for ORB to ORB, no security
  225: %%-----------------------------------------------------------------
  226: 
  227: implicit_context_api(doc) -> ["IIOP Implicit Contex tests"];
  228: implicit_context_api(suite) -> [];
  229: implicit_context_api(_Config) ->
  230:     IP = orber_test_lib:get_host(),
  231:     Loopback = orber_test_lib:get_loopback_interface(),
  232:     {ok, ServerNode, _ServerHost} =
  233: 	?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE},
  234: 						 {ip_address, IP}])),
  235:     ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
  236:     %% Create a remote server
  237:     ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
  238: 					   install_test_data,
  239: 					   [nameservice])),
  240:     IOR = ?match(#'IOP_IOR'{},
  241: 		 corba:string_to_object("corbaname::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService#mamba")),
  242: 
  243:     Relay = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([])),
  244:     ?match(ok,
  245: 	   orber_test_server:
  246: 	   relay_call(Relay,
  247: 		      [{context,
  248: 			[#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
  249: 					       context_data = {interface,
  250: 							       Loopback}}]}],
  251: 		      IOR)),
  252: 
  253:     ?match([_,_], orber:iiop_connections(out)),
  254:     Conns = ?match([_,_],
  255: 		   orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])),
  256:     ?match(true, lists:keymember(Loopback, 1, Conns)),
  257:     ok.
  258: 
  259: implicit_context_roundtrip_api(doc) ->
  260:     ["IIOP Implicit Contex roundtrip tests"];
  261: implicit_context_roundtrip_api(suite) -> [];
  262: implicit_context_roundtrip_api(_Config) ->
  263:     IP = orber_test_lib:get_host(),
  264:     Loopback = orber_test_lib:get_loopback_interface(),
  265:     {ok, ServerNode, _ServerHost} =
  266: 	?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE},
  267: 						 {ip_address, IP}])),
  268:     ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
  269:     %% Create a remote server
  270:     ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
  271: 					   install_test_data,
  272: 					   [nameservice])),
  273:     Relay = ?match(#'IOP_IOR'{},
  274: 		   corba:string_to_object("corbaname::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService#mamba")),
  275: 
  276:     IOR = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([], [])),
  277:     ?match(ok,
  278: 	   orber_test_server:
  279: 	   relay_call(Relay,
  280: 		      [{context,
  281: 			[#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
  282: 					       context_data = {interface,
  283: 							       Loopback}}]}],
  284: 		      IOR)),
  285:     ?match([_,_], orber:iiop_connections(out)),
  286:     Conns = ?match([_,_],
  287: 		   orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])),
  288:     ?match(true, lists:keymember(Loopback, 1, Conns)),
  289:     ok.
  290: 
  291: 
  292: 
  293: oneway_implicit_context_api(doc) -> ["IIOP Implicit Contex oneway tests"];
  294: oneway_implicit_context_api(suite) -> [];
  295: oneway_implicit_context_api(_Config) ->
  296:     IP = orber_test_lib:get_host(),
  297:     Loopback = orber_test_lib:get_loopback_interface(),
  298:     {ok, ServerNode, _ServerHost} =
  299: 	?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE},
  300: 						 {ip_address, IP}])),
  301:     ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
  302:     %% Create a remote server
  303:     ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
  304: 					   install_test_data,
  305: 					   [nameservice])),
  306:     IOR = ?match(#'IOP_IOR'{},
  307: 		 corba:string_to_object("corbaname::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService#mamba")),
  308: 
  309:     Relay = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([])),
  310:     ?match(ok,
  311: 	   orber_test_server:
  312: 	   relay_cast(Relay,
  313: 		      [{context,
  314: 			[#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
  315: 					       context_data = {interface,
  316: 							       Loopback}}]}],
  317: 		      IOR)),
  318: 
  319:     %% We must wait for a few seconds for the client to be able to set up the
  320:     %% connection (since it's a oneway operation).
  321:     timer:sleep(5000),
  322:     ?match([_,_], orber:iiop_connections(out)),
  323:     Conns = ?match([_,_],
  324: 		   orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])),
  325:     ?match(true, lists:keymember(Loopback, 1, Conns)),
  326:     ok.
  327: 
  328: 
  329: pseudo_implicit_context_api(doc) -> ["IIOP Implicit Contex tests (via pseudo object)"];
  330: pseudo_implicit_context_api(suite) -> [];
  331: pseudo_implicit_context_api(_Config) ->
  332:     IP = orber_test_lib:get_host(),
  333:     Loopback = orber_test_lib:get_loopback_interface(),
  334:     {ok, ServerNode, _ServerHost} =
  335: 	?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE},
  336: 						 {ip_address, IP}])),
  337:     ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
  338:     %% Create a remote server
  339:     ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
  340: 					   install_test_data,
  341: 					   [nameservice])),
  342:     IOR = ?match(#'IOP_IOR'{},
  343: 		 corba:string_to_object("corbaname::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService#mamba")),
  344: 
  345:     Relay = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([], [{pseudo,true}])),
  346:     ?match(ok,
  347: 	   orber_test_server:
  348: 	   relay_call(Relay,
  349: 		      [{context,
  350: 			[#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
  351: 					       context_data = {interface,
  352: 							       Loopback}}]}],
  353: 		      IOR)),
  354:     ?match([_,_], orber:iiop_connections(out)),
  355:     Conns = ?match([_,_],
  356: 		   orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])),
  357:     ?match(true, lists:keymember(Loopback, 1, Conns)),
  358:     ok.
  359: 
  360: pseudo_two_implicit_context_api(doc) ->
  361:     ["IIOP two Implicit Contex tests (via pseudo object)"];
  362: pseudo_two_implicit_context_api(suite) -> [];
  363: pseudo_two_implicit_context_api(_Config) ->
  364:     IP = orber_test_lib:get_host(),
  365:     Loopback = orber_test_lib:get_loopback_interface(),
  366:     {ok, ServerNode, _ServerHost} =
  367: 	?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE},
  368: 						 {ip_address, IP}])),
  369:     ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
  370:     %% Create a remote server
  371:     ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
  372: 					   install_test_data,
  373: 					   [nameservice])),
  374:     IOR = ?match(#'IOP_IOR'{},
  375: 		 corba:string_to_object("corbaname::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService#mamba")),
  376: 
  377:     Relay = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([], [{pseudo,true}])),
  378:     put(oe_server_in_context,
  379: 	[#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
  380: 			       context_data = {interface,
  381: 					       IP}}]),
  382:     ?match(ok,
  383: 	   orber_test_server:
  384: 	   relay_call(Relay,
  385: 		      [{context,
  386: 			[#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
  387: 					       context_data = {interface,
  388: 							       Loopback}}]}],
  389: 		      IOR)),
  390:     ?match([_,_], orber:iiop_connections(out)),
  391:     Conns = ?match([_,_],
  392: 		   orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])),
  393:     ?match(true, lists:keymember(Loopback, 1, Conns)),
  394:     ok.
  395: 
  396: oneway_pseudo_implicit_context_api(doc) -> ["IIOP Implicit Contex tests (via pseudo object oneway)"];
  397: oneway_pseudo_implicit_context_api(suite) -> [];
  398: oneway_pseudo_implicit_context_api(_Config) ->
  399:     IP = orber_test_lib:get_host(),
  400:     Loopback = orber_test_lib:get_loopback_interface(),
  401:     {ok, ServerNode, _ServerHost} =
  402: 	?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE},
  403: 						 {ip_address, IP}])),
  404:     ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
  405:     %% Create a remote server
  406:     ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
  407: 					   install_test_data,
  408: 					   [nameservice])),
  409:     IOR = ?match(#'IOP_IOR'{},
  410: 		 corba:string_to_object("corbaname::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService#mamba")),
  411: 
  412:     Relay = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([], [{pseudo,true}])),
  413:     ?match(ok,
  414: 	   orber_test_server:
  415: 	   relay_cast(Relay,
  416: 		      [{context,
  417: 			[#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
  418: 					       context_data = {interface,
  419: 							       Loopback}}]}],
  420: 		      IOR)),
  421:     ?match([_,_], orber:iiop_connections(out)),
  422:     Conns = ?match([_,_],
  423: 		   orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])),
  424:     ?match(true, lists:keymember(Loopback, 1, Conns)),
  425:     ok.
  426: 
  427: oneway_pseudo_two_implicit_context_api(doc) ->
  428:     ["IIOP two Implicit Contex tests (via pseudo object oneway)"];
  429: oneway_pseudo_two_implicit_context_api(suite) -> [];
  430: oneway_pseudo_two_implicit_context_api(_Config) ->
  431:     IP = orber_test_lib:get_host(),
  432:     Loopback = orber_test_lib:get_loopback_interface(),
  433:     {ok, ServerNode, _ServerHost} =
  434: 	?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE},
  435: 						 {ip_address, IP}])),
  436:     ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
  437:     %% Create a remote server
  438:     ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
  439: 					   install_test_data,
  440: 					   [nameservice])),
  441:     IOR = ?match(#'IOP_IOR'{},
  442: 		 corba:string_to_object("corbaname::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService#mamba")),
  443: 
  444:     Relay = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([], [{pseudo,true}])),
  445:     %% Add incoming implicit context which must be removed.
  446:     put(oe_server_in_context,
  447: 	[#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
  448: 			       context_data = {interface,
  449: 					       IP}}]),
  450:     ?match(ok,
  451: 	   orber_test_server:
  452: 	   relay_cast(Relay,
  453: 		      [{context,
  454: 			[#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
  455: 					       context_data = {interface,
  456: 							       Loopback}}]}],
  457: 		      IOR)),
  458:     ?match([_,_], orber:iiop_connections(out)),
  459:     Conns = ?match([_,_],
  460: 		   orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])),
  461:     ?match(true, lists:keymember(Loopback, 1, Conns)),
  462:     ok.
  463: 
  464: 
  465: 
  466: multiple_accept_api(doc) -> ["IIOP Multiple Accept tests"];
  467: multiple_accept_api(suite) -> [];
  468: multiple_accept_api(_Config) ->
  469:     IP = orber_test_lib:get_host(),
  470:     Loopback = orber_test_lib:get_loopback_interface(),
  471:     {ok, ServerNode, _ServerHost} =
  472: 	?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE},
  473: 						 {ip_address, IP}])),
  474:     ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
  475:     %% The server ORB doesn't listen to 127.0.0.1
  476:     ?match({'EXCEPTION',_},
  477: 	   corba:string_to_object("corbaloc::1.2@" ++Loopback++":"++integer_to_list(ServerPort)++"/NameService")),
  478:     ?match([], orber:iiop_connections(out)),
  479: 
  480:     IOR1 = ?match(#'IOP_IOR'{},
  481: 		  corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")),
  482:     ?match({'external', {IP, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}},
  483: 	   iop_ior:get_key(IOR1)),
  484:     ?match([_], orber:iiop_connections(out)),
  485: 
  486:     {ok, Ref1} = ?match({ok, _},
  487: 			orber_test_lib:remote_apply(ServerNode, orber,
  488: 						    add_listen_interface,
  489: 						    [Loopback, normal])),
  490: 
  491:     IOR2 = ?match(#'IOP_IOR'{},
  492: 		  corba:string_to_object("corbaloc::1.2@"++Loopback++":"++integer_to_list(ServerPort)++"/NameService")),
  493:     ?match({'external', {Loopback, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}},
  494: 	   iop_ior:get_key(IOR2)),
  495:     ?match([_,_], orber:iiop_connections(out)),
  496: 
  497:     {ok, Ref2} = ?match({ok, _},
  498: 			orber_test_lib:remote_apply(ServerNode, orber,
  499: 						    add_listen_interface,
  500: 						    [Loopback, normal, 9543])),
  501:     ?match({error, eaddrinuse},
  502: 	   orber_test_lib:remote_apply(ServerNode, orber,
  503: 				       add_listen_interface,
  504: 				       [Loopback, normal, 9543])),
  505: 
  506:     IOR3 = ?match(#'IOP_IOR'{},
  507: 		  corba:string_to_object("corbaloc::1.2@"++Loopback++":9543/NameService")),
  508:     ?match({'external', {Loopback, 9543, _ObjectKey, _Counter, _TP, _NewHD}},
  509: 	   iop_ior:get_key(IOR3)),
  510:     ?match([_,_,_], orber:iiop_connections(out)),
  511: 
  512:     ?match(ok,
  513: 	   orber_test_lib:remote_apply(ServerNode, orber,
  514: 				       remove_listen_interface, [Ref1])),
  515:     %% Wait a few seconds to be sure that the connections really has been removed.
  516:     timer:sleep(4000),
  517:     ?match([_,_], orber:iiop_connections(out)),
  518: 
  519:     ?match(ok,
  520: 	   orber_test_lib:remote_apply(ServerNode, orber,
  521: 				       remove_listen_interface, [Ref2])),
  522:     %% Wait a few seconds to be sure that the connections really has been removed.
  523:     timer:sleep(4000),
  524:     ?match([_], orber:iiop_connections(out)),
  525: 
  526:     ?match({'EXCEPTION',_},
  527: 	   corba:string_to_object("corbaloc::1.2@"++Loopback++":9543/NameService")),
  528:     ?match({'EXCEPTION',_},
  529: 	   corba:string_to_object("corbaloc::1.2@"++Loopback++":"++integer_to_list(ServerPort)++"/NameService")),
  530: 
  531:     IOR4 = ?match(#'IOP_IOR'{},
  532: 		  corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")),
  533:     ?match({'external', {IP, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}},
  534: 	   iop_ior:get_key(IOR4)),
  535: 
  536:     ok.
  537: 
  538: 
  539: proxy_interface_api(doc) -> ["IIOP Proxy Interface tests",
  540: 			     "This case test if the server ORB use the correct",
  541: 			     "interface when exporting IOR:s"];
  542: proxy_interface_api(suite) -> [];
  543: proxy_interface_api(_Config) ->
  544:     IP = orber_test_lib:get_host(),
  545:     Loopback = orber_test_lib:get_loopback_interface(),
  546:     {ok, ServerNode, _ServerHost} =
  547: 	?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE}])),
  548:     ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
  549:     IOR1 = ?match(#'IOP_IOR'{},
  550: 		  corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")),
  551:     ?match({'external', {IP, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}},
  552: 	   iop_ior:get_key(IOR1)),
  553:     IOR2 = ?match(#'IOP_IOR'{},
  554: 		  corba:string_to_object("corbaloc::1.2@"++Loopback++":"++integer_to_list(ServerPort)++"/NameService")),
  555:     ?match({'external', {Loopback, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}},
  556: 	   iop_ior:get_key(IOR2)),
  557:     ok.
  558: 
  559: proxy_interface_ipv6_api(doc) -> ["IIOP Proxy Interface tests",
  560: 				  "This case test if the server ORB use the correct",
  561: 				  "IPv6 interface when exporting IOR:s"];
  562: proxy_interface_ipv6_api(suite) -> [];
  563: proxy_interface_ipv6_api(_Config) ->
  564:     case orber_test_lib:version_ok() of
  565: 	true ->
  566: 	    proxy_interface_ipv6_api2();
  567: 	Reason ->
  568: 	    Reason
  569:     end.
  570: 
  571: proxy_interface_ipv6_api2() ->
  572:     Loopback = orber_test_lib:get_loopback_interface(inet6),
  573:     {ok, ServerNode, _ServerHost} =
  574: 	?match({ok,_,_}, orber_test_lib:js_node([{flags, (?ORB_ENV_USE_IPV6 bor
  575: 							  ?ORB_ENV_LOCAL_INTERFACE)}])),
  576:     ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
  577: 
  578:     {ok, ClientNode, _ClientHost} =
  579: 	?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_USE_IPV6}])),
  580: 
  581:     IP = orber_test_lib:remote_apply(ClientNode, orber_test_lib, get_host, []),
  582: 
  583:     IOR1 = ?match(#'IOP_IOR'{},
  584: 		  orber_test_lib:remote_apply(ClientNode, corba, string_to_object,
  585: 					      ["corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService"])),
  586:     ?match({'external', {IP, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}},
  587: 	   orber_test_lib:remote_apply(ClientNode, iop_ior, get_key, [IOR1])),
  588:     IOR2 = ?match(#'IOP_IOR'{},
  589: 		  orber_test_lib:remote_apply(ClientNode, corba, string_to_object,
  590: 					      ["corbaloc::1.2@"++Loopback++":"++integer_to_list(ServerPort)++"/NameService"])),
  591:     ?match({'external', {Loopback, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}},
  592: 	   orber_test_lib:remote_apply(ClientNode, iop_ior, get_key, [IOR2])),
  593:     ok.
  594: 
  595: local_interface_api(doc) -> ["IIOP Local Interface tests",
  596: 			     "This case test if the server ORB use the correct",
  597: 			     "local interface when connecting to another ORB"];
  598: local_interface_api(suite) -> [];
  599: local_interface_api(_Config) ->
  600:     IP = orber_test_lib:get_host(),
  601:     Loopback = orber_test_lib:get_loopback_interface(),
  602:     {ok, ClientNode, _ClientHost} =
  603: 	?match({ok,_,_}, orber_test_lib:js_node([{ip_address_local, Loopback}])),
  604:     Port = orber:iiop_port(),
  605:     ?match(#'IOP_IOR'{},
  606: 	   orber_test_lib:remote_apply(ClientNode, corba, string_to_object,
  607: 				       ["corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService"])),
  608:     [{Loopback, RemotePort}] =
  609: 	?match([{Loopback,_RemotePort}], orber:iiop_connections(in)),
  610: 
  611:     ?match([{IP, Port}],
  612: 	   orber_test_lib:remote_apply(ClientNode, orber,
  613: 				       iiop_connections, [out])),
  614:     ?match([{IP, Port}], orber:find_sockname_by_peername(Loopback,RemotePort)),
  615:     ?match([{Loopback, RemotePort}], orber:find_peername_by_sockname(IP, Port)),
  616: 
  617:     ?match([{Loopback, RemotePort}],
  618: 	   orber_test_lib:remote_apply(ClientNode, orber,
  619: 				       find_sockname_by_peername,
  620: 				       [IP, Port])),
  621:     ?match([{IP, Port}],
  622: 	   orber_test_lib:remote_apply(ClientNode, orber,
  623: 				       find_peername_by_sockname,
  624: 				       [Loopback,RemotePort])),
  625: 
  626: 
  627:     ok.
  628: 
  629: local_interface_ctx_override_api(doc) ->
  630:     ["IIOP Local Interface tests",
  631:      "This case test if the server ORB use the correct",
  632:      "local interface when connecting to another ORB"];
  633: local_interface_ctx_override_api(suite) -> [];
  634: local_interface_ctx_override_api(_Config) ->
  635:     IP = orber_test_lib:get_host(),
  636:     Loopback = orber_test_lib:get_loopback_interface(),
  637:     {ok, ClientNode, _ClientHost} =
  638: 	?match({ok,_,_}, orber_test_lib:js_node([{ip_address_local, IP}])),
  639:     Port = orber:iiop_port(),
  640:     ?match(#'IOP_IOR'{},
  641: 	   orber_test_lib:remote_apply(ClientNode, corba, string_to_object,
  642: 				       ["corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService",
  643: 					[#'IOP_ServiceContext'
  644: 					 {context_id=?ORBER_GENERIC_CTX_ID,
  645: 					  context_data = {interface, Loopback}}]])),
  646:     [{Loopback, RemotePort}] =
  647: 	?match([{Loopback,_RemotePort}], orber:iiop_connections(in)),
  648: 
  649:     ?match([{IP, Port, Loopback}],
  650: 	   orber_test_lib:remote_apply(ClientNode, orber,
  651: 				       iiop_connections, [out])),
  652:     ?match([{IP, Port}], orber:find_sockname_by_peername(Loopback,RemotePort)),
  653:     ?match([{Loopback, RemotePort}], orber:find_peername_by_sockname(IP, Port)),
  654: 
  655:     ?match([{Loopback, RemotePort}],
  656: 	   orber_test_lib:remote_apply(ClientNode, orber,
  657: 				       find_sockname_by_peername,
  658: 				       [IP, Port])),
  659:     ?match([{IP, Port}],
  660: 	   orber_test_lib:remote_apply(ClientNode, orber,
  661: 				       find_peername_by_sockname,
  662: 				       [Loopback,RemotePort])),
  663: 
  664:     ok.
  665: 
  666: local_interface_acl_override_api(doc) ->
  667:     ["IIOP Local Interface tests",
  668:      "This case test if the server ORB use the correct",
  669:      "local interface when connecting to another ORB"];
  670: local_interface_acl_override_api(suite) -> [];
  671: local_interface_acl_override_api(_Config) ->
  672:     IP = orber_test_lib:get_host(),
  673:     Loopback = orber_test_lib:get_loopback_interface(),
  674:     ACL = [{tcp_out, IP ++ "/18", [Loopback]}],
  675:     {ok, ClientNode, _ClientHost} =
  676: 	?match({ok,_,_}, orber_test_lib:js_node([{ip_address_local, IP},
  677: 						 {iiop_acl, ACL},
  678: 						 {flags, ?ORB_ENV_USE_ACL_OUTGOING}])),
  679:     Port = orber:iiop_port(),
  680:     ?match(#'IOP_IOR'{},
  681: 	   orber_test_lib:remote_apply(ClientNode, corba, string_to_object,
  682: 				       ["corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService",
  683: 					[#'IOP_ServiceContext'
  684: 					 {context_id=?ORBER_GENERIC_CTX_ID,
  685: 					  context_data = {interface, IP}}]])),
  686:     ?match([{Loopback,_RemotePort}], orber:iiop_connections(in)),
  687:     ?match(#'IOP_IOR'{},
  688: 	   orber_test_lib:remote_apply(ClientNode, corba, string_to_object,
  689: 				       ["corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService"])),
  690: 
  691:     [{Loopback, RemotePort}] =
  692: 	?match([{Loopback,_RemotePort}], orber:iiop_connections(in)),
  693:     ?match([{IP, Port, IP}], orber_test_lib:remote_apply(ClientNode, orber,
  694: 							 iiop_connections, [out])),
  695:     ?match([{IP, Port}], orber:find_sockname_by_peername(Loopback,RemotePort)),
  696:     ?match([{Loopback, RemotePort}], orber:find_peername_by_sockname(IP, Port)),
  697: 
  698:     ?match([{Loopback, RemotePort}],
  699: 	   orber_test_lib:remote_apply(ClientNode, orber,
  700: 				       find_sockname_by_peername,
  701: 				       [IP, Port])),
  702:     ?match([{IP, Port}],
  703: 	   orber_test_lib:remote_apply(ClientNode, orber,
  704: 				       find_peername_by_sockname,
  705: 				       [Loopback,RemotePort])),
  706: 
  707:     ok.
  708: 
  709: 
  710: iiop_timeout_api(doc) -> ["IIOP TIMEOUT API tests",
  711: 			 "This case test if timeout configuration behaves correctly"];
  712: iiop_timeout_api(suite) -> [];
  713: iiop_timeout_api(_Config) ->
  714: 
  715:     %% Install two secure orber.
  716:     {ok, ClientNode, ClientHost} =
  717: 	?match({ok,_,_}, orber_test_lib:js_node([{iiop_timeout, 6},
  718: 						 {iiop_connection_timeout, 3},
  719: 						 {iiop_in_connection_timeout, 3}])),
  720:     ClientPort = orber_test_lib:remote_apply(ClientNode, orber, iiop_port, []),
  721: 
  722:     {ok, ServerNode, ServerHost} =
  723: 	?match({ok,_,_}, orber_test_lib:js_node([{iiop_timeout, 6},
  724: 						 {iiop_connection_timeout, 3},
  725: 						 {iiop_in_connection_timeout, 12}])),
  726:     ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
  727: 
  728:     ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
  729: 					   install_test_data,
  730: 					   [timeout])),
  731: 
  732:     %% Tell client_orb to interoperate with server_orb.
  733:     ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib,
  734: 					   lookup,
  735: 					   [ServerHost, ServerPort])),
  736:     %% Interop worked fine, perform delay tests.
  737:     ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib,
  738: 					   timeouts,
  739: 					   [ServerHost, ServerPort, 6000])),
  740: 
  741:     %% Create a connection to the "client_orb", which will now act as server.
  742:     ?match({'IOP_IOR',_,_},
  743: 	   corba:string_to_object("corbaloc::1.2@"++ClientHost++":"++integer_to_list(ClientPort)++"/NameService")),
  744:     %% Check that the connection is established.
  745:     ?match([{_, ClientPort}], orber:iiop_connections(out)),
  746:     %% Wait >3 seconds (i.e. iiop_in_connection_timeout) and check if the connection
  747:     %% have been closed.
  748:     timer:sleep(8000),
  749:     ?match([], orber:iiop_connections(out)),
  750: 
  751:     ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
  752: 					   uninstall_test_data,
  753: 					   [timeout])),
  754:     ok.
  755: 
  756: iiop_timeout_added_api(doc) -> ["IIOP TIMEOUT API tests",
  757: 			 "This case test if timeout configuration behaves correctly"];
  758: iiop_timeout_added_api(suite) -> [];
  759: iiop_timeout_added_api(_Config) ->
  760:     IP = orber_test_lib:get_host(),
  761:     {ok, Node, _Host} = ?match({ok,_,_}, orber_test_lib:js_node([])),
  762:     Port = 1 + orber_test_lib:remote_apply(Node, orber, iiop_port, []),
  763:     ?match({ok, _},
  764: 	   orber_test_lib:remote_apply(Node, orber,
  765: 				       add_listen_interface,
  766: 				       [IP, normal,
  767: 					[{iiop_in_connection_timeout, 3},
  768: 					 {flags, ?ORB_ENV_LOCAL_INTERFACE},
  769: 					 {iiop_port, Port}]])),
  770: 
  771:     ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
  772: 					   install_test_data,
  773: 					   [timeout])),
  774: 
  775:     ?match({'IOP_IOR',_,_},
  776: 	   corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService")),
  777:     %% Check that the connection is established.
  778:     ?match([{_, Port}], orber:iiop_connections(out)),
  779:     %% Wait >3 seconds (i.e. iiop_in_connection_timeout) and check if the connection
  780:     %% have been closed.
  781:     timer:sleep(8000),
  782:     ?match([], orber:iiop_connections(out)),
  783: 
  784:     ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
  785: 					   uninstall_test_data,
  786: 					   [timeout])),
  787:     ok.
  788: 
  789: %%-----------------------------------------------------------------
  790: %%  API tests for ORB to ORB using pseudo call/cast, no security
  791: %%-----------------------------------------------------------------
  792: 
  793: multi_pseudo_orber_api(doc) ->
  794:     ["MULTI ORB PSEUDO API tests",
  795:      "This case test if data encode/decode (IIOP) for pseudo objects",
  796:      "produce the correct result, i.e., the test_server echos",
  797:      "the input parameter or an exception is raised (MARSHAL)."];
  798: multi_pseudo_orber_api(suite) -> [];
  799: multi_pseudo_orber_api(_Config) ->
  800:     %% --- Create a slave-node ---
  801:     {ok, Node, Host} =
  802: 	?match({ok,_,_}, orber_test_lib:js_node()),
  803:     Port = orber_test_lib:remote_apply(Node, orber, iiop_port, []),
  804: 
  805:     ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
  806: 					   install_test_data,
  807: 					   [pseudo])),
  808: 
  809:     NSR = ?match({'IOP_IOR',"IDL:omg.org/CosNaming/NamingContextExt:1.0",_},
  810: 		 corba:string_to_object("corbaloc::1.1@"++Host++":"++
  811: 					integer_to_list(Port)++"/NameService")),
  812:     Obj =
  813: 	?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
  814: 	       'CosNaming_NamingContext':resolve(NSR, lname:new(["mamba"]))),
  815:     orber_test_lib:corba_object_tests(Obj, NSR),
  816: 
  817:     %% Can we even contact the object?
  818:     ?match(ok, orber_test_server:print(Obj)),
  819: 
  820:     %% Invoke one blocking call followed by several invokations.
  821:     spawn(?MODULE, pseudo_calls, [5, Obj]),
  822:     ?match({ok, 10000}, orber_test_server:pseudo_call_delay(Obj, 10000)),
  823:     spawn(?MODULE, pseudo_casts, [5, Obj]),
  824:     ?match(ok, orber_test_server:pseudo_cast_delay(Obj, 10000)),
  825: 
  826:     %%--- Testing code and decode arguments ---
  827:     orber_test_lib:test_coding(Obj),
  828: 
  829:     %% Test if exit is handled properly.
  830:     ?match({'EXCEPTION',{'TRANSIENT',_,_,_}},
  831: 	   orber_test_server:stop_brutal(Obj)),
  832: 
  833:     ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
  834: 					   uninstall_test_data,
  835: 					   [pseudo])),
  836:     ok.
  837: 
  838: 
  839: %%-----------------------------------------------------------------
  840: %%  API tests for ORB to ORB with local flags definition set.
  841: %%-----------------------------------------------------------------
  842: flags_added_api(doc) ->
  843:     ["MULTI ORB PSEUDO with local flags definition set"];
  844: flags_added_api(suite) -> [];
  845: flags_added_api(_Config) ->
  846:     %% --- Create a slave-node ---
  847:     IP = orber_test_lib:get_host(),
  848:     {ok, Node, _Host} =
  849: 	?match({ok,_,_}, orber_test_lib:js_node([])),
  850:     Port = 1 + orber_test_lib:remote_apply(Node, orber, iiop_port, []),
  851:     ?match({ok, _},
  852: 	   orber_test_lib:remote_apply(Node, orber,
  853: 				       add_listen_interface,
  854: 				       [IP, normal,
  855: 					[{flags, (?ORB_ENV_LOCAL_INTERFACE bor
  856: 						  ?ORB_ENV_EXCLUDE_CODESET_COMPONENT)},
  857: 					 {iiop_port, Port}]])),
  858: 
  859:     ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
  860: 						 install_test_data,
  861: 						 [pseudo])),
  862:     Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
  863: 		       corba:string_to_object("corbaname::1.1@"++IP++":"++
  864: 					      integer_to_list(Port)++"/NameService#mamba")),
  865:     ?match({'external', {IP, Port, _ObjectKey, _Counter,
  866: 			 #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP,
  867: 					      profile_data=
  868: 					      #'IIOP_ProfileBody_1_1'{components=[]}},
  869: 			 _NewHD}},
  870: 	   iop_ior:get_key(Obj)),
  871:     ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
  872: 						 uninstall_test_data,
  873: 						 [pseudo])),
  874: 
  875:     ok.
  876: 
  877: 
  878: 
  879: %%-----------------------------------------------------------------
  880: %%  API tests for ORB to ORB with limited concurrent requests
  881: %%-----------------------------------------------------------------
  882: max_requests_api(doc) ->
  883:     ["MULTI ORB PSEUDO with limited concurrent requests tests"];
  884: max_requests_api(suite) -> [];
  885: max_requests_api(_Config) ->
  886:     %% --- Create a slave-node ---
  887:     {ok, Node, Host} =
  888: 	?match({ok,_,_}, orber_test_lib:js_node([{iiop_max_in_requests, 1}])),
  889:     Port = orber_test_lib:remote_apply(Node, orber, iiop_port, []),
  890:     max_requests(Node, Host, Port).
  891: 
  892: max_requests_added_api(doc) ->
  893:     ["MULTI ORB PSEUDO with limited concurrent requests tests"];
  894: max_requests_added_api(suite) -> [];
  895: max_requests_added_api(_Config) ->
  896:     %% --- Create a slave-node ---
  897:     [IP] = ?match([_], orber:host()),
  898:     {ok, Node, _Host} =
  899: 	?match({ok,_,_}, orber_test_lib:js_node([])),
  900:     Port = 1 + orber_test_lib:remote_apply(Node, orber, iiop_port, []),
  901:     ?match({ok, _},
  902: 	   orber_test_lib:remote_apply(Node, orber,
  903: 				       add_listen_interface,
  904: 				       [IP, normal,
  905: 					[{iiop_max_in_requests, 1},
  906: 					 {flags, ?ORB_ENV_LOCAL_INTERFACE},
  907: 					 {iiop_port, Port}]])),
  908:     max_requests(Node, IP, Port).
  909: 
  910: max_requests(Node, Host, Port) ->
  911:     ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
  912: 						 install_test_data,
  913: 						 [pseudo])),
  914:     Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
  915: 		       corba:string_to_object("corbaname::1.1@"++Host++":"++
  916: 					      integer_to_list(Port)++"/NameService#mamba")),
  917: 
  918:     %% Can we even contact the object?
  919:     ?match(ok, orber_test_server:print(Obj)),
  920: 
  921:     %% Invoke one blocking call followed by several invokations.
  922:     spawn(orber_test_server, pseudo_call_delay, [Obj, 15000]),
  923:     %% Wait for a second to be sure that the previous request has been sent
  924:     timer:sleep(1000),
  925:     {MegaSecsB, Before, _} = now(),
  926:     pseudo_calls(5, Obj),
  927:     {MegaSecsA, After, _} = now(),
  928:     %% Normally we we can perform hundreds of pseudo-calls per second. Hence,
  929:     %% if we add 8 seconds to 'Before' it should still be less since we only
  930:     %% allow one request at a time to the target ORB.
  931:     ?match(true, (MegaSecsB + (Before+8)*1000000) < (MegaSecsA + After*1000000)),
  932: 
  933:     ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
  934: 						 uninstall_test_data,
  935: 						 [pseudo])),
  936: 
  937:     ok.
  938: 
  939: %%-----------------------------------------------------------------
  940: %%  API tests for ORB to ORB with limited concurrent connections
  941: %%-----------------------------------------------------------------
  942: max_connections_api(doc) ->
  943:     ["MULTI ORB PSEUDO with limited concurrent connections tests"];
  944: max_connections_api(suite) -> [];
  945: max_connections_api(_Config) ->
  946:     %% --- Create a slave-node ---
  947:     {ok, ServerNode, ServerHost} =
  948: 	?match({ok,_,_}, orber_test_lib:js_node([{iiop_backlog, 0},
  949: 						 {iiop_max_in_connections, 2}])),
  950:     ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
  951:     ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
  952: 						 install_test_data,
  953: 						 [nameservice])),
  954: 
  955:     %% Claim connection 1 & 2
  956:     Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
  957: 		       corba:string_to_object("corbaname::1.2@"++ServerHost++":"++
  958: 					      integer_to_list(ServerPort)++"/NameService#mamba")),
  959:     %% Claim backlog
  960:     {ok, ClientNode, _ClientHost} =
  961: 	?match({ok,_,_}, orber_test_lib:js_node()),
  962: 
  963:     spawn(ClientNode, orber_test_server, print, [Obj]),
  964:     timer:sleep(5000),
  965:     ?match([_], orber_test_lib:remote_apply(ClientNode, orber,
  966: 						  iiop_connections, [])),
  967: 
  968:     %% Try to connect. Should fail. Due to the behavior of different TCP stacks, backlog 1
  969:     %% might not be the precise value. Hence, we also need to define the iiop_timeout. Otherwise
  970:     %% this test case will fail. For the same reason we must GC this connection.
  971:     {ok, ClientNodeII, _ClientHostII} =
  972: 	?match({ok,_,_}, orber_test_lib:js_node([{iiop_setup_connection_timeout, 5},
  973: 						 {iiop_timeout, 5},
  974: 						 {iiop_connection_timeout, 8}])),
  975: 
  976:     ?match({'EXCEPTION', _},
  977: 	   orber_test_lib:remote_apply(ClientNodeII, orber_test_server,
  978: 				       testing_iiop_string, [Obj, "Fail"])),
  979: 
  980:     %% Remove 2 connections. We need to wait a moment so that both sides has detected it.
  981:     timer:sleep(5000),
  982:     ?match([_,_], orber:iiop_connections()),
  983:     ?match(ok, orber_iiop_pm:close_connection([{ServerHost, ServerPort}])),
  984:     timer:sleep(5000),
  985:     [{Host, Port}] = ?match([_], orber:iiop_connections()),
  986:     ?match(ok, orber_iiop_pm:close_connection([{Host, Port}])),
  987:     timer:sleep(5000),
  988:     ?match([], orber:iiop_connections()),
  989: 
  990:     ?match([_], orber_test_lib:remote_apply(ClientNode, orber,
  991: 					    iiop_connections, [])),
  992: 
  993:     ?match([], orber_test_lib:remote_apply(ClientNodeII, orber,
  994: 					   iiop_connections, [])),
  995: 
  996:     ?match({ok, "OK"},
  997: 	   orber_test_lib:remote_apply(ClientNodeII, orber_test_server,
  998: 				       testing_iiop_string, [Obj, "OK"])),
  999: 
 1000:     timer:sleep(4000),
 1001:     ?match([_], orber_test_lib:remote_apply(ClientNodeII, orber,
 1002: 					    iiop_connections, [])),
 1003: 
 1004:     ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
 1005: 						 uninstall_test_data,
 1006: 						 [pseudo])),
 1007: 
 1008:     ok.
 1009: 
 1010: 
 1011: %%-----------------------------------------------------------------
 1012: %%  API tests for terminating connection by using an IOR.
 1013: %%-----------------------------------------------------------------
 1014: close_connections_api(doc) ->
 1015:     ["Close outgoing connection "];
 1016: close_connections_api(suite) -> [];
 1017: close_connections_api(_Config) ->
 1018:     %% --- Create a slave-node ---
 1019:     IP = orber_test_lib:get_host(),
 1020:     Loopback = orber_test_lib:get_loopback_interface(),
 1021:     {ok, ServerNode, _ServerHost} =
 1022: 	?match({ok,_,_}, orber_test_lib:js_node([{ip_address, IP}])),
 1023:     ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
 1024:     ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
 1025: 					   install_test_data,
 1026: 					   [nameservice])),
 1027:     orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
 1028:     IP = orber_test_lib:get_host(),
 1029: 
 1030:     %% Create a connection
 1031:     Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
 1032: 		       corba:string_to_object("corbaname::1.2@"++IP++":"++
 1033: 					      integer_to_list(ServerPort)++"/NameService#mamba")),
 1034:     %% Check that it's up.
 1035:     ?match([{IP, ServerPort}], orber:iiop_connections(out)),
 1036:     %% Try to close using the wronge interface.
 1037:     ?match(ok, orber:close_connection(Obj, Loopback)),
 1038:     %% Should still be up.
 1039:     ?match([{IP, ServerPort}], orber:iiop_connections(out)),
 1040:     %% Try to close it properly
 1041:     ?match(ok, orber:close_connection(Obj)),
 1042:     %% Wait a moment so that both sides has detected it.
 1043:     timer:sleep(5000),
 1044:     %% Worked?
 1045:     ?match([], orber:iiop_connections(out)),
 1046:     ok.
 1047: 
 1048: 
 1049: close_connections_local_interface_api(doc) ->
 1050:     ["IIOP Local Interface disconnect tests",
 1051:      "This case test if the server ORB use the correct",
 1052:      "local interface when connecting to another ORB"];
 1053: close_connections_local_interface_api(suite) -> [];
 1054: close_connections_local_interface_api(_Config) ->
 1055:     IP = orber_test_lib:get_host(),
 1056:     Loopback = orber_test_lib:get_loopback_interface(),
 1057:     {ok, ClientNode, _ClientHost} =
 1058: 	?match({ok,_,_}, orber_test_lib:js_node([{ip_address_local, Loopback}])),
 1059:     {ok, ServerNode, _ServerHost} =
 1060: 	?match({ok,_,_}, orber_test_lib:js_node([{ip_address, IP}])),
 1061:     Port = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
 1062:     IOR = ?match(#'IOP_IOR'{},
 1063: 		 orber_test_lib:remote_apply(ClientNode, corba, string_to_object,
 1064: 					     ["corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService"])),
 1065: 
 1066:     %% Check that the connnection is up and running using the default interface
 1067:     ?match([{Loopback,_RemotePort}], orber_test_lib:remote_apply(ServerNode, orber,
 1068: 								 iiop_connections, [in])),
 1069:     ?match([{IP, Port}],
 1070: 	   orber_test_lib:remote_apply(ClientNode, orber,
 1071: 				       iiop_connections, [out])),
 1072:     %% Try to close the connection
 1073:     ?match(ok, orber_test_lib:remote_apply(ClientNode, orber,
 1074: 					   close_connection, [IOR])),
 1075:     %% Wait a moment so that both sides has detected it.
 1076:     timer:sleep(5000),
 1077:     %% Now the connection shall be gone.
 1078:     ?match([], orber_test_lib:remote_apply(ClientNode, orber,
 1079: 					   iiop_connections, [out])),
 1080:     ?match([], orber_test_lib:remote_apply(ServerNode, orber,
 1081: 					   iiop_connections, [in])),
 1082: 
 1083:     ok.
 1084: 
 1085: close_connections_local_interface_ctx_override_api(doc) ->
 1086:     ["IIOP Local Interface disconnect tests",
 1087:      "This case test if the server ORB use the correct",
 1088:      "local interface when connecting to another ORB"];
 1089: close_connections_local_interface_ctx_override_api(suite) -> [];
 1090: close_connections_local_interface_ctx_override_api(_Config) ->
 1091:     IP = orber_test_lib:get_host(),
 1092:     Loopback = orber_test_lib:get_loopback_interface(),
 1093:     {ok, ClientNode, _ClientHost} =
 1094: 	?match({ok,_,_}, orber_test_lib:js_node([{ip_address_local, IP},
 1095: 						 {ip_address, IP}])),
 1096:     {ok, ServerNode, _ServerHost} =
 1097: 	?match({ok,_,_}, orber_test_lib:js_node([{ip_address, IP}])),
 1098:     Port = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
 1099:     IOR = ?match(#'IOP_IOR'{},
 1100: 		 orber_test_lib:remote_apply(ClientNode, corba, string_to_object,
 1101: 					     ["corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService",
 1102: 					      [#'IOP_ServiceContext'
 1103: 					       {context_id=?ORBER_GENERIC_CTX_ID,
 1104: 						context_data = {interface, Loopback}}]])),
 1105: 
 1106:     timer:sleep(2000),
 1107:     %% Check that the connnection is up and running using the default interface
 1108:     ?match([{Loopback,_RemotePort}], orber_test_lib:remote_apply(ServerNode, orber,
 1109: 								 iiop_connections, [in])),
 1110: 
 1111:     ?match([{IP, Port, Loopback}],
 1112: 	   orber_test_lib:remote_apply(ClientNode, orber,
 1113: 				       iiop_connections, [out])),
 1114:     %% Try to close not supplying the interface.
 1115:     ?match(ok, orber_test_lib:remote_apply(ClientNode, orber,
 1116: 					   close_connection, [IOR])),
 1117: 
 1118:     timer:sleep(2000),
 1119:     %% The connection shall still be up and running
 1120:     ?match([{Loopback,_RemotePort}], orber_test_lib:remote_apply(ServerNode, orber,
 1121: 								 iiop_connections, [in])),
 1122:     ?match([{IP, Port, Loopback}],
 1123: 	   orber_test_lib:remote_apply(ClientNode, orber,
 1124: 				       iiop_connections, [out])),
 1125:     %% Try to close not supplying the interface.
 1126:     ?match(ok, orber_test_lib:remote_apply(ClientNode, orber,
 1127: 					   close_connection, [IOR, IP])),
 1128: 
 1129:     timer:sleep(2000),
 1130:     %% The connection shall still be up and running
 1131:     ?match([{Loopback,_RemotePort}], orber_test_lib:remote_apply(ServerNode, orber,
 1132: 								 iiop_connections, [in])),
 1133:     ?match([{IP, Port, Loopback}],
 1134: 	   orber_test_lib:remote_apply(ClientNode, orber,
 1135: 				       iiop_connections, [out])),
 1136: 
 1137:     %% Try to close supplying the correct interface.
 1138:     ?match(ok, orber_test_lib:remote_apply(ClientNode, orber,
 1139: 					   close_connection, [IOR, Loopback])),
 1140:     %% Wait a moment so that both sides has detected it.
 1141:     timer:sleep(5000),
 1142:     %% Now the connection shall be gone.
 1143:     ?match([], orber_test_lib:remote_apply(ServerNode, orber,
 1144: 					   iiop_connections, [in])),
 1145:     ?match([], orber_test_lib:remote_apply(ClientNode, orber,
 1146: 					   iiop_connections, [out])),
 1147:     ok.
 1148: 
 1149: close_connections_alt_iiop_addr_api(doc) ->
 1150:     ["IIOP alternate address disconnect tests",
 1151:      "This case test if the server ORB use the correct",
 1152:      "local interface when connecting to another ORB"];
 1153: close_connections_alt_iiop_addr_api(suite) -> [];
 1154: close_connections_alt_iiop_addr_api(_Config) ->
 1155:     %% --- Create a slave-node ---
 1156:     Loopback = orber_test_lib:get_loopback_interface(),
 1157:     IP = orber_test_lib:get_host(),
 1158:     {ok, ServerNode, _ServerHost} =
 1159: 	?match({ok,_,_}, orber_test_lib:js_node([{giop_version, {1, 2}},
 1160: 						 {ip_address, {multiple, [IP, Loopback]}}])),
 1161:     ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
 1162:     ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
 1163: 					   install_test_data,
 1164: 					   [{nameservice, Loopback, ServerPort}])),
 1165:     %% Create two connections
 1166:     Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
 1167: 		 corba:string_to_object("corbaname::1.2@"++IP++":"++
 1168: 					integer_to_list(ServerPort)++"/NameService#mamba")),
 1169:     ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
 1170: 	   corba:string_to_object("corbaname::1.2@"++Loopback++":"++
 1171: 				  integer_to_list(ServerPort)++"/NameService#mamba")),
 1172:     timer:sleep(2000),
 1173:     %% The connection shall still be up and running
 1174:     ?match([{_,_}, {_,_}], orber:iiop_connections(out)),
 1175:     ?match([{_,_}, {_,_}],
 1176: 	   orber_test_lib:remote_apply(ServerNode, orber,
 1177: 				       iiop_connections, [in])),
 1178: 
 1179:     %% Try to close the connection
 1180:     ?match(ok, orber:close_connection(Obj)),
 1181:     %% Wait a moment so that both sides has detected it.
 1182:     timer:sleep(5000),
 1183:     %% Now the connections shall be gone.
 1184:     ?match([], orber:iiop_connections(out)),
 1185:     ?match([], orber_test_lib:remote_apply(ServerNode, orber,
 1186: 					   iiop_connections, [in])),
 1187:     ok.
 1188: 
 1189: close_connections_multiple_profiles_api(doc) ->
 1190:     ["IIOP alternate address disconnect tests",
 1191:      "This case test if the server ORB use the correct",
 1192:      "local interface when connecting to another ORB"];
 1193: close_connections_multiple_profiles_api(suite) -> [];
 1194: close_connections_multiple_profiles_api(_Config) ->
 1195:     IP = orber_test_lib:get_host(),
 1196:     Loopback = orber_test_lib:get_loopback_interface(),
 1197:     %% --- Create a slave-node ---
 1198:     {ok, ServerNode, _ServerHost} =
 1199: 	?match({ok,_,_}, orber_test_lib:js_node([{ip_address,
 1200: 						  {multiple, [Loopback, IP]}}])),
 1201:     ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
 1202:     ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
 1203: 					   install_test_data, [nameservice])),
 1204:     %% Create two connections
 1205:     Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
 1206: 		 corba:string_to_object("corbaname::1.2@"++IP++":"++
 1207: 					integer_to_list(ServerPort)++"/NameService#mamba")),
 1208:     ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
 1209: 	   corba:string_to_object("corbaname::1.2@"++Loopback++":"++
 1210: 				  integer_to_list(ServerPort)++"/NameService#mamba")),
 1211:     %% The connection shall still be up and running
 1212:     ?match([{_,_}, {_,_}], orber:iiop_connections(out)),
 1213:     ?match([{_,_}, {_,_}],
 1214: 	   orber_test_lib:remote_apply(ServerNode, orber,
 1215: 				       iiop_connections, [in])),
 1216: 
 1217:     %% Try to close the connection
 1218:     ?match(ok, orber:close_connection(Obj)),
 1219:     %% Wait a moment so that both sides has detected it.
 1220:     timer:sleep(5000),
 1221:     %% Now the connections shall be gone.
 1222:     ?match([], orber:iiop_connections(out)),
 1223:     ?match([], orber_test_lib:remote_apply(ServerNode, orber,
 1224: 					   iiop_connections, [in])),
 1225:     ok.
 1226: 
 1227: %%-----------------------------------------------------------------
 1228: %%  API tests for ORB to ORB with iiop_packet_size set
 1229: %%-----------------------------------------------------------------
 1230: max_packet_size_exceeded_api(doc) ->
 1231:     ["Exceed the maximum request size"];
 1232: max_packet_size_exceeded_api(suite) -> [];
 1233: max_packet_size_exceeded_api(_Config) ->
 1234:     case catch gen_tcp:listen(0, [{packet,cdr}, {packet_size, 14}]) of
 1235: 	{'EXIT',badarg} ->
 1236: 	    {skipped, "The inet option {packet_size, Max} not supported"};
 1237: 	{ok, LS} ->
 1238: 	    (catch gen_tcp:close(LS)),
 1239: 	    %% --- Create a slave-node ---
 1240: 	    {ok, ServerNode, ServerHost} =
 1241: 		?match({ok,_,_}, orber_test_lib:js_node([{iiop_packet_size, 1}])),
 1242: 	    ServerPort = orber_test_lib:remote_apply(ServerNode, orber,
 1243: 						     iiop_port, []),
 1244: 	    ?match({'EXCEPTION', #'CosNaming_NamingContextExt_InvalidAddress'{}},
 1245: 		   corba:string_to_object("corbaloc::1.2@"++ServerHost++":"++integer_to_list(ServerPort)++"/NameService")),
 1246: 	    ok
 1247:     end.
 1248: 
 1249: %%-----------------------------------------------------------------
 1250: %%  API tests for ORB to ORB with iiop_packet_size set
 1251: %%-----------------------------------------------------------------
 1252: max_packet_size_ok_api(doc) ->
 1253:     ["Not exceed the maximum request size"];
 1254: max_packet_size_ok_api(suite) -> [];
 1255: max_packet_size_ok_api(_Config) ->
 1256:     case catch gen_tcp:listen(0, [{packet,cdr}, {packet_size, 14}]) of
 1257: 	{'EXIT',badarg} ->
 1258: 	    {skipped, "The inet option {packet_size, Max} not supported"};
 1259: 	{ok, LS} ->
 1260: 	    (catch gen_tcp:close(LS)),
 1261: 	    %% --- Create a slave-node ---
 1262: 	    {ok, ServerNode, ServerHost} =
 1263: 		?match({ok,_,_}, orber_test_lib:js_node([{iiop_packet_size, 5000}])),
 1264: 	    ServerPort = orber_test_lib:remote_apply(ServerNode, orber,
 1265: 						     iiop_port, []),
 1266: 	    ?match({'IOP_IOR',_,_},
 1267: 		   corba:string_to_object("corbaloc::1.2@"++ServerHost++":"++integer_to_list(ServerPort)++"/NameService")),
 1268: 	    ok
 1269:     end.
 1270: 
 1271: 
 1272: 
 1273: %%-----------------------------------------------------------------
 1274: %%  API tests for ORB to ORB, no security
 1275: %%-----------------------------------------------------------------
 1276: 
 1277: light_ifr_api(doc) -> ["LIGHT IFR ORB API tests"];
 1278: light_ifr_api(suite) -> [];
 1279: light_ifr_api(_Config) ->
 1280: 
 1281:     {ok, ClientNode, _ClientHost} =
 1282: 	?match({ok,_,_}, orber_test_lib:js_node([{flags, 128}])),
 1283: 
 1284:     ?match([_,_,_,_], orber_test_lib:remote_apply(ClientNode, orber, get_tables, [])),
 1285:     ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib,
 1286:                                                  install_test_data,
 1287:                                                  [nameservice])),
 1288: 
 1289: 
 1290:     {ok, ServerNode, ServerHost} =
 1291: 	?match({ok,_,_}, orber_test_lib:js_node([{flags, 128}])),
 1292:     ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
 1293:     ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
 1294: 					   install_test_data,
 1295: 					   [nameservice])),
 1296:     ?match([_,_,_,_], orber_test_lib:remote_apply(ServerNode, orber, get_tables, [])),
 1297: 
 1298:     Obj = ?match({'IOP_IOR',_,_},
 1299: 		 corba:string_to_object("corbaname::1.2@"++ServerHost++":"++integer_to_list(ServerPort)++"/NameService#mamba")),
 1300:     ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib, test_coding, [Obj])),
 1301: 
 1302:     ?match(0, orber_test_lib:remote_apply(ClientNode, orber_diagnostics, missing_modules, [])),
 1303: 
 1304:     ?match(ok, orber_test_lib:remote_apply(ClientNode, mnesia, dirty_write,
 1305: 					   [#orber_light_ifr{id = "FakeId1",
 1306: 							     module=non_existing,
 1307: 							     type=?IFR_StructDef}])),
 1308:     ?match(ok, orber_test_lib:remote_apply(ClientNode, mnesia, dirty_write,
 1309: 					   [#orber_light_ifr{id = "FakeId2",
 1310: 							     module=non_existing,
 1311: 							     type=?IFR_UnionDef}])),
 1312:     ?match(ok, orber_test_lib:remote_apply(ClientNode, mnesia, dirty_write,
 1313: 					   [#orber_light_ifr{id = "FakeId3",
 1314: 							     module=non_existing,
 1315: 							     type=?IFR_ExceptionDef}])),
 1316:     ?match(ok, orber_test_lib:remote_apply(ClientNode, mnesia, dirty_write,
 1317: 					   [#orber_light_ifr{id = "FakeId4",
 1318: 							     module=non_existing,
 1319: 							     type=?IFR_InterfaceDef}])),
 1320:     ?match(ok, orber_test_lib:remote_apply(ClientNode, mnesia, dirty_write,
 1321: 					   [#orber_light_ifr{id = "FakeId5",
 1322: 							     module=orber_test_lib,
 1323: 							     type=?IFR_InterfaceDef}])),
 1324:     ?match(5, orber_test_lib:remote_apply(ClientNode, orber_diagnostics, missing_modules, [])),
 1325: 
 1326: 
 1327:     ?match(ok, mnesia:dirty_write(#ir_UnionDef{ir_Internal_ID = "FakedIId1",
 1328: 						     absolute_name="::Module::NonExisting"})),
 1329:     ?match(ok, mnesia:dirty_write(#ir_StructDef{ir_Internal_ID = "FakedIId2",
 1330: 						      absolute_name="::Module::NonExisting"})),
 1331:     ?match(ok, mnesia:dirty_write(#ir_ExceptionDef{ir_Internal_ID = "FakedIId3",
 1332: 							 absolute_name="::Module::NonExisting"})),
 1333:     ?match(ok, mnesia:dirty_write(#ir_InterfaceDef{ir_Internal_ID = "FakedIId4",
 1334: 							 absolute_name="::Module::NonExisting"})),
 1335:     ?match(ok, mnesia:dirty_write(#ir_InterfaceDef{ir_Internal_ID = "FakedIId5",
 1336: 							 absolute_name="::orber::test::lib"})),
 1337: 
 1338:     ?match(5, orber_diagnostics:missing_modules()),
 1339: 
 1340:     ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
 1341: 						 uninstall_test_data,
 1342: 						 [nameservice])),
 1343:     ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib,
 1344: 						 uninstall_test_data,
 1345: 						 [nameservice])),
 1346:     ok.
 1347: 
 1348: %%-----------------------------------------------------------------
 1349: %%  API tests for ORB to ORB, no security
 1350: %%-----------------------------------------------------------------
 1351: 
 1352: light_orber_api(doc) -> ["LIGHT ORB API tests",
 1353: 			 "This case test if a light Orber can communicate correctly",
 1354: 			 "with an fully installed Orber."];
 1355: light_orber_api(suite) -> [];
 1356: light_orber_api(_Config) ->
 1357:     %% --- Create a slave-node ---
 1358:     LocalHost = net_adm:localhost(),
 1359:     {ok, Node, _Host} =
 1360: 	?match({ok,_,_}, orber_test_lib:js_node([{lightweight, ["iiop://"++LocalHost++":"++integer_to_list(orber:iiop_port())]}],
 1361: 						lightweight)),
 1362:     ?match(ok, orber:info(io)),
 1363:     ?match([_], orber_test_lib:remote_apply(Node, orber_env, get_lightweight_nodes,[])),
 1364: 
 1365:     ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
 1366: 						 install_test_data,
 1367: 						 [light])),
 1368: 
 1369:     Obj1=(catch orber_test_server:oe_create(state,[{pseudo,true}])),
 1370:     ?match({_,pseudo,orber_test_server_impl, _,_, _}, Obj1),
 1371:     Obj2=(catch orber_test_server:oe_create(state,[])),
 1372:     ?match({_,key,_, _,_, _}, Obj2),
 1373: 
 1374:     NS  = corba:resolve_initial_references("NameService"),
 1375:     'CosNaming_NamingContext':bind(NS, lname:new(["mamba"]), Obj1),
 1376:     'CosNaming_NamingContext':bind(NS, lname:new(["viper"]), Obj2),
 1377: 
 1378:     ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
 1379: 					   light_tests,
 1380: 					   [LocalHost,
 1381: 					    orber:iiop_port(), "viper"])),
 1382:     ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
 1383: 					   light_tests,
 1384: 					   [LocalHost,
 1385: 					    orber:iiop_port(), "mamba"])),
 1386: 
 1387:     %% Clean up.
 1388: 
 1389:     catch corba:dispose(Obj1),
 1390:     catch corba:dispose(Obj2),
 1391:     catch 'CosNaming_NamingContext':destroy(NS),
 1392: 
 1393:     ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
 1394: 						 uninstall_test_data,
 1395: 						 [light])),
 1396:     ok.
 1397: %%-----------------------------------------------------------------
 1398: %%  API tests for ORB to ORB, no security
 1399: %%-----------------------------------------------------------------
 1400: 
 1401: light_orber2_api(doc) -> ["LIGHT ORB API tests",
 1402: 			 "This case test if a light Orber can communicate correctly",
 1403: 			 "with an fully installed Orber. This case test if we can",
 1404: 			 "start as lightweight without first setting the environment",
 1405: 			 "variable"];
 1406: light_orber2_api(suite) -> [];
 1407: light_orber2_api(_Config) ->
 1408:     %% --- Create a slave-node ---
 1409:     LocalHost = net_adm:localhost(),
 1410:     {ok, Node, _Host} =
 1411: 	?match({ok,_,_}, orber_test_lib:js_node([],
 1412: 						{lightweight, ["iiop://"++LocalHost++":"++integer_to_list(orber:iiop_port())]})),
 1413:     ?match(ok, orber:info(io)),
 1414:     ?match([_], orber_test_lib:remote_apply(Node, orber_env, get_lightweight_nodes,[])),
 1415: 
 1416:     ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
 1417: 					   install_test_data,
 1418: 					   [light])),
 1419: 
 1420:     Obj1=(catch orber_test_server:oe_create(state,[{pseudo,true}])),
 1421:     ?match({_,pseudo,orber_test_server_impl, _,_, _}, Obj1),
 1422:     Obj2=(catch orber_test_server:oe_create(state,[])),
 1423:     ?match({_,key,_, _,_, _}, Obj2),
 1424: 
 1425:     NS  = corba:resolve_initial_references("NameService"),
 1426:     'CosNaming_NamingContext':bind(NS, lname:new(["mamba"]), Obj1),
 1427:     'CosNaming_NamingContext':bind(NS, lname:new(["viper"]), Obj2),
 1428: 
 1429:     ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
 1430: 					   light_tests,
 1431: 					   [LocalHost,
 1432: 					    orber:iiop_port(), "viper"])),
 1433:     ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
 1434: 					   light_tests,
 1435: 					   [LocalHost,
 1436: 					    orber:iiop_port(), "mamba"])),
 1437: 
 1438:     %% Clean up.
 1439: 
 1440:     catch corba:dispose(Obj1),
 1441:     catch corba:dispose(Obj2),
 1442:     catch 'CosNaming_NamingContext':destroy(NS),
 1443: 
 1444:     ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
 1445: 					   uninstall_test_data,
 1446: 					   [light])),
 1447:     ok.
 1448: 
 1449: %%-----------------------------------------------------------------
 1450: %%  API tests for ORB to ORB, no security
 1451: %%-----------------------------------------------------------------
 1452: 
 1453: multi_orber_api(doc) -> ["MULTI ORB API tests",
 1454: 			 "This case test if data encode/decode (IIOP)",
 1455: 			 "produce the correct result, i.e., the test_server echos",
 1456: 			 "the input parameter or an exception is raised (MARSHAL)."];
 1457: multi_orber_api(suite) -> [];
 1458: multi_orber_api(_Config) ->
 1459: 
 1460:     NewICObj1 = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([])),
 1461:     NewICObj2 = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([], [{regname, {local, newic2}}])),
 1462:     NewICObj3 = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([], [{regname, {global, newic3}}])),
 1463:     ?match(ok, orber_test_server:print(NewICObj1)),
 1464:     ?match(ok, orber_test_server:print(NewICObj2)),
 1465:     ?match(ok, orber_test_server:print(NewICObj3)),
 1466:     catch corba:dispose(NewICObj1),
 1467:     catch corba:dispose(NewICObj2),
 1468:     catch corba:dispose(NewICObj3),
 1469: 
 1470:     %% --- Create a slave-node ---
 1471:     {ok, Node, Host} =
 1472: 	?match({ok,_,_}, orber_test_lib:js_node()),
 1473:     Port = orber_test_lib:remote_apply(Node, orber, iiop_port, []),
 1474: 
 1475:     ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
 1476: 					   install_test_data,
 1477: 					   [nameservice])),
 1478: 
 1479:     NSR = ?match({'IOP_IOR',"IDL:omg.org/CosNaming/NamingContextExt:1.0",_},
 1480: 		 corba:string_to_object("corbaloc::1.2@"++Host++":"++
 1481: 					integer_to_list(Port)++"/NameService")),
 1482: 
 1483:     ?match({'EXCEPTION',{'CosNaming_NamingContext_NotFound',_,_,_}},
 1484: 	   'CosNaming_NamingContext':resolve(NSR, lname:new(["not_exist"]))),
 1485: 
 1486:     Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
 1487: 		 'CosNaming_NamingContext':resolve(NSR, lname:new(["mamba"]))),
 1488:     ?match(ok, orber_test_server:print(Obj)),
 1489: 
 1490:     Obj12B = ?match({'IOP_IOR',_,_},
 1491: 		    corba:string_to_object("corbaloc::1.2@"++Host++":"++integer_to_list(Port)++"/Mamba")),
 1492: 
 1493:     Obj11B = ?match({'IOP_IOR',_,_},
 1494: 		    corba:string_to_object("corbaloc::1.1@"++Host++":"++integer_to_list(Port)++"/Mamba")),
 1495: 
 1496:     Obj10B = ?match({'IOP_IOR',_,_},
 1497: 		    corba:string_to_object("corbaloc::1.0@"++Host++":"++integer_to_list(Port)++"/Mamba")),
 1498: 
 1499:     context_test(Obj12B),
 1500:     context_test(Obj11B),
 1501: 
 1502:     ?match(ok, orber_test_server:print(Obj12B)),
 1503:     ?match(ok, orber_test_server:print(Obj11B)),
 1504:     ?match(ok, orber_test_server:print(Obj10B)),
 1505:     ?match({'EXCEPTION',{'CosNaming_NamingContextExt_InvalidAddress',_}},
 1506: 	   corba:string_to_object("corbaloc::1.0@"++Host++":"++integer_to_list(Port)++"/Wrong")),
 1507: 
 1508:     ?match(ok, orber_test_lib:corba_object_tests(Obj12B, NSR)),
 1509:     ?match(ok, orber_test_lib:corba_object_tests(Obj11B, NSR)),
 1510:     ?match(ok, orber_test_lib:corba_object_tests(Obj10B, NSR)),
 1511: 
 1512:     %%--- Testing code and decode arguments ---
 1513:     orber_test_lib:test_coding(Obj),
 1514: 
 1515:     ?match({'EXCEPTION',#'BAD_CONTEXT'{}},
 1516: 	   orber_test_server:
 1517: 	   print(Obj12B,
 1518: 		 [{context,
 1519: 		   [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
 1520: 					  context_data = {interface,
 1521: 							  {127,0,0,1}}}]}])),
 1522: 
 1523:     ?match({'EXCEPTION',{'TRANSIENT',_,_,_}},
 1524: 	   orber_test_server:stop_brutal(Obj12B)),
 1525:     ?match({'EXCEPTION',{'TRANSIENT',_,_,_}},
 1526: 		 orber_test_server:print(Obj12B)),
 1527: 
 1528:     ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
 1529: 					   uninstall_test_data,
 1530: 					   [nameservice])),
 1531:     ok.
 1532: 
 1533: 
 1534: %%-----------------------------------------------------------------
 1535: %%  API tests for ORB to ORB, no security, using basic interceptors
 1536: %%-----------------------------------------------------------------
 1537: basic_PI_api(doc) -> ["MULTI ORB API tests",
 1538: 		      "This case test if data encode/decode (IIOP)",
 1539: 		      "produce the correct result when using basic interceptors,",
 1540: 		      "i.e., the test_server echos",
 1541: 		      "the input parameter or an exception is raised (MARSHAL)."];
 1542: basic_PI_api(suite) -> [];
 1543: basic_PI_api(_Config) ->
 1544:     %% Change configuration to use Basic Interceptors.
 1545:     orber:configure_override(interceptors, {native, [orber_test_lib]}),
 1546:     %% --- Create a slave-node ---
 1547:     {ok, Node, Host} =
 1548: 	?match({ok,_,_}, orber_test_lib:js_node([{interceptors, {native, [orber_test_lib]}}])),
 1549:     Port = orber_test_lib:remote_apply(Node, orber, iiop_port, []),
 1550: 
 1551:     ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
 1552: 					   install_test_data,
 1553: 					   [nameservice])),
 1554: 
 1555:     Obj12 = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
 1556: 		   corba:string_to_object("corbaname::1.2@"++Host++":"++integer_to_list(Port)++"/NameService#mamba")),
 1557: 
 1558:     Obj11 = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
 1559: 		   corba:string_to_object("corbaname::1.1@"++Host++":"++integer_to_list(Port)++"/NameService#mamba")),
 1560: 
 1561:     Obj10 = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
 1562: 		   corba:string_to_object("corbaname::1.0@"++Host++":"++integer_to_list(Port)++"/NameService#mamba")),
 1563: 
 1564:     ?match(ok, corba:print_object(Obj12)),
 1565:     ?match(ok, corba:print_object(Obj11, error_report)),
 1566:     ?match(ok, corba:print_object(Obj10, {error_report, "Reason"})),
 1567: 
 1568:     ?match(ok, orber_test_server:print(Obj12)),
 1569:     ?match(ok, orber_test_server:print(Obj11)),
 1570:     ?match(ok, orber_test_server:print(Obj10)),
 1571: 
 1572: 
 1573:     Obj12B = ?match({'IOP_IOR',_,_},
 1574: 		    corba:string_to_object("corbaloc::1.2@"++Host++":"++integer_to_list(Port)++"/Mamba")),
 1575: 
 1576:     Obj11B = ?match({'IOP_IOR',_,_},
 1577: 		    corba:string_to_object("corbaloc::1.1@"++Host++":"++integer_to_list(Port)++"/Mamba")),
 1578: 
 1579:     Obj10B = ?match({'IOP_IOR',_,_},
 1580: 		    corba:string_to_object("corbaloc::1.0@"++Host++":"++integer_to_list(Port)++"/Mamba")),
 1581: 
 1582:     ?match(ok, corba:print_object(Obj12B, info_msg)),
 1583:     ?match(ok, corba:print_object(Obj11B, {info_msg, "Comment"})),
 1584:     ?match([_|_], corba:print_object(Obj10B, string)),
 1585: 
 1586:     ?match(ok, orber_test_server:print(Obj12B)),
 1587:     ?match(ok, orber_test_server:print(Obj11B)),
 1588:     ?match(ok, orber_test_server:print(Obj10B)),
 1589:     ?match({'EXCEPTION',{'CosNaming_NamingContextExt_InvalidAddress',_}},
 1590: 		 corba:string_to_object("corbaloc::1.0@"++Host++":"++integer_to_list(Port)++"/Wrong")),
 1591: 
 1592:     ?match(ok, orber_test_lib:alternate_iiop_address(Host, Port)),
 1593: 
 1594:     context_test(Obj12B),
 1595:     context_test(Obj11B),
 1596: 
 1597:     %%--- Testing code and decode arguments ---
 1598:     orber_test_lib:test_coding(Obj12),
 1599:     orber_test_lib:test_coding(Obj11),
 1600:     orber_test_lib:test_coding(Obj10),
 1601: 
 1602:     application:set_env(orber, interceptors, false),
 1603: 
 1604:     ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
 1605: 					   uninstall_test_data,
 1606: 					   [nameservice])),
 1607:     ok.
 1608: 
 1609: 
 1610: %%-----------------------------------------------------------------
 1611: %%  API tests for ORB to ORB, ssl security depth 1
 1612: %%-----------------------------------------------------------------
 1613: 
 1614: ssl_1_multi_orber_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 1)",
 1615: 			       "This case set up two secure orbs and test if they can",
 1616: 			     "communicate. The case also test to access one of the",
 1617: 			     "secure orbs which must raise a NO_PERMISSION exception."];
 1618: ssl_1_multi_orber_api(suite) -> [];
 1619: ssl_1_multi_orber_api(_Config) ->
 1620:     ServerOptions = orber_test_lib:get_options_old(iiop_ssl, server,
 1621: 					       1, [{iiop_ssl_port, 0}]),
 1622:     ClientOptions = orber_test_lib:get_options_old(iiop_ssl, client,
 1623: 					       1, [{iiop_ssl_port, 0}]),
 1624:     ssl_suite(ServerOptions, ClientOptions).
 1625: 
 1626: 
 1627: ssl_1_multi_orber_generation_3_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 1)",
 1628: 			       "This case set up two secure orbs and test if they can",
 1629: 			     "communicate. The case also test to access one of the",
 1630: 			     "secure orbs which must raise a NO_PERMISSION exception."];
 1631: ssl_1_multi_orber_generation_3_api(suite) -> [];
 1632: ssl_1_multi_orber_generation_3_api(_Config) ->
 1633: 
 1634:     ServerOptions = orber_test_lib:get_options(iiop_ssl, server,
 1635: 					       1, [{ssl_generation, 3},
 1636: 						   {iiop_ssl_port, 0}]),
 1637:     ClientOptions = orber_test_lib:get_options(iiop_ssl, client,
 1638: 					       1, [{ssl_generation, 3},
 1639: 						   {iiop_ssl_port, 0}]),
 1640:     ssl_suite(ServerOptions, ClientOptions).
 1641: 
 1642: %%-----------------------------------------------------------------
 1643: %%  API tests for ORB to ORB, ssl security depth 2
 1644: %%-----------------------------------------------------------------
 1645: 
 1646: ssl_2_multi_orber_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 2)",
 1647: 			     "This case set up two secure orbs and test if they can",
 1648: 			     "communicate. The case also test to access one of the",
 1649: 			     "secure orbs which must raise a NO_PERMISSION exception."];
 1650: ssl_2_multi_orber_api(suite) -> [];
 1651: ssl_2_multi_orber_api(_Config) ->
 1652: 
 1653:     ServerOptions = orber_test_lib:get_options_old(iiop_ssl, server,
 1654: 					       2, [{iiop_ssl_port, 0}]),
 1655:     ClientOptions = orber_test_lib:get_options_old(iiop_ssl, client,
 1656: 					       2, [{iiop_ssl_port, 0}]),
 1657:     ssl_suite(ServerOptions, ClientOptions).
 1658: 
 1659: 
 1660: ssl_2_multi_orber_generation_3_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 2)",
 1661: 			     "This case set up two secure orbs and test if they can",
 1662: 			     "communicate. The case also test to access one of the",
 1663: 			     "secure orbs which must raise a NO_PERMISSION exception."];
 1664: ssl_2_multi_orber_generation_3_api(suite) -> [];
 1665: ssl_2_multi_orber_generation_3_api(_Config) ->
 1666: 
 1667:     ServerOptions = orber_test_lib:get_options(iiop_ssl, server,
 1668: 					       2, [{ssl_generation, 3},
 1669: 						   {iiop_ssl_port, 0}]),
 1670:     ClientOptions = orber_test_lib:get_options(iiop_ssl, client,
 1671: 					       2, [{ssl_generation, 3},
 1672: 						   {iiop_ssl_port, 0}]),
 1673:     ssl_suite(ServerOptions, ClientOptions).
 1674: %%-----------------------------------------------------------------
 1675: %%  API tests for ORB to ORB, ssl security depth 2
 1676: %%-----------------------------------------------------------------
 1677: 
 1678: ssl_reconfigure_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 2)",
 1679: 			     "This case set up two secure orbs and test if they can",
 1680: 			     "communicate. The case also test to access one of the",
 1681: 			     "secure orbs which must raise a NO_PERMISSION exception."];
 1682: ssl_reconfigure_api(suite) -> [];
 1683: ssl_reconfigure_api(_Config) ->
 1684:     ssl_reconfigure_old([]).
 1685: 
 1686: 
 1687: ssl_reconfigure_generation_3_api_old(_Config) ->
 1688:     ssl_reconfigure_old([{ssl_generation, 3}]).
 1689: 
 1690: ssl_reconfigure_old(ExtraSSLOptions) ->
 1691: 
 1692:     IP = orber_test_lib:get_host(),
 1693:     Loopback = orber_test_lib:get_loopback_interface(),
 1694:     {ok, ServerNode, _ServerHost} =
 1695: 	?match({ok,_,_},
 1696: 	       orber_test_lib:js_node([{iiop_port, 0},
 1697: 				       {flags, ?ORB_ENV_LOCAL_INTERFACE},
 1698: 				       {ip_address, IP}|ExtraSSLOptions])),
 1699:     orber_test_lib:remote_apply(ServerNode, ssl, start, []),
 1700:     orber_test_lib:remote_apply(ServerNode, crypto, start, []),
 1701:     ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
 1702: 					   install_test_data,
 1703: 					   [ssl])),
 1704:     ?match({ok, _},
 1705: 	   orber_test_lib:remote_apply(ServerNode, orber,
 1706: 				       add_listen_interface,
 1707: 				       [Loopback, normal, [{iiop_port, 5648},
 1708: 							   {iiop_ssl_port, 5649},
 1709: 							   {interceptors, {native, [orber_iiop_tracer_silent]}}|ExtraSSLOptions]])),
 1710:     ServerOptions = orber_test_lib:get_options_old(iiop_ssl, server,
 1711: 					       2, [{flags, ?ORB_ENV_LOCAL_INTERFACE},
 1712: 						   {iiop_port, 5648},
 1713: 						   {iiop_ssl_port, 5649},
 1714: 						   {interceptors, {native, [orber_iiop_tracer_silent]}}|ExtraSSLOptions]),
 1715:     ?match({ok, _},
 1716: 	   orber_test_lib:remote_apply(ServerNode, orber,
 1717: 				       add_listen_interface,
 1718: 				       [Loopback, ssl, ServerOptions])),
 1719: 
 1720:     ClientOptions = orber_test_lib:get_options_old(iiop_ssl, client,
 1721: 					       2, [{iiop_ssl_port, 0}|ExtraSSLOptions]),
 1722:     {ok, ClientNode, _ClientHost} =
 1723: 	?match({ok,_,_}, orber_test_lib:js_node(ClientOptions)),
 1724: 
 1725:     ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib,
 1726: 					   install_test_data,
 1727: 					   [ssl])),
 1728:     orber_test_lib:remote_apply(ClientNode, ssl, start, []),
 1729:     orber_test_lib:remote_apply(ServerNode, crypto, start, []),
 1730:     Obj = ?match(#'IOP_IOR'{},
 1731: 		 orber_test_lib:remote_apply(ClientNode, corba,
 1732: 					     string_to_object, ["corbaname:iiop:1.1@"++Loopback++":5648/NameService#mamba",
 1733: 								[{context, [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
 1734: 												  context_data = {configuration, ClientOptions}}]}]])),
 1735:     ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_server,
 1736: 					   print, [Obj])).
 1737: 
 1738: 
 1739: ssl_reconfigure_generation_3_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 2)",
 1740: 			     "This case set up two secure orbs and test if they can",
 1741: 			     "communicate. The case also test to access one of the",
 1742: 			     "secure orbs which must raise a NO_PERMISSION exception."];
 1743: ssl_reconfigure_generation_3_api(suite) -> [];
 1744: ssl_reconfigure_generation_3_api(_Config) ->
 1745:     ssl_reconfigure([{ssl_generation, 3}]).
 1746: 
 1747: 
 1748: ssl_reconfigure(ExtraSSLOptions) ->
 1749: 
 1750:     IP = orber_test_lib:get_host(),
 1751:     Loopback = orber_test_lib:get_loopback_interface(),
 1752:     {ok, ServerNode, _ServerHost} =
 1753: 	?match({ok,_,_},
 1754: 	       orber_test_lib:js_node([{iiop_port, 0},
 1755: 				       {flags, ?ORB_ENV_LOCAL_INTERFACE},
 1756: 				       {ip_address, IP}|ExtraSSLOptions])),
 1757:     orber_test_lib:remote_apply(ServerNode, ssl, start, []),
 1758:     orber_test_lib:remote_apply(ServerNode, crypto, start, []),
 1759:     ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
 1760: 					   install_test_data,
 1761: 					   [ssl])),
 1762:     ?match({ok, _},
 1763: 	   orber_test_lib:remote_apply(ServerNode, orber,
 1764: 				       add_listen_interface,
 1765: 				       [Loopback, normal, [{iiop_port, 5648},
 1766: 							   {iiop_ssl_port, 5649},
 1767: 							   {interceptors, {native, [orber_iiop_tracer_silent]}}|ExtraSSLOptions]])),
 1768:     ServerOptions = orber_test_lib:get_options(iiop_ssl, server,
 1769: 					       2, [{flags, ?ORB_ENV_LOCAL_INTERFACE},
 1770: 						   {iiop_port, 5648},
 1771: 						   {iiop_ssl_port, 5649},
 1772: 						   {interceptors, {native, [orber_iiop_tracer_silent]}}|ExtraSSLOptions]),
 1773:     ?match({ok, _},
 1774: 	   orber_test_lib:remote_apply(ServerNode, orber,
 1775: 				       add_listen_interface,
 1776: 				       [Loopback, ssl, ServerOptions])),
 1777: 
 1778:     ClientOptions = orber_test_lib:get_options(iiop_ssl, client,
 1779: 					       2, [{iiop_ssl_port, 0}|ExtraSSLOptions]),
 1780:     {ok, ClientNode, _ClientHost} =
 1781: 	?match({ok,_,_}, orber_test_lib:js_node(ClientOptions)),
 1782: 
 1783:     ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib,
 1784: 					   install_test_data,
 1785: 					   [ssl])),
 1786:     orber_test_lib:remote_apply(ClientNode, ssl, start, []),
 1787:     orber_test_lib:remote_apply(ServerNode, crypto, start, []),
 1788:     Obj = ?match(#'IOP_IOR'{},
 1789: 		 orber_test_lib:remote_apply(ClientNode, corba,
 1790: 					     string_to_object, ["corbaname:iiop:1.1@"++Loopback++":5648/NameService#mamba",
 1791: 								[{context, [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
 1792: 												  context_data = {configuration, ClientOptions}}]}]])),
 1793:     ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_server,
 1794: 					   print, [Obj])).
 1795: 
 1796: 
 1797: %%-----------------------------------------------------------------
 1798: %%  API tests for Orber to Java ORB, no security
 1799: %%-----------------------------------------------------------------
 1800: 
 1801: %orber_java_api(doc) -> ["ERLANG-ORB <-> JAVA-ORB API tests",
 1802: %			"This case test if data encode/decode (IIOP)",
 1803: %			"produce the correct result, i.e., the test_server echos",
 1804: %			"the input parameter or an exception is raised (MARSHAL)."];
 1805: %orber_java_api(suite) -> [];
 1806: %orber_java_api(Config) ->
 1807: %    ok.
 1808: 
 1809: %%------------------------------------------------------------
 1810: %% function : ssl_suite
 1811: %% Arguments: Config
 1812: %%            Depth
 1813: %% Returns  : ok
 1814: %% Effect   :
 1815: %%------------------------------------------------------------
 1816: 
 1817: ssl_suite(ServerOptions, ClientOptions) ->
 1818: 
 1819:     {ok, ServerNode, ServerHost} =
 1820: 	?match({ok,_,_}, orber_test_lib:js_node(ServerOptions)),
 1821:     ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
 1822:     SSLServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_ssl_port, []),
 1823: 
 1824:     {ok, ClientNode, _ClientHost} =
 1825: 	?match({ok,_,_}, orber_test_lib:js_node(ClientOptions)),
 1826: 
 1827:     ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
 1828: 					   install_test_data,
 1829: 					   [ssl])),
 1830:     %% Tell the client to interoperate with the server. The purpose of this
 1831:     %% operation is to look up, using NameService, an object reference and
 1832:     %% use it to contact the object.
 1833:     ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib,
 1834: 					   lookup,
 1835: 					   [ServerHost, ServerPort])),
 1836: 
 1837:     ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib,
 1838: 					   alternate_ssl_iiop_address,
 1839: 					   [ServerHost, ServerPort, SSLServerPort])),
 1840: 
 1841:     %% 'This' node is not secure. Contact the server. Must refuse connection.
 1842:     NSR = ?match({'IOP_IOR',"IDL:omg.org/CosNaming/NamingContextExt:1.0",_},
 1843: 		       corba:string_to_object("corbaloc::1.2@"++ServerHost++":"++
 1844: 					      integer_to_list(ServerPort)++"/NameService")),
 1845: 
 1846:     %% Should be 'NO_PERMISSION'??
 1847:     ?match({'EXCEPTION',{'COMM_FAILURE',_,_,_}},
 1848: 		 'CosNaming_NamingContext':resolve(NSR, lname:new(["not_exist"]))),
 1849: 
 1850:     %% Should be 'NO_PERMISSION'??
 1851:     ?match({'EXCEPTION',{'COMM_FAILURE',_,_,_}},
 1852: 		 'CosNaming_NamingContext':resolve(NSR, lname:new(["mamba"]))),
 1853: 
 1854:     %% Uninstall.
 1855:     ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
 1856: 					   uninstall_test_data,
 1857: 					   [ssl])),
 1858:     ok.
 1859: 
 1860: %%-----------------------------------------------------------------
 1861: %%  iiop_setup_connection_timeout API tests for ORB to ORB.
 1862: %%-----------------------------------------------------------------
 1863: setup_connection_timeout_api(doc) -> ["iiop_setup_connection_timeout API tests for ORB to ORB."];
 1864: setup_connection_timeout_api(suite) -> [];
 1865: setup_connection_timeout_api(_Config) ->
 1866:     ?match(ok, application:set_env(orber, iiop_backlog, 0)),
 1867:     %% Wait to be sure that the configuration has kicked in.
 1868:     timer:sleep(2000),
 1869:     {ok, Ref, Port} = create_fake_server_ORB(normal, 0, [], listen, []),
 1870:     ?match(ok, orber:configure(iiop_setup_connection_timeout, 5)),
 1871:     ?match(ok, orber:info(io)),
 1872:     IP = orber_test_lib:get_host(),
 1873:     spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
 1874:     spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
 1875:     spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
 1876:     spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
 1877:     spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
 1878:     timer:sleep(2000),
 1879:     Corbaloc = "corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService",
 1880:     ?match({'EXCEPTION', _E}, corba:string_to_object(Corbaloc)),
 1881:     destroy_fake_ORB(Ref),
 1882:     ?match(ok, application:set_env(orber, iiop_backlog, 5)),
 1883:     ok.
 1884: 
 1885: %%-----------------------------------------------------------------
 1886: %%  iiop_setup_connection_timeout API tests for ORB to ORB.
 1887: %%-----------------------------------------------------------------
 1888: setup_multi_connection_timeout_api(doc) ->
 1889:     ["iiop_multi_setup_connection_timeout API tests for ORB to ORB."];
 1890: setup_multi_connection_timeout_api(suite) -> [];
 1891: setup_multi_connection_timeout_api(_Config) ->
 1892:     ?match(ok, application:set_env(orber, iiop_backlog, 0)),
 1893:     %% Wait to be sure that the configuration has kicked in.
 1894:     timer:sleep(2000),
 1895:     {ok, Ref, Port} = create_fake_server_ORB(normal, 0, [], listen, []),
 1896:     ?match(ok, application:set_env(orber, iiop_out_ports, {6042, 6234})),
 1897:     ?match(ok, orber:configure(iiop_setup_connection_timeout, 5)),
 1898:     ?match(ok, orber:info(io)),
 1899:     IP = orber_test_lib:get_host(),
 1900:     spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
 1901:     spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
 1902:     spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
 1903:     spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
 1904:     spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
 1905:     Corbaloc = "corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService",
 1906:     timer:sleep(2000),
 1907:     ?match({'EXCEPTION', _E}, corba:string_to_object(Corbaloc)),
 1908:     destroy_fake_ORB(Ref),
 1909:     ?match(ok, application:set_env(orber, iiop_backlog, 5)),
 1910:     ?match(ok, application:set_env(orber, iiop_out_ports, undefined)),
 1911:     ok.
 1912: 
 1913: setup_multi_connection_timeout_attempts_api(doc) ->
 1914:     ["iiop_multi_setup_connection_timeout API tests for ORB to ORB."];
 1915: setup_multi_connection_timeout_attempts_api(suite) -> [];
 1916: setup_multi_connection_timeout_attempts_api(_Config) ->
 1917:     ?match(ok, application:set_env(orber, iiop_backlog, 0)),
 1918:     %% Wait to be sure that the configuration has kicked in.
 1919:     timer:sleep(2000),
 1920:     {ok, Ref, Port} = create_fake_server_ORB(normal, 0, [], listen, []),
 1921:     ?match(ok, application:set_env(orber, iiop_out_ports, {6042, 6234})),
 1922:     ?match(ok, application:set_env(orber, iiop_out_ports_attempts, 1)),
 1923:     ?match(ok, orber:configure(iiop_setup_connection_timeout, 5)),
 1924:     ?match(ok, orber:info(io)),
 1925:     IP = orber_test_lib:get_host(),
 1926:     spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
 1927:     spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
 1928:     spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
 1929:     spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
 1930:     spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
 1931:     Corbaloc = "corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService",
 1932:     timer:sleep(2000),
 1933:     ?match({'EXCEPTION', _E}, corba:string_to_object(Corbaloc)),
 1934:     destroy_fake_ORB(Ref),
 1935:     ?match(ok, application:set_env(orber, iiop_backlog, 5)),
 1936:     ?match(ok, application:set_env(orber, iiop_out_ports, undefined)),
 1937:     ok.
 1938: 
 1939: setup_multi_connection_timeout_random_api(doc) ->
 1940:     ["iiop_multi_setup_connection_timeout API tests for ORB to ORB."];
 1941: setup_multi_connection_timeout_random_api(suite) -> [];
 1942: setup_multi_connection_timeout_random_api(_Config) ->
 1943:     ?match(ok, application:set_env(orber, iiop_backlog, 0)),
 1944:     %% Wait to be sure that the configuration has kicked in.
 1945:     timer:sleep(2000),
 1946:     {ok, Ref, Port} = create_fake_server_ORB(normal, 0, [], listen, []),
 1947:     ?match(ok, application:set_env(orber, iiop_out_ports, {6042, 6234})),
 1948:     ?match(ok, application:set_env(orber, iiop_out_ports_random, true)),
 1949:     ?match(ok, orber:configure(iiop_setup_connection_timeout, 5)),
 1950:     ?match(ok, orber:info(io)),
 1951:     IP = orber_test_lib:get_host(),
 1952:     spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
 1953:     spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
 1954:     spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
 1955:     spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
 1956:     spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
 1957:     Corbaloc = "corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService",
 1958:     timer:sleep(2000),
 1959:     ?match({'EXCEPTION', _E}, corba:string_to_object(Corbaloc)),
 1960:     destroy_fake_ORB(Ref),
 1961:     ?match(ok, application:set_env(orber, iiop_backlog, 5)),
 1962:     ?match(ok, application:set_env(orber, iiop_out_ports, undefined)),
 1963:     ok.
 1964: 
 1965: %%-----------------------------------------------------------------
 1966: %%  Sending an incorrect header to the server-side ORB.
 1967: %%-----------------------------------------------------------------
 1968: bad_giop_header_api(doc) -> ["Sending an incorrect header to the server-side ORB."];
 1969: bad_giop_header_api(suite) -> [];
 1970: bad_giop_header_api(_Config) ->
 1971:     orber:configure_override(interceptors, {native,[orber_iiop_tracer]}),
 1972:     orber:configure(orber_debug_level, 10),
 1973:     ?match(ok, orber:info(io)),
 1974:     {ok, ServerNode, ServerHost} =
 1975: 	?match({ok,_,_}, orber_test_lib:js_node()),
 1976:     ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
 1977:     Req = <<"GIOP",1,2,0,100,0,0,0,5,0,0,0,10,50>> ,
 1978:     ?match(ok, fake_client_ORB(normal, ServerHost, ServerPort, [],
 1979: 				     message_error, [Req])),
 1980: 
 1981:     application:set_env(orber, interceptors, false),
 1982:     orber:configure(orber_debug_level, 0),
 1983:     ok.
 1984: 
 1985: 
 1986: %%-----------------------------------------------------------------
 1987: %%  Fragmented IIOP tests (Server-side).
 1988: %%-----------------------------------------------------------------
 1989: -define(REQUEST_ID, 0).
 1990: 
 1991: -define(REPLY_FRAG_1, <<71,73,79,80,1,2,2,1,0,0,0,41,0,0,0,?REQUEST_ID,0,0,0,0,0,0,0,1,78,69,79,0,0,0,0,2,0,10,0,0,0,0,0,0,0,0,0,18,0,0,0,0,0,0,0,4,49>>).
 1992: %% The fragments are identical for requests and replies.
 1993: -define(FRAG_2, <<71,73,79,80,1,2,2,7,0,0,0,5,0,0,0,?REQUEST_ID,50>>).
 1994: -define(FRAG_3, <<71,73,79,80,1,2,2,7,0,0,0,5,0,0,0,?REQUEST_ID,51>>).
 1995: -define(FRAG_4, <<71,73,79,80,1,2,0,7,0,0,0,5,0,0,0,?REQUEST_ID,0>>).
 1996: 
 1997: 
 1998: fragments_server_api(doc) -> ["fragments API tests for server-side ORB."];
 1999: fragments_server_api(suite) -> [];
 2000: fragments_server_api(_Config) ->
 2001:     %% --- Create a slave-node ---
 2002:     {ok, Node, Host} =
 2003: 	?match({ok,_,_}, orber_test_lib:js_node()),
 2004:     Port = orber_test_lib:remote_apply(Node, orber, iiop_port, []),
 2005: 
 2006:     ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
 2007: 					   install_test_data,
 2008: 					   [nameservice])),
 2009: 
 2010:     NSR = ?match({'IOP_IOR',"IDL:omg.org/CosNaming/NamingContextExt:1.0",_},
 2011: 		 corba:string_to_object("corbaloc::1.2@"++Host++":"++
 2012: 					integer_to_list(Port)++"/NameService")),
 2013: 
 2014:     Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
 2015: 		 'CosNaming_NamingContext':resolve(NSR, lname:new(["mamba"]))),
 2016: 
 2017:     Any = #any{typecode = {tk_string,0},
 2018: 	       value = "123"},
 2019:     Target = #'GIOP_TargetAddress'{label = ?GIOP_KeyAddr,
 2020: 				   value = iop_ior:get_objkey(Obj)},
 2021:     %% Fix a request header.
 2022:     {Hdr, Body, HdrLen, _What, _Flags} =
 2023: 	cdr_encode:enc_request_split(
 2024: 	  #giop_env{version = {1,2}, objkey = Target,
 2025: 		    request_id = ?REQUEST_ID,
 2026: 		    response_expected = true,
 2027: 		    op = testing_iiop_any,
 2028: 		    parameters = [49], ctx = [],
 2029: 		    tc = {tk_void,[tk_char],[]},
 2030: 		    host = [orber_test_lib:get_host()],
 2031: 		    iiop_port = orber:iiop_port(),
 2032: 		    iiop_ssl_port = orber:iiop_ssl_port(),
 2033: 		    domain = orber:domain(),
 2034: 		    partial_security = orber:partial_security()}),
 2035:     NewBody =
 2036: 	case size(Body) of
 2037: 	    1 ->
 2038: 		<<0,0,0,18,0,0,0,0,0,0,0,4,49>> ;
 2039: 	    Size ->
 2040: 		Aligned = Size -1,
 2041: 		<<AligmnetData:Aligned/binary,49>> = Body,
 2042: 		list_to_binary([AligmnetData, <<0,0,0,18,0,0,0,0,0,0,0,4,49>> ])
 2043: 	end,
 2044: 
 2045:     MessSize = HdrLen+size(NewBody),
 2046:     ReqFrag = list_to_binary([ <<"GIOP",1:8,2:8,2:8,0:8,
 2047: 			       MessSize:32/big-unsigned-integer>> , Hdr |NewBody]),
 2048:     ?match(Any, fake_client_ORB(normal, Host, Port, [], fragments,
 2049: 				[ReqFrag, ?FRAG_2, ?FRAG_3, ?FRAG_4])),
 2050: 
 2051:     ok.
 2052: 
 2053: %%-----------------------------------------------------------------
 2054: %%  Fragmented IIOP tests (Server-side). Exceeding Maximum.
 2055: %%-----------------------------------------------------------------
 2056: fragments_max_server_api(doc) -> ["Maximum fragments API tests for server-side ORB."];
 2057: fragments_max_server_api(suite) -> [];
 2058: fragments_max_server_api(_Config) ->
 2059:     %% --- Create a slave-node ---
 2060:     IP = orber_test_lib:get_host(),
 2061:     {ok, ServerNode, _ServerHost} =
 2062: 	?match({ok,_,_}, orber_test_lib:js_node([{iiop_max_fragments, 2},
 2063: 						 {ip_address, IP}])),
 2064:     ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
 2065:     fragments_max_server(ServerNode, IP, ServerPort).
 2066: 
 2067: fragments_max_server_added_api(doc) -> ["Maximum fragments API tests for server-side ORB."];
 2068: fragments_max_server_added_api(suite) -> [];
 2069: fragments_max_server_added_api(_Config) ->
 2070:     %% --- Create a slave-node ---
 2071:     IP = orber_test_lib:get_host(),
 2072:     {ok, ServerNode, _ServerHost} =
 2073: 	?match({ok,_,_}, orber_test_lib:js_node([])),
 2074:     ServerPort = 1 + orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
 2075:     ?match({ok, _},
 2076: 	   orber_test_lib:remote_apply(ServerNode, orber,
 2077: 				       add_listen_interface,
 2078: 				       [IP, normal,
 2079: 					[{iiop_max_fragments, 2},
 2080: 					 {flags, ?ORB_ENV_LOCAL_INTERFACE},
 2081: 					 {iiop_port, ServerPort}]])),
 2082:     fragments_max_server(ServerNode, IP, ServerPort).
 2083: 
 2084: fragments_max_server(ServerNode, ServerHost, ServerPort) ->
 2085:     ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
 2086: 					   install_test_data,
 2087: 					   [nameservice])),
 2088:     Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
 2089: 		 corba:string_to_object("corbaname::1.2@"++ServerHost++":"++
 2090: 					integer_to_list(ServerPort)++"/NameService#mamba")),
 2091:     Target = #'GIOP_TargetAddress'{label = ?GIOP_KeyAddr,
 2092: 				   value = iop_ior:get_objkey(Obj)},
 2093:     %% Fix a request header.
 2094:     {Hdr, Body, HdrLen, _What, _Flags} =
 2095: 	cdr_encode:enc_request_split(
 2096: 	  #giop_env{version = {1,2},
 2097: 		    objkey = Target,
 2098: 		    request_id = ?REQUEST_ID,
 2099: 		    response_expected = true,
 2100: 		    op = testing_iiop_any,
 2101: 		    parameters = [49], ctx = [],
 2102: 		    tc = {tk_void,[tk_char],[]},
 2103: 		    host = [orber_test_lib:get_host()],
 2104: 		    iiop_port = orber:iiop_port(),
 2105: 		    iiop_ssl_port = orber:iiop_ssl_port(),
 2106: 		    domain = orber:domain(),
 2107: 		    partial_security = orber:partial_security()}),
 2108:     NewBody =
 2109: 	case size(Body) of
 2110: 	    1 ->
 2111: 		<<0,0,0,18,0,0,0,0,0,0,0,4,49>> ;
 2112: 	    Size ->
 2113: 		Aligned = Size -1,
 2114: 		<<AligmnetData:Aligned/binary,49>> = Body,
 2115: 		list_to_binary([AligmnetData, <<0,0,0,18,0,0,0,0,0,0,0,4,49>> ])
 2116: 	end,
 2117: 
 2118:     MessSize = HdrLen+size(NewBody),
 2119:     ReqFrag = list_to_binary([ <<"GIOP",1:8,2:8,2:8,0:8,
 2120: 			       MessSize:32/big-unsigned-integer>> , Hdr |NewBody]),
 2121:     ?match(#'IMP_LIMIT'{},
 2122: 	   fake_client_ORB(normal, ServerHost, ServerPort, [], fragments_max,
 2123: 			   [ReqFrag, ?FRAG_2, ?FRAG_3, ?FRAG_4])),
 2124: 
 2125:     ok.
 2126: 
 2127: %%-----------------------------------------------------------------
 2128: %%  Fragmented IIOP tests (Client-side).
 2129: %%-----------------------------------------------------------------
 2130: fragments_client_api(doc) -> ["fragments API tests for client-side ORB."];
 2131: fragments_client_api(suite) -> [];
 2132: fragments_client_api(_Config) ->
 2133:     Any = #any{typecode = {tk_string,0},
 2134: 	       value = "123"},
 2135:     application:set_env(orber, interceptors, {native,[orber_iiop_tracer]}),
 2136:     orber:configure(orber_debug_level, 10),
 2137:     orber:info(),
 2138:     IOR = ?match({'IOP_IOR',_,_},
 2139: 		       iop_ior:create_external({1, 2}, "IDL:FAKE:1.0",
 2140: 					       "localhost", 6004, "FAKE", [])),
 2141:     spawn(?MODULE, create_fake_server_ORB, [normal, 6004, [], fragments,
 2142: 					    [?REPLY_FRAG_1, ?FRAG_2,
 2143: 					     ?FRAG_3, ?FRAG_4]]),
 2144:     ?match({ok, Any}, orber_test_server:testing_iiop_any(IOR, Any)),
 2145:     application:set_env(orber, interceptors, false),
 2146:     orber:configure(orber_debug_level, 0),
 2147:     ok.
 2148: 
 2149: %%-----------------------------------------------------------------
 2150: %%  Fragmented IIOP tests (Client-side).
 2151: %%-----------------------------------------------------------------
 2152: bad_fragment_id_client_api(doc) -> ["fragments API tests for client-side ORB."];
 2153: bad_fragment_id_client_api(suite) -> [];
 2154: bad_fragment_id_client_api(_Config) ->
 2155:     application:set_env(orber, interceptors, {native,[orber_iiop_tracer]}),
 2156:     orber:configure(orber_debug_level, 10),
 2157:     orber:info(),
 2158:     {ok, ServerNode, ServerHost} =
 2159: 	?match({ok,_,_}, orber_test_lib:js_node()),
 2160:     ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
 2161:     Req = <<71,73,79,80,1,2,2,7,0,0,0,5,0,0,0,100,50>> ,
 2162:     ?match(ok, fake_client_ORB(normal, ServerHost, ServerPort, [],
 2163: 			       message_error, [Req])),
 2164: 
 2165:     application:set_env(orber, interceptors, false),
 2166:     orber:configure(orber_debug_level, 0),
 2167: 
 2168:     ok.
 2169: 
 2170: %%-----------------------------------------------------------------
 2171: %%  Non-existing request id
 2172: %%-----------------------------------------------------------------
 2173: bad_id_cancel_request_api(doc) -> ["Description", "more description"];
 2174: bad_id_cancel_request_api(suite) -> [];
 2175: bad_id_cancel_request_api(Config) when is_list(Config) ->
 2176:     Req10 = cdr_encode:enc_cancel_request(#giop_env{version = {1, 0},
 2177: 						    request_id = 556}),
 2178:     Req11 = cdr_encode:enc_cancel_request(#giop_env{version = {1, 1},
 2179: 						    request_id = 556}),
 2180:     Req12 = cdr_encode:enc_cancel_request(#giop_env{version = {1, 2},
 2181: 						    request_id = 556}),
 2182:     {ok, ServerNode, ServerHost} =
 2183: 	?match({ok,_,_}, orber_test_lib:js_node()),
 2184:     ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
 2185:     ?match(ok, fake_client_ORB(normal, ServerHost, ServerPort, [],
 2186: 			       message_error, [Req10])),
 2187:     ?match(ok, fake_client_ORB(normal, ServerHost, ServerPort, [],
 2188: 			       message_error, [Req11])),
 2189:     ?match(ok, fake_client_ORB(normal, ServerHost, ServerPort, [],
 2190: 			       message_error, [Req12])),
 2191:     ok.
 2192: 
 2193: %%-----------------------------------------------------------------
 2194: %% Local functions.
 2195: %%-----------------------------------------------------------------
 2196: 
 2197: do_connect(Host, Port, Options) ->
 2198:     gen_tcp:connect(Host, Port, Options),
 2199:     timer:sleep(20000).
 2200: 
 2201: pseudo_calls(0, _) ->
 2202:     ok;
 2203: pseudo_calls(Times, Obj) ->
 2204:     orber_test_server:pseudo_call(Obj),
 2205:     New = Times - 1,
 2206:     pseudo_calls(New, Obj).
 2207: pseudo_casts(0, _) ->
 2208:     ok;
 2209: pseudo_casts(Times, Obj) ->
 2210:     orber_test_server:pseudo_cast(Obj),
 2211:     New = Times - 1,
 2212:     pseudo_casts(New, Obj).
 2213: 
 2214: context_test(Obj) ->
 2215:     CodeSetCtx = #'CONV_FRAME_CodeSetContext'{char_data =  65537,
 2216: 					      wchar_data = 65801},
 2217:     FTGrp = #'FT_FTGroupVersionServiceContext'{object_group_ref_version = ?ULONGMAX},
 2218:     FTReq = #'FT_FTRequestServiceContext'{client_id = "ClientId",
 2219: 					  retention_id = ?LONGMAX,
 2220: 					  expiration_time = ?ULONGLONGMAX},
 2221: 
 2222:     IDToken1 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTAbsent,
 2223: 				    value = true},
 2224:     IDToken2 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTAnonymous,
 2225: 				    value = false},
 2226:     IDToken3 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTPrincipalName,
 2227: 				    value = [0,255]},
 2228:     IDToken4 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTX509CertChain,
 2229: 				    value = [1,255]},
 2230:     IDToken5 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTDistinguishedName,
 2231: 				    value = [2,255]},
 2232:     IDToken6 = #'CSI_IdentityToken'{label = ?ULONGMAX,
 2233: 				    value = [3,255]},
 2234: 
 2235:     MTEstablishContext1 = #'CSI_SASContextBody'
 2236:       {label = ?CSI_MsgType_MTEstablishContext,
 2237:        value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX,
 2238: 				       authorization_token =
 2239: 				       [#'CSI_AuthorizationElement'
 2240: 					{the_type = ?ULONGMAX,
 2241: 					 the_element = [0,255]}],
 2242: 				       identity_token = IDToken1,
 2243: 				       client_authentication_token = [1, 255]}},
 2244:     MTEstablishContext2 = #'CSI_SASContextBody'
 2245:       {label = ?CSI_MsgType_MTEstablishContext,
 2246:        value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX,
 2247: 				       authorization_token =
 2248: 				       [#'CSI_AuthorizationElement'
 2249: 					{the_type = ?ULONGMAX,
 2250: 					 the_element = [0,255]}],
 2251: 				       identity_token = IDToken2,
 2252: 				       client_authentication_token = [1, 255]}},
 2253:     MTEstablishContext3 = #'CSI_SASContextBody'
 2254:       {label = ?CSI_MsgType_MTEstablishContext,
 2255:        value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX,
 2256: 				       authorization_token =
 2257: 				       [#'CSI_AuthorizationElement'
 2258: 					{the_type = ?ULONGMAX,
 2259: 					 the_element = [0,255]}],
 2260: 				       identity_token = IDToken3,
 2261: 				       client_authentication_token = [1, 255]}},
 2262:     MTEstablishContext4 = #'CSI_SASContextBody'
 2263:       {label = ?CSI_MsgType_MTEstablishContext,
 2264:        value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX,
 2265: 				       authorization_token =
 2266: 				       [#'CSI_AuthorizationElement'
 2267: 					{the_type = ?ULONGMAX,
 2268: 					 the_element = [0,255]}],
 2269: 				       identity_token = IDToken4,
 2270: 				       client_authentication_token = [1, 255]}},
 2271:     MTEstablishContext5 = #'CSI_SASContextBody'
 2272:       {label = ?CSI_MsgType_MTEstablishContext,
 2273:        value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX,
 2274: 				       authorization_token =
 2275: 				       [#'CSI_AuthorizationElement'
 2276: 					{the_type = ?ULONGMAX,
 2277: 					 the_element = [0,255]}],
 2278: 				       identity_token = IDToken5,
 2279: 				       client_authentication_token = [1, 255]}},
 2280:     MTEstablishContext6 = #'CSI_SASContextBody'
 2281:       {label = ?CSI_MsgType_MTEstablishContext,
 2282:        value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX,
 2283: 				       authorization_token =
 2284: 				       [#'CSI_AuthorizationElement'
 2285: 					{the_type = ?ULONGMAX,
 2286: 					 the_element = [0,255]}],
 2287: 				       identity_token = IDToken6,
 2288: 				       client_authentication_token = [1, 255]}},
 2289:     MTCompleteEstablishContext = #'CSI_SASContextBody'
 2290:       {label = ?CSI_MsgType_MTCompleteEstablishContext,
 2291:        value = #'CSI_CompleteEstablishContext'{client_context_id = ?ULONGLONGMAX,
 2292: 					       context_stateful = false,
 2293: 					       final_context_token = [1, 255]}},
 2294:     MTContextError = #'CSI_SASContextBody'
 2295:       {label = ?CSI_MsgType_MTContextError,
 2296:        value = #'CSI_ContextError'{client_context_id = ?ULONGLONGMAX,
 2297: 				   major_status = 1,
 2298: 				   minor_status = 2,
 2299: 				   error_token = [2,255]}},
 2300:     MTMessageInContext = #'CSI_SASContextBody'
 2301:       {label = ?CSI_MsgType_MTMessageInContext,
 2302:        value = #'CSI_MessageInContext'{client_context_id = ?ULONGLONGMAX,
 2303: 				       discard_context = true}},
 2304:     Ctx = [#'IOP_ServiceContext'{context_id=?IOP_CodeSets,
 2305: 				 context_data = CodeSetCtx},
 2306: 	   #'IOP_ServiceContext'{context_id=?IOP_FT_GROUP_VERSION,
 2307: 				 context_data = FTGrp},
 2308: 	   #'IOP_ServiceContext'{context_id=?IOP_FT_REQUEST,
 2309: 				 context_data = FTReq},
 2310: 	   #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
 2311: 				 context_data = MTEstablishContext1},
 2312: 	   #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
 2313: 				 context_data = MTEstablishContext2},
 2314: 	   #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
 2315: 				 context_data = MTEstablishContext3},
 2316: 	   #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
 2317: 				 context_data = MTEstablishContext4},
 2318: 	   #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
 2319: 				 context_data = MTEstablishContext5},
 2320: 	   #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
 2321: 				 context_data = MTEstablishContext6},
 2322: 	   #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
 2323: 				 context_data = MTCompleteEstablishContext},
 2324: 	   #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
 2325: 				 context_data = MTContextError},
 2326: 	   #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
 2327: 				 context_data = MTMessageInContext},
 2328: 	   #'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
 2329: 				 context_data = {any_kind_of_data, {127,0,0,1}, 4001}}],
 2330:     ?match(ok, orber_test_server:testing_iiop_context(Obj, [{context, Ctx}])).
 2331: 
 2332: 
 2333: create_fake_server_ORB(Type, Port, Options, listen, _Data) ->
 2334:     {ok, _ListenSocket, NewPort} =
 2335: 	orber_socket:listen(Type, Port,
 2336: 			    [{backlog, 0}, {active, false}|Options]),
 2337:     Socket = orber_socket:connect(Type, 'localhost', NewPort, [{active, false}|Options]),
 2338:     {ok, {Type, Socket}, NewPort};
 2339: create_fake_server_ORB(Type, Port, Options, Action, Data) ->
 2340:     {ok, ListenSocket, _NewPort} =
 2341: 	orber_socket:listen(Type, Port, [{active, false}|Options]),
 2342:     Socket = orber_socket:accept(Type, ListenSocket),
 2343:     do_server_action(Type, Socket, Action, Data),
 2344:     orber_socket:close(Type, Socket),
 2345:     ok.
 2346: 
 2347: destroy_fake_ORB({Type, Socket}) ->
 2348:     orber_socket:close(Type, Socket);
 2349: destroy_fake_ORB(_) ->
 2350:     ok.
 2351: 
 2352: fake_client_ORB(Type, Host, Port, Options, connect, _Data) ->
 2353:     Socket = orber_socket:connect(Type, Host, Port, [{active, false}|Options]),
 2354:     {Type, Socket};
 2355: fake_client_ORB(Type, Host, Port, Options, Action, Data) ->
 2356:     Socket = orber_socket:connect(Type, Host, Port, [{active, false}|Options]),
 2357:     Result = do_client_action(Type, Socket, Action, Data),
 2358:     orber_socket:close(Type, Socket),
 2359:     Result.
 2360: 
 2361: 
 2362: 
 2363: do_server_action(Type, Socket, fragments, FragList) ->
 2364:     timer:sleep(3000),
 2365:     {ok, _B} = gen_tcp:recv(Socket, 0),
 2366:     ok = send_data(Type, Socket, FragList);
 2367: do_server_action(_Type, _Socket, _Action, _Data) ->
 2368:     ok.
 2369: 
 2370: do_client_action(Type, Socket, fragments, FragList) ->
 2371:     ok = send_data(Type, Socket, FragList),
 2372:     timer:sleep(3000),
 2373:     {ok, Bytes} = gen_tcp:recv(Socket, 0),
 2374:     {#reply_header{request_id = ?REQUEST_ID, reply_status = no_exception}, ok, [Par]} =
 2375: 	cdr_decode:dec_message({tk_void,[tk_any],[tk_any]}, Bytes),
 2376:     Par;
 2377: do_client_action(Type, Socket, fragments_max, FragList) ->
 2378:     ok = send_data(Type, Socket, FragList),
 2379:     timer:sleep(3000),
 2380:     {ok, Bytes} = gen_tcp:recv(Socket, 0),
 2381:     {#reply_header{request_id = ?REQUEST_ID, reply_status = system_exception}, Exc, []} =
 2382: 	cdr_decode:dec_message({tk_void,[tk_any],[tk_any]}, Bytes),
 2383:     Exc;
 2384: do_client_action(Type, Socket, message_error, Data) ->
 2385:     ok = send_data(Type, Socket, Data),
 2386:     timer:sleep(3000),
 2387:     {ok,Bytes} = gen_tcp:recv(Socket, 0),
 2388:     'message_error' = cdr_decode:dec_message({tk_void,[tk_any],[tk_any]}, Bytes),
 2389:     ok;
 2390: do_client_action(_Type, _Socket, _Action, _Data) ->
 2391:     ok.
 2392: 
 2393: send_data(_Type, _Socket, []) ->
 2394:     ok;
 2395: send_data(Type, Socket, [H|T]) ->
 2396:     orber_socket:write(Type, Socket, H),
 2397:     send_data(Type, Socket, T).
 2398: