aboutsummaryrefslogtreecommitdiffstats
path: root/lib/orber/test
diff options
context:
space:
mode:
authorNiclas Eklund <[email protected]>2010-09-20 13:25:26 +0200
committerBjörn Gustavsson <[email protected]>2010-09-21 15:35:34 +0200
commit5ddf44bb91540fd88e604f077d71482c40185cd8 (patch)
treea9fb6b22a3428444f684848accb1c5181bd32d70 /lib/orber/test
parentcedcfd6364a9ee2f36ea09b5995613375d7ab9ae (diff)
downloadotp-5ddf44bb91540fd88e604f077d71482c40185cd8.tar.gz
otp-5ddf44bb91540fd88e604f077d71482c40185cd8.tar.bz2
otp-5ddf44bb91540fd88e604f077d71482c40185cd8.zip
Add test suites for (most) CORBA applications
Diffstat (limited to 'lib/orber/test')
-rw-r--r--lib/orber/test/Makefile228
-rw-r--r--lib/orber/test/cdrcoding_10_SUITE.erl616
-rw-r--r--lib/orber/test/cdrcoding_11_SUITE.erl615
-rw-r--r--lib/orber/test/cdrcoding_12_SUITE.erl603
-rw-r--r--lib/orber/test/cdrlib_SUITE.erl487
-rw-r--r--lib/orber/test/corba_SUITE.erl909
-rw-r--r--lib/orber/test/csiv2_SUITE.erl940
-rw-r--r--lib/orber/test/data_types_SUITE.erl173
-rw-r--r--lib/orber/test/generated_SUITE.erl385
-rw-r--r--lib/orber/test/idl_output/.gitignore0
-rw-r--r--lib/orber/test/iiop_module_do_test_impl.erl112
-rw-r--r--lib/orber/test/iiop_module_test_impl.erl128
-rw-r--r--lib/orber/test/iiop_test.idl111
-rw-r--r--lib/orber/test/iiop_test_impl.erl34
-rw-r--r--lib/orber/test/interceptors_SUITE.erl338
-rw-r--r--lib/orber/test/iop_ior_10_SUITE.erl167
-rw-r--r--lib/orber/test/iop_ior_11_SUITE.erl186
-rw-r--r--lib/orber/test/iop_ior_12_SUITE.erl187
-rw-r--r--lib/orber/test/lname_SUITE.erl198
-rw-r--r--lib/orber/test/multi_ORB_SUITE.erl2352
-rw-r--r--lib/orber/test/naming_context_SUITE.erl385
-rw-r--r--lib/orber/test/orber.spec19
-rw-r--r--lib/orber/test/orber_SUITE.erl179
-rw-r--r--lib/orber/test/orber_acl_SUITE.erl303
-rw-r--r--lib/orber/test/orber_firewall_ipv4_in_SUITE.erl280
-rw-r--r--lib/orber/test/orber_firewall_ipv4_out_SUITE.erl224
-rw-r--r--lib/orber/test/orber_firewall_ipv6_in_SUITE.erl311
-rw-r--r--lib/orber/test/orber_firewall_ipv6_out_SUITE.erl231
-rw-r--r--lib/orber/test/orber_nat_SUITE.erl372
-rw-r--r--lib/orber/test/orber_test.idl95
-rw-r--r--lib/orber/test/orber_test_lib.erl1498
-rw-r--r--lib/orber/test/orber_test_server.cfg27
-rw-r--r--lib/orber/test/orber_test_server.idl153
-rw-r--r--lib/orber/test/orber_test_server_impl.erl262
-rw-r--r--lib/orber/test/orber_test_timeout_server_impl.erl65
-rw-r--r--lib/orber/test/orber_web_SUITE.erl443
-rw-r--r--lib/orber/test/tc_SUITE.erl661
37 files changed, 14277 insertions, 0 deletions
diff --git a/lib/orber/test/Makefile b/lib/orber/test/Makefile
new file mode 100644
index 0000000000..4601e84d2c
--- /dev/null
+++ b/lib/orber/test/Makefile
@@ -0,0 +1,228 @@
+#
+# %CopyrightBegin%
+#
+# Copyright Ericsson AB 1997-2010. All Rights Reserved.
+#
+# The contents of this file are subject to the Erlang Public License,
+# Version 1.1, (the "License"); you may not use this file except in
+# compliance with the License. You should have received a copy of the
+# Erlang Public License along with this software. If not, it can be
+# retrieved online at http://www.erlang.org/.
+#
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+# the License for the specific language governing rights and limitations
+# under the License.
+#
+# %CopyrightEnd%
+#
+#
+include $(ERL_TOP)/make/target.mk
+include $(ERL_TOP)/make/$(TARGET)/otp.mk
+
+# ----------------------------------------------------
+# Application version
+# ----------------------------------------------------
+include ../vsn.mk
+VSN=$(ORBER_VSN)
+# ----------------------------------------------------
+# Release directory specification
+# ----------------------------------------------------
+RELSYSDIR = $(RELEASE_PATH)/orber_test
+
+# ----------------------------------------------------
+# Target Specs
+# ----------------------------------------------------
+TEST_SPEC_FILE = orber.spec
+
+
+IDL_FILES = \
+ orber_test.idl \
+ iiop_test.idl \
+ orber_test_server.idl
+
+IDLOUTDIR = idl_output
+
+MODULES = \
+ cdrcoding_11_SUITE \
+ cdrcoding_10_SUITE \
+ cdrcoding_12_SUITE \
+ cdrlib_SUITE \
+ corba_SUITE \
+ iop_ior_11_SUITE \
+ iop_ior_10_SUITE \
+ iop_ior_12_SUITE \
+ iiop_module_do_test_impl \
+ iiop_module_test_impl \
+ lname_SUITE \
+ naming_context_SUITE \
+ orber_SUITE \
+ orber_test_server_impl \
+ orber_test_timeout_server_impl \
+ orber_test_lib \
+ csiv2_SUITE \
+ multi_ORB_SUITE \
+ data_types_SUITE \
+ tc_SUITE \
+ generated_SUITE \
+ orber_web_SUITE \
+ interceptors_SUITE \
+ orber_acl_SUITE \
+ orber_firewall_ipv4_in_SUITE \
+ orber_firewall_ipv6_in_SUITE \
+ orber_firewall_ipv4_out_SUITE \
+ orber_firewall_ipv6_out_SUITE \
+ orber_nat_SUITE
+
+GEN_MOD_ORBER = \
+ oe_orber_test \
+ Module_Except1 \
+ Module_Except2 \
+ Module_Except3 \
+ Module_Except4 \
+ Module_HEADER \
+ Module_I1 \
+ Module_I2 \
+ Module_Struct0 \
+ Module_Struct1 \
+ Module_Struct2 \
+ Module_Union \
+ Module_Union1 \
+ Module_Union2
+
+GEN_HRL_ORBER = \
+ oe_orber_test.hrl \
+ Module.hrl \
+ Module_I1.hrl \
+ Module_I2.hrl
+
+GEN_MOD_IIOP = \
+ oe_iiop_test \
+ iiop_module_Except1 \
+ iiop_module_Struct1 \
+ iiop_module_Union1 \
+ iiop_module_do_test \
+ iiop_module_test \
+ iiop_module_test_retval
+
+GEN_HRL_IIOP = \
+ oe_iiop_test.hrl \
+ iiop_module.hrl \
+ iiop_module_do_test.hrl \
+ iiop_module_test.hrl
+
+GEN_MOD_TEST_SERVER = \
+ oe_orber_test_server \
+ orber_test_server \
+ orber_test_server_ComplexUserDefinedException \
+ orber_test_server_UserDefinedException \
+ orber_test_server_struc \
+ orber_test_server_uni \
+ orber_test_server_uni_d \
+ orber_test_timeout_server \
+ orber_parent_inherrit
+
+GEN_HRL_TEST_SERVER = \
+ oe_orber_test_server.hrl \
+ orber_test_server.hrl \
+ orber_test_timeout_server.hrl
+
+GEN_MODULES = $(GEN_MOD_ORBER) $(GEN_MOD_IIOP) \
+ $(GEN_MOD_TEST_SERVER)
+
+ERL_FILES = $(MODULES:%=%.erl)
+
+HRL_FILES =
+
+GEN_HRL_FILES = $(GEN_HRL_ORBER) $(GEN_HRL_IIOP) \
+ $(GEN_HRL_TEST_SERVER)
+
+GEN_FILES = \
+ $(GEN_HRL_FILES:%=$(IDLOUTDIR)/%) \
+ $(GEN_MODULES:%=$(IDLOUTDIR)/%.erl)
+
+GEN_TARGET_FILES = $(GEN_MODULES:%=$(IDLOUTDIR)/%.$(EMULATOR))
+
+SUITE_TARGET_FILES = $(MODULES:%=%.$(EMULATOR))
+
+TARGET_FILES = \
+ $(GEN_TARGET_FILES) \
+ $(SUITE_TARGET_FILES)
+
+# ----------------------------------------------------
+# FLAGS
+# ----------------------------------------------------
+ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/orber/ebin -pa $(ERL_TOP)/lib/ic/ebin
+
+ERL_COMPILE_FLAGS += $(ERL_IDL_FLAGS) \
+ -pa $(ERL_TOP)/lib/test_server/ebin \
+ -pa $(ERL_TOP)/lib/ic/ebin \
+ -pa $(ERL_TOP)/lib/orber/ebin \
+ -I$(ERL_TOP)/lib/orber \
+ -I$(ERL_TOP)/lib/orber/test/$(IDLOUTDIR) \
+ -I$(ERL_TOP)/lib/test_server/include
+
+# ----------------------------------------------------
+# Targets
+# ----------------------------------------------------
+tests debug opt: $(TARGET_FILES)
+
+clean:
+ rm -f idl_output/*
+ rm -f $(TARGET_FILES)
+ rm -f errs core *~
+
+
+docs:
+
+# ----------------------------------------------------
+# Special Targets
+# ----------------------------------------------------
+
+#
+# Each IDL file produces many target files so no pattern
+# rule can be used.
+#
+TGT_ORBER = \
+ $(GEN_HRL_ORBER:%=$(IDLOUTDIR)/%) \
+ $(GEN_MOD_ORBER:%=$(IDLOUTDIR)/%.erl)
+TGT_IIOP = \
+ $(GEN_HRL_IIOP:%=$(IDLOUTDIR)/%) \
+ $(GEN_MOD_IIOP:%=$(IDLOUTDIR)/%.erl)
+
+TGT_TEST_SERVER = \
+ $(GEN_HRL_TEST_SERVER:%=$(IDLOUTDIR)/%) \
+ $(GEN_MOD_TEST_SERVER:%=$(IDLOUTDIR)/%.erl)
+
+$(TGT_ORBER): orber_test.idl
+ erlc $(ERL_IDL_FLAGS) -o$(IDLOUTDIR) orber_test.idl
+
+$(TGT_IIOP): iiop_test.idl
+ erlc $(ERL_IDL_FLAGS) -o$(IDLOUTDIR) \
+ +'{preproc_flags,"-I../COSS/CosNaming"}' iiop_test.idl
+
+$(TGT_TEST_SERVER): orber_test_server.idl
+ erlc $(ERL_IDL_FLAGS) -o$(IDLOUTDIR) \
+ +'{cfgfile,"orber_test_server.cfg"}' orber_test_server.idl
+
+# ----------------------------------------------------
+# Release Targets
+# ----------------------------------------------------
+# We don't copy generated intermediate erlang and hrl files
+
+include $(ERL_TOP)/make/otp_release_targets.mk
+
+release_spec:
+
+release_docs_spec:
+
+release_tests_spec: tests
+ $(INSTALL_DIR) $(RELSYSDIR)
+ $(INSTALL_DATA) $(IDL_FILES) $(TEST_SPEC_FILE) \
+ $(ERL_FILES) $(RELSYSDIR)
+ $(INSTALL_DATA) $(SUITE_TARGET_FILES) $(RELSYSDIR)
+ chmod -f -R u+w $(RELSYSDIR)
+ $(INSTALL_DIR) $(RELSYSDIR)/$(IDLOUTDIR)
+ $(INSTALL_DATA) $(GEN_TARGET_FILES) $(GEN_FILES) \
+ $(RELSYSDIR)/$(IDLOUTDIR)
+
diff --git a/lib/orber/test/cdrcoding_10_SUITE.erl b/lib/orber/test/cdrcoding_10_SUITE.erl
new file mode 100644
index 0000000000..d5d030538f
--- /dev/null
+++ b/lib/orber/test/cdrcoding_10_SUITE.erl
@@ -0,0 +1,616 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1999-2010. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%-----------------------------------------------------------------
+%%
+%% Description:
+%% Test suite for the CDR encode/decode functions
+%%
+%%-----------------------------------------------------------------
+-module(cdrcoding_10_SUITE).
+
+
+-include("idl_output/Module.hrl").
+-include("test_server.hrl").
+-include_lib("orber/include/corba.hrl").
+-include_lib("orber/src/orber_iiop.hrl").
+
+-define(default_timeout, ?t:minutes(20)).
+
+%%-----------------------------------------------------------------
+%% External exports
+%%-----------------------------------------------------------------
+-export([all/1]).
+
+%%-----------------------------------------------------------------
+%% Internal exports
+%%-----------------------------------------------------------------
+-export([]).
+-compile(export_all).
+
+%%-----------------------------------------------------------------
+%% Func: all/1
+%% Args:
+%% Returns:
+%%-----------------------------------------------------------------
+all(doc) -> ["Description", "more description"];
+all(suite) -> {req,
+ [mnesia],
+ {conf, init_all, cases(), finish_all}}.
+
+cases() ->
+ [types, reply, cancel_request, close_connection, message_error].
+%% request, locate_request, locate_reply].
+
+%%-----------------------------------------------------------------
+%% Init and cleanup functions.
+%%-----------------------------------------------------------------
+
+init_per_testcase(_Case, Config) ->
+ Path = code:which(?MODULE),
+ code:add_pathz(filename:join(filename:dirname(Path), "idl_output")),
+ ?line Dog=test_server:timetrap(?default_timeout),
+ [{watchdog, Dog}|Config].
+
+
+fin_per_testcase(_Case, Config) ->
+ Path = code:which(?MODULE),
+ code:del_path(filename:join(filename:dirname(Path), "idl_output")),
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+init_all(Config) when is_list(Config) ->
+ orber:jump_start(0),
+ if
+ is_list(Config) ->
+ Config;
+ true ->
+ exit("Config not a list")
+ end.
+
+finish_all(Config) when is_list(Config) ->
+ orber:jump_stop(),
+ Config.
+
+%%-----------------------------------------------------------------
+%% Test Case: type encoding tests
+%% Description: Just testing the complex types, the others are
+%% tested in the cdrlib SUITE.
+%%-----------------------------------------------------------------
+types(doc) -> ["Description", "more description"];
+types(suite) -> [do_register, null_type, void_type, principal_type,
+ objref_type, struct_type, union_type, string_type,
+ array_type, any_type, typecode_type, alias_type,
+ exception_type, do_unregister].
+%types(Config) when list(Config) ->
+% 'oe_orber_test':'oe_register'(),
+% null_type(),
+% void_type(),
+% principal_type(),
+% objref_type(),
+% struct_type(),
+% union_type(),
+% string_type(),
+% array_type(),
+% any_type(),
+% typecode_type(),
+% alias_type(),
+% exception_type(),
+% 'oe_orber_test':'oe_unregister'(),
+% ok.
+
+do_register(doc) -> [];
+do_register(suite) -> [];
+do_register(Config) when is_list(Config) ->
+ io:format("Pwd: ~p, mod: ~p~n",[c:pwd(), c:m('oe_orber_test')]),
+ 'oe_orber_test':'oe_register'(),
+ ok.
+do_unregister(doc) -> [];
+do_unregister(suite) -> [];
+do_unregister(Config) when is_list(Config) ->
+ 'oe_orber_test':'oe_unregister'(),
+ ok.
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: null
+%%-----------------------------------------------------------------
+null_type(doc) -> [];
+null_type(suite) -> [];
+null_type(Config) when is_list(Config) ->
+ ?line B = cdr_encode:enc_type(#giop_env{version = {1, 0}}, 'tk_null', 'null'),
+ ?line {'null', <<>>, _} = cdr_decode:dec_type('tk_null', {1, 0}, B, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: void
+%%-----------------------------------------------------------------
+void_type(doc) -> [];
+void_type(suite) -> [];
+void_type(Config) when is_list(Config) ->
+ ?line B = cdr_encode:enc_type(#giop_env{version = {1, 0}}, 'tk_void', 'ok'),
+ ?line {'ok', <<>>, _} = cdr_decode:dec_type('tk_void', {1, 0}, B, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: principal
+%%-----------------------------------------------------------------
+principal_type(doc) -> [];
+principal_type(suite) -> [];
+principal_type(Config) when is_list(Config) ->
+ ?line B0 = cdr_encode:enc_type(#giop_env{version = {1, 0}}, 'tk_Principal', "principal"),
+ ?line {"principal", <<>>, _} = cdr_decode:dec_type('tk_Principal', {1, 0}, B0, 0, big),
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 0}}, 'tk_Principal', ""),
+ ?line {"", <<>>, _} = cdr_decode:dec_type('tk_Principal', {1, 0}, B1, 0, big),
+ ?line B2 = cdr_encode:enc_type(#giop_env{version = {1, 0}}, 'tk_Principal', "principal"),
+ ?line {"principal", <<>>, _} =
+ cdr_decode:dec_type('tk_Principal', {1, 0}, B2, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: object reference
+%%-----------------------------------------------------------------
+version() -> #'IIOP_Version'{major=1,minor=0}.
+
+objref(0) ->
+ PB = #'IIOP_ProfileBody_1_0'{iiop_version=version(),
+ host="my.hostname.org",
+ port=4040,
+ object_key="ExternalKey: which is an arbitary octet sequence"},
+ TP = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB},
+ #'IOP_IOR'{type_id="IDL:Module/Interface:1.0", profiles=[TP]};
+objref(1) ->
+ K = corba_fake_mk_objkey("IDL:Module/Interface:1.0", key,
+ list_to_pid("<0.100.0>")),
+ PB = #'IIOP_ProfileBody_1_0'{iiop_version=version(),
+ host="my.hostname.org",
+ port=4040,
+ object_key=K},
+ TP = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB},
+ #'IOP_IOR'{type_id="IDL:Module/Interface:1.0", profiles=[TP]};
+objref(2) ->
+ K = corba_fake_mk_objkey("IDL:Module/Interface:1.0", registered,
+ list_to_atom("orber_nameservice")),
+ PB = #'IIOP_ProfileBody_1_0'{iiop_version=version(),
+ host="my.hostname.org",
+ port=4040,
+ object_key=K},
+ TP = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB},
+ #'IOP_IOR'{type_id="IDL:Module/Interface:1.0", profiles=[TP]}.
+
+objref_type(doc) -> [];
+objref_type(suite) -> [];
+objref_type(Config) when is_list(Config) ->
+ T = {'tk_objref', "IDL:Module/Interface:1.0", "Interface"},
+ Objref0 = objref(0),
+ ?line B0 = cdr_encode:enc_type(#giop_env{version = {1, 0}}, T, Objref0),
+ ?line {Objref0, <<>>, _} = cdr_decode:dec_type(T, {1, 0}, B0, 0, big),
+ Objref1 = objref(1),
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 0}}, T, Objref1),
+ ?line {Objref1, <<>>, _} = cdr_decode:dec_type(T, {1, 0}, B1, 0, big),
+ Objref2 = objref(2),
+ ?line B2 = cdr_encode:enc_type(#giop_env{version = {1, 0}}, T, Objref2),
+ ?line {Objref2, <<>>, _} = cdr_decode:dec_type(T, {1, 0}, B2, 0, big),
+ ok.
+
+
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: struct
+%%-----------------------------------------------------------------
+struct_type(doc) -> [];
+struct_type(suite) -> [];
+struct_type(Config) when is_list(Config) ->
+ T0 = {'tk_struct',"IDL:Module/Struct0:1.0", "Module_Struct0",
+ [{"long", 'tk_long'}, {"short", 'tk_short'}, {"character", 'tk_char'}]},
+ S0 = #'Module_Struct0'{l=-4711, s=17, c=$a},
+ ?line B0 = cdr_encode:enc_type({1, 0}, T0, S0),
+ ?line {S0, <<>>, _} = cdr_decode:dec_type(T0, {1, 0}, B0, 0, big),
+
+ T1 = {'tk_struct', "IDL:Module/Struct1:1.0", "Module_Struct1",
+ [{"string", {'tk_string', 0}}, {"ushort", 'tk_ushort'}, {"ulong", 'tk_ulong'}]},
+ S1 = #'Module_Struct1'{s="Hi !!!!", us=17, ul=4711},
+ ?line B1 = cdr_encode:enc_type({1, 0}, T1, S1),
+ ?line {S1, <<>>, _} = cdr_decode:dec_type(T1, {1, 0}, B1, 0, big),
+
+ T2 = {'tk_struct', "IDL:Module/Struct2:1.0", "Module_Struct2",
+ [{"long_sequence", {'tk_sequence', 'tk_long', 0}},
+ {"enum", {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum", ["horse", "pig", "cow"]}},
+ {"octet", 'tk_octet'}]},
+ S2 = #'Module_Struct2'{long_sequence=[4711, 350000, 0, -3030, -600000], e=cow, o=$X},
+ ?line B2 = cdr_encode:enc_type({1, 0}, T2, S2),
+ ?line {S2, <<>>, _} = cdr_decode:dec_type(T2, {1, 0}, B2, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: union
+%%-----------------------------------------------------------------
+union_type(doc) -> [];
+union_type(suite) -> [];
+union_type(Config) when is_list(Config) ->
+ T0 = {'tk_union', "IDL:Module/Union:1.0", "Union", 'tk_short', 2,
+ [{0, "First", 'tk_short'},
+ {1, "Second", {'tk_string', 0}},
+ {2, "Third", 'tk_char'}]},
+ S0 = #'Module_Union'{label=1, value="Foo Bar !"},
+ ?line B0 = cdr_encode:enc_type({1, 0}, T0, S0),
+ ?line {S0, <<>>, _} = cdr_decode:dec_type(T0, {1, 0}, B0, 0, big),
+ S1 = #'Module_Union'{label=0, value=-17},
+ ?line B1 = cdr_encode:enc_type({1, 0}, T0, S1),
+ ?line {S1, <<>>, _} = cdr_decode:dec_type(T0, {1, 0}, B1, 0, big),
+ S2 = #'Module_Union'{label=2, value=$X},
+ ?line B2 = cdr_encode:enc_type({1, 0}, T0, S2),
+ ?line {S2, <<>>, _} = cdr_decode:dec_type(T0, {1, 0}, B2, 0, big),
+ T1 = {'tk_union', "IDL:Module/Union1:1.0", "Union1",
+ {'tk_enum', "IDL:Module/Enum:1.0",
+ "Module_Enum", ["horse", "pig", "cow"]}, "pig",
+ [{"horse", "First", 'tk_ushort'},
+ {"pig", "Second", {'tk_sequence', {'tk_string', 0}, 0}},
+ {"cow", "Third", {'tk_enum', "IDL:Module/Enum1:1.0",
+ "Module_Enum1", ["orange", "banana", "apple"]}}]},
+ S3 = #'Module_Union1'{label=pig, value=["Foo", "Bar", "!"]},
+ ?line B3 = cdr_encode:enc_type({1, 0}, T1, S3),
+ ?line {S3, <<>>, _} = cdr_decode:dec_type(T1, {1, 0}, B3, 0, big),
+ S4 = #'Module_Union1'{label=cow, value=apple},
+ ?line B4 = cdr_encode:enc_type({1, 0}, T1, S4),
+ ?line {S4, <<>>, _} = cdr_decode:dec_type(T1, {1, 0}, B4, 0, big),
+ S5 = #'Module_Union1'{label=horse, value=17},
+ ?line B5 = cdr_encode:enc_type({1, 0}, T1, S5),
+ ?line {S5, <<>>, _} = cdr_decode:dec_type(T1, {1, 0}, B5, 0, big),
+ T2 = {'tk_union', "IDL:Module/Union2:1.0", "Union2",
+ {'tk_enum', "IDL:Module/Enum:1.0",
+ "Module_Enum", ["horse", "pig", "cow"]}, "pig",
+ [{"horse", "First", {'tk_array', 'tk_long', 3}},
+ {"pig", "Second",
+ {'tk_union', "IDL:Module/Union:1.0", "Union", 'tk_short', 2,
+ [{0, "First", 'tk_short'},
+ {1, "Second", {'tk_string', 0}},
+ {2, "Third", 'tk_char'}]}},
+ {"cow", "Third", {'tk_union', "IDL:Module/Union1:1.0", "Union1",
+ {'tk_enum', "IDL:Module/Enum:1.0",
+ "Module_Enum", ["horse", "pig", "cow"]}, "pig",
+ [{"horse", "First", 'tk_ushort'},
+ {"pig", "Second", {'tk_sequence',
+ {'tk_string', 0}, 0}},
+ {"cow", "Third", {'tk_enum',
+ "IDL:Module/Enum1:1.0",
+ "Module_Enum1",
+ ["orange", "banana",
+ "apple"]}}]}}]},
+ S6 = #'Module_Union2'{label=pig, value=#'Module_Union'{label=0, value=-17}},
+ ?line B6 = cdr_encode:enc_type({1, 0}, T2, S6),
+ ?line {S6, <<>>, _} = cdr_decode:dec_type(T2, {1, 0}, B6, 0, big),
+ S7 = #'Module_Union2'{label=cow, value=#'Module_Union1'{label=pig,
+ value=["Foo", "Bar", "!"]}},
+ ?line B7 = cdr_encode:enc_type({1, 0}, T2, S7),
+ ?line {S7, <<>>, _} = cdr_decode:dec_type(T2, {1, 0}, B7, 0, big),
+ S8 = #'Module_Union2'{label=horse, value={-17, 1234567890, -987654321}},
+ ?line B8 = cdr_encode:enc_type({1, 0}, T2, S8),
+ ?line {S8, <<>>, _} = cdr_decode:dec_type(T2, {1, 0}, B8, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: string
+%%-----------------------------------------------------------------
+string_type(doc) -> [];
+string_type(suite) -> [];
+string_type(Config) when is_list(Config) ->
+ S0 = "Foo Bar ???",
+ ?line B0 = cdr_encode:enc_type({1, 0}, {'tk_string', 0}, S0),
+ ?line {S0, <<>>, _} = cdr_decode:dec_type({'tk_string', 0}, {1, 0}, B0, 0, big),
+ S1 = "Yes, Foo Bar !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! more than 5000 characters",
+ ?line B1 = cdr_encode:enc_type({1, 0}, {'tk_string', 0}, S1),
+ ?line {S1, <<>>, _} = cdr_decode:dec_type({'tk_string', 0}, {1, 0}, B1, 0, big),
+ S2 = "",
+ ?line B2 = cdr_encode:enc_type({1, 0}, {'tk_string', 0}, S2),
+ ?line {S2, <<>>, _} = cdr_decode:dec_type({'tk_string', 0}, {1, 0}, B2, 0, big),
+ S3 = "\0",
+ ?line B3 = cdr_encode:enc_type({1, 0}, {'tk_string', 0}, S3),
+ ?line {S3, <<>>, _} = cdr_decode:dec_type({'tk_string', 0}, {1, 0}, B3, 0, big),
+ S4 = "~n",
+ ?line B4 = cdr_encode:enc_type({1, 0}, {'tk_string', 0}, S4),
+ ?line {S4, <<>>, _} = cdr_decode:dec_type({'tk_string', 0}, {1, 0}, B4, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: array
+%%-----------------------------------------------------------------
+array_type(doc) -> [];
+array_type(suite) -> [];
+array_type(Config) when is_list(Config) ->
+ T0 = {'tk_array', 'tk_long', 5},
+ S0 = {-100, 0, 30000, -900100900, 123456789},
+ ?line B0 = cdr_encode:enc_type(#giop_env{version = {1, 0}}, T0, S0),
+ ?line {S0, <<>>, _} = cdr_decode:dec_type(T0, {1, 0}, B0, 0, big),
+ T1 = {'tk_array', {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum", ["horse", "pig", "cow"]}, 2},
+ S1 = {pig, cow},
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 0}}, T1, S1),
+ ?line {S1, <<>>, _} = cdr_decode:dec_type(T1, {1, 0}, B1, 0, big),
+ T2 = {'tk_array', {'tk_union', "IDL:Module/Union:1.0", "Union",
+ {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum", ["horse", "pig", "cow"]}, "pig",
+ [{"horse", "First", 'tk_ushort'},
+ {"pig", "Second", {'tk_sequence', {'tk_string', 0}, 0}},
+ {"cow", "Third", {'tk_enum', "IDL:Module/Enum1:1.0",
+ "Module_Enum1", ["orange", "banana", "apple"]}}]}, 2},
+ S2 = {#'Module_Union'{label=cow, value=banana}, #'Module_Union'{label=pig, value=["This", "is", "a", "test", ""]}},
+ ?line B2 = cdr_encode:enc_type(#giop_env{version = {1, 0}}, T2, S2),
+ ?line {S2, <<>>, _} = cdr_decode:dec_type(T2, {1, 0}, B2, 0, big),
+ T3 = {'tk_array', {'tk_objref', "IDL:Module/Interface:1.0", "Interface"}, 3},
+ S3 = {objref(0), objref(1), objref(2)},
+ ?line B3 = cdr_encode:enc_type(#giop_env{version = {1, 0}}, T3, S3),
+ ?line {S3, <<>>, _} = cdr_decode:dec_type(T3, {1, 0}, B3, 0, big),
+ ok.
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: TypeCode
+%%-----------------------------------------------------------------
+any_type(doc) -> [];
+any_type(suite) -> [];
+any_type(Config) when is_list(Config) ->
+ T = 'tk_any',
+ TC = {'tk_struct', "IDL:Module/Struct2:1.0", "Module_Struct2",
+ [{"long_sequence", {'tk_sequence', 'tk_long', 0}},
+ {"enum", {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum",
+ ["horse", "pig", "cow"]}},
+ {"octet", 'tk_octet'}]},
+ S = #'Module_Struct2'{long_sequence=[4711, 350000, 0, -3030, -600000],
+ e=cow, o=$X},
+ Any = #any{typecode=TC,value=S},
+ ?line B = cdr_encode:enc_type(#giop_env{version = {1, 0}}, T,Any),
+ ?line {Any, <<>>, _} = cdr_decode:dec_type(T, {1, 0}, B, 0, big),
+ TC1 = {'tk_array', {'tk_union', "IDL:Module/Union:1.0", "Union",
+ {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum",
+ ["horse", "pig", "cow"]}, 1,
+ [{"horse", "First", 'tk_ushort'},
+ {"pig", "Second", {'tk_sequence', {'tk_string', 0}, 0}},
+ {"cow", "Third", {'tk_enum', "IDL:Module/Enum1:1.0",
+ "Module_Enum1", ["orange", "banana",
+ "apple"]}}]},2},
+ S1 = {#'Module_Union'{label=cow, value=banana}, #'Module_Union'{label=pig, value=["This", "is", "a", "test", ""]}},
+ Any1 = #any{typecode=TC1,value=S1},
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 0}}, T,Any1),
+ ?line {Any1, <<>>, _} = cdr_decode:dec_type(T, {1, 0}, B1, 0, big),
+ ok.
+
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: TypeCode
+%%-----------------------------------------------------------------
+typecode_type(doc) -> [];
+typecode_type(suite) -> [];
+typecode_type(Config) when is_list(Config) ->
+ T = 'tk_TypeCode',
+ TC = {'tk_array', {'tk_union', "IDL:Module/Union:1.0", "Union",
+ {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum",
+ ["horse", "pig", "cow"]}, 1,
+ [{"horse", "First", 'tk_ushort'},
+ {"pig", "Second", {'tk_sequence', {'tk_string', 0}, 0}},
+ {"cow", "Third", {'tk_enum', "IDL:Module/Enum1:1.0",
+ "Module_Enum1", ["orange", "banana",
+ "apple"]}}]}, 10},
+ ?line B = cdr_encode:enc_type(#giop_env{version = {1, 0}}, T,TC),
+ ?line {TC, <<>>, _} = cdr_decode:dec_type(T, {1, 0}, B, 0, big),
+ TC1 = {'tk_union', "IDL:Module/Union2:1.0", "Union2",
+ {'tk_enum', "IDL:Module/Enum:1.0",
+ "Module_Enum", ["horse", "pig", "cow"]}, 2,
+ [{"horse", "First", 'tk_long'},
+ {"pig", "Second",
+ {'tk_union', "IDL:Module/Union:1.0", "Union", 'tk_short', 2,
+ [{0, "First", 'tk_short'},
+ {1, "Second", {'tk_string', 0}},
+ {2, "Third", 'tk_char'}]}},
+ {"cow", "Third", {'tk_union', "IDL:Module/Union1:1.0", "Union1",
+ {'tk_enum', "IDL:Module/Enum:1.0",
+ "Module_Enum", ["horse", "pig", "cow"]}, 2,
+ [{"horse", "First", 'tk_ushort'},
+ {"pig", "Second", {'tk_sequence',
+ {'tk_string', 0}, 0}},
+ {"cow", "Third", {'tk_enum',
+ "IDL:Module/Enum1:1.0",
+ "Module_Enum1",
+ ["orange", "banana",
+ "apple"]}}]}}]},
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 0}}, T, TC1),
+ ?line {TC1, <<>>, _} = cdr_decode:dec_type(T, {1, 0}, B1, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: TypeCode
+%%-----------------------------------------------------------------
+alias_type(doc) -> [];
+alias_type(suite) -> [];
+alias_type(Config) when is_list(Config) ->
+ T = {'tk_alias', "IDL:Module/Alias:1.0", "Alias",
+ {'tk_struct', "IDL:Module/Struct2:1.0", "Module_Struct2",
+ [{"long_sequence", {'tk_sequence', 'tk_long', 0}},
+ {"enum", {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum",
+ ["horse", "pig", "cow"]}},
+ {"octet", 'tk_octet'}]}},
+ S = #'Module_Struct2'{long_sequence=[4711, 350000, 0, -3030, -600000],
+ e=cow, o=$X},
+ ?line B = cdr_encode:enc_type(#giop_env{version = {1, 0}}, T,S),
+ ?line {S, <<>>, _} = cdr_decode:dec_type(T, {1, 0}, B, 0, big),
+ T1 = {'tk_alias', "IDL:Module/Alias1:1.0", "Alias1",
+ {'tk_sequence', {'tk_union', "IDL:Module/Union:1.0", "Union",
+ {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum",
+ ["horse", "pig", "cow"]}, 2,
+ [{"horse", "First", 'tk_ushort'},
+ {"pig", "Second", {'tk_sequence', {'tk_string', 0}, 0}},
+ {"cow", "Third", {'tk_enum', "IDL:Module/Enum1:1.0",
+ "Module_Enum1", ["orange", "banana",
+ "apple"]}}]},0}},
+ S1 = [#'Module_Union'{label=cow, value=banana}, #'Module_Union'{label=pig, value=["This", "is", "a", "test", ""]}],
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 0}}, T1, S1),
+ ?line {S1, <<>>, _} = cdr_decode:dec_type(T1, {1, 0}, B1, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: exception
+%%-----------------------------------------------------------------
+exception_type(doc) -> [];
+exception_type(suite) -> [];
+exception_type(Config) when is_list(Config) ->
+ system_exceptions(),
+ user_exceptions(),
+ ok.
+
+system_exceptions() ->
+ E = #'UNKNOWN'{completion_status=?COMPLETED_YES},
+ {system_exception, T, E} = orber_exceptions:get_def(E),
+ ?line B = cdr_encode:enc_type(#giop_env{version = {1, 0}}, T,E),
+ ?line {E, _} = cdr_decode:dec_system_exception({1, 0}, B, 0, big),
+ E1 = #'INV_OBJREF'{completion_status=?COMPLETED_NO},
+ {system_exception, T1, E1} = orber_exceptions:get_def(E1),
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 0}}, T1,E1),
+ ?line {E1, _} = cdr_decode:dec_system_exception({1, 0}, B1, 0, big),
+ E2 = #'BAD_OPERATION'{completion_status=?COMPLETED_NO},
+ {system_exception, T2, E2} = orber_exceptions:get_def(E2),
+ ?line B2 = cdr_encode:enc_type(#giop_env{version = {1, 0}}, T2,E2),
+ ?line {E2, _} = cdr_decode:dec_system_exception({1, 0}, B2, 0, big),
+ E3 = #'INTF_REPOS'{completion_status=?COMPLETED_MAYBE},
+ {system_exception, T3, E3} = orber_exceptions:get_def(E3),
+ ?line B3 = cdr_encode:enc_type(#giop_env{version = {1, 0}}, T3,E3),
+ ?line {E3, _} = cdr_decode:dec_system_exception({1, 0}, B3, 0, big),
+ ok.
+
+user_exceptions() ->
+ E = #'Module_Except1'{rest_of_name=["I","am","testing","exceptions"], why="Error"},
+ {user_exception, T, E} = orber_exceptions:get_def(E),
+ ?line B = cdr_encode:enc_type(#giop_env{version = {1, 0}}, T, E),
+ ?line {E, _} = cdr_decode:dec_user_exception({1, 0}, B, 0, big),
+ E1 = #'Module_Except2'{e=banana,
+ s=#'Module_Struct2'{long_sequence=[12,-4040,
+ 1234567898],
+ e=horse,
+ o=$a}},
+ {user_exception, T1, E1} = orber_exceptions:get_def(E1),
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 0}}, T1, E1),
+ ?line {E1, _} = cdr_decode:dec_user_exception({1, 0}, B1, 0, big),
+ E2 = #'Module_Except3'{u=#'Module_Union1'{label=pig,value=["high","and","low"]},s=1313, o=objref(0)},
+ {user_exception, T2, E2} = orber_exceptions:get_def(E2),
+ ?line B2 = cdr_encode:enc_type(#giop_env{version = {1, 0}}, T2, E2),
+ ?line {E2, _} = cdr_decode:dec_user_exception({1, 0}, B2, 0, big),
+ E3 = #'Module_Except4'{},
+ {user_exception, T3, E3} = orber_exceptions:get_def(E3),
+ ?line B3 = cdr_encode:enc_type(#giop_env{version = {1, 0}}, T3, E3),
+ ?line {E3, _} = cdr_decode:dec_user_exception({1, 0}, B3, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: request encoding test
+%% Description: Precondition the stack must be started so the
+%% objectkey is valid.
+%%-----------------------------------------------------------------
+%request(suite) -> [];
+%request(_) ->
+% exit(not_implemented).
+
+%%-----------------------------------------------------------------
+%% Test Case: reply encoding test
+%% Description:
+%%-----------------------------------------------------------------
+reply(doc) -> ["Description", "more description"];
+reply(suite) -> [];
+reply(Config) when is_list(Config) ->
+ R = #reply_header{service_context=[], request_id=1,
+ reply_status='no_exception'},
+ ?line B = cdr_encode:enc_reply(
+ #giop_env{version = {1, 0}, request_id = 1,
+ reply_status = 'no_exception',
+ tc = {'tk_long', [], [{'tk_sequence',
+ {'tk_string', 0}, 0}]},
+ result = 1200, parameters = [["foo","Bar"]],
+ ctx = []}),
+ ?line {R, 1200, [["foo","Bar"]]} =
+ cdr_decode:dec_message({'tk_long', [], [{'tk_sequence', {'tk_string', 0},0}]},
+ B),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: cancel_request encoding test
+%% Description:
+%%-----------------------------------------------------------------
+cancel_request(doc) -> ["Description", "more description"];
+cancel_request(suite) -> [];
+cancel_request(Config) when is_list(Config) ->
+ R = #cancel_request_header{request_id=1},
+ ?line B = cdr_encode:enc_cancel_request(#giop_env{version = {1, 0},
+ request_id = 1}),
+ ?line R = cdr_decode:dec_message([], B),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: locate_request encoding test
+%% Description:
+%%-----------------------------------------------------------------
+locate_request(doc) -> ["Description", "more description"];
+locate_request(suite) -> [];
+locate_request(Config) when is_list(Config) ->
+ io:format("Function not imlpemented yet"),
+ exit(not_implemented).
+
+%%-----------------------------------------------------------------
+%% Test Case: locate_reply encoding test
+%% Description:
+%%-----------------------------------------------------------------
+locate_reply(doc) -> ["Description", "more description"];
+locate_reply(suite) -> [];
+locate_reply(Config) when is_list(Config) ->
+ io:format("Function not imlpemented yet"),
+ exit(not_implemented).
+
+%%-----------------------------------------------------------------
+%% Test Case: close_connection encoding test
+%% Description:
+%%-----------------------------------------------------------------
+close_connection(doc) -> ["Description", "more description"];
+close_connection(suite) -> [];
+close_connection(Config) when is_list(Config) ->
+ ?line B = cdr_encode:enc_close_connection(#giop_env{version = {1, 0}}),
+ ?line 'close_connection' = cdr_decode:dec_message([], B),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: message_error encoding test
+%% Description:
+%%-----------------------------------------------------------------
+message_error(doc) -> ["Description", "more description"];
+message_error(suite) -> [];
+message_error(Config) when is_list(Config) ->
+ ?line B = cdr_encode:enc_message_error(#giop_env{version = {1, 0}}),
+ ?line 'message_error' = cdr_decode:dec_message([], B),
+ ok.
+
+
+
+%%-----------------------------------------------------------------
+%% Internal functions
+%%-----------------------------------------------------------------
+corba_fake_mk_objkey(Id, 'key', Pid) when is_pid(Pid) ->
+ Key = make_objkey(),
+ {list_to_binary(Id), 'key', Key, term_to_binary(undefined),
+ term_to_binary(undefined), term_to_binary(undefined)};
+corba_fake_mk_objkey(Id, 'key', RegName) when is_atom(RegName) ->
+ Key = term_to_binary(RegName),
+ {list_to_binary(Id), 'key', Key, term_to_binary(undefined),
+ term_to_binary(undefined), term_to_binary(undefined)};
+corba_fake_mk_objkey(Id, 'registered', RegName) when is_atom(RegName) ->
+ {list_to_binary(Id), 'registered', RegName, term_to_binary(undefined),
+ term_to_binary(undefined), term_to_binary(undefined)}.
+
+make_objkey() ->
+ term_to_binary({now(), node()}).
diff --git a/lib/orber/test/cdrcoding_11_SUITE.erl b/lib/orber/test/cdrcoding_11_SUITE.erl
new file mode 100644
index 0000000000..d62fe6eb3a
--- /dev/null
+++ b/lib/orber/test/cdrcoding_11_SUITE.erl
@@ -0,0 +1,615 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%-----------------------------------------------------------------
+%%
+%% Description:
+%% Test suite for the CDR encode/decode functions
+%%
+%%-----------------------------------------------------------------
+-module(cdrcoding_11_SUITE).
+
+
+-include("idl_output/Module.hrl").
+-include("test_server.hrl").
+-include_lib("orber/include/corba.hrl").
+-include_lib("orber/src/orber_iiop.hrl").
+
+-define(default_timeout, ?t:minutes(5)).
+
+%%-----------------------------------------------------------------
+%% External exports
+%%-----------------------------------------------------------------
+-export([all/1]).
+
+%%-----------------------------------------------------------------
+%% Internal exports
+%%-----------------------------------------------------------------
+-export([]).
+-compile(export_all).
+
+%%-----------------------------------------------------------------
+%% Func: all/1
+%% Args:
+%% Returns:
+%%-----------------------------------------------------------------
+all(doc) -> ["Description", "more description"];
+all(suite) -> {req,
+ [mnesia],
+ {conf, init_all, cases(), finish_all}}.
+
+cases() ->
+ [types, reply, cancel_request, close_connection, message_error].
+%% request, locate_request, locate_reply].
+
+%%-----------------------------------------------------------------
+%% Init and cleanup functions.
+%%-----------------------------------------------------------------
+
+init_per_testcase(_Case, Config) ->
+ Path = code:which(?MODULE),
+ code:add_pathz(filename:join(filename:dirname(Path), "idl_output")),
+ ?line Dog=test_server:timetrap(?default_timeout),
+ [{watchdog, Dog}|Config].
+
+
+fin_per_testcase(_Case, Config) ->
+ Path = code:which(?MODULE),
+ code:del_path(filename:join(filename:dirname(Path), "idl_output")),
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+init_all(Config) when is_list(Config) ->
+ orber:jump_start(0),
+ if
+ is_list(Config) ->
+ Config;
+ true ->
+ exit("Config not a list")
+ end.
+
+finish_all(Config) when is_list(Config) ->
+ orber:jump_stop(),
+ Config.
+
+%%-----------------------------------------------------------------
+%% Test Case: type encoding tests
+%% Description: Just testing the complex types, the others are
+%% tested in the cdrlib SUITE.
+%%-----------------------------------------------------------------
+types(doc) -> ["Description", "more description"];
+types(suite) -> [do_register, null_type, void_type, principal_type,
+ objref_type, struct_type, union_type, string_type,
+ array_type, any_type, typecode_type, alias_type,
+ exception_type, do_unregister].
+%types(Config) when list(Config) ->
+% 'oe_orber_test':'oe_register'(),
+% null_type(),
+% void_type(),
+% principal_type(),
+% objref_type(),
+% struct_type(),
+% union_type(),
+% string_type(),
+% array_type(),
+% any_type(),
+% typecode_type(),
+% alias_type(),
+% exception_type(),
+% 'oe_orber_test':'oe_unregister'(),
+% ok.
+
+do_register(doc) -> [];
+do_register(suite) -> [];
+do_register(Config) when is_list(Config) ->
+ 'oe_orber_test':'oe_register'(),
+ ok.
+do_unregister(doc) -> [];
+do_unregister(suite) -> [];
+do_unregister(Config) when is_list(Config) ->
+ 'oe_orber_test':'oe_unregister'(),
+ ok.
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: null
+%%-----------------------------------------------------------------
+null_type(doc) -> [];
+null_type(suite) -> [];
+null_type(Config) when is_list(Config) ->
+ ?line B = cdr_encode:enc_type(#giop_env{version = {1, 1}}, 'tk_null', 'null'),
+ ?line {'null', <<>>, _} = cdr_decode:dec_type('tk_null', {1, 1}, B, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: void
+%%-----------------------------------------------------------------
+void_type(doc) -> [];
+void_type(suite) -> [];
+void_type(Config) when is_list(Config) ->
+ ?line B = cdr_encode:enc_type(#giop_env{version = {1, 1}}, 'tk_void', 'ok'),
+ ?line {'ok', <<>>, _} = cdr_decode:dec_type('tk_void', {1, 1}, B, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: principal
+%%-----------------------------------------------------------------
+principal_type(doc) -> [];
+principal_type(suite) -> [];
+principal_type(Config) when is_list(Config) ->
+ ?line B0 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, 'tk_Principal', "principal"),
+ ?line {"principal", <<>>, _} = cdr_decode:dec_type('tk_Principal', {1, 1}, B0, 0, big),
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, 'tk_Principal', ""),
+ ?line {"", <<>>, _} = cdr_decode:dec_type('tk_Principal', {1, 1}, B1, 0, big),
+ ?line B2 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, 'tk_Principal', "principal"),
+ ?line {"principal", <<>>, _} =
+ cdr_decode:dec_type('tk_Principal', {1, 1}, B2, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: object reference
+%%-----------------------------------------------------------------
+version() -> #'IIOP_Version'{major=1,minor=1}.
+
+objref(0) ->
+ PB = #'IIOP_ProfileBody_1_1'{iiop_version=version(),
+ host="my.hostname.org",
+ port=4040,
+ object_key="ExternalKey: which is an arbitary octet sequence",
+ components=[]},
+ TP = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB},
+ #'IOP_IOR'{type_id="IDL:Module/Interface:1.0", profiles=[TP]};
+objref(1) ->
+ K = corba_fake_mk_objkey("IDL:Module/Interface:1.0", key,
+ list_to_pid("<0.100.0>")),
+ PB = #'IIOP_ProfileBody_1_1'{iiop_version=version(),
+ host="my.hostname.org",
+ port=4040,
+ object_key=K, components=[]},
+ TP = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB},
+ #'IOP_IOR'{type_id="IDL:Module/Interface:1.0", profiles=[TP]};
+objref(2) ->
+ K = corba_fake_mk_objkey("IDL:Module/Interface:1.0", registered,
+ list_to_atom("orber_nameservice")),
+ PB = #'IIOP_ProfileBody_1_1'{iiop_version=version(),
+ host="my.hostname.org",
+ port=4040,
+ object_key=K, components=[]},
+ TP = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB},
+ #'IOP_IOR'{type_id="IDL:Module/Interface:1.0", profiles=[TP]}.
+
+objref_type(doc) -> [];
+objref_type(suite) -> [];
+objref_type(Config) when is_list(Config) ->
+ T = {'tk_objref', "IDL:Module/Interface:1.0", "Interface"},
+ Objref0 = objref(0),
+ ?line B0 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T, Objref0),
+ ?line {Objref0, <<>>, _} = cdr_decode:dec_type(T, {1, 1}, B0, 0, big),
+ Objref1 = objref(1),
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T, Objref1),
+ ?line {Objref1, <<>>, _} = cdr_decode:dec_type(T, {1, 1}, B1, 0, big),
+ Objref2 = objref(2),
+ ?line B2 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T, Objref2),
+ ?line {Objref2, <<>>, _} = cdr_decode:dec_type(T, {1, 1}, B2, 0, big),
+ ok.
+
+
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: struct
+%%-----------------------------------------------------------------
+struct_type(doc) -> [];
+struct_type(suite) -> [];
+struct_type(Config) when is_list(Config) ->
+ T0 = {'tk_struct',"IDL:Module/Struct0:1.0", "Module_Struct0",
+ [{"long", 'tk_long'}, {"short", 'tk_short'}, {"character", 'tk_char'}]},
+ S0 = #'Module_Struct0'{l=-4711, s=17, c=$a},
+ ?line B0 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T0, S0),
+ ?line {S0, <<>>, _} = cdr_decode:dec_type(T0, {1, 1}, B0, 0, big),
+
+ T1 = {'tk_struct', "IDL:Module/Struct1:1.0", "Module_Struct1",
+ [{"string", {'tk_string', 0}}, {"ushort", 'tk_ushort'}, {"ulong", 'tk_ulong'}]},
+ S1 = #'Module_Struct1'{s="Hi !!!!", us=17, ul=4711},
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T1, S1),
+ ?line {S1, <<>>, _} = cdr_decode:dec_type(T1, {1, 1}, B1, 0, big),
+
+ T2 = {'tk_struct', "IDL:Module/Struct2:1.0", "Module_Struct2",
+ [{"long_sequence", {'tk_sequence', 'tk_long', 0}},
+ {"enum", {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum", ["horse", "pig", "cow"]}},
+ {"octet", 'tk_octet'}]},
+ S2 = #'Module_Struct2'{long_sequence=[4711, 350000, 0, -3030, -600000], e=cow, o=$X},
+ ?line B2 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T2, S2),
+ ?line {S2, <<>>, _} = cdr_decode:dec_type(T2, {1, 1}, B2, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: union
+%%-----------------------------------------------------------------
+union_type(doc) -> [];
+union_type(suite) -> [];
+union_type(Config) when is_list(Config) ->
+ T0 = {'tk_union', "IDL:Module/Union:1.0", "Union", 'tk_short', 2,
+ [{0, "First", 'tk_short'},
+ {1, "Second", {'tk_string', 0}},
+ {2, "Third", 'tk_char'}]},
+ S0 = #'Module_Union'{label=1, value="Foo Bar !"},
+ ?line B0 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T0, S0),
+ ?line {S0, <<>>, _} = cdr_decode:dec_type(T0, {1, 1}, B0, 0, big),
+ S1 = #'Module_Union'{label=0, value=-17},
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T0, S1),
+ ?line {S1, <<>>, _} = cdr_decode:dec_type(T0, {1, 1}, B1, 0, big),
+ S2 = #'Module_Union'{label=2, value=$X},
+ ?line B2 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T0, S2),
+ ?line {S2, <<>>, _} = cdr_decode:dec_type(T0, {1, 1}, B2, 0, big),
+ T1 = {'tk_union', "IDL:Module/Union1:1.0", "Union1",
+ {'tk_enum', "IDL:Module/Enum:1.0",
+ "Module_Enum", ["horse", "pig", "cow"]}, "pig",
+ [{"horse", "First", 'tk_ushort'},
+ {"pig", "Second", {'tk_sequence', {'tk_string', 0}, 0}},
+ {"cow", "Third", {'tk_enum', "IDL:Module/Enum1:1.0",
+ "Module_Enum1", ["orange", "banana", "apple"]}}]},
+ S3 = #'Module_Union1'{label=pig, value=["Foo", "Bar", "!"]},
+ ?line B3 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T1, S3),
+ ?line {S3, <<>>, _} = cdr_decode:dec_type(T1, {1, 1}, B3, 0, big),
+ S4 = #'Module_Union1'{label=cow, value=apple},
+ ?line B4 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T1, S4),
+ ?line {S4, <<>>, _} = cdr_decode:dec_type(T1, {1, 1}, B4, 0, big),
+ S5 = #'Module_Union1'{label=horse, value=17},
+ ?line B5 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T1, S5),
+ ?line {S5, <<>>, _} = cdr_decode:dec_type(T1, {1, 1}, B5, 0, big),
+ T2 = {'tk_union', "IDL:Module/Union2:1.0", "Union2",
+ {'tk_enum', "IDL:Module/Enum:1.0",
+ "Module_Enum", ["horse", "pig", "cow"]}, "pig",
+ [{"horse", "First", {'tk_array', 'tk_long', 3}},
+ {"pig", "Second",
+ {'tk_union', "IDL:Module/Union:1.0", "Union", 'tk_short', 2,
+ [{0, "First", 'tk_short'},
+ {1, "Second", {'tk_string', 0}},
+ {2, "Third", 'tk_char'}]}},
+ {"cow", "Third", {'tk_union', "IDL:Module/Union1:1.0", "Union1",
+ {'tk_enum', "IDL:Module/Enum:1.0",
+ "Module_Enum", ["horse", "pig", "cow"]}, "pig",
+ [{"horse", "First", 'tk_ushort'},
+ {"pig", "Second", {'tk_sequence',
+ {'tk_string', 0}, 0}},
+ {"cow", "Third", {'tk_enum',
+ "IDL:Module/Enum1:1.0",
+ "Module_Enum1",
+ ["orange", "banana",
+ "apple"]}}]}}]},
+ S6 = #'Module_Union2'{label=pig, value=#'Module_Union'{label=0, value=-17}},
+ ?line B6 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T2, S6),
+ ?line {S6, <<>>, _} = cdr_decode:dec_type(T2, {1, 1}, B6, 0, big),
+ S7 = #'Module_Union2'{label=cow, value=#'Module_Union1'{label=pig,
+ value=["Foo", "Bar", "!"]}},
+ ?line B7 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T2, S7),
+ ?line {S7, <<>>, _} = cdr_decode:dec_type(T2, {1, 1}, B7, 0, big),
+ S8 = #'Module_Union2'{label=horse, value={-17, 1234567890, -987654321}},
+ ?line B8 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T2, S8),
+ ?line {S8, <<>>, _} = cdr_decode:dec_type(T2, {1, 1}, B8, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: string
+%%-----------------------------------------------------------------
+string_type(doc) -> [];
+string_type(suite) -> [];
+string_type(Config) when is_list(Config) ->
+ S0 = "Foo Bar ???",
+ ?line B0 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, {'tk_string', 0}, S0),
+ ?line {S0, <<>>, _} = cdr_decode:dec_type({'tk_string', 0}, {1, 1}, B0, 0, big),
+ S1 = "Yes, Foo Bar !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! more than 5000 characters",
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, {'tk_string', 0}, S1),
+ ?line {S1, <<>>, _} = cdr_decode:dec_type({'tk_string', 0}, {1, 1}, B1, 0, big),
+ S2 = "",
+ ?line B2 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, {'tk_string', 0}, S2),
+ ?line {S2, <<>>, _} = cdr_decode:dec_type({'tk_string', 0}, {1, 1}, B2, 0, big),
+ S3 = "\0",
+ ?line B3 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, {'tk_string', 0}, S3),
+ ?line {S3, <<>>, _} = cdr_decode:dec_type({'tk_string', 0}, {1, 1}, B3, 0, big),
+ S4 = "~n",
+ ?line B4 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, {'tk_string', 0}, S4),
+ ?line {S4, <<>>, _} = cdr_decode:dec_type({'tk_string', 0}, {1, 1}, B4, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: array
+%%-----------------------------------------------------------------
+array_type(doc) -> [];
+array_type(suite) -> [];
+array_type(Config) when is_list(Config) ->
+ T0 = {'tk_array', 'tk_long', 5},
+ S0 = {-100, 0, 30000, -900100900, 123456789},
+ ?line B0 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T0, S0),
+ ?line {S0, <<>>, _} = cdr_decode:dec_type(T0, {1, 1}, B0, 0, big),
+ T1 = {'tk_array', {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum", ["horse", "pig", "cow"]}, 2},
+ S1 = {pig, cow},
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T1, S1),
+ ?line {S1, <<>>, _} = cdr_decode:dec_type(T1, {1, 1}, B1, 0, big),
+ T2 = {'tk_array', {'tk_union', "IDL:Module/Union:1.0", "Union",
+ {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum", ["horse", "pig", "cow"]}, "pig",
+ [{"horse", "First", 'tk_ushort'},
+ {"pig", "Second", {'tk_sequence', {'tk_string', 0}, 0}},
+ {"cow", "Third", {'tk_enum', "IDL:Module/Enum1:1.0",
+ "Module_Enum1", ["orange", "banana", "apple"]}}]}, 2},
+ S2 = {#'Module_Union'{label=cow, value=banana}, #'Module_Union'{label=pig, value=["This", "is", "a", "test", ""]}},
+ ?line B2 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T2, S2),
+ ?line {S2, <<>>, _} = cdr_decode:dec_type(T2, {1, 1}, B2, 0, big),
+ T3 = {'tk_array', {'tk_objref', "IDL:Module/Interface:1.0", "Interface"}, 3},
+ S3 = {objref(0), objref(1), objref(2)},
+ ?line B3 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T3, S3),
+ ?line {S3, <<>>, _} = cdr_decode:dec_type(T3, {1, 1}, B3, 0, big),
+ ok.
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: TypeCode
+%%-----------------------------------------------------------------
+any_type(doc) -> [];
+any_type(suite) -> [];
+any_type(Config) when is_list(Config) ->
+ T = 'tk_any',
+ TC = {'tk_struct', "IDL:Module/Struct2:1.0", "Module_Struct2",
+ [{"long_sequence", {'tk_sequence', 'tk_long', 0}},
+ {"enum", {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum",
+ ["horse", "pig", "cow"]}},
+ {"octet", 'tk_octet'}]},
+ S = #'Module_Struct2'{long_sequence=[4711, 350000, 0, -3030, -600000],
+ e=cow, o=$X},
+ Any = #any{typecode=TC,value=S},
+ ?line B = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T,Any),
+ ?line {Any, <<>>, _} = cdr_decode:dec_type(T, {1, 1}, B, 0, big),
+ TC1 = {'tk_array', {'tk_union', "IDL:Module/Union:1.0", "Union",
+ {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum",
+ ["horse", "pig", "cow"]}, 1,
+ [{"horse", "First", 'tk_ushort'},
+ {"pig", "Second", {'tk_sequence', {'tk_string', 0}, 0}},
+ {"cow", "Third", {'tk_enum', "IDL:Module/Enum1:1.0",
+ "Module_Enum1", ["orange", "banana",
+ "apple"]}}]},2},
+ S1 = {#'Module_Union'{label=cow, value=banana}, #'Module_Union'{label=pig, value=["This", "is", "a", "test", ""]}},
+ Any1 = #any{typecode=TC1,value=S1},
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T,Any1),
+ ?line {Any1, <<>>, _} = cdr_decode:dec_type(T, {1, 1}, B1, 0, big),
+ ok.
+
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: TypeCode
+%%-----------------------------------------------------------------
+typecode_type(doc) -> [];
+typecode_type(suite) -> [];
+typecode_type(Config) when is_list(Config) ->
+ T = 'tk_TypeCode',
+ TC = {'tk_array', {'tk_union', "IDL:Module/Union:1.0", "Union",
+ {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum",
+ ["horse", "pig", "cow"]}, 1,
+ [{"horse", "First", 'tk_ushort'},
+ {"pig", "Second", {'tk_sequence', {'tk_string', 0}, 0}},
+ {"cow", "Third", {'tk_enum', "IDL:Module/Enum1:1.0",
+ "Module_Enum1", ["orange", "banana",
+ "apple"]}}]}, 10},
+ ?line B = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T,TC),
+ ?line {TC, <<>>, _} = cdr_decode:dec_type(T, {1, 1}, B, 0, big),
+ TC1 = {'tk_union', "IDL:Module/Union2:1.0", "Union2",
+ {'tk_enum', "IDL:Module/Enum:1.0",
+ "Module_Enum", ["horse", "pig", "cow"]}, 2,
+ [{"horse", "First", 'tk_long'},
+ {"pig", "Second",
+ {'tk_union', "IDL:Module/Union:1.0", "Union", 'tk_short', 2,
+ [{0, "First", 'tk_short'},
+ {1, "Second", {'tk_string', 0}},
+ {2, "Third", 'tk_char'}]}},
+ {"cow", "Third", {'tk_union', "IDL:Module/Union1:1.0", "Union1",
+ {'tk_enum', "IDL:Module/Enum:1.0",
+ "Module_Enum", ["horse", "pig", "cow"]}, 2,
+ [{"horse", "First", 'tk_ushort'},
+ {"pig", "Second", {'tk_sequence',
+ {'tk_string', 0}, 0}},
+ {"cow", "Third", {'tk_enum',
+ "IDL:Module/Enum1:1.0",
+ "Module_Enum1",
+ ["orange", "banana",
+ "apple"]}}]}}]},
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T, TC1),
+ ?line {TC1, <<>>, _} = cdr_decode:dec_type(T, {1, 1}, B1, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: TypeCode
+%%-----------------------------------------------------------------
+alias_type(doc) -> [];
+alias_type(suite) -> [];
+alias_type(Config) when is_list(Config) ->
+ T = {'tk_alias', "IDL:Module/Alias:1.0", "Alias",
+ {'tk_struct', "IDL:Module/Struct2:1.0", "Module_Struct2",
+ [{"long_sequence", {'tk_sequence', 'tk_long', 0}},
+ {"enum", {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum",
+ ["horse", "pig", "cow"]}},
+ {"octet", 'tk_octet'}]}},
+ S = #'Module_Struct2'{long_sequence=[4711, 350000, 0, -3030, -600000],
+ e=cow, o=$X},
+ ?line B = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T,S),
+ ?line {S, <<>>, _} = cdr_decode:dec_type(T, {1, 1}, B, 0, big),
+ T1 = {'tk_alias', "IDL:Module/Alias1:1.0", "Alias1",
+ {'tk_sequence', {'tk_union', "IDL:Module/Union:1.0", "Union",
+ {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum",
+ ["horse", "pig", "cow"]}, 2,
+ [{"horse", "First", 'tk_ushort'},
+ {"pig", "Second", {'tk_sequence', {'tk_string', 0}, 0}},
+ {"cow", "Third", {'tk_enum', "IDL:Module/Enum1:1.0",
+ "Module_Enum1", ["orange", "banana",
+ "apple"]}}]},0}},
+ S1 = [#'Module_Union'{label=cow, value=banana}, #'Module_Union'{label=pig, value=["This", "is", "a", "test", ""]}],
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T1, S1),
+ ?line {S1, <<>>, _} = cdr_decode:dec_type(T1, {1, 1}, B1, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: exception
+%%-----------------------------------------------------------------
+exception_type(doc) -> [];
+exception_type(suite) -> [];
+exception_type(Config) when is_list(Config) ->
+ system_exceptions(),
+ user_exceptions(),
+ ok.
+
+system_exceptions() ->
+ E = #'UNKNOWN'{completion_status=?COMPLETED_YES},
+ {system_exception, T, E} = orber_exceptions:get_def(E),
+ ?line B = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T,E),
+ ?line {E, _} = cdr_decode:dec_system_exception({1, 1}, B, 0, big),
+ E1 = #'INV_OBJREF'{completion_status=?COMPLETED_NO},
+ {system_exception, T1, E1} = orber_exceptions:get_def(E1),
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T1,E1),
+ ?line {E1, _} = cdr_decode:dec_system_exception({1, 1}, B1, 0, big),
+ E2 = #'BAD_OPERATION'{completion_status=?COMPLETED_NO},
+ {system_exception, T2, E2} = orber_exceptions:get_def(E2),
+ ?line B2 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T2,E2),
+ ?line {E2, _} = cdr_decode:dec_system_exception({1, 1}, B2, 0, big),
+ E3 = #'INTF_REPOS'{completion_status=?COMPLETED_MAYBE},
+ {system_exception, T3, E3} = orber_exceptions:get_def(E3),
+ ?line B3 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T3,E3),
+ ?line {E3, _} = cdr_decode:dec_system_exception({1, 1}, B3, 0, big),
+ ok.
+
+user_exceptions() ->
+ E = #'Module_Except1'{rest_of_name=["I","am","testing","exceptions"], why="Error"},
+ {user_exception, T, E} = orber_exceptions:get_def(E),
+ ?line B = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T, E),
+ ?line {E, _} = cdr_decode:dec_user_exception({1, 1}, B, 0, big),
+ E1 = #'Module_Except2'{e=banana,
+ s=#'Module_Struct2'{long_sequence=[12,-4040,
+ 1234567898],
+ e=horse,
+ o=$a}},
+ {user_exception, T1, E1} = orber_exceptions:get_def(E1),
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T1, E1),
+ ?line {E1, _} = cdr_decode:dec_user_exception({1, 1}, B1, 0, big),
+ E2 = #'Module_Except3'{u=#'Module_Union1'{label=pig,value=["high","and","low"]},s=1313, o=objref(0)},
+ {user_exception, T2, E2} = orber_exceptions:get_def(E2),
+ ?line B2 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T2, E2),
+ ?line {E2, _} = cdr_decode:dec_user_exception({1, 1}, B2, 0, big),
+ E3 = #'Module_Except4'{},
+ {user_exception, T3, E3} = orber_exceptions:get_def(E3),
+ ?line B3 = cdr_encode:enc_type(#giop_env{version = {1, 1}}, T3, E3),
+ ?line {E3, _} = cdr_decode:dec_user_exception({1, 1}, B3, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: request encoding test
+%% Description: Precondition the stack must be started so the
+%% objectkey is valid.
+%%-----------------------------------------------------------------
+%request(suite) -> [];
+%request(_) ->
+% exit(not_implemented).
+
+%%-----------------------------------------------------------------
+%% Test Case: reply encoding test
+%% Description:
+%%-----------------------------------------------------------------
+reply(doc) -> ["Description", "more description"];
+reply(suite) -> [];
+reply(Config) when is_list(Config) ->
+ R = #reply_header{service_context=[], request_id=1,
+ reply_status='no_exception'},
+ ?line B = cdr_encode:enc_reply(#giop_env{version = {1, 1}, request_id = 1,
+ reply_status = 'no_exception',
+ tc = {'tk_long', [], [{'tk_sequence',
+ {'tk_string', 0}, 0}]},
+ result = 1200, parameters = [["foo","Bar"]],
+ ctx = []}),
+ ?line {R, 1200, [["foo","Bar"]]} =
+ cdr_decode:dec_message({'tk_long', [], [{'tk_sequence', {'tk_string', 0},0}]},
+ B),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: cancel_request encoding test
+%% Description:
+%%-----------------------------------------------------------------
+cancel_request(doc) -> ["Description", "more description"];
+cancel_request(suite) -> [];
+cancel_request(Config) when is_list(Config) ->
+ R = #cancel_request_header{request_id=1},
+ ?line B = cdr_encode:enc_cancel_request(#giop_env{version = {1, 1},
+ request_id = 1}),
+ ?line R = cdr_decode:dec_message([], B),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: locate_request encoding test
+%% Description:
+%%-----------------------------------------------------------------
+locate_request(doc) -> ["Description", "more description"];
+locate_request(suite) -> [];
+locate_request(Config) when is_list(Config) ->
+ io:format("Function not imlpemented yet"),
+ exit(not_implemented).
+
+%%-----------------------------------------------------------------
+%% Test Case: locate_reply encoding test
+%% Description:
+%%-----------------------------------------------------------------
+locate_reply(doc) -> ["Description", "more description"];
+locate_reply(suite) -> [];
+locate_reply(Config) when is_list(Config) ->
+ io:format("Function not imlpemented yet"),
+ exit(not_implemented).
+
+%%-----------------------------------------------------------------
+%% Test Case: close_connection encoding test
+%% Description:
+%%-----------------------------------------------------------------
+close_connection(doc) -> ["Description", "more description"];
+close_connection(suite) -> [];
+close_connection(Config) when is_list(Config) ->
+ ?line B = cdr_encode:enc_close_connection(#giop_env{version = {1, 1}}),
+ ?line 'close_connection' = cdr_decode:dec_message([], B),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: message_error encoding test
+%% Description:
+%%-----------------------------------------------------------------
+message_error(doc) -> ["Description", "more description"];
+message_error(suite) -> [];
+message_error(Config) when is_list(Config) ->
+ ?line B = cdr_encode:enc_message_error(#giop_env{version = {1, 1}}),
+ ?line 'message_error' = cdr_decode:dec_message([], B),
+ ok.
+
+
+
+%%-----------------------------------------------------------------
+%% Internal functions
+%%-----------------------------------------------------------------
+corba_fake_mk_objkey(Id, 'key', Pid) when is_pid(Pid) ->
+ Key = make_objkey(),
+ {list_to_binary(Id), 'key', Key, term_to_binary(undefined),
+ term_to_binary(undefined), term_to_binary(undefined)};
+corba_fake_mk_objkey(Id, 'key', RegName) when is_atom(RegName) ->
+ Key = term_to_binary(RegName),
+ {list_to_binary(Id), 'key', Key, term_to_binary(undefined),
+ term_to_binary(undefined), term_to_binary(undefined)};
+corba_fake_mk_objkey(Id, 'registered', RegName) when is_atom(RegName) ->
+ {list_to_binary(Id), 'registered', RegName, term_to_binary(undefined),
+ term_to_binary(undefined), term_to_binary(undefined)}.
+
+make_objkey() ->
+ term_to_binary({now(), node()}).
diff --git a/lib/orber/test/cdrcoding_12_SUITE.erl b/lib/orber/test/cdrcoding_12_SUITE.erl
new file mode 100644
index 0000000000..18e8eaa08a
--- /dev/null
+++ b/lib/orber/test/cdrcoding_12_SUITE.erl
@@ -0,0 +1,603 @@
+%%----------------------------------------------------------------------
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2000-2010. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%-----------------------------------------------------------------
+%%
+%% Description:
+%% Test suite for the CDR encode/decode functions
+%%
+%%-----------------------------------------------------------------
+
+-module(cdrcoding_12_SUITE).
+
+-include("idl_output/Module.hrl").
+-include("test_server.hrl").
+-include_lib("orber/include/corba.hrl").
+-include_lib("orber/src/orber_iiop.hrl").
+
+-define(default_timeout, ?t:minutes(5)).
+
+%%-----------------------------------------------------------------
+%% External exports
+%%-----------------------------------------------------------------
+-export([all/1]).
+
+%%-----------------------------------------------------------------
+%% Internal exports
+%%-----------------------------------------------------------------
+-export([]).
+-compile(export_all).
+
+%%-----------------------------------------------------------------
+%% Func: all/1
+%% Args:
+%% Returns:
+%%-----------------------------------------------------------------
+all(doc) -> ["Description", "more description"];
+all(suite) -> {req,
+ [mnesia],
+ {conf, init_all, cases(), finish_all}}.
+
+cases() ->
+ [types, reply, cancel_request, close_connection, message_error].
+%% request, locate_request, locate_reply].
+
+%%-----------------------------------------------------------------
+%% Init and cleanup functions.
+%%-----------------------------------------------------------------
+
+init_per_testcase(_Case, Config) ->
+ Path = code:which(?MODULE),
+ code:add_pathz(filename:join(filename:dirname(Path), "idl_output")),
+ ?line Dog=test_server:timetrap(?default_timeout),
+ [{watchdog, Dog}|Config].
+
+
+fin_per_testcase(_Case, Config) ->
+ Path = code:which(?MODULE),
+ code:del_path(filename:join(filename:dirname(Path), "idl_output")),
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+init_all(Config) when is_list(Config) ->
+ orber:jump_start(0),
+ if
+ is_list(Config) ->
+ Config;
+ true ->
+ exit("Config not a list")
+ end.
+
+finish_all(Config) when is_list(Config) ->
+ orber:jump_stop(),
+ Config.
+
+%%-----------------------------------------------------------------
+%% Test Case: type encoding tests
+%% Description: Just testing the complex types, the others are
+%% tested in the cdrlib SUITE.
+%%-----------------------------------------------------------------
+types(doc) -> ["Description", "more description"];
+types(suite) -> [do_register, null_type, void_type, principal_type,
+ objref_type, struct_type, union_type, string_type,
+ array_type, any_type, typecode_type, alias_type,
+ exception_type, do_unregister].
+
+do_register(doc) -> [];
+do_register(suite) -> [];
+do_register(Config) when is_list(Config) ->
+ 'oe_orber_test':'oe_register'(),
+ ok.
+do_unregister(doc) -> [];
+do_unregister(suite) -> [];
+do_unregister(Config) when is_list(Config) ->
+ 'oe_orber_test':'oe_unregister'(),
+ ok.
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: null
+%%-----------------------------------------------------------------
+null_type(doc) -> [];
+null_type(suite) -> [];
+null_type(Config) when is_list(Config) ->
+ ?line B = cdr_encode:enc_type(#giop_env{version = {1, 2}}, 'tk_null', 'null'),
+ ?line {'null', <<>>, _} = cdr_decode:dec_type('tk_null', {1, 2}, B, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: void
+%%-----------------------------------------------------------------
+void_type(doc) -> [];
+void_type(suite) -> [];
+void_type(Config) when is_list(Config) ->
+ ?line B = cdr_encode:enc_type(#giop_env{version = {1, 2}}, 'tk_void', 'ok'),
+ ?line {'ok', <<>>, _} = cdr_decode:dec_type('tk_void', {1, 2}, B, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: principal
+%%-----------------------------------------------------------------
+principal_type(doc) -> [];
+principal_type(suite) -> [];
+principal_type(Config) when is_list(Config) ->
+ ?line B0 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, 'tk_Principal', "principal"),
+ ?line {"principal", <<>>, _} = cdr_decode:dec_type('tk_Principal', {1, 2}, B0, 0, big),
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, 'tk_Principal', ""),
+ ?line {"", <<>>, _} = cdr_decode:dec_type('tk_Principal', {1, 2}, B1, 0, big),
+ ?line B2 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, 'tk_Principal', "principal"),
+ ?line {"principal", <<>>, _} =
+ cdr_decode:dec_type('tk_Principal', {1, 2}, B2, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: object reference
+%%-----------------------------------------------------------------
+version() -> #'IIOP_Version'{major=1,minor=2}.
+
+objref(0) ->
+ PB = #'IIOP_ProfileBody_1_1'{iiop_version=version(),
+ host="my.hostname.org",
+ port=4040,
+ object_key="ExternalKey: which is an arbitary octet sequence",
+ components=[]},
+ TP = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB},
+ #'IOP_IOR'{type_id="IDL:Module/Interface:1.0", profiles=[TP]};
+objref(1) ->
+ K = corba_fake_mk_objkey("IDL:Module/Interface:1.0", key,
+ list_to_pid("<0.100.0>")),
+ PB = #'IIOP_ProfileBody_1_1'{iiop_version=version(),
+ host="my.hostname.org",
+ port=4040,
+ object_key=K, components=[]},
+ TP = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB},
+ #'IOP_IOR'{type_id="IDL:Module/Interface:1.0", profiles=[TP]};
+objref(2) ->
+ K = corba_fake_mk_objkey("IDL:Module/Interface:1.0", registered,
+ list_to_atom("orber_nameservice")),
+ PB = #'IIOP_ProfileBody_1_1'{iiop_version=version(),
+ host="my.hostname.org",
+ port=4040,
+ object_key=K, components=[]},
+ TP = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB},
+ #'IOP_IOR'{type_id="IDL:Module/Interface:1.0", profiles=[TP]}.
+
+objref_type(doc) -> [];
+objref_type(suite) -> [];
+objref_type(Config) when is_list(Config) ->
+ T = {'tk_objref', "IDL:Module/Interface:1.0", "Interface"},
+ Objref0 = objref(0),
+ ?line B0 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T, Objref0),
+ ?line {Objref0, <<>>, _} = cdr_decode:dec_type(T, {1, 2}, B0, 0, big),
+ Objref1 = objref(1),
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T, Objref1),
+ ?line {Objref1, <<>>, _} = cdr_decode:dec_type(T, {1, 2}, B1, 0, big),
+ Objref2 = objref(2),
+ ?line B2 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T, Objref2),
+ ?line {Objref2, <<>>, _} = cdr_decode:dec_type(T, {1, 2}, B2, 0, big),
+ ok.
+
+
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: struct
+%%-----------------------------------------------------------------
+struct_type(doc) -> [];
+struct_type(suite) -> [];
+struct_type(Config) when is_list(Config) ->
+ T0 = {'tk_struct',"IDL:Module/Struct0:1.0", "Module_Struct0",
+ [{"long", 'tk_long'}, {"short", 'tk_short'}, {"character", 'tk_char'}]},
+ S0 = #'Module_Struct0'{l=-4711, s=17, c=$a},
+ ?line B0 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T0, S0),
+ ?line {S0, <<>>, _} = cdr_decode:dec_type(T0, {1, 2}, B0, 0, big),
+
+ T1 = {'tk_struct', "IDL:Module/Struct1:1.0", "Module_Struct1",
+ [{"string", {'tk_string', 0}}, {"ushort", 'tk_ushort'}, {"ulong", 'tk_ulong'}]},
+ S1 = #'Module_Struct1'{s="Hi !!!!", us=17, ul=4711},
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T1, S1),
+ ?line {S1, <<>>, _} = cdr_decode:dec_type(T1, {1, 2}, B1, 0, big),
+
+ T2 = {'tk_struct', "IDL:Module/Struct2:1.0", "Module_Struct2",
+ [{"long_sequence", {'tk_sequence', 'tk_long', 0}},
+ {"enum", {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum", ["horse", "pig", "cow"]}},
+ {"octet", 'tk_octet'}]},
+ S2 = #'Module_Struct2'{long_sequence=[4711, 350000, 0, -3030, -600000], e=cow, o=$X},
+ ?line B2 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T2, S2),
+ ?line {S2, <<>>, _} = cdr_decode:dec_type(T2, {1, 2}, B2, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: union
+%%-----------------------------------------------------------------
+union_type(doc) -> [];
+union_type(suite) -> [];
+union_type(Config) when is_list(Config) ->
+ T0 = {'tk_union', "IDL:Module/Union:1.0", "Union", 'tk_short', 2,
+ [{0, "First", 'tk_short'},
+ {1, "Second", {'tk_string', 0}},
+ {2, "Third", 'tk_char'}]},
+ S0 = #'Module_Union'{label=1, value="Foo Bar !"},
+ ?line B0 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T0, S0),
+ ?line {S0, <<>>, _} = cdr_decode:dec_type(T0, {1, 2}, B0, 0, big),
+ S1 = #'Module_Union'{label=0, value=-17},
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T0, S1),
+ ?line {S1, <<>>, _} = cdr_decode:dec_type(T0, {1, 2}, B1, 0, big),
+ S2 = #'Module_Union'{label=2, value=$X},
+ ?line B2 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T0, S2),
+ ?line {S2, <<>>, _} = cdr_decode:dec_type(T0, {1, 2}, B2, 0, big),
+ T1 = {'tk_union', "IDL:Module/Union1:1.0", "Union1",
+ {'tk_enum', "IDL:Module/Enum:1.0",
+ "Module_Enum", ["horse", "pig", "cow"]}, "pig",
+ [{"horse", "First", 'tk_ushort'},
+ {"pig", "Second", {'tk_sequence', {'tk_string', 0}, 0}},
+ {"cow", "Third", {'tk_enum', "IDL:Module/Enum1:1.0",
+ "Module_Enum1", ["orange", "banana", "apple"]}}]},
+ S3 = #'Module_Union1'{label=pig, value=["Foo", "Bar", "!"]},
+ ?line B3 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T1, S3),
+ ?line {S3, <<>>, _} = cdr_decode:dec_type(T1, {1, 2}, B3, 0, big),
+ S4 = #'Module_Union1'{label=cow, value=apple},
+ ?line B4 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T1, S4),
+ ?line {S4, <<>>, _} = cdr_decode:dec_type(T1, {1, 2}, B4, 0, big),
+ S5 = #'Module_Union1'{label=horse, value=17},
+ ?line B5 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T1, S5),
+ ?line {S5, <<>>, _} = cdr_decode:dec_type(T1, {1, 2}, B5, 0, big),
+ T2 = {'tk_union', "IDL:Module/Union2:1.0", "Union2",
+ {'tk_enum', "IDL:Module/Enum:1.0",
+ "Module_Enum", ["horse", "pig", "cow"]}, "pig",
+ [{"horse", "First", {'tk_array', 'tk_long', 3}},
+ {"pig", "Second",
+ {'tk_union', "IDL:Module/Union:1.0", "Union", 'tk_short', 2,
+ [{0, "First", 'tk_short'},
+ {1, "Second", {'tk_string', 0}},
+ {2, "Third", 'tk_char'}]}},
+ {"cow", "Third", {'tk_union', "IDL:Module/Union1:1.0", "Union1",
+ {'tk_enum', "IDL:Module/Enum:1.0",
+ "Module_Enum", ["horse", "pig", "cow"]}, "pig",
+ [{"horse", "First", 'tk_ushort'},
+ {"pig", "Second", {'tk_sequence',
+ {'tk_string', 0}, 0}},
+ {"cow", "Third", {'tk_enum',
+ "IDL:Module/Enum1:1.0",
+ "Module_Enum1",
+ ["orange", "banana",
+ "apple"]}}]}}]},
+ S6 = #'Module_Union2'{label=pig, value=#'Module_Union'{label=0, value=-17}},
+ ?line B6 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T2, S6),
+ ?line {S6, <<>>, _} = cdr_decode:dec_type(T2, {1, 2}, B6, 0, big),
+ S7 = #'Module_Union2'{label=cow, value=#'Module_Union1'{label=pig,
+ value=["Foo", "Bar", "!"]}},
+ ?line B7 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T2, S7),
+ ?line {S7, <<>>, _} = cdr_decode:dec_type(T2, {1, 2}, B7, 0, big),
+ S8 = #'Module_Union2'{label=horse, value={-17, 1234567890, -987654321}},
+ ?line B8 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T2, S8),
+ ?line {S8, <<>>, _} = cdr_decode:dec_type(T2, {1, 2}, B8, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: string
+%%-----------------------------------------------------------------
+string_type(doc) -> [];
+string_type(suite) -> [];
+string_type(Config) when is_list(Config) ->
+ S0 = "Foo Bar ???",
+ ?line B0 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, {'tk_string', 0}, S0),
+ ?line {S0, <<>>, _} = cdr_decode:dec_type({'tk_string', 0}, {1, 2}, B0, 0, big),
+ S1 = "Yes, Foo Bar !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! more than 5000 characters",
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, {'tk_string', 0}, S1),
+ ?line {S1, <<>>, _} = cdr_decode:dec_type({'tk_string', 0}, {1, 2}, B1, 0, big),
+ S2 = "",
+ ?line B2 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, {'tk_string', 0}, S2),
+ ?line {S2, <<>>, _} = cdr_decode:dec_type({'tk_string', 0}, {1, 2}, B2, 0, big),
+ S3 = "\0",
+ ?line B3 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, {'tk_string', 0}, S3),
+ ?line {S3, <<>>, _} = cdr_decode:dec_type({'tk_string', 0}, {1, 2}, B3, 0, big),
+ S4 = "~n",
+ ?line B4 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, {'tk_string', 0}, S4),
+ ?line {S4, <<>>, _} = cdr_decode:dec_type({'tk_string', 0}, {1, 2}, B4, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: array
+%%-----------------------------------------------------------------
+array_type(doc) -> [];
+array_type(suite) -> [];
+array_type(Config) when is_list(Config) ->
+ T0 = {'tk_array', 'tk_long', 5},
+ S0 = {-100, 0, 30000, -900100900, 123456789},
+ ?line B0 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T0, S0),
+ ?line {S0, <<>>, _} = cdr_decode:dec_type(T0, {1, 2}, B0, 0, big),
+ T1 = {'tk_array', {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum", ["horse", "pig", "cow"]}, 2},
+ S1 = {pig, cow},
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T1, S1),
+ ?line {S1, <<>>, _} = cdr_decode:dec_type(T1, {1, 2}, B1, 0, big),
+ T2 = {'tk_array', {'tk_union', "IDL:Module/Union:1.0", "Union",
+ {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum", ["horse", "pig", "cow"]}, "pig",
+ [{"horse", "First", 'tk_ushort'},
+ {"pig", "Second", {'tk_sequence', {'tk_string', 0}, 0}},
+ {"cow", "Third", {'tk_enum', "IDL:Module/Enum1:1.0",
+ "Module_Enum1", ["orange", "banana", "apple"]}}]}, 2},
+ S2 = {#'Module_Union'{label=cow, value=banana}, #'Module_Union'{label=pig, value=["This", "is", "a", "test", ""]}},
+ ?line B2 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T2, S2),
+ ?line {S2, <<>>, _} = cdr_decode:dec_type(T2, {1, 2}, B2, 0, big),
+ T3 = {'tk_array', {'tk_objref', "IDL:Module/Interface:1.0", "Interface"}, 3},
+ S3 = {objref(0), objref(1), objref(2)},
+ ?line B3 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T3, S3),
+ ?line {S3, <<>>, _} = cdr_decode:dec_type(T3, {1, 2}, B3, 0, big),
+ ok.
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: TypeCode
+%%-----------------------------------------------------------------
+any_type(doc) -> [];
+any_type(suite) -> [];
+any_type(Config) when is_list(Config) ->
+ T = 'tk_any',
+ TC = {'tk_struct', "IDL:Module/Struct2:1.0", "Module_Struct2",
+ [{"long_sequence", {'tk_sequence', 'tk_long', 0}},
+ {"enum", {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum",
+ ["horse", "pig", "cow"]}},
+ {"octet", 'tk_octet'}]},
+ S = #'Module_Struct2'{long_sequence=[4711, 350000, 0, -3030, -600000],
+ e=cow, o=$X},
+ Any = #any{typecode=TC,value=S},
+ ?line B = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T,Any),
+ ?line {Any, <<>>, _} = cdr_decode:dec_type(T, {1, 2}, B, 0, big),
+ TC1 = {'tk_array', {'tk_union', "IDL:Module/Union:1.0", "Union",
+ {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum",
+ ["horse", "pig", "cow"]}, 1,
+ [{"horse", "First", 'tk_ushort'},
+ {"pig", "Second", {'tk_sequence', {'tk_string', 0}, 0}},
+ {"cow", "Third", {'tk_enum', "IDL:Module/Enum1:1.0",
+ "Module_Enum1", ["orange", "banana",
+ "apple"]}}]},2},
+ S1 = {#'Module_Union'{label=cow, value=banana}, #'Module_Union'{label=pig, value=["This", "is", "a", "test", ""]}},
+ Any1 = #any{typecode=TC1,value=S1},
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T,Any1),
+ ?line {Any1, <<>>, _} = cdr_decode:dec_type(T, {1, 2}, B1, 0, big),
+ ok.
+
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: TypeCode
+%%-----------------------------------------------------------------
+typecode_type(doc) -> [];
+typecode_type(suite) -> [];
+typecode_type(Config) when is_list(Config) ->
+ T = 'tk_TypeCode',
+ TC = {'tk_array', {'tk_union', "IDL:Module/Union:1.0", "Union",
+ {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum",
+ ["horse", "pig", "cow"]}, 1,
+ [{"horse", "First", 'tk_ushort'},
+ {"pig", "Second", {'tk_sequence', {'tk_string', 0}, 0}},
+ {"cow", "Third", {'tk_enum', "IDL:Module/Enum1:1.0",
+ "Module_Enum1", ["orange", "banana",
+ "apple"]}}]}, 10},
+ ?line B = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T,TC),
+ ?line {TC, <<>>, _} = cdr_decode:dec_type(T, {1, 2}, B, 0, big),
+ TC1 = {'tk_union', "IDL:Module/Union2:1.0", "Union2",
+ {'tk_enum', "IDL:Module/Enum:1.0",
+ "Module_Enum", ["horse", "pig", "cow"]}, 2,
+ [{"horse", "First", 'tk_long'},
+ {"pig", "Second",
+ {'tk_union', "IDL:Module/Union:1.0", "Union", 'tk_short', 2,
+ [{0, "First", 'tk_short'},
+ {1, "Second", {'tk_string', 0}},
+ {2, "Third", 'tk_char'}]}},
+ {"cow", "Third", {'tk_union', "IDL:Module/Union1:1.0", "Union1",
+ {'tk_enum', "IDL:Module/Enum:1.0",
+ "Module_Enum", ["horse", "pig", "cow"]}, 2,
+ [{"horse", "First", 'tk_ushort'},
+ {"pig", "Second", {'tk_sequence',
+ {'tk_string', 0}, 0}},
+ {"cow", "Third", {'tk_enum',
+ "IDL:Module/Enum1:1.0",
+ "Module_Enum1",
+ ["orange", "banana",
+ "apple"]}}]}}]},
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T, TC1),
+ ?line {TC1, <<>>, _} = cdr_decode:dec_type(T, {1, 2}, B1, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: TypeCode
+%%-----------------------------------------------------------------
+alias_type(doc) -> [];
+alias_type(suite) -> [];
+alias_type(Config) when is_list(Config) ->
+ T = {'tk_alias', "IDL:Module/Alias:1.0", "Alias",
+ {'tk_struct', "IDL:Module/Struct2:1.0", "Module_Struct2",
+ [{"long_sequence", {'tk_sequence', 'tk_long', 0}},
+ {"enum", {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum",
+ ["horse", "pig", "cow"]}},
+ {"octet", 'tk_octet'}]}},
+ S = #'Module_Struct2'{long_sequence=[4711, 350000, 0, -3030, -600000],
+ e=cow, o=$X},
+ ?line B = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T,S),
+ ?line {S, <<>>, _} = cdr_decode:dec_type(T, {1, 2}, B, 0, big),
+ T1 = {'tk_alias', "IDL:Module/Alias1:1.0", "Alias1",
+ {'tk_sequence', {'tk_union', "IDL:Module/Union:1.0", "Union",
+ {'tk_enum', "IDL:Module/Enum:1.0", "Module_Enum",
+ ["horse", "pig", "cow"]}, 2,
+ [{"horse", "First", 'tk_ushort'},
+ {"pig", "Second", {'tk_sequence', {'tk_string', 0}, 0}},
+ {"cow", "Third", {'tk_enum', "IDL:Module/Enum1:1.0",
+ "Module_Enum1", ["orange", "banana",
+ "apple"]}}]},0}},
+ S1 = [#'Module_Union'{label=cow, value=banana}, #'Module_Union'{label=pig, value=["This", "is", "a", "test", ""]}],
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T1, S1),
+ ?line {S1, <<>>, _} = cdr_decode:dec_type(T1, {1, 2}, B1, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Encode/decode test of type: exception
+%%-----------------------------------------------------------------
+exception_type(doc) -> [];
+exception_type(suite) -> [];
+exception_type(Config) when is_list(Config) ->
+ system_exceptions(),
+ user_exceptions(),
+ ok.
+
+system_exceptions() ->
+ E = #'UNKNOWN'{completion_status=?COMPLETED_YES},
+ {system_exception, T, E} = orber_exceptions:get_def(E),
+ ?line B = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T,E),
+ ?line {E, _} = cdr_decode:dec_system_exception({1, 2}, B, 0, big),
+ E1 = #'INV_OBJREF'{completion_status=?COMPLETED_NO},
+ {system_exception, T1, E1} = orber_exceptions:get_def(E1),
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T1,E1),
+ ?line {E1, _} = cdr_decode:dec_system_exception({1, 2}, B1, 0, big),
+ E2 = #'BAD_OPERATION'{completion_status=?COMPLETED_NO},
+ {system_exception, T2, E2} = orber_exceptions:get_def(E2),
+ ?line B2 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T2,E2),
+ ?line {E2, _} = cdr_decode:dec_system_exception({1, 2}, B2, 0, big),
+ E3 = #'INTF_REPOS'{completion_status=?COMPLETED_MAYBE},
+ {system_exception, T3, E3} = orber_exceptions:get_def(E3),
+ ?line B3 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T3,E3),
+ ?line {E3, _} = cdr_decode:dec_system_exception({1, 2}, B3, 0, big),
+ ok.
+
+user_exceptions() ->
+ E = #'Module_Except1'{rest_of_name=["I","am","testing","exceptions"], why="Error"},
+ {user_exception, T, E} = orber_exceptions:get_def(E),
+ ?line B = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T, E),
+ ?line {E, _} = cdr_decode:dec_user_exception({1, 2}, B, 0, big),
+ E1 = #'Module_Except2'{e=banana,
+ s=#'Module_Struct2'{long_sequence=[12,-4040,
+ 1234567898],
+ e=horse,
+ o=$a}},
+ {user_exception, T1, E1} = orber_exceptions:get_def(E1),
+ ?line B1 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T1, E1),
+ ?line {E1, _} = cdr_decode:dec_user_exception({1, 2}, B1, 0, big),
+ E2 = #'Module_Except3'{u=#'Module_Union1'{label=pig,value=["high","and","low"]},s=1313, o=objref(0)},
+ {user_exception, T2, E2} = orber_exceptions:get_def(E2),
+ ?line B2 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T2, E2),
+ ?line {E2, _} = cdr_decode:dec_user_exception({1, 2}, B2, 0, big),
+ E3 = #'Module_Except4'{},
+ {user_exception, T3, E3} = orber_exceptions:get_def(E3),
+ ?line B3 = cdr_encode:enc_type(#giop_env{version = {1, 2}}, T3, E3),
+ ?line {E3, _} = cdr_decode:dec_user_exception({1, 2}, B3, 0, big),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: request encoding test
+%% Description: Precondition the stack must be started so the
+%% objectkey is valid.
+%%-----------------------------------------------------------------
+%request(suite) -> [];
+%request(_) ->
+% exit(not_implemented).
+
+%%-----------------------------------------------------------------
+%% Test Case: reply encoding test
+%% Description:
+%%-----------------------------------------------------------------
+reply(doc) -> ["Description", "more description"];
+reply(suite) -> [];
+reply(Config) when is_list(Config) ->
+ R = #reply_header{service_context=[], request_id=1,
+ reply_status='no_exception'},
+ ?line B = cdr_encode:enc_reply(#giop_env{version = {1, 2}, request_id = 1,
+ reply_status = 'no_exception',
+ tc = {'tk_long', [], [{'tk_sequence',
+ {'tk_string', 0}, 0}]},
+ result = 1200,
+ parameters = [["foo","Bar"]],
+ ctx = []}),
+
+ ?line {R, 1200, [["foo","Bar"]]} =
+ cdr_decode:dec_message({'tk_long', [], [{'tk_sequence', {'tk_string', 0},0}]},
+ B),
+
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: cancel_request encoding test
+%% Description:
+%%-----------------------------------------------------------------
+cancel_request(doc) -> ["Description", "more description"];
+cancel_request(suite) -> [];
+cancel_request(Config) when is_list(Config) ->
+ R = #cancel_request_header{request_id=1},
+ ?line B = cdr_encode:enc_cancel_request(#giop_env{version = {1, 2},
+ request_id = 1}),
+ ?line R = cdr_decode:dec_message([], B),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: locate_request encoding test
+%% Description:
+%%-----------------------------------------------------------------
+locate_request(doc) -> ["Description", "more description"];
+locate_request(suite) -> [];
+locate_request(Config) when is_list(Config) ->
+ io:format("Function not imlpemented yet"),
+ exit(not_implemented).
+
+%%-----------------------------------------------------------------
+%% Test Case: locate_reply encoding test
+%% Description:
+%%-----------------------------------------------------------------
+locate_reply(doc) -> ["Description", "more description"];
+locate_reply(suite) -> [];
+locate_reply(Config) when is_list(Config) ->
+ io:format("Function not imlpemented yet"),
+ exit(not_implemented).
+
+%%-----------------------------------------------------------------
+%% Test Case: close_connection encoding test
+%% Description:
+%%-----------------------------------------------------------------
+close_connection(doc) -> ["Description", "more description"];
+close_connection(suite) -> [];
+close_connection(Config) when is_list(Config) ->
+ ?line B = cdr_encode:enc_close_connection(#giop_env{version = {1, 2}}),
+ ?line 'close_connection' = cdr_decode:dec_message([], B),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: message_error encoding test
+%% Description:
+%%-----------------------------------------------------------------
+message_error(doc) -> ["Description", "more description"];
+message_error(suite) -> [];
+message_error(Config) when is_list(Config) ->
+ ?line B = cdr_encode:enc_message_error(#giop_env{version = {1, 2}}),
+ ?line 'message_error' = cdr_decode:dec_message([], B),
+ ok.
+
+
+
+%%-----------------------------------------------------------------
+%% Internal functions
+%%-----------------------------------------------------------------
+corba_fake_mk_objkey(Id, 'key', Pid) when is_pid(Pid) ->
+ Key = make_objkey(),
+ {list_to_binary(Id), 'key', Key, term_to_binary(undefined),
+ term_to_binary(undefined), term_to_binary(undefined)};
+corba_fake_mk_objkey(Id, 'key', RegName) when is_atom(RegName) ->
+ Key = term_to_binary(RegName),
+ {list_to_binary(Id), 'key', Key, term_to_binary(undefined),
+ term_to_binary(undefined), term_to_binary(undefined)};
+corba_fake_mk_objkey(Id, 'registered', RegName) when is_atom(RegName) ->
+ {list_to_binary(Id), 'registered', RegName, term_to_binary(undefined),
+ term_to_binary(undefined), term_to_binary(undefined)}.
+
+make_objkey() ->
+ term_to_binary({now(), node()}).
diff --git a/lib/orber/test/cdrlib_SUITE.erl b/lib/orber/test/cdrlib_SUITE.erl
new file mode 100644
index 0000000000..fa2d7f2a30
--- /dev/null
+++ b/lib/orber/test/cdrlib_SUITE.erl
@@ -0,0 +1,487 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%-----------------------------------------------------------------
+%%
+%% Description:
+%% Test suite for the CDR basic type encode/decode functions
+%%
+%%-----------------------------------------------------------------
+-module(cdrlib_SUITE).
+
+-include("test_server.hrl").
+
+-define(default_timeout, ?t:minutes(3)).
+
+%%-----------------------------------------------------------------
+%% External exports
+%%-----------------------------------------------------------------
+-export([all/1]).
+
+%%-----------------------------------------------------------------
+%% Internal exports
+%%-----------------------------------------------------------------
+-export([]).
+-compile(export_all).
+
+%%-----------------------------------------------------------------
+%% Func: all/1
+%% Args:
+%% Returns:
+%%-----------------------------------------------------------------
+all(doc) -> ["Description", "more description"];
+all(suite) ->
+ [short, ushort, long, ulong, longlong, ulonglong, boolean, character, octet,
+ float, double, enum].
+
+%%-----------------------------------------------------------------
+%% Init and cleanup functions.
+%%-----------------------------------------------------------------
+
+init_per_testcase(_Case, Config) ->
+ ?line Dog=test_server:timetrap(?default_timeout),
+ [{watchdog, Dog}|Config].
+
+
+fin_per_testcase(_Case, Config) ->
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: short integer test
+%% Description:
+%%-----------------------------------------------------------------
+short(doc) -> ["Description", "more description"];
+short(suite) -> [];
+short(_) ->
+ short_big_loop([-32768, -4040, -1, 0, 4040, 32767]),
+ short_little_loop([-32768, -4040, -1, 0, 4040, 32767]),
+ bad_short().
+
+short_big_loop([]) ->
+ ok;
+short_big_loop([X |List]) ->
+ ?line [CodedType] = cdrlib:enc_short(X, []),
+ ?line {X, <<>>} = cdrlib:dec_short(big, CodedType),
+ short_big_loop(List),
+ ok.
+
+short_little_loop([]) ->
+ ok;
+short_little_loop([X |List]) ->
+ ?line CodedType = enc_short_little(X, []),
+ ?line {X, <<>>} = cdrlib:dec_short(little, CodedType),
+ short_little_loop(List),
+ ok.
+
+enc_short_little(X, Message) ->
+ list_to_binary([(X) band 16#ff, ((X) bsr 8) band 16#ff | Message]).
+
+bad_short() ->
+ ?line {'EXCEPTION', _} = (catch cdrlib:enc_short('atom', [])),
+ ?line [CodedType] = cdrlib:enc_char($a, []),
+ ?line {'EXIT', _} = (catch cdrlib:dec_short(big, CodedType)),
+ ok.
+%%-----------------------------------------------------------------
+%% Test Case: unsigned short integer test
+%% Description:
+%%-----------------------------------------------------------------
+ushort(doc) -> ["Description", "more description"];
+ushort(suite) -> [];
+ushort(_) ->
+ ushort_big_loop([0, 4040, 65535]),
+ ushort_little_loop([0, 4040, 65535]),
+ bad_ushort().
+
+ushort_big_loop([]) ->
+ ok;
+ushort_big_loop([X |List]) ->
+ ?line [CodedType] = cdrlib:enc_unsigned_short(X, []),
+ ?line {X, <<>>} = cdrlib:dec_unsigned_short(big, CodedType),
+ ushort_big_loop(List),
+ ok.
+
+ushort_little_loop([]) ->
+ ok;
+ushort_little_loop([X |List]) ->
+ ?line CodedType = enc_ushort_little(X, []),
+ ?line {X, <<>>} = cdrlib:dec_unsigned_short(little, CodedType),
+ ushort_little_loop(List),
+ ok.
+
+enc_ushort_little(X, Message) ->
+ list_to_binary([(X) band 16#ff, ((X) bsr 8) band 16#ff | Message]).
+
+bad_ushort() ->
+ ok.
+%%-----------------------------------------------------------------
+%% Test Case: long integer test
+%% Description:
+%%-----------------------------------------------------------------
+long(doc) -> ["Description", "more description"];
+long(suite) -> [];
+long(_) ->
+ long_big_loop([-2147483648, -40404040, -32768, -4040, -1,
+ 0, 4040, 32767, 40404040, 2147483647]),
+ long_little_loop([-2147483648, -40404040, -32768, -4040, -1,
+ 0, 4040, 32767, 40404040, 2147483647]),
+ bad_long().
+
+
+long_big_loop([]) ->
+ ok;
+long_big_loop([X |List]) ->
+ ?line [CodedType] = cdrlib:enc_long(X, []),
+ ?line {X, <<>>} = cdrlib:dec_long(big, CodedType),
+ long_big_loop(List),
+ ok.
+
+long_little_loop([]) ->
+ ok;
+long_little_loop([X |List]) ->
+ ?line CodedType = enc_long_little(X, []),
+ ?line {X, <<>>} = cdrlib:dec_long(little, CodedType),
+ long_little_loop(List),
+ ok.
+
+enc_long_little(X, Message) ->
+ list_to_binary([(X) band 16#ff, ((X) bsr 8) band 16#ff, ((X) bsr 16) band 16#ff,
+ ((X) bsr 24) band 16#ff | Message]).
+
+bad_long() ->
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: unsigned long integer test
+%% Description:
+%%-----------------------------------------------------------------
+ulong(doc) -> ["Description", "more description"];
+ulong(suite) -> [];
+ulong(_) ->
+ ulong_big_loop([0, 4040, 65535, 40404040, 2147483647, 4294967295]),
+ ulong_little_loop([0, 4040, 65535, 40404040, 2147483647, 4294967295]),
+ bad_ulong().
+
+
+ulong_big_loop([]) ->
+ ok;
+ulong_big_loop([X |List]) ->
+ ?line [CodedType] = cdrlib:enc_unsigned_long(X, []),
+ ?line {X, <<>>} = cdrlib:dec_unsigned_long(big, CodedType),
+ ulong_big_loop(List),
+ ok.
+
+ulong_little_loop([]) ->
+ ok;
+ulong_little_loop([X |List]) ->
+ ?line CodedType = enc_ulong_little(X, []),
+ ?line {X, <<>>} = cdrlib:dec_unsigned_long(little, CodedType),
+ ulong_little_loop(List),
+ ok.
+
+enc_ulong_little(X, Message) ->
+ list_to_binary([(X) band 16#ff, ((X) bsr 8) band 16#ff, ((X) bsr 16) band 16#ff,
+ ((X) bsr 24) band 16#ff | Message]).
+
+
+bad_ulong() ->
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: long integer test
+%% Description:
+%%-----------------------------------------------------------------
+longlong(doc) -> ["Description", "more description"];
+longlong(suite) -> [];
+longlong(_) ->
+ longlong_big_loop([-2147483648, -40404040, -32768, -4040, -1,
+ 0, 4040, 32767, 40404040, 2147483647]),
+ longlong_little_loop([-2147483648, -40404040, -32768, -4040, -1,
+ 0, 4040, 32767, 40404040, 2147483647]),
+ bad_longlong().
+
+
+longlong_big_loop([]) ->
+ ok;
+longlong_big_loop([X |List]) ->
+ ?line [CodedType] = cdrlib:enc_longlong(X, []),
+ ?line {X, <<>>} = cdrlib:dec_longlong(big, CodedType),
+ longlong_big_loop(List),
+ ok.
+
+longlong_little_loop([]) ->
+ ok;
+longlong_little_loop([X |List]) ->
+ ?line CodedType = enc_longlong_little(X, []),
+ ?line {X, <<>>} = cdrlib:dec_longlong(little, CodedType),
+ longlong_little_loop(List),
+ ok.
+
+enc_longlong_little(X, Message) ->
+ list_to_binary([(X) band 16#ff, ((X) bsr 8) band 16#ff, ((X) bsr 16) band 16#ff,
+ ((X) bsr 24) band 16#ff, ((X) bsr 32) band 16#ff, ((X) bsr 40) band 16#ff,
+ ((X) bsr 48) band 16#ff, ((X) bsr 56) band 16#ff | Message]).
+
+bad_longlong() ->
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: unsigned long integer test
+%% Description:
+%%-----------------------------------------------------------------
+ulonglong(doc) -> ["Description", "more description"];
+ulonglong(suite) -> [];
+ulonglong(_) ->
+ ulonglong_big_loop([0, 4040, 65535, 40404040, 2147483647, 4294967295]),
+ ulonglong_little_loop([0, 4040, 65535, 40404040, 2147483647, 4294967295]),
+ bad_ulonglong().
+
+
+ulonglong_big_loop([]) ->
+ ok;
+ulonglong_big_loop([X |List]) ->
+ ?line [CodedType] = cdrlib:enc_unsigned_longlong(X, []),
+ ?line {X, <<>>} = cdrlib:dec_unsigned_longlong(big, CodedType),
+ ulonglong_big_loop(List),
+ ok.
+
+ulonglong_little_loop([]) ->
+ ok;
+ulonglong_little_loop([X |List]) ->
+ ?line CodedType = enc_ulonglong_little(X, []),
+ ?line {X, <<>>} = cdrlib:dec_unsigned_longlong(little, CodedType),
+ ulonglong_little_loop(List),
+ ok.
+
+enc_ulonglong_little(X, Message) ->
+ list_to_binary([(X) band 16#ff, ((X) bsr 8) band 16#ff, ((X) bsr 16) band 16#ff,
+ ((X) bsr 24) band 16#ff, ((X) bsr 32) band 16#ff, ((X) bsr 40) band 16#ff,
+ ((X) bsr 48) band 16#ff, ((X) bsr 56) band 16#ff | Message]).
+
+bad_ulonglong() ->
+ ok.
+
+
+
+%%-----------------------------------------------------------------
+%% Test Case: boolean test
+%% Description:
+%%-----------------------------------------------------------------
+boolean(doc) -> ["Description", "more description"];
+boolean(suite) -> [];
+boolean(_) ->
+ ?line [CodedTrue] = cdrlib:enc_bool('true', []),
+ ?line {'true', <<>>} = cdrlib:dec_bool(CodedTrue),
+ ?line [CodedFalse] = cdrlib:enc_bool('false', []),
+ ?line {'false', <<>>} = cdrlib:dec_bool(CodedFalse),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: character test
+%% Description:
+%%-----------------------------------------------------------------
+character(doc) -> ["Description", "more description"];
+character(suite) -> [];
+character(_) ->
+ ?line [Coded_0] = cdrlib:enc_char($0, []),
+ ?line {$0, <<>>} = cdrlib:dec_char(Coded_0),
+ ?line [Coded_a] = cdrlib:enc_char($a, []),
+ ?line {$a, <<>>} = cdrlib:dec_char(Coded_a),
+ ?line [Coded_Z] = cdrlib:enc_char($Z, []),
+ ?line {$Z, <<>>} = cdrlib:dec_char(Coded_Z),
+ ?line [Coded_dollar] = cdrlib:enc_char($$, []),
+ ?line {$$, <<>>} = cdrlib:dec_char(Coded_dollar),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: octet test
+%% Description:
+%%-----------------------------------------------------------------
+octet(doc) -> ["Description", "more description"];
+octet(suite) -> [];
+octet(_) ->
+ ?line [Coded_ff] = cdrlib:enc_octet(16#ff, []),
+ ?line {16#ff, <<>>} = cdrlib:dec_octet(Coded_ff),
+ ?line [Coded_00] = cdrlib:enc_octet(16#00, []),
+ ?line {16#00, <<>>} = cdrlib:dec_octet(Coded_00),
+ ?line [Coded_5a] = cdrlib:enc_octet(16#5a, []),
+ ?line {16#5a, <<>>} = cdrlib:dec_octet(Coded_5a),
+ ?line [Coded_48] = cdrlib:enc_octet(16#48, []),
+ ?line {16#48, <<>>} = cdrlib:dec_octet(Coded_48),
+ ok.
+
+
+
+%%-----------------------------------------------------------------
+%% Test Case: float test
+%% Description:
+%%-----------------------------------------------------------------
+float(doc) -> ["Description", "more description"];
+float(suite) -> [];
+float(_) ->
+ G = 16#7fffff / 16#800000 + 1.0,
+ H1 = math:pow(2, 127),
+ H2 = math:pow(2, -126),
+ float_big_loop([-H1 * G, -H1 * 1.0, -H2 * G, -H2 * 1.0,
+ -4040.313131, -3.141592, 0.0, 3.141592, 4040.313131,
+ H1 * G, H1 * 1.0, H2 * G, H2 * 1.0]),
+ float_little_loop([-H1 * G, -H1 * 1.0, -H2 * G, -H2 * 1.0,
+ -4040.313131, -3.141592, 0.0, 3.141592, 4040.313131,
+ H1 * G, H1 * 1.0, H2 * G, H2 * 1.0]),
+ ok.
+
+float_big_loop([]) ->
+ ok;
+float_big_loop([X |List]) ->
+ ?line [CodedType] = cdrlib:enc_float(X, []),
+ ?line {Y, <<>>} = cdrlib:dec_float(big, CodedType),
+ ?line float_comp(X,Y),
+ float_big_loop(List),
+ ok.
+
+float_little_loop([]) ->
+ ok;
+float_little_loop([X |List]) ->
+ ?line [CodedType] = enc_float_little(X, []),
+ ?line {Y, <<>>} = cdrlib:dec_float(little, CodedType),
+ ?line float_comp(X,Y),
+ float_little_loop(List),
+ ok.
+
+float_comp(X,Y) when X == 0.0, Y == 0.0 ->
+ ok;
+float_comp(X,Y) ->
+ Div = abs(Y) / abs(X),
+ %% io:format("~p~n", [float_to_list(Div)]),
+ ?line true = (Div < 1.0000001),
+ ?line true = (Div > 0.9999999),
+ ok.
+
+enc_float_little(X, Message) ->
+ [ <<X:32/little-float>> | Message].
+
+%%-----------------------------------------------------------------
+%% Test Case: double test
+%% Description:
+%%-----------------------------------------------------------------
+double(doc) -> ["Description", "more description"];
+double(suite) -> [];
+double(_) ->
+ F = 16#0fffffffffffff / 16#10000000000000 + 1.0,
+ E1 = math:pow(2, 1023),
+ E2 = math:pow(2, -1022),
+ G = 16#7fffff / 16#800000 + 1.0,
+ H1 = math:pow(2, 128),
+ H2 = math:pow(2, -127),
+ double_big_loop([-E1 * F, -E1 * 1.0, -E2 * F, -E2 * 1.0,
+ -H1 * G, -H1 * 1.0, -H2 * G, -H2 * 1.0,
+ -4040.313131, -3.141592, 0.0, 3.141592, 4040.313131,
+ H1 * G, H1 * 1.0, H2 * G, H2 * 1.0,
+ E1 * F, E1 * 1.0, E2 * F, E2 * 1.0]),
+ double_little_loop([-E1 * F, -E1 * 1.0, -E2 * F, -E2 * 1.0,
+ -H1 * G, -H1 * 1.0, -H2 * G, -H2 * 1.0,
+ -4040.313131, -3.141592, 0.0, 3.141592, 4040.313131,
+ H1 * G, H1 * 1.0, H2 * G, H2 * 1.0,
+ E1 * F, E1 * 1.0, E2 * F, E2 * 1.0]),
+ ok.
+
+double_big_loop([]) ->
+ ok;
+double_big_loop([X |List]) ->
+ ?line [CodedType] = cdrlib:enc_double(X, []),
+ ?line {Y, <<>>} = cdrlib:dec_double(big, CodedType),
+ ?line double_comp(X,Y),
+ double_big_loop(List),
+ ok.
+
+double_little_loop([]) ->
+ ok;
+double_little_loop([X |List]) ->
+ ?line [CodedType] = enc_double_little(X, []),
+ ?line {Y, <<>>} = cdrlib:dec_double(little, CodedType),
+ ?line double_comp(X,Y),
+ double_little_loop(List),
+ ok.
+
+enc_double_little(X, Message) ->
+ [ <<X:64/little-float>> | Message].
+
+double_comp(X,Y) when X == 0.0, Y == 0.0 ->
+ ok;
+double_comp(X,Y) ->
+ Div = abs(Y) / abs(X),
+ %% io:format("~p~n", [float_to_list(Div)]),
+ ?line true = (Div < 1.00000000000001),
+ ?line true = (Div > 0.99999999999999),
+ ok.
+
+double_should_be_ok(doc) -> ["Description", "more description"];
+double_should_be_ok(suite) -> [];
+double_should_be_ok(_) ->
+ F = 16#0fffffffffffff / 16#10000000000000 + 1.0,
+ E1 = math:pow(2, 1024), % erlang can't handle this.
+ E2 = math:pow(2, -1023),
+ double_big_loop([-E1 * F, -E1 * 1.0, -E2 * F, -E2 * 1.0,
+ E1 * F, E1 * 1.0, E2 * F, E2 * 1.0]),
+ double_little_loop([-E1 * F, -E1 * 1.0, -E2 * F, -E2 * 1.0,
+ E1 * F, E1 * 1.0, E2 * F, E2 * 1.0]),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: enum test
+%% Description:
+%%-----------------------------------------------------------------
+enum(doc) -> ["Description", "more description"];
+enum(suite) -> [];
+enum(_) ->
+ enum_big(),
+ enum_little(),
+ ok.
+
+enum_big() ->
+ ?line [Coded_a] = cdrlib:enc_enum(a,[a,b,c],[]),
+ ?line {a, <<>>} = cdrlib:dec_enum(big, ["a","b","c"], Coded_a),
+ ?line [Coded_b] = cdrlib:enc_enum(b,[a,b,c],[]),
+ ?line {b, <<>>} = cdrlib:dec_enum(big, ["a","b","c"], Coded_b),
+ ?line [Coded_c] = cdrlib:enc_enum(c,[a,b,c],[]),
+ ?line {c, <<>>} = cdrlib:dec_enum(big, ["a","b","c"], Coded_c),
+ ok.
+
+enum_little() ->
+ ?line Coded_a = enc_r_enum(a,[a,b,c],[]),
+ ?line {a, <<>>} = cdrlib:dec_enum(little, ["a","b","c"], Coded_a),
+ ?line Coded_b = enc_r_enum(b,[a,b,c],[]),
+ ?line {b, <<>>} = cdrlib:dec_enum(little, ["a","b","c"], Coded_b),
+ ?line Coded_c = enc_r_enum(c,[a,b,c],[]),
+ ?line {c, <<>>} = cdrlib:dec_enum(little, ["a","b","c"], Coded_c),
+ ok.
+
+enc_r_enum(Enum, ElemList, Message) ->
+ Val = getEnumValue(ElemList,Enum, 0),
+ enc_r_unsigned_long(Val, Message).
+
+getEnumValue([Enum |_List], Enum, N) ->
+ N;
+getEnumValue([_ |List], Enum, N) ->
+ getEnumValue(List, Enum, N + 1).
+
+enc_r_unsigned_long(X, Message) ->
+ list_to_binary([(X) band 16#ff, ((X) bsr 8) band 16#ff,
+ ((X) bsr 16) band 16#ff, ((X) bsr 24) band 16#ff | Message]).
diff --git a/lib/orber/test/corba_SUITE.erl b/lib/orber/test/corba_SUITE.erl
new file mode 100644
index 0000000000..dae8fcbefc
--- /dev/null
+++ b/lib/orber/test/corba_SUITE.erl
@@ -0,0 +1,909 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%-----------------------------------------------------------------
+%%
+%% Description:
+%% Test suite for corba/boa/object/orber API functions
+%%
+%%-----------------------------------------------------------------
+-module(corba_SUITE).
+
+-include("test_server.hrl").
+-include_lib("orber/include/corba.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming.hrl").
+-include_lib("orber/src/orber_iiop.hrl").
+
+
+-define(default_timeout, ?t:minutes(5)).
+
+-define(match(ExpectedRes,Expr),
+ fun() ->
+ AcTuAlReS = (catch (Expr)),
+ case AcTuAlReS of
+ ExpectedRes ->
+ io:format("------ CORRECT RESULT ------~n~p~n",
+ [AcTuAlReS]),
+ AcTuAlReS;
+ _ ->
+ io:format("###### ERROR ERROR ######~nRESULT: ~p~n",
+ [AcTuAlReS]),
+ exit(AcTuAlReS)
+ end
+ end()).
+
+%%-----------------------------------------------------------------
+%% External exports
+%%-----------------------------------------------------------------
+-export([all/1]).
+
+%%-----------------------------------------------------------------
+%% Internal exports
+%%-----------------------------------------------------------------
+-export([pseudo_calls/2, pseudo_casts/2]).
+-compile(export_all).
+
+%%-----------------------------------------------------------------
+%% Func: all/1
+%% Args:
+%% Returns:
+%%-----------------------------------------------------------------
+all(doc) -> ["API tests for the CORBA/BOA/Object/orber interfaces", ""];
+all(suite) -> {req,
+ [mnesia],
+ {conf, init_all, cases(), finish_all}}.
+
+cases() ->
+ [exception_info_api, corba_api, object_api, orber_api,
+ orber_objectkeys_api, orber_pseudo_objects, callback_ok_api,
+ callback_arity_api, callback_module_api, callback_function_api,
+ callback_precond_api, callback_postcond_api, callback_exit_api,
+ callback_badarith_api, callback_case_clause_api,
+ callback_function_clause_api].
+
+%% boa_api, request, locate_request, locate_reply].
+
+%%-----------------------------------------------------------------
+%% Init and cleanup functions.
+%%-----------------------------------------------------------------
+
+init_per_testcase(_Case, Config) ->
+ Path = code:which(?MODULE),
+ code:add_pathz(filename:join(filename:dirname(Path), "idl_output")),
+ ?line Dog=test_server:timetrap(?default_timeout),
+ [{watchdog, Dog}|Config].
+
+
+fin_per_testcase(_Case, Config) ->
+ Path = code:which(?MODULE),
+ code:del_path(filename:join(filename:dirname(Path), "idl_output")),
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+init_all(Config) ->
+ corba:orb_init([{orber_debug_level, 10}, {giop_version, {1,2}},
+ {iiop_port, 0}]),
+ mnesia:delete_schema([node()]),
+ mnesia:create_schema([node()]),
+ orber:install([node()]),
+ application:start(mnesia),
+ application:start(orber),
+ if
+ is_list(Config) ->
+ Config;
+ true ->
+ exit("Config not a list")
+ end.
+
+finish_all(Config) ->
+ application:stop(orber),
+ application:stop(mnesia),
+ mnesia:delete_schema([node()]),
+ Config.
+
+%%-----------------------------------------------------------------
+%% API tests for pseudo interface CORBA
+%%-----------------------------------------------------------------
+corba_api(doc) -> ["CORBA API tests", ""];
+corba_api(suite) -> [];
+corba_api(_) ->
+ NIL = corba:create_nil_objref(),
+ ?line ok = corba:dispose(NIL),
+ ?line NS = corba:resolve_initial_references("NameService"),
+ ?line List = corba:list_initial_services(),
+ ?line ["NameService"] = List,
+ ?line NSstring = corba:object_to_string(NS),
+ ?line NS1 = corba:string_to_object(NSstring),
+ ?line NSstring = corba:object_to_string(NS1),
+ ?line true = corba:add_initial_service("MyData", NS),
+ ?line NS = corba:resolve_initial_references("MyData"),
+ ?line [_,_] = corba:list_initial_services(),
+ ?line false = corba:remove_initial_service("Wrong"),
+ ?line NIL = corba:resolve_initial_references("Wrong"),
+ ?line NS = corba:string_to_object("corbaloc:rir:/MyData"),
+ ?line true = corba:remove_initial_service("MyData"),
+ ?line ["NameService"] = corba:list_initial_services(),
+
+ %% This is a collection of different stringified IOR:s (correct & incorrect)
+ %% which we use to test IOR encode/decode.
+ ?line IOR1 = ?match({'IOP_IOR',_,_}, corba:string_to_object("IOR:000303030000000d49444c3a746573743a312e3000030303000000040000000000000100000102010000000a3132372e302e302e31009d610000002dabacab3131303432343836383731005f526f6f74504f4100414c4c5f504f410000cafebabe3e2316570000000003030300000002000000210000007800010202000000010040020200000022000000080003030300000000004000400000000806066781020101010000001b0401000806066781020101010000000b40616469726f6e2e636f6d010400000000000000000000020000000806066781020101010000000b06092a864886f712010202010000000f000000010000002c00030303000100010000000400010020000101090001010005010001000101090000000200010100050100010000000000000184000102010000000a3132372e302e302e310000000000002dabacab3131303432343836383731005f526f6f74504f4100414c4c5f504f410000cafebabe3e231657000000000303030000000300000021000000ec000102020000000200060202000000240000001c0001006600060202000000010000000a3132372e302e302e31009d600000000000000000000000000400000000000000000000020000000806066781020101010000000b06092a864886f712010202010000000f00460202000000240000001c0001006600060202000000010000000a3132372e302e302e31009d62004000400000000806066781020101010000001b0401000806066781020101010000000b40616469726f6e2e636f6d010400000000000000000000020000000806066781020101010000000b06092a864886f712010202010000000f00000014000000080001006600069d5e000000010000002c000303030001000100000004000100200001010900010100050100010001010900000002000101000501000100000000000000dc000102010000000a3132372e302e302e31009d5f0000002dabacab3131303432343836383731005f526f6f74504f4100414c4c5f504f410000cafebabe3e23165700000000030303000000020000002100000054000102020000000100000202000000220000000800030303000000000000000000000000000000000400000000000000000000020000000806066781020101010000000b06092a864886f712010202010000000f000000010000002c00030303000100010000000400010020000101090001010005010001000101090000000200010100050100010000000000000080000102010000000a3132372e302e302e31009d5d0000002dabacab3131303432343836383731005f526f6f74504f4100414c4c5f504f410000cafebabe3e2316570000000003030300000001000000010000002c0003030300010001000000040001002000010109000101000501000100010109000000020001010005010001")),
+ ?line IOR2 = ?match({'IOP_IOR',_,_}, corba:string_to_object("IOR:000303030000000d49444c3a746573743a312e30000303030000000100000000000000e0000102010000000a3132372e302e302e31009d5f00000034abacab3131303432343836383731005f526f6f74504f410049494f505f43534976325f504f410000cafebabe3e23165700000000000000020000002100000054000102020000000100000202000000220000000800030303000000000000000000000000000000000400000000000000000000020000000806066781020101010000000b06092a864886f712010202010000000f000000010000002c0003030300010001000000040001002000010109000101000501000100010109000000020001010005010001")),
+ ?line IOR3 = ?match({'IOP_IOR',_,_}, corba:string_to_object("IOR:000303030000000d49444c3a746573743a312e3000030303000000010000000000000108000102010000000a3132372e302e302e31009d6100000037abacab3131303432343836383731005f526f6f74504f410049494f505f43534976325f55505f504f410000cafebabe3e231657000000000100000002000000210000007800010202000000010040020200000022000000080003030300000000004000400000000806066781020101010000001b0401000806066781020101010000000b40616469726f6e2e636f6d010400000000000000000000020000000806066781020101010000000b06092a864886f712010202010000000f000000010000002c0003030300010001000000040001002000010109000101000501000100010109000000020001010005010001")),
+ ?line IOR4 = ?match({'IOP_IOR',_,_}, corba:string_to_object("IOR:000303030000000d49444c3a746573743a312e3000030303000000010000000000000080000102010000000a3132372e302e302e31009d5d0000002eabacab3131303432343836383731005f526f6f74504f410049494f505f504f410000cafebabe3e23165700000000020200000001000000010000002c0003030300010001000000040001002000010109000101000501000100010109000000020001010005010001")),
+ ?line IOR5 = ?match({'IOP_IOR',_,_}, corba:string_to_object("IOR:000303030000000d49444c3a746573743a312e30000303030000000100000000000000fc000102010000000a3132372e302e302e3100000000000033abacab3131303432343836383731005f526f6f74504f4100544c535f43534976325f504f410000cafebabe3e231657000000000100000002000000210000007000010202000000010006020200000024000000220001006600060202000000010000000f3132382e3233302e3230382e353500019d6000000000020200000000000000000400000000000000000000020000000806066781020101010000000b06092a864886f712010202010000000f000000010000002c0003030300010001000000040001002000010109000101000501000100010109000000020001010005010001")),
+ ?line IOR6 = ?match({'IOP_IOR',_,_}, corba:string_to_object("IOR:000303030000000d49444c3a746573743a312e3000030303000000010000000000000124000102010000000a3132372e302e302e3100000000000036abacab3131303432343836383731005f526f6f74504f4100544c535f43534976325f55505f504f410000cafebabe3e23165700000000020200000002000000210000009400010202000000010046020200000024000000220001006600060202000000010000000f3132382e3233302e3230382e353500019d620040004002020000000806066781020101010000001b0401000806066781020101010000000b40616469726f6e2e636f6d010400000000000000000000020000000806066781020101010000000b06092a864886f712010202010000000f000000010000002c0003030300010001000000040001002000010109000101000501000100010109000000020001010005010001")),
+ ?line IOR7 = ?match({'IOP_IOR',_,_}, corba:string_to_object("IOR:000303030000000d49444c3a746573743a312e3000030303000000010000000000000090000102010000000a3132372e302e302e310000000000002dabacab3131303432343836383731005f526f6f74504f4100544c535f504f410000cafebabe3e231657000000000303030000000200000014000000080001006600069d5e000000010000002c0003030300010001000000040001002000010109000101000501000100010109000000020001010005010001")),
+ ?line IOR1 = corba:string_to_object(corba:object_to_string(IOR1)),
+ ?line IOR2 = corba:string_to_object(corba:object_to_string(IOR2)),
+ ?line IOR3 = corba:string_to_object(corba:object_to_string(IOR3)),
+ ?line IOR4 = corba:string_to_object(corba:object_to_string(IOR4)),
+ ?line IOR5 = corba:string_to_object(corba:object_to_string(IOR5)),
+ ?line IOR6 = corba:string_to_object(corba:object_to_string(IOR6)),
+ ?line IOR7 = corba:string_to_object(corba:object_to_string(IOR7)),
+ ?line ?match(ok, corba:print_object(IOR1)),
+ ?line ?match(ok, corba:print_object(IOR2)),
+ ?line ?match(ok, corba:print_object(IOR3)),
+ ?line ?match(ok, corba:print_object(IOR4)),
+ ?line ?match(ok, corba:print_object(IOR5)),
+ ?line ?match(ok, corba:print_object(IOR6)),
+ ?line ?match(ok, corba:print_object(IOR7)),
+ ?line ?match(ok, corba:print_object("IOR:000303030000000d49444c3a746573743a312e300003030300000002000000000000003000010001000000136d792e686f73742e65726c616e672e6f72670001801a02020000000c424f410a00000a0000070a010000000100000024000303030000000100000001000000140003030300010001000000000001010900000000")),
+ [IP] = ?match([_], orber:host()),
+ ?match(#'IOP_IOR'{profiles=[#'IOP_TaggedProfile'
+ {tag=?TAG_INTERNET_IOP,
+ profile_data=#'IIOP_ProfileBody_1_1'
+ {host = IP}}]},
+ corba:string_to_object(corba:object_to_string(NS))),
+ ?match(#'IOP_IOR'{profiles=[#'IOP_TaggedProfile'
+ {tag=?TAG_INTERNET_IOP,
+ profile_data=#'IIOP_ProfileBody_1_1'
+ {host = "127.0.0.1"}}]},
+ corba:string_to_object(corba:object_to_string(NS, ["127.0.0.1"]))),
+ ?match(#'IOP_IOR'{profiles=[#'IOP_TaggedProfile'
+ {tag=?TAG_INTERNET_IOP,
+ profile_data=#'IIOP_ProfileBody_1_1'
+ {host = "127.0.0.1", port = 5468}}]},
+ corba:string_to_object(corba:object_to_string(NS, ["127.0.0.1"],
+ 5468))),
+ ok.
+
+%%-----------------------------------------------------------------
+%% API tests for interface BOA
+%%-----------------------------------------------------------------
+boa_api(doc) -> ["BOA API tests", ""];
+boa_api(suite) -> [];
+boa_api(_) ->
+ ok.
+
+%%-----------------------------------------------------------------
+%% API tests for interface OBJECT
+%%-----------------------------------------------------------------
+object_api(doc) -> ["Object API tests", ""];
+object_api(suite) -> [];
+object_api(_) ->
+ ?line oe_orber_test_server:oe_register(),
+ ?line EC = orber_test_server:oe_create(),
+ ?line NS = corba:resolve_initial_references("NameService"),
+ %% testing corba_object:is_a(Obj, IFRID) locally.
+ ?line orber_test_lib:corba_object_tests(EC, NS),
+
+ ?line ?match(false, corba_object:non_existent(NS)),
+
+ ?line corba:dispose(EC),
+ ?line oe_orber_test_server:oe_unregister(),
+ ok.
+
+%%-----------------------------------------------------------------
+%% API tests for orbers main module
+%%-----------------------------------------------------------------
+orber_api(doc) -> ["orber API tests", ""];
+orber_api(suite) -> [];
+orber_api(_) ->
+ ?line ok = orber:uninstall(),
+ ?line orber:install([node()]),
+ ?line application:start(orber),
+ ?line NodeList = orber:orber_nodes(),
+ ?line NL = node(),
+ ?line [NL] = NodeList,
+ ok.
+
+%%-----------------------------------------------------------------
+%% API tests for exception mapping
+%%-----------------------------------------------------------------
+exception_info_api(doc) -> ["orber API tests", ""];
+exception_info_api(suite) -> [];
+exception_info_api(_) ->
+ ?line {ok, S1} = orber:exception_info({'EXCEPTION',{'MARSHAL',[],1163001858,'COMPLETED_NO'}}),
+ ?line {ok, S2} = orber:exception_info({'EXCEPTION',{'MARSHAL',[],1330446337,'COMPLETED_NO'}}),
+ ?line {ok, S3} = orber:exception_info({'EXCEPTION',{'MARSHAL',[],1398079490,'COMPLETED_NO'}}),
+ ?line {ok, S4} = orber:exception_info({'EXCEPTION',{'MARSHAL',[],1347813377,'COMPLETED_NO'}}),
+ ?line {ok, S5} = orber:exception_info({'EXCEPTION', {'CosNaming_NamingContext_InvalidName',"IDL:omg.org/CosNaming/NamingContext/InvalidName:1.0"}}),
+ ?line error_logger:info_msg("~s", [S1]),
+ ?line error_logger:info_msg("~s", [S2]),
+ ?line error_logger:info_msg("~s", [S3]),
+ ?line error_logger:info_msg("~s", [S4]),
+ ?line error_logger:info_msg("~s", [S5]),
+ ok.
+
+%%-----------------------------------------------------------------
+%% API tests for orbers pseudo objects.
+%%-----------------------------------------------------------------
+orber_pseudo_objects(doc) -> ["orber_pseudo_objects API tests", ""];
+orber_pseudo_objects(suite) -> [];
+orber_pseudo_objects(_) ->
+ ?line oe_orber_test_server:oe_register(),
+ Obj1=(catch orber_test_server:oe_create(state,[{pseudo,true},
+ {local_typecheck, true}])),
+ ?line ?match({_,pseudo,orber_test_server_impl, _,_, _}, Obj1),
+ Obj2=(catch orber_test_server:oe_create([],[{pseudo, truce}])),
+ ?line ?match({'EXCEPTION',{'BAD_PARAM',[],_,'COMPLETED_NO'}}, Obj2),
+ spawn(?MODULE, pseudo_calls, [20, Obj1]),
+ ?line ?match({ok, 10000}, orber_test_server:pseudo_call_delay(Obj1, 10000)),
+ spawn(?MODULE, pseudo_casts, [20, Obj1]),
+ ?line ?match(ok, orber_test_server:pseudo_cast_delay(Obj1, 10000)),
+
+ ?line ?match('object_here', corba:locate(Obj1)),
+
+ ?line NS = corba:resolve_initial_references("NameService"),
+
+ ?line orber_test_lib:corba_object_tests(Obj1, NS),
+
+ ?line ?match("IDL:omg.org/orber_test/server:1.0",orber_test_server:typeID()),
+
+ %% Test if exceptions are handled properly.
+ ?line ?match({'EXCEPTION',{'BAD_QOS',_,_,_}},
+ orber_test_server:pseudo_call_raise_exc(Obj1, 1)),
+ ?line ?match({'EXCEPTION',{'BAD_QOS',_,_,_}},
+ orber_test_server:pseudo_call_raise_exc(Obj1, 2)),
+
+ %% Test if exit is handled properly.
+ ?line ?match({'EXCEPTION',{'TRANSIENT',_,_,_}},
+ orber_test_server:stop_brutal(Obj1)),
+
+ orber_test_lib:test_coding(Obj1, true),
+
+ %% possible to use subobject key?
+ ?line ?match(state, binary_to_term(corba:get_subobject_key(Obj1))),
+
+ ?line ?match({'EXCEPTION',{'INV_OBJREF',[],_,'COMPLETED_NO'}},
+ corba:get_pid(Obj1)),
+ ?line ?match(false, corba_object:non_existent(Obj1)),
+
+ ?line ?match(ok, corba:dispose(Obj1)),
+
+ ?line ?match(false, corba_object:non_existent(Obj1)),
+
+ %% Try if it's possible to stringify and recover the object reference.
+ IOR_string = (catch corba:object_to_string(Obj1)),
+ Obj3 =(catch corba:string_to_object(IOR_string)),
+ ?line ?match(IOR_string, corba:object_to_string(Obj3)),
+
+ Obj4=(catch orber_test_server:oe_create(undefined,[{pseudo,true}])),
+ ?line ?match(ok, corba:dispose(Obj4)),
+ ?line oe_orber_test_server:oe_unregister(),
+ ok.
+
+%%-----------------------------------------------------------------
+%% API tests for orbers objectkeys server.
+%%-----------------------------------------------------------------
+orber_objectkeys_api(doc) -> ["orber_objectkeys API tests", ""];
+orber_objectkeys_api(suite) -> [];
+orber_objectkeys_api(_) ->
+ Obj0=(catch orber_test_server:oe_create([], [{sup_child, true}])),
+ Obj1=(catch orber_test_server:oe_create([], [{persistent, true},
+ {regname, {local,obj1}}])),
+ Obj2=(catch orber_test_server:oe_create([], [{persistent, true},
+ {regname, {global,{obj2, 12345}}}])),
+
+ %% Obj0 is supposed to be a child started by a supervisor (r6) which
+ %% handles not only {ok, Pid} but also {ok,Pid, Returnvalue}. In our
+ %% case the Returnvalue is an ObjectRef.
+ ?line ?match({ok,_,{_,key,_, _,_, _}}, Obj0),
+ {ok,_,Obj0Ref} = Obj0,
+ corba:dispose(Obj0Ref),
+
+ %% Only 'global' servers are at the moment allowed to be persistent.
+ ?line ?match({'EXCEPTION',{'BAD_PARAM',[],_,'COMPLETED_NO'}}, Obj1),
+
+ %% We created a persistent object successfully.
+ ?line ?match({_,key,_,_,_, _}, Obj2),
+
+ %% Get key and Pid
+ {_,_,Key,_,_, _} = Obj2,
+ PID=(catch orber_objectkeys:get_pid(Key)),
+
+ %% Use the two different ways to look up if the server is persistent.
+ ?line ?match(true, orber_objectkeys:is_persistent(Key)),
+ ?line ?match(true, orber_objectkeys:is_persistent(PID)),
+
+ %% Create servers using every possible way.
+ O1=(catch orber_test_server:oe_create()),
+ O2=(catch orber_test_server:oe_create_link()),
+ O3=(catch orber_test_server:oe_create([])),
+ O4=(catch orber_test_server:oe_create_link([])),
+ %% NOTE!!! Next four lines requires that we still support RegName instead of
+ %% only OptionList as the second argument to oe_create*/2. Remove these when that
+ %% is no longer the case.
+ O5=(catch orber_test_server:oe_create([], {'local', o5})),
+ O6=(catch orber_test_server:oe_create([], {'global', {o6, obj}})),
+ O7=(catch orber_test_server:oe_create_link([], {'local', o7})),
+ O8=(catch orber_test_server:oe_create_link([], {'global', {o8, obj}})),
+
+ %% Test if all the object references are correct.
+ ?line ?match({_,key,_,_,_, _}, O1),
+ ?line ?match({_,key,_,_,_, _}, O2),
+ ?line ?match({_,key,_,_,_, _}, O3),
+ ?line ?match({_,key,_,_,_, _}, O4),
+ ?line ?match({_, registered, o5, _,_, _}, O5),
+ ?line ?match({_,key,_,_,_, _}, O6),
+ ?line ?match({_, registered, o7, _,_, _}, O7),
+ ?line ?match({_,key,_,_,_, _}, O8),
+
+ %% Test if persistent.
+ {_,_,Key1,_,_, _} = O1,
+ PID1=(catch orber_objectkeys:get_pid(Key1)),
+ ?line ?match(false, orber_objectkeys:is_persistent(Key1)),
+ ?line ?match(false, orber_objectkeys:is_persistent(PID1)),
+
+ %% all the servers are alive(?!).
+ ?line ?match(false, corba_object:non_existent(O1)),
+ ?line ?match(false, corba_object:non_existent(O2)),
+ ?line ?match(false, corba_object:non_existent(O3)),
+ ?line ?match(false, corba_object:non_existent(O4)),
+ ?line ?match(false, corba_object:non_existent(O5)),
+ ?line ?match(false, corba_object:non_existent(O6)),
+ ?line ?match(false, corba_object:non_existent(O7)),
+ ?line ?match(false, corba_object:non_existent(O8)),
+ ?line ?match(false, corba_object:non_existent(Obj2)),
+
+ %% Does locate work?
+ ?line ?match('object_here', corba:locate(O1)),
+ ?line ?match('object_here', corba:locate(O2)),
+ ?line ?match('object_here', corba:locate(O3)),
+ ?line ?match('object_here', corba:locate(O4)),
+ ?line ?match('object_here', corba:locate(O5)),
+ ?line ?match('object_here', corba:locate(O6)),
+ ?line ?match('object_here', corba:locate(O7)),
+ ?line ?match('object_here', corba:locate(O8)),
+ ?line ?match('object_here', corba:locate(Obj2)),
+
+ %% Terminate all servers with reason 'normal'.
+ catch corba:dispose(O1),
+ catch corba:dispose(O2),
+ catch corba:dispose(O3),
+ catch corba:dispose(O4),
+ catch corba:dispose(O5),
+ catch corba:dispose(O6),
+ catch corba:dispose(O7),
+ catch corba:dispose(O8),
+ catch corba:dispose(Obj2),
+
+
+ %% To make sure that orber_objectkeys-server is able to
+ %% clean up we wait.
+ timer:sleep(2000),
+
+ %% all the servers are dead(?!). If one of these test-cases
+ %% fails the only error can be that we didn't sleep long enough, i.e.,
+ %% try a longer timeout. If still fails something is wrong.
+ ?line ?match(true, corba_object:non_existent(O1)),
+ ?line ?match(true, corba_object:non_existent(O2)),
+ ?line ?match(true, corba_object:non_existent(O3)),
+ ?line ?match(true, corba_object:non_existent(O4)),
+ ?line ?match(true, corba_object:non_existent(O5)),
+ ?line ?match(true, corba_object:non_existent(O6)),
+ ?line ?match(true, corba_object:non_existent(O7)),
+ ?line ?match(true, corba_object:non_existent(O8)),
+ ?line ?match(true, corba_object:non_existent(Obj2)),
+
+ %% Create a new persistent server.
+ Obj3=(catch orber_test_server:oe_create([],
+ [{persistent, true},
+ {regname, {global,{obj2, 12345}}}])),
+
+ %% OK?!
+ ?line ?match({_,key,_,_,_, _}, Obj3),
+
+ %% Try to create a server with the same name (naturally it fails).
+ ?line ?match({'EXCEPTION',{'INTERNAL',[],_,'COMPLETED_NO'}},
+ orber_test_server:oe_create([],
+ [{persistent, true},
+ {regname, {global,{obj2, 12345}}}])),
+ %% Try to remove all 'dead' servers. No server should be removed.
+ orber_objectkeys:gc(0),
+
+ %% Kill object brutal, i.e., not with reason 'normal' or 'shutdown'.
+ P3 = corba:get_pid(Obj3),
+ exit(P3, kill),
+
+ {_,_,Key3,_,_, _} = Obj3,
+
+ %% Give time to clean up.
+ timer:sleep(2000),
+ ?line ?match({'EXCEPTION',{'TRANSIENT',[],_,'COMPLETED_NO'}},
+ gen_server:call(orber_objkeyserver,
+ {get_pid, Key3},
+ infinity)),
+
+ ?line ?match(false,corba_object:non_existent(Obj3)),
+
+ %% Run gc wit a "huge" time-limit. Will not erase the dead object.
+ orber_objectkeys:gc(10000),
+ ?line ?match(false,corba_object:non_existent(Obj3)),
+
+ %% Run gc with minimum time-limit. Will erase the dead object.
+ orber_objectkeys:gc(0),
+ ?line ?match(true,corba_object:non_existent(Obj3)),
+
+ %% Create a new persistent server.
+ Obj4=(catch orber_test_server:oe_create([],
+ [{persistent, true},
+ {regname, {global,{obj2, 12345}}}])),
+
+ %% OK?!
+ ?match({_,key,_,_,_, _}, Obj4),
+ %% Kill object brutal, i.e., not with reason 'normal' or 'shutdown'.
+ P4 = corba:get_pid(Obj4),
+ exit(P4, kill),
+
+ %% Give time to clean up.
+ timer:sleep(2000),
+% ?line ?match({'EXCEPTION',{'COMM_FAILURE',[],0,'COMPLETED_NO'}},
+ ?line ?match({error, _},
+ corba:get_pid(Obj4)),
+
+ ?line ?match(false,corba_object:non_existent(Obj4)),
+
+ %% Restart the object.
+ Obj5=(catch orber_test_server:oe_create([],
+ [{persistent, true},
+ {regname, {global,{obj2, 12345}}}])),
+ %% OK?!
+ ?line ?match({_,key,_,_,_, _}, Obj5),
+
+ %% Run gc with minimum time-limit.
+ orber_objectkeys:gc(0),
+ ?line ?match(false,corba_object:non_existent(Obj5)),
+ corba:dispose(Obj5),
+ ok.
+
+
+%%-----------------------------------------------------------------
+%% API tests for callback functions
+%%-----------------------------------------------------------------
+-define(DO_EXIT_FLAG, 0).
+-define(NO_EXIT_FLAG, 16#10).
+
+-define(DO_EXIT, {is, 0}).
+-define(NO_EXIT, {is, 16#10}).
+
+
+
+callback_ok_api(doc) -> ["Successful callbak API tests", ""];
+callback_ok_api(suite) -> [];
+callback_ok_api(_) ->
+ %% Init
+ ?line ?match({ok, {?DO_EXIT, state}}, corba:handle_init(?MODULE, {?DO_EXIT_FLAG, state})),
+ %% Terminate
+ ?line ?match(ok, corba:handle_terminate(?MODULE, "reason", {?DO_EXIT, state})),
+ %% Handle_call
+ ?line ?match({reply,ok,{?DO_EXIT,state}},
+ corba:handle_call(?MODULE, foo, [],
+ {?DO_EXIT, state}, [], false, false)),
+ %% Handle_cast
+ ?line ?match({noreply, {?DO_EXIT,state}},
+ corba:handle_cast(?MODULE, foo_1w, [],
+ {?DO_EXIT, state}, [], false)),
+ %% Handle_call precond/postcond
+ ?line ?match({reply, ok, {?DO_EXIT, state}},
+ corba:handle_call(?MODULE, foo, [],
+ {?DO_EXIT, state}, [], false, false, {?MODULE, precond},
+ {?MODULE, postcond}, ?MODULE)),
+ %% Handle_cast precond/postcond
+ ?line ?match({noreply, {?DO_EXIT, state}},
+ corba:handle_cast(?MODULE, foo_1w, [],
+ {?DO_EXIT, state}, [], false, {?MODULE, precond},
+ {?MODULE, postcond}, ?MODULE)),
+ %% Handle_info
+ ?line ?match({noreply, {?DO_EXIT, state}},
+ corba:handle_info(?MODULE, "info", {?DO_EXIT, state})),
+ ok.
+
+callback_arity_api(doc) -> ["callbak arity API tests", ""];
+callback_arity_api(suite) -> [];
+callback_arity_api(_) ->
+ %% Handle_call - stay-alive == false
+ ?line ?match({'EXIT', {undef,_}},
+ corba:handle_call(?MODULE, foo, [to, many, arguments],
+ {?DO_EXIT, state}, [], false, false)),
+ %% Handle_call - stay-alive == true
+ ?line ?match({reply, {'EXCEPTION', #'OBJ_ADAPTER'{}}, _},
+ corba:handle_call(?MODULE, foo, [to, many, arguments],
+ {?NO_EXIT, state}, [], false, false)),
+ %% Handle_call - stay-alive == false
+ ?line ?match({'EXIT', _},
+ corba:handle_call(?MODULE, foo, [],
+ {?DO_EXIT, arity}, [], false, false)),
+ %% Handle_call - stay-alive == true
+ ?line ?match({reply, {'EXCEPTION', #'OBJ_ADAPTER'{}}, _},
+ corba:handle_call(?MODULE, foo, [],
+ {?NO_EXIT, arity}, [], false, false)),
+ %% Handle_cast - stay-alive == false
+ ?line ?match({'EXIT', {undef,_}},
+ corba:handle_cast(?MODULE, foo_1w, [to, many, arguments],
+ {?DO_EXIT, state}, [], false)),
+ %% Handle_cast - stay-alive == true
+ ?line ?match({noreply, {?NO_EXIT, state}},
+ corba:handle_cast(?MODULE, foo_1w, [to, many, arguments],
+ {?NO_EXIT, state}, [], false)),
+ %% Handle_cast - stay-alive == false
+ ?line ?match({'EXIT', _},
+ corba:handle_cast(?MODULE, foo_1w, [],
+ {?DO_EXIT, arity}, [], false)),
+ %% Handle_cast - stay-alive == true
+ ?line ?match({noreply, {?NO_EXIT, arity}},
+ corba:handle_cast(?MODULE, foo_1w, [],
+ {?NO_EXIT, arity}, [], false)),
+ %% Handle_info - stay-alive == false
+ ?line ?match({'EXIT', _},
+ corba:handle_info(?MODULE, "info", {?DO_EXIT, arity})),
+
+ %% Handle_info - stay-alive == true
+ ?line ?match({noreply, {?NO_EXIT, arity}},
+ corba:handle_info(?MODULE, "info", {?NO_EXIT, arity})),
+ ok.
+
+callback_module_api(doc) -> ["Module callbak API tests", ""];
+callback_module_api(suite) -> [];
+callback_module_api(_) ->
+ %% Handle_call - stay-alive == false
+ ?line ?match({'EXIT', {undef,_}},
+ corba:handle_call(wrong_mod, foo, [],
+ {?DO_EXIT, state}, [], false, false)),
+ %% Handle_call - stay-alive == true
+ ?line ?match({reply, {'EXCEPTION', #'OBJ_ADAPTER'{}}, _},
+ corba:handle_call(wrong_mod, foo, [],
+ {?NO_EXIT, state}, [], false, false)),
+ %% Handle_cast - stay-alive == false
+ ?line ?match({'EXIT', {undef,_}},
+ corba:handle_cast(wrong_mod, foo_1w, [],
+ {?DO_EXIT, state}, [], false)),
+ %% Handle_cast - stay-alive == true
+ ?line ?match({noreply, {?NO_EXIT, state}},
+ corba:handle_cast(wrong_mod, foo_1w, [],
+ {?NO_EXIT, state}, [], false)),
+ %% Handle_info - stay-alive == false.
+ ?line ?match({'EXIT', _},
+ corba:handle_info(wrong_mod, "info", {?DO_EXIT, state})),
+
+ %% Handle_info - stay-alive == true.
+ ?line ?match({noreply, {?NO_EXIT, state}},
+ corba:handle_info(wrong_mod, "info", {?NO_EXIT, state})),
+ ok.
+
+callback_function_api(doc) -> ["Function callbak API tests", ""];
+callback_function_api(suite) -> [];
+callback_function_api(_) ->
+ %% Handle_call - stay-alive == false
+ ?line ?match({'EXIT', {undef,_}},
+ corba:handle_call(?MODULE, bad_function, [],
+ {?DO_EXIT, state}, [], false, false)),
+ %% Handle_call - stay-alive == true
+ ?line ?match({reply, {'EXCEPTION', #'OBJ_ADAPTER'{}}, _},
+ corba:handle_call(?MODULE, bad_function, [],
+ {?NO_EXIT, state}, [], false, false)),
+ %% Handle_cast - stay-alive == false
+ ?line ?match({'EXIT', {undef,_}},
+ corba:handle_cast(?MODULE, bad_function, [],
+ {?DO_EXIT, state}, [], false)),
+ %% Handle_cast - stay-alive == true
+ ?line ?match({noreply, {?NO_EXIT, state}},
+ corba:handle_cast(?MODULE, bad_function, [],
+ {?NO_EXIT, state}, [], false)),
+ %% Handle_info - stay-alive == false. Note, we cannot use ?MODULE here.
+ ?line ?match({'EXIT', _},
+ corba:handle_info(corba, "info", {?DO_EXIT, state})),
+
+ %% Handle_info - stay-alive == true. Note, we cannot use ?MODULE here.
+ ?line ?match({noreply, {?NO_EXIT, state}},
+ corba:handle_info(corba, "info", {?NO_EXIT, state})),
+ ok.
+
+callback_precond_api(doc) -> ["Precond callbak API tests", ""];
+callback_precond_api(suite) -> [];
+callback_precond_api(_) ->
+ %% Handle_call - stay-alive == false
+ ?line ?match({'EXIT', _},
+ corba:handle_call(?MODULE, foo, [],
+ {?DO_EXIT, state}, [], false, false, {wrong_mod, precond},
+ {?MODULE, postcond}, ?MODULE)),
+ %% Handle_call - stay-alive == false
+ ?line ?match({'EXIT', _},
+ corba:handle_call(?MODULE, foo, [],
+ {?DO_EXIT, state}, [], false, false, {?MODULE, bad_precond},
+ {?MODULE, postcond}, ?MODULE)),
+ %% Handle_call - stay-alive == true
+ ?line ?match({reply, {'EXCEPTION', #'OBJ_ADAPTER'{}},_},
+ corba:handle_call(?MODULE, foo, [],
+ {?NO_EXIT, state}, [], false, false, {wrong_mod, precond},
+ {?MODULE, postcond}, ?MODULE)),
+ %% Handle_call - stay-alive == true
+ ?line ?match({reply, {'EXCEPTION', #'OBJ_ADAPTER'{}},_},
+ corba:handle_call(?MODULE, foo, [],
+ {?NO_EXIT, state}, [], false, false, {?MODULE, bad_precond},
+ {?MODULE, postcond}, ?MODULE)),
+ %% Handle_cast - stay-alive == false
+ ?line ?match({'EXIT', _},
+ corba:handle_cast(?MODULE, foo_1w, [],
+ {?DO_EXIT, state}, [], false, {wrong_mod, precond},
+ {?MODULE, postcond}, ?MODULE)),
+ %% Handle_cast - stay-alive == false
+ ?line ?match({'EXIT', _},
+ corba:handle_cast(?MODULE, foo_1w, [],
+ {?DO_EXIT, state}, [], false, {?MODULE, bad_precond},
+ {?MODULE, postcond}, ?MODULE)),
+ %% Handle_cast - stay-alive == true
+ ?line ?match({noreply, {?NO_EXIT, state}},
+ corba:handle_cast(?MODULE, foo_1w, [],
+ {?NO_EXIT, state}, [], false, {wrong_mod, precond},
+ {?MODULE, postcond}, ?MODULE)),
+ %% Handle_cast - stay-alive == true
+ ?line ?match({noreply, {?NO_EXIT, state}},
+ corba:handle_cast(?MODULE, foo_1w, [],
+ {?NO_EXIT, state}, [], false, {?MODULE, bad_precond},
+ {?MODULE, postcond}, ?MODULE)),
+ ok.
+
+
+callback_postcond_api(doc) -> ["Postcond callbak API tests", ""];
+callback_postcond_api(suite) -> [];
+callback_postcond_api(_) ->
+ %% Handle_call - stay-alive == false
+ ?line ?match({'EXIT', _},
+ corba:handle_call(?MODULE, foo, [],
+ {?DO_EXIT, state}, [], false, false, {?MODULE, precond},
+ {wrong_mod, postcond}, ?MODULE)),
+ %% Handle_call - stay-alive == false
+ ?line ?match({'EXIT', _},
+ corba:handle_call(?MODULE, foo, [],
+ {?DO_EXIT, state}, [], false, false, {?MODULE, precond},
+ {?MODULE, bad_postcond}, ?MODULE)),
+ %% Handle_call - stay-alive == true
+ ?line ?match({reply, {'EXCEPTION', #'OBJ_ADAPTER'{}},_},
+ corba:handle_call(?MODULE, foo, [],
+ {?NO_EXIT, state}, [], false, false, {?MODULE, precond},
+ {wrong_mod, postcond}, ?MODULE)),
+ %% Handle_call - stay-alive == true
+ ?line ?match({reply, {'EXCEPTION', #'OBJ_ADAPTER'{}},_},
+ corba:handle_call(?MODULE, foo, [],
+ {?NO_EXIT, state}, [], false, false, {?MODULE, precond},
+ {?MODULE, bad_postcond}, ?MODULE)),
+ %% Handle_cast - stay-alive == false
+ ?line ?match({'EXIT', _},
+ corba:handle_cast(?MODULE, foo_1w, [],
+ {?DO_EXIT, state}, [], false, {?MODULE, precond},
+ {wrong_mod, postcond}, ?MODULE)),
+ %% Handle_cast - stay-alive == false
+ ?line ?match({'EXIT', _},
+ corba:handle_cast(?MODULE, foo_1w, [],
+ {?DO_EXIT, state}, [], false, {?MODULE, precond},
+ {?MODULE, bad_postcond}, ?MODULE)),
+ %% Handle_cast - stay-alive == true
+ ?line ?match({noreply, {?NO_EXIT, state}},
+ corba:handle_cast(?MODULE, foo_1w, [],
+ {?NO_EXIT, state}, [], false, {?MODULE, precond},
+ {wrong_mod, postcond}, ?MODULE)),
+ %% Handle_cast - stay-alive == true
+ ?line ?match({noreply, {?NO_EXIT, state}},
+ corba:handle_cast(?MODULE, foo_1w, [],
+ {?NO_EXIT, state}, [], false, {?MODULE, precond},
+ {?MODULE, bad_postcond}, ?MODULE)),
+ ok.
+
+
+callback_exit_api(doc) -> ["Callbak exit API tests", ""];
+callback_exit_api(suite) -> [];
+callback_exit_api(_) ->
+ %% Handle_call - stay-alive == false
+ ?line ?match({'EXIT', _},
+ corba:handle_call(?MODULE, foo, [],
+ {?DO_EXIT, exit}, [], false, false)),
+ %% Handle_call - stay-alive == true
+ ?line ?match({reply, {'EXCEPTION', #'OBJ_ADAPTER'{}}, _},
+ corba:handle_call(?MODULE, foo, [],
+ {?NO_EXIT, exit}, [], false, false)),
+ %% Handle_cast - stay-alive == false
+ ?line ?match({'EXIT', _},
+ corba:handle_cast(?MODULE, foo_1w, [],
+ {?DO_EXIT, exit}, [], false)),
+ %% Handle_cast - stay-alive == true
+ ?line ?match({noreply, {?NO_EXIT, exit}},
+ corba:handle_cast(?MODULE, foo_1w, [],
+ {?NO_EXIT, exit}, [], false)),
+ %% Handle_info - stay-alive == false
+ ?line ?match({'EXIT', _},
+ corba:handle_info(?MODULE, "info", {?DO_EXIT, exit})),
+
+ %% Handle_info - stay-alive == true
+ ?line ?match({noreply, {?NO_EXIT, exit}},
+ corba:handle_info(?MODULE, "info", {?NO_EXIT, exit})),
+ ok.
+
+
+callback_badarith_api(doc) -> ["callbak badarith API tests", ""];
+callback_badarith_api(suite) -> [];
+callback_badarith_api(_) ->
+ %% Handle_call - stay-alive == false
+ ?line ?match({'EXIT', _},
+ corba:handle_call(?MODULE, foo, [],
+ {?DO_EXIT, badarith}, [], false, false)),
+ %% Handle_call - stay-alive == true
+ ?line ?match({reply, {'EXCEPTION', #'OBJ_ADAPTER'{}},_},
+ corba:handle_call(?MODULE, foo, [],
+ {?NO_EXIT, badarith}, [], false, false)),
+ %% Handle_cast - stay-alive == false
+ ?line ?match({'EXIT', _},
+ corba:handle_cast(?MODULE, foo_1w, [],
+ {?DO_EXIT, badarith}, [], false)),
+ %% Handle_cast - stay-alive == true
+ ?line ?match({noreply, {?NO_EXIT, badarith}},
+ corba:handle_cast(?MODULE, foo_1w, [],
+ {?NO_EXIT, badarith}, [], false)),
+ %% Handle_info - stay-alive == false
+ ?line ?match({'EXIT', _},
+ corba:handle_info(?MODULE, "info", {?DO_EXIT, badarith})),
+
+ %% Handle_info - stay-alive == true
+ ?line ?match({noreply, {?NO_EXIT, badarith}},
+ corba:handle_info(?MODULE, "info", {?NO_EXIT, badarith})),
+ ok.
+
+callback_case_clause_api(doc) -> ["callbak case_clause API tests", ""];
+callback_case_clause_api(suite) -> [];
+callback_case_clause_api(_) ->
+ %% Handle_call - stay-alive == false
+ ?line ?match({'EXIT', _},
+ corba:handle_call(?MODULE, foo, [],
+ {?DO_EXIT, case_clause}, [], false, false)),
+ %% Handle_call - stay-alive == true
+ ?line ?match({reply, {'EXCEPTION', #'OBJ_ADAPTER'{}}, _},
+ corba:handle_call(?MODULE, foo, [],
+ {?NO_EXIT, case_clause}, [], false, false)),
+ %% Handle_cast - stay-alive == false
+ ?line ?match({'EXIT', _},
+ corba:handle_cast(?MODULE, foo_1w, [],
+ {?DO_EXIT, case_clause}, [], false)),
+ %% Handle_cast - stay-alive == true
+ ?line ?match({noreply, {?NO_EXIT, case_clause}},
+ corba:handle_cast(?MODULE, foo_1w, [],
+ {?NO_EXIT, case_clause}, [], false)),
+ %% Handle_info - stay-alive == false
+ ?line ?match({'EXIT', _},
+ corba:handle_info(?MODULE, "info", {?DO_EXIT, case_clause})),
+
+ %% Handle_info - stay-alive == true
+ ?line ?match({noreply, {?NO_EXIT, case_clause}},
+ corba:handle_info(?MODULE, "info", {?NO_EXIT, case_clause})),
+ ok.
+
+callback_function_clause_api(doc) -> ["callbak function_clause API tests", ""];
+callback_function_clause_api(suite) -> [];
+callback_function_clause_api(_) ->
+ %% Handle_call - stay-alive == false
+ ?line ?match({'EXIT', _},
+ corba:handle_call(?MODULE, foo, [],
+ {?DO_EXIT, function_clause}, [], false, false)),
+ %% Handle_call - stay-alive == true
+ ?line ?match({reply, {'EXCEPTION', #'OBJ_ADAPTER'{}}, _},
+ corba:handle_call(?MODULE, foo, [],
+ {?NO_EXIT, function_clause}, [], false, false)),
+ %% Handle_cast - stay-alive == false
+ ?line ?match({'EXIT', _},
+ corba:handle_cast(?MODULE, foo_1w, [],
+ {?DO_EXIT, function_clause}, [], false)),
+ %% Handle_cast - stay-alive == true
+ ?line ?match({noreply, {?NO_EXIT, function_clause}},
+ corba:handle_cast(?MODULE, foo_1w, [],
+ {?NO_EXIT, function_clause}, [], false)),
+ %% Handle_info - stay-alive == false
+ ?line ?match({'EXIT', _},
+ corba:handle_info(?MODULE, "info", {?DO_EXIT, function_clause})),
+ %% Handle_info - stay-alive == true
+ ?line ?match({noreply, {?NO_EXIT, function_clause}},
+ corba:handle_info(?MODULE, "info", {?NO_EXIT, function_clause})),
+ ok.
+
+%% Faked mandatory operations
+init(State) ->
+ evaluate_state(State),
+ {ok, State}.
+terminate(_Reason, State) ->
+ evaluate_state(State),
+ ok.
+
+code_change(_OldVsn, State, _Extra) ->
+ evaluate_state(State),
+ {ok, State}.
+handle_call(_,_, State) ->
+ evaluate_state(State),
+ {noreply, State}.
+handle_cast(_, State) ->
+ evaluate_state(State),
+ {noreply, State}.
+handle_info(_Info, State) ->
+ evaluate_state(State),
+ {noreply, State}.
+
+foo(State) ->
+ evaluate_state(State),
+ {reply, ok, State}.
+foo(State, _Arg) ->
+ evaluate_state(State),
+ {reply, ok, State}.
+
+foo_1w(State) ->
+ evaluate_state(State),
+ {noreply, State}.
+foo_1w(State, _Arg) ->
+ evaluate_state(State),
+ {noreply, State}.
+
+precond(_Module, _Function, _Args) ->
+ ok.
+
+postcond(_Module, _Function, _Args, _Result) ->
+ ok.
+
+evaluate_state(exit) ->
+ exit("exit on purpose");
+evaluate_state(badarith) ->
+ 10 * atom;
+evaluate_state(case_clause) ->
+ case 10 of
+ false ->
+ ok
+ end;
+evaluate_state(module) ->
+ non_existing_module:bar();
+evaluate_state(function) ->
+ ?MODULE:non_existing_function();
+evaluate_state(arity) ->
+ ?MODULE:foo(to, many, arguments);
+evaluate_state(function_clause) ->
+ evaluate_state(incorrect_state);
+evaluate_state(state) ->
+ ok.
+
+%%-----------------------------------------------------------------
+%% Local functions.
+%%-----------------------------------------------------------------
+
+pseudo_calls(0, _) ->
+ ok;
+pseudo_calls(Times, Obj) ->
+ orber_test_server:pseudo_call(Obj),
+ New = Times - 1,
+ pseudo_calls(New, Obj).
+pseudo_casts(0, _) ->
+ ok;
+pseudo_casts(Times, Obj) ->
+ orber_test_server:pseudo_cast(Obj),
+ New = Times - 1,
+ pseudo_casts(New, Obj).
diff --git a/lib/orber/test/csiv2_SUITE.erl b/lib/orber/test/csiv2_SUITE.erl
new file mode 100644
index 0000000000..8103fd81ac
--- /dev/null
+++ b/lib/orber/test/csiv2_SUITE.erl
@@ -0,0 +1,940 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2005-2010. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+
+-module(csiv2_SUITE).
+
+-include("test_server.hrl").
+-include_lib("orber/include/corba.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming.hrl").
+-include_lib("orber/src/orber_iiop.hrl").
+-include_lib("orber/src/ifr_objects.hrl").
+-include("idl_output/orber_test_server.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming_NamingContextExt.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming_NamingContext.hrl").
+%%-include_lib("orber/src/OrberCSIv2.hrl").
+
+-define(default_timeout, ?t:minutes(5)).
+
+-define(match(ExpectedRes,Expr),
+ fun() ->
+ AcTuAlReS = (catch (Expr)),
+ case AcTuAlReS of
+ ExpectedRes ->
+ io:format("------ CORRECT RESULT ------~n~p~n",
+ [AcTuAlReS]),
+ AcTuAlReS;
+ _ ->
+ io:format("###### ERROR ERROR ######~nRESULT: ~p~n",
+ [AcTuAlReS]),
+ ?line exit(AcTuAlReS)
+ end
+ end()).
+
+-define(REQUEST_ID, 0).
+
+-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>>).
+%% The fragments are identical for requests and replies.
+-define(FRAG_2, <<71,73,79,80,1,2,2,7,0,0,0,5,0,0,0,?REQUEST_ID,50>>).
+-define(FRAG_3, <<71,73,79,80,1,2,2,7,0,0,0,5,0,0,0,?REQUEST_ID,51>>).
+-define(FRAG_4, <<71,73,79,80,1,2,0,7,0,0,0,5,0,0,0,?REQUEST_ID,0>>).
+
+%% Should X509 DER generated by, for example, OpenSSL
+-define(X509DER,
+ <<42>>).
+
+%% Should X509 PEM generated by, for example, OpenSSL
+-define(X509PEM,
+ <<42>>).
+
+%% IOR exported by VB (CSIv2 activated).
+-define(VB_IOR,
+ #'IOP_IOR'
+ {type_id = "IDL:omg.org/CosNotifyComm/SequencePushConsumer:1.0",
+ profiles =
+ [#'IOP_TaggedProfile'
+ {tag = ?TAG_INTERNET_IOP,
+ profile_data =
+ #'IIOP_ProfileBody_1_1'{
+ iiop_version = #'IIOP_Version'{major = 1,
+ minor = 2},
+ host = "127.0.0.1",
+ port = 0,
+ object_key = [0,86,66,1,0,0,0,24,47,70,77,65,95,67,73,82,80,77,65,78,95,80,79,65,95,83,69,67,85,82,69,0,0,0,0,4,0,0,4,186,0,0,2,10,81,218,65,185],
+ components =
+ [#'IOP_TaggedComponent'{tag = ?TAG_SSL_SEC_TRANS,
+ component_data = #'SSLIOP_SSL'{
+ target_supports = 102,
+ target_requires = 66,
+ port = 49934}},
+ #'IOP_TaggedComponent'{tag = ?TAG_CSI_SEC_MECH_LIST,
+ component_data =
+ #'CSIIOP_CompoundSecMechList'{stateful = true,
+ mechanism_list =
+ [#'CSIIOP_CompoundSecMech'
+ {target_requires = 66,
+ transport_mech = #'IOP_TaggedComponent'{
+ tag = ?TAG_TLS_SEC_TRANS,
+ component_data =
+ #'CSIIOP_TLS_SEC_TRANS'{
+ target_supports = 102,
+ target_requires = 66,
+ addresses =
+ [#'CSIIOP_TransportAddress'
+ {host_name = "127.0.0.1",
+ port = 49934}]}},
+ as_context_mech =
+ #'CSIIOP_AS_ContextSec'{
+ target_supports = 0,
+ target_requires = 0,
+ client_authentication_mech = [],
+ target_name = []},
+ sas_context_mech =
+ #'CSIIOP_SAS_ContextSec'{
+ target_supports = 1024,
+ target_requires = 0,
+ privilege_authorities =
+ [#'CSIIOP_ServiceConfiguration'
+ {syntax = 1447174401,
+ name = "Borland"}],
+ supported_naming_mechanisms = [[6,
+ 6,
+ 103,
+ 129,
+ 2,
+ 1,
+ 1,
+ 1]],
+ supported_identity_types = 15}}]}},
+ #'IOP_TaggedComponent'
+ {tag = ?TAG_CODE_SETS,
+ component_data =
+ #'CONV_FRAME_CodeSetComponentInfo'{'ForCharData' =
+ #'CONV_FRAME_CodeSetComponent'{
+ native_code_set = 65537,
+ conversion_code_sets = [83951617]},
+ 'ForWcharData' =
+ #'CONV_FRAME_CodeSetComponent'{
+ native_code_set = 65801,
+ conversion_code_sets = []}}},
+ #'IOP_TaggedComponent'{tag = ?TAG_ORB_TYPE,
+ component_data = 1447645952},
+ #'IOP_TaggedComponent'{tag = 1447645955,
+ component_data = [0,5,7,1,127]}]}}]}).
+
+%% Common basic types
+-define(OID, {2,23,130,1,1,1}).
+
+-define(OCTET_STR, [1,2,3,4]).
+
+-define(BIT_STR, [0,1,0,1,1]).
+
+-define(BOOLEAN, false).
+
+-define(ANY, [19,5,111,116,112,67,65]).
+
+-ifdef(false).
+%% PKIX1Explicit88
+-define(AlgorithmIdentifier,
+ #'AlgorithmIdentifier'{algorithm = ?OID,
+ parameters = ?ANY}).
+
+-define(Validity, #'Validity'{notBefore = {utcTime, "19820102070533.8"},
+ notAfter = {generalTime, "19820102070533.8"}}).
+
+-define(SubjectPublicKeyInfo,
+ #'SubjectPublicKeyInfo'{algorithm = ?AlgorithmIdentifier,
+ subjectPublicKey = ?BIT_STR}).
+
+-define(AttributeTypeAndValue,
+ #'AttributeTypeAndValue'{type = ?OID,
+ value = <<19,11,69,114,105,99,115,115,111,110,32,65,66>>}).
+
+-define(RelativeDistinguishedName, [?AttributeTypeAndValue]).
+
+-define(RDNSequence, [?RelativeDistinguishedName]).
+
+-define(Name, {rdnSequence, ?RDNSequence}).
+
+-define(Version, v3).
+
+-define(CertificateSerialNumber, 1).
+
+-define(UniqueIdentifier, ?BIT_STR).
+
+-define(Extension, #'Extension'{extnID = ?OID,
+ critical = ?BOOLEAN,
+ extnValue = ?OCTET_STR}).
+
+-define(Extensions, [?Extension]).
+
+-define(TBSCertificate,
+ #'TBSCertificate'{version = ?Version,
+ serialNumber = ?CertificateSerialNumber,
+ signature = ?AlgorithmIdentifier,
+ issuer = ?Name,
+ validity = ?Validity,
+ subject = ?Name,
+ subjectPublicKeyInfo = ?SubjectPublicKeyInfo,
+ issuerUniqueID = ?UniqueIdentifier,
+ subjectUniqueID = ?UniqueIdentifier,
+ extensions = ?Extensions}).
+
+-define(Certificate, #'Certificate'{tbsCertificate = ?TBSCertificate,
+ signatureAlgorithm = ?AlgorithmIdentifier,
+ signature = ?BIT_STR}).
+
+%% PKIX1Implicit88
+
+-define(GeneralName, {registeredID, ?OID}).
+
+-define(GeneralNames, [?GeneralName]).
+
+%% PKIXAttributeCertificate
+-define(AttCertValidityPeriod,
+ #'AttCertValidityPeriod'{notBeforeTime = "19820102070533.8",
+ notAfterTime = "19820102070533.8"}).
+
+
+-define(Attribute, #'Attribute'{type = ?OID,
+ values = []}).
+
+-define(Attributes, [?Attribute]).
+
+-define(IssuerSerial, #'IssuerSerial'{issuer = ?GeneralNames,
+ serial = ?CertificateSerialNumber,
+ issuerUID = ?UniqueIdentifier}).
+
+-define(DigestedObjectType, publicKey). %% Enum
+
+-define(ObjectDigestInfo,
+ #'ObjectDigestInfo'{digestedObjectType = ?DigestedObjectType,
+ otherObjectTypeID = ?OID,
+ digestAlgorithm = ?AlgorithmIdentifier,
+ objectDigest = ?BIT_STR}).
+
+-define(V2Form, #'V2Form'{issuerName = ?GeneralNames,
+ baseCertificateID = ?IssuerSerial,
+ objectDigestInfo = ?ObjectDigestInfo}).
+
+-define(AttCertVersion, v2).
+
+-define(Holder, #'Holder'{baseCertificateID = ?IssuerSerial,
+ entityName = ?GeneralNames,
+ objectDigestInfo = ?ObjectDigestInfo}).
+
+-define(AttCertIssuer, {v2Form, ?V2Form}).
+
+-define(AttributeCertificateInfo,
+ #'AttributeCertificateInfo'{version = ?AttCertVersion,
+ holder = ?Holder,
+ issuer = ?AttCertIssuer,
+ signature = ?AlgorithmIdentifier,
+ serialNumber = ?CertificateSerialNumber,
+ attrCertValidityPeriod = ?AttCertValidityPeriod,
+ attributes = ?Attributes,
+ issuerUniqueID = ?UniqueIdentifier,
+ extensions = ?Extensions}).
+
+-define(AttributeCertificate,
+ #'AttributeCertificate'{acinfo = ?AttributeCertificateInfo,
+ signatureAlgorithm = ?AlgorithmIdentifier,
+ signatureValue = ?BIT_STR}).
+
+
+%% OrberCSIv2
+-define(AttributeCertChain,
+ #'AttributeCertChain'{attributeCert = ?AttributeCertificate,
+ certificateChain = ?CertificateChain}).
+
+-define(CertificateChain, [?Certificate]).
+
+-define(VerifyingCertChain, [?Certificate]).
+
+-endif.
+
+%%-----------------------------------------------------------------
+%% External exports
+%%-----------------------------------------------------------------
+-export([all/1, cases/0, init_all/1, finish_all/1,
+ init_per_testcase/2, fin_per_testcase/2,
+% code_CertificateChain_api/1,
+% code_AttributeCertChain_api/1,
+% code_VerifyingCertChain_api/1,
+% code_AttributeCertificate_api/1,
+% code_Certificate_api/1,
+% code_TBSCertificate_api/1,
+% code_CertificateSerialNumber_api/1,
+% code_Version_api/1,
+% code_AlgorithmIdentifier_api/1,
+% code_Name_api/1,
+% code_RDNSequence_api/1,
+% code_RelativeDistinguishedName_api/1,
+% code_AttributeTypeAndValue_api/1,
+% code_Attribute_api/1,
+% code_Validity_api/1,
+% code_SubjectPublicKeyInfo_api/1,
+% code_UniqueIdentifier_api/1,
+% code_Extensions_api/1,
+% code_Extension_api/1,
+% code_AttributeCertificateInfo_api/1,
+% code_AttCertVersion_api/1,
+% code_Holder_api/1,
+% code_AttCertIssuer_api/1,
+% code_AttCertValidityPeriod_api/1,
+% code_V2Form_api/1,
+% code_IssuerSerial_api/1,
+% code_ObjectDigestInfo_api/1,
+% code_OpenSSL509_api/1,
+ ssl_server_peercert_api/1,
+ ssl_client_peercert_api/1]).
+
+
+%%-----------------------------------------------------------------
+%% Internal exports
+%%-----------------------------------------------------------------
+-export([fake_server_ORB/5]).
+
+%%-----------------------------------------------------------------
+%% Func: all/1
+%% Args:
+%% Returns:
+%%-----------------------------------------------------------------
+all(doc) -> ["API tests for multi orber interfaces using CSIv2"];
+all(suite) -> {req,
+ [mnesia],
+ {conf, init_all, cases(), finish_all}}.
+
+%% NOTE - the fragment test cases must bu first since we explicitly set a request
+%% id. Otherwise, the request-id counter would be increased and we cannot know
+%% what it is.
+cases() ->
+ [
+% code_CertificateChain_api,
+% code_AttributeCertChain_api,
+% code_VerifyingCertChain_api,
+% code_AttributeCertificate_api,
+% code_Certificate_api,
+% code_TBSCertificate_api,
+% code_CertificateSerialNumber_api,
+% code_Version_api,
+% code_AlgorithmIdentifier_api,
+% code_Name_api,
+% code_RDNSequence_api,
+% code_RelativeDistinguishedName_api,
+% code_AttributeTypeAndValue_api,
+% code_Attribute_api,
+% code_Validity_api,
+% code_SubjectPublicKeyInfo_api,
+% code_UniqueIdentifier_api,
+% code_Extensions_api,
+% code_Extension_api,
+% code_AttributeCertificateInfo_api,
+% code_AttCertVersion_api,
+% code_Holder_api,
+% code_AttCertIssuer_api,
+% code_AttCertValidityPeriod_api,
+% code_V2Form_api,
+% code_IssuerSerial_api,
+% code_ObjectDigestInfo_api,
+% code_OpenSSL509_api,
+ ssl_server_peercert_api,
+ ssl_client_peercert_api].
+
+%%-----------------------------------------------------------------
+%% Init and cleanup functions.
+%%-----------------------------------------------------------------
+
+init_per_testcase(_Case, Config) ->
+ Path = code:which(?MODULE),
+ code:add_pathz(filename:join(filename:dirname(Path), "idl_output")),
+ Dog=test_server:timetrap(?default_timeout),
+ orber:jump_start(0),
+ oe_orber_test_server:oe_register(),
+ [{watchdog, Dog}|Config].
+
+
+fin_per_testcase(_Case, Config) ->
+ oe_orber_test_server:oe_unregister(),
+ orber:jump_stop(),
+ Path = code:which(?MODULE),
+ code:del_path(filename:join(filename:dirname(Path), "idl_output")),
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+init_all(Config) ->
+ if
+ is_list(Config) ->
+ Config;
+ true ->
+ exit("Config not a list")
+ end.
+
+finish_all(Config) ->
+ Config.
+
+%%-----------------------------------------------------------------
+%% API tests for ORB to ORB, no security
+%%-----------------------------------------------------------------
+
+
+%%-----------------------------------------------------------------
+%% Encode and decode ASN.1 X509
+%%-----------------------------------------------------------------
+
+-ifdef(false).
+%% OrberCSIv2
+code_CertificateChain_api(doc) -> ["Code CertificateChain"];
+code_CertificateChain_api(suite) -> [];
+code_CertificateChain_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _},
+ 'OrberCSIv2':encode('CertificateChain', ?CertificateChain)),
+ ?match({ok, [#'Certificate'{}]},
+ 'OrberCSIv2':decode('CertificateChain', list_to_binary(Enc))),
+ ok.
+
+code_AttributeCertChain_api(doc) -> ["Code AttributeCertChain"];
+code_AttributeCertChain_api(suite) -> [];
+code_AttributeCertChain_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _},
+ 'OrberCSIv2':encode('AttributeCertChain', ?AttributeCertChain)),
+ ?match({ok, #'AttributeCertChain'{}},
+ 'OrberCSIv2':decode('AttributeCertChain', list_to_binary(Enc))),
+ ok.
+
+code_VerifyingCertChain_api(doc) -> ["Code VerifyingCertChain"];
+code_VerifyingCertChain_api(suite) -> [];
+code_VerifyingCertChain_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _},
+ 'OrberCSIv2':encode('VerifyingCertChain', ?VerifyingCertChain)),
+ ?match({ok, [#'Certificate'{}]},
+ 'OrberCSIv2':decode('VerifyingCertChain', list_to_binary(Enc))),
+ ok.
+
+%% PKIXAttributeCertificate
+code_AttributeCertificate_api(doc) -> ["Code AttributeCertificate"];
+code_AttributeCertificate_api(suite) -> [];
+code_AttributeCertificate_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _},
+ 'OrberCSIv2':encode('AttributeCertificate', ?AttributeCertificate)),
+ ?match({ok, #'AttributeCertificate'{}},
+ 'OrberCSIv2':decode('AttributeCertificate', list_to_binary(Enc))),
+ ok.
+
+code_AttributeCertificateInfo_api(doc) -> ["Code AttributeCertificateInfo"];
+code_AttributeCertificateInfo_api(suite) -> [];
+code_AttributeCertificateInfo_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _},
+ 'OrberCSIv2':encode('AttributeCertificateInfo', ?AttributeCertificateInfo)),
+ ?match({ok, #'AttributeCertificateInfo'{}},
+ 'OrberCSIv2':decode('AttributeCertificateInfo', list_to_binary(Enc))),
+ ok.
+
+code_AttCertVersion_api(doc) -> ["Code AttCertVersion"];
+code_AttCertVersion_api(suite) -> [];
+code_AttCertVersion_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _},
+ 'OrberCSIv2':encode('AttCertVersion', ?AttCertVersion)),
+ ?match({ok, ?AttCertVersion},
+ 'OrberCSIv2':decode('AttCertVersion', list_to_binary(Enc))),
+ ok.
+
+code_Holder_api(doc) -> ["Code Holder"];
+code_Holder_api(suite) -> [];
+code_Holder_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _},
+ 'OrberCSIv2':encode('Holder', ?Holder)),
+ ?match({ok, #'Holder'{}},
+ 'OrberCSIv2':decode('Holder', list_to_binary(Enc))),
+ ok.
+
+code_AttCertIssuer_api(doc) -> ["Code AttCertIssuer"];
+code_AttCertIssuer_api(suite) -> [];
+code_AttCertIssuer_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _},
+ 'OrberCSIv2':encode('AttCertIssuer', ?AttCertIssuer)),
+ ?match({ok, {v2Form, _}},
+ 'OrberCSIv2':decode('AttCertIssuer', list_to_binary(Enc))),
+ ok.
+
+code_AttCertValidityPeriod_api(doc) -> ["Code AttCertValidityPeriod"];
+code_AttCertValidityPeriod_api(suite) -> [];
+code_AttCertValidityPeriod_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _}, 'OrberCSIv2':encode('AttCertValidityPeriod', ?AttCertValidityPeriod)),
+ ?match({ok, #'AttCertValidityPeriod'{}},
+ 'OrberCSIv2':decode('AttCertValidityPeriod', list_to_binary(Enc))),
+ ok.
+
+code_V2Form_api(doc) -> ["Code V2Form"];
+code_V2Form_api(suite) -> [];
+code_V2Form_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _},
+ 'OrberCSIv2':encode('V2Form', ?V2Form)),
+ ?match({ok, #'V2Form'{}},
+ 'OrberCSIv2':decode('V2Form', list_to_binary(Enc))),
+ ok.
+
+code_IssuerSerial_api(doc) -> ["Code IssuerSerial"];
+code_IssuerSerial_api(suite) -> [];
+code_IssuerSerial_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _},
+ 'OrberCSIv2':encode('IssuerSerial', ?IssuerSerial)),
+ ?match({ok, #'IssuerSerial'{}},
+ 'OrberCSIv2':decode('IssuerSerial', list_to_binary(Enc))),
+ ok.
+
+code_ObjectDigestInfo_api(doc) -> ["Code ObjectDigestInfo"];
+code_ObjectDigestInfo_api(suite) -> [];
+code_ObjectDigestInfo_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _},
+ 'OrberCSIv2':encode('ObjectDigestInfo', ?ObjectDigestInfo)),
+ ?match({ok, #'ObjectDigestInfo'{}},
+ 'OrberCSIv2':decode('ObjectDigestInfo', list_to_binary(Enc))),
+ ok.
+
+%% PKIX1Explicit88
+code_Certificate_api(doc) -> ["Code Certificate"];
+code_Certificate_api(suite) -> [];
+code_Certificate_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _},
+ 'OrberCSIv2':encode('Certificate', ?Certificate)),
+ ?match({ok, #'Certificate'{}},
+ 'OrberCSIv2':decode('Certificate', list_to_binary(Enc))),
+ ok.
+
+code_TBSCertificate_api(doc) -> ["Code TBSCertificate"];
+code_TBSCertificate_api(suite) -> [];
+code_TBSCertificate_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _},
+ 'OrberCSIv2':encode('TBSCertificate', ?TBSCertificate)),
+ ?match({ok, #'TBSCertificate'{}},
+ 'OrberCSIv2':decode('TBSCertificate', list_to_binary(Enc))),
+ ok.
+
+code_CertificateSerialNumber_api(doc) -> ["Code CertificateSerialNumber"];
+code_CertificateSerialNumber_api(suite) -> [];
+code_CertificateSerialNumber_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _},
+ 'OrberCSIv2':encode('CertificateSerialNumber', ?CertificateSerialNumber)),
+ ?match({ok, ?CertificateSerialNumber},
+ 'OrberCSIv2':decode('CertificateSerialNumber', list_to_binary(Enc))),
+ ok.
+
+code_Version_api(doc) -> ["Code Version"];
+code_Version_api(suite) -> [];
+code_Version_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _}, 'OrberCSIv2':encode('Version', ?Version)),
+ ?match({ok, ?Version}, 'OrberCSIv2':decode('Version', list_to_binary(Enc))),
+ ok.
+
+code_AlgorithmIdentifier_api(doc) -> ["Code AlgorithmIdentifier"];
+code_AlgorithmIdentifier_api(suite) -> [];
+code_AlgorithmIdentifier_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _}, 'OrberCSIv2':encode('AlgorithmIdentifier', ?AlgorithmIdentifier)),
+ ?match({ok, #'AlgorithmIdentifier'{}},
+ 'OrberCSIv2':decode('AlgorithmIdentifier', list_to_binary(Enc))),
+ ok.
+
+code_Name_api(doc) -> ["Code Name"];
+code_Name_api(suite) -> [];
+code_Name_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _}, 'OrberCSIv2':encode('Name', ?Name)),
+ ?match({ok, {rdnSequence,_}},
+ 'OrberCSIv2':decode('Name', list_to_binary(Enc))),
+ ok.
+
+code_RDNSequence_api(doc) -> ["Code RDNSequence"];
+code_RDNSequence_api(suite) -> [];
+code_RDNSequence_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _}, 'OrberCSIv2':encode('RDNSequence', ?RDNSequence)),
+ ?match({ok, [[#'AttributeTypeAndValue'{}]]},
+ 'OrberCSIv2':decode('RDNSequence', list_to_binary(Enc))),
+ ok.
+
+code_RelativeDistinguishedName_api(doc) -> ["Code RelativeDistinguishedName"];
+code_RelativeDistinguishedName_api(suite) -> [];
+code_RelativeDistinguishedName_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _}, 'OrberCSIv2':encode('RelativeDistinguishedName', ?RelativeDistinguishedName)),
+ ?match({ok, [#'AttributeTypeAndValue'{}]},
+ 'OrberCSIv2':decode('RelativeDistinguishedName', list_to_binary(Enc))),
+ ok.
+
+code_AttributeTypeAndValue_api(doc) -> ["Code AttributeTypeAndValue"];
+code_AttributeTypeAndValue_api(suite) -> [];
+code_AttributeTypeAndValue_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _}, 'OrberCSIv2':encode('AttributeTypeAndValue', ?AttributeTypeAndValue)),
+ ?match({ok, #'AttributeTypeAndValue'{}},
+ 'OrberCSIv2':decode('AttributeTypeAndValue', list_to_binary(Enc))),
+ ok.
+
+code_Attribute_api(doc) -> ["Code Attribute"];
+code_Attribute_api(suite) -> [];
+code_Attribute_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _}, 'OrberCSIv2':encode('Attribute', ?Attribute)),
+ ?match({ok, #'Attribute'{}},
+ 'OrberCSIv2':decode('Attribute', list_to_binary(Enc))),
+ ok.
+
+code_Validity_api(doc) -> ["Code Validity"];
+code_Validity_api(suite) -> [];
+code_Validity_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _}, 'OrberCSIv2':encode('Validity', ?Validity)),
+ ?match({ok, #'Validity'{}},
+ 'OrberCSIv2':decode('Validity', list_to_binary(Enc))),
+ ok.
+
+code_SubjectPublicKeyInfo_api(doc) -> ["Code SubjectPublicKeyInfo"];
+code_SubjectPublicKeyInfo_api(suite) -> [];
+code_SubjectPublicKeyInfo_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _}, 'OrberCSIv2':encode('SubjectPublicKeyInfo', ?SubjectPublicKeyInfo)),
+ ?match({ok, #'SubjectPublicKeyInfo'{}},
+ 'OrberCSIv2':decode('SubjectPublicKeyInfo', list_to_binary(Enc))),
+ ok.
+
+code_UniqueIdentifier_api(doc) -> ["Code UniqueIdentifier"];
+code_UniqueIdentifier_api(suite) -> [];
+code_UniqueIdentifier_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _}, 'OrberCSIv2':encode('UniqueIdentifier', ?UniqueIdentifier)),
+ ?match({ok, _}, 'OrberCSIv2':decode('UniqueIdentifier', list_to_binary(Enc))),
+ ok.
+
+code_Extensions_api(doc) -> ["Code Extensions"];
+code_Extensions_api(suite) -> [];
+code_Extensions_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _}, 'OrberCSIv2':encode('Extensions', ?Extensions)),
+ ?match({ok, [#'Extension'{}]},
+ 'OrberCSIv2':decode('Extensions', list_to_binary(Enc))),
+ ok.
+
+code_Extension_api(doc) -> ["Code Extension"];
+code_Extension_api(suite) -> [];
+code_Extension_api(_Config) ->
+ {ok, Enc} =
+ ?match({ok, _}, 'OrberCSIv2':encode('Extension', ?Extension)),
+ ?match({ok, #'Extension'{}},
+ 'OrberCSIv2':decode('Extension', list_to_binary(Enc))),
+ ok.
+
+%% OpenSSL generated x509 Certificate
+code_OpenSSL509_api(doc) -> ["Code OpenSSL generated x509 Certificate"];
+code_OpenSSL509_api(suite) -> [];
+code_OpenSSL509_api(_Config) ->
+ {ok, Cert} =
+ ?match({ok, #'Certificate'{}},
+ 'OrberCSIv2':decode('Certificate', ?X509DER)),
+ AttrCertChain = #'AttributeCertChain'{attributeCert = ?AttributeCertificate,
+ certificateChain = [Cert]},
+ {ok, EAttrCertChain} =
+ ?match({ok, _}, 'OrberCSIv2':encode('AttributeCertChain', AttrCertChain)),
+ ?match({ok, #'AttributeCertChain'{}},
+ 'OrberCSIv2':decode('AttributeCertChain', list_to_binary(EAttrCertChain))),
+ ok.
+
+-endif.
+
+%%-----------------------------------------------------------------
+%% Test ssl:peercert
+%%-----------------------------------------------------------------
+ssl_server_peercert_api(doc) -> ["Test ssl:peercert (server side)"];
+ssl_server_peercert_api(suite) -> [];
+ssl_server_peercert_api(_Config) ->
+ case os:type() of
+ vxworks ->
+ {skipped, "No SSL-support for VxWorks."};
+ _ ->
+ Options = orber_test_lib:get_options(iiop_ssl, server,
+ 2, [{iiop_ssl_port, 0}]),
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node(Options)),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_ssl_port, []),
+ SSLOptions = orber_test_lib:get_options(ssl, client),
+ {ok, Socket} =
+ ?match({ok, _}, fake_client_ORB(ssl, ServerHost, ServerPort, SSLOptions)),
+ {ok, _PeerCert} = ?match({ok, _}, orber_socket:peercert(ssl, Socket)),
+ ?match({ok, {rdnSequence, _}}, orber_socket:peercert(ssl, Socket, [pkix, subject])),
+ ?match({ok, {rdnSequence, _}}, orber_socket:peercert(ssl, Socket, [ssl, subject])),
+% ?match({ok, #'Certificate'{}},
+% 'OrberCSIv2':decode('Certificate', PeerCert)),
+ destroy_fake_ORB(ssl, Socket),
+ ok
+ end.
+
+ssl_client_peercert_api(doc) -> ["Test ssl:peercert (client side)"];
+ssl_client_peercert_api(suite) -> [];
+ssl_client_peercert_api(_Config) ->
+ case os:type() of
+ vxworks ->
+ {skipped, "No SSL-support for VxWorks."};
+ _ ->
+ Options = orber_test_lib:get_options(iiop_ssl, client,
+ 2, [{iiop_ssl_port, 0}]),
+ {ok, ClientNode, _ClientHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node(Options)),
+ crypto:start(),
+ ssl:start(),
+ ssl:seed("testing"),
+ SSLOptions = orber_test_lib:get_options(ssl, server),
+ {ok, LSock} = ?match({ok, _}, ssl:listen(0, SSLOptions)),
+ {ok, {_Address, LPort}} = ?match({ok, {_, _}}, ssl:sockname(LSock)),
+ IOR = ?match({'IOP_IOR',_,_},
+ iop_ior:create_external({1, 2}, "IDL:FAKE:1.0",
+ "localhost", 6004, "FAKE",
+ [#'IOP_TaggedComponent'
+ {tag=?TAG_SSL_SEC_TRANS,
+ component_data=#'SSLIOP_SSL'
+ {target_supports = 2,
+ target_requires = 2,
+ port = LPort}}])),
+ spawn(orber_test_lib, remote_apply,
+ [ClientNode, corba_object, non_existent, [IOR]]),
+ {ok, Socket} = ?match({ok, _}, ssl:transport_accept(LSock)),
+ ?match(ok, ssl:ssl_accept(Socket)),
+
+ {ok, _PeerCert} = ?match({ok, _}, orber_socket:peercert(ssl, Socket)),
+ ?match({ok, {rdnSequence, _}}, orber_socket:peercert(ssl, Socket, [pkix, subject])),
+ ?match({ok, {rdnSequence, _}}, orber_socket:peercert(ssl, Socket, [ssl, subject])),
+% ?match({ok, #'Certificate'{}},
+% 'OrberCSIv2':decode('Certificate', PeerCert)),
+ ssl:close(Socket),
+ ssl:close(LSock),
+ ssl:stop(),
+ ok
+ end.
+
+%%-----------------------------------------------------------------
+%% Local functions.
+%%-----------------------------------------------------------------
+-ifdef(false).
+%% Not used yet.
+context_test(Obj) ->
+ IDToken1 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTAbsent,
+ value = true},
+ IDToken2 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTAnonymous,
+ value = false},
+ IDToken3 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTPrincipalName,
+ value = [0,255]},
+ IDToken4 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTX509CertChain,
+ value = [1,255]},
+ IDToken5 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTDistinguishedName,
+ value = [2,255]},
+ IDToken6 = #'CSI_IdentityToken'{label = ?ULONGMAX,
+ value = [3,255]},
+
+ MTEstablishContext1 = #'CSI_SASContextBody'
+ {label = ?CSI_MsgType_MTEstablishContext,
+ value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX,
+ authorization_token =
+ [#'CSI_AuthorizationElement'
+ {the_type = ?ULONGMAX,
+ the_element = [0,255]}],
+ identity_token = IDToken1,
+ client_authentication_token = [1, 255]}},
+ MTEstablishContext2 = #'CSI_SASContextBody'
+ {label = ?CSI_MsgType_MTEstablishContext,
+ value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX,
+ authorization_token =
+ [#'CSI_AuthorizationElement'
+ {the_type = ?ULONGMAX,
+ the_element = [0,255]}],
+ identity_token = IDToken2,
+ client_authentication_token = [1, 255]}},
+ MTEstablishContext3 = #'CSI_SASContextBody'
+ {label = ?CSI_MsgType_MTEstablishContext,
+ value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX,
+ authorization_token =
+ [#'CSI_AuthorizationElement'
+ {the_type = ?ULONGMAX,
+ the_element = [0,255]}],
+ identity_token = IDToken3,
+ client_authentication_token = [1, 255]}},
+ MTEstablishContext4 = #'CSI_SASContextBody'
+ {label = ?CSI_MsgType_MTEstablishContext,
+ value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX,
+ authorization_token =
+ [#'CSI_AuthorizationElement'
+ {the_type = ?ULONGMAX,
+ the_element = [0,255]}],
+ identity_token = IDToken4,
+ client_authentication_token = [1, 255]}},
+ MTEstablishContext5 = #'CSI_SASContextBody'
+ {label = ?CSI_MsgType_MTEstablishContext,
+ value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX,
+ authorization_token =
+ [#'CSI_AuthorizationElement'
+ {the_type = ?ULONGMAX,
+ the_element = [0,255]}],
+ identity_token = IDToken5,
+ client_authentication_token = [1, 255]}},
+ MTEstablishContext6 = #'CSI_SASContextBody'
+ {label = ?CSI_MsgType_MTEstablishContext,
+ value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX,
+ authorization_token =
+ [#'CSI_AuthorizationElement'
+ {the_type = ?ULONGMAX,
+ the_element = [0,255]}],
+ identity_token = IDToken6,
+ client_authentication_token = [1, 255]}},
+ MTCompleteEstablishContext = #'CSI_SASContextBody'
+ {label = ?CSI_MsgType_MTCompleteEstablishContext,
+ value = #'CSI_CompleteEstablishContext'{client_context_id = ?ULONGLONGMAX,
+ context_stateful = false,
+ final_context_token = [1, 255]}},
+ MTContextError = #'CSI_SASContextBody'
+ {label = ?CSI_MsgType_MTContextError,
+ value = #'CSI_ContextError'{client_context_id = ?ULONGLONGMAX,
+ major_status = 1,
+ minor_status = 2,
+ error_token = [2,255]}},
+ MTMessageInContext = #'CSI_SASContextBody'
+ {label = ?CSI_MsgType_MTMessageInContext,
+ value = #'CSI_MessageInContext'{client_context_id = ?ULONGLONGMAX,
+ discard_context = true}},
+ Ctx = [#'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
+ context_data = MTEstablishContext1},
+ #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
+ context_data = MTEstablishContext2},
+ #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
+ context_data = MTEstablishContext3},
+ #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
+ context_data = MTEstablishContext4},
+ #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
+ context_data = MTEstablishContext5},
+ #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
+ context_data = MTEstablishContext6},
+ #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
+ context_data = MTCompleteEstablishContext},
+ #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
+ context_data = MTContextError},
+ #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
+ context_data = MTMessageInContext}],
+ ?line ?match(ok, orber_test_server:testing_iiop_context(Obj, [{context, Ctx}])).
+
+
+fake_server_ORB(Type, Port, Options) ->
+ start_ssl(Type),
+ {ok, ListenSocket, NewPort} =
+ orber_socket:listen(Type, Port,
+ [{active, false}|Options]),
+ Socket = orber_socket:accept(Type, ListenSocket),
+ orber_socket:post_accept(Type, Socket),
+ {ok, Socket, NewPort}.
+
+-endif.
+
+fake_server_ORB(Type, Port, Options, Action, Data) ->
+ start_ssl(Type),
+ {ok, ListenSocket, _NewPort} =
+ orber_socket:listen(Type, Port, [{active, false}|Options]),
+ Socket = orber_socket:accept(Type, ListenSocket),
+ orber_socket:post_accept(Type, Socket),
+ do_server_action(Type, Socket, Action, Data),
+ orber_socket:close(Type, Socket),
+ ok.
+
+start_ssl(ssl) ->
+ crypto:start(),
+ ssl:start(),
+ ssl:seed("testing");
+start_ssl(_) ->
+ ok.
+
+
+destroy_fake_ORB(ssl, Socket) ->
+ orber_socket:close(ssl, Socket),
+ ssl:stop();
+destroy_fake_ORB(Type, Socket) ->
+ orber_socket:close(Type, Socket).
+
+fake_client_ORB(Type, Host, Port, Options) ->
+ start_ssl(Type),
+ Socket = orber_socket:connect(Type, Host, Port, [{active, false}|Options]),
+ {ok, Socket}.
+
+-ifdef(false).
+%% Not used yet.
+
+fake_client_ORB(Type, Host, Port, Options, Action, Data) ->
+ start_ssl(Type),
+ Socket = orber_socket:connect(Type, Host, Port, [{active, false}|Options]),
+ Result = do_client_action(Type, Socket, Action, Data),
+ orber_socket:close(Type, Socket),
+ Result.
+
+do_client_action(Type, Socket, fragments, FragList) ->
+ ok = send_data(Type, Socket, FragList),
+ {ok, Bytes} = gen_tcp:recv(Socket, 0),
+ {#reply_header{request_id = ?REQUEST_ID, reply_status = no_exception}, ok, [Par]} =
+ cdr_decode:dec_message({tk_void,[tk_any],[tk_any]}, Bytes),
+ Par;
+do_client_action(Type, Socket, fragments_max, FragList) ->
+ ok = send_data(Type, Socket, FragList),
+ {ok, Bytes} = gen_tcp:recv(Socket, 0),
+ {#reply_header{request_id = ?REQUEST_ID, reply_status = system_exception}, Exc, []} =
+ cdr_decode:dec_message({tk_void,[tk_any],[tk_any]}, Bytes),
+ Exc;
+do_client_action(Type, Socket, message_error, Data) ->
+ ok = send_data(Type, Socket, Data),
+ {ok,Bytes} = gen_tcp:recv(Socket, 0),
+ 'message_error' = cdr_decode:dec_message({tk_void,[tk_any],[tk_any]}, Bytes),
+ ok;
+do_client_action(_Type, _Socket, _Action, _Data) ->
+ ok.
+
+-endif.
+
+do_server_action(Type, Socket, fragments, FragList) ->
+ {ok, _B} = gen_tcp:recv(Socket, 0),
+ ok = send_data(Type, Socket, FragList);
+do_server_action(_Type, _Socket, _Action, _Data) ->
+ ok.
+
+
+send_data(_Type, _Socket, []) ->
+ ok;
+send_data(Type, Socket, [H|T]) ->
+ orber_socket:write(Type, Socket, H),
+ send_data(Type, Socket, T).
+
diff --git a/lib/orber/test/data_types_SUITE.erl b/lib/orber/test/data_types_SUITE.erl
new file mode 100644
index 0000000000..1feb0b3b58
--- /dev/null
+++ b/lib/orber/test/data_types_SUITE.erl
@@ -0,0 +1,173 @@
+%%-----------------------------------------------------------------
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2002-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%-----------------------------------------------------------------
+%% File : data_types_SUITE.erl
+%% Purpose :
+%%-----------------------------------------------------------------
+
+-module(data_types_SUITE).
+
+-include("test_server.hrl").
+-include_lib("orber/include/corba.hrl").
+
+-define(default_timeout, ?t:minutes(3)).
+
+-define(match(ExpectedRes, Expr),
+ fun() ->
+ AcTuAlReS = (catch (Expr)),
+ case AcTuAlReS of
+ ExpectedRes ->
+ io:format("------ CORRECT RESULT ------~n~p~n",
+ [AcTuAlReS]),
+ AcTuAlReS;
+ _ ->
+ io:format("###### ERROR ERROR ######~n~p~n",
+ [AcTuAlReS]),
+ ?line exit(AcTuAlReS)
+ end
+ end()).
+
+%%-----------------------------------------------------------------
+%% External exports
+%%-----------------------------------------------------------------
+-export([all/1]).
+
+%%-----------------------------------------------------------------
+%% Internal exports
+%%-----------------------------------------------------------------
+-export([]).
+-compile(export_all).
+
+%%-----------------------------------------------------------------
+%% Func: all/1
+%% Args:
+%% Returns:
+%%-----------------------------------------------------------------
+all(doc) -> ["This suite is for testing more or less complex data types"];
+all(suite) ->
+ [fixed_type, any_type].
+
+%%-----------------------------------------------------------------
+%% Init and cleanup functions.
+%%-----------------------------------------------------------------
+init_per_testcase(_Case, Config) ->
+ Path = code:which(?MODULE),
+ code:add_pathz(filename:join(filename:dirname(Path), "idl_output")),
+ ?line Dog=test_server:timetrap(?default_timeout),
+ [{watchdog, Dog}|Config].
+
+
+fin_per_testcase(_Case, Config) ->
+ Path = code:which(?MODULE),
+ code:del_path(filename:join(filename:dirname(Path), "idl_output")),
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+
+%%-----------------------------------------------------------------
+%% Test Case: name component handling tests
+%% Description:
+%%-----------------------------------------------------------------
+fixed_type(doc) -> ["Test the Fixed Point Datatype."];
+fixed_type(suite) -> [];
+fixed_type(_) ->
+ Val1 = ?match({fixed,3,2,314}, orber_test_server:val1()),
+ _Val2 = ?match({fixed,3,2,314}, orber_test_server:val2()),
+ _Val3 = ?match({fixed,3,2,314}, orber_test_server:val3()),
+ Val4 = ?match({fixed,3,2,314}, orber_test_server:val4()),
+ Val5 = ?match({fixed,2,2,14}, orber_test_server:val5()),
+ _Val6 = ?match({fixed,1,0,3}, orber_test_server:val6()),
+ Val7 = ?match({fixed,2,2,-14}, orber_test_server:val7()),
+ _Val8 = ?match({fixed,1,0,-3}, orber_test_server:val8()),
+ Val9 = ?match({fixed,3,2,328}, orber_test_server:val9()),
+ Val10 = ?match({fixed,4,4,4396}, orber_test_server:val10()),
+ Val11 = ?match({fixed,31,29,2242857142857142857142857142857}, orber_test_server:val11()),
+ Val12 = ?match({fixed,9,6,123140001}, orber_test_server:val12()),
+ Val13 = ?match({fixed,9,1,123140001}, orber_test_server:val13()),
+ Val14 = ?match({fixed,14,6,-12313876959999}, orber_test_server:val14()),
+ Val15 = ?match({fixed,14,6,12314123240001}, orber_test_server:val15()),
+ Val16 = ?match({fixed,17,7,15163459846280001}, orber_test_server:val16()),
+ _Val17 = ?match({fixed,3,2,402}, orber_test_server:val17()),
+ _Val18 = ?match({fixed,5,4,40401}, orber_test_server:val18()),
+ _Val19 = ?match({fixed,3,0,200}, orber_test_server:val19()),
+ Val20 = ?match({fixed,31,0,1999999999999999999999999999999}, orber_test_server:val20()),
+ Val21 = ?match({fixed,1,0,0}, orber_test_server:val21()),
+ Val22 = ?match({fixed,31,0,9999999999999999999999999999998}, orber_test_server:val22()),
+ Val23 = ?match({fixed,1,0,1}, orber_test_server:val23()),
+ _Val24 = ?match({fixed,5,0,19998}, orber_test_server:val24()),
+ _Val25 = ?match({fixed,2,0,40}, orber_test_server:val25()),
+ Val26 = ?match({fixed,31,0,9999999999999999999999999999999}, orber_test_server:val26()),
+
+ ?match(Val1, fixed:create(3,2,314)),
+ Val27 = ?match({fixed,6,2,314}, fixed:create(6,2,314)),
+
+ ?match({tk_fixed,3,2}, fixed:get_typecode(Val1)),
+ ?match({tk_fixed,6,2}, fixed:get_typecode(Val27)),
+ ?match({'EXCEPTION',{'BAD_PARAM',_,_,_}}, fixed:create(3,2,3140)),
+ ?match({'EXCEPTION',{'BAD_PARAM',_,_,_}}, fixed:create(5,6,314)),
+ ?match({'EXCEPTION',{'BAD_PARAM',_,_,_}}, fixed:create(32,2,314)),
+ ?match(Val10, fixed:multiply(Val4, Val5)),
+ ?match(Val16, fixed:multiply(Val12, Val13)),
+ ?match(Val22, fixed:multiply(Val26, Val26)),
+
+ ?match(Val9, fixed:add(Val4, Val5)),
+ ?match(Val15, fixed:add(Val12, Val13)),
+ ?match(Val20, fixed:add(Val26, Val26)),
+
+ ?match(Val11, fixed:divide(Val4, Val5)),
+ ?match(Val23, fixed:divide(Val26, Val26)),
+
+ ?match(Val14, fixed:subtract(Val12, Val13)),
+ ?match(Val21, fixed:subtract(Val26, Val26)),
+
+ ?match(Val7, fixed:unary_minus(Val5)),
+ ?match(Val5, fixed:unary_minus(Val7)),
+
+
+
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: any type
+%% Description:
+%%-----------------------------------------------------------------
+any_type(doc) -> ["Test the Any Datatype."];
+any_type(suite) -> [];
+any_type(_) ->
+ ?match(#any{typecode=undefined, value=undefined},
+ any:create()),
+ ?match(#any{typecode=tk_short, value=undefined},
+ any:set_typecode(any:create(), tk_short)),
+ ?match({'EXCEPTION', #'BAD_TYPECODE'{}},
+ any:set_typecode(any:create(), "wrong")),
+ ?match({'EXCEPTION', #'BAD_TYPECODE'{}},
+ any:create("wrong", 1)),
+ ?match(#any{typecode=tk_short, value = 1},
+ any:create(tk_short, 1)),
+ ?match(tk_short,
+ any:get_typecode(any:create(tk_short, 1))),
+ ?match(1,
+ any:get_value(any:create(tk_short, 1))),
+ ?match(#any{typecode=tk_short, value=2},
+ any:set_value(any:create(tk_short, 1), 2)),
+
+ ok.
diff --git a/lib/orber/test/generated_SUITE.erl b/lib/orber/test/generated_SUITE.erl
new file mode 100644
index 0000000000..1cd1674fc4
--- /dev/null
+++ b/lib/orber/test/generated_SUITE.erl
@@ -0,0 +1,385 @@
+%%-----------------------------------------------------------------
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2004-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%-----------------------------------------------------------------
+%% File : generated_SUITE.erl
+%% Purpose :
+%%-----------------------------------------------------------------
+
+-module(generated_SUITE).
+
+-include("test_server.hrl").
+-include_lib("orber/include/corba.hrl").
+
+-define(default_timeout, ?t:minutes(3)).
+
+-define(match(ExpectedRes, Expr),
+ fun() ->
+ AcTuAlReS = (catch (Expr)),
+ case AcTuAlReS of
+ ExpectedRes ->
+ AcTuAlReS;
+ _ ->
+ io:format("###### ERROR ERROR ######~n~p~n",
+ [AcTuAlReS]),
+ ?line exit(AcTuAlReS)
+ end
+ end()).
+
+-define(nomatch(Not, Expr),
+ fun() ->
+ AcTuAlReS = (catch (Expr)),
+ case AcTuAlReS of
+ Not ->
+ io:format("###### ERROR ERROR ######~n~p~n",
+ [AcTuAlReS]),
+ ?line exit(AcTuAlReS);
+ _ ->
+ AcTuAlReS
+ end
+ end()).
+
+
+-define(checktc(_Op),
+ fun(TC) ->
+ case orber_tc:check_tc(TC) of
+ false ->
+ io:format("###### ERROR ERROR ######~n~p - ~p~n", [Op, TC]),
+ ?line exit(TC);
+ true ->
+ true
+ end
+ end).
+
+%%-----------------------------------------------------------------
+%% External exports
+%%-----------------------------------------------------------------
+-export([all/1]).
+
+%%-----------------------------------------------------------------
+%% Internal exports
+%%-----------------------------------------------------------------
+-export([]).
+-compile(export_all).
+
+%%-----------------------------------------------------------------
+%% Func: all/1
+%% Args:
+%% Returns:
+%%-----------------------------------------------------------------
+all(doc) -> ["This suite is for testing IC generated files"];
+all(suite) ->
+ ['OrberApp_IFR',
+ erlang_binary, erlang_pid, erlang_port, erlang_ref,
+ 'CosNaming_Binding', 'CosNaming_BindingList', 'CosNaming_Name',
+ 'CosNaming_NameComponent', 'CosNaming_NamingContextExt_InvalidAddress',
+ 'CosNaming_NamingContext_AlreadyBound', 'CosNaming_NamingContext_CannotProceed',
+ 'CosNaming_NamingContext_InvalidName', 'CosNaming_NamingContext_NotEmpty',
+ 'CosNaming_NamingContext_NotFound', 'CosNaming_BindingIterator',
+ 'CosNaming_NamingContext', 'CosNaming_NamingContextExt'].
+
+%%-----------------------------------------------------------------
+%% Init and cleanup functions.
+%%-----------------------------------------------------------------
+init_per_testcase(_Case, Config) ->
+ ?line Dog=test_server:timetrap(?default_timeout),
+ [{watchdog, Dog}|Config].
+
+
+fin_per_testcase(_Case, Config) ->
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case:'OrberApp_IFR'
+%% Description:
+%%-----------------------------------------------------------------
+'OrberApp_IFR'(doc) -> [""];
+'OrberApp_IFR'(suite) -> [];
+'OrberApp_IFR'(_) ->
+ ?nomatch(undefined, 'OrberApp_IFR':oe_tc(get_absolute_name)),
+ ?nomatch(undefined, 'OrberApp_IFR':oe_tc(get_user_exception_type)),
+ ?match(undefined, 'OrberApp_IFR':oe_tc(undefined)),
+ ?match([_|_], 'OrberApp_IFR':oe_get_interface()),
+ ?match("IDL:OrberApp/IFR:1.0", 'OrberApp_IFR':typeID()),
+ check_tc('OrberApp_IFR':oe_get_interface()),
+ ?match(true, 'OrberApp_IFR':oe_is_a('OrberApp_IFR':typeID())),
+ ?match(false, 'OrberApp_IFR':oe_is_a("wrong")),
+ ok.
+
+
+%%-----------------------------------------------------------------
+%% Test Case: erlang_binary
+%% Description:
+%%-----------------------------------------------------------------
+erlang_binary(doc) -> [""];
+erlang_binary(suite) -> [];
+erlang_binary(_) ->
+ ?match(true, orber_tc:check_tc(erlang_binary:tc())),
+ ?match("IDL:erlang/binary:1.0", erlang_binary:id()),
+ ?match("erlang_binary", erlang_binary:name()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: erlang_pid
+%% Description:
+%%-----------------------------------------------------------------
+erlang_pid(doc) -> [""];
+erlang_pid(suite) -> [];
+erlang_pid(_) ->
+ ?match(true, orber_tc:check_tc(erlang_pid:tc())),
+ ?match("IDL:erlang/pid:1.0", erlang_pid:id()),
+ ?match("erlang_pid", erlang_pid:name()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: erlang_port
+%% Description:
+%%-----------------------------------------------------------------
+erlang_port(doc) -> [""];
+erlang_port(suite) -> [];
+erlang_port(_) ->
+ ?match(true, orber_tc:check_tc(erlang_port:tc())),
+ ?match("IDL:erlang/port:1.0", erlang_port:id()),
+ ?match("erlang_port", erlang_port:name()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: erlang_ref
+%% Description:
+%%-----------------------------------------------------------------
+erlang_ref(doc) -> [""];
+erlang_ref(suite) -> [];
+erlang_ref(_) ->
+ ?match(true, orber_tc:check_tc(erlang_ref:tc())),
+ ?match("IDL:erlang/ref:1.0", erlang_ref:id()),
+ ?match("erlang_ref", erlang_ref:name()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: 'CosNaming_Binding'
+%% Description:
+%%-----------------------------------------------------------------
+'CosNaming_Binding'(doc) -> [""];
+'CosNaming_Binding'(suite) -> [];
+'CosNaming_Binding'(_) ->
+ ?match(true, orber_tc:check_tc('CosNaming_Binding':tc())),
+ ?match("IDL:omg.org/CosNaming/Binding:1.0", 'CosNaming_Binding':id()),
+ ?match("CosNaming_Binding", 'CosNaming_Binding':name()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: 'CosNaming_BindingList'
+%% Description:
+%%-----------------------------------------------------------------
+'CosNaming_BindingList'(doc) -> [""];
+'CosNaming_BindingList'(suite) -> [];
+'CosNaming_BindingList'(_) ->
+ ?match(true, orber_tc:check_tc('CosNaming_BindingList':tc())),
+ ?match("IDL:omg.org/CosNaming/BindingList:1.0", 'CosNaming_BindingList':id()),
+ ?match("CosNaming_BindingList", 'CosNaming_BindingList':name()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: 'CosNaming_Name'
+%% Description:
+%%-----------------------------------------------------------------
+'CosNaming_Name'(doc) -> [""];
+'CosNaming_Name'(suite) -> [];
+'CosNaming_Name'(_) ->
+ ?match(true, orber_tc:check_tc('CosNaming_Name':tc())),
+ ?match("IDL:omg.org/CosNaming/Name:1.0", 'CosNaming_Name':id()),
+ ?match("CosNaming_Name", 'CosNaming_Name':name()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: 'CosNaming_NameComponent'
+%% Description:
+%%-----------------------------------------------------------------
+'CosNaming_NameComponent'(doc) -> [""];
+'CosNaming_NameComponent'(suite) -> [];
+'CosNaming_NameComponent'(_) ->
+ ?match(true, orber_tc:check_tc('CosNaming_NameComponent':tc())),
+ ?match("IDL:omg.org/CosNaming/NameComponent:1.0", 'CosNaming_NameComponent':id()),
+ ?match("CosNaming_NameComponent", 'CosNaming_NameComponent':name()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: 'CosNaming_NamingContextExt_InvalidAddress'
+%% Description:
+%%-----------------------------------------------------------------
+'CosNaming_NamingContextExt_InvalidAddress'(doc) -> [""];
+'CosNaming_NamingContextExt_InvalidAddress'(suite) -> [];
+'CosNaming_NamingContextExt_InvalidAddress'(_) ->
+ ?match(true, orber_tc:check_tc('CosNaming_NamingContextExt_InvalidAddress':tc())),
+ ?match("IDL:omg.org/CosNaming/NamingContextExt/InvalidAddress:1.0", 'CosNaming_NamingContextExt_InvalidAddress':id()),
+ ?match("CosNaming_NamingContextExt_InvalidAddress", 'CosNaming_NamingContextExt_InvalidAddress':name()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: 'CosNaming_NamingContext_AlreadyBound'
+%% Description:
+%%-----------------------------------------------------------------
+'CosNaming_NamingContext_AlreadyBound'(doc) -> [""];
+'CosNaming_NamingContext_AlreadyBound'(suite) -> [];
+'CosNaming_NamingContext_AlreadyBound'(_) ->
+ ?match(true, orber_tc:check_tc('CosNaming_NamingContext_AlreadyBound':tc())),
+ ?match("IDL:omg.org/CosNaming/NamingContext/AlreadyBound:1.0", 'CosNaming_NamingContext_AlreadyBound':id()),
+ ?match("CosNaming_NamingContext_AlreadyBound", 'CosNaming_NamingContext_AlreadyBound':name()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: 'CosNaming_NamingContext_CannotProceed'
+%% Description:
+%%-----------------------------------------------------------------
+'CosNaming_NamingContext_CannotProceed'(doc) -> [""];
+'CosNaming_NamingContext_CannotProceed'(suite) -> [];
+'CosNaming_NamingContext_CannotProceed'(_) ->
+ ?match(true, orber_tc:check_tc('CosNaming_NamingContext_CannotProceed':tc())),
+ ?match("IDL:omg.org/CosNaming/NamingContext/CannotProceed:1.0", 'CosNaming_NamingContext_CannotProceed':id()),
+ ?match("CosNaming_NamingContext_CannotProceed", 'CosNaming_NamingContext_CannotProceed':name()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: 'CosNaming_NamingContext_InvalidName'
+%% Description:
+%%-----------------------------------------------------------------
+'CosNaming_NamingContext_InvalidName'(doc) -> [""];
+'CosNaming_NamingContext_InvalidName'(suite) -> [];
+'CosNaming_NamingContext_InvalidName'(_) ->
+ ?match(true, orber_tc:check_tc('CosNaming_NamingContext_InvalidName':tc())),
+ ?match("IDL:omg.org/CosNaming/NamingContext/InvalidName:1.0", 'CosNaming_NamingContext_InvalidName':id()),
+ ?match("CosNaming_NamingContext_InvalidName", 'CosNaming_NamingContext_InvalidName':name()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: 'CosNaming_NamingContext_NotEmpty'
+%% Description:
+%%-----------------------------------------------------------------
+'CosNaming_NamingContext_NotEmpty'(doc) -> [""];
+'CosNaming_NamingContext_NotEmpty'(suite) -> [];
+'CosNaming_NamingContext_NotEmpty'(_) ->
+ ?match(true, orber_tc:check_tc('CosNaming_NamingContext_NotEmpty':tc())),
+ ?match("IDL:omg.org/CosNaming/NamingContext/NotEmpty:1.0", 'CosNaming_NamingContext_NotEmpty':id()),
+ ?match("CosNaming_NamingContext_NotEmpty", 'CosNaming_NamingContext_NotEmpty':name()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: 'CosNaming_NamingContext_NotFound'
+%% Description:
+%%-----------------------------------------------------------------
+'CosNaming_NamingContext_NotFound'(doc) -> [""];
+'CosNaming_NamingContext_NotFound'(suite) -> [];
+'CosNaming_NamingContext_NotFound'(_) ->
+ ?match(true, orber_tc:check_tc('CosNaming_NamingContext_NotFound':tc())),
+ ?match("IDL:omg.org/CosNaming/NamingContext/NotFound:1.0", 'CosNaming_NamingContext_NotFound':id()),
+ ?match("CosNaming_NamingContext_NotFound", 'CosNaming_NamingContext_NotFound':name()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: 'CosNaming_BindingIterator'
+%% Description:
+%%-----------------------------------------------------------------
+'CosNaming_BindingIterator'(doc) -> [""];
+'CosNaming_BindingIterator'(suite) -> [];
+'CosNaming_BindingIterator'(_) ->
+ ?nomatch(undefined, 'CosNaming_BindingIterator':oe_tc(next_one)),
+ ?nomatch(undefined, 'CosNaming_BindingIterator':oe_tc(next_n)),
+ ?nomatch(undefined, 'CosNaming_BindingIterator':oe_tc(destroy)),
+ ?match(undefined, 'CosNaming_BindingIterator':oe_tc(undefined)),
+ ?match([_|_], 'CosNaming_BindingIterator':oe_get_interface()),
+ ?match("IDL:omg.org/CosNaming/BindingIterator:1.0",
+ 'CosNaming_BindingIterator':typeID()),
+ check_tc('CosNaming_BindingIterator':oe_get_interface()),
+ ?match(true, 'CosNaming_BindingIterator':oe_is_a('CosNaming_BindingIterator':typeID())),
+ ?match(false, 'CosNaming_BindingIterator':oe_is_a("wrong")),
+ ok.
+
+
+%%-----------------------------------------------------------------
+%% Test Case: 'CosNaming_NamingContext'
+%% Description:
+%%-----------------------------------------------------------------
+'CosNaming_NamingContext'(doc) -> [""];
+'CosNaming_NamingContext'(suite) -> [];
+'CosNaming_NamingContext'(_) ->
+ ?nomatch(undefined, 'CosNaming_NamingContext':oe_tc(bind)),
+ ?nomatch(undefined, 'CosNaming_NamingContext':oe_tc(rebind)),
+ ?nomatch(undefined, 'CosNaming_NamingContext':oe_tc(bind_context)),
+ ?nomatch(undefined, 'CosNaming_NamingContext':oe_tc(rebind_context)),
+ ?nomatch(undefined, 'CosNaming_NamingContext':oe_tc(resolve)),
+ ?nomatch(undefined, 'CosNaming_NamingContext':oe_tc(unbind)),
+ ?nomatch(undefined, 'CosNaming_NamingContext':oe_tc(new_context)),
+ ?nomatch(undefined, 'CosNaming_NamingContext':oe_tc(bind_new_context)),
+ ?nomatch(undefined, 'CosNaming_NamingContext':oe_tc(destroy)),
+ ?nomatch(undefined, 'CosNaming_NamingContext':oe_tc(list)),
+ ?match(undefined, 'CosNaming_NamingContext':oe_tc(undefined)),
+ ?match([_|_], 'CosNaming_NamingContext':oe_get_interface()),
+ ?match("IDL:omg.org/CosNaming/NamingContext:1.0",
+ 'CosNaming_NamingContext':typeID()),
+ check_tc('CosNaming_NamingContext':oe_get_interface()),
+ ?match(true, 'CosNaming_NamingContext':oe_is_a('CosNaming_NamingContext':typeID())),
+ ?match(false, 'CosNaming_NamingContext':oe_is_a("wrong")),
+ ok.
+
+
+%%-----------------------------------------------------------------
+%% Test Case: 'CosNaming_NamingContexExt'
+%% Description:
+%%-----------------------------------------------------------------
+'CosNaming_NamingContextExt'(doc) -> [""];
+'CosNaming_NamingContextExt'(suite) -> [];
+'CosNaming_NamingContextExt'(_) ->
+ ?nomatch(undefined, 'CosNaming_NamingContextExt':oe_tc(to_string)),
+ ?nomatch(undefined, 'CosNaming_NamingContextExt':oe_tc(to_name)),
+ ?nomatch(undefined, 'CosNaming_NamingContextExt':oe_tc(to_url)),
+ ?nomatch(undefined, 'CosNaming_NamingContextExt':oe_tc(resolve_str)),
+ ?nomatch(undefined, 'CosNaming_NamingContextExt':oe_tc(bind)),
+ ?nomatch(undefined, 'CosNaming_NamingContextExt':oe_tc(rebind)),
+ ?nomatch(undefined, 'CosNaming_NamingContextExt':oe_tc(bind_context)),
+ ?nomatch(undefined, 'CosNaming_NamingContextExt':oe_tc(rebind_context)),
+ ?nomatch(undefined, 'CosNaming_NamingContextExt':oe_tc(new_context)),
+ ?nomatch(undefined, 'CosNaming_NamingContextExt':oe_tc(bind_new_context)),
+ ?nomatch(undefined, 'CosNaming_NamingContextExt':oe_tc(destroy)),
+ ?nomatch(undefined, 'CosNaming_NamingContextExt':oe_tc(list)),
+ ?match(undefined, 'CosNaming_NamingContextExt':oe_tc(undefined)),
+ ?match([_|_], 'CosNaming_NamingContextExt':oe_get_interface()),
+ ?match("IDL:omg.org/CosNaming/NamingContextExt:1.0",
+ 'CosNaming_NamingContextExt':typeID()),
+ check_tc('CosNaming_NamingContextExt':oe_get_interface()),
+ ?match(true, 'CosNaming_NamingContextExt':oe_is_a('CosNaming_NamingContextExt':typeID())),
+ ?match(true, 'CosNaming_NamingContextExt':oe_is_a('CosNaming_NamingContext':typeID())),
+ ?match(false, 'CosNaming_NamingContextExt':oe_is_a("wrong")),
+ ok.
+
+
+%%-----------------------------------------------------------------
+%% MISC functions
+%%-----------------------------------------------------------------
+check_tc([]) ->
+ ok;
+check_tc([{Op, {RetType, InParameters, OutParameters}}|T]) ->
+ io:format("checked - ~s~n", [Op]),
+ lists:all(?checktc(Op), [RetType|InParameters]),
+ lists:all(?checktc(Op), OutParameters),
+ check_tc(T).
+
+
diff --git a/lib/orber/test/idl_output/.gitignore b/lib/orber/test/idl_output/.gitignore
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/lib/orber/test/idl_output/.gitignore
diff --git a/lib/orber/test/iiop_module_do_test_impl.erl b/lib/orber/test/iiop_module_do_test_impl.erl
new file mode 100644
index 0000000000..bf171a3097
--- /dev/null
+++ b/lib/orber/test/iiop_module_do_test_impl.erl
@@ -0,0 +1,112 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1998-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+
+-module(iiop_module_do_test_impl).
+
+
+-export([run_all/3, run_userexception/2, run_systemexception/2]).
+-export([createTestContext/0]).
+
+-export([start/0, stop/0]).
+-export([init/1, terminate/2]).
+
+
+init(_) ->
+ {ok, []}.
+
+terminate(Reason, _State) ->
+ io:format("~p terminating with reason ~p~n", [?MODULE, Reason]),
+ ok.
+
+createTestContext() ->
+ NS = corba:resolve_initial_references("NameService"),
+ NC = lname_component:set_id(lname_component:create(), "iiop_test"),
+ N = lname:insert_component(lname:create(), 1, NC),
+ 'CosNaming_NamingContext':bind_new_context(NS, N).
+
+start() ->
+ SFok = corba:create('iiop_module_do_test', "IDL:iiop_module/do_test:1.0"),
+ NS = corba:resolve_initial_references("NameService"),
+ NC1 = lname_component:set_id(lname_component:create(), "iiop_test"),
+ NC2 = lname_component:set_id(lname_component:create(), "erl_dotest"),
+ N = lname:insert_component(lname:create(), 1, NC1),
+ N1 = lname:insert_component(N, 2, NC2),
+ 'CosNaming_NamingContext':bind(NS, N1, SFok),
+ SFok.
+
+stop() ->
+ NS = corba:resolve_initial_references("NameService"),
+ NC1 = lname_component:set_id(lname_component:create(), "iiop_test"),
+ NC2 = lname_component:set_id(lname_component:create(), "erl_dotest"),
+ N = lname:insert_component(lname:create(), 1, NC1),
+ N1 = lname:insert_component(N, 2, NC2),
+ 'CosNaming_NamingContext':unbind(NS, N1).
+
+run_all(S, X, TL) ->
+ ok = iiop_module_test:send_void(X),
+ {tk_short, P1} = lists:nth(1, TL),
+ {R1, IO1, O1} = iiop_module_test:send_short(X, P1, P1),
+ RL1= [{tk_short, R1}],
+ IOL1= [{tk_short, IO1}],
+ OL1= [{tk_short, O1}],
+ {tk_ushort, P2} = lists:nth(2, TL),
+ {R2, IO2, O2} = iiop_module_test:send_ushort(X, P2, P2),
+ RL2= [{tk_ushort, R2}|RL1],
+ IOL2= [{tk_ushort, IO2}|IOL1],
+ OL2= [{tk_ushort, O2}|OL1],
+ {tk_long, P3} = lists:nth(3, TL),
+ {R3, IO3, O3} = iiop_module_test:send_long(X, P3, P3),
+ RL3= [{tk_long, R3}|RL2],
+ IOL3= [{tk_long, IO3}|IOL2],
+ OL3= [{tk_long, O3}|OL2],
+ {tk_ulong, P4} = lists:nth(4, TL),
+ {R4, IO4, O4} = iiop_module_test:send_ulong(X, P4, P4),
+ RL4= [{tk_ulong, R4}|RL3],
+ IOL4= [{tk_ulong, IO4}|IOL3],
+ OL4= [{tk_ulong, O4}|OL3],
+ {tk_float, P5} = lists:nth(5, TL),
+ {R5, IO5, O5} = iiop_module_test:send_float(X, P5, P5),
+ RL5= [{tk_float, R5}|RL4],
+ IOL5= [{tk_float, IO5}|IOL4],
+ OL5= [{tk_float, O5}|OL4],
+ {tk_double, P6} = lists:nth(6, TL),
+ {R6, IO6, O6} = iiop_module_test:send_double(X, P6, P6),
+ RL6= [{tk_double, R6}|RL5],
+ IOL6= [{tk_double, IO6}|IOL5],
+ OL6= [{tk_double, O6}|OL5],
+ {tk_boolean, P7} = lists:nth(7, TL),
+ {R7, IO7, O7} = iiop_module_test:send_boolean(X, P7, P7),
+ RL7= [{tk_boolean, R7}|RL6],
+ IOL7= [{tk_boolean, IO7}|IOL6],
+ OL7= [{tk_boolean, O7}|OL6],
+ {tk_char, P8} = lists:nth(8, TL),
+ {R8, IO8, O8} = iiop_module_test:send_char(X, P8, P8),
+ RL= [{tk_char, R8} |RL7],
+ IOL= [{tk_char, IO8} |IOL7],
+ OL= [{tk_char, O8} |OL7],
+ {{lists:reverse(RL),lists:reverse(IOL),lists:reverse(OL)}, S}.
+
+run_systemexception(S, X) ->
+ iiop_module_test:ret_systemexception(X),
+ {ok, S}.
+
+run_userexception(S, X) ->
+ iiop_module_test:ret_userexception(X),
+ {ok, S}.
diff --git a/lib/orber/test/iiop_module_test_impl.erl b/lib/orber/test/iiop_module_test_impl.erl
new file mode 100644
index 0000000000..fe334e1b26
--- /dev/null
+++ b/lib/orber/test/iiop_module_test_impl.erl
@@ -0,0 +1,128 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1998-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+
+-module(iiop_module_test_impl).
+-include_lib("orber/include/corba.hrl").
+-include("idl_output/iiop_module.hrl").
+
+
+-export([send_void/1, send_short/3, send_ushort/3]).
+-export([send_long/3, send_ulong/3, send_float/3]).
+-export([send_double/3, send_boolean/3, send_char/3]).
+-export([send_octet/3, send_any/3, send_object/3]).
+-export([send_struct1/3, send_union1/3, send_enum1/3]).
+-export([send_string/3, send_sequence1/3, send_array1/3]).
+-export([ret_systemexception/1, ret_userexception/1]).
+
+
+
+-export([start/0, stop/0]).
+-export([init/1, terminate/2]).
+
+
+init(_) ->
+ {ok, []}.
+
+terminate(Reason, _State) ->
+ io:format("~p terminating with reason ~p~n", [?MODULE, Reason]),
+ ok.
+
+
+start() ->
+ SFok = corba:create('iiop_module_test', "IDL:iiop_module/test:1.0"),
+ NS = corba:resolve_initial_references("NameService"),
+ NC1 = lname_component:set_id(lname_component:create(), "iiop_test"),
+ NC2 = lname_component:set_id(lname_component:create(), "erl_test"),
+ N = lname:insert_component(lname:create(), 1, NC1),
+ N1 = lname:insert_component(N, 2, NC2),
+ 'CosNaming_NamingContext':bind(NS, N1, SFok),
+ SFok.
+
+stop() ->
+ NS = corba:resolve_initial_references("NameService"),
+ NC1 = lname_component:set_id(lname_component:create(), "iiop_test"),
+ NC2 = lname_component:set_id(lname_component:create(), "erl_test"),
+ N = lname:insert_component(lname:create(), 1, NC1),
+ N1 = lname:insert_component(N, 2, NC2),
+ 'CosNaming_NamingContext':unbind(NS, N1).
+
+
+
+send_void(S) ->
+ {ok, S}.
+
+send_short(S, P1, P2) ->
+ {{P1, P1, P2}, S}.
+
+send_ushort(S, P1, P2) ->
+ {{P1, P1, P2}, S}.
+
+send_long(S, P1, P2) ->
+ {{P1, P1, P2}, S}.
+
+send_ulong(S, P1, P2) ->
+ {{P1, P1, P2}, S}.
+
+send_float(S, P1, P2) ->
+ {{P1, P1, P2}, S}.
+
+send_double(S, P1, P2) ->
+ {{P1, P1, P2}, S}.
+
+send_boolean(S, P1, P2) ->
+ {{P1, P1, P2}, S}.
+
+send_char(S, P1, P2) ->
+ {{P1, P1, P2}, S}.
+
+send_octet(S, P1, P2) ->
+ {{P1, P1, P2}, S}.
+
+send_any(S, P1, P2) ->
+ {{P1, P1, P2}, S}.
+
+send_object(S, P1, P2) ->
+ {{P1, P1, P2}, S}.
+
+send_struct1(S, P1, P2) ->
+ {{P1, P1, P2}, S}.
+
+send_union1(S, P1, P2) ->
+ {{P1, P1, P2}, S}.
+
+send_enum1(S, P1, P2) ->
+ {{P1, P1, P2}, S}.
+
+send_string(S, P1, P2) ->
+ {{P1, P1, P2}, S}.
+
+send_sequence1(S, P1, P2) ->
+ {{P1, P1, P2}, S}.
+
+send_array1(S, P1, P2) ->
+ {{P1, P1, P2}, S}.
+
+ret_systemexception(S) ->
+ throw(#'BAD_PARAM'{}),
+ {ok, S}.
+
+ret_userexception(S) ->
+ throw(#iiop_module_Except1{why="not readable",rest_of_name=["foo", "bar"]}),
+ {ok, S}.
diff --git a/lib/orber/test/iiop_test.idl b/lib/orber/test/iiop_test.idl
new file mode 100644
index 0000000000..339678106e
--- /dev/null
+++ b/lib/orber/test/iiop_test.idl
@@ -0,0 +1,111 @@
+//
+// %CopyrightBegin%
+//
+// Copyright Ericsson AB 1997-2010. All Rights Reserved.
+//
+// The contents of this file are subject to the Erlang Public License,
+// Version 1.1, (the "License"); you may not use this file except in
+// compliance with the License. You should have received a copy of the
+// Erlang Public License along with this software. If not, it can be
+// retrieved online at http://www.erlang.org/.
+//
+// Software distributed under the License is distributed on an "AS IS"
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+// the License for the specific language governing rights and limitations
+// under the License.
+//
+// %CopyrightEnd%
+//
+#include "cos_naming.idl"
+
+module iiop_module
+{
+
+ typedef long Array1[10];
+
+ enum Enum1 {horse, pig, cow};
+
+ typedef sequence<long> Sequence1;
+
+ typedef Sequence1 Sequence2;
+
+ struct Struct1 {
+ string s;
+ unsigned short us;
+ unsigned long ul;
+ };
+
+ union Union1 switch (short) {
+ case 0: short First;
+ case 1: string Second;
+ case 2: char Third;
+ };
+
+ exception Except1 {
+ string why;
+ sequence <string> rest_of_name;
+ };
+
+ typedef sequence<any> test_values;
+ struct test_retval {
+ test_values R;
+ test_values InOut;
+ test_values Out;
+ };
+
+ interface test;
+
+ interface do_test {
+ void run_systemexception(in test x)
+ raises(CosNaming::NamingContext::NotFound,
+ CosNaming::NamingContext::CannotProceed,
+ CosNaming::NamingContext::InvalidName);
+ void run_userexception(in test x)
+ raises(iiop_module::Except1,
+ CosNaming::NamingContext::NotFound,
+ CosNaming::NamingContext::CannotProceed,
+ CosNaming::NamingContext::InvalidName);
+ test_retval run_all(in test x, in test_values tlist)
+ raises(iiop_module::Except1,
+ CosNaming::NamingContext::NotFound,
+ CosNaming::NamingContext::CannotProceed,
+ CosNaming::NamingContext::InvalidName);
+ };
+
+ interface test {
+ // Function to run all tests from java to erlang
+ // and return the answers
+ // Primitive types
+ void send_void();
+ short send_short(in short p1, inout short p2, out short p3);
+ unsigned short send_ushort(in unsigned short p1, inout unsigned short p2,
+ out unsigned short p3);
+ long send_long(in long p1, inout long p2, out long p3);
+ unsigned long send_ulong(in unsigned long p1, inout unsigned long p2,
+ out unsigned long p3);
+ float send_float(in float p1, inout float p2, out float p3);
+ double send_double(in double p1, inout double p2, out double p3);
+ boolean send_boolean(in boolean p1, inout boolean p2, out boolean p3);
+ char send_char(in char p1, inout char p2, out char p3);
+ octet send_octet(in octet p1, inout octet p2, out octet p3);
+ any send_any(in any p1, inout any p2, out any p3);
+ Object send_object(in Object p1, inout Object p2, out Object p3);
+ // TypeCode send_typecode(in TypeCode p1, inout TypeCode p2, out TypeCode p3);
+ // Principal send_principal(in Principal p); //tested in every request
+
+ // Complex types
+ Struct1 send_struct1(in Struct1 p1, inout Struct1 p2, out Struct1 p3);
+ Union1 send_union1(in Union1 p1, inout Union1 p2, out Union1 p3);
+ Enum1 send_enum1(in Enum1 p1, inout Enum1 p2, out Enum1 p3);
+ string send_string(in string p1, inout string p2, out string p3);
+ Sequence1 send_sequence1(in Sequence1 p1, inout Sequence1 p2,
+ out Sequence1 p3);
+ Array1 send_array1(in Array1 p1, inout Array1 p2, out Array1 p3);
+
+ void ret_systemexception();
+ void ret_userexception() raises(iiop_module::Except1);
+
+
+ };
+
+};
diff --git a/lib/orber/test/iiop_test_impl.erl b/lib/orber/test/iiop_test_impl.erl
new file mode 100644
index 0000000000..fd92109c09
--- /dev/null
+++ b/lib/orber/test/iiop_test_impl.erl
@@ -0,0 +1,34 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1998-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+-module(iiop_test_impl).
+-include_lib("orber/include/corba.hrl").
+-include_lib("orber/test/iiop_test.hrl").
+-export([]).
+
+
+init(Env) ->
+ {ok, []}.
+
+terminate(From, Reason) ->
+ ok.
+
+send_void(State) ->
+ {ok, State}.
+
diff --git a/lib/orber/test/interceptors_SUITE.erl b/lib/orber/test/interceptors_SUITE.erl
new file mode 100644
index 0000000000..27e23a9433
--- /dev/null
+++ b/lib/orber/test/interceptors_SUITE.erl
@@ -0,0 +1,338 @@
+%%-----------------------------------------------------------------
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2004-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%-----------------------------------------------------------------
+%% File : interceptors_SUITE.erl
+%% Purpose :
+%%-----------------------------------------------------------------
+
+-module(interceptors_SUITE).
+
+-include("test_server.hrl").
+-include_lib("orber/include/corba.hrl").
+-include_lib("orber/src/orber_iiop.hrl").
+
+-define(default_timeout, ?t:minutes(3)).
+
+-define(match(ExpectedRes, Expr),
+ fun() ->
+ AcTuAlReS = (catch (Expr)),
+ case AcTuAlReS of
+ ExpectedRes ->
+ io:format("------ CORRECT RESULT ------~n~p~n",
+ [AcTuAlReS]),
+ AcTuAlReS;
+ _ ->
+ io:format("###### ERROR ERROR ######~n~p~n",
+ [AcTuAlReS]),
+ ?line exit(AcTuAlReS)
+ end
+ end()).
+
+-define(nomatch(Not, Expr),
+ fun() ->
+ AcTuAlReS = (catch (Expr)),
+ case AcTuAlReS of
+ Not ->
+ io:format("###### ERROR ERROR ######~n~p~n",
+ [AcTuAlReS]),
+ ?line exit(AcTuAlReS);
+ _ ->
+ io:format("------ CORRECT RESULT ------~n~p~n",
+ [AcTuAlReS]),
+ AcTuAlReS
+ end
+ end()).
+
+
+%%-----------------------------------------------------------------
+%% External exports
+%%-----------------------------------------------------------------
+-export([all/1]).
+
+%%-----------------------------------------------------------------
+%% Internal exports
+%%-----------------------------------------------------------------
+-export([in_reply/6, out_request/6]).
+-compile(export_all).
+
+%%-----------------------------------------------------------------
+%% Func: all/1
+%% Args:
+%% Returns:
+%%-----------------------------------------------------------------
+all(doc) -> ["This suite is for testing Orber Interceptors"];
+all(suite) ->
+ [local_pseudo, local_default, local_local, local_global].
+
+%%-----------------------------------------------------------------
+%% Init and cleanup functions.
+%%-----------------------------------------------------------------
+init_per_testcase(_Case, Config) ->
+ ?line Dog=test_server:timetrap(?default_timeout),
+ Path = code:which(?MODULE),
+ code:add_pathz(filename:join(filename:dirname(Path), "idl_output")),
+ corba:orb_init([{flags, (?ORB_ENV_USE_PI bor ?ORB_ENV_LOCAL_TYPECHECKING)},
+ {local_interceptors, {native, [?MODULE]}}]),
+ orber:jump_start(2945),
+ oe_orber_test_server:oe_register(),
+ [{watchdog, Dog}|Config].
+
+
+fin_per_testcase(_Case, Config) ->
+ oe_orber_test_server:oe_unregister(),
+ orber:jump_stop(),
+ Path = code:which(?MODULE),
+ code:del_path(filename:join(filename:dirname(Path), "idl_output")),
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: local_pseudo
+%% Description:
+%%-----------------------------------------------------------------
+local_pseudo(doc) -> [""];
+local_pseudo(suite) -> [];
+local_pseudo(_) ->
+ ?match({native, [?MODULE]}, orber:get_local_interceptors()),
+ %% Global settings
+ Obj1 = orber_test_server:oe_create(state,[{pseudo,true}]),
+ Result11 = orber_test_server:testing_iiop_ushort(Obj1, ?USHORTMAX),
+ ?match([?USHORTMAX], put(out_request, undefined)),
+ ?match(Result11, put(in_reply, undefined)),
+
+ Result12 = ?match({'EXCEPTION',_},
+ orber_test_server:testing_iiop_ushort(Obj1, ?USHORTMAX+1)),
+ ?match([(?USHORTMAX+1)], put(out_request, undefined)),
+ ?nomatch(Result12, put(in_reply, undefined)),
+
+ Result13 = orber_test_server:testing_iiop_oneway_delay(Obj1, 0),
+ ?match([0], put(out_request, undefined)),
+ ?nomatch(Result13, put(in_reply, undefined)),
+
+ Result14 = ?match({'EXCEPTION', _},
+ orber_test_server:raise_local_exception(Obj1)),
+ ?match([], put(out_request, undefined)),
+ ?match(Result14, put(in_reply, undefined)),
+
+ Result15 = ?match({'EXCEPTION',_}, orber_test_server:stop_brutal(Obj1)),
+ ?match([], put(out_request, undefined)),
+ ?match(Result15, put(in_reply, undefined)),
+
+ %% Per-object
+ Obj2 = orber_test_server:oe_create(state,[{pseudo,true},
+ {local_interceptors, false}]),
+
+ Result21 = orber_test_server:testing_iiop_ushort(Obj2, ?USHORTMAX),
+ ?nomatch([?USHORTMAX], put(out_request, undefined)),
+ ?nomatch(Result21, put(in_reply, undefined)),
+
+ Obj3 = orber_test_server:oe_create(state,[{pseudo,true},
+ {local_interceptors, true}]),
+
+ Result31 = orber_test_server:testing_iiop_ushort(Obj3, ?USHORTMAX),
+ ?match([?USHORTMAX], put(out_request, undefined)),
+ ?match(Result31, put(in_reply, undefined)),
+
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: local_default
+%% Description:
+%%-----------------------------------------------------------------
+local_default(doc) -> [""];
+local_default(suite) -> [];
+local_default(_) ->
+ ?match({native, [?MODULE]}, orber:get_local_interceptors()),
+ %% Global settings
+ Obj1 = orber_test_server:oe_create(state, []),
+ Result11 = orber_test_server:testing_iiop_ushort(Obj1, ?USHORTMAX),
+ ?match([?USHORTMAX], put(out_request, undefined)),
+ ?match(Result11, put(in_reply, undefined)),
+
+ Result12 = ?match({'EXCEPTION',_},
+ orber_test_server:testing_iiop_ushort(Obj1, ?USHORTMAX+1)),
+ ?match([(?USHORTMAX+1)], put(out_request, undefined)),
+ ?nomatch(Result12, put(in_reply, undefined)),
+
+ Result13 = orber_test_server:testing_iiop_oneway_delay(Obj1, 0),
+ ?match([0], put(out_request, undefined)),
+ ?nomatch(Result13, put(in_reply, undefined)),
+
+ Result14 = ?match({'EXCEPTION', _},
+ orber_test_server:raise_local_exception(Obj1)),
+ ?match([], put(out_request, undefined)),
+ ?match(Result14, put(in_reply, undefined)),
+
+ Result15 = ?match({'EXCEPTION',_}, orber_test_server:stop_brutal(Obj1)),
+ ?match([], put(out_request, undefined)),
+ ?match(Result15, put(in_reply, undefined)),
+
+
+ %% Per-object
+ Obj2 = orber_test_server:oe_create(state,[{local_interceptors, false}]),
+
+ Result21 = orber_test_server:testing_iiop_ushort(Obj2, ?USHORTMAX),
+ ?nomatch([?USHORTMAX], put(out_request, undefined)),
+ ?nomatch(Result21, put(in_reply, undefined)),
+ corba:dispose(Obj2),
+
+ Obj3 = orber_test_server:oe_create(state,[{local_interceptors, true}]),
+
+ Result31 = orber_test_server:testing_iiop_ushort(Obj3, ?USHORTMAX),
+ ?match([?USHORTMAX], put(out_request, undefined)),
+ ?match(Result31, put(in_reply, undefined)),
+ corba:dispose(Obj3),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: local_local
+%% Description:
+%%-----------------------------------------------------------------
+local_local(doc) -> [""];
+local_local(suite) -> [];
+local_local(_) ->
+ ?match({native, [?MODULE]}, orber:get_local_interceptors()),
+ %% Global settings
+ Obj1 = orber_test_server:oe_create(state, [{regname, {local, regname}}]),
+ Result11 = orber_test_server:testing_iiop_ushort(Obj1, ?USHORTMAX),
+ ?match([?USHORTMAX], put(out_request, undefined)),
+ ?match(Result11, put(in_reply, undefined)),
+
+ Result12 = ?match({'EXCEPTION',_},
+ orber_test_server:testing_iiop_ushort(Obj1, ?USHORTMAX+1)),
+ ?match([(?USHORTMAX+1)], put(out_request, undefined)),
+ ?nomatch(Result12, put(in_reply, undefined)),
+
+ Result13 = orber_test_server:testing_iiop_oneway_delay(Obj1, 0),
+ ?match([0], put(out_request, undefined)),
+ ?nomatch(Result13, put(in_reply, undefined)),
+
+ Result14 = ?match({'EXCEPTION', _},
+ orber_test_server:raise_local_exception(Obj1)),
+ ?match([], put(out_request, undefined)),
+ ?match(Result14, put(in_reply, undefined)),
+
+ Result15 = ?match({'EXCEPTION',_}, orber_test_server:stop_brutal(Obj1)),
+ ?match([], put(out_request, undefined)),
+ ?match(Result15, put(in_reply, undefined)),
+
+ %% Per-object
+ Obj2 = orber_test_server:oe_create(state,[{regname, {local, regname}},
+ {local_interceptors, false}]),
+
+ Result21 = orber_test_server:testing_iiop_ushort(Obj2, ?USHORTMAX),
+ ?nomatch([?USHORTMAX], put(out_request, undefined)),
+ ?nomatch(Result21, put(in_reply, undefined)),
+ corba:dispose(Obj2),
+
+ Obj3 = orber_test_server:oe_create(state,[{regname, {local, regname}},
+ {local_interceptors, true}]),
+
+ Result31 = orber_test_server:testing_iiop_ushort(Obj3, ?USHORTMAX),
+ ?match([?USHORTMAX], put(out_request, undefined)),
+ ?match(Result31, put(in_reply, undefined)),
+ corba:dispose(Obj3),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: local_global
+%% Description:
+%%-----------------------------------------------------------------
+local_global(doc) -> [""];
+local_global(suite) -> [];
+local_global(_) ->
+ ?match({native, [?MODULE]}, orber:get_local_interceptors()),
+ %% Global settings
+ Obj1 = orber_test_server:oe_create(state, [{regname, {global, regname}}]),
+ Result11 = orber_test_server:testing_iiop_ushort(Obj1, ?USHORTMAX),
+ ?match([?USHORTMAX], put(out_request, undefined)),
+ ?match(Result11, put(in_reply, undefined)),
+
+ Result12 = ?match({'EXCEPTION',_},
+ orber_test_server:testing_iiop_ushort(Obj1, ?USHORTMAX+1)),
+ ?match([(?USHORTMAX+1)], put(out_request, undefined)),
+ ?nomatch(Result12, put(in_reply, undefined)),
+
+ Result13 = orber_test_server:testing_iiop_oneway_delay(Obj1, 0),
+ ?match([0], put(out_request, undefined)),
+ ?nomatch(Result13, put(in_reply, undefined)),
+
+ Result14 = ?match({'EXCEPTION', _},
+ orber_test_server:raise_local_exception(Obj1)),
+ ?match([], put(out_request, undefined)),
+ ?match(Result14, put(in_reply, undefined)),
+
+ Result15 = ?match({'EXCEPTION',_}, orber_test_server:stop_brutal(Obj1)),
+ ?match([], put(out_request, undefined)),
+ ?match(Result15, put(in_reply, undefined)),
+
+ %% Per-object
+ Obj2 = orber_test_server:oe_create(state,[{regname, {global, regname}},
+ {local_interceptors, false}]),
+
+ Result21 = orber_test_server:testing_iiop_ushort(Obj2, ?USHORTMAX),
+ ?nomatch([?USHORTMAX], put(out_request, undefined)),
+ ?nomatch(Result21, put(in_reply, undefined)),
+ corba:dispose(Obj2),
+
+ Obj3 = orber_test_server:oe_create(state,[{regname, {global, regname}},
+ {local_interceptors, true}]),
+
+ Result31 = orber_test_server:testing_iiop_ushort(Obj3, ?USHORTMAX),
+ ?match([?USHORTMAX], put(out_request, undefined)),
+ ?match(Result31, put(in_reply, undefined)),
+ corba:dispose(Obj3),
+ ok.
+
+
+
+
+%%-----------------------------------------------------------------
+%% Local functions
+%%-----------------------------------------------------------------
+%%-----------------------------------------------------------------
+%% function : in_reply
+%%-----------------------------------------------------------------
+in_reply(Ref, _ObjKey, Ctx, Op, Reply, _Args) ->
+ error_logger:info_msg("=============== in_reply =================
+Connection: ~p
+Operation : ~p
+Reply : ~p
+Context : ~p
+==========================================~n",
+ [Ref, Op, Reply, Ctx]),
+ put(in_reply, Reply),
+ {Reply, "NewArgs"}.
+
+%%-----------------------------------------------------------------
+%% function : out_request
+%%-----------------------------------------------------------------
+out_request(Ref, _ObjKey, Ctx, Op, Params, _Args) ->
+ error_logger:info_msg("=============== out_request ==============
+Connection: ~p
+Operation : ~p
+Parameters: ~p
+Context : ~p
+==========================================~n",
+ [Ref, Op, Params, Ctx]),
+ put(out_request, Params),
+ {Params, "NewArgs"}.
diff --git a/lib/orber/test/iop_ior_10_SUITE.erl b/lib/orber/test/iop_ior_10_SUITE.erl
new file mode 100644
index 0000000000..1000c7f113
--- /dev/null
+++ b/lib/orber/test/iop_ior_10_SUITE.erl
@@ -0,0 +1,167 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1999-2010. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%-----------------------------------------------------------------
+%%
+%% Description:
+%% Test suite for the IOR functions
+%%
+%%-----------------------------------------------------------------
+-module(iop_ior_10_SUITE).
+
+-include("test_server.hrl").
+-include_lib("orber/src/orber_iiop.hrl").
+
+-define(default_timeout, ?t:minutes(3)).
+
+%%-----------------------------------------------------------------
+%% External exports
+%%-----------------------------------------------------------------
+-export([all/1]).
+
+%%-----------------------------------------------------------------
+%% Internal exports
+%%-----------------------------------------------------------------
+-export([]).
+-compile(export_all).
+
+%%-----------------------------------------------------------------
+%% Func: all/1
+%% Args:
+%% Returns:
+%%-----------------------------------------------------------------
+all(doc) -> ["Description", "more description"];
+all(suite) ->
+ [encoding, create_and_get_ops].
+
+%%-----------------------------------------------------------------
+%% Init and cleanup functions.
+%%-----------------------------------------------------------------
+
+init_per_testcase(_Case, Config) ->
+ ?line Dog=test_server:timetrap(?default_timeout),
+ [{watchdog, Dog}|Config].
+
+
+fin_per_testcase(_Case, Config) ->
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: IOR encoding test
+%% Description: Just testing the string_encoding function because the
+%% other encodings is called from them.
+%%-----------------------------------------------------------------
+encoding(doc) -> ["Description", "more description"];
+encoding(suite) -> [];
+encoding(_) ->
+ V = #'IIOP_Version'{major=1,minor=0},
+ M0 = 'Module_Interface',
+ T0 = "IDL:Module/Interface:1.0",
+ H0 = "my.hostname.org",
+ P0 = 4040,
+ N0 = 'name',
+ ?line O0 = corba_fake_mk_objkey(M0, registered, N0),
+ PB0 = #'IIOP_ProfileBody_1_0'{iiop_version=V, host=H0, port=P0, object_key=O0},
+ TP0 = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB0},
+ S0 = #'IOP_IOR'{type_id=T0, profiles=[TP0]},
+ N1 = list_to_pid("<0.100.0>"),
+ ?line O1 = corba_fake_mk_objkey(M0, key, N1),
+ PB1 = #'IIOP_ProfileBody_1_0'{iiop_version=V, host=H0, port=P0, object_key=O1},
+ TP1 = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB1},
+ S1 = #'IOP_IOR'{type_id=T0, profiles=[TP1]},
+ O2 = "This is an external objectkey",
+ PB2 = #'IIOP_ProfileBody_1_0'{iiop_version=V, host=H0, port=P0, object_key=O2},
+ TP2 = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB2},
+ S2 = #'IOP_IOR'{type_id=T0, profiles=[TP2]},
+ ?line C0 = iop_ior:string_code(S0),
+ ?line {S0, <<>>, _} = iop_ior:string_decode(C0),
+ ?line C1 = iop_ior:string_code(S1),
+ ?line {S1, <<>>, _} = iop_ior:string_decode(C1),
+ ?line C2 = iop_ior:string_code(S2),
+ ?line {S2, <<>>, _} = iop_ior:string_decode(C2),
+ ok.
+
+
+%%-----------------------------------------------------------------
+%% Test Case: IOR creation test
+%% Description:
+%%-----------------------------------------------------------------
+create_and_get_ops(doc) -> ["Description", "more description"];
+create_and_get_ops(suite) -> [];
+create_and_get_ops(_) ->
+ V = #'IIOP_Version'{major=1,minor=0},
+ M0 = 'Module_Interface',
+ T0 = "IDL:Module/Interface:1.0",
+ H0 = "my.hostname.org",
+ P0 = 4040,
+ N0 = 'name',
+ ?line O0 = corba_fake_mk_objkey(M0, registered, N0),
+ PB0 = #'IIOP_ProfileBody_1_0'{iiop_version=V, host=H0, port=P0, object_key=O0},
+ TP0 = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB0},
+ S0 = #'IOP_IOR'{type_id=T0, profiles=[TP0]},
+ ?line S0 = iop_ior:create({1, 0}, T0, [H0], P0, -1, O0, [], 0, 0),
+ N1 = list_to_pid("<0.100.0>"),
+ ?line O1 = corba_fake_mk_objkey(M0, key, N1),
+ {_,_,K1,_,_,_} = O1,
+ PB1 = #'IIOP_ProfileBody_1_0'{iiop_version=V, host=H0, port=P0, object_key=O1},
+ TP1 = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB1},
+ S1 = #'IOP_IOR'{type_id=T0, profiles=[TP1]},
+ ?line S1 = iop_ior:create({1, 0}, T0, [H0], P0, -1, O1, [], 0, 0),
+ O2 = "This is an external objectkey",
+ PB2 = #'IIOP_ProfileBody_1_0'{iiop_version=V, host=H0, port=P0, object_key=O2},
+ TP2 = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB2},
+ S2 = #'IOP_IOR'{type_id=T0, profiles=[TP2]},
+ ?line {'internal_registered', N0, _, _, M0} = iop_ior:get_key(S0),
+ ?line {'internal', K1, _, _, M0} = iop_ior:get_key(S1),
+ ?line {'external', {H0, P0, O2, _,_,
+ #host_data{protocol = normal,
+ ssl_data = undefined,
+ version = {1,0},
+ csiv2_mech = undefined,
+ csiv2_statefull = false,
+ charset = 65537,
+ wcharset = 65801,
+ ft_heartbeat = false,
+ ft_primary = false,
+ ft_group = undefined,
+ csiv2_addresses = []}}}
+ = iop_ior:get_key(S2),
+ ?line T0 = iop_ior:get_typeID(S0),
+ ?line O0 = iop_ior:get_objkey(S0),
+ ?line O1 = iop_ior:get_objkey(S1),
+ ?line O2 = iop_ior:get_objkey(S2),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Internal functions
+%%-----------------------------------------------------------------
+corba_fake_mk_objkey(Id, 'key', Pid) when is_pid(Pid) ->
+ Key = make_objkey(),
+ {Id, 'key', Key, term_to_binary(undefined), 0, 0};
+corba_fake_mk_objkey(Id, 'key', RegName) when is_atom(RegName) ->
+ Key = term_to_binary(RegName),
+ {Id, 'key', Key, term_to_binary(undefined), 0, 0};
+corba_fake_mk_objkey(Id, 'registered', RegName) when is_atom(RegName) ->
+ {Id, 'registered', RegName, term_to_binary(undefined), 0, 0}.
+
+
+make_objkey() ->
+ term_to_binary({now(), node()}).
diff --git a/lib/orber/test/iop_ior_11_SUITE.erl b/lib/orber/test/iop_ior_11_SUITE.erl
new file mode 100644
index 0000000000..35d01789ee
--- /dev/null
+++ b/lib/orber/test/iop_ior_11_SUITE.erl
@@ -0,0 +1,186 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%-----------------------------------------------------------------
+%%
+%% Description:
+%% Test suite for the IOR functions
+%%
+%%-----------------------------------------------------------------
+-module(iop_ior_11_SUITE).
+
+-include("test_server.hrl").
+-include_lib("orber/src/orber_iiop.hrl").
+
+-define(default_timeout, ?t:minutes(3)).
+
+%%-----------------------------------------------------------------
+%% External exports
+%%-----------------------------------------------------------------
+-export([all/1]).
+
+%%-----------------------------------------------------------------
+%% Internal exports
+%%-----------------------------------------------------------------
+-export([]).
+-compile(export_all).
+
+%%-----------------------------------------------------------------
+%% Func: all/1
+%% Args:
+%% Returns:
+%%-----------------------------------------------------------------
+all(doc) -> ["Description", "more description"];
+all(suite) ->
+ [encoding, create_and_get_ops].
+
+%%-----------------------------------------------------------------
+%% Init and cleanup functions.
+%%-----------------------------------------------------------------
+
+init_per_testcase(_Case, Config) ->
+ ?line Dog=test_server:timetrap(?default_timeout),
+ [{watchdog, Dog}|Config].
+
+
+fin_per_testcase(_Case, Config) ->
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: IOR encoding test
+%% Description: Just testing the string_encoding function because the
+%% other encodings is called from them.
+%%-----------------------------------------------------------------
+encoding(doc) -> ["Description", "more description"];
+encoding(suite) -> [];
+encoding(_) ->
+ V = #'IIOP_Version'{major=1,minor=1},
+ M0 = 'Module_Interface',
+ T0 = "IDL:Module/Interface:1.0",
+ H0 = "my.hostname.org",
+ P0 = 4040,
+ N0 = 'name',
+ Components = case orber:iiop_ssl_port() of
+ -1 ->
+ [];
+ SSLPort ->
+ [#'IOP_TaggedComponent'{tag=?TAG_SSL_SEC_TRANS,
+ component_data=[0 |
+ cdrlib:enc_unsigned_short(2,
+ cdrlib:enc_unsigned_short(2,
+ cdrlib:enc_unsigned_short(SSLPort, [])))]}]
+ end,
+ ?line O0 = corba_fake_mk_objkey(M0, registered, N0),
+ PB0 = #'IIOP_ProfileBody_1_1'{iiop_version=V, host=H0, port=P0, object_key=O0,
+ components=Components},
+ TP0 = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB0},
+ S0 = #'IOP_IOR'{type_id=T0, profiles=[TP0]},
+ N1 = list_to_pid("<0.100.0>"),
+ ?line O1 = corba_fake_mk_objkey(M0, key, N1),
+ PB1 = #'IIOP_ProfileBody_1_1'{iiop_version=V, host=H0, port=P0, object_key=O1,
+ components=[]},
+ TP1 = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB1},
+ S1 = #'IOP_IOR'{type_id=T0, profiles=[TP1]},
+ O2 = "This is an external objectkey",
+ PB2 = #'IIOP_ProfileBody_1_1'{iiop_version=V, host=H0, port=P0, object_key=O2,
+ components=[]},
+ TP2 = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB2},
+ S2 = #'IOP_IOR'{type_id=T0, profiles=[TP2]},
+ ?line C0 = iop_ior:string_code(S0),
+ ?line {S0, <<>>, _} = iop_ior:string_decode(C0),
+ ?line C1 = iop_ior:string_code(S1),
+ ?line {S1, <<>>, _} = iop_ior:string_decode(C1),
+ ?line C2 = iop_ior:string_code(S2),
+ ?line {S2, <<>>, _} = iop_ior:string_decode(C2),
+ ok.
+
+
+%%-----------------------------------------------------------------
+%% Test Case: IOR creation test
+%% Description:
+%%-----------------------------------------------------------------
+create_and_get_ops(doc) -> ["Description", "more description"];
+create_and_get_ops(suite) -> [];
+create_and_get_ops(_) ->
+ V = #'IIOP_Version'{major=1,minor=1},
+ CSC = #'IOP_TaggedComponent'{tag=?TAG_CODE_SETS,
+ component_data=?DEFAULT_CODESETS},
+ M0 = 'Module_Interface',
+ T0 = "IDL:Module/Interface:1.0",
+ H0 = "my.hostname.org",
+ P0 = 4040,
+ N0 = 'name',
+ ?line O0 = corba_fake_mk_objkey(M0, registered, N0),
+ PB0 = #'IIOP_ProfileBody_1_1'
+ {iiop_version=V, host=H0, port=P0, object_key=O0,
+ components=[CSC]},
+ TP0 = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB0},
+ S0 = #'IOP_IOR'{type_id=T0, profiles=[TP0]},
+ ?line S0 = iop_ior:create({1, 1}, T0, [H0], P0, -1, O0, [CSC], 0, 0),
+ N1 = list_to_pid("<0.100.0>"),
+ ?line O1 = corba_fake_mk_objkey(M0, key, N1),
+ {_,_,K1,_,_,_} = O1,
+ PB1 = #'IIOP_ProfileBody_1_1'
+ {iiop_version=V, host=H0, port=P0, object_key=O1,
+ components=[CSC]},
+ TP1 = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB1},
+ S1 = #'IOP_IOR'{type_id=T0, profiles=[TP1]},
+ ?line S1 = iop_ior:create({1, 1}, T0, [H0], P0, -1, O1, [CSC], 0, 0),
+ O2 = "This is an external objectkey",
+ PB2 = #'IIOP_ProfileBody_1_1'{iiop_version=V, host=H0, port=P0, object_key=O2,
+ components=[]},
+ TP2 = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB2},
+ S2 = #'IOP_IOR'{type_id=T0, profiles=[TP2]},
+ ?line {'internal_registered', N0, _, _, M0} = iop_ior:get_key(S0),
+ ?line {'internal', K1, _, _, M0} = iop_ior:get_key(S1),
+ ?line {'external', {H0, P0, O2, _,_,
+ #host_data{protocol = normal,
+ ssl_data = undefined,
+ version = {1,1},
+ csiv2_mech = undefined,
+ csiv2_statefull = false,
+ charset = 65537,
+ wcharset = 65801,
+ ft_heartbeat = false,
+ ft_primary = false,
+ ft_group = undefined,
+ csiv2_addresses = []}}} =
+ iop_ior:get_key(S2),
+ ?line T0 = iop_ior:get_typeID(S0),
+ ?line O0 = iop_ior:get_objkey(S0),
+ ?line O1 = iop_ior:get_objkey(S1),
+ ?line O2 = iop_ior:get_objkey(S2),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Internal functions
+%%-----------------------------------------------------------------
+corba_fake_mk_objkey(Id, 'key', Pid) when is_pid(Pid) ->
+ Key = make_objkey(),
+ {Id, 'key', Key, term_to_binary(undefined), 0, 0};
+corba_fake_mk_objkey(Id, 'key', RegName) when is_atom(RegName) ->
+ Key = term_to_binary(RegName),
+ {Id, 'key', Key, term_to_binary(undefined), 0, 0};
+corba_fake_mk_objkey(Id, 'registered', RegName) when is_atom(RegName) ->
+ {Id, 'registered', RegName, term_to_binary(undefined), 0, 0}.
+
+make_objkey() ->
+ term_to_binary({now(), node()}).
diff --git a/lib/orber/test/iop_ior_12_SUITE.erl b/lib/orber/test/iop_ior_12_SUITE.erl
new file mode 100644
index 0000000000..42db130e54
--- /dev/null
+++ b/lib/orber/test/iop_ior_12_SUITE.erl
@@ -0,0 +1,187 @@
+%%----------------------------------------------------------------------
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2000-2010. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%-----------------------------------------------------------------
+%% File : iop_ior_12_SUITE.erl
+%% Description : Test suite for the IOR functions
+%%
+%%----------------------------------------------------------------------
+-module(iop_ior_12_SUITE).
+
+
+-include("test_server.hrl").
+-include_lib("orber/src/orber_iiop.hrl").
+
+-define(default_timeout, ?t:minutes(3)).
+
+%%-----------------------------------------------------------------
+%% External exports
+%%-----------------------------------------------------------------
+-export([all/1]).
+
+%%-----------------------------------------------------------------
+%% Internal exports
+%%-----------------------------------------------------------------
+-export([]).
+-compile(export_all).
+
+%%-----------------------------------------------------------------
+%% Func: all/1
+%% Args:
+%% Returns:
+%%-----------------------------------------------------------------
+all(doc) -> ["Description", "more description"];
+all(suite) ->
+ [encoding, create_and_get_ops].
+
+%%-----------------------------------------------------------------
+%% Init and cleanup functions.
+%%-----------------------------------------------------------------
+
+init_per_testcase(_Case, Config) ->
+ ?line Dog=test_server:timetrap(?default_timeout),
+ [{watchdog, Dog}|Config].
+
+
+fin_per_testcase(_Case, Config) ->
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: IOR encoding test
+%% Description: Just testing the string_encoding function because the
+%% other encodings is called from them.
+%%-----------------------------------------------------------------
+encoding(doc) -> ["Description", "more description"];
+encoding(suite) -> [];
+encoding(_) ->
+ V = #'IIOP_Version'{major=1,minor=2},
+ M0 = 'Module_Interface',
+ T0 = "IDL:Module/Interface:1.0",
+ H0 = "my.hostname.org",
+ P0 = 4040,
+ N0 = 'name',
+ Components = case orber:iiop_ssl_port() of
+ -1 ->
+ [];
+ SSLPort ->
+ [#'IOP_TaggedComponent'{tag=?TAG_SSL_SEC_TRANS,
+ component_data=[0 |
+ cdrlib:enc_unsigned_short(2,
+ cdrlib:enc_unsigned_short(2,
+ cdrlib:enc_unsigned_short(SSLPort, [])))]}]
+ end,
+ ?line O0 = corba_fake_mk_objkey(M0, registered, N0),
+ PB0 = #'IIOP_ProfileBody_1_1'{iiop_version=V, host=H0, port=P0, object_key=O0,
+ components=Components},
+ TP0 = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB0},
+ S0 = #'IOP_IOR'{type_id=T0, profiles=[TP0]},
+ N1 = list_to_pid("<0.100.0>"),
+ ?line O1 = corba_fake_mk_objkey(M0, key, N1),
+ PB1 = #'IIOP_ProfileBody_1_1'{iiop_version=V, host=H0, port=P0, object_key=O1,
+ components=[]},
+ TP1 = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB1},
+ S1 = #'IOP_IOR'{type_id=T0, profiles=[TP1]},
+ O2 = "This is an external objectkey",
+ PB2 = #'IIOP_ProfileBody_1_1'{iiop_version=V, host=H0, port=P0, object_key=O2,
+ components=[]},
+ TP2 = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB2},
+ S2 = #'IOP_IOR'{type_id=T0, profiles=[TP2]},
+ ?line C0 = iop_ior:string_code(S0),
+ ?line {S0, <<>>, _} = iop_ior:string_decode(C0),
+ ?line C1 = iop_ior:string_code(S1),
+ ?line {S1, <<>>, _} = iop_ior:string_decode(C1),
+ ?line C2 = iop_ior:string_code(S2),
+ ?line {S2, <<>>, _} = iop_ior:string_decode(C2),
+ ok.
+
+
+%%-----------------------------------------------------------------
+%% Test Case: IOR creation test
+%% Description:
+%%-----------------------------------------------------------------
+create_and_get_ops(doc) -> ["Description", "more description"];
+create_and_get_ops(suite) -> [];
+create_and_get_ops(_) ->
+ V = #'IIOP_Version'{major=1,minor=2},
+ CSC = #'IOP_TaggedComponent'{tag=?TAG_CODE_SETS,
+ component_data=?DEFAULT_CODESETS},
+ M0 = 'Module_Interface',
+ T0 = "IDL:Module/Interface:1.0",
+ H0 = "my.hostname.org",
+ P0 = 4040,
+ N0 = 'name',
+ ?line O0 = corba_fake_mk_objkey(M0, registered, N0),
+ PB0 = #'IIOP_ProfileBody_1_1'
+ {iiop_version=V, host=H0, port=P0, object_key=O0,
+ components=[CSC]},
+ TP0 = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB0},
+ S0 = #'IOP_IOR'{type_id=T0, profiles=[TP0]},
+ ?line S0 = iop_ior:create({1, 2}, T0, [H0], P0, -1, O0, [CSC], 0, 0),
+ N1 = list_to_pid("<0.100.0>"),
+ ?line O1 = corba_fake_mk_objkey(M0, key, N1),
+ {_,_,K1,_,_,_} = O1,
+ PB1 = #'IIOP_ProfileBody_1_1'
+ {iiop_version=V, host=H0, port=P0, object_key=O1,
+ components=[CSC]},
+ TP1 = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB1},
+ S1 = #'IOP_IOR'{type_id=T0, profiles=[TP1]},
+ ?line S1 = iop_ior:create({1, 2}, T0, [H0], P0, -1, O1, [CSC], 0, 0),
+ O2 = "This is an external objectkey",
+ PB2 = #'IIOP_ProfileBody_1_1'{iiop_version=V, host=H0, port=P0, object_key=O2,
+ components=[]},
+ TP2 = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB2},
+ S2 = #'IOP_IOR'{type_id=T0, profiles=[TP2]},
+ ?line {'internal_registered', N0, _, _, M0} = iop_ior:get_key(S0),
+ ?line {'internal', K1, _, _, M0} = iop_ior:get_key(S1),
+ ?line {'external', {H0, P0, O2,_,_,
+ #host_data{protocol = normal,
+ ssl_data = undefined,
+ version = {1,2},
+ csiv2_mech = undefined,
+ csiv2_statefull = false,
+ charset = 65537,
+ wcharset = 65801,
+ ft_heartbeat = false,
+ ft_primary = false,
+ ft_group = undefined,
+ csiv2_addresses = []}}}
+ = iop_ior:get_key(S2),
+ ?line T0 = iop_ior:get_typeID(S0),
+ ?line O0 = iop_ior:get_objkey(S0),
+ ?line O1 = iop_ior:get_objkey(S1),
+ ?line O2 = iop_ior:get_objkey(S2),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Internal functions
+%%-----------------------------------------------------------------
+corba_fake_mk_objkey(Id, 'key', Pid) when is_pid(Pid) ->
+ Key = make_objkey(),
+ {Id, 'key', Key, term_to_binary(undefined), 0, 0};
+corba_fake_mk_objkey(Id, 'key', RegName) when is_atom(RegName) ->
+ Key = term_to_binary(RegName),
+ {Id, 'key', Key, term_to_binary(undefined), 0, 0};
+corba_fake_mk_objkey(Id, 'registered', RegName) when is_atom(RegName) ->
+ {Id, 'registered', RegName, term_to_binary(undefined), 0, 0}.
+
+make_objkey() ->
+ term_to_binary({now(), node()}).
diff --git a/lib/orber/test/lname_SUITE.erl b/lib/orber/test/lname_SUITE.erl
new file mode 100644
index 0000000000..d1f0e7cf0e
--- /dev/null
+++ b/lib/orber/test/lname_SUITE.erl
@@ -0,0 +1,198 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%-----------------------------------------------------------------
+%%
+%% Description:
+%% Test suite for the Names Library module
+%%
+%%-----------------------------------------------------------------
+-module(lname_SUITE).
+
+-include("test_server.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming.hrl").
+-include_lib("orber/COSS/CosNaming/lname.hrl").
+
+-define(default_timeout, ?t:minutes(3)).
+
+%%-----------------------------------------------------------------
+%% External exports
+%%-----------------------------------------------------------------
+-export([all/1]).
+
+%%-----------------------------------------------------------------
+%% Internal exports
+%%-----------------------------------------------------------------
+-export([]).
+-compile(export_all).
+
+%%-----------------------------------------------------------------
+%% Func: all/1
+%% Args:
+%% Returns:
+%%-----------------------------------------------------------------
+all(doc) -> ["Description", "more description"];
+all(suite) ->
+ [lname_component, lname].
+
+%%-----------------------------------------------------------------
+%% Init and cleanup functions.
+%%-----------------------------------------------------------------
+
+init_per_testcase(_Case, Config) ->
+ ?line Dog=test_server:timetrap(?default_timeout),
+ [{watchdog, Dog}|Config].
+
+
+fin_per_testcase(_Case, Config) ->
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+
+%%-----------------------------------------------------------------
+%% Test Case: name component handling tests
+%% Description:
+%%-----------------------------------------------------------------
+lname_component(doc) -> ["Description", "more description"];
+lname_component(suite) -> [];
+lname_component(_) ->
+ create_test(),
+ get_tests(),
+ set_tests().
+
+create_test() ->
+ ?line #'CosNaming_NameComponent'{} = lname_component:create(),
+ ok.
+
+get_tests() ->
+ NC = #'CosNaming_NameComponent'{id="first", kind="apple"},
+ NC1 = #'CosNaming_NameComponent'{id="", kind="apple"},
+ NC2 = #'CosNaming_NameComponent'{id="first", kind=""},
+ ?line "first" = lname_component:get_id(NC),
+ ?line "apple" = lname_component:get_kind(NC),
+ ?line {'EXCEPTION', #'LNameComponent_NotSet'{}} =
+ (catch lname_component:get_id(NC1)),
+ ?line {'EXCEPTION', #'LNameComponent_NotSet'{}} =
+ (catch lname_component:get_kind(NC2)),
+ ok.
+
+set_tests() ->
+ NC = #'CosNaming_NameComponent'{id="first", kind="apple"},
+ ?line #'CosNaming_NameComponent'{id="second", kind="apple"} =
+ lname_component:set_id(NC, "second"),
+ ?line #'CosNaming_NameComponent'{id="first", kind="pear"} =
+ lname_component:set_kind(NC, "pear"),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: name handling tests
+%% Description:
+%%-----------------------------------------------------------------
+lname(doc) -> ["Description", "more description"];
+lname(suite) -> [];
+lname(_) ->
+ Name = [#'CosNaming_NameComponent'{id="first", kind="apple"},
+ #'CosNaming_NameComponent'{id="last", kind="peach"},
+ #'CosNaming_NameComponent'{id="and", kind="plum"},
+ #'CosNaming_NameComponent'{id="always", kind="orange"}],
+ insert_tests(Name),
+ get_tests(Name),
+ delete_tests(Name),
+ comparision_tests(Name),
+ convertion_tests(Name).
+
+insert_tests(Name) ->
+ NC = #'CosNaming_NameComponent'{id="new", kind="pear"},
+ ?line [NC, #'CosNaming_NameComponent'{id="first", kind="apple"},
+ #'CosNaming_NameComponent'{id="last", kind="peach"},
+ #'CosNaming_NameComponent'{id="and", kind="plum"},
+ #'CosNaming_NameComponent'{id="always", kind="orange"}] =
+ lname:insert_component(Name, 1, NC),
+ ?line [#'CosNaming_NameComponent'{id="first", kind="apple"},
+ #'CosNaming_NameComponent'{id="last", kind="peach"},
+ #'CosNaming_NameComponent'{id="and", kind="plum"},
+ #'CosNaming_NameComponent'{id="always", kind="orange"}, NC] =
+ lname:insert_component(Name, 5, NC),
+ ?line [#'CosNaming_NameComponent'{id="first", kind="apple"},
+ #'CosNaming_NameComponent'{id="last", kind="peach"},
+ #'CosNaming_NameComponent'{id="and", kind="plum"}, NC,
+ #'CosNaming_NameComponent'{id="always", kind="orange"}] =
+ lname:insert_component(Name, 4, NC),
+ ?line [#'CosNaming_NameComponent'{id="first", kind="apple"},
+ #'CosNaming_NameComponent'{id="last", kind="peach"}, NC,
+ #'CosNaming_NameComponent'{id="and", kind="plum"},
+ #'CosNaming_NameComponent'{id="always", kind="orange"}] =
+ lname:insert_component(Name, 3, NC),
+ ?line {'EXCEPTION', #'LName_NoComponent'{}} =
+ (catch lname:insert_component(Name, 6, NC)),
+ ?line {'EXCEPTION', #'LName_NoComponent'{}} =
+ (catch lname:insert_component(Name, 0, NC)),
+ ?line {'EXCEPTION', #'LName_NoComponent'{}} =
+ (catch lname:insert_component(Name, -2, NC)),
+ ok.
+
+get_tests(Name) ->
+ ?line #'CosNaming_NameComponent'{id="first", kind="apple"} =
+ lname:get_component(Name, 1),
+ ?line #'CosNaming_NameComponent'{id="always", kind="orange"} =
+ lname:get_component(Name, 4),
+ ?line #'CosNaming_NameComponent'{id="and", kind="plum"} =
+ lname:get_component(Name, 3),
+ ?line {'EXCEPTION', #'LName_NoComponent'{}} =
+ (catch lname:get_component(Name, 5)),
+ ?line {'EXCEPTION', #'LName_NoComponent'{}} =
+ (catch lname:get_component(Name, 0)),
+ ?line {'EXCEPTION', #'LName_NoComponent'{}} =
+ (catch lname:get_component(Name, -2)),
+ ok.
+
+delete_tests(Name) ->
+ ?line [#'CosNaming_NameComponent'{id="last", kind="peach"},
+ #'CosNaming_NameComponent'{id="and", kind="plum"},
+ #'CosNaming_NameComponent'{id="always", kind="orange"}] =
+ lname:delete_component(Name, 1),
+ ?line [#'CosNaming_NameComponent'{id="first", kind="apple"},
+ #'CosNaming_NameComponent'{id="last", kind="peach"},
+ #'CosNaming_NameComponent'{id="and", kind="plum"}] =
+ lname:delete_component(Name, 4),
+ ?line [#'CosNaming_NameComponent'{id="first", kind="apple"},
+ #'CosNaming_NameComponent'{id="last", kind="peach"},
+ #'CosNaming_NameComponent'{id="always", kind="orange"}] =
+ lname:delete_component(Name, 3),
+ ?line {'EXCEPTION', #'LName_NoComponent'{}} =
+ (catch lname:delete_component(Name, 6)),
+ ?line {'EXCEPTION', #'LName_NoComponent'{}} =
+ (catch lname:delete_component(Name, 0)),
+ ?line {'EXCEPTION', #'LName_NoComponent'{}} =
+ (catch lname:delete_component(Name, -2)),
+ ok.
+
+comparision_tests(Name) ->
+ ?line true = lname:equal(Name, Name),
+ ?line false = lname:equal(Name, lname:delete_component(Name, 2)),
+ ?line true = lname:less_than(lname:delete_component(Name, 2), Name),
+ ?line false = lname:less_than(Name, Name),
+ ?line false = lname:less_than(Name, lname:delete_component(Name, 2)),
+ ok.
+
+convertion_tests(Name) ->
+ ?line Name = lname:from_idl_form(Name),
+ ?line Name = lname:to_idl_form(Name),
+ ok.
diff --git a/lib/orber/test/multi_ORB_SUITE.erl b/lib/orber/test/multi_ORB_SUITE.erl
new file mode 100644
index 0000000000..d1931f5393
--- /dev/null
+++ b/lib/orber/test/multi_ORB_SUITE.erl
@@ -0,0 +1,2352 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1999-2010. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+
+-module(multi_ORB_SUITE).
+
+-include("test_server.hrl").
+-include_lib("orber/include/corba.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming.hrl").
+-include_lib("orber/src/orber_iiop.hrl").
+-include_lib("orber/src/ifr_objects.hrl").
+-include("idl_output/orber_test_server.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming_NamingContextExt.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming_NamingContext.hrl").
+
+
+-define(default_timeout, ?t:minutes(15)).
+
+-define(match(ExpectedRes,Expr),
+ fun() ->
+ AcTuAlReS = (catch (Expr)),
+ case AcTuAlReS of
+ ExpectedRes ->
+ io:format("------ CORRECT RESULT ------~n~p~n",
+ [AcTuAlReS]),
+ AcTuAlReS;
+ _ ->
+ io:format("###### ERROR ERROR ######~nRESULT: ~p~n",
+ [AcTuAlReS]),
+ ?line exit(AcTuAlReS)
+ end
+ end()).
+
+%%-----------------------------------------------------------------
+%% External exports
+%%-----------------------------------------------------------------
+-export([all/1, cases/0, init_all/1, finish_all/1, basic_PI_api/1, multi_orber_api/1,
+ init_per_testcase/2, fin_per_testcase/2, multi_pseudo_orber_api/1,
+ light_orber_api/1, light_orber2_api/1,
+ ssl_1_multi_orber_api/1, ssl_2_multi_orber_api/1, ssl_reconfigure_api/1,
+ iiop_timeout_api/1, iiop_timeout_added_api/1, setup_connection_timeout_api/1,
+ setup_multi_connection_timeout_api/1, setup_multi_connection_timeout_random_api/1,
+ setup_multi_connection_timeout_attempts_api/1,
+ fragments_server_api/1, fragments_max_server_api/1,
+ fragments_max_server_added_api/1, fragments_client_api/1,
+ light_ifr_api/1, max_requests_api/1, max_requests_added_api/1,
+ max_connections_api/1, max_packet_size_exceeded_api/1,
+ max_packet_size_ok_api/1, proxy_interface_api/1, proxy_interface_ipv6_api/1,
+ multiple_accept_api/1, implicit_context_api/1,
+ pseudo_implicit_context_api/1, pseudo_two_implicit_context_api/1,
+ oneway_implicit_context_api/1, implicit_context_roundtrip_api/1,
+ oneway_pseudo_implicit_context_api/1, flags_added_api/1,
+ oneway_pseudo_two_implicit_context_api/1,
+ local_interface_api/1, local_interface_ctx_override_api/1,
+ local_interface_acl_override_api/1, bad_giop_header_api/1,
+ bad_fragment_id_client_api/1, bad_id_cancel_request_api/1,
+ close_connections_api/1, close_connections_local_interface_api/1,
+ close_connections_local_interface_ctx_override_api/1, ssl_reconfigure_generation_3_api/1,
+ ssl_1_multi_orber_generation_3_api/1, ssl_2_multi_orber_generation_3_api/1,
+ close_connections_alt_iiop_addr_api/1, close_connections_multiple_profiles_api/1]).
+
+
+%%-----------------------------------------------------------------
+%% Internal exports
+%%-----------------------------------------------------------------
+-export([pseudo_calls/2, pseudo_casts/2, create_fake_server_ORB/5, do_connect/3]).
+
+%%-----------------------------------------------------------------
+%% Func: all/1
+%% Args:
+%% Returns:
+%%-----------------------------------------------------------------
+all(doc) -> ["API tests for multi orber interfaces",
+ "This suite test intra-ORB communication. There are three scenarios:",
+ "* No security at all (multi_orber_api)",
+ "* Two secure orbs using ssl (ssl_multi_orb_api)",
+ "* One secure and one orb with no security. (ssl_multi_orb_api)"];
+all(suite) -> {req,
+ [mnesia],
+ {conf, init_all, cases(), finish_all}}.
+
+%% NOTE - the fragment test cases must be first since we explicitly set a request
+%% id. Otherwise, the request-id counter would be increased and we cannot know
+%% what it is.
+cases() ->
+ [fragments_server_api,
+ fragments_max_server_api,
+ fragments_max_server_added_api,
+ fragments_client_api,
+ flags_added_api,
+ bad_fragment_id_client_api,
+ bad_giop_header_api,
+ bad_id_cancel_request_api,
+ implicit_context_api,
+ pseudo_implicit_context_api,
+ pseudo_two_implicit_context_api,
+ implicit_context_roundtrip_api,
+ oneway_implicit_context_api,
+ oneway_pseudo_implicit_context_api,
+ oneway_pseudo_two_implicit_context_api,
+ proxy_interface_api,
+ proxy_interface_ipv6_api,
+ local_interface_api,
+ local_interface_ctx_override_api,
+ local_interface_acl_override_api,
+ close_connections_api,
+ close_connections_local_interface_api,
+ close_connections_local_interface_ctx_override_api,
+ close_connections_alt_iiop_addr_api,
+ close_connections_multiple_profiles_api,
+ multiple_accept_api,
+ max_requests_api,
+ max_requests_added_api,
+ max_connections_api,
+ max_packet_size_exceeded_api,
+ max_packet_size_ok_api,
+ light_ifr_api,
+ multi_pseudo_orber_api,
+ multi_orber_api,
+ light_orber_api,
+ light_orber2_api,
+ basic_PI_api,
+ iiop_timeout_api,
+ iiop_timeout_added_api,
+ setup_connection_timeout_api,
+ setup_multi_connection_timeout_api,
+ setup_multi_connection_timeout_attempts_api,
+ setup_multi_connection_timeout_random_api,
+ ssl_1_multi_orber_api,
+ ssl_1_multi_orber_generation_3_api,
+ ssl_2_multi_orber_api,
+ ssl_2_multi_orber_generation_3_api,
+ ssl_reconfigure_generation_3_api,
+ ssl_reconfigure_api
+ ].
+
+%%-----------------------------------------------------------------
+%% Init and cleanup functions.
+%%-----------------------------------------------------------------
+
+init_per_testcase(_Case, Config) ->
+ Path = code:which(?MODULE),
+ code:add_pathz(filename:join(filename:dirname(Path), "idl_output")),
+ Dog=test_server:timetrap(?default_timeout),
+ orber:jump_start(0),
+ oe_orber_test_server:oe_register(),
+ [{watchdog, Dog}|Config].
+
+
+fin_per_testcase(_Case, Config) ->
+ oe_orber_test_server:oe_unregister(),
+ orber:jump_stop(),
+ Path = code:which(?MODULE),
+ code:del_path(filename:join(filename:dirname(Path), "idl_output")),
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+init_all(Config) ->
+ if
+ is_list(Config) ->
+ Config;
+ true ->
+ exit("Config not a list")
+ end.
+
+finish_all(Config) ->
+ Config.
+
+%%-----------------------------------------------------------------
+%% API tests for ORB to ORB, no security
+%%-----------------------------------------------------------------
+
+implicit_context_api(doc) -> ["IIOP Implicit Contex tests"];
+implicit_context_api(suite) -> [];
+implicit_context_api(_Config) ->
+ IP = orber_test_lib:get_host(),
+ Loopback = orber_test_lib:get_loopback_interface(),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE},
+ {ip_address, IP}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ %% Create a remote server
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ install_test_data,
+ [nameservice])),
+ IOR = ?match(#'IOP_IOR'{},
+ corba:string_to_object("corbaname::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService#mamba")),
+
+ Relay = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([])),
+ ?match(ok,
+ orber_test_server:
+ relay_call(Relay,
+ [{context,
+ [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
+ context_data = {interface,
+ Loopback}}]}],
+ IOR)),
+
+ ?match([_,_], orber:iiop_connections(out)),
+ Conns = ?match([_,_],
+ orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])),
+ ?match(true, lists:keymember(Loopback, 1, Conns)),
+ ok.
+
+implicit_context_roundtrip_api(doc) ->
+ ["IIOP Implicit Contex roundtrip tests"];
+implicit_context_roundtrip_api(suite) -> [];
+implicit_context_roundtrip_api(_Config) ->
+ IP = orber_test_lib:get_host(),
+ Loopback = orber_test_lib:get_loopback_interface(),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE},
+ {ip_address, IP}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ %% Create a remote server
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ install_test_data,
+ [nameservice])),
+ Relay = ?match(#'IOP_IOR'{},
+ corba:string_to_object("corbaname::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService#mamba")),
+
+ IOR = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([], [])),
+ ?match(ok,
+ orber_test_server:
+ relay_call(Relay,
+ [{context,
+ [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
+ context_data = {interface,
+ Loopback}}]}],
+ IOR)),
+ ?match([_,_], orber:iiop_connections(out)),
+ Conns = ?match([_,_],
+ orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])),
+ ?match(true, lists:keymember(Loopback, 1, Conns)),
+ ok.
+
+
+
+oneway_implicit_context_api(doc) -> ["IIOP Implicit Contex oneway tests"];
+oneway_implicit_context_api(suite) -> [];
+oneway_implicit_context_api(_Config) ->
+ IP = orber_test_lib:get_host(),
+ Loopback = orber_test_lib:get_loopback_interface(),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE},
+ {ip_address, IP}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ %% Create a remote server
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ install_test_data,
+ [nameservice])),
+ IOR = ?match(#'IOP_IOR'{},
+ corba:string_to_object("corbaname::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService#mamba")),
+
+ Relay = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([])),
+ ?match(ok,
+ orber_test_server:
+ relay_cast(Relay,
+ [{context,
+ [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
+ context_data = {interface,
+ Loopback}}]}],
+ IOR)),
+
+ %% We must wait for a few seconds for the client to be able to set up the
+ %% connection (since it's a oneway operation).
+ timer:sleep(5000),
+ ?match([_,_], orber:iiop_connections(out)),
+ Conns = ?match([_,_],
+ orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])),
+ ?match(true, lists:keymember(Loopback, 1, Conns)),
+ ok.
+
+
+pseudo_implicit_context_api(doc) -> ["IIOP Implicit Contex tests (via pseudo object)"];
+pseudo_implicit_context_api(suite) -> [];
+pseudo_implicit_context_api(_Config) ->
+ IP = orber_test_lib:get_host(),
+ Loopback = orber_test_lib:get_loopback_interface(),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE},
+ {ip_address, IP}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ %% Create a remote server
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ install_test_data,
+ [nameservice])),
+ IOR = ?match(#'IOP_IOR'{},
+ corba:string_to_object("corbaname::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService#mamba")),
+
+ Relay = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([], [{pseudo,true}])),
+ ?match(ok,
+ orber_test_server:
+ relay_call(Relay,
+ [{context,
+ [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
+ context_data = {interface,
+ Loopback}}]}],
+ IOR)),
+ ?match([_,_], orber:iiop_connections(out)),
+ Conns = ?match([_,_],
+ orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])),
+ ?match(true, lists:keymember(Loopback, 1, Conns)),
+ ok.
+
+pseudo_two_implicit_context_api(doc) ->
+ ["IIOP two Implicit Contex tests (via pseudo object)"];
+pseudo_two_implicit_context_api(suite) -> [];
+pseudo_two_implicit_context_api(_Config) ->
+ IP = orber_test_lib:get_host(),
+ Loopback = orber_test_lib:get_loopback_interface(),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE},
+ {ip_address, IP}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ %% Create a remote server
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ install_test_data,
+ [nameservice])),
+ IOR = ?match(#'IOP_IOR'{},
+ corba:string_to_object("corbaname::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService#mamba")),
+
+ Relay = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([], [{pseudo,true}])),
+ put(oe_server_in_context,
+ [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
+ context_data = {interface,
+ IP}}]),
+ ?match(ok,
+ orber_test_server:
+ relay_call(Relay,
+ [{context,
+ [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
+ context_data = {interface,
+ Loopback}}]}],
+ IOR)),
+ ?match([_,_], orber:iiop_connections(out)),
+ Conns = ?match([_,_],
+ orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])),
+ ?match(true, lists:keymember(Loopback, 1, Conns)),
+ ok.
+
+oneway_pseudo_implicit_context_api(doc) -> ["IIOP Implicit Contex tests (via pseudo object oneway)"];
+oneway_pseudo_implicit_context_api(suite) -> [];
+oneway_pseudo_implicit_context_api(_Config) ->
+ IP = orber_test_lib:get_host(),
+ Loopback = orber_test_lib:get_loopback_interface(),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE},
+ {ip_address, IP}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ %% Create a remote server
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ install_test_data,
+ [nameservice])),
+ IOR = ?match(#'IOP_IOR'{},
+ corba:string_to_object("corbaname::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService#mamba")),
+
+ Relay = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([], [{pseudo,true}])),
+ ?match(ok,
+ orber_test_server:
+ relay_cast(Relay,
+ [{context,
+ [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
+ context_data = {interface,
+ Loopback}}]}],
+ IOR)),
+ ?match([_,_], orber:iiop_connections(out)),
+ Conns = ?match([_,_],
+ orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])),
+ ?match(true, lists:keymember(Loopback, 1, Conns)),
+ ok.
+
+oneway_pseudo_two_implicit_context_api(doc) ->
+ ["IIOP two Implicit Contex tests (via pseudo object oneway)"];
+oneway_pseudo_two_implicit_context_api(suite) -> [];
+oneway_pseudo_two_implicit_context_api(_Config) ->
+ IP = orber_test_lib:get_host(),
+ Loopback = orber_test_lib:get_loopback_interface(),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE},
+ {ip_address, IP}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ %% Create a remote server
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ install_test_data,
+ [nameservice])),
+ IOR = ?match(#'IOP_IOR'{},
+ corba:string_to_object("corbaname::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService#mamba")),
+
+ Relay = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([], [{pseudo,true}])),
+ %% Add incoming implicit context which must be removed.
+ put(oe_server_in_context,
+ [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
+ context_data = {interface,
+ IP}}]),
+ ?match(ok,
+ orber_test_server:
+ relay_cast(Relay,
+ [{context,
+ [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
+ context_data = {interface,
+ Loopback}}]}],
+ IOR)),
+ ?match([_,_], orber:iiop_connections(out)),
+ Conns = ?match([_,_],
+ orber_test_lib:remote_apply(ServerNode, orber, iiop_connections, [in])),
+ ?match(true, lists:keymember(Loopback, 1, Conns)),
+ ok.
+
+
+
+multiple_accept_api(doc) -> ["IIOP Multiple Accept tests"];
+multiple_accept_api(suite) -> [];
+multiple_accept_api(_Config) ->
+ IP = orber_test_lib:get_host(),
+ Loopback = orber_test_lib:get_loopback_interface(),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE},
+ {ip_address, IP}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ %% The server ORB doesn't listen to 127.0.0.1
+ ?match({'EXCEPTION',_},
+ corba:string_to_object("corbaloc::1.2@" ++Loopback++":"++integer_to_list(ServerPort)++"/NameService")),
+ ?match([], orber:iiop_connections(out)),
+
+ IOR1 = ?match(#'IOP_IOR'{},
+ corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")),
+ ?match({'external', {IP, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}},
+ iop_ior:get_key(IOR1)),
+ ?match([_], orber:iiop_connections(out)),
+
+ {ok, Ref1} = ?match({ok, _},
+ orber_test_lib:remote_apply(ServerNode, orber,
+ add_listen_interface,
+ [Loopback, normal])),
+
+ IOR2 = ?match(#'IOP_IOR'{},
+ corba:string_to_object("corbaloc::1.2@"++Loopback++":"++integer_to_list(ServerPort)++"/NameService")),
+ ?match({'external', {Loopback, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}},
+ iop_ior:get_key(IOR2)),
+ ?match([_,_], orber:iiop_connections(out)),
+
+ {ok, Ref2} = ?match({ok, _},
+ orber_test_lib:remote_apply(ServerNode, orber,
+ add_listen_interface,
+ [Loopback, normal, 9543])),
+ ?match({error, eaddrinuse},
+ orber_test_lib:remote_apply(ServerNode, orber,
+ add_listen_interface,
+ [Loopback, normal, 9543])),
+
+ IOR3 = ?match(#'IOP_IOR'{},
+ corba:string_to_object("corbaloc::1.2@"++Loopback++":9543/NameService")),
+ ?match({'external', {Loopback, 9543, _ObjectKey, _Counter, _TP, _NewHD}},
+ iop_ior:get_key(IOR3)),
+ ?match([_,_,_], orber:iiop_connections(out)),
+
+ ?match(ok,
+ orber_test_lib:remote_apply(ServerNode, orber,
+ remove_listen_interface, [Ref1])),
+ %% Wait a few seconds to be sure that the connections really has been removed.
+ timer:sleep(4000),
+ ?match([_,_], orber:iiop_connections(out)),
+
+ ?match(ok,
+ orber_test_lib:remote_apply(ServerNode, orber,
+ remove_listen_interface, [Ref2])),
+ %% Wait a few seconds to be sure that the connections really has been removed.
+ timer:sleep(4000),
+ ?match([_], orber:iiop_connections(out)),
+
+ ?match({'EXCEPTION',_},
+ corba:string_to_object("corbaloc::1.2@"++Loopback++":9543/NameService")),
+ ?match({'EXCEPTION',_},
+ corba:string_to_object("corbaloc::1.2@"++Loopback++":"++integer_to_list(ServerPort)++"/NameService")),
+
+ IOR4 = ?match(#'IOP_IOR'{},
+ corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")),
+ ?match({'external', {IP, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}},
+ iop_ior:get_key(IOR4)),
+
+ ok.
+
+
+proxy_interface_api(doc) -> ["IIOP Proxy Interface tests",
+ "This case test if the server ORB use the correct",
+ "interface when exporting IOR:s"];
+proxy_interface_api(suite) -> [];
+proxy_interface_api(_Config) ->
+ IP = orber_test_lib:get_host(),
+ Loopback = orber_test_lib:get_loopback_interface(),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_LOCAL_INTERFACE}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ IOR1 = ?match(#'IOP_IOR'{},
+ corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")),
+ ?match({'external', {IP, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}},
+ iop_ior:get_key(IOR1)),
+ IOR2 = ?match(#'IOP_IOR'{},
+ corba:string_to_object("corbaloc::1.2@"++Loopback++":"++integer_to_list(ServerPort)++"/NameService")),
+ ?match({'external', {Loopback, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}},
+ iop_ior:get_key(IOR2)),
+ ok.
+
+proxy_interface_ipv6_api(doc) -> ["IIOP Proxy Interface tests",
+ "This case test if the server ORB use the correct",
+ "IPv6 interface when exporting IOR:s"];
+proxy_interface_ipv6_api(suite) -> [];
+proxy_interface_ipv6_api(_Config) ->
+ case orber_test_lib:version_ok() of
+ true ->
+ proxy_interface_ipv6_api2();
+ Reason ->
+ Reason
+ end.
+
+proxy_interface_ipv6_api2() ->
+ Loopback = orber_test_lib:get_loopback_interface(inet6),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, (?ORB_ENV_USE_IPV6 bor
+ ?ORB_ENV_LOCAL_INTERFACE)}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+
+ {ok, ClientNode, _ClientHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_USE_IPV6}])),
+
+ IP = orber_test_lib:remote_apply(ClientNode, orber_test_lib, get_host, []),
+
+ IOR1 = ?match(#'IOP_IOR'{},
+ orber_test_lib:remote_apply(ClientNode, corba, string_to_object,
+ ["corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService"])),
+ ?match({'external', {IP, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}},
+ orber_test_lib:remote_apply(ClientNode, iop_ior, get_key, [IOR1])),
+ IOR2 = ?match(#'IOP_IOR'{},
+ orber_test_lib:remote_apply(ClientNode, corba, string_to_object,
+ ["corbaloc::1.2@"++Loopback++":"++integer_to_list(ServerPort)++"/NameService"])),
+ ?match({'external', {Loopback, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}},
+ orber_test_lib:remote_apply(ClientNode, iop_ior, get_key, [IOR2])),
+ ok.
+
+local_interface_api(doc) -> ["IIOP Local Interface tests",
+ "This case test if the server ORB use the correct",
+ "local interface when connecting to another ORB"];
+local_interface_api(suite) -> [];
+local_interface_api(_Config) ->
+ IP = orber_test_lib:get_host(),
+ Loopback = orber_test_lib:get_loopback_interface(),
+ {ok, ClientNode, _ClientHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{ip_address_local, Loopback}])),
+ Port = orber:iiop_port(),
+ ?match(#'IOP_IOR'{},
+ orber_test_lib:remote_apply(ClientNode, corba, string_to_object,
+ ["corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService"])),
+ [{Loopback, RemotePort}] =
+ ?match([{Loopback,_RemotePort}], orber:iiop_connections(in)),
+
+ ?match([{IP, Port}],
+ orber_test_lib:remote_apply(ClientNode, orber,
+ iiop_connections, [out])),
+ ?match([{IP, Port}], orber:find_sockname_by_peername(Loopback,RemotePort)),
+ ?match([{Loopback, RemotePort}], orber:find_peername_by_sockname(IP, Port)),
+
+ ?match([{Loopback, RemotePort}],
+ orber_test_lib:remote_apply(ClientNode, orber,
+ find_sockname_by_peername,
+ [IP, Port])),
+ ?match([{IP, Port}],
+ orber_test_lib:remote_apply(ClientNode, orber,
+ find_peername_by_sockname,
+ [Loopback,RemotePort])),
+
+
+ ok.
+
+local_interface_ctx_override_api(doc) ->
+ ["IIOP Local Interface tests",
+ "This case test if the server ORB use the correct",
+ "local interface when connecting to another ORB"];
+local_interface_ctx_override_api(suite) -> [];
+local_interface_ctx_override_api(_Config) ->
+ IP = orber_test_lib:get_host(),
+ Loopback = orber_test_lib:get_loopback_interface(),
+ {ok, ClientNode, _ClientHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{ip_address_local, IP}])),
+ Port = orber:iiop_port(),
+ ?match(#'IOP_IOR'{},
+ orber_test_lib:remote_apply(ClientNode, corba, string_to_object,
+ ["corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService",
+ [#'IOP_ServiceContext'
+ {context_id=?ORBER_GENERIC_CTX_ID,
+ context_data = {interface, Loopback}}]])),
+ [{Loopback, RemotePort}] =
+ ?match([{Loopback,_RemotePort}], orber:iiop_connections(in)),
+
+ ?match([{IP, Port, Loopback}],
+ orber_test_lib:remote_apply(ClientNode, orber,
+ iiop_connections, [out])),
+ ?match([{IP, Port}], orber:find_sockname_by_peername(Loopback,RemotePort)),
+ ?match([{Loopback, RemotePort}], orber:find_peername_by_sockname(IP, Port)),
+
+ ?match([{Loopback, RemotePort}],
+ orber_test_lib:remote_apply(ClientNode, orber,
+ find_sockname_by_peername,
+ [IP, Port])),
+ ?match([{IP, Port}],
+ orber_test_lib:remote_apply(ClientNode, orber,
+ find_peername_by_sockname,
+ [Loopback,RemotePort])),
+
+ ok.
+
+local_interface_acl_override_api(doc) ->
+ ["IIOP Local Interface tests",
+ "This case test if the server ORB use the correct",
+ "local interface when connecting to another ORB"];
+local_interface_acl_override_api(suite) -> [];
+local_interface_acl_override_api(_Config) ->
+ IP = orber_test_lib:get_host(),
+ Loopback = orber_test_lib:get_loopback_interface(),
+ ACL = [{tcp_out, IP ++ "/18", [Loopback]}],
+ {ok, ClientNode, _ClientHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{ip_address_local, IP},
+ {iiop_acl, ACL},
+ {flags, ?ORB_ENV_USE_ACL_OUTGOING}])),
+ Port = orber:iiop_port(),
+ ?match(#'IOP_IOR'{},
+ orber_test_lib:remote_apply(ClientNode, corba, string_to_object,
+ ["corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService",
+ [#'IOP_ServiceContext'
+ {context_id=?ORBER_GENERIC_CTX_ID,
+ context_data = {interface, IP}}]])),
+ ?match([{Loopback,_RemotePort}], orber:iiop_connections(in)),
+ ?match(#'IOP_IOR'{},
+ orber_test_lib:remote_apply(ClientNode, corba, string_to_object,
+ ["corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService"])),
+
+ [{Loopback, RemotePort}] =
+ ?match([{Loopback,_RemotePort}], orber:iiop_connections(in)),
+ ?match([{IP, Port, IP}], orber_test_lib:remote_apply(ClientNode, orber,
+ iiop_connections, [out])),
+ ?match([{IP, Port}], orber:find_sockname_by_peername(Loopback,RemotePort)),
+ ?match([{Loopback, RemotePort}], orber:find_peername_by_sockname(IP, Port)),
+
+ ?match([{Loopback, RemotePort}],
+ orber_test_lib:remote_apply(ClientNode, orber,
+ find_sockname_by_peername,
+ [IP, Port])),
+ ?match([{IP, Port}],
+ orber_test_lib:remote_apply(ClientNode, orber,
+ find_peername_by_sockname,
+ [Loopback,RemotePort])),
+
+ ok.
+
+
+iiop_timeout_api(doc) -> ["IIOP TIMEOUT API tests",
+ "This case test if timeout configuration behaves correctly"];
+iiop_timeout_api(suite) -> [];
+iiop_timeout_api(_Config) ->
+
+ %% Install two secure orber.
+ {ok, ClientNode, ClientHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{iiop_timeout, 6},
+ {iiop_connection_timeout, 3},
+ {iiop_in_connection_timeout, 3}])),
+ ClientPort = orber_test_lib:remote_apply(ClientNode, orber, iiop_port, []),
+
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{iiop_timeout, 6},
+ {iiop_connection_timeout, 3},
+ {iiop_in_connection_timeout, 12}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ install_test_data,
+ [timeout])),
+
+ %% Tell client_orb to interoperate with server_orb.
+ ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib,
+ lookup,
+ [ServerHost, ServerPort])),
+ %% Interop worked fine, perform delay tests.
+ ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib,
+ timeouts,
+ [ServerHost, ServerPort, 6000])),
+
+ %% Create a connection to the "client_orb", which will now act as server.
+ ?match({'IOP_IOR',_,_},
+ corba:string_to_object("corbaloc::1.2@"++ClientHost++":"++integer_to_list(ClientPort)++"/NameService")),
+ %% Check that the connection is established.
+ ?match([{_, ClientPort}], orber:iiop_connections(out)),
+ %% Wait >3 seconds (i.e. iiop_in_connection_timeout) and check if the connection
+ %% have been closed.
+ timer:sleep(8000),
+ ?match([], orber:iiop_connections(out)),
+
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ uninstall_test_data,
+ [timeout])),
+ ok.
+
+iiop_timeout_added_api(doc) -> ["IIOP TIMEOUT API tests",
+ "This case test if timeout configuration behaves correctly"];
+iiop_timeout_added_api(suite) -> [];
+iiop_timeout_added_api(_Config) ->
+ IP = orber_test_lib:get_host(),
+ {ok, Node, _Host} = ?match({ok,_,_}, orber_test_lib:js_node([])),
+ Port = 1 + orber_test_lib:remote_apply(Node, orber, iiop_port, []),
+ ?match({ok, _},
+ orber_test_lib:remote_apply(Node, orber,
+ add_listen_interface,
+ [IP, normal,
+ [{iiop_in_connection_timeout, 3},
+ {flags, ?ORB_ENV_LOCAL_INTERFACE},
+ {iiop_port, Port}]])),
+
+ ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
+ install_test_data,
+ [timeout])),
+
+ ?match({'IOP_IOR',_,_},
+ corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService")),
+ %% Check that the connection is established.
+ ?match([{_, Port}], orber:iiop_connections(out)),
+ %% Wait >3 seconds (i.e. iiop_in_connection_timeout) and check if the connection
+ %% have been closed.
+ timer:sleep(8000),
+ ?match([], orber:iiop_connections(out)),
+
+ ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
+ uninstall_test_data,
+ [timeout])),
+ ok.
+
+%%-----------------------------------------------------------------
+%% API tests for ORB to ORB using pseudo call/cast, no security
+%%-----------------------------------------------------------------
+
+multi_pseudo_orber_api(doc) ->
+ ["MULTI ORB PSEUDO API tests",
+ "This case test if data encode/decode (IIOP) for pseudo objects",
+ "produce the correct result, i.e., the test_server echos",
+ "the input parameter or an exception is raised (MARSHAL)."];
+multi_pseudo_orber_api(suite) -> [];
+multi_pseudo_orber_api(_Config) ->
+ %% --- Create a slave-node ---
+ {ok, Node, Host} =
+ ?match({ok,_,_}, orber_test_lib:js_node()),
+ Port = orber_test_lib:remote_apply(Node, orber, iiop_port, []),
+
+ ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
+ install_test_data,
+ [pseudo])),
+
+ NSR = ?match({'IOP_IOR',"IDL:omg.org/CosNaming/NamingContextExt:1.0",_},
+ corba:string_to_object("corbaloc::1.1@"++Host++":"++
+ integer_to_list(Port)++"/NameService")),
+ Obj =
+ ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
+ 'CosNaming_NamingContext':resolve(NSR, lname:new(["mamba"]))),
+ orber_test_lib:corba_object_tests(Obj, NSR),
+
+ %% Can we even contact the object?
+ ?match(ok, orber_test_server:print(Obj)),
+
+ %% Invoke one blocking call followed by several invokations.
+ spawn(?MODULE, pseudo_calls, [5, Obj]),
+ ?match({ok, 10000}, orber_test_server:pseudo_call_delay(Obj, 10000)),
+ spawn(?MODULE, pseudo_casts, [5, Obj]),
+ ?match(ok, orber_test_server:pseudo_cast_delay(Obj, 10000)),
+
+ %%--- Testing code and decode arguments ---
+ orber_test_lib:test_coding(Obj),
+
+ %% Test if exit is handled properly.
+ ?match({'EXCEPTION',{'TRANSIENT',_,_,_}},
+ orber_test_server:stop_brutal(Obj)),
+
+ ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
+ uninstall_test_data,
+ [pseudo])),
+ ok.
+
+
+%%-----------------------------------------------------------------
+%% API tests for ORB to ORB with local flags definition set.
+%%-----------------------------------------------------------------
+flags_added_api(doc) ->
+ ["MULTI ORB PSEUDO with local flags definition set"];
+flags_added_api(suite) -> [];
+flags_added_api(_Config) ->
+ %% --- Create a slave-node ---
+ IP = orber_test_lib:get_host(),
+ {ok, Node, _Host} =
+ ?match({ok,_,_}, orber_test_lib:js_node([])),
+ Port = 1 + orber_test_lib:remote_apply(Node, orber, iiop_port, []),
+ ?match({ok, _},
+ orber_test_lib:remote_apply(Node, orber,
+ add_listen_interface,
+ [IP, normal,
+ [{flags, (?ORB_ENV_LOCAL_INTERFACE bor
+ ?ORB_ENV_EXCLUDE_CODESET_COMPONENT)},
+ {iiop_port, Port}]])),
+
+ ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
+ install_test_data,
+ [pseudo])),
+ Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
+ corba:string_to_object("corbaname::1.1@"++IP++":"++
+ integer_to_list(Port)++"/NameService#mamba")),
+ ?match({'external', {IP, Port, _ObjectKey, _Counter,
+ #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP,
+ profile_data=
+ #'IIOP_ProfileBody_1_1'{components=[]}},
+ _NewHD}},
+ iop_ior:get_key(Obj)),
+ ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
+ uninstall_test_data,
+ [pseudo])),
+
+ ok.
+
+
+
+%%-----------------------------------------------------------------
+%% API tests for ORB to ORB with limited concurrent requests
+%%-----------------------------------------------------------------
+max_requests_api(doc) ->
+ ["MULTI ORB PSEUDO with limited concurrent requests tests"];
+max_requests_api(suite) -> [];
+max_requests_api(_Config) ->
+ %% --- Create a slave-node ---
+ {ok, Node, Host} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{iiop_max_in_requests, 1}])),
+ Port = orber_test_lib:remote_apply(Node, orber, iiop_port, []),
+ max_requests(Node, Host, Port).
+
+max_requests_added_api(doc) ->
+ ["MULTI ORB PSEUDO with limited concurrent requests tests"];
+max_requests_added_api(suite) -> [];
+max_requests_added_api(_Config) ->
+ %% --- Create a slave-node ---
+ [IP] = ?match([_], orber:host()),
+ {ok, Node, _Host} =
+ ?match({ok,_,_}, orber_test_lib:js_node([])),
+ Port = 1 + orber_test_lib:remote_apply(Node, orber, iiop_port, []),
+ ?match({ok, _},
+ orber_test_lib:remote_apply(Node, orber,
+ add_listen_interface,
+ [IP, normal,
+ [{iiop_max_in_requests, 1},
+ {flags, ?ORB_ENV_LOCAL_INTERFACE},
+ {iiop_port, Port}]])),
+ max_requests(Node, IP, Port).
+
+max_requests(Node, Host, Port) ->
+ ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
+ install_test_data,
+ [pseudo])),
+ Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
+ corba:string_to_object("corbaname::1.1@"++Host++":"++
+ integer_to_list(Port)++"/NameService#mamba")),
+
+ %% Can we even contact the object?
+ ?match(ok, orber_test_server:print(Obj)),
+
+ %% Invoke one blocking call followed by several invokations.
+ spawn(orber_test_server, pseudo_call_delay, [Obj, 15000]),
+ %% Wait for a second to be sure that the previous request has been sent
+ timer:sleep(1000),
+ {MegaSecsB, Before, _} = now(),
+ pseudo_calls(5, Obj),
+ {MegaSecsA, After, _} = now(),
+ %% Normally we we can perform hundreds of pseudo-calls per second. Hence,
+ %% if we add 8 seconds to 'Before' it should still be less since we only
+ %% allow one request at a time to the target ORB.
+ ?match(true, (MegaSecsB + (Before+8)*1000000) < (MegaSecsA + After*1000000)),
+
+ ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
+ uninstall_test_data,
+ [pseudo])),
+
+ ok.
+
+%%-----------------------------------------------------------------
+%% API tests for ORB to ORB with limited concurrent connections
+%%-----------------------------------------------------------------
+max_connections_api(doc) ->
+ ["MULTI ORB PSEUDO with limited concurrent connections tests"];
+max_connections_api(suite) -> [];
+max_connections_api(_Config) ->
+ %% --- Create a slave-node ---
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{iiop_backlog, 0},
+ {iiop_max_in_connections, 2}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ install_test_data,
+ [nameservice])),
+
+ %% Claim connection 1 & 2
+ Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
+ corba:string_to_object("corbaname::1.2@"++ServerHost++":"++
+ integer_to_list(ServerPort)++"/NameService#mamba")),
+ %% Claim backlog
+ {ok, ClientNode, _ClientHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node()),
+
+ spawn(ClientNode, orber_test_server, print, [Obj]),
+ timer:sleep(5000),
+ ?match([_], orber_test_lib:remote_apply(ClientNode, orber,
+ iiop_connections, [])),
+
+ %% Try to connect. Should fail. Due to the behavior of different TCP stacks, backlog 1
+ %% might not be the precise value. Hence, we also need to define the iiop_timeout. Otherwise
+ %% this test case will fail. For the same reason we must GC this connection.
+ {ok, ClientNodeII, _ClientHostII} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{iiop_setup_connection_timeout, 5},
+ {iiop_timeout, 5},
+ {iiop_connection_timeout, 8}])),
+
+ ?match({'EXCEPTION', _},
+ orber_test_lib:remote_apply(ClientNodeII, orber_test_server,
+ testing_iiop_string, [Obj, "Fail"])),
+
+ %% Remove 2 connections. We need to wait a moment so that both sides has detected it.
+ timer:sleep(5000),
+ ?match([_,_], orber:iiop_connections()),
+ ?match(ok, orber_iiop_pm:close_connection([{ServerHost, ServerPort}])),
+ timer:sleep(5000),
+ [{Host, Port}] = ?match([_], orber:iiop_connections()),
+ ?match(ok, orber_iiop_pm:close_connection([{Host, Port}])),
+ timer:sleep(5000),
+ ?match([], orber:iiop_connections()),
+
+ ?match([_], orber_test_lib:remote_apply(ClientNode, orber,
+ iiop_connections, [])),
+
+ ?match([], orber_test_lib:remote_apply(ClientNodeII, orber,
+ iiop_connections, [])),
+
+ ?match({ok, "OK"},
+ orber_test_lib:remote_apply(ClientNodeII, orber_test_server,
+ testing_iiop_string, [Obj, "OK"])),
+
+ timer:sleep(4000),
+ ?match([_], orber_test_lib:remote_apply(ClientNodeII, orber,
+ iiop_connections, [])),
+
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ uninstall_test_data,
+ [pseudo])),
+
+ ok.
+
+
+%%-----------------------------------------------------------------
+%% API tests for terminating connection by using an IOR.
+%%-----------------------------------------------------------------
+close_connections_api(doc) ->
+ ["Close outgoing connection "];
+close_connections_api(suite) -> [];
+close_connections_api(_Config) ->
+ %% --- Create a slave-node ---
+ IP = orber_test_lib:get_host(),
+ Loopback = orber_test_lib:get_loopback_interface(),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{ip_address, IP}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ install_test_data,
+ [nameservice])),
+ orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ IP = orber_test_lib:get_host(),
+
+ %% Create a connection
+ Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
+ corba:string_to_object("corbaname::1.2@"++IP++":"++
+ integer_to_list(ServerPort)++"/NameService#mamba")),
+ %% Check that it's up.
+ ?match([{IP, ServerPort}], orber:iiop_connections(out)),
+ %% Try to close using the wronge interface.
+ ?match(ok, orber:close_connection(Obj, Loopback)),
+ %% Should still be up.
+ ?match([{IP, ServerPort}], orber:iiop_connections(out)),
+ %% Try to close it properly
+ ?match(ok, orber:close_connection(Obj)),
+ %% Wait a moment so that both sides has detected it.
+ timer:sleep(5000),
+ %% Worked?
+ ?match([], orber:iiop_connections(out)),
+ ok.
+
+
+close_connections_local_interface_api(doc) ->
+ ["IIOP Local Interface disconnect tests",
+ "This case test if the server ORB use the correct",
+ "local interface when connecting to another ORB"];
+close_connections_local_interface_api(suite) -> [];
+close_connections_local_interface_api(_Config) ->
+ IP = orber_test_lib:get_host(),
+ Loopback = orber_test_lib:get_loopback_interface(),
+ {ok, ClientNode, _ClientHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{ip_address_local, Loopback}])),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{ip_address, IP}])),
+ Port = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ IOR = ?match(#'IOP_IOR'{},
+ orber_test_lib:remote_apply(ClientNode, corba, string_to_object,
+ ["corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService"])),
+
+ %% Check that the connnection is up and running using the default interface
+ ?match([{Loopback,_RemotePort}], orber_test_lib:remote_apply(ServerNode, orber,
+ iiop_connections, [in])),
+ ?match([{IP, Port}],
+ orber_test_lib:remote_apply(ClientNode, orber,
+ iiop_connections, [out])),
+ %% Try to close the connection
+ ?match(ok, orber_test_lib:remote_apply(ClientNode, orber,
+ close_connection, [IOR])),
+ %% Wait a moment so that both sides has detected it.
+ timer:sleep(5000),
+ %% Now the connection shall be gone.
+ ?match([], orber_test_lib:remote_apply(ClientNode, orber,
+ iiop_connections, [out])),
+ ?match([], orber_test_lib:remote_apply(ServerNode, orber,
+ iiop_connections, [in])),
+
+ ok.
+
+close_connections_local_interface_ctx_override_api(doc) ->
+ ["IIOP Local Interface disconnect tests",
+ "This case test if the server ORB use the correct",
+ "local interface when connecting to another ORB"];
+close_connections_local_interface_ctx_override_api(suite) -> [];
+close_connections_local_interface_ctx_override_api(_Config) ->
+ IP = orber_test_lib:get_host(),
+ Loopback = orber_test_lib:get_loopback_interface(),
+ {ok, ClientNode, _ClientHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{ip_address_local, IP},
+ {ip_address, IP}])),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{ip_address, IP}])),
+ Port = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ IOR = ?match(#'IOP_IOR'{},
+ orber_test_lib:remote_apply(ClientNode, corba, string_to_object,
+ ["corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService",
+ [#'IOP_ServiceContext'
+ {context_id=?ORBER_GENERIC_CTX_ID,
+ context_data = {interface, Loopback}}]])),
+
+ timer:sleep(2000),
+ %% Check that the connnection is up and running using the default interface
+ ?match([{Loopback,_RemotePort}], orber_test_lib:remote_apply(ServerNode, orber,
+ iiop_connections, [in])),
+
+ ?match([{IP, Port, Loopback}],
+ orber_test_lib:remote_apply(ClientNode, orber,
+ iiop_connections, [out])),
+ %% Try to close not supplying the interface.
+ ?match(ok, orber_test_lib:remote_apply(ClientNode, orber,
+ close_connection, [IOR])),
+
+ timer:sleep(2000),
+ %% The connection shall still be up and running
+ ?match([{Loopback,_RemotePort}], orber_test_lib:remote_apply(ServerNode, orber,
+ iiop_connections, [in])),
+ ?match([{IP, Port, Loopback}],
+ orber_test_lib:remote_apply(ClientNode, orber,
+ iiop_connections, [out])),
+ %% Try to close not supplying the interface.
+ ?match(ok, orber_test_lib:remote_apply(ClientNode, orber,
+ close_connection, [IOR, IP])),
+
+ timer:sleep(2000),
+ %% The connection shall still be up and running
+ ?match([{Loopback,_RemotePort}], orber_test_lib:remote_apply(ServerNode, orber,
+ iiop_connections, [in])),
+ ?match([{IP, Port, Loopback}],
+ orber_test_lib:remote_apply(ClientNode, orber,
+ iiop_connections, [out])),
+
+ %% Try to close supplying the correct interface.
+ ?match(ok, orber_test_lib:remote_apply(ClientNode, orber,
+ close_connection, [IOR, Loopback])),
+ %% Wait a moment so that both sides has detected it.
+ timer:sleep(5000),
+ %% Now the connection shall be gone.
+ ?match([], orber_test_lib:remote_apply(ServerNode, orber,
+ iiop_connections, [in])),
+ ?match([], orber_test_lib:remote_apply(ClientNode, orber,
+ iiop_connections, [out])),
+ ok.
+
+close_connections_alt_iiop_addr_api(doc) ->
+ ["IIOP alternate address disconnect tests",
+ "This case test if the server ORB use the correct",
+ "local interface when connecting to another ORB"];
+close_connections_alt_iiop_addr_api(suite) -> [];
+close_connections_alt_iiop_addr_api(_Config) ->
+ %% --- Create a slave-node ---
+ Loopback = orber_test_lib:get_loopback_interface(),
+ IP = orber_test_lib:get_host(),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{giop_version, {1, 2}},
+ {ip_address, {multiple, [IP, Loopback]}}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ install_test_data,
+ [{nameservice, Loopback, ServerPort}])),
+ %% Create two connections
+ Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
+ corba:string_to_object("corbaname::1.2@"++IP++":"++
+ integer_to_list(ServerPort)++"/NameService#mamba")),
+ ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
+ corba:string_to_object("corbaname::1.2@"++Loopback++":"++
+ integer_to_list(ServerPort)++"/NameService#mamba")),
+ timer:sleep(2000),
+ %% The connection shall still be up and running
+ ?match([{_,_}, {_,_}], orber:iiop_connections(out)),
+ ?match([{_,_}, {_,_}],
+ orber_test_lib:remote_apply(ServerNode, orber,
+ iiop_connections, [in])),
+
+ %% Try to close the connection
+ ?match(ok, orber:close_connection(Obj)),
+ %% Wait a moment so that both sides has detected it.
+ timer:sleep(5000),
+ %% Now the connections shall be gone.
+ ?match([], orber:iiop_connections(out)),
+ ?match([], orber_test_lib:remote_apply(ServerNode, orber,
+ iiop_connections, [in])),
+ ok.
+
+close_connections_multiple_profiles_api(doc) ->
+ ["IIOP alternate address disconnect tests",
+ "This case test if the server ORB use the correct",
+ "local interface when connecting to another ORB"];
+close_connections_multiple_profiles_api(suite) -> [];
+close_connections_multiple_profiles_api(_Config) ->
+ IP = orber_test_lib:get_host(),
+ Loopback = orber_test_lib:get_loopback_interface(),
+ %% --- Create a slave-node ---
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{ip_address,
+ {multiple, [Loopback, IP]}}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ install_test_data, [nameservice])),
+ %% Create two connections
+ Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
+ corba:string_to_object("corbaname::1.2@"++IP++":"++
+ integer_to_list(ServerPort)++"/NameService#mamba")),
+ ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
+ corba:string_to_object("corbaname::1.2@"++Loopback++":"++
+ integer_to_list(ServerPort)++"/NameService#mamba")),
+ %% The connection shall still be up and running
+ ?match([{_,_}, {_,_}], orber:iiop_connections(out)),
+ ?match([{_,_}, {_,_}],
+ orber_test_lib:remote_apply(ServerNode, orber,
+ iiop_connections, [in])),
+
+ %% Try to close the connection
+ ?match(ok, orber:close_connection(Obj)),
+ %% Wait a moment so that both sides has detected it.
+ timer:sleep(5000),
+ %% Now the connections shall be gone.
+ ?match([], orber:iiop_connections(out)),
+ ?match([], orber_test_lib:remote_apply(ServerNode, orber,
+ iiop_connections, [in])),
+ ok.
+
+%%-----------------------------------------------------------------
+%% API tests for ORB to ORB with iiop_packet_size set
+%%-----------------------------------------------------------------
+max_packet_size_exceeded_api(doc) ->
+ ["Exceed the maximum request size"];
+max_packet_size_exceeded_api(suite) -> [];
+max_packet_size_exceeded_api(_Config) ->
+ case catch gen_tcp:listen(0, [{packet,cdr}, {packet_size, 14}]) of
+ {'EXIT',badarg} ->
+ {skipped, "The inet option {packet_size, Max} not supported"};
+ {ok, LS} ->
+ (catch gen_tcp:close(LS)),
+ %% --- Create a slave-node ---
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{iiop_packet_size, 1}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber,
+ iiop_port, []),
+ ?match({'EXCEPTION', #'CosNaming_NamingContextExt_InvalidAddress'{}},
+ corba:string_to_object("corbaloc::1.2@"++ServerHost++":"++integer_to_list(ServerPort)++"/NameService")),
+ ok
+ end.
+
+%%-----------------------------------------------------------------
+%% API tests for ORB to ORB with iiop_packet_size set
+%%-----------------------------------------------------------------
+max_packet_size_ok_api(doc) ->
+ ["Not exceed the maximum request size"];
+max_packet_size_ok_api(suite) -> [];
+max_packet_size_ok_api(_Config) ->
+ case catch gen_tcp:listen(0, [{packet,cdr}, {packet_size, 14}]) of
+ {'EXIT',badarg} ->
+ {skipped, "The inet option {packet_size, Max} not supported"};
+ {ok, LS} ->
+ (catch gen_tcp:close(LS)),
+ %% --- Create a slave-node ---
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{iiop_packet_size, 5000}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber,
+ iiop_port, []),
+ ?match({'IOP_IOR',_,_},
+ corba:string_to_object("corbaloc::1.2@"++ServerHost++":"++integer_to_list(ServerPort)++"/NameService")),
+ ok
+ end.
+
+
+
+%%-----------------------------------------------------------------
+%% API tests for ORB to ORB, no security
+%%-----------------------------------------------------------------
+
+light_ifr_api(doc) -> ["LIGHT IFR ORB API tests"];
+light_ifr_api(suite) -> [];
+light_ifr_api(_Config) ->
+
+ {ok, ClientNode, _ClientHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, 128}])),
+
+ ?match([_,_,_,_], orber_test_lib:remote_apply(ClientNode, orber, get_tables, [])),
+ ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib,
+ install_test_data,
+ [nameservice])),
+
+
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, 128}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ install_test_data,
+ [nameservice])),
+ ?match([_,_,_,_], orber_test_lib:remote_apply(ServerNode, orber, get_tables, [])),
+
+ Obj = ?match({'IOP_IOR',_,_},
+ corba:string_to_object("corbaname::1.2@"++ServerHost++":"++integer_to_list(ServerPort)++"/NameService#mamba")),
+ ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib, test_coding, [Obj])),
+
+ ?match(0, orber_test_lib:remote_apply(ClientNode, orber_diagnostics, missing_modules, [])),
+
+ ?match(ok, orber_test_lib:remote_apply(ClientNode, mnesia, dirty_write,
+ [#orber_light_ifr{id = "FakeId1",
+ module=non_existing,
+ type=?IFR_StructDef}])),
+ ?match(ok, orber_test_lib:remote_apply(ClientNode, mnesia, dirty_write,
+ [#orber_light_ifr{id = "FakeId2",
+ module=non_existing,
+ type=?IFR_UnionDef}])),
+ ?match(ok, orber_test_lib:remote_apply(ClientNode, mnesia, dirty_write,
+ [#orber_light_ifr{id = "FakeId3",
+ module=non_existing,
+ type=?IFR_ExceptionDef}])),
+ ?match(ok, orber_test_lib:remote_apply(ClientNode, mnesia, dirty_write,
+ [#orber_light_ifr{id = "FakeId4",
+ module=non_existing,
+ type=?IFR_InterfaceDef}])),
+ ?match(ok, orber_test_lib:remote_apply(ClientNode, mnesia, dirty_write,
+ [#orber_light_ifr{id = "FakeId5",
+ module=orber_test_lib,
+ type=?IFR_InterfaceDef}])),
+ ?match(5, orber_test_lib:remote_apply(ClientNode, orber_diagnostics, missing_modules, [])),
+
+
+ ?match(ok, mnesia:dirty_write(#ir_UnionDef{ir_Internal_ID = "FakedIId1",
+ absolute_name="::Module::NonExisting"})),
+ ?match(ok, mnesia:dirty_write(#ir_StructDef{ir_Internal_ID = "FakedIId2",
+ absolute_name="::Module::NonExisting"})),
+ ?match(ok, mnesia:dirty_write(#ir_ExceptionDef{ir_Internal_ID = "FakedIId3",
+ absolute_name="::Module::NonExisting"})),
+ ?match(ok, mnesia:dirty_write(#ir_InterfaceDef{ir_Internal_ID = "FakedIId4",
+ absolute_name="::Module::NonExisting"})),
+ ?match(ok, mnesia:dirty_write(#ir_InterfaceDef{ir_Internal_ID = "FakedIId5",
+ absolute_name="::orber::test::lib"})),
+
+ ?match(5, orber_diagnostics:missing_modules()),
+
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ uninstall_test_data,
+ [nameservice])),
+ ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib,
+ uninstall_test_data,
+ [nameservice])),
+ ok.
+
+%%-----------------------------------------------------------------
+%% API tests for ORB to ORB, no security
+%%-----------------------------------------------------------------
+
+light_orber_api(doc) -> ["LIGHT ORB API tests",
+ "This case test if a light Orber can communicate correctly",
+ "with an fully installed Orber."];
+light_orber_api(suite) -> [];
+light_orber_api(_Config) ->
+ %% --- Create a slave-node ---
+ LocalHost = net_adm:localhost(),
+ {ok, Node, _Host} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{lightweight, ["iiop://"++LocalHost++":"++integer_to_list(orber:iiop_port())]}],
+ lightweight)),
+ ?match(ok, orber:info(io)),
+ ?match([_], orber_test_lib:remote_apply(Node, orber_env, get_lightweight_nodes,[])),
+
+ ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
+ install_test_data,
+ [light])),
+
+ Obj1=(catch orber_test_server:oe_create(state,[{pseudo,true}])),
+ ?match({_,pseudo,orber_test_server_impl, _,_, _}, Obj1),
+ Obj2=(catch orber_test_server:oe_create(state,[])),
+ ?match({_,key,_, _,_, _}, Obj2),
+
+ NS = corba:resolve_initial_references("NameService"),
+ 'CosNaming_NamingContext':bind(NS, lname:new(["mamba"]), Obj1),
+ 'CosNaming_NamingContext':bind(NS, lname:new(["viper"]), Obj2),
+
+ ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
+ light_tests,
+ [LocalHost,
+ orber:iiop_port(), "viper"])),
+ ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
+ light_tests,
+ [LocalHost,
+ orber:iiop_port(), "mamba"])),
+
+ %% Clean up.
+
+ catch corba:dispose(Obj1),
+ catch corba:dispose(Obj2),
+ catch 'CosNaming_NamingContext':destroy(NS),
+
+ ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
+ uninstall_test_data,
+ [light])),
+ ok.
+%%-----------------------------------------------------------------
+%% API tests for ORB to ORB, no security
+%%-----------------------------------------------------------------
+
+light_orber2_api(doc) -> ["LIGHT ORB API tests",
+ "This case test if a light Orber can communicate correctly",
+ "with an fully installed Orber. This case test if we can",
+ "start as lightweight without first setting the environment",
+ "variable"];
+light_orber2_api(suite) -> [];
+light_orber2_api(_Config) ->
+ %% --- Create a slave-node ---
+ LocalHost = net_adm:localhost(),
+ {ok, Node, _Host} =
+ ?match({ok,_,_}, orber_test_lib:js_node([],
+ {lightweigth, ["iiop://"++LocalHost++":"++integer_to_list(orber:iiop_port())]})),
+ ?match(ok, orber:info(io)),
+ ?match([_], orber_test_lib:remote_apply(Node, orber_env, get_lightweight_nodes,[])),
+
+ ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
+ install_test_data,
+ [light])),
+
+ Obj1=(catch orber_test_server:oe_create(state,[{pseudo,true}])),
+ ?match({_,pseudo,orber_test_server_impl, _,_, _}, Obj1),
+ Obj2=(catch orber_test_server:oe_create(state,[])),
+ ?match({_,key,_, _,_, _}, Obj2),
+
+ NS = corba:resolve_initial_references("NameService"),
+ 'CosNaming_NamingContext':bind(NS, lname:new(["mamba"]), Obj1),
+ 'CosNaming_NamingContext':bind(NS, lname:new(["viper"]), Obj2),
+
+ ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
+ light_tests,
+ [LocalHost,
+ orber:iiop_port(), "viper"])),
+ ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
+ light_tests,
+ [LocalHost,
+ orber:iiop_port(), "mamba"])),
+
+ %% Clean up.
+
+ catch corba:dispose(Obj1),
+ catch corba:dispose(Obj2),
+ catch 'CosNaming_NamingContext':destroy(NS),
+
+ ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
+ uninstall_test_data,
+ [light])),
+ ok.
+
+%%-----------------------------------------------------------------
+%% API tests for ORB to ORB, no security
+%%-----------------------------------------------------------------
+
+multi_orber_api(doc) -> ["MULTI ORB API tests",
+ "This case test if data encode/decode (IIOP)",
+ "produce the correct result, i.e., the test_server echos",
+ "the input parameter or an exception is raised (MARSHAL)."];
+multi_orber_api(suite) -> [];
+multi_orber_api(_Config) ->
+
+ NewICObj1 = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([])),
+ NewICObj2 = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([], [{regname, {local, newic2}}])),
+ NewICObj3 = ?match({_,_,_,_,_,_}, orber_test_server:oe_create([], [{regname, {global, newic3}}])),
+ ?match(ok, orber_test_server:print(NewICObj1)),
+ ?match(ok, orber_test_server:print(NewICObj2)),
+ ?match(ok, orber_test_server:print(NewICObj3)),
+ catch corba:dispose(NewICObj1),
+ catch corba:dispose(NewICObj2),
+ catch corba:dispose(NewICObj3),
+
+ %% --- Create a slave-node ---
+ {ok, Node, Host} =
+ ?match({ok,_,_}, orber_test_lib:js_node()),
+ Port = orber_test_lib:remote_apply(Node, orber, iiop_port, []),
+
+ ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
+ install_test_data,
+ [nameservice])),
+
+ NSR = ?match({'IOP_IOR',"IDL:omg.org/CosNaming/NamingContextExt:1.0",_},
+ corba:string_to_object("corbaloc::1.2@"++Host++":"++
+ integer_to_list(Port)++"/NameService")),
+
+ ?match({'EXCEPTION',{'CosNaming_NamingContext_NotFound',_,_,_}},
+ 'CosNaming_NamingContext':resolve(NSR, lname:new(["not_exist"]))),
+
+ Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
+ 'CosNaming_NamingContext':resolve(NSR, lname:new(["mamba"]))),
+ ?match(ok, orber_test_server:print(Obj)),
+
+ Obj12B = ?match({'IOP_IOR',_,_},
+ corba:string_to_object("corbaloc::1.2@"++Host++":"++integer_to_list(Port)++"/Mamba")),
+
+ Obj11B = ?match({'IOP_IOR',_,_},
+ corba:string_to_object("corbaloc::1.1@"++Host++":"++integer_to_list(Port)++"/Mamba")),
+
+ Obj10B = ?match({'IOP_IOR',_,_},
+ corba:string_to_object("corbaloc::1.0@"++Host++":"++integer_to_list(Port)++"/Mamba")),
+
+ context_test(Obj12B),
+ context_test(Obj11B),
+
+ ?match(ok, orber_test_server:print(Obj12B)),
+ ?match(ok, orber_test_server:print(Obj11B)),
+ ?match(ok, orber_test_server:print(Obj10B)),
+ ?match({'EXCEPTION',{'CosNaming_NamingContextExt_InvalidAddress',_}},
+ corba:string_to_object("corbaloc::1.0@"++Host++":"++integer_to_list(Port)++"/Wrong")),
+
+ ?match(ok, orber_test_lib:corba_object_tests(Obj12B, NSR)),
+ ?match(ok, orber_test_lib:corba_object_tests(Obj11B, NSR)),
+ ?match(ok, orber_test_lib:corba_object_tests(Obj10B, NSR)),
+
+ %%--- Testing code and decode arguments ---
+ orber_test_lib:test_coding(Obj),
+
+ ?match({'EXCEPTION',#'BAD_CONTEXT'{}},
+ orber_test_server:
+ print(Obj12B,
+ [{context,
+ [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
+ context_data = {interface,
+ {127,0,0,1}}}]}])),
+
+ ?match({'EXCEPTION',{'TRANSIENT',_,_,_}},
+ orber_test_server:stop_brutal(Obj12B)),
+ ?match({'EXCEPTION',{'TRANSIENT',_,_,_}},
+ orber_test_server:print(Obj12B)),
+
+ ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
+ uninstall_test_data,
+ [nameservice])),
+ ok.
+
+
+%%-----------------------------------------------------------------
+%% API tests for ORB to ORB, no security, using basic interceptors
+%%-----------------------------------------------------------------
+basic_PI_api(doc) -> ["MULTI ORB API tests",
+ "This case test if data encode/decode (IIOP)",
+ "produce the correct result when using basic interceptors,",
+ "i.e., the test_server echos",
+ "the input parameter or an exception is raised (MARSHAL)."];
+basic_PI_api(suite) -> [];
+basic_PI_api(_Config) ->
+ %% Change configuration to use Basic Interceptors.
+ orber:configure_override(interceptors, {native, [orber_test_lib]}),
+ %% --- Create a slave-node ---
+ {ok, Node, Host} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{interceptors, {native, [orber_test_lib]}}])),
+ Port = orber_test_lib:remote_apply(Node, orber, iiop_port, []),
+
+ ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
+ install_test_data,
+ [nameservice])),
+
+ Obj12 = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
+ corba:string_to_object("corbaname::1.2@"++Host++":"++integer_to_list(Port)++"/NameService#mamba")),
+
+ Obj11 = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
+ corba:string_to_object("corbaname::1.1@"++Host++":"++integer_to_list(Port)++"/NameService#mamba")),
+
+ Obj10 = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
+ corba:string_to_object("corbaname::1.0@"++Host++":"++integer_to_list(Port)++"/NameService#mamba")),
+
+ ?match(ok, corba:print_object(Obj12)),
+ ?match(ok, corba:print_object(Obj11, error_report)),
+ ?match(ok, corba:print_object(Obj10, {error_report, "Reason"})),
+
+ ?match(ok, orber_test_server:print(Obj12)),
+ ?match(ok, orber_test_server:print(Obj11)),
+ ?match(ok, orber_test_server:print(Obj10)),
+
+
+ Obj12B = ?match({'IOP_IOR',_,_},
+ corba:string_to_object("corbaloc::1.2@"++Host++":"++integer_to_list(Port)++"/Mamba")),
+
+ Obj11B = ?match({'IOP_IOR',_,_},
+ corba:string_to_object("corbaloc::1.1@"++Host++":"++integer_to_list(Port)++"/Mamba")),
+
+ Obj10B = ?match({'IOP_IOR',_,_},
+ corba:string_to_object("corbaloc::1.0@"++Host++":"++integer_to_list(Port)++"/Mamba")),
+
+ ?match(ok, corba:print_object(Obj12B, info_msg)),
+ ?match(ok, corba:print_object(Obj11B, {info_msg, "Comment"})),
+ ?match([_|_], corba:print_object(Obj10B, string)),
+
+ ?match(ok, orber_test_server:print(Obj12B)),
+ ?match(ok, orber_test_server:print(Obj11B)),
+ ?match(ok, orber_test_server:print(Obj10B)),
+ ?match({'EXCEPTION',{'CosNaming_NamingContextExt_InvalidAddress',_}},
+ corba:string_to_object("corbaloc::1.0@"++Host++":"++integer_to_list(Port)++"/Wrong")),
+
+ ?match(ok, orber_test_lib:alternate_iiop_address(Host, Port)),
+
+ context_test(Obj12B),
+ context_test(Obj11B),
+
+ %%--- Testing code and decode arguments ---
+ orber_test_lib:test_coding(Obj12),
+ orber_test_lib:test_coding(Obj11),
+ orber_test_lib:test_coding(Obj10),
+
+ application:set_env(orber, interceptors, false),
+
+ ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
+ uninstall_test_data,
+ [nameservice])),
+ ok.
+
+
+%%-----------------------------------------------------------------
+%% API tests for ORB to ORB, ssl security depth 1
+%%-----------------------------------------------------------------
+
+ssl_1_multi_orber_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 1)",
+ "This case set up two secure orbs and test if they can",
+ "communicate. The case also test to access one of the",
+ "secure orbs which must raise a NO_PERMISSION exception."];
+ssl_1_multi_orber_api(suite) -> [];
+ssl_1_multi_orber_api(_Config) ->
+ case os:type() of
+ vxworks ->
+ {skipped, "No SSL-support for VxWorks."};
+ _ ->
+ ServerOptions = orber_test_lib:get_options(iiop_ssl, server,
+ 1, [{iiop_ssl_port, 0}]),
+ ClientOptions = orber_test_lib:get_options(iiop_ssl, client,
+ 1, [{iiop_ssl_port, 0}]),
+ ssl_suite(ServerOptions, ClientOptions),
+ ok
+ end.
+
+ssl_1_multi_orber_generation_3_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 1)",
+ "This case set up two secure orbs and test if they can",
+ "communicate. The case also test to access one of the",
+ "secure orbs which must raise a NO_PERMISSION exception."];
+ssl_1_multi_orber_generation_3_api(suite) -> [];
+ssl_1_multi_orber_generation_3_api(_Config) ->
+ case os:type() of
+ vxworks ->
+ {skipped, "No SSL-support for VxWorks."};
+ _ ->
+ case orber_test_lib:ssl_version() of
+ 3 ->
+ ServerOptions = orber_test_lib:get_options(iiop_ssl, server,
+ 1, [{ssl_generation, 3},
+ {iiop_ssl_port, 0}]),
+ ClientOptions = orber_test_lib:get_options(iiop_ssl, client,
+ 1, [{ssl_generation, 3},
+ {iiop_ssl_port, 0}]),
+ ssl_suite(ServerOptions, ClientOptions),
+ ok;
+ _ ->
+ {skipped, "Required SSL generation not available"}
+ end
+ end.
+
+
+%%-----------------------------------------------------------------
+%% API tests for ORB to ORB, ssl security depth 2
+%%-----------------------------------------------------------------
+
+ssl_2_multi_orber_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 2)",
+ "This case set up two secure orbs and test if they can",
+ "communicate. The case also test to access one of the",
+ "secure orbs which must raise a NO_PERMISSION exception."];
+ssl_2_multi_orber_api(suite) -> [];
+ssl_2_multi_orber_api(_Config) ->
+ case os:type() of
+ vxworks ->
+ {skipped, "No SSL-support for VxWorks."};
+ _ ->
+ ServerOptions = orber_test_lib:get_options(iiop_ssl, server,
+ 2, [{iiop_ssl_port, 0}]),
+ ClientOptions = orber_test_lib:get_options(iiop_ssl, client,
+ 2, [{iiop_ssl_port, 0}]),
+ ssl_suite(ServerOptions, ClientOptions),
+ ok
+ end.
+
+ssl_2_multi_orber_generation_3_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 2)",
+ "This case set up two secure orbs and test if they can",
+ "communicate. The case also test to access one of the",
+ "secure orbs which must raise a NO_PERMISSION exception."];
+ssl_2_multi_orber_generation_3_api(suite) -> [];
+ssl_2_multi_orber_generation_3_api(_Config) ->
+ case os:type() of
+ vxworks ->
+ {skipped, "No SSL-support for VxWorks."};
+ _ ->
+ case orber_test_lib:ssl_version() of
+ 3 ->
+ ServerOptions = orber_test_lib:get_options(iiop_ssl, server,
+ 2, [{ssl_generation, 3},
+ {iiop_ssl_port, 0}]),
+ ClientOptions = orber_test_lib:get_options(iiop_ssl, client,
+ 2, [{ssl_generation, 3},
+ {iiop_ssl_port, 0}]),
+ ssl_suite(ServerOptions, ClientOptions),
+ ok;
+ _ ->
+ {skipped, "Required SSL generation not available"}
+ end
+ end.
+%%-----------------------------------------------------------------
+%% API tests for ORB to ORB, ssl security depth 2
+%%-----------------------------------------------------------------
+
+ssl_reconfigure_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 2)",
+ "This case set up two secure orbs and test if they can",
+ "communicate. The case also test to access one of the",
+ "secure orbs which must raise a NO_PERMISSION exception."];
+ssl_reconfigure_api(suite) -> [];
+ssl_reconfigure_api(_Config) ->
+ ssl_reconfigure([]).
+
+ssl_reconfigure_generation_3_api(doc) -> ["SECURE MULTI ORB API tests (SSL depth 2)",
+ "This case set up two secure orbs and test if they can",
+ "communicate. The case also test to access one of the",
+ "secure orbs which must raise a NO_PERMISSION exception."];
+ssl_reconfigure_generation_3_api(suite) -> [];
+ssl_reconfigure_generation_3_api(_Config) ->
+ case orber_test_lib:ssl_version() of
+ 3 ->
+ ssl_reconfigure([{ssl_generation, 3}]);
+
+ _ ->
+ {skipped, "Required SSL generation not available"}
+ end.
+
+ssl_reconfigure(ExtraSSLOptions) ->
+ case os:type() of
+ vxworks ->
+ {skipped, "No SSL-support for VxWorks."};
+ _ ->
+ IP = orber_test_lib:get_host(),
+ Loopback = orber_test_lib:get_loopback_interface(),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_},
+ orber_test_lib:js_node([{iiop_port, 0},
+ {flags, ?ORB_ENV_LOCAL_INTERFACE},
+ {ip_address, IP}|ExtraSSLOptions])),
+ orber_test_lib:remote_apply(ServerNode, ssl, start, []),
+ orber_test_lib:remote_apply(ServerNode, crypto, start, []),
+ orber_test_lib:remote_apply(ServerNode, ssl, seed, ["testing"]),
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ install_test_data,
+ [ssl])),
+ ?match({ok, _},
+ orber_test_lib:remote_apply(ServerNode, orber,
+ add_listen_interface,
+ [Loopback, normal, [{iiop_port, 5648},
+ {iiop_ssl_port, 5649},
+ {interceptors, {native, [orber_iiop_tracer_silent]}}|ExtraSSLOptions]])),
+ ServerOptions = orber_test_lib:get_options(iiop_ssl, server,
+ 2, [{flags, ?ORB_ENV_LOCAL_INTERFACE},
+ {iiop_port, 5648},
+ {iiop_ssl_port, 5649},
+ {interceptors, {native, [orber_iiop_tracer_silent]}}|ExtraSSLOptions]),
+ ?match({ok, _},
+ orber_test_lib:remote_apply(ServerNode, orber,
+ add_listen_interface,
+ [Loopback, ssl, ServerOptions])),
+
+ ClientOptions = orber_test_lib:get_options(iiop_ssl, client,
+ 2, [{iiop_ssl_port, 0}|ExtraSSLOptions]),
+ {ok, ClientNode, _ClientHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node(ClientOptions)),
+
+ ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib,
+ install_test_data,
+ [ssl])),
+ orber_test_lib:remote_apply(ClientNode, ssl, start, []),
+ orber_test_lib:remote_apply(ServerNode, crypto, start, []),
+ orber_test_lib:remote_apply(ClientNode, ssl, seed, ["testing"]),
+ Obj = ?match(#'IOP_IOR'{},
+ orber_test_lib:remote_apply(ClientNode, corba,
+ string_to_object, ["corbaname:iiop:1.1@"++Loopback++":5648/NameService#mamba",
+ [{context, [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
+ context_data = {configuration, ClientOptions}}]}]])),
+ ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_server,
+ print, [Obj])),
+
+ ok
+ end.
+
+
+
+%%-----------------------------------------------------------------
+%% API tests for Orber to Java ORB, no security
+%%-----------------------------------------------------------------
+
+%orber_java_api(doc) -> ["ERLANG-ORB <-> JAVA-ORB API tests",
+% "This case test if data encode/decode (IIOP)",
+% "produce the correct result, i.e., the test_server echos",
+% "the input parameter or an exception is raised (MARSHAL)."];
+%orber_java_api(suite) -> [];
+%orber_java_api(Config) ->
+% ok.
+
+%%------------------------------------------------------------
+%% function : ssl_suite
+%% Arguments: Config
+%% Depth
+%% Returns : ok
+%% Effect :
+%%------------------------------------------------------------
+
+ssl_suite(ServerOptions, ClientOptions) ->
+
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node(ServerOptions)),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ SSLServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_ssl_port, []),
+
+ {ok, ClientNode, _ClientHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node(ClientOptions)),
+
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ install_test_data,
+ [ssl])),
+ %% Tell the client to interoperate with the server. The purpose of this
+ %% operation is to look up, using NameService, an object reference and
+ %% use it to contact the object.
+ ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib,
+ lookup,
+ [ServerHost, ServerPort])),
+
+ ?match(ok, orber_test_lib:remote_apply(ClientNode, orber_test_lib,
+ alternate_ssl_iiop_address,
+ [ServerHost, ServerPort, SSLServerPort])),
+
+ %% 'This' node is not secure. Contact the server. Must refuse connection.
+ NSR = ?match({'IOP_IOR',"IDL:omg.org/CosNaming/NamingContextExt:1.0",_},
+ corba:string_to_object("corbaloc::1.2@"++ServerHost++":"++
+ integer_to_list(ServerPort)++"/NameService")),
+
+ %% Should be 'NO_PERMISSION'??
+ ?match({'EXCEPTION',{'COMM_FAILURE',_,_,_}},
+ 'CosNaming_NamingContext':resolve(NSR, lname:new(["not_exist"]))),
+
+ %% Should be 'NO_PERMISSION'??
+ ?match({'EXCEPTION',{'COMM_FAILURE',_,_,_}},
+ 'CosNaming_NamingContext':resolve(NSR, lname:new(["mamba"]))),
+
+ %% Uninstall.
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ uninstall_test_data,
+ [ssl])),
+ ok.
+
+%%-----------------------------------------------------------------
+%% iiop_setup_connection_timeout API tests for ORB to ORB.
+%%-----------------------------------------------------------------
+setup_connection_timeout_api(doc) -> ["iiop_setup_connection_timeout API tests for ORB to ORB."];
+setup_connection_timeout_api(suite) -> [];
+setup_connection_timeout_api(_Config) ->
+ ?match(ok, application:set_env(orber, iiop_backlog, 0)),
+ %% Wait to be sure that the configuration has kicked in.
+ timer:sleep(2000),
+ {ok, Ref, Port} = create_fake_server_ORB(normal, 0, [], listen, []),
+ ?match(ok, orber:configure(iiop_setup_connection_timeout, 5)),
+ ?match(ok, orber:info(io)),
+ IP = orber_test_lib:get_host(),
+ spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
+ spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
+ spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
+ spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
+ spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
+ timer:sleep(2000),
+ Corbaloc = "corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService",
+ ?match({'EXCEPTION', _E}, corba:string_to_object(Corbaloc)),
+ destroy_fake_ORB(Ref),
+ ?match(ok, application:set_env(orber, iiop_backlog, 5)),
+ ok.
+
+%%-----------------------------------------------------------------
+%% iiop_setup_connection_timeout API tests for ORB to ORB.
+%%-----------------------------------------------------------------
+setup_multi_connection_timeout_api(doc) ->
+ ["iiop_multi_setup_connection_timeout API tests for ORB to ORB."];
+setup_multi_connection_timeout_api(suite) -> [];
+setup_multi_connection_timeout_api(_Config) ->
+ ?match(ok, application:set_env(orber, iiop_backlog, 0)),
+ %% Wait to be sure that the configuration has kicked in.
+ timer:sleep(2000),
+ {ok, Ref, Port} = create_fake_server_ORB(normal, 0, [], listen, []),
+ ?match(ok, application:set_env(orber, iiop_out_ports, {6042, 6234})),
+ ?match(ok, orber:configure(iiop_setup_connection_timeout, 5)),
+ ?match(ok, orber:info(io)),
+ IP = orber_test_lib:get_host(),
+ spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
+ spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
+ spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
+ spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
+ spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
+ Corbaloc = "corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService",
+ timer:sleep(2000),
+ ?match({'EXCEPTION', _E}, corba:string_to_object(Corbaloc)),
+ destroy_fake_ORB(Ref),
+ ?match(ok, application:set_env(orber, iiop_backlog, 5)),
+ ?match(ok, application:set_env(orber, iiop_out_ports, undefined)),
+ ok.
+
+setup_multi_connection_timeout_attempts_api(doc) ->
+ ["iiop_multi_setup_connection_timeout API tests for ORB to ORB."];
+setup_multi_connection_timeout_attempts_api(suite) -> [];
+setup_multi_connection_timeout_attempts_api(_Config) ->
+ ?match(ok, application:set_env(orber, iiop_backlog, 0)),
+ %% Wait to be sure that the configuration has kicked in.
+ timer:sleep(2000),
+ {ok, Ref, Port} = create_fake_server_ORB(normal, 0, [], listen, []),
+ ?match(ok, application:set_env(orber, iiop_out_ports, {6042, 6234})),
+ ?match(ok, application:set_env(orber, iiop_out_ports_attempts, 1)),
+ ?match(ok, orber:configure(iiop_setup_connection_timeout, 5)),
+ ?match(ok, orber:info(io)),
+ IP = orber_test_lib:get_host(),
+ spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
+ spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
+ spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
+ spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
+ spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
+ Corbaloc = "corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService",
+ timer:sleep(2000),
+ ?match({'EXCEPTION', _E}, corba:string_to_object(Corbaloc)),
+ destroy_fake_ORB(Ref),
+ ?match(ok, application:set_env(orber, iiop_backlog, 5)),
+ ?match(ok, application:set_env(orber, iiop_out_ports, undefined)),
+ ok.
+
+setup_multi_connection_timeout_random_api(doc) ->
+ ["iiop_multi_setup_connection_timeout API tests for ORB to ORB."];
+setup_multi_connection_timeout_random_api(suite) -> [];
+setup_multi_connection_timeout_random_api(_Config) ->
+ ?match(ok, application:set_env(orber, iiop_backlog, 0)),
+ %% Wait to be sure that the configuration has kicked in.
+ timer:sleep(2000),
+ {ok, Ref, Port} = create_fake_server_ORB(normal, 0, [], listen, []),
+ ?match(ok, application:set_env(orber, iiop_out_ports, {6042, 6234})),
+ ?match(ok, application:set_env(orber, iiop_out_ports_random, true)),
+ ?match(ok, orber:configure(iiop_setup_connection_timeout, 5)),
+ ?match(ok, orber:info(io)),
+ IP = orber_test_lib:get_host(),
+ spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
+ spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
+ spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
+ spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
+ spawn(?MODULE, do_connect, [IP, Port, [{active, false}]]),
+ Corbaloc = "corbaloc::1.2@"++IP++":"++integer_to_list(Port)++"/NameService",
+ timer:sleep(2000),
+ ?match({'EXCEPTION', _E}, corba:string_to_object(Corbaloc)),
+ destroy_fake_ORB(Ref),
+ ?match(ok, application:set_env(orber, iiop_backlog, 5)),
+ ?match(ok, application:set_env(orber, iiop_out_ports, undefined)),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Sending an incorrect header to the server-side ORB.
+%%-----------------------------------------------------------------
+bad_giop_header_api(doc) -> ["Sending an incorrect header to the server-side ORB."];
+bad_giop_header_api(suite) -> [];
+bad_giop_header_api(_Config) ->
+ orber:configure_override(interceptors, {native,[orber_iiop_tracer]}),
+ orber:configure(orber_debug_level, 10),
+ ?match(ok, orber:info(io)),
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node()),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ Req = <<"GIOP",1,2,0,100,0,0,0,5,0,0,0,10,50>> ,
+ ?match(ok, fake_client_ORB(normal, ServerHost, ServerPort, [],
+ message_error, [Req])),
+
+ application:set_env(orber, interceptors, false),
+ orber:configure(orber_debug_level, 0),
+ ok.
+
+
+%%-----------------------------------------------------------------
+%% Fragmented IIOP tests (Server-side).
+%%-----------------------------------------------------------------
+-define(REQUEST_ID, 0).
+
+-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>>).
+%% The fragments are identical for requests and replies.
+-define(FRAG_2, <<71,73,79,80,1,2,2,7,0,0,0,5,0,0,0,?REQUEST_ID,50>>).
+-define(FRAG_3, <<71,73,79,80,1,2,2,7,0,0,0,5,0,0,0,?REQUEST_ID,51>>).
+-define(FRAG_4, <<71,73,79,80,1,2,0,7,0,0,0,5,0,0,0,?REQUEST_ID,0>>).
+
+
+fragments_server_api(doc) -> ["fragments API tests for server-side ORB."];
+fragments_server_api(suite) -> [];
+fragments_server_api(_Config) ->
+ %% --- Create a slave-node ---
+ {ok, Node, Host} =
+ ?match({ok,_,_}, orber_test_lib:js_node()),
+ Port = orber_test_lib:remote_apply(Node, orber, iiop_port, []),
+
+ ?match(ok, orber_test_lib:remote_apply(Node, orber_test_lib,
+ install_test_data,
+ [nameservice])),
+
+ NSR = ?match({'IOP_IOR',"IDL:omg.org/CosNaming/NamingContextExt:1.0",_},
+ corba:string_to_object("corbaloc::1.2@"++Host++":"++
+ integer_to_list(Port)++"/NameService")),
+
+ Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
+ 'CosNaming_NamingContext':resolve(NSR, lname:new(["mamba"]))),
+
+ Any = #any{typecode = {tk_string,0},
+ value = "123"},
+ Target = #'GIOP_TargetAddress'{label = ?GIOP_KeyAddr,
+ value = iop_ior:get_objkey(Obj)},
+ %% Fix a request header.
+ {Hdr, Body, HdrLen, _What, _Flags} =
+ cdr_encode:enc_request_split(
+ #giop_env{version = {1,2}, objkey = Target,
+ request_id = ?REQUEST_ID,
+ response_expected = true,
+ op = testing_iiop_any,
+ parameters = [49], ctx = [],
+ tc = {tk_void,[tk_char],[]},
+ host = [orber_test_lib:get_host()],
+ iiop_port = orber:iiop_port(),
+ iiop_ssl_port = orber:iiop_ssl_port(),
+ domain = orber:domain(),
+ partial_security = orber:partial_security()}),
+ NewBody =
+ case size(Body) of
+ 1 ->
+ <<0,0,0,18,0,0,0,0,0,0,0,4,49>> ;
+ Size ->
+ Aligned = Size -1,
+ <<AligmnetData:Aligned/binary,49>> = Body,
+ list_to_binary([AligmnetData, <<0,0,0,18,0,0,0,0,0,0,0,4,49>> ])
+ end,
+
+ MessSize = HdrLen+size(NewBody),
+ ReqFrag = list_to_binary([ <<"GIOP",1:8,2:8,2:8,0:8,
+ MessSize:32/big-unsigned-integer>> , Hdr |NewBody]),
+ ?match(Any, fake_client_ORB(normal, Host, Port, [], fragments,
+ [ReqFrag, ?FRAG_2, ?FRAG_3, ?FRAG_4])),
+
+ ok.
+
+%%-----------------------------------------------------------------
+%% Fragmented IIOP tests (Server-side). Exceeding Maximum.
+%%-----------------------------------------------------------------
+fragments_max_server_api(doc) -> ["Maximum fragments API tests for server-side ORB."];
+fragments_max_server_api(suite) -> [];
+fragments_max_server_api(_Config) ->
+ %% --- Create a slave-node ---
+ IP = orber_test_lib:get_host(),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{iiop_max_fragments, 2},
+ {ip_address, IP}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ fragments_max_server(ServerNode, IP, ServerPort).
+
+fragments_max_server_added_api(doc) -> ["Maximum fragments API tests for server-side ORB."];
+fragments_max_server_added_api(suite) -> [];
+fragments_max_server_added_api(_Config) ->
+ %% --- Create a slave-node ---
+ IP = orber_test_lib:get_host(),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([])),
+ ServerPort = 1 + orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ ?match({ok, _},
+ orber_test_lib:remote_apply(ServerNode, orber,
+ add_listen_interface,
+ [IP, normal,
+ [{iiop_max_fragments, 2},
+ {flags, ?ORB_ENV_LOCAL_INTERFACE},
+ {iiop_port, ServerPort}]])),
+ fragments_max_server(ServerNode, IP, ServerPort).
+
+fragments_max_server(ServerNode, ServerHost, ServerPort) ->
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ install_test_data,
+ [nameservice])),
+ Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
+ corba:string_to_object("corbaname::1.2@"++ServerHost++":"++
+ integer_to_list(ServerPort)++"/NameService#mamba")),
+ Target = #'GIOP_TargetAddress'{label = ?GIOP_KeyAddr,
+ value = iop_ior:get_objkey(Obj)},
+ %% Fix a request header.
+ {Hdr, Body, HdrLen, _What, _Flags} =
+ cdr_encode:enc_request_split(
+ #giop_env{version = {1,2},
+ objkey = Target,
+ request_id = ?REQUEST_ID,
+ response_expected = true,
+ op = testing_iiop_any,
+ parameters = [49], ctx = [],
+ tc = {tk_void,[tk_char],[]},
+ host = [orber_test_lib:get_host()],
+ iiop_port = orber:iiop_port(),
+ iiop_ssl_port = orber:iiop_ssl_port(),
+ domain = orber:domain(),
+ partial_security = orber:partial_security()}),
+ NewBody =
+ case size(Body) of
+ 1 ->
+ <<0,0,0,18,0,0,0,0,0,0,0,4,49>> ;
+ Size ->
+ Aligned = Size -1,
+ <<AligmnetData:Aligned/binary,49>> = Body,
+ list_to_binary([AligmnetData, <<0,0,0,18,0,0,0,0,0,0,0,4,49>> ])
+ end,
+
+ MessSize = HdrLen+size(NewBody),
+ ReqFrag = list_to_binary([ <<"GIOP",1:8,2:8,2:8,0:8,
+ MessSize:32/big-unsigned-integer>> , Hdr |NewBody]),
+ ?match(#'IMP_LIMIT'{},
+ fake_client_ORB(normal, ServerHost, ServerPort, [], fragments_max,
+ [ReqFrag, ?FRAG_2, ?FRAG_3, ?FRAG_4])),
+
+ ok.
+
+%%-----------------------------------------------------------------
+%% Fragmented IIOP tests (Client-side).
+%%-----------------------------------------------------------------
+fragments_client_api(doc) -> ["fragments API tests for client-side ORB."];
+fragments_client_api(suite) -> [];
+fragments_client_api(_Config) ->
+ Any = #any{typecode = {tk_string,0},
+ value = "123"},
+ application:set_env(orber, interceptors, {native,[orber_iiop_tracer]}),
+ orber:configure(orber_debug_level, 10),
+ orber:info(),
+ IOR = ?match({'IOP_IOR',_,_},
+ iop_ior:create_external({1, 2}, "IDL:FAKE:1.0",
+ "localhost", 6004, "FAKE", [])),
+ spawn(?MODULE, create_fake_server_ORB, [normal, 6004, [], fragments,
+ [?REPLY_FRAG_1, ?FRAG_2,
+ ?FRAG_3, ?FRAG_4]]),
+ ?match({ok, Any}, orber_test_server:testing_iiop_any(IOR, Any)),
+ application:set_env(orber, interceptors, false),
+ orber:configure(orber_debug_level, 0),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Fragmented IIOP tests (Client-side).
+%%-----------------------------------------------------------------
+bad_fragment_id_client_api(doc) -> ["fragments API tests for client-side ORB."];
+bad_fragment_id_client_api(suite) -> [];
+bad_fragment_id_client_api(_Config) ->
+ application:set_env(orber, interceptors, {native,[orber_iiop_tracer]}),
+ orber:configure(orber_debug_level, 10),
+ orber:info(),
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node()),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ Req = <<71,73,79,80,1,2,2,7,0,0,0,5,0,0,0,100,50>> ,
+ ?match(ok, fake_client_ORB(normal, ServerHost, ServerPort, [],
+ message_error, [Req])),
+
+ application:set_env(orber, interceptors, false),
+ orber:configure(orber_debug_level, 0),
+
+ ok.
+
+%%-----------------------------------------------------------------
+%% Non-existing request id
+%%-----------------------------------------------------------------
+bad_id_cancel_request_api(doc) -> ["Description", "more description"];
+bad_id_cancel_request_api(suite) -> [];
+bad_id_cancel_request_api(Config) when is_list(Config) ->
+ Req10 = cdr_encode:enc_cancel_request(#giop_env{version = {1, 0},
+ request_id = 556}),
+ Req11 = cdr_encode:enc_cancel_request(#giop_env{version = {1, 1},
+ request_id = 556}),
+ Req12 = cdr_encode:enc_cancel_request(#giop_env{version = {1, 2},
+ request_id = 556}),
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node()),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ ?match(ok, fake_client_ORB(normal, ServerHost, ServerPort, [],
+ message_error, [Req10])),
+ ?match(ok, fake_client_ORB(normal, ServerHost, ServerPort, [],
+ message_error, [Req11])),
+ ?match(ok, fake_client_ORB(normal, ServerHost, ServerPort, [],
+ message_error, [Req12])),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Local functions.
+%%-----------------------------------------------------------------
+
+do_connect(Host, Port, Options) ->
+ gen_tcp:connect(Host, Port, Options),
+ timer:sleep(20000).
+
+pseudo_calls(0, _) ->
+ ok;
+pseudo_calls(Times, Obj) ->
+ orber_test_server:pseudo_call(Obj),
+ New = Times - 1,
+ pseudo_calls(New, Obj).
+pseudo_casts(0, _) ->
+ ok;
+pseudo_casts(Times, Obj) ->
+ orber_test_server:pseudo_cast(Obj),
+ New = Times - 1,
+ pseudo_casts(New, Obj).
+
+context_test(Obj) ->
+ CodeSetCtx = #'CONV_FRAME_CodeSetContext'{char_data = 65537,
+ wchar_data = 65801},
+ FTGrp = #'FT_FTGroupVersionServiceContext'{object_group_ref_version = ?ULONGMAX},
+ FTReq = #'FT_FTRequestServiceContext'{client_id = "ClientId",
+ retention_id = ?LONGMAX,
+ expiration_time = ?ULONGLONGMAX},
+
+ IDToken1 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTAbsent,
+ value = true},
+ IDToken2 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTAnonymous,
+ value = false},
+ IDToken3 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTPrincipalName,
+ value = [0,255]},
+ IDToken4 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTX509CertChain,
+ value = [1,255]},
+ IDToken5 = #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTDistinguishedName,
+ value = [2,255]},
+ IDToken6 = #'CSI_IdentityToken'{label = ?ULONGMAX,
+ value = [3,255]},
+
+ MTEstablishContext1 = #'CSI_SASContextBody'
+ {label = ?CSI_MsgType_MTEstablishContext,
+ value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX,
+ authorization_token =
+ [#'CSI_AuthorizationElement'
+ {the_type = ?ULONGMAX,
+ the_element = [0,255]}],
+ identity_token = IDToken1,
+ client_authentication_token = [1, 255]}},
+ MTEstablishContext2 = #'CSI_SASContextBody'
+ {label = ?CSI_MsgType_MTEstablishContext,
+ value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX,
+ authorization_token =
+ [#'CSI_AuthorizationElement'
+ {the_type = ?ULONGMAX,
+ the_element = [0,255]}],
+ identity_token = IDToken2,
+ client_authentication_token = [1, 255]}},
+ MTEstablishContext3 = #'CSI_SASContextBody'
+ {label = ?CSI_MsgType_MTEstablishContext,
+ value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX,
+ authorization_token =
+ [#'CSI_AuthorizationElement'
+ {the_type = ?ULONGMAX,
+ the_element = [0,255]}],
+ identity_token = IDToken3,
+ client_authentication_token = [1, 255]}},
+ MTEstablishContext4 = #'CSI_SASContextBody'
+ {label = ?CSI_MsgType_MTEstablishContext,
+ value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX,
+ authorization_token =
+ [#'CSI_AuthorizationElement'
+ {the_type = ?ULONGMAX,
+ the_element = [0,255]}],
+ identity_token = IDToken4,
+ client_authentication_token = [1, 255]}},
+ MTEstablishContext5 = #'CSI_SASContextBody'
+ {label = ?CSI_MsgType_MTEstablishContext,
+ value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX,
+ authorization_token =
+ [#'CSI_AuthorizationElement'
+ {the_type = ?ULONGMAX,
+ the_element = [0,255]}],
+ identity_token = IDToken5,
+ client_authentication_token = [1, 255]}},
+ MTEstablishContext6 = #'CSI_SASContextBody'
+ {label = ?CSI_MsgType_MTEstablishContext,
+ value = #'CSI_EstablishContext'{client_context_id = ?ULONGLONGMAX,
+ authorization_token =
+ [#'CSI_AuthorizationElement'
+ {the_type = ?ULONGMAX,
+ the_element = [0,255]}],
+ identity_token = IDToken6,
+ client_authentication_token = [1, 255]}},
+ MTCompleteEstablishContext = #'CSI_SASContextBody'
+ {label = ?CSI_MsgType_MTCompleteEstablishContext,
+ value = #'CSI_CompleteEstablishContext'{client_context_id = ?ULONGLONGMAX,
+ context_stateful = false,
+ final_context_token = [1, 255]}},
+ MTContextError = #'CSI_SASContextBody'
+ {label = ?CSI_MsgType_MTContextError,
+ value = #'CSI_ContextError'{client_context_id = ?ULONGLONGMAX,
+ major_status = 1,
+ minor_status = 2,
+ error_token = [2,255]}},
+ MTMessageInContext = #'CSI_SASContextBody'
+ {label = ?CSI_MsgType_MTMessageInContext,
+ value = #'CSI_MessageInContext'{client_context_id = ?ULONGLONGMAX,
+ discard_context = true}},
+ Ctx = [#'IOP_ServiceContext'{context_id=?IOP_CodeSets,
+ context_data = CodeSetCtx},
+ #'IOP_ServiceContext'{context_id=?IOP_FT_GROUP_VERSION,
+ context_data = FTGrp},
+ #'IOP_ServiceContext'{context_id=?IOP_FT_REQUEST,
+ context_data = FTReq},
+ #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
+ context_data = MTEstablishContext1},
+ #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
+ context_data = MTEstablishContext2},
+ #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
+ context_data = MTEstablishContext3},
+ #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
+ context_data = MTEstablishContext4},
+ #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
+ context_data = MTEstablishContext5},
+ #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
+ context_data = MTEstablishContext6},
+ #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
+ context_data = MTCompleteEstablishContext},
+ #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
+ context_data = MTContextError},
+ #'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService,
+ context_data = MTMessageInContext},
+ #'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID,
+ context_data = {any_kind_of_data, {127,0,0,1}, 4001}}],
+ ?match(ok, orber_test_server:testing_iiop_context(Obj, [{context, Ctx}])).
+
+
+create_fake_server_ORB(Type, Port, Options, listen, _Data) ->
+ {ok, _ListenSocket, NewPort} =
+ orber_socket:listen(Type, Port,
+ [{backlog, 0}, {active, false}|Options]),
+ Socket = orber_socket:connect(Type, 'localhost', NewPort, [{active, false}|Options]),
+ {ok, {Type, Socket}, NewPort};
+create_fake_server_ORB(Type, Port, Options, Action, Data) ->
+ {ok, ListenSocket, _NewPort} =
+ orber_socket:listen(Type, Port, [{active, false}|Options]),
+ Socket = orber_socket:accept(Type, ListenSocket),
+ do_server_action(Type, Socket, Action, Data),
+ orber_socket:close(Type, Socket),
+ ok.
+
+destroy_fake_ORB({Type, Socket}) ->
+ orber_socket:close(Type, Socket);
+destroy_fake_ORB(_) ->
+ ok.
+
+fake_client_ORB(Type, Host, Port, Options, connect, _Data) ->
+ Socket = orber_socket:connect(Type, Host, Port, [{active, false}|Options]),
+ {Type, Socket};
+fake_client_ORB(Type, Host, Port, Options, Action, Data) ->
+ Socket = orber_socket:connect(Type, Host, Port, [{active, false}|Options]),
+ Result = do_client_action(Type, Socket, Action, Data),
+ orber_socket:close(Type, Socket),
+ Result.
+
+
+
+do_server_action(Type, Socket, fragments, FragList) ->
+ timer:sleep(3000),
+ {ok, _B} = gen_tcp:recv(Socket, 0),
+ ok = send_data(Type, Socket, FragList);
+do_server_action(_Type, _Socket, _Action, _Data) ->
+ ok.
+
+do_client_action(Type, Socket, fragments, FragList) ->
+ ok = send_data(Type, Socket, FragList),
+ timer:sleep(3000),
+ {ok, Bytes} = gen_tcp:recv(Socket, 0),
+ {#reply_header{request_id = ?REQUEST_ID, reply_status = no_exception}, ok, [Par]} =
+ cdr_decode:dec_message({tk_void,[tk_any],[tk_any]}, Bytes),
+ Par;
+do_client_action(Type, Socket, fragments_max, FragList) ->
+ ok = send_data(Type, Socket, FragList),
+ timer:sleep(3000),
+ {ok, Bytes} = gen_tcp:recv(Socket, 0),
+ {#reply_header{request_id = ?REQUEST_ID, reply_status = system_exception}, Exc, []} =
+ cdr_decode:dec_message({tk_void,[tk_any],[tk_any]}, Bytes),
+ Exc;
+do_client_action(Type, Socket, message_error, Data) ->
+ ok = send_data(Type, Socket, Data),
+ timer:sleep(3000),
+ {ok,Bytes} = gen_tcp:recv(Socket, 0),
+ 'message_error' = cdr_decode:dec_message({tk_void,[tk_any],[tk_any]}, Bytes),
+ ok;
+do_client_action(_Type, _Socket, _Action, _Data) ->
+ ok.
+
+send_data(_Type, _Socket, []) ->
+ ok;
+send_data(Type, Socket, [H|T]) ->
+ orber_socket:write(Type, Socket, H),
+ send_data(Type, Socket, T).
+
diff --git a/lib/orber/test/naming_context_SUITE.erl b/lib/orber/test/naming_context_SUITE.erl
new file mode 100644
index 0000000000..4406e01d5a
--- /dev/null
+++ b/lib/orber/test/naming_context_SUITE.erl
@@ -0,0 +1,385 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%-----------------------------------------------------------------
+%%
+%% Description:
+%% Test suite for Name service
+%%
+%%-----------------------------------------------------------------
+-module(naming_context_SUITE).
+
+-include("test_server.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming.hrl").
+-include_lib("orber/src/orber_iiop.hrl").
+-include_lib("orber/include/corba.hrl").
+
+-define(default_timeout, ?t:minutes(5)).
+
+%%-----------------------------------------------------------------
+%% External exports
+%%-----------------------------------------------------------------
+-export([all/1]).
+
+%%-----------------------------------------------------------------
+%% Internal exports
+%%-----------------------------------------------------------------
+
+-export([name_context/1, check_list/1, name_context_ext/1]).
+
+-export([init_all/1, finish_all/1, init_per_testcase/2, fin_per_testcase/2]).
+
+
+%%-----------------------------------------------------------------
+%% Macros
+%%-----------------------------------------------------------------
+-define(REMAP_EXCEPT(F), case catch F of
+ {'EXCEPTION', E} -> exit(E);
+ {'EXIT', E} -> exit(E);
+ R -> R
+ end).
+
+-define(match(ExpectedRes, Expr),
+ fun() ->
+ AcTuAlReS = (catch (Expr)),
+ case AcTuAlReS of
+ ExpectedRes ->
+ io:format("------ CORRECT RESULT ------~n~p~n",
+ [AcTuAlReS]),
+ AcTuAlReS;
+ _ ->
+ io:format("###### ERROR ERROR ######~n~p~n",
+ [AcTuAlReS]),
+ ?line exit(AcTuAlReS)
+ end
+ end()).
+
+%%-----------------------------------------------------------------
+%% Func: all/1
+%% Args:
+%% Returns:
+%%-----------------------------------------------------------------
+all(doc) -> ["Description", "more description"];
+all(suite) -> {req,
+ [mnesia],
+ {conf, init_all, cases(), finish_all}}.
+
+cases() ->
+ [name_context, check_list, name_context_ext].
+
+%%-----------------------------------------------------------------
+%% Init and cleanup functions.
+%%-----------------------------------------------------------------
+
+init_per_testcase(_Case, Config) ->
+ Path = code:which(?MODULE),
+ code:add_pathz(filename:join(filename:dirname(Path), "idl_output")),
+ ?line Dog=test_server:timetrap(?default_timeout),
+ orber:jump_start(0),
+ [{watchdog, Dog}|Config].
+
+
+fin_per_testcase(_Case, Config) ->
+ Path = code:which(?MODULE),
+ code:del_path(filename:join(filename:dirname(Path), "idl_output")),
+ orber:jump_stop(),
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+init_all(Config) ->
+ Config.
+
+finish_all(Config) ->
+ Config.
+
+%%-----------------------------------------------------------------
+%% Test Case: name handling tests
+%% Description:
+%%-----------------------------------------------------------------
+name_context(doc) -> ["Description", "more description"];
+name_context(suite) -> [];
+name_context(_) ->
+ ?REMAP_EXCEPT(name_context_run()).
+
+name_context_run() ->
+ ?line Ns = corba:resolve_initial_references("NameService"),
+
+ ?match({'EXCEPTION', #'NO_PERMISSION'{}},
+ 'CosNaming_NamingContextExt':destroy(Ns)),
+
+ %% Create a test context.
+ ?line Tc = 'CosNaming_NamingContext':bind_new_context(Ns,
+ [#'CosNaming_NameComponent'{id="testcontext",
+ kind=""}]),
+ %% Start testing
+ ?line 'CosNaming_NamingContext':bind(Tc, [#'CosNaming_NameComponent'
+ {id="hej",
+ kind=""}], Ns),
+ ?line Ns = 'CosNaming_NamingContext':resolve(Tc,
+ [#'CosNaming_NameComponent'{id="hej",
+ kind=""}]),
+ ?line Nc = 'CosNaming_NamingContext':new_context(Tc),
+ ?line 'CosNaming_NamingContext':bind(Tc, [#'CosNaming_NameComponent'
+ {id="stop",
+ kind=""}], Nc),
+ ?line Nc = 'CosNaming_NamingContext':resolve(Tc,
+ [#'CosNaming_NameComponent'{id="stop",
+ kind=""}]),
+ ?line {'EXCEPTION', E0} =
+ (catch 'CosNaming_NamingContext':bind(Tc,
+ [#'CosNaming_NameComponent'{id="stop",
+ kind=""}], Ns)),
+ ?line ok = 'CosNaming_NamingContext':rebind(Tc,
+ [#'CosNaming_NameComponent'{id="stop",
+ kind=""}], Ns),
+ ?line {'CosNaming_NamingContext_AlreadyBound', _} = E0,
+ ?line 'CosNaming_NamingContext':bind_context(Tc,
+ [#'CosNaming_NameComponent'{id="evaluate",
+ kind=""}], Nc),
+ ?line Nc =
+ 'CosNaming_NamingContext':resolve(Tc,
+ [#'CosNaming_NameComponent'{id="evaluate",
+ kind=""}]),
+ ?line 'CosNaming_NamingContext':bind(Tc,
+ [#'CosNaming_NameComponent'{id="evaluate",
+ kind=""},
+ #'CosNaming_NameComponent'{id="hej",
+ kind=""}], Ns),
+ ?line ok = 'CosNaming_NamingContext':rebind(Tc,
+ [#'CosNaming_NameComponent'{id="evaluate",
+ kind=""},
+ #'CosNaming_NameComponent'{id="hej",
+ kind=""}], Ns),
+ ?line Ns = 'CosNaming_NamingContext':resolve(Tc,
+ [#'CosNaming_NameComponent'{id="evaluate",
+ kind=""},
+ #'CosNaming_NameComponent'{id="hej",
+ kind=""}]),
+ ?line {'EXCEPTION', E1} =
+ (catch 'CosNaming_NamingContext':resolve(Tc,
+ [#'CosNaming_NameComponent'{id="stop",
+ kind=""},
+ #'CosNaming_NameComponent'{id="hej",
+ kind=""}])),
+ ?line ?match(ok, orber_diagnostics:nameservice()),
+
+ ?line {'CosNaming_NamingContext_CannotProceed', _,_,_} = E1,
+ ?line {'EXCEPTION', E2} = (catch 'CosNaming_NamingContext':destroy(Nc)),
+ ?line {'CosNaming_NamingContext_NotEmpty', _} = E2,
+ ?line ok = 'CosNaming_NamingContext':unbind(Tc,
+ [#'CosNaming_NameComponent'{id="evaluate",
+ kind=""},
+ #'CosNaming_NameComponent'{id="hej",
+ kind=""}]),
+ ?line ok = 'CosNaming_NamingContext':destroy(Nc),
+ ?line ok = 'CosNaming_NamingContext':unbind(Tc,
+ [#'CosNaming_NameComponent'{id="evaluate",
+ kind=""}]),
+ ?line ok = 'CosNaming_NamingContext':unbind(Tc,
+ [#'CosNaming_NameComponent'{id="stop",
+ kind=""}]),
+ ?line ok = 'CosNaming_NamingContext':unbind(Tc,
+ [#'CosNaming_NameComponent'{id="hej",
+ kind=""}]),
+ ?line case 'CosNaming_NamingContext':list(Tc, 3) of
+ {ok, [], ?ORBER_NIL_OBJREF} ->
+ ok;
+ _ ->
+ exit(not_empty)
+ end,
+ ?line ok = 'CosNaming_NamingContext':unbind(Ns,
+ [#'CosNaming_NameComponent'{id="testcontext",
+ kind=""}]),
+ ?line ok = 'CosNaming_NamingContext':destroy(Tc),
+ ok.
+
+
+
+check_list(doc) ->
+ ["Check that the CosNaming::NamingContext::list()",
+ "returns ok.",
+ "Own Id: OTP-2023"];
+check_list(suite) -> [];
+check_list(Config) when is_list(Config) ->
+ ?REMAP_EXCEPT(check_list_run(Config)).
+
+check_list_run(_Config) ->
+ create_default_contexts(),
+ ?line Ns = corba:resolve_initial_references("NameService"),
+ ?line {_, BL, _} = ?match({ok, _, ?ORBER_NIL_OBJREF},
+ 'CosNaming_NamingContext':list(Ns, 256)),
+
+ FF = fun(X) -> XX = hd(X#'CosNaming_Binding'.binding_name),
+ XX#'CosNaming_NameComponent'.id end,
+
+ L = lists:sort(lists:map(FF, BL)),
+ ?line ["host", "workgroup"] = L,
+
+ %% Test next_n/2
+ ?line {_, _, BI} = ?match({ok, [], _BI}, 'CosNaming_NamingContext':list(Ns, 0)),
+ ?line ?match({true, []}, 'CosNaming_BindingIterator':next_n(BI, 0)),
+ ?line ?match({true, [_]}, 'CosNaming_BindingIterator':next_n(BI, 1)),
+ ?line ?match({false, [_]}, 'CosNaming_BindingIterator':next_n(BI, 1)),
+ ?line ?match({false, []}, 'CosNaming_BindingIterator':next_n(BI, 1)),
+ ?line ?match(ok, 'CosNaming_BindingIterator':destroy(BI)),
+
+ ?line {_, _, BI2} = ?match({ok, [], _BI2}, 'CosNaming_NamingContext':list(Ns, 0)),
+ ?line ?match({true, _}, 'CosNaming_BindingIterator':next_one(BI2)),
+ ?line ?match({true, _}, 'CosNaming_BindingIterator':next_one(BI2)),
+ ?line ?match({false, _}, 'CosNaming_BindingIterator':next_one(BI2)),
+ ?line ?match(ok, 'CosNaming_BindingIterator':destroy(BI2)),
+ ?line ?match(ok, orber_diagnostics:nameservice()),
+ ok.
+
+create_default_contexts() ->
+ HostComponent = lname_component:set_id(lname_component:create(),
+ "host"),
+ HostsComponent = lname_component:set_id(lname_component:create(),
+ "hosts"),
+ ResourcesComponent = lname_component:set_id(lname_component:create(),
+ "resources"),
+ DevelopmentComponent = lname_component:set_id(lname_component:create(),
+ "development"),
+ FactoriesComponent = lname_component:set_id(lname_component:create(),
+ "factories"),
+ WGComponent = lname_component:set_id(lname_component:create(),
+ "workgroup"),
+ %% Creation of Naming Context host and it's subcontexts
+ NS = corba:resolve_initial_references("NameService"),
+ H = 'CosNaming_NamingContext':bind_new_context(NS,
+ lname:insert_component(lname:create(), 1, HostComponent)),
+ HR = 'CosNaming_NamingContext':bind_new_context(H,
+ lname:insert_component(lname:create(), 1, ResourcesComponent)),
+ 'CosNaming_NamingContext':bind_new_context(HR,
+ lname:insert_component(lname:create(), 1, FactoriesComponent)),
+ HD = 'CosNaming_NamingContext':bind_new_context(H,
+ lname:insert_component(lname:create(), 1, DevelopmentComponent)),
+ HDR = 'CosNaming_NamingContext':bind_new_context(HD,
+ lname:insert_component(lname:create(), 1, ResourcesComponent)),
+ 'CosNaming_NamingContext':bind_new_context(HDR,
+ lname:insert_component(lname:create(), 1, FactoriesComponent)),
+ %% Creation of Naming Context workgroup and it's subcontexts
+ W = 'CosNaming_NamingContext':bind_new_context(NS,
+ lname:insert_component(lname:create(), 1, WGComponent)),
+ 'CosNaming_NamingContext':bind_new_context(W,
+ lname:insert_component(lname:create(), 1, HostsComponent)),
+ WR = 'CosNaming_NamingContext':bind_new_context(W,
+ lname:insert_component(lname:create(), 1, ResourcesComponent)),
+ 'CosNaming_NamingContext':bind_new_context(WR,
+ lname:insert_component(lname:create(), 1, FactoriesComponent)),
+ WD = 'CosNaming_NamingContext':bind_new_context(W,
+ lname:insert_component(lname:create(), 1, DevelopmentComponent)),
+ WDR = 'CosNaming_NamingContext':bind_new_context(WD,
+ lname:insert_component(lname:create(), 1, ResourcesComponent)),
+ 'CosNaming_NamingContext':bind_new_context(WDR,
+ lname:insert_component(lname:create(), 1, FactoriesComponent)),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case:
+%% Description:
+%%-----------------------------------------------------------------
+name_context_ext(doc) -> ["Description", "more description"];
+name_context_ext(suite) -> [];
+name_context_ext(_Config) ->
+ ?REMAP_EXCEPT(name_context_ext_run()).
+
+name_context_ext_run() ->
+ ?line NS = ?match({_,pseudo,_, _,_, _},
+ corba:resolve_initial_references("NameService")),
+
+ Name1 = [#'CosNaming_NameComponent'{id="\\<id1\\>", kind="kind1"},
+ #'CosNaming_NameComponent'{id="id2", kind="kind2"}],
+ String1 = "\\<id1\\>.kind1/id2.kind2",
+ Name2 = [#'CosNaming_NameComponent'{id="id1", kind=""},
+ #'CosNaming_NameComponent'{id="id2", kind=""},
+ #'CosNaming_NameComponent'{id="id3", kind=""}],
+ String2 = "id1/id2/id3",
+ Name3 = [#'CosNaming_NameComponent'{id="id1", kind="kind1"},
+ #'CosNaming_NameComponent'{id="", kind=""},
+ #'CosNaming_NameComponent'{id="id3", kind="kind3"}],
+ String3 = "id1.kind1/./id3.kind3",
+ Name4 = [#'CosNaming_NameComponent'{id="id1", kind="kind1"},
+ #'CosNaming_NameComponent'{id="i.d.2", kind="kind2"},
+ #'CosNaming_NameComponent'{id="id3", kind="kind3"}],
+ String4 = "id1.kind1/i\\.d\\.2.kind2/id3.kind3",
+ Name5 = [#'CosNaming_NameComponent'{id="id1", kind=""},
+ #'CosNaming_NameComponent'{id="i/d/2", kind="kind2"},
+ #'CosNaming_NameComponent'{id="id3", kind=""}],
+ String5 = "id1/i\\/d\\/2.kind2/id3",
+
+ BadString1 = "id1./id2/id3",
+ BadString2 = "id1//id3",
+
+ ?match(String1, 'CosNaming_NamingContextExt':to_string(NS, Name1)),
+ ?match(String2, 'CosNaming_NamingContextExt':to_string(NS, Name2)),
+ ?match(String3, 'CosNaming_NamingContextExt':to_string(NS, Name3)),
+ ?match(String4, 'CosNaming_NamingContextExt':to_string(NS, Name4)),
+ ?match(String5, 'CosNaming_NamingContextExt':to_string(NS, Name5)),
+ ?match(Name1, 'CosNaming_NamingContextExt':to_name(NS, String1)),
+ ?match(Name2, 'CosNaming_NamingContextExt':to_name(NS, String2)),
+ ?match(Name3, 'CosNaming_NamingContextExt':to_name(NS, String3)),
+ ?match(Name4, 'CosNaming_NamingContextExt':to_name(NS, String4)),
+ ?match(Name5, 'CosNaming_NamingContextExt':to_name(NS, String5)),
+
+ ?match({'EXCEPTION', {'CosNaming_NamingContext_InvalidName',_}},
+ 'CosNaming_NamingContextExt':to_name(NS, BadString1)),
+ ?match({'EXCEPTION', {'CosNaming_NamingContext_InvalidName',_}},
+ 'CosNaming_NamingContextExt':to_name(NS, BadString2)),
+
+ %% Create a test context.
+ ?line Tc = ?match({_,pseudo,_, _,_, _},
+ 'CosNaming_NamingContext':bind_new_context(NS,
+ [#'CosNaming_NameComponent'{id="testcontext",
+ kind=""}])),
+ ?match(ok, 'CosNaming_NamingContext':bind(Tc, [#'CosNaming_NameComponent'
+ {id="hej",
+ kind=""}], NS)),
+
+ ?match(NS, 'CosNaming_NamingContextExt':resolve_str(Tc, "hej")),
+
+ ?match("corbaloc:rir:", 'CosNaming_NamingContextExt':to_url(Tc, "rir:", "")),
+ ?match("corbaname:rir:/NameService#org/erlang/",
+ 'CosNaming_NamingContextExt':to_url(Tc, "rir:/NameService", "org/erlang/")),
+ ?match("corbaloc::1.1@555%3cxyz.com:9999/Dev/NameService",
+ 'CosNaming_NamingContextExt':to_url(Tc, ":1.1@555\\<xyz.com:9999/Dev/NameService", "")),
+
+ %% Bad port
+ ?match({'EXCEPTION', {'CosNaming_NamingContextExt_InvalidAddress',_}},
+ 'CosNaming_NamingContextExt':to_url(Tc, ":[email protected]:99a9/", "")),
+ %% BAd IIOP-version
+ ?match({'EXCEPTION', {'CosNaming_NamingContextExt_InvalidAddress',_}},
+ 'CosNaming_NamingContextExt':to_url(Tc, ":[email protected]:99a9/", "")),
+ %% Bad IIOP-version
+ ?match({'EXCEPTION', {'CosNaming_NamingContextExt_InvalidAddress',_}},
+ 'CosNaming_NamingContextExt':to_url(Tc, ":@555xyz.com:99a9/", "")),
+ %% Bad protocol
+ ?match({'EXCEPTION', {'CosNaming_NamingContextExt_InvalidAddress',_}},
+ 'CosNaming_NamingContextExt':to_url(Tc, "iop:@555xyz.com:99a9/", "")),
+ %% Unsupported protocol
+ ?match({'EXCEPTION', {'CosNaming_NamingContextExt_InvalidAddress',_}},
+ 'CosNaming_NamingContextExt':to_url(Tc, "atm:@555xyz.com:9999/", "")),
+ %% Bad Name
+ ?match({'EXCEPTION', {'CosNaming_NamingContext_InvalidName',_}},
+ 'CosNaming_NamingContextExt':to_url(Tc, ":555xyz.com:9999/", "id1./id2.kind2")),
+
+ ok.
+
+
diff --git a/lib/orber/test/orber.spec b/lib/orber/test/orber.spec
new file mode 100644
index 0000000000..9d19ea7fc1
--- /dev/null
+++ b/lib/orber/test/orber.spec
@@ -0,0 +1,19 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+{topcase, {dir, "../orber_test"}}.
diff --git a/lib/orber/test/orber_SUITE.erl b/lib/orber/test/orber_SUITE.erl
new file mode 100644
index 0000000000..f54da02c0e
--- /dev/null
+++ b/lib/orber/test/orber_SUITE.erl
@@ -0,0 +1,179 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+-module(orber_SUITE).
+-include("test_server.hrl").
+
+
+-define(default_timeout, ?t:minutes(15)).
+-define(application, orber).
+
+% Test server specific exports
+-export([all/1]).
+-export([init_per_testcase/2, fin_per_testcase/2]).
+
+% Test cases must be exported.
+-export([app_test/1, undefined_functions/1, install_load_order/1,
+ install_local_content/1]).
+
+%%
+%% all/1
+%%
+all(doc) ->
+ [];
+all(suite) ->
+ [app_test, undefined_functions,
+ install_load_order, install_local_content].
+
+init_per_testcase(_Case, Config) ->
+ ?line Dog=test_server:timetrap(?default_timeout),
+ [{watchdog, Dog}|Config].
+
+fin_per_testcase(_Case, Config) ->
+ Dog=?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+%
+% Test cases starts here.
+%
+app_test(doc) -> [];
+app_test(suite) -> [];
+app_test(_Config) ->
+ ?line ok=?t:app_test(orber),
+ ok.
+
+%% Install Orber using the load_order option.
+install_load_order(suite) ->
+ [];
+install_load_order(doc) ->
+ [];
+install_load_order(_Config) ->
+ orber:jump_stop(),
+ case catch install_load_order2() of
+ ok ->
+ orber:jump_stop();
+ What ->
+ orber:jump_stop(),
+ exit(What)
+ end.
+
+install_load_order2() ->
+ application:load(orber),
+ mnesia:start(),
+ corba:orb_init([{iiop_port, 0}]),
+ orber:install([node()], [{ifr_storage_type, ram_copies},
+ {load_order, 10}]),
+ orber:start(),
+ [H|_] = orber:get_tables(),
+ 10 = mnesia:table_info(H, load_order),
+ ok.
+
+%% Install Orber using the local_content option.
+install_local_content(suite) ->
+ [];
+install_local_content(doc) ->
+ [];
+install_local_content(_Config) ->
+ orber:jump_stop(),
+ case catch install_local_content2() of
+ ok ->
+ orber:jump_stop();
+ What ->
+ orber:jump_stop(),
+ exit(What)
+ end.
+
+install_local_content2() ->
+ application:load(orber),
+ mnesia:start(),
+ corba:orb_init([{iiop_port, 0}]),
+ orber:install([node()], [{ifr_storage_type, ram_copies},
+ {local_content, true}]),
+ orber:start(),
+ [H|_] = orber:get_tables(),
+ true = mnesia:table_info(H, local_content),
+ ok.
+
+
+
+%% Check for undefined functions
+undefined_functions(suite) ->
+ [];
+undefined_functions(doc) ->
+ [];
+undefined_functions(_Config) ->
+ App = orber,
+ Root = code:root_dir(),
+ LibDir = code:lib_dir(App),
+ EbinDir = filename:join([LibDir,"ebin"]),
+ AppFilePath = filename:join([LibDir,"ebin", "orber.app"]),
+ {ok, [{application,orber,AppFile}]} = file:consult(AppFilePath),
+ io:format("Using ~p~n~p~n", [AppFilePath, AppFile]),
+ Mods = key1search(modules, AppFile),
+ XRefTestName = undef_funcs_make_name(App, xref_test_name),
+ {ok, XRef} = xref:start(XRefTestName),
+ ok = xref:set_default(XRef,
+ [{verbose,false},{warnings,false}]),
+ XRefName = undef_funcs_make_name(App, xref_name),
+ {ok, XRefName} = xref:add_release(XRef, Root, {name,XRefName}),
+ {ok, App} = xref:replace_application(XRef, App, EbinDir),
+ {ok, Undefs} = xref:analyze(XRef, undefined_function_calls),
+ xref:stop(XRef),
+ analyze_undefined_function_calls(Undefs, Mods, []).
+
+analyze_undefined_function_calls([], _, []) ->
+ ok;
+analyze_undefined_function_calls([], _, AppUndefs) ->
+ exit({suite_failed, {undefined_function_calls, AppUndefs}});
+analyze_undefined_function_calls([{{Mod, _F, _A}, _C} = AppUndef|Undefs],
+ AppModules, AppUndefs) ->
+ %% Check that this module is our's
+ case lists:member(Mod,AppModules) of
+ true ->
+ {Calling,Called} = AppUndef,
+ {Mod1,Func1,Ar1} = Calling,
+ {Mod2,Func2,Ar2} = Called,
+ io:format("undefined function call: "
+ "~n ~w:~w/~w calls ~w:~w/~w~n",
+ [Mod1,Func1,Ar1,Mod2,Func2,Ar2]),
+ analyze_undefined_function_calls(Undefs, AppModules,
+ [AppUndef|AppUndefs]);
+ false ->
+ io:format("dropping ~p~n", [Mod]),
+ analyze_undefined_function_calls(Undefs, AppModules, AppUndefs)
+ end.
+
+%% This function is used simply to avoid cut-and-paste errors later...
+undef_funcs_make_name(App, PostFix) ->
+ list_to_atom(atom_to_list(App) ++ "_" ++ atom_to_list(PostFix)).
+
+key1search(Key, L) ->
+ case lists:keysearch(Key, 1, L) of
+ false ->
+ fail({not_found, Key, L});
+ {value, {Key, Value}} ->
+ Value
+ end.
+
+fail(Reason) ->
+ exit({suite_failed, Reason}).
+
+
+
diff --git a/lib/orber/test/orber_acl_SUITE.erl b/lib/orber/test/orber_acl_SUITE.erl
new file mode 100644
index 0000000000..2c2a768af2
--- /dev/null
+++ b/lib/orber/test/orber_acl_SUITE.erl
@@ -0,0 +1,303 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2004-2010. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%-----------------------------------------------------------------
+%%
+%% Description:
+%% Test suite for the ACL functions
+%%
+%%-----------------------------------------------------------------
+-module(orber_acl_SUITE).
+
+-include("test_server.hrl").
+
+-define(default_timeout, ?t:minutes(5)).
+
+-define(match(ExpectedRes,Expr),
+ fun() ->
+ AcTuAlReS = (catch (Expr)),
+ case AcTuAlReS of
+ ExpectedRes ->
+ io:format("------ CORRECT RESULT ------~n~p~n",
+ [AcTuAlReS]),
+ AcTuAlReS;
+ _ ->
+ io:format("###### ERROR ERROR ######~nRESULT: ~p~n",
+ [AcTuAlReS]),
+ ?line exit(AcTuAlReS)
+ end
+ end()).
+
+%%-----------------------------------------------------------------
+%% External exports
+%%-----------------------------------------------------------------
+-export([all/1]).
+
+%%-----------------------------------------------------------------
+%% Internal exports
+%%-----------------------------------------------------------------
+-compile(export_all).
+
+%%-----------------------------------------------------------------
+%% Func: all/1
+%% Args:
+%% Returns:
+%%-----------------------------------------------------------------
+all(doc) -> ["Testing API for ACL (Access Control List)"];
+all(suite) ->
+ [ipv4_verify, ipv4_range, ipv4_interfaces, ipv4_bm,
+ ipv6_verify, ipv6_range, ipv6_interfaces, ipv6_bm].
+
+%%-----------------------------------------------------------------
+%% Init and cleanup functions.
+%%-----------------------------------------------------------------
+init_all(Config) ->
+ if
+ list(Config) ->
+ Config;
+ true ->
+ exit("Config not a list")
+ end.
+
+finish_all(Config) ->
+ Config.
+
+
+init_per_testcase(_Case, Config) ->
+ ?line Dog=test_server:timetrap(?default_timeout),
+ [{watchdog, Dog}|Config].
+
+
+fin_per_testcase(_Case, Config) ->
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case :
+%% Description:
+%%-----------------------------------------------------------------
+ipv4_verify(doc) -> ["Testing IPv4 Verify Operation."];
+ipv4_verify(suite) -> [];
+ipv4_verify(_) ->
+ ?match(true, orber_acl:verify("192.168.64.148", "192.168.64.0/17", inet)),
+ ?match({false,"192.168.128.0","192.168.255.255"},
+ orber_acl:verify("192.168.64.148", "192.168.255.0/17", inet)),
+ ?match(true, orber_acl:verify("192.168.255.148", "192.168.128.0/17", inet)),
+ ?match(true, orber_acl:verify("192.168.128.148", "192.168.128.0/17", inet)),
+ ?match(true, orber_acl:verify("192.168.255.255", "192.168.128.0/16", inet)),
+ ?match({false,"192.168.0.0","192.168.255.255"},
+ orber_acl:verify("192.169.255.255", "192.168.128.0/16", inet)),
+ ?match(true, orber_acl:verify("192.168.128.255", "192.168.128.0/24", inet)),
+ ?match({false,"192.168.128.0","192.168.128.255"},
+ orber_acl:verify("192.168.255.255", "192.168.128.0/24", inet)),
+ ?match({false,"192.168.128.0","192.168.128.127"},
+ orber_acl:verify("192.168.128.255", "192.168.128.0/25", inet)),
+ ?match(true, orber_acl:verify("192.168.128.255", "192.168.128.128/25", inet)),
+ ?match(true, orber_acl:verify("192.168.128.128", "192.168.128.128/32", inet)),
+ ?match({false,"192.168.128.128.","192.168.128.128."},
+ orber_acl:verify("192.168.128.255", "192.168.128.128/32", inet)),
+ ?match(true, orber_acl:verify("192.168.128.128", "192.168.128.128", inet)),
+ ?match({false,"192.168.128.128.","192.168.128.128."},
+ orber_acl:verify("192.168.128.255", "192.168.128.128", inet)),
+ ?match(true, orber_acl:verify("192.168.128.255", "192.168.128.128/7", inet)),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case :
+%% Description:
+%%-----------------------------------------------------------------
+ipv4_range(doc) -> ["Testing IPv4 Range Operation."];
+ipv4_range(suite) -> [];
+ipv4_range(_) ->
+ ?match({ok,"192.168.0.0", "192.168.127.255"},
+ orber_acl:range("192.168.64.0/17")),
+ ?match({ok, "192.168.128.0", "192.168.255.255"},
+ orber_acl:range("192.168.255.0/17")),
+ ?match({ok,"192.168.128.0","192.168.255.255"},
+ orber_acl:range("192.168.128.0/17")),
+ ?match({ok,"192.168.0.0","192.168.255.255"},
+ orber_acl:range("192.168.128.0/16")),
+ ?match({ok,"192.168.128.0","192.168.128.255"},
+ orber_acl:range("192.168.128.0/24")),
+ ?match({ok,"192.168.128.0","192.168.128.127"},
+ orber_acl:range("192.168.128.0/25")),
+ ?match({ok,"192.168.128.128","192.168.128.255"},
+ orber_acl:range("192.168.128.128/25")),
+ ?match({ok,"192.168.128.128.","192.168.128.128."},
+ orber_acl:range("192.168.128.128/32")),
+ ?match({ok,"192.168.128.128.","192.168.128.128."},
+ orber_acl:range("192.168.128.128")),
+ ?match({ok,"192.0.0.0","193.255.255.255"},
+ orber_acl:range("192.168.128.128/7")),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case :
+%% Description:
+%%-----------------------------------------------------------------
+ipv4_interfaces(doc) -> ["Testing IPv4 Interfaces Operation."];
+ipv4_interfaces(suite) -> [];
+ipv4_interfaces(_) ->
+ ?match({ok, _},
+ orber_acl:init_acl([{tcp_in, "192.168.128.0/18", ["10.1.1.1"]},
+ {tcp_in, "192.167.64.0/18#4001/5001", ["10.1.1.2"]},
+ {tcp_in, "192.166.192.0/18"}], inet)),
+ {ok, IPTuple1} = ?match({ok, _}, inet:getaddr("192.168.128.0", inet)),
+ ?match({true, ["10.1.1.1"], 0}, orber_acl:match(IPTuple1, tcp_in, true)),
+ ?match({false, [], 0}, orber_acl:match(IPTuple1, tcp_out, true)),
+ {ok, IPTuple2} = ?match({ok, _}, inet:getaddr("192.167.64.0", inet)),
+ ?match({true, ["10.1.1.2"], {4001,5001}}, orber_acl:match(IPTuple2, tcp_in, true)),
+ ?match({false, [], 0}, orber_acl:match(IPTuple2, tcp_out, true)),
+ {ok, IPTuple3} = ?match({ok, _}, inet:getaddr("192.166.192.0", inet)),
+ ?match({true, [], 0}, orber_acl:match(IPTuple3, tcp_in, true)),
+ ?match(false, orber_acl:match(IPTuple3, tcp_out)),
+ ?match(ok, orber_acl:clear_acl()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case :
+%% Description:
+%%-----------------------------------------------------------------
+ipv4_bm(doc) -> ["Benchmarking runtime critical IPv4 Operations."];
+ipv4_bm(suite) -> [];
+ipv4_bm(_) ->
+ ?match({ok, _, _, _}, bm2([{tcp_in, "192.168.64.0/17"}], inet, "192.168.64.148")),
+ ok.
+%%-----------------------------------------------------------------
+%% Test Case :
+%% Description:
+%%-----------------------------------------------------------------
+ipv6_verify(doc) -> ["Testing IPv6 Verify Operation."];
+ipv6_verify(suite) -> [];
+ipv6_verify(_) ->
+ case orber_test_lib:version_ok() of
+ true ->
+ ?match(true, orber_acl:verify("2002:C0A8:0:0:0:0:0:0", "2002:C0A8::/48", inet6)),
+ ?match(true, orber_acl:verify("2002:C0A8:0:FFFF:FFFF:FFFF:FFFF:FFFF", "2002:C0A8::/48", inet6)),
+ ?match({false,"2002:C0A8:0:0:0:0:0:0", "2002:C0A8:0:FFFF:FFFF:FFFF:FFFF:FFFF"},
+ orber_acl:verify("2002:C0A8:1:FFFF:FFFF:FFFF:FFFF:FFFF", "2002:C0A8::/48", inet6)),
+ ?match(true, orber_acl:verify("2002:C0A8:1:FFFF:FFFF:FFFF:FFFF:FFFF", "2002:C0A8::/47", inet6)),
+ ?match({false,"2002:C0A8:0:0:0:0:0:0", "2002:C0A8:1:FFFF:FFFF:FFFF:FFFF:FFFF"},
+ orber_acl:verify("2002:C0A8:2:FFFF:FFFF:FFFF:FFFF:FFFF", "2002:C0A8::/47", inet6)),
+ ok;
+ Reason ->
+ Reason
+ end.
+
+%%-----------------------------------------------------------------
+%% Test Case :
+%% Description:
+%%-----------------------------------------------------------------
+ipv6_range(doc) -> ["Testing IPv6 Range Operation."];
+ipv6_range(suite) -> [];
+ipv6_range(_) ->
+ case orber_test_lib:version_ok() of
+ true ->
+ ?match({ok,"2002:C0A8:0:0:0:0:0:0", "2002:C0A8:0:FFFF:FFFF:FFFF:FFFF:FFFF"},
+ orber_acl:range("2002:C0A8::/48", inet6)),
+ ?match({ok,"2002:C0A8:0:0:0:0:0:0", "2002:C0A8:1:FFFF:FFFF:FFFF:FFFF:FFFF"},
+ orber_acl:range("2002:C0A8::/47", inet6)),
+ ok;
+ Reason ->
+ Reason
+ end.
+
+%%-----------------------------------------------------------------
+%% Test Case :
+%% Description:
+%%-----------------------------------------------------------------
+ipv6_interfaces(doc) -> ["Testing IPv6 Interfaces Operation."];
+ipv6_interfaces(suite) -> [];
+ipv6_interfaces(_) ->
+ case orber_test_lib:version_ok() of
+ true ->
+ ?match({ok, _}, orber_acl:init_acl([{tcp_in, "2002:C0A8::/49", ["0:0:0:0:0:0:10.1.1.1"]}], inet6)),
+ {ok, IPTuple1} = ?match({ok, _}, inet:getaddr("2002:C0A8:0:7FFF:FFFF:FFFF:FFFF:FFFF", inet6)),
+ ?match({true, ["0:0:0:0:0:0:10.1.1.1"], 0}, orber_acl:match(IPTuple1, tcp_in, true)),
+ ?match(false, orber_acl:match(IPTuple1, tcp_out)),
+ ?match(ok, orber_acl:clear_acl()),
+ ok;
+ Reason ->
+ Reason
+ end.
+
+%%-----------------------------------------------------------------
+%% Test Case :
+%% Description:
+%%-----------------------------------------------------------------
+ipv6_bm(doc) -> ["Benchmarking runtime critical IPv6 Operations."];
+ipv6_bm(suite) -> [];
+ipv6_bm(_) ->
+ case orber_test_lib:version_ok() of
+ true ->
+ ?match({ok, _, _, _}, bm2([{tcp_in, "2002:C0A8::/48"}], inet6, "2002:C0A8:0:0:0:0:0:0")),
+ ok;
+ Reason ->
+ Reason
+ end.
+
+%%-----------------------------------------------------------------
+%% Local Functions
+%%-----------------------------------------------------------------
+-define(NO_OF_TIMES, 1000).
+
+bm2(Filters, Family, Ip) ->
+ {ok, IPTuple} = inet:getaddr(Ip, Family),
+ orber_acl:init_acl(Filters, Family),
+ TimeBefore1 = erlang:now(),
+ bm_loop(IPTuple, ?NO_OF_TIMES),
+ TimeAfter1 = erlang:now(),
+ orber_acl:clear_acl(),
+ Time1 = computeTime(TimeBefore1, TimeAfter1),
+ orber_acl:init_acl(Filters, Family),
+ TimeBefore2 = erlang:now(),
+ bm_loop2(Ip, ?NO_OF_TIMES, Family),
+ TimeAfter2 = erlang:now(),
+ orber_acl:clear_acl(),
+ Time2 = computeTime(TimeBefore2, TimeAfter2),
+ orber_acl:init_acl(Filters, Family),
+ TimeBefore3 = erlang:now(),
+ bm_loop2(IPTuple, ?NO_OF_TIMES, Family),
+ TimeAfter3 = erlang:now(),
+ orber_acl:clear_acl(),
+ Time3 = computeTime(TimeBefore3, TimeAfter3),
+ {ok, round(?NO_OF_TIMES/Time1), round(?NO_OF_TIMES/Time2), round(?NO_OF_TIMES/Time3)}.
+
+
+bm_loop(_Ip, 0) ->
+ ok;
+bm_loop(Ip, N) ->
+ true = orber_acl:match(Ip, tcp_in),
+ bm_loop(Ip, N-1).
+
+bm_loop2(_Ip, 0, _Family) ->
+ ok;
+bm_loop2(Ip, N, Family) ->
+ {ok, IPTuple} = inet:getaddr(Ip, Family),
+ true = orber_acl:match(IPTuple, tcp_in),
+ bm_loop2(Ip, N-1, Family).
+
+computeTime({_MegaSecb, Secb, MicroSecb}, {_MegaSeca, Seca, MicroSeca}) ->
+ (Seca - Secb) + ((MicroSeca - MicroSecb) / 1000000).
+
+
+%%-----------------------------------------------------------------
+%% END OF MODULE
+%%-----------------------------------------------------------------
diff --git a/lib/orber/test/orber_firewall_ipv4_in_SUITE.erl b/lib/orber/test/orber_firewall_ipv4_in_SUITE.erl
new file mode 100644
index 0000000000..3ac0cb7921
--- /dev/null
+++ b/lib/orber/test/orber_firewall_ipv4_in_SUITE.erl
@@ -0,0 +1,280 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2004-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+
+-module(orber_firewall_ipv4_in_SUITE).
+
+-include("test_server.hrl").
+-include_lib("orber/include/corba.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming.hrl").
+-include_lib("orber/src/orber_iiop.hrl").
+-include_lib("orber/src/ifr_objects.hrl").
+-include("idl_output/orber_test_server.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming_NamingContextExt.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming_NamingContext.hrl").
+
+-define(default_timeout, ?t:minutes(15)).
+
+-define(match(ExpectedRes,Expr),
+ fun() ->
+ AcTuAlReS = (catch (Expr)),
+ case AcTuAlReS of
+ ExpectedRes ->
+ io:format("------ CORRECT RESULT ------~n~p~n",
+ [AcTuAlReS]),
+ AcTuAlReS;
+ _ ->
+ io:format("###### ERROR ERROR ######~nRESULT: ~p~n",
+ [AcTuAlReS]),
+ ?line exit(AcTuAlReS)
+ end
+ end()).
+
+%%-----------------------------------------------------------------
+%% External exports
+%%-----------------------------------------------------------------
+-export([all/1, cases/0, init_all/1, finish_all/1,
+ init_per_testcase/2, fin_per_testcase/2,
+ deny_port_api/1, deny_port_range_api/1, deny_host_api/1,
+ deny_peerhost_api/1, allow_port_range_api/1,
+ allow_host_api/1, allow_peerhost_api/1, check_address_api/1]).
+
+%%-----------------------------------------------------------------
+%% Func: all/1
+%% Args:
+%% Returns:
+%%-----------------------------------------------------------------
+all(doc) -> ["API tests for orber's firewall functionallity."];
+all(suite) -> {req,
+ [mnesia],
+ {conf, init_all, cases(), finish_all}}.
+
+%% NOTE - the fragment test cases must bu first since we explicitly set a request
+%% id. Otherwise, the request-id counter would be increased and we cannot know
+%% what it is.
+cases() ->
+ [deny_port_api, deny_port_range_api, deny_host_api, deny_peerhost_api,
+ allow_port_range_api, allow_host_api, allow_peerhost_api, check_address_api].
+
+
+init_per_testcase(_Case, Config) ->
+ ?line Dog=test_server:timetrap(?default_timeout),
+ [{watchdog, Dog}|Config].
+
+
+fin_per_testcase(_Case, Config) ->
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+init_all(Config) ->
+ if
+ is_list(Config) ->
+ orber:jump_start([{iiop_port, 0},
+ {iiop_out_ports, {5980, 6000}}]),
+ Config;
+ true ->
+ exit("Config not a list")
+ end.
+
+finish_all(Config) ->
+ orber:jump_stop(),
+ Config.
+
+%%-----------------------------------------------------------------
+%% Incomming connections - Deny
+%%-----------------------------------------------------------------
+deny_port_api(doc) -> ["Deny Access due to invalid local port"];
+deny_port_api(suite) -> [];
+deny_port_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_USE_ACL_INCOMING},
+ {iiop_acl, [{tcp_in, IP++"/32#7000"}]}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ ?match({'EXCEPTION', #'CosNaming_NamingContextExt_InvalidAddress'{}},
+ corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")),
+% ?line catch orber_test_lib:destroy_node(ServerNode, timeout),
+ ok.
+
+deny_port_range_api(doc) -> ["Deny Access due to invalid local port range"];
+deny_port_range_api(suite) -> [];
+deny_port_range_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_USE_ACL_INCOMING},
+ {iiop_acl, [{tcp_in, IP++"/32#7000/8000"}]}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ ?match({'EXCEPTION', #'CosNaming_NamingContextExt_InvalidAddress'{}},
+ corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")),
+% ?line catch orber_test_lib:destroy_node(ServerNode, timeout),
+ ok.
+
+
+deny_host_api(doc) -> ["Deny Access due to invalid host"];
+deny_host_api(suite) -> [];
+deny_host_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_USE_ACL_INCOMING},
+ {iiop_acl, [{tcp_in, "123.123.123.123/32"}]}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ ?match({'EXCEPTION', #'CosNaming_NamingContextExt_InvalidAddress'{}},
+ corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")),
+% ?line catch orber_test_lib:destroy_node(ServerNode, timeout),
+ ok.
+
+deny_peerhost_api(doc) -> ["Deny Access due to invalid peerhost"];
+deny_peerhost_api(suite) -> [];
+deny_peerhost_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_USE_ACL_INCOMING},
+ {iiop_acl, [{tcp_in, IP++"/32", ["123.123.123.123"]}]}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ ?match({'EXCEPTION', #'CosNaming_NamingContextExt_InvalidAddress'{}},
+ corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")),
+% ?line catch orber_test_lib:destroy_node(ServerNode, timeout),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Incomming connections - Allow
+%%-----------------------------------------------------------------
+allow_port_range_api(doc) -> ["Allow Access due to valid local port range"];
+allow_port_range_api(suite) -> [];
+allow_port_range_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_USE_ACL_INCOMING},
+ {iiop_acl, [{tcp_in, IP++"/32#5980/6000"}]}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ IOR =
+ ?match({'IOP_IOR',_,_},
+ corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")),
+ ?match(false, corba_object:not_existent(IOR)),
+% ?line catch orber_test_lib:destroy_node(ServerNode, timeout),
+ ok.
+
+
+allow_host_api(doc) -> ["Allow Access due to valid host"];
+allow_host_api(suite) -> [];
+allow_host_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_USE_ACL_INCOMING},
+ {iiop_acl, [{tcp_in, IP++"/32"}]}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ IOR =
+ ?match({'IOP_IOR',_,_},
+ corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")),
+ ?match(false, corba_object:not_existent(IOR)),
+% ?line catch orber_test_lib:destroy_node(ServerNode, timeout),
+ ok.
+
+allow_peerhost_api(doc) -> ["Allow Access due to valid peerhost"];
+allow_peerhost_api(suite) -> [];
+allow_peerhost_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_USE_ACL_INCOMING},
+ {iiop_acl, [{tcp_in, IP++"/32", [IP]}]}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ IOR =
+ ?match({'IOP_IOR',_,_},
+ corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService",
+ [#'IOP_ServiceContext'
+ {context_id=?ORBER_GENERIC_CTX_ID,
+ context_data = {interface, IP}}])),
+ ?match(false, corba_object:not_existent(IOR,
+ [#'IOP_ServiceContext'
+ {context_id=?ORBER_GENERIC_CTX_ID,
+ context_data = {interface, IP}}])),
+% ?line catch orber_test_lib:destroy_node(ServerNode, timeout),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test corbaloc strings
+%%-----------------------------------------------------------------
+check_address_api(doc) -> ["Test corbaloc strings"];
+check_address_api(suite) -> [];
+check_address_api(_Config) ->
+ ?match({[[iiop,{1,0},"10.0.0.1",2809]],"NameService"},
+ orber_cosnaming_utils:addresses(":10.0.0.1/NameService")),
+ ?match({[[iiop,{1,0},"10.0.0.1",2809]],[]},
+ orber_cosnaming_utils:addresses(":10.0.0.1")),
+ ?match({[[iiop,{1,2},"10.0.0.1",2809]],"NameService"},
+ orber_cosnaming_utils:addresses(":[email protected]/NameService")),
+ ?match({[[iiop,{1,0},"10.0.0.1",4001]],"NameService"},
+ orber_cosnaming_utils:addresses(":10.0.0.1:4001/NameService")),
+ ?match({[[iiop,{1,1},"10.0.0.1",4001]],"NameService"},
+ orber_cosnaming_utils:addresses(":[email protected]:4001/NameService")),
+ ?match({[[iiop,{1,1},"10.0.0.1",4001]],[]},
+ orber_cosnaming_utils:addresses(":[email protected]:4001")),
+ ?match({[[iiop,{1,1},"10.0.0.1",4001]],[]},
+ orber_cosnaming_utils:addresses("iiop:[email protected]:4001")),
+ ?match({[[iiop,{1,1},"10.0.0.1",4001]],[]},
+ orber_cosnaming_utils:addresses("iiop:[email protected]:4001/")),
+
+ ?match({[[iiop,{1,1},"myhost",4001]],[]},
+ orber_cosnaming_utils:addresses("iiop:1.1@myhost:4001")),
+ ?match({[[iiop,{1,1},"myhost.full.name",4001]],"NameService"},
+ orber_cosnaming_utils:addresses("iiop:[email protected]:4001/NameService")),
+ ?match({[[iiop,{1,1},"myhost",4001],
+ [iiop,{1,1},"myhost.full.name",2809]],"NameService"},
+ orber_cosnaming_utils:addresses("iiop:1.1@myhost:4001,iiop:[email protected]/NameService")),
+
+ ?match({[[iiop,{1,1},"123.12.23.2",4001],
+ [iiop,{1,1},"10.0.0.1",4001]], "NameService"},
+ orber_cosnaming_utils:addresses(":[email protected]:4001,:[email protected]:4001/NameService")),
+ ?match({[[iiop,{1,1},"123.12.23.2",4001],
+ [iiop,{1,1},"10.0.0.1",4001]], []},
+ orber_cosnaming_utils:addresses(":[email protected]:4001,:[email protected]:4001")),
+ ?match({[[iiop,{1,0},"123.12.23.2",4001],
+ [iiop,{1,1},"10.0.0.1",4001]], "NameService"},
+ orber_cosnaming_utils:addresses(":123.12.23.2:4001,:[email protected]:4001/NameService")),
+ ?match({[[iiop,{1,1},"123.12.23.2",4001],
+ [iiop,{1,0},"10.0.0.1",4001]], "NameService"},
+ orber_cosnaming_utils:addresses(":[email protected]:4001,:10.0.0.1:4001/NameService")),
+ ?match({[[iiop,{1,1},"123.12.23.2",2809],
+ [iiop,{1,1},"10.0.0.1",4001]], "NameService"},
+ orber_cosnaming_utils:addresses(":[email protected],:[email protected]:4001/NameService")),
+ ?match({[[iiop,{1,1},"123.12.23.2",4001],
+ [iiop,{1,1},"10.0.0.1",2809]], "NameService"},
+ orber_cosnaming_utils:addresses(":[email protected]:4001,:[email protected]/NameService")),
+ ?match({[[iiop,{1,0},"123.12.23.2",2809],
+ [iiop,{1,0},"10.0.0.1",2809]], "NameService"},
+ orber_cosnaming_utils:addresses(":123.12.23.2,:10.0.0.1/NameService")),
+ ?match({[[iiop,{1,0},"123.12.23.2",2809],
+ [iiop,{1,0},"10.0.0.1",2809]], []},
+ orber_cosnaming_utils:addresses(":123.12.23.2,:10.0.0.1/")),
+ ?match({[[iiop,{1,0},"123.12.23.2",2809],
+ [iiop,{1,0},"10.0.0.1",2809]], []},
+ orber_cosnaming_utils:addresses("iiop:123.12.23.2,:10.0.0.1/")),
+
+ [IP] = ?match([_], orber:host()),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_USE_ACL_INCOMING},
+ {iiop_acl, [{tcp_in, IP++"/32"}]}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ ?match({'IOP_IOR',_,_},
+ corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")),
+% ?line catch orber_test_lib:destroy_node(ServerNode, timeout),
+
+ ok.
+
diff --git a/lib/orber/test/orber_firewall_ipv4_out_SUITE.erl b/lib/orber/test/orber_firewall_ipv4_out_SUITE.erl
new file mode 100644
index 0000000000..193fc72f7c
--- /dev/null
+++ b/lib/orber/test/orber_firewall_ipv4_out_SUITE.erl
@@ -0,0 +1,224 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2004-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+
+-module(orber_firewall_ipv4_out_SUITE).
+
+-include("test_server.hrl").
+-include_lib("orber/include/corba.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming.hrl").
+-include_lib("orber/src/orber_iiop.hrl").
+-include_lib("orber/src/ifr_objects.hrl").
+-include("idl_output/orber_test_server.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming_NamingContextExt.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming_NamingContext.hrl").
+
+-define(default_timeout, ?t:minutes(15)).
+
+-define(match(ExpectedRes,Expr),
+ fun() ->
+ AcTuAlReS = (catch (Expr)),
+ case AcTuAlReS of
+ ExpectedRes ->
+ io:format("------ CORRECT RESULT ------~n~p~n",
+ [AcTuAlReS]),
+ AcTuAlReS;
+ _ ->
+ io:format("###### ERROR ERROR ######~nRESULT: ~p~n",
+ [AcTuAlReS]),
+ ?line exit(AcTuAlReS)
+ end
+ end()).
+
+%%-----------------------------------------------------------------
+%% External exports
+%%-----------------------------------------------------------------
+-export([all/1, cases/0, init_all/1, finish_all/1,
+ init_per_testcase/2, fin_per_testcase/2,
+ deny_port_api/1, deny_port_range_api/1, deny_host_api/1,
+ allow_port_api/1, allow_port_range_api/1, allow_host_api/1,
+ local_interface_api/1]).
+
+%%-----------------------------------------------------------------
+%% Func: all/1
+%% Args:
+%% Returns:
+%%-----------------------------------------------------------------
+all(doc) -> ["API tests for orber's firewall functionallity."];
+all(suite) -> {req,
+ [mnesia],
+ {conf, init_all, cases(), finish_all}}.
+
+%% NOTE - the fragment test cases must bu first since we explicitly set a request
+%% id. Otherwise, the request-id counter would be increased and we cannot know
+%% what it is.
+cases() ->
+ [deny_port_api, deny_port_range_api, deny_host_api,
+ allow_port_api, allow_port_range_api, allow_host_api,
+ local_interface_api].
+
+
+init_per_testcase(_Case, Config) ->
+ ?line Dog=test_server:timetrap(?default_timeout),
+ [{watchdog, Dog}|Config].
+
+
+fin_per_testcase(_Case, Config) ->
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+init_all(Config) ->
+ if
+ is_list(Config) ->
+ orber:jump_start([{iiop_port, 0},
+ {iiop_out_ports, {5980, 6000}}]),
+ Config;
+ true ->
+ exit("Config not a list")
+ end.
+
+finish_all(Config) ->
+ orber:jump_stop(),
+ Config.
+
+%%-----------------------------------------------------------------
+%% Incomming connections - Deny
+%%-----------------------------------------------------------------
+deny_port_api(doc) -> ["Deny Access due to invalid local port"];
+deny_port_api(suite) -> [];
+deny_port_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ ServerPort = orber:iiop_port(),
+ {ok, ClientNode, _ClientHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_USE_ACL_OUTGOING},
+ {iiop_acl, [{tcp_out, IP++"/32#" ++ integer_to_list(ServerPort+10)}]}])),
+ ?match({'EXCEPTION', #'CosNaming_NamingContextExt_InvalidAddress'{}},
+ orber_test_lib:remote_apply(ClientNode, corba, string_to_object,
+ ["corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService"])),
+% ?line catch orber_test_lib:destroy_node(ClientNode, timeout),
+ ok.
+
+deny_port_range_api(doc) -> ["Deny Access due to invalid local port range"];
+deny_port_range_api(suite) -> [];
+deny_port_range_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ ServerPort = orber:iiop_port(),
+ {ok, ClientNode, _ClientHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_USE_ACL_OUTGOING},
+ {iiop_acl, [{tcp_out, IP++"/32#"++integer_to_list(ServerPort+100)++ "/" ++ integer_to_list(ServerPort+120)}]}])),
+ ?match({'EXCEPTION', #'CosNaming_NamingContextExt_InvalidAddress'{}},
+ orber_test_lib:remote_apply(ClientNode, corba, string_to_object,
+ ["corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService"])),
+% ?line catch orber_test_lib:destroy_node(ClientNode, timeout),
+ ok.
+
+
+deny_host_api(doc) -> ["Deny Access due to invalid host"];
+deny_host_api(suite) -> [];
+deny_host_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ {ok, ClientNode, _ClientHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_USE_ACL_OUTGOING},
+ {iiop_acl, [{tcp_out, "123.123.123.123/32"}]}])),
+ ServerPort = orber:iiop_port(),
+ ?match({'EXCEPTION', #'CosNaming_NamingContextExt_InvalidAddress'{}},
+ orber_test_lib:remote_apply(ClientNode, corba, string_to_object,
+ ["corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService"])),
+% ?line catch orber_test_lib:destroy_node(ClientNode, timeout),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Incomming connections - Allow
+%%-----------------------------------------------------------------
+allow_port_api(doc) -> ["Allow Access due to valid local port range"];
+allow_port_api(suite) -> [];
+allow_port_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ ServerPort = orber:iiop_port(),
+ {ok, ClientNode, _ClientHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_USE_ACL_OUTGOING},
+ {iiop_acl, [{tcp_out, IP++"/32#"++integer_to_list(ServerPort)}]}])),
+ IOR =
+ ?match({'IOP_IOR',_,_},
+ orber_test_lib:remote_apply(ClientNode, corba, string_to_object,
+ ["corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService"])),
+ ?match(false,
+ orber_test_lib:remote_apply(ClientNode, corba_object, not_existent, [IOR])),
+% ?line catch orber_test_lib:destroy_node(ClientNode, timeout),
+ ok.
+
+allow_port_range_api(doc) -> ["Allow Access due to valid local port range"];
+allow_port_range_api(suite) -> [];
+allow_port_range_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ ServerPort = orber:iiop_port(),
+ {ok, ClientNode, _ClientHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_USE_ACL_OUTGOING},
+ {iiop_acl, [{tcp_out, IP++"/32#" ++ integer_to_list(ServerPort-10) ++ "/" ++ integer_to_list(ServerPort+10)}]}])),
+ IOR =
+ ?match({'IOP_IOR',_,_},
+ orber_test_lib:remote_apply(ClientNode, corba, string_to_object,
+ ["corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService"])),
+ ?match(false,
+ orber_test_lib:remote_apply(ClientNode, corba_object, not_existent, [IOR])),
+% ?line catch orber_test_lib:destroy_node(ClientNode, timeout),
+ ok.
+
+
+allow_host_api(doc) -> ["Allow Access due to valid host"];
+allow_host_api(suite) -> [];
+allow_host_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ {ok, ClientNode, _ClientHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_USE_ACL_OUTGOING},
+ {iiop_acl, [{tcp_out, IP++"/32"}]}])),
+ ServerPort = orber:iiop_port(),
+ IOR =
+ ?match({'IOP_IOR',_,_},
+ orber_test_lib:remote_apply(ClientNode, corba, string_to_object,
+ ["corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService"])),
+ ?match(false,
+ orber_test_lib:remote_apply(ClientNode, corba_object, not_existent, [IOR])),
+% ?line catch orber_test_lib:destroy_node(ClientNode, timeout),
+ ok.
+
+local_interface_api(doc) -> ["Allow Access due to valid host via a spcific interface"];
+local_interface_api(suite) -> [];
+local_interface_api(_Config) ->
+ IP = orber_test_lib:get_host(),
+ Loopback = orber_test_lib:get_loopback_interface(),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{iiop_port, 0},
+ {iiop_out_ports, {5980, 6000}},
+ {ip_address, IP}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+
+ {ok, ClientNode, _ClientHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_USE_ACL_OUTGOING},
+ {iiop_acl, [{tcp_out, IP, [Loopback]}]}])),
+ IOR =
+ ?match({'IOP_IOR',_,_},
+ orber_test_lib:remote_apply(ClientNode, corba, string_to_object,
+ ["corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService"])),
+ ?match(false,
+ orber_test_lib:remote_apply(ClientNode, corba_object, not_existent, [IOR])),
+% ?line catch orber_test_lib:destroy_node(ClientNode, timeout),
+ ok.
+
diff --git a/lib/orber/test/orber_firewall_ipv6_in_SUITE.erl b/lib/orber/test/orber_firewall_ipv6_in_SUITE.erl
new file mode 100644
index 0000000000..83f48cba0c
--- /dev/null
+++ b/lib/orber/test/orber_firewall_ipv6_in_SUITE.erl
@@ -0,0 +1,311 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2004-2010. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+
+-module(orber_firewall_ipv6_in_SUITE).
+
+-include("test_server.hrl").
+-include_lib("orber/include/corba.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming.hrl").
+-include_lib("orber/src/orber_iiop.hrl").
+-include_lib("orber/src/ifr_objects.hrl").
+-include("idl_output/orber_test_server.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming_NamingContextExt.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming_NamingContext.hrl").
+
+-define(default_timeout, ?t:minutes(15)).
+
+-define(match(ExpectedRes,Expr),
+ fun() ->
+ AcTuAlReS = (catch (Expr)),
+ case AcTuAlReS of
+ ExpectedRes ->
+ io:format("------ CORRECT RESULT ------~n~p~n",
+ [AcTuAlReS]),
+ AcTuAlReS;
+ _ ->
+ io:format("###### ERROR ERROR ######~nRESULT: ~p~n",
+ [AcTuAlReS]),
+ ?line exit(AcTuAlReS)
+ end
+ end()).
+
+%%-----------------------------------------------------------------
+%% External exports
+%%-----------------------------------------------------------------
+-export([all/1, cases/0, init_all/1, finish_all/1,
+ init_per_testcase/2, fin_per_testcase/2,
+ deny_port_api/1, deny_port_range_api/1, deny_host_api/1,
+ deny_peerhost_api/1, allow_port_range_api/1,
+ allow_host_api/1, allow_peerhost_api/1, check_address_api/1]).
+
+%%-----------------------------------------------------------------
+%% Func: all/1
+%% Args:
+%% Returns:
+%%-----------------------------------------------------------------
+all(doc) -> ["API tests for orber's firewall functionallity."];
+all(suite) -> {req,
+ [mnesia],
+ {conf, init_all, cases(), finish_all}}.
+
+%% NOTE - the fragment test cases must bu first since we explicitly set a request
+%% id. Otherwise, the request-id counter would be increased and we cannot know
+%% what it is.
+cases() ->
+ [deny_port_api, deny_port_range_api, deny_host_api, deny_peerhost_api,
+ allow_port_range_api, allow_host_api, allow_peerhost_api,
+ check_address_api].
+
+
+init_per_testcase(_Case, Config) ->
+ ?line Dog=test_server:timetrap(?default_timeout),
+ orber:jump_start([{iiop_port, 0},
+ {iiop_out_ports, {5980, 6000}},
+ {flags, ?ORB_ENV_USE_IPV6}]),
+ [{watchdog, Dog}|Config].
+
+
+fin_per_testcase(_Case, Config) ->
+ orber:jump_stop(),
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+init_all(Config) ->
+ case orber_test_lib:version_ok() of
+ true ->
+ if
+ is_list(Config) ->
+ Config;
+ true ->
+ exit("Config not a list")
+ end;
+ Reason ->
+ Reason
+ end.
+
+finish_all(Config) ->
+ Config.
+
+
+%%-----------------------------------------------------------------
+%% Incomming connections - Deny
+%%-----------------------------------------------------------------
+deny_port_api(doc) -> ["Deny Access due to invalid local port"];
+deny_port_api(suite) -> [];
+deny_port_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, (?ORB_ENV_USE_IPV6 bor
+ ?ORB_ENV_USE_ACL_INCOMING)},
+ {iiop_acl, [{tcp_in, IP++"/128#7000"}]}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ ?match({'EXCEPTION', #'CosNaming_NamingContextExt_InvalidAddress'{}},
+ corba:string_to_object("corbaloc::1.2@"++ServerHost++":"++integer_to_list(ServerPort)++"/NameService")),
+ % ?line catch orber_test_lib:destroy_node(ServerNode, timeout),
+ ok.
+
+deny_port_range_api(doc) -> ["Deny Access due to invalid local port range"];
+deny_port_range_api(suite) -> [];
+deny_port_range_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, (?ORB_ENV_USE_IPV6 bor
+ ?ORB_ENV_USE_ACL_INCOMING)},
+ {iiop_acl, [{tcp_in, IP++"/128#7000/8000"}]}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ ?match({'EXCEPTION', #'CosNaming_NamingContextExt_InvalidAddress'{}},
+ corba:string_to_object("corbaloc::1.2@"++ServerHost++":"++integer_to_list(ServerPort)++"/NameService")),
+% ?line catch orber_test_lib:destroy_node(ServerNode, timeout),
+ ok.
+
+
+deny_host_api(doc) -> ["Deny Access due to invalid host"];
+deny_host_api(suite) -> [];
+deny_host_api(_Config) ->
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, (?ORB_ENV_USE_IPV6 bor
+ ?ORB_ENV_USE_ACL_INCOMING)},
+ {iiop_acl, [{tcp_in, "0:0:0:0:0:0:10.1.1.1/128"}]}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ ?match({'EXCEPTION', #'CosNaming_NamingContextExt_InvalidAddress'{}},
+ corba:string_to_object("corbaloc::1.2@"++ServerHost++":"++integer_to_list(ServerPort)++"/NameService")),
+% ?line catch orber_test_lib:destroy_node(ServerNode, timeout),
+ ok.
+
+deny_peerhost_api(doc) -> ["Deny Access due to invalid peer host"];
+deny_peerhost_api(suite) -> [];
+deny_peerhost_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_},
+ orber_test_lib:js_node([{flags, (?ORB_ENV_USE_IPV6 bor
+ ?ORB_ENV_USE_ACL_INCOMING)},
+ {iiop_acl, [{tcp_in, IP++"/128", ["0:0:0:0:0:0:10.1.1.1"]}]}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ ?match({'EXCEPTION', #'CosNaming_NamingContextExt_InvalidAddress'{}},
+ corba:string_to_object("corbaloc::1.2@"++ServerHost++":"++integer_to_list(ServerPort)++"/NameService")),
+% ?line catch orber_test_lib:destroy_node(ServerNode, timeout),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Incomming connections - Allow
+%%-----------------------------------------------------------------
+allow_port_range_api(doc) -> ["Allow Access due to valid local port range"];
+allow_port_range_api(suite) -> [];
+allow_port_range_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, (?ORB_ENV_USE_IPV6 bor
+ ?ORB_ENV_USE_ACL_INCOMING)},
+ {iiop_acl, [{tcp_in, IP++"/128#5980/6000"}]}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ IOR =
+ ?match({'IOP_IOR',_,_},
+ corba:string_to_object("corbaloc::1.2@"++ServerHost++":"++integer_to_list(ServerPort)++"/NameService")),
+ ?match(false, corba_object:not_existent(IOR)),
+% ?line catch orber_test_lib:destroy_node(ServerNode, timeout),
+ ok.
+
+
+allow_host_api(doc) -> ["Allow Access due to valid host"];
+allow_host_api(suite) -> [];
+allow_host_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, (?ORB_ENV_USE_IPV6 bor
+ ?ORB_ENV_USE_ACL_INCOMING)},
+ {iiop_acl, [{tcp_in, IP++"/128"}]}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ IOR =
+ ?match({'IOP_IOR',_,_},
+ corba:string_to_object("corbaloc::1.2@"++ServerHost++":"++integer_to_list(ServerPort)++"/NameService")),
+ ?match(false, corba_object:not_existent(IOR)),
+
+% ?line catch orber_test_lib:destroy_node(ServerNode, timeout),
+ ok.
+
+allow_peerhost_api(doc) -> ["Allow Access due to valid host"];
+allow_peerhost_api(suite) -> [];
+allow_peerhost_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, (?ORB_ENV_USE_IPV6 bor
+ ?ORB_ENV_USE_ACL_INCOMING)},
+ {iiop_acl, [{tcp_in, IP++"/128", [IP]}]}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ IOR =
+ ?match({'IOP_IOR',_,_},
+ corba:string_to_object("corbaloc::1.2@"++ServerHost++":"++integer_to_list(ServerPort)++"/NameService",
+ [#'IOP_ServiceContext'
+ {context_id=?ORBER_GENERIC_CTX_ID,
+ context_data = {interface, IP}}])),
+ ?match(false, corba_object:not_existent(IOR,
+ [#'IOP_ServiceContext'
+ {context_id=?ORBER_GENERIC_CTX_ID,
+ context_data = {interface, IP}}])),
+
+% ?line catch orber_test_lib:destroy_node(ServerNode, timeout),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test corbaloc strings
+%%-----------------------------------------------------------------
+check_address_api(doc) -> ["Test corbaloc strings"];
+check_address_api(suite) -> [];
+check_address_api(_Config) ->
+ ?match({[[iiop,{1,0},"0:0:0:0:0:FFFF:C02A:2A2A",2809]],"NameService"},
+ orber_cosnaming_utils:addresses(":0:0:0:0:0:FFFF:C02A:2A2A/NameService")),
+ ?match({[[iiop,{1,0},"0:0:0:0:0:FFFF:C02A:2A2A",2809]],[]},
+ orber_cosnaming_utils:addresses(":0:0:0:0:0:FFFF:C02A:2A2A")),
+ ?match({[[iiop,{1,2},"0:0:0:0:0:FFFF:C02A:2A2A",2809]],"NameService"},
+ orber_cosnaming_utils:addresses(":1.2@0:0:0:0:0:FFFF:C02A:2A2A/NameService")),
+ ?match({[[iiop,{1,0},"0:0:0:0:0:FFFF:C02A:2A2A",4001]],"NameService"},
+ orber_cosnaming_utils:addresses(":0:0:0:0:0:FFFF:C02A:2A2A:4001/NameService")),
+ ?match({[[iiop,{1,1},"0:0:0:0:0:FFFF:C02A:2A2A",4001]],"NameService"},
+ orber_cosnaming_utils:addresses(":1.1@0:0:0:0:0:FFFF:C02A:2A2A:4001/NameService")),
+ ?match({[[iiop,{1,1},"0:0:0:0:0:FFFF:C02A:2A2A",4001]],[]},
+ orber_cosnaming_utils:addresses(":1.1@0:0:0:0:0:FFFF:C02A:2A2A:4001")),
+ ?match({[[iiop,{1,1},"0:0:0:0:0:FFFF:C02A:2A2A",4001]],[]},
+ orber_cosnaming_utils:addresses("iiop:1.1@0:0:0:0:0:FFFF:C02A:2A2A:4001")),
+
+ ?match({[[iiop,{1,0},"0:0:0:0:0:FFFF:10.11.11.11",2809]],"NameService"},
+ orber_cosnaming_utils:addresses(":0:0:0:0:0:FFFF:10.11.11.11/NameService")),
+ ?match({[[iiop,{1,0},"0:0:0:0:0:FFFF:10.11.11.11",2809]],[]},
+ orber_cosnaming_utils:addresses(":0:0:0:0:0:FFFF:10.11.11.11")),
+ ?match({[[iiop,{1,2},"0:0:0:0:0:FFFF:10.11.11.11",2809]],"NameService"},
+ orber_cosnaming_utils:addresses(":1.2@0:0:0:0:0:FFFF:10.11.11.11/NameService")),
+ ?match({[[iiop,{1,0},"0:0:0:0:0:FFFF:10.11.11.11",4001]],"NameService"},
+ orber_cosnaming_utils:addresses(":0:0:0:0:0:FFFF:10.11.11.11:4001/NameService")),
+ ?match({[[iiop,{1,1},"0:0:0:0:0:FFFF:10.11.11.11",4001]],"NameService"},
+ orber_cosnaming_utils:addresses(":1.1@0:0:0:0:0:FFFF:10.11.11.11:4001/NameService")),
+ ?match({[[iiop,{1,1},"0:0:0:0:0:FFFF:10.11.11.11",4001]],[]},
+ orber_cosnaming_utils:addresses(":1.1@0:0:0:0:0:FFFF:10.11.11.11:4001/")),
+ ?match({[[iiop,{1,1},"0:0:0:0:0:FFFF:10.11.11.11",4001]],[]},
+ orber_cosnaming_utils:addresses("iiop:1.1@0:0:0:0:0:FFFF:10.11.11.11:4001/")),
+
+ ?match({[[iiop,{1,1},"myhost",4001]],[]},
+ orber_cosnaming_utils:addresses("iiop:1.1@myhost:4001")),
+ ?match({[[iiop,{1,1},"myhost.full.name",4001]],"NameService"},
+ orber_cosnaming_utils:addresses("iiop:[email protected]:4001/NameService")),
+ ?match({[[iiop,{1,1},"myhost",4001],
+ [iiop,{1,1},"myhost.full.name",2809]],"NameService"},
+ orber_cosnaming_utils:addresses("iiop:1.1@myhost:4001,iiop:[email protected]/NameService")),
+
+ ?match({[[iiop,{1,1},"0:0:0:0:0:FFFF:10.11.11.11",4001],
+ [iiop,{1,1},"0:0:0:0:0:FFFF:C02A:2A2A",4001]], "NameService"},
+ orber_cosnaming_utils:addresses(":1.1@0:0:0:0:0:FFFF:10.11.11.11:4001,:1.1@0:0:0:0:0:FFFF:C02A:2A2A:4001/NameService")),
+ ?match({[[iiop,{1,1},"0:0:0:0:0:FFFF:10.11.11.11",4001],
+ [iiop,{1,1},"0:0:0:0:0:FFFF:C02A:2A2A",4001]], []},
+ orber_cosnaming_utils:addresses(":1.1@0:0:0:0:0:FFFF:10.11.11.11:4001,:1.1@0:0:0:0:0:FFFF:C02A:2A2A:4001")),
+ ?match({[[iiop,{1,0},"0:0:0:0:0:FFFF:10.11.11.11",4001],
+ [iiop,{1,1},"0:0:0:0:0:FFFF:C02A:2A2A",4001]], "NameService"},
+ orber_cosnaming_utils:addresses(":0:0:0:0:0:FFFF:10.11.11.11:4001,:1.1@0:0:0:0:0:FFFF:C02A:2A2A:4001/NameService")),
+ ?match({[[iiop,{1,1},"0:0:0:0:0:FFFF:10.11.11.11",4001],
+ [iiop,{1,0},"0:0:0:0:0:FFFF:C02A:2A2A",4001]], "NameService"},
+ orber_cosnaming_utils:addresses(":1.1@0:0:0:0:0:FFFF:10.11.11.11:4001,:0:0:0:0:0:FFFF:C02A:2A2A:4001/NameService")),
+ ?match({[[iiop,{1,1},"0:0:0:0:0:FFFF:10.11.11.11",2809],
+ [iiop,{1,1},"0:0:0:0:0:FFFF:C02A:2A2A",4001]], "NameService"},
+ orber_cosnaming_utils:addresses(":1.1@0:0:0:0:0:FFFF:10.11.11.11,:1.1@0:0:0:0:0:FFFF:C02A:2A2A:4001/NameService")),
+ ?match({[[iiop,{1,1},"0:0:0:0:0:FFFF:10.11.11.11",4001],
+ [iiop,{1,1},"0:0:0:0:0:FFFF:C02A:2A2A",2809]], "NameService"},
+ orber_cosnaming_utils:addresses(":1.1@0:0:0:0:0:FFFF:10.11.11.11:4001,:1.1@0:0:0:0:0:FFFF:C02A:2A2A/NameService")),
+ ?match({[[iiop,{1,0},"0:0:0:0:0:FFFF:10.11.11.11",2809],
+ [iiop,{1,0},"0:0:0:0:0:FFFF:C02A:2A2A",2809]], "NameService"},
+ orber_cosnaming_utils:addresses(":0:0:0:0:0:FFFF:10.11.11.11,:0:0:0:0:0:FFFF:C02A:2A2A/NameService")),
+ ?match({[[iiop,{1,0},"0:0:0:0:0:FFFF:10.11.11.11",2809],
+ [iiop,{1,0},"0:0:0:0:0:FFFF:C02A:2A2A",2809]], []},
+ orber_cosnaming_utils:addresses(":0:0:0:0:0:FFFF:10.11.11.11,:0:0:0:0:0:FFFF:C02A:2A2A/")),
+ ?match({[[iiop,{1,0},"0:0:0:0:0:FFFF:10.11.11.11",2809],
+ [iiop,{1,0},"0:0:0:0:0:FFFF:C02A:2A2A",2809]], []},
+ orber_cosnaming_utils:addresses("iiop:0:0:0:0:0:FFFF:10.11.11.11,:0:0:0:0:0:FFFF:C02A:2A2A/")),
+
+ [IP] = ?match([_], orber:host()),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, (?ORB_ENV_USE_IPV6 bor
+ ?ORB_ENV_USE_ACL_INCOMING)},
+ {iiop_acl, [{tcp_in, IP++"/128"}]}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ ?match({'IOP_IOR',_,_},
+ corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")),
+% ?line catch orber_test_lib:destroy_node(ServerNode, timeout),
+ ok.
+
+
diff --git a/lib/orber/test/orber_firewall_ipv6_out_SUITE.erl b/lib/orber/test/orber_firewall_ipv6_out_SUITE.erl
new file mode 100644
index 0000000000..e1856b9a47
--- /dev/null
+++ b/lib/orber/test/orber_firewall_ipv6_out_SUITE.erl
@@ -0,0 +1,231 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2004-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+
+-module(orber_firewall_ipv6_out_SUITE).
+
+-include("test_server.hrl").
+-include_lib("orber/include/corba.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming.hrl").
+-include_lib("orber/src/orber_iiop.hrl").
+-include_lib("orber/src/ifr_objects.hrl").
+-include("idl_output/orber_test_server.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming_NamingContextExt.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming_NamingContext.hrl").
+
+-define(default_timeout, ?t:minutes(15)).
+
+-define(match(ExpectedRes,Expr),
+ fun() ->
+ AcTuAlReS = (catch (Expr)),
+ case AcTuAlReS of
+ ExpectedRes ->
+ io:format("------ CORRECT RESULT ------~n~p~n",
+ [AcTuAlReS]),
+ AcTuAlReS;
+ _ ->
+ io:format("###### ERROR ERROR ######~nRESULT: ~p~n",
+ [AcTuAlReS]),
+ ?line exit(AcTuAlReS)
+ end
+ end()).
+
+%%-----------------------------------------------------------------
+%% External exports
+%%-----------------------------------------------------------------
+-export([all/1, cases/0, init_all/1, finish_all/1,
+ init_per_testcase/2, fin_per_testcase/2,
+ deny_port_api/1, deny_port_range_api/1, deny_host_api/1,
+ allow_port_api/1, allow_port_range_api/1, allow_host_api/1,
+ local_interface_api/1]).
+
+%%-----------------------------------------------------------------
+%% Func: all/1
+%% Args:
+%% Returns:
+%%-----------------------------------------------------------------
+all(doc) -> ["API tests for orber's firewall functionallity."];
+all(suite) -> {req,
+ [mnesia],
+ {conf, init_all, cases(), finish_all}}.
+
+%% NOTE - the fragment test cases must bu first since we explicitly set a request
+%% id. Otherwise, the request-id counter would be increased and we cannot know
+%% what it is.
+cases() ->
+ [deny_port_api, deny_port_range_api, deny_host_api,
+ allow_port_api, allow_port_range_api, allow_host_api,
+ local_interface_api].
+
+
+init_per_testcase(_Case, Config) ->
+ ?line Dog=test_server:timetrap(?default_timeout),
+ orber:jump_start([{iiop_port, 0},
+ {iiop_out_ports, {5980, 6000}},
+ {flags, ?ORB_ENV_USE_IPV6}]),
+ [{watchdog, Dog}|Config].
+
+
+fin_per_testcase(_Case, Config) ->
+ orber:jump_stop(),
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+init_all(Config) ->
+ case orber_test_lib:version_ok() of
+ true ->
+ if
+ is_list(Config) ->
+ Config;
+ true ->
+ exit("Config not a list")
+ end;
+ Reason ->
+ Reason
+ end.
+
+finish_all(Config) ->
+ Config.
+
+
+%%-----------------------------------------------------------------
+%% Incomming connections - Deny
+%%-----------------------------------------------------------------
+deny_port_api(doc) -> ["Deny Access due to invalid local port"];
+deny_port_api(suite) -> [];
+deny_port_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ ServerPort = orber:iiop_port(),
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, (?ORB_ENV_USE_IPV6 bor
+ ?ORB_ENV_USE_ACL_OUTGOING)},
+ {iiop_acl, [{tcp_out, IP++"/128#" ++ integer_to_list(ServerPort+10)}]}])),
+ ?match({'EXCEPTION', #'CosNaming_NamingContextExt_InvalidAddress'{}},
+ orber_test_lib:remote_apply(ServerNode, corba, string_to_object,
+ ["corbaloc::1.2@"++ServerHost++":"++integer_to_list(ServerPort)++"/NameService"])),
+% ?line catch orber_test_lib:destroy_node(ServerNode, timeout),
+ ok.
+
+deny_port_range_api(doc) -> ["Deny Access due to invalid local port range"];
+deny_port_range_api(suite) -> [];
+deny_port_range_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ ServerPort = orber:iiop_port(),
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, (?ORB_ENV_USE_IPV6 bor
+ ?ORB_ENV_USE_ACL_OUTGOING)},
+ {iiop_acl, [{tcp_out, IP++"/128#"++integer_to_list(ServerPort+100)++ "/" ++ integer_to_list(ServerPort+120)}]}])),
+ ?match({'EXCEPTION', #'CosNaming_NamingContextExt_InvalidAddress'{}},
+ orber_test_lib:remote_apply(ServerNode, corba, string_to_object,
+ ["corbaloc::1.2@"++ServerHost++":"++integer_to_list(ServerPort)++"/NameService"])),
+% ?line catch orber_test_lib:destroy_node(ServerNode, timeout),
+ ok.
+
+
+deny_host_api(doc) -> ["Deny Access due to invalid host"];
+deny_host_api(suite) -> [];
+deny_host_api(_Config) ->
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, (?ORB_ENV_USE_IPV6 bor
+ ?ORB_ENV_USE_ACL_OUTGOING)},
+ {iiop_acl, [{tcp_out, "0:0:0:0:0:0:10.1.1.1/128"}]}])),
+ ServerPort = orber:iiop_port(),
+ ?match({'EXCEPTION', #'CosNaming_NamingContextExt_InvalidAddress'{}},
+ orber_test_lib:remote_apply(ServerNode, corba, string_to_object,
+ ["corbaloc::1.2@"++ServerHost++":"++integer_to_list(ServerPort)++"/NameService"])),
+% ?line catch orber_test_lib:destroy_node(ServerNode, timeout),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Incomming connections - Allow
+%%-----------------------------------------------------------------
+allow_port_api(doc) -> ["Allow Access due to valid local port"];
+allow_port_api(suite) -> [];
+allow_port_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ ServerPort = orber:iiop_port(),
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, (?ORB_ENV_USE_IPV6 bor
+ ?ORB_ENV_USE_ACL_OUTGOING)},
+ {iiop_acl, [{tcp_out, IP++"/128#" ++ integer_to_list(ServerPort)}]}])),
+ IOR =
+ ?match({'IOP_IOR',_,_},
+ orber_test_lib:remote_apply(ServerNode, corba, string_to_object,
+ ["corbaloc::1.2@"++ServerHost++":"++integer_to_list(ServerPort)++"/NameService"])),
+ ?match(false,
+ orber_test_lib:remote_apply(ServerNode, corba_object, not_existent, [IOR])),
+% ?line catch orber_test_lib:destroy_node(ServerNode, timeout),
+ ok.
+
+allow_port_range_api(doc) -> ["Allow Access due to valid local port range"];
+allow_port_range_api(suite) -> [];
+allow_port_range_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ ServerPort = orber:iiop_port(),
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, (?ORB_ENV_USE_IPV6 bor
+ ?ORB_ENV_USE_ACL_OUTGOING)},
+ {iiop_acl, [{tcp_out, IP++"/128#" ++ integer_to_list(ServerPort-10) ++ "/" ++ integer_to_list(ServerPort+10)}]}])),
+ IOR =
+ ?match({'IOP_IOR',_,_},
+ orber_test_lib:remote_apply(ServerNode, corba, string_to_object,
+ ["corbaloc::1.2@"++ServerHost++":"++integer_to_list(ServerPort)++"/NameService"])),
+ ?match(false,
+ orber_test_lib:remote_apply(ServerNode, corba_object, not_existent, [IOR])),
+% ?line catch orber_test_lib:destroy_node(ServerNode, timeout),
+ ok.
+
+
+allow_host_api(doc) -> ["Allow Access due to valid host"];
+allow_host_api(suite) -> [];
+allow_host_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, (?ORB_ENV_USE_IPV6 bor
+ ?ORB_ENV_USE_ACL_OUTGOING)},
+ {iiop_acl, [{tcp_out, IP}]}])),
+ ServerPort = orber:iiop_port(),
+ IOR =
+ ?match({'IOP_IOR',_,_},
+ orber_test_lib:remote_apply(ServerNode, corba, string_to_object,
+ ["corbaloc::1.2@"++ServerHost++":"++integer_to_list(ServerPort)++"/NameService"])),
+ ?match(false,
+ orber_test_lib:remote_apply(ServerNode, corba_object, not_existent, [IOR])),
+% ?line catch orber_test_lib:destroy_node(ServerNode, timeout),
+ ok.
+
+local_interface_api(doc) -> ["Allow Access due to valid host via a spcific interface"];
+local_interface_api(suite) -> [];
+local_interface_api(_Config) ->
+ [IP] = ?match([_], orber:host()),
+ {ok, ServerNode, ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, (?ORB_ENV_USE_IPV6 bor
+ ?ORB_ENV_USE_ACL_OUTGOING)},
+ {iiop_acl, [{tcp_out, IP, [IP]}]}])),
+ ServerPort = orber:iiop_port(),
+ IOR =
+ ?match({'IOP_IOR',_,_},
+ orber_test_lib:remote_apply(ServerNode, corba, string_to_object,
+ ["corbaloc::1.2@"++ServerHost++":"++integer_to_list(ServerPort)++"/NameService"])),
+ ?match(false,
+ orber_test_lib:remote_apply(ServerNode, corba_object, not_existent, [IOR])),
+% ?line catch orber_test_lib:destroy_node(ServerNode, timeout),
+ ok.
+
diff --git a/lib/orber/test/orber_nat_SUITE.erl b/lib/orber/test/orber_nat_SUITE.erl
new file mode 100644
index 0000000000..5b295dd1aa
--- /dev/null
+++ b/lib/orber/test/orber_nat_SUITE.erl
@@ -0,0 +1,372 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2006-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+
+-module(orber_nat_SUITE).
+
+-include("test_server.hrl").
+-include_lib("orber/include/corba.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming.hrl").
+-include_lib("orber/src/orber_iiop.hrl").
+-include_lib("orber/src/ifr_objects.hrl").
+-include("idl_output/orber_test_server.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming_NamingContextExt.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming_NamingContext.hrl").
+
+
+-define(default_timeout, ?t:minutes(15)).
+
+-define(match(ExpectedRes,Expr),
+ fun() ->
+ AcTuAlReS = (catch (Expr)),
+ case AcTuAlReS of
+ ExpectedRes ->
+ io:format("------ CORRECT RESULT ------~n~p~n",
+ [AcTuAlReS]),
+ AcTuAlReS;
+ _ ->
+ io:format("###### ERROR ERROR ######~nRESULT: ~p~n",
+ [AcTuAlReS]),
+ ?line exit(AcTuAlReS)
+ end
+ end()).
+
+%%-----------------------------------------------------------------
+%% External exports
+%%-----------------------------------------------------------------
+-export([all/1, cases/0, init_all/1, finish_all/1,
+ init_per_testcase/2, fin_per_testcase/2,
+ nat_ip_address/1, nat_ip_address_multiple/1,
+ nat_ip_address_local/1, nat_ip_address_local_local/1,
+ nat_iiop_port/1, nat_iiop_port_local/1,
+ nat_iiop_port_local_local/1, nat_iiop_ssl_port/1,
+ nat_iiop_ssl_port_local/1]).
+
+
+%%-----------------------------------------------------------------
+%% Internal exports
+%%-----------------------------------------------------------------
+
+%%-----------------------------------------------------------------
+%% Func: all/1
+%% Args:
+%% Returns:
+%%-----------------------------------------------------------------
+all(doc) -> ["API tests for multi orber interfaces",
+ "This suite test intra-ORB communication. There are three scenarios:",
+ "* No security at all (multi_orber_api)",
+ "* Two secure orbs using ssl (ssl_multi_orb_api)",
+ "* One secure and one orb with no security. (ssl_multi_orb_api)"];
+all(suite) -> {req,
+ [mnesia],
+ {conf, init_all, cases(), finish_all}}.
+
+cases() ->
+ [
+ nat_ip_address,
+ nat_ip_address_multiple,
+ nat_ip_address_local,
+ nat_iiop_port,
+ nat_iiop_port_local,
+ nat_ip_address_local_local,
+ nat_iiop_port_local_local,
+ nat_iiop_ssl_port,
+ nat_iiop_ssl_port_local
+ ].
+
+%%-----------------------------------------------------------------
+%% Init and cleanup functions.
+%%-----------------------------------------------------------------
+
+init_per_testcase(_Case, Config) ->
+ Path = code:which(?MODULE),
+ code:add_pathz(filename:join(filename:dirname(Path), "idl_output")),
+ Dog=test_server:timetrap(?default_timeout),
+ orber:jump_start([{iiop_port, 0},
+ {flags, 0}]),
+ oe_orber_test_server:oe_register(),
+ [{watchdog, Dog}|Config].
+
+
+fin_per_testcase(_Case, Config) ->
+ oe_orber_test_server:oe_unregister(),
+ orber:jump_stop(),
+ Path = code:which(?MODULE),
+ code:del_path(filename:join(filename:dirname(Path), "idl_output")),
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+init_all(Config) ->
+ if
+ is_list(Config) ->
+ Config;
+ true ->
+ exit("Config not a list")
+ end.
+
+finish_all(Config) ->
+ Config.
+
+%%-----------------------------------------------------------------
+%% API tests for NAT
+%%-----------------------------------------------------------------
+
+nat_ip_address(doc) -> ["This case test if the server ORB use the correct",
+ "interface when exporting IOR:s"];
+nat_ip_address(suite) -> [];
+nat_ip_address(_Config) ->
+ IP = orber_test_lib:get_host(),
+ Loopback = orber_test_lib:get_loopback_interface(),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_ENABLE_NAT},
+ {nat_ip_address, Loopback}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ IOR = ?match(#'IOP_IOR'{},
+ corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")),
+ ?match({'external', {Loopback, ServerPort, _ObjectKey, _Counter, _TP, _NewHD}},
+ iop_ior:get_key(IOR)),
+ ok.
+
+nat_ip_address_multiple(doc) -> ["This case test if the server ORB use the correct",
+ "interface when exporting IOR:s"];
+nat_ip_address_multiple(suite) -> [];
+nat_ip_address_multiple(_Config) ->
+ IP = orber_test_lib:get_host(),
+
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_ENABLE_NAT},
+ {nat_ip_address, {multiple, ["10.0.0.1"]}}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ IOR = ?match(#'IOP_IOR'{},
+ corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")),
+ ?match({'external', {"10.0.0.1", ServerPort, _ObjectKey, _Counter, _TP, _NewHD}},
+ iop_ior:get_key(IOR)),
+ ok.
+
+nat_ip_address_local(doc) -> ["This case test if the server ORB use the correct",
+ "interface when exporting IOR:s"];
+nat_ip_address_local(suite) -> [];
+nat_ip_address_local(_Config) ->
+ IP = orber_test_lib:get_host(),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_ENABLE_NAT},
+ {nat_ip_address, {local, "10.0.0.1", [{IP, "127.0.0.1"}]}}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ IOR = ?match(#'IOP_IOR'{},
+ corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")),
+ ?match({'external', {"10.0.0.1", ServerPort, _ObjectKey, _Counter, _TP, _NewHD}},
+ iop_ior:get_key(IOR)),
+ ok.
+
+nat_ip_address_local_local(doc) -> ["This case test if the server ORB use the correct",
+ "interface when exporting IOR:s"];
+nat_ip_address_local_local(suite) -> [];
+nat_ip_address_local_local(_Config) ->
+ IP = orber_test_lib:get_host(),
+ Loopback = orber_test_lib:get_loopback_interface(),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags,
+ (?ORB_ENV_LOCAL_INTERFACE bor
+ ?ORB_ENV_ENABLE_NAT)},
+ {nat_ip_address, {local, "10.0.0.1", [{IP, "10.0.0.2"}]}}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ IOR1 = ?match(#'IOP_IOR'{},
+ corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")),
+ ?match({'external', {"10.0.0.2", ServerPort, _ObjectKey, _Counter, _TP, _NewHD}},
+ iop_ior:get_key(IOR1)),
+ IOR2 = ?match(#'IOP_IOR'{},
+ corba:string_to_object("corbaloc::1.2@"++Loopback++":"++integer_to_list(ServerPort)++"/NameService")),
+ ?match({'external', {"10.0.0.1", ServerPort, _ObjectKey, _Counter, _TP, _NewHD}},
+ iop_ior:get_key(IOR2)),
+ ok.
+
+nat_iiop_port(doc) -> ["This case test if the server ORB use the correct",
+ "port when exporting IOR:s"];
+nat_iiop_port(suite) -> [];
+nat_iiop_port(_Config) ->
+ IP = orber_test_lib:get_host(),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_ENABLE_NAT},
+ {nat_iiop_port, 42}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ IOR = ?match(#'IOP_IOR'{},
+ corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")),
+ ?match({'external', {_IP, 42, _ObjectKey, _Counter, _TP, _NewHD}},
+ iop_ior:get_key(IOR)),
+ ok.
+
+nat_iiop_port_local(doc) -> ["This case test if the server ORB use the correct",
+ "port when exporting IOR:s"];
+nat_iiop_port_local(suite) -> [];
+nat_iiop_port_local(_Config) ->
+ IP = orber_test_lib:get_host(),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags, ?ORB_ENV_ENABLE_NAT},
+ {nat_iiop_port, {local, 42, [{4001, 43}]}}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ IOR = ?match(#'IOP_IOR'{},
+ corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")),
+ ?match({'external', {_IP, 42, _ObjectKey, _Counter, _TP, _NewHD}},
+ iop_ior:get_key(IOR)),
+ ok.
+
+nat_iiop_port_local_local(doc) -> ["This case test if the server ORB use the correct",
+ "port when exporting IOR:s"];
+nat_iiop_port_local_local(suite) -> [];
+nat_iiop_port_local_local(_Config) ->
+ IP = orber_test_lib:get_host(),
+ Loopback = orber_test_lib:get_loopback_interface(),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node([{flags,
+ (?ORB_ENV_LOCAL_INTERFACE bor
+ ?ORB_ENV_ENABLE_NAT)},
+ {ip_address, IP}])),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ orber_test_lib:remote_apply(ServerNode, orber_env, configure_override, [nat_iiop_port, {local, 42, [{ServerPort, 43}]}]),
+ IOR1 = ?match(#'IOP_IOR'{},
+ corba:string_to_object("corbaloc::1.2@"++IP++":"++integer_to_list(ServerPort)++"/NameService")),
+ ?match({'external', {IP, 43, _ObjectKey, _Counter, _TP, _NewHD}},
+ iop_ior:get_key(IOR1)),
+ {ok, Ref} = ?match({ok, _},
+ orber_test_lib:remote_apply(ServerNode, orber,
+ add_listen_interface,
+ [Loopback, normal, 10088])),
+ IOR2 = ?match(#'IOP_IOR'{},
+ corba:string_to_object("corbaloc::1.2@"++Loopback++":10088/NameService")),
+ ?match({'external', {IP, 42, _ObjectKey, _Counter, _TP, _NewHD}},
+ iop_ior:get_key(IOR2)),
+ ?match(ok,
+ orber_test_lib:remote_apply(ServerNode, orber,
+ remove_listen_interface, [Ref])),
+ ok.
+
+
+%%-----------------------------------------------------------------
+%% API tests for ORB to ORB, ssl security depth 1
+%%-----------------------------------------------------------------
+
+nat_iiop_ssl_port(doc) -> ["SECURE MULTI ORB API tests (SSL depth 1)",
+ "Make sure NAT works for SSL"];
+nat_iiop_ssl_port(suite) -> [];
+nat_iiop_ssl_port(_Config) ->
+ case os:type() of
+ vxworks ->
+ {skipped, "No SSL-support for VxWorks."};
+ _ ->
+ IP = orber_test_lib:get_host(),
+ ServerOptions = orber_test_lib:get_options(iiop_ssl, server,
+ 1, [{iiop_ssl_port, 0},
+ {flags, ?ORB_ENV_ENABLE_NAT},
+ {ip_address, IP}]),
+ ClientOptions = orber_test_lib:get_options(iiop_ssl, client,
+ 1, [{iiop_ssl_port, 0}]),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node(ServerOptions)),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ SSLServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_ssl_port, []),
+ NATSSLServerPort = SSLServerPort+1,
+ {ok, Ref} = ?match({ok, _},
+ orber_test_lib:remote_apply(ServerNode, orber,
+ add_listen_interface,
+ [IP, ssl, NATSSLServerPort])),
+ orber_test_lib:remote_apply(ServerNode, orber_env, configure_override,
+ [nat_iiop_ssl_port,
+ {local, NATSSLServerPort, [{4001, 43}]}]),
+
+ {ok, ClientNode, _ClientHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node(ClientOptions)),
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ install_test_data,
+ [ssl])),
+
+ IOR1 = ?match(#'IOP_IOR'{},
+ orber_test_lib:remote_apply(ClientNode, corba,
+ string_to_object,
+ ["corbaname::1.2@"++IP++":"++
+ integer_to_list(ServerPort)++"/NameService#mamba"])),
+
+ ?match({'external', {_IP, _Port, _ObjectKey, _Counter, _TP,
+ #host_data{protocol = ssl,
+ ssl_data = #'SSLIOP_SSL'{port = NATSSLServerPort}}}},
+ iop_ior:get_key(IOR1)),
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ uninstall_test_data,
+ [ssl])),
+ ?match(ok,
+ orber_test_lib:remote_apply(ServerNode, orber,
+ remove_listen_interface, [Ref])),
+ ok
+ end.
+
+nat_iiop_ssl_port_local(doc) -> ["SECURE MULTI ORB API tests (SSL depth 1)",
+ "Make sure NAT works for SSL"];
+nat_iiop_ssl_port_local(suite) -> [];
+nat_iiop_ssl_port_local(_Config) ->
+ case os:type() of
+ vxworks ->
+ {skipped, "No SSL-support for VxWorks."};
+ _ ->
+ IP = orber_test_lib:get_host(),
+ ServerOptions = orber_test_lib:get_options(iiop_ssl, server,
+ 1, [{iiop_ssl_port, 0},
+ {flags,
+ (?ORB_ENV_LOCAL_INTERFACE bor
+ ?ORB_ENV_ENABLE_NAT)},
+ {ip_address, IP}]),
+ ClientOptions = orber_test_lib:get_options(iiop_ssl, client,
+ 1, [{iiop_ssl_port, 0}]),
+ {ok, ServerNode, _ServerHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node(ServerOptions)),
+ ServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_port, []),
+ SSLServerPort = orber_test_lib:remote_apply(ServerNode, orber, iiop_ssl_port, []),
+ NATSSLServerPort = SSLServerPort+1,
+ {ok, Ref} = ?match({ok, _},
+ orber_test_lib:remote_apply(ServerNode, orber,
+ add_listen_interface,
+ [IP, ssl, NATSSLServerPort])),
+ orber_test_lib:remote_apply(ServerNode, orber_env, configure_override,
+ [nat_iiop_ssl_port,
+ {local, NATSSLServerPort, [{NATSSLServerPort, NATSSLServerPort}]}]),
+
+ {ok, ClientNode, _ClientHost} =
+ ?match({ok,_,_}, orber_test_lib:js_node(ClientOptions)),
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ install_test_data,
+ [ssl])),
+
+ IOR1 = ?match(#'IOP_IOR'{},
+ orber_test_lib:remote_apply(ClientNode, corba,
+ string_to_object,
+ ["corbaname::1.2@"++IP++":"++
+ integer_to_list(ServerPort)++"/NameService#mamba"])),
+
+ ?match({'external', {_IP, _Port, _ObjectKey, _Counter, _TP,
+ #host_data{protocol = ssl,
+ ssl_data = #'SSLIOP_SSL'{port = NATSSLServerPort}}}},
+ iop_ior:get_key(IOR1)),
+ ?match(ok, orber_test_lib:remote_apply(ServerNode, orber_test_lib,
+ uninstall_test_data,
+ [ssl])),
+ ?match(ok,
+ orber_test_lib:remote_apply(ServerNode, orber,
+ remove_listen_interface, [Ref])),
+ ok
+ end.
+
diff --git a/lib/orber/test/orber_test.idl b/lib/orber/test/orber_test.idl
new file mode 100644
index 0000000000..3d943f2d18
--- /dev/null
+++ b/lib/orber/test/orber_test.idl
@@ -0,0 +1,95 @@
+//
+// %CopyrightBegin%
+//
+// Copyright Ericsson AB 1997-2010. All Rights Reserved.
+//
+// The contents of this file are subject to the Erlang Public License,
+// Version 1.1, (the "License"); you may not use this file except in
+// compliance with the License. You should have received a copy of the
+// Erlang Public License along with this software. If not, it can be
+// retrieved online at http://www.erlang.org/.
+//
+// Software distributed under the License is distributed on an "AS IS"
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+// the License for the specific language governing rights and limitations
+// under the License.
+//
+// %CopyrightEnd%
+//
+module Module
+{
+
+ enum Enum {horse, pig, cow};
+
+ struct Struct0 {
+ long l;
+ short s;
+ char c;
+ };
+
+ struct Struct1 {
+ string s;
+ unsigned short us;
+ unsigned long ul;
+ };
+
+ struct Struct2 {
+ sequence <long> long_sequence;
+ Enum e;
+ octet o;
+ };
+
+ struct HEADER {
+ short EID;
+ short NDW;
+ short SSID;
+ };
+
+ enum Enum1 {orange,banana, apple};
+
+ union Union switch (short) {
+ case 0: short First;
+ case 1: string Second;
+ case 2: char Third;
+ };
+
+ union Union1 switch (Enum){
+ case horse: short horse;
+ case pig: sequence <string> Second;
+ case cow: Enum1 Third;
+ };
+
+ union Union2 switch (Enum){
+ case horse: long a[10];
+ case pig: Union u;
+ case cow: Union1 u1;
+ };
+
+ exception Except1 {
+ string why;
+ sequence <string> rest_of_name;
+ };
+
+ exception Except2 {
+ Enum1 e;
+ Struct2 s;
+ };
+
+ exception Except3 {
+ Union1 u;
+ unsigned short s;
+ Object o ;
+ };
+
+ exception Except4 {};
+
+ interface I1 {
+ void a();
+ };
+
+ interface I2 {
+ void a();
+ };
+
+};
+
diff --git a/lib/orber/test/orber_test_lib.erl b/lib/orber/test/orber_test_lib.erl
new file mode 100644
index 0000000000..a694dc58c4
--- /dev/null
+++ b/lib/orber/test/orber_test_lib.erl
@@ -0,0 +1,1498 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1999-2010. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+
+-module(orber_test_lib).
+-include("test_server.hrl").
+-include_lib("orber/include/corba.hrl").
+-include_lib("orber/include/ifr_types.hrl").
+-include_lib("orber/src/orber_iiop.hrl").
+-include("idl_output/orber_test_server.hrl").
+-include_lib("orber/COSS/CosNaming/CosNaming.hrl").
+
+-define(match(ExpectedRes,Expr),
+ fun() ->
+ AcTuAlReS = (catch (Expr)),
+ case AcTuAlReS of
+ ExpectedRes ->
+ io:format("------ CORRECT RESULT ------~n~p~n",
+ [AcTuAlReS]),
+ AcTuAlReS;
+ _ ->
+ io:format("###### ERROR ERROR ######~nRESULT: ~p~n",
+ [AcTuAlReS]),
+ ?line exit(AcTuAlReS)
+ end
+ end()).
+
+-export([js_node/2,
+ js_node/1,
+ js_node/0,
+ slave_sup/0,
+ remote_apply/4,
+ install_test_data/1,
+ light_tests/3,
+ uninstall_test_data/1,
+ destroy_node/2,
+ lookup/2,
+ alternate_iiop_address/2,
+ create_alternate_iiop_address/2,
+ alternate_ssl_iiop_address/3,
+ create_alternate_ssl_iiop_address/3,
+ test_coding/1,
+ test_coding/2,
+ corba_object_tests/2,
+ timeouts/3,
+ precond/3,
+ postcond/4,
+ oe_get_interface/0,
+ create_components_IOR/1,
+ get_options/2,
+ get_options/3,
+ get_options/4,
+ version_ok/0,
+ ssl_version/0,
+ get_loopback_interface/0,
+ get_loopback_interface/1,
+ get_host/0,
+ get_host/1]).
+
+%% Interceptor functions.
+-export([new_out_connection/3,
+ new_in_connection/3,
+ closed_in_connection/1,
+ closed_out_connection/1,
+ in_request_encoded/6,
+ in_reply_encoded/6,
+ out_reply_encoded/6,
+ out_request_encoded/6,
+ in_request/6,
+ in_reply/6,
+ out_reply/6,
+ out_request/6]).
+
+%%------------------------------------------------------------
+%% function : ssl_version
+%% Arguments:
+%% Returns : integer()
+%% Effect :
+%%
+%%------------------------------------------------------------
+ssl_version() ->
+ case catch erlang:system_info(otp_release) of
+ Version when is_list(Version) ->
+ if
+ "R12B" < Version ->
+ 3;
+ true ->
+ 2
+ end;
+ _ ->
+ 2
+ end.
+
+%%------------------------------------------------------------
+%% function : version_ok
+%% Arguments:
+%% Returns : true | {skipped, Reason}
+%% Effect :
+%%
+%%------------------------------------------------------------
+version_ok() ->
+ {ok, Hostname} = inet:gethostname(),
+ case inet:getaddr(Hostname, inet6) of
+ {error,nxdomain} ->
+ {skipped, "Inet cannot handle IPv6"};
+ _ ->
+ case inet:getaddr("0:0:0:0:0:FFFF:127.0.0.1", inet6) of
+ {error,nxdomain} ->
+ {skipped, "Inet cannot handle IPv6"};
+ _ ->
+ case gen_tcp:listen(0, [{reuseaddr, true}, inet6]) of
+ {ok, LSock} ->
+ gen_tcp:close(LSock),
+ true;
+ {error, _} ->
+ {skipped, "Inet cannot handle IPv6"}
+ end
+ end
+ end.
+%%------------------------------------------------------------
+%% function : get_host
+%% Arguments: Family - inet | inet6
+%% Returns : string()
+%% Effect :
+%%
+%%------------------------------------------------------------
+get_host() ->
+ get_host(inet).
+get_host(Family) ->
+ case os:type() of
+ {win32, _} ->
+ case os:version() of
+ {6, _, _} when Family == inet ->
+ "127.0.0.1";
+ {6, _, _} ->
+ "0:0:0:0:0:FFFF:7F00:0001";
+ _ ->
+ [IP] = ?match([_], orber:host()),
+ IP
+ end;
+ _ ->
+ [IP] = ?match([_], orber:host()),
+ IP
+ end.
+
+%%------------------------------------------------------------
+%% function : get_loopback_interface
+%% Arguments: Family - inet | inet6
+%% Returns : string()
+%% Effect :
+%%
+%%------------------------------------------------------------
+get_loopback_interface() ->
+ get_loopback_interface(inet).
+get_loopback_interface(Family) ->
+ case os:type() of
+ {win32, _} ->
+ case os:version() of
+ {6, _, _} when Family == inet ->
+ "127.0.0.2";
+ {6, _, _} ->
+ "0:0:0:0:0:FFFF:7F00:0002";
+ _ when Family == inet ->
+ "127.0.0.1";
+ _ ->
+ "0:0:0:0:0:FFFF:7F00:0001"
+ end;
+ _ when Family == inet ->
+ "127.0.0.1";
+ _ ->
+ "0:0:0:0:0:FFFF:7F00:0001"
+ end.
+
+%%------------------------------------------------------------
+%% function : js_node/4
+%% Arguments: Port - which iiop_port (integer())
+%% InitOptions - [{Key, Value}]
+%% {Type, StartOptions} - {lightweight, [{Key, Value}]}
+%% Returns : {ok, Node} | {error, _}
+%% Effect : Starts a new slave-node with given (optinally)
+%% extra arguments. If fails it retries 'Retries' times.
+%%------------------------------------------------------------
+js_node() ->
+ js_node([], []).
+
+js_node(InitOptions) when is_list(InitOptions) ->
+ js_node(InitOptions, []).
+
+js_node(InitOptions, StartOptions) when is_list(InitOptions) ->
+ {A,B,C} = erlang:now(),
+ [_, Host] = string:tokens(atom_to_list(node()), [$@]),
+ _NewInitOptions = check_options(InitOptions),
+ js_node_helper(Host, 0, lists:concat([A,'_',B,'_',C]),
+ InitOptions, 10, StartOptions).
+
+js_node_helper(Host, Port, Name, Options, Retries, StartOptions) ->
+ case starter(Host, Name, create_paths()) of
+ {ok, NewNode} ->
+ case net_adm:ping(NewNode) of
+ pong ->
+ start_ssl(lists:member({secure, ssl}, Options), NewNode),
+ {ok, Cwd} = file:get_cwd(),
+ Path = code:get_path(),
+ ok = rpc:call(NewNode, file, set_cwd, [Cwd]),
+ true = rpc:call(NewNode, code, set_path, [Path]),
+ rpc:call(NewNode, application, load, [orber]),
+ ok = rpc:call(NewNode, corba, orb_init,
+ [[{iiop_port, Port},
+ {orber_debug_level, 10}|Options]]),
+ start_orber(StartOptions, NewNode),
+ spawn_link(NewNode, ?MODULE, slave_sup, []),
+ rpc:multicall([node() | nodes()], global, sync, []),
+ ok = rpc:call(NewNode, orber, info, [io]),
+ {ok, NewNode, Host};
+ _ ->
+ {error, "net_adm:ping(Node) failed"}
+ end;
+ {error, Reason} when Retries == 0 ->
+ {error, Reason};
+ {error, Reason} ->
+ io:format("Could not start slavenode ~p:~p due to: ~p~n",
+ [Host, Port, Reason]),
+ timer:sleep(500),
+ js_node_helper(Host, Port, Name, Options, Retries-1, StartOptions)
+ end.
+
+check_options(Options) ->
+ case {os:type(), os:version()} of
+ {{win32, _}, {6, _, _}} ->
+ %% Vista, need to run additional checks.
+ case {orber_tb:keysearch(ip_address, Options),
+ orber_tb:keysearch(flags, Options, 0)} of
+ {undefined, Flags} ->
+ case ?ORB_FLAG_TEST(Flags, ?ORB_ENV_USE_IPV6) of
+ true ->
+ [{ip_address, get_host(inet6)}|Options];
+ false ->
+ [{ip_address, get_host(inet)}|Options]
+ end;
+ _ ->
+ Options
+ end;
+ _ ->
+ Options
+ end.
+
+starter(Host, Name, Args) ->
+ case os:type() of
+ vxworks ->
+ test_server:start_node(Name, slave, [{args,Args}]);
+ _ ->
+ slave:start_link(Host, Name, Args)
+ end.
+
+slave_sup() ->
+ process_flag(trap_exit, true),
+ receive
+ {'EXIT', _, _} ->
+ case os:type() of
+ vxworks ->
+ erlang:halt();
+ _ ->
+ ignore
+ end
+ end.
+
+start_ssl(true, Node) ->
+ rpc:call(Node, ssl, start, []),
+ rpc:call(Node, crypto, start, []),
+ rpc:call(Node, ssl, seed, ["testing"]);
+start_ssl(_, _) ->
+ ok.
+
+start_orber({lightweigth, Options}, Node) ->
+ ok = rpc:call(Node, orber, start_lightweight, [Options]);
+start_orber(lightweight, Node) ->
+ ok = rpc:call(Node, orber, start_lightweight, []);
+start_orber(_, Node) ->
+ ok = rpc:call(Node, orber, jump_start, []).
+
+
+%%-----------------------------------------------------------------
+%% Type - ssl | iiop_ssl
+%% Role - 'server' | 'client'
+%% Options - [{Key, Value}]
+%%-----------------------------------------------------------------
+get_options(Type, Role) ->
+ get_options(Type, Role, 2, []).
+
+get_options(ssl, Role, Level) ->
+ get_options(ssl, Role, Level, []).
+
+get_options(ssl, Role, 2, Options) ->
+ Dir = filename:join([code:lib_dir(ssl), "examples", "certs", "etc"]),
+ [{depth, 2},
+ {verify, 2},
+ {keyfile, filename:join([Dir, Role, "key.pem"])},
+ {cacertfile, filename:join([Dir, Role, "cacerts.pem"])},
+ {certfile, filename:join([Dir, Role, "cert.pem"])}|Options];
+get_options(iiop_ssl, _Role, 2, Options) ->
+ Dir = filename:join([code:lib_dir(ssl), "examples", "certs", "etc"]),
+ [{ssl_server_depth, 2},
+ {ssl_server_verify, 2},
+ {ssl_server_certfile, filename:join([Dir, "server", "cert.pem"])},
+ {ssl_server_cacertfile, filename:join([Dir, "server", "cacerts.pem"])},
+ {ssl_server_keyfile, filename:join([Dir, "server", "key.pem"])},
+ {ssl_client_depth, 2},
+ {ssl_client_verify, 2},
+ {ssl_client_certfile, filename:join([Dir, "client", "cert.pem"])},
+ {ssl_client_cacertfile, filename:join([Dir, "client", "cacerts.pem"])},
+ {ssl_client_keyfile, filename:join([Dir, "client", "key.pem"])},
+ {secure, ssl}|Options];
+get_options(iiop_ssl, _Role, 1, Options) ->
+ Dir = filename:join([code:lib_dir(ssl), "examples", "certs", "etc"]),
+ [{ssl_server_depth, 1},
+ {ssl_server_verify, 0},
+ {ssl_server_certfile, filename:join([Dir, "server", "cert.pem"])},
+ {ssl_server_cacertfile, filename:join([Dir, "server", "cacerts.pem"])},
+ {ssl_server_keyfile, filename:join([Dir, "server", "key.pem"])},
+ {ssl_client_depth, 1},
+ {ssl_client_verify, 0},
+ {ssl_client_certfile, filename:join([Dir, "client", "cert.pem"])},
+ {ssl_client_cacertfile, filename:join([Dir, "client", "cacerts.pem"])},
+ {ssl_client_keyfile, filename:join([Dir, "client", "key.pem"])},
+ {secure, ssl}|Options].
+
+
+create_paths() ->
+ Path = filename:dirname(code:which(?MODULE)),
+ " -pa " ++ Path ++ " -pa " ++
+ filename:join(Path, "idl_output") ++
+ " -pa " ++
+ filename:join(Path, "all_SUITE_data") ++
+ " -pa " ++
+ filename:dirname(code:which(orber)).
+
+%%------------------------------------------------------------
+%% function : destroy_node
+%% Arguments: Node - which node to destroy.
+%% Type - normal | ssl
+%% Returns :
+%% Effect :
+%%------------------------------------------------------------
+
+destroy_node(Node, Type) ->
+ stopper(Node, Type).
+
+stopper(Node, _Type) ->
+ case os:type() of
+ vxworks ->
+ test_server:stop_node(Node);
+ _ ->
+ slave:stop(Node)
+ end.
+
+
+%%------------------------------------------------------------
+%% function : remote_apply
+%% Arguments: N - Node, M - Module,
+%% F - Function, A - Arguments (list)
+%% Returns :
+%% Effect :
+%%------------------------------------------------------------
+remote_apply(N, M,F,A) ->
+ case rpc:call(N, M, F, A) of
+ {badrpc, Reason} ->
+ exit(Reason);
+ Other ->
+ Other
+ end.
+
+
+
+%%------------------------------------------------------------
+%% function : install_test_data
+%% Arguments: WhichSuite
+%% Returns : ok
+%% Effect : Installs test data associated with 'WhichSuite'
+%%------------------------------------------------------------
+
+install_test_data(nameservice) ->
+ oe_orber_test_server:oe_register(),
+ Mamba = orber_test_server:oe_create([], [{regname, {local, mamba}}]),
+ true = corba:add_initial_service("Mamba", Mamba),
+ NS = corba:resolve_initial_references("NameService"),
+ NC1 = lname_component:set_id(lname_component:create(), "mamba"),
+ N = lname:insert_component(lname:create(), 1, NC1),
+ 'CosNaming_NamingContext':bind(NS, N,Mamba);
+
+install_test_data({nameservice, AltAddr, AltPort}) ->
+ oe_orber_test_server:oe_register(),
+ Obj = orber_test_server:oe_create([], [{regname, {local, mamba}}]),
+ Mamba = corba:add_alternate_iiop_address(Obj, AltAddr, AltPort),
+ true = corba:add_initial_service("Mamba", Mamba),
+ NS = corba:resolve_initial_references("NameService"),
+ NC1 = lname_component:set_id(lname_component:create(), "mamba"),
+ N = lname:insert_component(lname:create(), 1, NC1),
+ 'CosNaming_NamingContext':bind(NS, N,Mamba);
+
+install_test_data(timeout) ->
+ oe_orber_test_server:oe_register(),
+ Mamba = orber_test_server:oe_create([], {local, mamba}),
+ Viper = orber_test_timeout_server:oe_create([], {local, viper}),
+ NS = corba:resolve_initial_references("NameService"),
+ NC1 = lname_component:set_id(lname_component:create(), "mamba"),
+ N1 = lname:insert_component(lname:create(), 1, NC1),
+ NC2 = lname_component:set_id(lname_component:create(), "viper"),
+ N2 = lname:insert_component(lname:create(), 1, NC2),
+ 'CosNaming_NamingContext':bind(NS, N1, Mamba),
+ 'CosNaming_NamingContext':bind(NS, N2, Viper);
+
+install_test_data(pseudo) ->
+ oe_orber_test_server:oe_register(),
+ Mamba = orber_test_server:oe_create([], [{pseudo,true}]),
+ NS = corba:resolve_initial_references("NameService"),
+ NC1 = lname_component:set_id(lname_component:create(), "mamba"),
+ N = lname:insert_component(lname:create(), 1, NC1),
+ 'CosNaming_NamingContext':bind(NS, N,Mamba);
+
+install_test_data(ssl) ->
+ oe_orber_test_server:oe_register(),
+ Mamba = orber_test_server:oe_create([], [{regname, {local, mamba}}]),
+ NS = corba:resolve_initial_references("NameService"),
+ NC1 = lname_component:set_id(lname_component:create(), "mamba"),
+ N = lname:insert_component(lname:create(), 1, NC1),
+ 'CosNaming_NamingContext':bind(NS, N,Mamba);
+
+install_test_data(ssl_simple) ->
+ oe_orber_test_server:oe_register();
+
+install_test_data(light) ->
+ %% Nothing to do at the moment but we might in the future
+ ok;
+
+install_test_data(_) ->
+ {error, "no_implement"}.
+
+
+%%------------------------------------------------------------
+%% function : uninstall_test_data
+%% Arguments: WhichSuite
+%% Returns : ok
+%% Effect : Uninstalls test data associated with 'WhichSuite'
+%%------------------------------------------------------------
+
+uninstall_test_data(pseudo) ->
+ NS = corba:resolve_initial_references("NameService"),
+ NC1 = lname_component:set_id(lname_component:create(), "mamba"),
+ N = lname:insert_component(lname:create(), 1, NC1),
+ _Obj = (catch 'CosNaming_NamingContext':resolve(NS, N)),
+ catch 'CosNaming_NamingContext':destroy(NS),
+ oe_orber_test_server:oe_unregister();
+
+uninstall_test_data(timeout) ->
+ NS = corba:resolve_initial_references("NameService"),
+ NC1 = lname_component:set_id(lname_component:create(), "mamba"),
+ N1 = lname:insert_component(lname:create(), 1, NC1),
+
+ NC2 = lname_component:set_id(lname_component:create(), "viper"),
+ N2 = lname:insert_component(lname:create(), 1, NC2),
+ Mamba = (catch 'CosNaming_NamingContext':resolve(NS, N1)),
+ Viper = (catch 'CosNaming_NamingContext':resolve(NS, N2)),
+ catch corba:dispose(Mamba),
+ catch corba:dispose(Viper),
+ catch 'CosNaming_NamingContext':destroy(NS),
+ oe_orber_test_server:oe_unregister();
+
+uninstall_test_data(nameservice) ->
+ true = corba:remove_initial_service("Mamba"),
+ NS = corba:resolve_initial_references("NameService"),
+ NC1 = lname_component:set_id(lname_component:create(), "mamba"),
+ N = lname:insert_component(lname:create(), 1, NC1),
+ Obj = (catch 'CosNaming_NamingContext':resolve(NS, N)),
+ catch corba:dispose(Obj),
+ catch 'CosNaming_NamingContext':destroy(NS),
+ oe_orber_test_server:oe_unregister();
+
+uninstall_test_data(ssl) ->
+ NS = corba:resolve_initial_references("NameService"),
+ NC1 = lname_component:set_id(lname_component:create(), "mamba"),
+ N = lname:insert_component(lname:create(), 1, NC1),
+ Obj = (catch 'CosNaming_NamingContext':resolve(NS, N)),
+ catch corba:dispose(Obj),
+ catch 'CosNaming_NamingContext':destroy(NS),
+ oe_orber_test_server:oe_unregister();
+
+uninstall_test_data(ssl_simple) ->
+ oe_orber_test_server:oe_unregister();
+
+uninstall_test_data(light) ->
+ %% Nothing to do at the moment but we might in the future
+ ok;
+
+uninstall_test_data(_) ->
+ {error, "no_implement"}.
+
+%%------------------------------------------------------------
+%% function : corba_object_tests
+%% Arguments: TestServerObj a orber_test_server ref
+%% OtherObj - any other Orber object.
+%% Returns : term()
+%% Effect :
+%%------------------------------------------------------------
+
+corba_object_tests(TestServerObj, OtherObj) ->
+ ?match(false,
+ corba_object:is_a(TestServerObj, "IDL:orber_parent/inherrit:1.0")),
+ ?match(true,
+ corba_object:is_a(TestServerObj, "IDL:omg.org/orber_parent/inherrit:1.0")),
+ ?match(true,
+ corba_object:is_a(TestServerObj, "IDL:omg.org/orber_test/server:1.0")),
+ ?match(false,
+ corba_object:is_a(TestServerObj, "IDL:orber_test/server:1.0")),
+ ?match(false,
+ corba_object:is_a(TestServerObj, "IDL:omg.org/orber_parent/inherrit:1.1")),
+ ?match(false,
+ corba_object:is_a(TestServerObj, "NotValidIFRID")),
+ ?match(false,
+ corba_object:is_nil(TestServerObj)),
+ ?match(false,
+ corba_object:is_equivalent(OtherObj,TestServerObj)),
+ ?match(true,
+ corba_object:is_equivalent(TestServerObj,TestServerObj)),
+ ?match(false, corba_object:non_existent(TestServerObj)),
+ ?match(false, corba_object:not_existent(TestServerObj)),
+ ?match(#fullinterfacedescription{}, corba_object:get_interface(TestServerObj)),
+
+ ok.
+
+%%------------------------------------------------------------
+%% function : lookup
+%% Arguments: Port - which port the other orb uses.
+%% Returns : term()
+%% Effect :
+%%------------------------------------------------------------
+
+lookup(Host, Port) ->
+ Key = Host++":"++integer_to_list(Port),
+ NSR = corba:resolve_initial_references_remote("NameService",
+ ["iiop://"++Key]),
+
+ NC1 = lname_component:set_id(lname_component:create(), "not_exist"),
+ N1 = lname:insert_component(lname:create(), 1, NC1),
+ ?match({'EXCEPTION',{'CosNaming_NamingContext_NotFound',_,_,_}},
+ 'CosNaming_NamingContext':resolve(NSR, N1)),
+
+ NC2 = lname_component:set_id(lname_component:create(), "mamba"),
+ N2 = lname:insert_component(lname:create(), 1, NC2),
+ Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
+ 'CosNaming_NamingContext':resolve(NSR, N2)),
+ orber_test_server:print(Obj),
+ Obj2 = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
+ corba:string_to_object("corbaname:iiop:1.1@"++Key++"/NameService#mamba")),
+
+ orber_test_server:print(Obj2),
+
+ NSR2 = ?match({'IOP_IOR',"IDL:omg.org/CosNaming/NamingContextExt:1.0",_},
+ corba:string_to_object("corbaloc:iiop:1.1@"++Key++"/NameService")),
+ Obj3 = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
+ 'CosNaming_NamingContext':resolve(NSR2, N2)),
+ orber_test_server:print(Obj3).
+
+%%------------------------------------------------------------
+%% function : alternate_iiop_address
+%% Arguments: Port - which port the other orb uses.
+%% Returns : term()
+%% Effect :
+%%------------------------------------------------------------
+alternate_iiop_address(Host, Port) ->
+ IOR = create_alternate_iiop_address(Host, Port),
+
+ ?match(false, corba_object:non_existent(IOR)),
+ ?match({'object_forward',_}, corba:locate(IOR)),
+ ?match({'object_forward',_}, corba:locate(IOR, 10000)),
+ ok.
+
+%%------------------------------------------------------------
+%% function : create_alternate_iiop_address
+%% Arguments: Port - which port the other orb uses.
+%% Returns : term()
+%% Effect :
+%%------------------------------------------------------------
+create_alternate_iiop_address(Host, Port) ->
+ MC = [#'IOP_TaggedComponent'{tag = ?TAG_ORB_TYPE,
+ component_data = ?ORBER_ORB_TYPE_1},
+ #'IOP_TaggedComponent'{tag = ?TAG_CODE_SETS,
+ component_data = ?DEFAULT_CODESETS},
+ #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS,
+ component_data = #'ALTERNATE_IIOP_ADDRESS'{
+ 'HostID' = Host,
+ 'Port' = Port}},
+ #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS,
+ component_data = #'ALTERNATE_IIOP_ADDRESS'{
+ 'HostID' = Host,
+ 'Port' = 8000}},
+ #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS,
+ component_data = #'ALTERNATE_IIOP_ADDRESS'{
+ 'HostID' = Host,
+ 'Port' = 8000}}],
+ #'IOP_IOR'{type_id=TypeID,
+ profiles=P1} = _IORA = iop_ior:create({1,2},
+ "IDL:omg.org/CosNaming/NamingContextExt:1.0",
+ [Host], 8000, -1,
+ "NameService", MC, 0, 0),
+ #'IOP_IOR'{profiles=P2} = _IORB = iop_ior:create({1,1},
+ "IDL:omg.org/CosNaming/NamingContextExt:1.0",
+ [Host], 8000, -1,
+ "NameService", [], 0, 0),
+ #'IOP_IOR'{type_id=TypeID, profiles=P2++P1}.
+
+
+%%------------------------------------------------------------
+%% function : create_components_IOR
+%% Arguments:
+%% Returns : term()
+%% Effect :
+%%------------------------------------------------------------
+create_components_IOR(Version) ->
+ MC = [#'IOP_TaggedComponent'{tag = ?TAG_ORB_TYPE,
+ component_data = ?ORBER_ORB_TYPE_1},
+ #'IOP_TaggedComponent'{tag = ?TAG_CODE_SETS,
+ component_data = ?DEFAULT_CODESETS},
+ #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS,
+ component_data = #'ALTERNATE_IIOP_ADDRESS'{
+ 'HostID' = "127.0.0.1",
+ 'Port' = 4001}},
+ #'IOP_TaggedComponent'{tag = ?TAG_SSL_SEC_TRANS,
+ component_data = #'SSLIOP_SSL'{target_supports = 0,
+ target_requires = 1,
+ port = 2}},
+ #'IOP_TaggedComponent'{tag = ?TAG_FT_GROUP,
+ component_data =
+ #'FT_TagFTGroupTaggedComponent'
+ {version = #'GIOP_Version'{major = 1,
+ minor = 2},
+ ft_domain_id = "FT_FTDomainId",
+ object_group_id = ?ULONGLONGMAX,
+ object_group_ref_version = ?LONGMAX}},
+ #'IOP_TaggedComponent'{tag = ?TAG_FT_PRIMARY,
+ component_data =
+ #'FT_TagFTPrimaryTaggedComponent'{primary = true}},
+ #'IOP_TaggedComponent'{tag = ?TAG_FT_HEARTBEAT_ENABLED,
+ component_data =
+ #'FT_TagFTHeartbeatEnabledTaggedComponent'{heartbeat_enabled = true}},
+ #'IOP_TaggedComponent'{tag = ?TAG_CSI_SEC_MECH_LIST,
+ component_data =
+ #'CSIIOP_CompoundSecMechList'
+ {stateful = false,
+ mechanism_list =
+ [#'CSIIOP_CompoundSecMech'
+ {target_requires = 6,
+ transport_mech =
+ #'IOP_TaggedComponent'
+ {tag=?TAG_TLS_SEC_TRANS,
+ component_data=#'CSIIOP_TLS_SEC_TRANS'
+ {target_supports = 7,
+ target_requires = 8,
+ addresses =
+ [#'CSIIOP_TransportAddress'{host_name = "127.0.0.1",
+ port = 6001}]}},
+ as_context_mech =
+ #'CSIIOP_AS_ContextSec'
+ {target_supports = 9, target_requires = 10,
+ client_authentication_mech = [1, 255],
+ target_name = [2,255]},
+ sas_context_mech =
+ #'CSIIOP_SAS_ContextSec'
+ {target_supports = 11, target_requires = 12,
+ privilege_authorities =
+ [#'CSIIOP_ServiceConfiguration'
+ {syntax = ?ULONGMAX,
+ name = [3,255]}],
+ supported_naming_mechanisms = [[4,255],[5,255]],
+ supported_identity_types = ?ULONGMAX}},
+ #'CSIIOP_CompoundSecMech'
+ {target_requires = 6,
+ transport_mech =
+ #'IOP_TaggedComponent'
+ {tag=?TAG_NULL_TAG,
+ component_data=[]},
+ as_context_mech =
+ #'CSIIOP_AS_ContextSec'
+ {target_supports = 9, target_requires = 10,
+ client_authentication_mech = [1, 255],
+ target_name = [2,255]},
+ sas_context_mech =
+ #'CSIIOP_SAS_ContextSec'
+ {target_supports = 11, target_requires = 12,
+ privilege_authorities =
+ [#'CSIIOP_ServiceConfiguration'
+ {syntax = ?ULONGMAX,
+ name = [3,255]}],
+ supported_naming_mechanisms = [[4,255],[5,255]],
+ supported_identity_types = ?ULONGMAX}},
+ #'CSIIOP_CompoundSecMech'
+ {target_requires = 6,
+ transport_mech =
+ #'IOP_TaggedComponent'
+ {tag=?TAG_SECIOP_SEC_TRANS,
+ component_data=#'CSIIOP_SECIOP_SEC_TRANS'
+ {target_supports = 7,
+ target_requires = 8,
+ mech_oid = [0,255],
+ target_name = [0,255],
+ addresses =
+ [#'CSIIOP_TransportAddress'{host_name = "127.0.0.1",
+ port = 6001}]}},
+ as_context_mech =
+ #'CSIIOP_AS_ContextSec'
+ {target_supports = 9, target_requires = 10,
+ client_authentication_mech = [1, 255],
+ target_name = [2,255]},
+ sas_context_mech =
+ #'CSIIOP_SAS_ContextSec'
+ {target_supports = 11, target_requires = 12,
+ privilege_authorities =
+ [#'CSIIOP_ServiceConfiguration'
+ {syntax = ?ULONGMAX,
+ name = [3,255]}],
+ supported_naming_mechanisms = [[4,255],[5,255]],
+ supported_identity_types = ?ULONGMAX}}]}}],
+ iop_ior:create(Version, "IDL:omg.org/CosNaming/NamingContextExt:1.0",
+ ["127.0.0.1"], 5001, -1,
+ "NameService", MC, 0, 0).
+
+
+%%------------------------------------------------------------
+%% function : alternate_ssl_iiop_address
+%% Arguments: Port - which port the other orb uses.
+%% Returns : term()
+%% Effect :
+%%------------------------------------------------------------
+alternate_ssl_iiop_address(Host, Port, SSLPort) ->
+ IOR = create_alternate_ssl_iiop_address(Host, Port, SSLPort),
+
+ ?match(false, corba_object:non_existent(IOR)),
+ ?match({'object_forward',_}, corba:locate(IOR)),
+ ?match({'object_forward',_}, corba:locate(IOR, 10000)),
+ ok.
+
+
+%%------------------------------------------------------------
+%% function : create_alternate_ssl_iiop_address
+%% Arguments: Port - which port the other orb uses.
+%% Returns : term()
+%% Effect :
+%%------------------------------------------------------------
+create_alternate_ssl_iiop_address(Host, Port, SSLPort) ->
+ MC = [#'IOP_TaggedComponent'{tag = ?TAG_ORB_TYPE,
+ component_data = ?ORBER_ORB_TYPE_1},
+ #'IOP_TaggedComponent'{tag = ?TAG_CODE_SETS,
+ component_data = ?DEFAULT_CODESETS},
+ #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS,
+ component_data = #'ALTERNATE_IIOP_ADDRESS'{
+ 'HostID' = Host,
+ 'Port' = Port}},
+ #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS,
+ component_data = #'ALTERNATE_IIOP_ADDRESS'{
+ 'HostID' = Host,
+ 'Port' = 8000}},
+ #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS,
+ component_data = #'ALTERNATE_IIOP_ADDRESS'{
+ 'HostID' = Host,
+ 'Port' = 8000}},
+ #'IOP_TaggedComponent'{tag=?TAG_SSL_SEC_TRANS,
+ component_data=#'SSLIOP_SSL'{target_supports = 2,
+ target_requires = 2,
+ port = SSLPort}}],
+ #'IOP_IOR'{type_id=TypeID,
+ profiles=P1} = _IORA = iop_ior:create_external({1,2},
+ "IDL:omg.org/CosNaming/NamingContextExt:1.0",
+ Host, 8000,
+ "NameService", MC),
+ #'IOP_IOR'{profiles=P2} = _IORB = iop_ior:create_external({1,1},
+ "IDL:omg.org/CosNaming/NamingContextExt:1.0",
+ Host, 8000,
+ "NameService", []),
+ #'IOP_IOR'{type_id=TypeID, profiles=P2++P1}.
+
+
+%%------------------------------------------------------------
+%% function : timeouts
+%% Arguments: Port - which port the other orb uses.
+%% Returns : term()
+%% Effect :
+%%------------------------------------------------------------
+
+timeouts(Host, Port, ReqT) ->
+ NSR = corba:resolve_initial_references_remote("NameService",
+ ["iiop://"++Host++":"++integer_to_list(Port)]),
+ NC1 = lname_component:set_id(lname_component:create(), "mamba"),
+ N1 = lname:insert_component(lname:create(), 1, NC1),
+ NC2 = lname_component:set_id(lname_component:create(), "viper"),
+ N2 = lname:insert_component(lname:create(), 1, NC2),
+ Mamba = 'CosNaming_NamingContext':resolve(NSR, N1),
+ Viper = 'CosNaming_NamingContext':resolve(NSR, N2),
+
+ ?match({'EXCEPTION',{'TIMEOUT',_,_,_}},
+ orber_test_timeout_server:twoway_function(Viper, ReqT, ReqT*2)),
+ ?match(ok, orber_test_timeout_server:oneway_function(Viper, ReqT*2)),
+
+ ?match({'EXCEPTION',{'TIMEOUT',_,_,_}},
+ orber_test_server:testing_iiop_twoway_delay(Mamba, ReqT)),
+ ?match(ok, orber_test_server:testing_iiop_oneway_delay(Mamba, ReqT)),
+
+ %% Since the objects are stalled we must wait until they are available again
+ %% to be able to run any more tests and get the correct results.
+ timer:sleep(ReqT*4),
+
+ ?match(ok, orber_test_timeout_server:twoway_function(Viper, ReqT*2, ReqT)),
+ ?match(ok, orber_test_timeout_server:oneway_function(Viper, ReqT*2)),
+
+ ?match(ok, orber_test_server:testing_iiop_twoway_delay(Mamba, 0)),
+ ?match(ok, orber_test_server:testing_iiop_oneway_delay(Mamba, 0)),
+
+ timer:sleep(ReqT*4),
+ ok.
+
+%%------------------------------------------------------------
+%% function : light_tests
+%% Arguments: Host - which node to contact.
+%% Port - which port the other orb uses.
+%% Returns : term()
+%% Effect :
+%%------------------------------------------------------------
+
+light_tests(Host, Port, ObjName) ->
+ NSR = corba:resolve_initial_references_remote("NameService",
+ ["iiop://"++Host++":"++integer_to_list(Port)]),
+ NC1 = lname_component:set_id(lname_component:create(), "not_exist"),
+ N1 = lname:insert_component(lname:create(), 1, NC1),
+ %% We cannot handle any unknown replies (besides those found in stub).
+ ?match({'EXCEPTION',
+ {'CosNaming_NamingContext_NotFound',
+ "IDL:omg.org/CosNaming/NamingContext/NotFound:1.0",_,_}},
+ 'CosNaming_NamingContext':resolve(NSR, N1)),
+ NC2 = lname_component:set_id(lname_component:create(), ObjName),
+ N2 = lname:insert_component(lname:create(), 1, NC2),
+ Obj = ?match({'IOP_IOR',"IDL:omg.org/orber_test/server:1.0",_},
+ 'CosNaming_NamingContext':resolve(NSR, N2)),
+ Nodes = orber:get_lightweight_nodes(),
+ io:format("Light Nodes: ~p~n", [Nodes]),
+ orber_test_server:print(Obj),
+ test_coding(Obj),
+ ok.
+
+
+%%------------------------------------------------------------
+%% function : test_coding_simple
+%% Arguments: ObjReference
+%% Returns : term()
+%% Effect : test encode/decode for all simple datatypes.
+%%------------------------------------------------------------
+
+test_coding(Obj) ->
+ test_coding(Obj, false).
+
+test_coding(Obj, Local) ->
+ %%--- Testing code and decode arguments ---
+ ?match({ok, 1.5}, orber_test_server:testing_iiop_float(Obj, 1.5)),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_float(Obj, atom)),
+
+ ?match({ok,1.0}, orber_test_server:testing_iiop_double(Obj, 1.0)),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_double(Obj, "wrong")),
+
+ ?match({ok,0}, orber_test_server:testing_iiop_short(Obj, 0)),
+ ?match({ok,?SHORTMAX}, orber_test_server:testing_iiop_short(Obj, ?SHORTMAX)),
+ ?match({ok,?SHORTMIN}, orber_test_server:testing_iiop_short(Obj, ?SHORTMIN)),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_short(Obj, atomic)),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_short(Obj, ?SHORTMAX+1)),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_short(Obj, ?SHORTMIN-1)),
+
+ ?match({ok,0}, orber_test_server:testing_iiop_ushort(Obj, 0)),
+ ?match({ok,?USHORTMAX}, orber_test_server:testing_iiop_ushort(Obj, ?USHORTMAX)),
+ ?match({ok,?USHORTMIN}, orber_test_server:testing_iiop_ushort(Obj, ?USHORTMIN)),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_ushort(Obj, ?USHORTMAX+1)),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_ushort(Obj, ?USHORTMIN-1)),
+
+ ?match({ok,0}, orber_test_server:testing_iiop_long(Obj, 0)),
+ ?match({ok,?LONGMAX}, orber_test_server:testing_iiop_long(Obj, ?LONGMAX)),
+ ?match({ok,?LONGMIN}, orber_test_server:testing_iiop_long(Obj, ?LONGMIN)),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_long(Obj, "wrong")),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_long(Obj, ?LONGMAX+1)),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_long(Obj, ?LONGMIN-1)),
+
+ ?match({ok,0}, orber_test_server:testing_iiop_longlong(Obj, 0)),
+ ?match({ok,?LONGLONGMAX}, orber_test_server:testing_iiop_longlong(Obj, ?LONGLONGMAX)),
+ ?match({ok,?LONGLONGMIN}, orber_test_server:testing_iiop_longlong(Obj, ?LONGLONGMIN)),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_longlong(Obj, "wrong")),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_longlong(Obj, ?LONGLONGMAX+1)),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_longlong(Obj, ?LONGLONGMIN-1)),
+
+ ?match({ok,0}, orber_test_server:testing_iiop_ulong(Obj, 0)),
+ ?match({ok,?ULONGMAX}, orber_test_server:testing_iiop_ulong(Obj, ?ULONGMAX)),
+ ?match({ok,?ULONGMIN}, orber_test_server:testing_iiop_ulong(Obj, ?ULONGMIN)),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_ulong(Obj, ?ULONGMAX+1)),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_ulong(Obj, ?ULONGMIN-1)),
+
+ ?match({ok,0}, orber_test_server:testing_iiop_ulonglong(Obj, 0)),
+ ?match({ok,?ULONGLONGMAX}, orber_test_server:testing_iiop_ulonglong(Obj, ?ULONGLONGMAX)),
+ ?match({ok,?ULONGLONGMIN}, orber_test_server:testing_iiop_ulonglong(Obj, ?ULONGLONGMIN)),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_ulonglong(Obj, ?ULONGLONGMAX+1)),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_ulonglong(Obj, ?ULONGLONGMIN-1)),
+
+ ?match({ok,98}, orber_test_server:testing_iiop_char(Obj, 98)),
+ ?match({ok,$b}, orber_test_server:testing_iiop_char(Obj, $b)),
+
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_char(Obj, atomic)),
+
+ ?match({ok,65535}, orber_test_server:testing_iiop_wchar(Obj, 65535)),
+ ?match({ok,$b}, orber_test_server:testing_iiop_wchar(Obj, $b)),
+
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_wchar(Obj, atomic)),
+
+ ?match({ok,true}, orber_test_server:testing_iiop_bool(Obj, true)),
+ ?match({ok,false}, orber_test_server:testing_iiop_bool(Obj, false)),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_bool(Obj, atom)),
+
+ ?match({ok,1}, orber_test_server:testing_iiop_octet(Obj, 1)),
+% No real guards for this case.
+% ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+% orber_test_server:testing_iiop_octet(Obj, 1.5)),
+ IOR12 = create_components_IOR({1,2}),
+ ?match({ok,Obj}, orber_test_server:testing_iiop_obj(Obj, Obj)),
+ ?match({ok,IOR12}, orber_test_server:testing_iiop_obj(Obj, IOR12)),
+ PObj = orber_test_server:oe_create([], [{pseudo,true}]),
+ ?match({ok, _}, orber_test_server:testing_iiop_obj(Obj, PObj)),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_obj(Obj, "no_object")),
+ ?match({ok,"string"}, orber_test_server:testing_iiop_string(Obj, "string")),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_string(Obj, "ToLongString")),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_string(Obj, atomic)),
+
+ ?match({ok,[65535]}, orber_test_server:testing_iiop_wstring(Obj, [65535])),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_wstring(Obj, "ToLongWstring")),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_wstring(Obj, atomic)),
+
+ ?match({ok, one},
+ orber_test_server:testing_iiop_enum(Obj, one)),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_enum(Obj, three)),
+ ?match({ok,[1,2,3]},
+ orber_test_server:testing_iiop_seq(Obj, [1,2,3])),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_seq(Obj, [1,2,3,4])),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_seq(Obj, false)),
+
+
+ ?match({ok,[#orber_test_server_struc{a=1, b=2}]},
+ orber_test_server:testing_iiop_struc_seq(Obj,
+ [#orber_test_server_struc{a=1, b=2}])),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_struc_seq(Obj, false)),
+
+ ?match({ok,[#orber_test_server_uni{label=1, value=66}]},
+ orber_test_server:testing_iiop_uni_seq(Obj,
+ [#orber_test_server_uni{label=1, value=66}])),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_uni_seq(Obj, false)),
+
+ ?match({ok,{"one", "two"}},
+ orber_test_server:testing_iiop_array(Obj, {"one", "two"})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_array(Obj, {"one", "two", "three"})),
+ ?match({ok,#orber_test_server_struc{a=1, b=2}},
+ orber_test_server:testing_iiop_struct(Obj,
+ #orber_test_server_struc{a=1, b=2})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_struct(Obj,
+ #orber_test_server_struc{a="WRONG", b=2})),
+ ?match({ok,#orber_test_server_uni{label=1, value=66}},
+ orber_test_server:testing_iiop_union(Obj,
+ #orber_test_server_uni{label=1, value=66})),
+
+ ?match({ok,#orber_test_server_uni_d{label=1, value=66}},
+ orber_test_server:testing_iiop_union_d(Obj,
+ #orber_test_server_uni_d{label=1, value=66})),
+
+ ?match({ok,#orber_test_server_uni_d{label=2, value=true}},
+ orber_test_server:testing_iiop_union_d(Obj,
+ #orber_test_server_uni_d{label=2, value=true})),
+
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_union_d(Obj,
+ #orber_test_server_uni_d{label=2, value=66})),
+
+ case Local of
+ true ->
+ ?match({ok,#orber_test_server_uni{label=2, value=66}},
+ orber_test_server:testing_iiop_union(Obj,
+ #orber_test_server_uni{label=2, value=66}));
+ false ->
+ ?match({ok,#orber_test_server_uni{label=2, value=undefined}},
+ orber_test_server:testing_iiop_union(Obj,
+ #orber_test_server_uni{label=2, value=66}))
+ end,
+
+ C1 = orber_test_server:fixed52const1(),
+ C2 = orber_test_server:fixed52const2(),
+ C3 = orber_test_server:fixed52const3(),
+
+ C4 = orber_test_server:fixed52negconst1(),
+ C5 = orber_test_server:fixed52negconst2(),
+ C6 = orber_test_server:fixed52negconst3(),
+
+ ?match({ok,C1}, orber_test_server:testing_iiop_fixed(Obj, C1)),
+ ?match({ok,C2}, orber_test_server:testing_iiop_fixed(Obj, C2)),
+ ?match({ok,C3}, orber_test_server:testing_iiop_fixed(Obj, C3)),
+ ?match({ok,C4}, orber_test_server:testing_iiop_fixed(Obj, C4)),
+ ?match({ok,C5}, orber_test_server:testing_iiop_fixed(Obj, C5)),
+ ?match({ok,C6}, orber_test_server:testing_iiop_fixed(Obj, C6)),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_fixed(Obj, #fixed{digits = 5,
+ scale = 2,
+ value = 123450})),
+
+ ?match(ok, orber_test_server:testing_iiop_void(Obj)),
+
+ ?match({'EXCEPTION',{'BAD_QOS',_,_,_}},
+ orber_test_server:pseudo_call_raise_exc(Obj, 1)),
+ ?match({'EXCEPTION',{'BAD_QOS',_,_,_}},
+ orber_test_server:pseudo_call_raise_exc(Obj, 2)),
+ ?match({'EXCEPTION',{'orber_test_server_UserDefinedException',_}},
+ orber_test_server:raise_local_exception(Obj)),
+ ?match({'EXCEPTION',{'orber_test_server_ComplexUserDefinedException',_,
+ [#orber_test_server_struc{a=1, b=2}]}},
+ orber_test_server:raise_complex_local_exception(Obj)),
+ %% Test all TypeCodes
+ ?match({ok, #any{typecode = tk_long, value = 1}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_long,
+ value = 1})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_long,
+ value = "wrong"})),
+ ?match({ok, #any{typecode = tk_float, value = 1.5}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_float,
+ value = 1.5})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_long,
+ value = "wrong"})),
+ ?match({ok, #any{typecode = tk_double}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_double,
+ value = 1.0})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_double,
+ value = "wrong"})),
+ ?match({ok, #any{typecode = tk_short, value = -1}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_short,
+ value = -1})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_short,
+ value = atomic})),
+ ?match({ok, #any{typecode = tk_ushort, value = 1}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ushort,
+ value = 1})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ushort,
+ value = -1})),
+ ?match({ok, #any{typecode = tk_long, value = 1}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_long,
+ value = 1})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_long,
+ value = "wrong"})),
+ ?match({ok, #any{typecode = tk_longlong, value = 1}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_longlong,
+ value = 1})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_longlong,
+ value = "wrong"})),
+ ?match({ok, #any{typecode = tk_ulong, value = 1}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ulong,
+ value = 1})),
+ ?match({ok, #any{typecode = tk_ulong, value = 4294967295}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ulong,
+ value = 4294967295})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ulong,
+ value = 4294967296})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ulong,
+ value = -1})),
+ ?match({ok, #any{typecode = tk_ulonglong, value = 1}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ulonglong,
+ value = 1})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_ulonglong,
+ value = -1})),
+ ?match({ok, #any{typecode = tk_char, value = 98}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_char,
+ value = 98})),
+ ?match({ok, #any{typecode = tk_char, value = $b}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_char,
+ value = $b})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_char,
+ value = atomic})),
+ ?match({ok, #any{typecode = tk_wchar, value = 65535}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_wchar,
+ value = 65535})),
+ ?match({ok, #any{typecode = tk_wchar, value = $b}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_wchar,
+ value = $b})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_wchar,
+ value = atomic})),
+ ?match({ok, #any{typecode = tk_boolean, value = true}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_boolean,
+ value = true})),
+ ?match({ok, #any{typecode = tk_boolean, value = false}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_boolean,
+ value = false})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_boolean,
+ value = 1})),
+ ?match({ok, #any{typecode = tk_octet, value = 1}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_octet,
+ value = 1})),
+ ?match({ok, #any{typecode = {tk_objref, "IDL:omg.org/orber_test/server:1.0", "server"}, value = Obj}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_objref, "IDL:omg.org/orber_test/server:1.0", "server"},
+ value = Obj})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_objref, "IDL:omg.org/orber_test/server:1.0", "server"},
+ value = "No Object"})),
+ ?match({ok, #any{typecode = {tk_string, 6}, value = "string"}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_string, 6},
+ value = "string"})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = tk_string,
+ value = atomic})),
+ ?match({ok, #any{typecode = {tk_wstring, 1}, value = [65535]}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_wstring, 1},
+ value = [65535]})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_wstring, 1},
+ value = atomic})),
+ ?match({ok, #any{typecode = {tk_enum, "IDL:omg.org/orber_test/server/enumerant:1.0", "enumerant", ["one","two"]},
+ value = two}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_enum, "IDL:omg.org/orber_test/server/enumerant:1.0", "enumerant", ["one","two"]},
+ value = two})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_enum, "IDL:omg.org/orber_test/server/enumerant:1.0", "enumerant", ["one","two"]},
+ value = three})),
+
+
+ ?match({ok, #any{typecode = {tk_sequence, tk_long, 3},
+ value = [1,2,3]}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_sequence, tk_long, 3},
+ value = [1,2,3]})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_sequence, tk_long, 3},
+ value = false})),
+
+
+
+ ?match({ok, #any{typecode = {tk_array,{tk_string,0},2},
+ value = {"one", "two"}}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_array,{tk_string,0},2},
+ value = {"one", "two"}})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_array,{tk_string,0},2},
+ value = {"one", "two", "three"}})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_array,{tk_string,0},2},
+ value = {1, 2}})),
+ ?match({ok, #any{typecode = {tk_struct,"IDL:omg.org/orber_test/server/struc:1.0",
+ "struc",
+ [{"a",tk_long},{"b",tk_short}]},
+ value = #orber_test_server_struc{a=1, b=2}}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_struct,"IDL:omg.org/orber_test/server/struc:1.0",
+ "struc",
+ [{"a",tk_long},{"b",tk_short}]},
+ value = #orber_test_server_struc{a=1, b=2}})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_struct,"IDL:omg.org/orber_test/server/struc:1.0",
+ "struc",
+ [{"a",tk_long},{"b",tk_short}]},
+ value = #orber_test_server_struc{a=1, b="string"}})),
+ ?match({ok, #any{typecode =
+ {tk_union,"IDL:omg.org/orber_test/server/uni:1.0",
+ "uni", tk_long, -1, [{1,"a",tk_long}]},
+ value = #orber_test_server_uni{label=1, value=66}}},
+ orber_test_server:
+ testing_iiop_any(Obj,
+ #any{typecode =
+ {tk_union,"IDL:omg.org/orber_test/server/uni:1.0",
+ "uni", tk_long, -1, [{1,"a",tk_long}]},
+ value = #orber_test_server_uni{label=1, value=66}})),
+ case Local of
+ true ->
+ ?match({ok, #any{typecode =
+ {tk_union,"IDL:omg.org/orber_test/server/uni:1.0",
+ "uni", tk_long, -1, [{1,"a",tk_long}]},
+ value = #orber_test_server_uni{label=2, value=66}}},
+ orber_test_server:
+ testing_iiop_any(Obj,
+ #any{typecode =
+ {tk_union,"IDL:omg.org/orber_test/server/uni:1.0",
+ "uni", tk_long, -1, [{1,"a",tk_long}]},
+ value = #orber_test_server_uni{label=2, value=66}}));
+ false ->
+ ?match({ok, #any{typecode =
+ {tk_union,"IDL:omg.org/orber_test/server/uni:1.0",
+ "uni", tk_long, -1, [{1,"a",tk_long}]},
+ value = #orber_test_server_uni{label=2, value=undefined}}},
+ orber_test_server:
+ testing_iiop_any(Obj,
+ #any{typecode =
+ {tk_union,"IDL:omg.org/orber_test/server/uni:1.0",
+ "uni", tk_long, -1, [{1,"a",tk_long}]},
+ value = #orber_test_server_uni{label=2, value=66}}))
+ end,
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:
+ testing_iiop_any(Obj,
+ #any{typecode =
+ {tk_union,"IDL:omg.org/orber_test/server/uni:1.0",
+ "uni", tk_long, -1, [{1,"a",tk_long}]},
+ value = #orber_test_server_uni{label=1, value="string"}})),
+
+ ?match({ok, #any{typecode = {tk_fixed,5,2},
+ value = #fixed{digits = 5, scale = 2, value = 12345}}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_fixed,5,2},
+ value = #fixed{digits = 5,
+ scale = 2,
+ value = 12345}})),
+ ?match({ok, #any{typecode = {tk_fixed,10,2},
+ value = #fixed{digits = 10, scale = 2, value = 1234567890}}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_fixed,10,2},
+ value = #fixed{digits = 10,
+ scale = 2,
+ value = 1234567890}})),
+ ?match({ok, #any{typecode = {tk_fixed,6,2},
+ value = #fixed{digits = 6, scale = 2, value = 300000}}},
+ orber_test_server:testing_iiop_any(Obj, #any{typecode = {tk_fixed,6,2},
+ value = #fixed{digits = 6,
+ scale = 2,
+ value = 300000}})),
+ ?match({'EXCEPTION',{'MARSHAL',_,_,_}},
+ orber_test_server:
+ testing_iiop_server_marshal(Obj, "string")),
+ ok.
+
+%%--------------- Testing Post- & Pre-cond -------------------
+precond(Module, Function, Args) ->
+ error_logger:info_msg("=============== pre-condition ============
+Module : ~p
+Function : ~p
+Arguments : ~p
+==========================================~n", [Module, Function, Args]),
+ ok.
+
+postcond(Module, Function, Args, Result) ->
+ error_logger:info_msg("=============== post-condition ===========
+Module : ~p
+Function : ~p
+Arguments : ~p
+Result : ~p
+==========================================~n", [Module, Function, Args, Result]),
+ ok.
+
+%%--------------- Testing Missing Module ---------------------
+oe_get_interface() ->
+ non_existing_module:tc(foo).
+
+%%--------------- INTERCEPTOR FUNCTIONS ----------------------
+%%------------------------------------------------------------
+%% function : new_in_connection
+%% Arguments:
+%% Returns :
+%%------------------------------------------------------------
+new_in_connection(Arg, CHost, Port) ->
+ Host = node(),
+ [{SHost, SPort}] = orber:find_sockname_by_peername(CHost, Port),
+ Peers = orber:find_peername_by_sockname(SHost, SPort),
+ error_logger:info_msg("=============== new_in_connection ========
+Node : ~p
+From Host : ~p
+From Port : ~p
+To Host : ~p
+To Port : ~p
+Peers : ~p
+Arg : ~p
+==========================================~n",
+ [Host, CHost, Port, SHost, SPort, Peers, Arg]),
+ {Host}.
+
+%%------------------------------------------------------------
+%% function : new_out_connection
+%% Arguments:
+%% Returns :
+%%------------------------------------------------------------
+new_out_connection(Arg, SHost, Port) ->
+ Host = node(),
+ error_logger:info_msg("=============== new_out_connection =======
+Node : ~p
+To Host : ~p
+To Port : ~p
+Arg : ~p
+==========================================~n",
+ [Host, SHost, Port, Arg]),
+ {Host}.
+
+%%------------------------------------------------------------
+%% function : closed_in_connection
+%% Arguments:
+%% Returns :
+%%------------------------------------------------------------
+closed_in_connection(Arg) ->
+ error_logger:info_msg("=============== closed_in_connection =====
+Node : ~p
+Connection: ~p
+==========================================~n",
+ [node(), Arg]),
+ Arg.
+
+%%------------------------------------------------------------
+%% function : closed_out_connection
+%% Arguments:
+%% Returns :
+%%------------------------------------------------------------
+closed_out_connection(Arg) ->
+ error_logger:info_msg("=============== closed_out_connection ====
+Node : ~p
+Connection: ~p
+==========================================~n",
+ [node(), Arg]),
+ Arg.
+
+%%------------------------------------------------------------
+%% function : in_request_encoded
+%% Arguments:
+%% Returns :
+%%------------------------------------------------------------
+in_request_encoded(Ref, _ObjKey, Ctx, Op,
+ <<100:8,101:8,102:8,103:8,104:8,105:8,106:8,107:8,108:8,109:8,110:8,T/binary>>, _Args) ->
+ error_logger:info_msg("=============== in_request_encoded =======
+Connection: ~p
+Operation : ~p
+Body : ~p
+Context : ~p
+==========================================~n",
+ [Ref, Op, T, Ctx]),
+ {T, "NewArgs"}.
+
+%%------------------------------------------------------------
+%% function : in_reply_encoded
+%% Arguments:
+%% Returns :
+%%------------------------------------------------------------
+in_reply_encoded(Ref, _ObjKey, Ctx, Op,
+ <<100:8,101:8,102:8,103:8,104:8,105:8,106:8,107:8,108:8,109:8,110:8,T/binary>>,
+ _Args) ->
+ error_logger:info_msg("============== in_reply_encoded ==========
+Connection: ~p
+Operation : ~p
+Body : ~p
+Context : ~p
+==========================================~n",
+ [Ref, Op, T, Ctx]),
+ {T, "NewArgs"}.
+
+%%------------------------------------------------------------
+%% function : out_reply_encoded
+%% Arguments:
+%% Returns :
+%%------------------------------------------------------------
+out_reply_encoded(Ref, _ObjKey, Ctx, Op, List, _Args) ->
+ error_logger:info_msg("============== out_reply_encoded =========
+Connection: ~p
+Operation : ~p
+Body : ~p
+Context : ~p
+==========================================~n",
+ [Ref, Op, List, Ctx]),
+ {list_to_binary([<<100:8,101:8,102:8,103:8,104:8,105:8,106:8,107:8,108:8,109:8,110:8>>|List]), "NewArgs"}.
+
+%%------------------------------------------------------------
+%% function : out_request_encoded
+%% Arguments:
+%% Returns :
+%%------------------------------------------------------------
+out_request_encoded(Ref, _ObjKey, Ctx, Op, List, _Args) ->
+ error_logger:info_msg("============== out_request_encoded =======
+Connection: ~p
+Operation : ~p
+Body : ~p
+Context : ~p
+==========================================~n",
+ [Ref, Op, List, Ctx]),
+ {list_to_binary([<<100:8,101:8,102:8,103:8,104:8,105:8,106:8,107:8,108:8,109:8,110:8>>|List]), "NewArgs"}.
+
+%%------------------------------------------------------------
+%% function : in_request
+%% Arguments:
+%% Returns :
+%%------------------------------------------------------------
+in_request(Ref, _ObjKey, Ctx, Op, Params, _Args) ->
+ error_logger:info_msg("=============== in_request ===============
+Connection: ~p
+Operation : ~p
+Parameters: ~p
+Context : ~p
+==========================================~n",
+ [Ref, Op, Params, Ctx]),
+ {Params, "NewArgs"}.
+
+%%------------------------------------------------------------
+%% function : in_reply
+%% Arguments:
+%% Returns :
+%%------------------------------------------------------------
+in_reply(Ref, _ObjKey, Ctx, Op, Reply, _Args) ->
+ error_logger:info_msg("=============== in_reply =================
+Connection: ~p
+Operation : ~p
+Reply : ~p
+Context : ~p
+==========================================~n",
+ [Ref, Op, Reply, Ctx]),
+ {Reply, "NewArgs"}.
+
+%%------------------------------------------------------------
+%% function : postinvoke
+%% Arguments:
+%% Returns :
+%%------------------------------------------------------------
+out_reply(Ref, _ObjKey, Ctx, Op, Reply, _Args) ->
+ error_logger:info_msg("=============== out_reply ================
+Connection: ~p
+Operation : ~p
+Reply : ~p
+Context : ~p
+==========================================~n",
+ [Ref, Op, Reply, Ctx]),
+ {Reply, "NewArgs"}.
+
+%%------------------------------------------------------------
+%% function : postinvoke
+%% Arguments:
+%% Returns :
+%%------------------------------------------------------------
+out_request(Ref, _ObjKey, Ctx, Op, Params, _Args) ->
+ error_logger:info_msg("=============== out_request ==============
+Connection: ~p
+Operation : ~p
+Parameters: ~p
+Context : ~p
+==========================================~n",
+ [Ref, Op, Params, Ctx]),
+ {Params, "NewArgs"}.
+
+
+%%--------------- END OF MODULE ------------------------------
+
+
+
diff --git a/lib/orber/test/orber_test_server.cfg b/lib/orber/test/orber_test_server.cfg
new file mode 100644
index 0000000000..84c671f795
--- /dev/null
+++ b/lib/orber/test/orber_test_server.cfg
@@ -0,0 +1,27 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1999-2010. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+{timeout, "orber_test::timeout_server"}.
+{this, "orber_test::timeout_server"}.
+{{handle_info, "orber_test::timeout_server"}, true}.
+{this, "orber_test::server"}.
+{{handle_info, "orber_test::server"}, true}.
+{{postcond, "orber_test::server::testing_iiop_union_d"}, {orber_test_lib, postcond}}.
+{{postcond, "orber_test::server::testing_iiop_array"}, {orber_test_lib, postcond}}.
+{{precond, "orber_test::server::testing_iiop_array"}, {orber_test_lib, precond}}.
+{{precond, "orber_test::server::testing_iiop_enum"}, {orber_test_lib, precond}}.
diff --git a/lib/orber/test/orber_test_server.idl b/lib/orber/test/orber_test_server.idl
new file mode 100644
index 0000000000..a88211c941
--- /dev/null
+++ b/lib/orber/test/orber_test_server.idl
@@ -0,0 +1,153 @@
+//
+// %CopyrightBegin%
+//
+// Copyright Ericsson AB 1999-2010. All Rights Reserved.
+//
+// The contents of this file are subject to the Erlang Public License,
+// Version 1.1, (the "License"); you may not use this file except in
+// compliance with the License. You should have received a copy of the
+// Erlang Public License along with this software. If not, it can be
+// retrieved online at http://www.erlang.org/.
+//
+// Software distributed under the License is distributed on an "AS IS"
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+// the License for the specific language governing rights and limitations
+// under the License.
+//
+// %CopyrightEnd%
+//
+
+#ifndef _ORBER_TEST_SERVER_IDL
+#define _ORBER_TEST_SERVER_IDL
+#pragma prefix "omg.org"
+
+module orber_parent {
+ interface inherrit {
+ void print();
+ };
+};
+
+module orber_test {
+
+ // interface server
+ interface server : orber_parent::inherrit {
+ typedef string array[2];
+ typedef sequence <long, 3> seq;
+ typedef wstring<6> WstrLength6;
+ typedef string<6> StrLength6;
+
+ struct struc {long a; short b;};
+ union uni switch(long) {
+ case 1: long a;};
+
+ union uni_d switch(long) {
+ case 1: long a;
+ default: boolean b;
+ };
+ enum enumerant {one, two};
+
+ exception UserDefinedException {};
+
+ typedef sequence<struc> StrucSeq;
+ typedef sequence<uni> UniSeq;
+ exception ComplexUserDefinedException { StrucSeq strseq; };
+
+ // Testing fixed
+ const fixed val1 = 3.14D;
+ const fixed val2 = 003.14D;
+ const fixed val3 = 003.1400D;
+ const fixed val4 = 3.1400D;
+ const fixed val5 = .1400D;
+ const fixed val6 = 3.D;
+ const fixed val7 = -.1400D;
+ const fixed val8 = -3.D;
+ const fixed val9 = val4+val5;
+ const fixed val10 = val4*val5;
+ const fixed val11 = val4/val5;
+ const fixed val12 = 123.140001D;
+ const fixed val13 = 12314000.1D;
+ const fixed val14 = val12-val13;
+ const fixed val15 = val12+val13;
+ const fixed val16 = val12*val13;
+ const fixed val17 = 2.01D+2.01D;
+ const fixed val18 = 2.01D*2.01D;
+ const fixed val19 = 200D;
+ const fixed val20 = 9999999999999999999999999999999D+9999999999999999999999999999999D;
+ const fixed val21 = 9999999999999999999999999999999D-9999999999999999999999999999999D;
+ const fixed val22 = 9999999999999999999999999999999D*9999999999999999999999999999999D;
+ const fixed val23 = 9999999999999999999999999999999D/9999999999999999999999999999999D;
+ const fixed val24 = 9999D+9999D;
+ const fixed val25 = 400D/10D;
+ const fixed val26 = 9999999999999999999999999999999D;
+
+
+ typedef fixed<5,2> fixed52;
+ const fixed52 fixed52const1 = 123.45d;
+ const fixed52 fixed52const2 = 123.00d;
+ const fixed52 fixed52const3 = 023.00d;
+ const fixed52 fixed52negconst1 = -123.45d;
+ const fixed52 fixed52negconst2 = -123.00d;
+ const fixed52 fixed52negconst3 = -023.00d;
+
+ void stop_normal();
+
+ void stop_brutal();
+
+ // Testing encode and decode
+ void testing_iiop_float(inout float Fl);
+ void testing_iiop_double(inout double Do);
+ void testing_iiop_short(inout short Sh);
+ void testing_iiop_ushort(inout unsigned short Us);
+ void testing_iiop_long(inout long Lo);
+ void testing_iiop_longlong(inout long long LLo);
+ void testing_iiop_ulong(inout unsigned long Ulo);
+ void testing_iiop_ulonglong(inout unsigned long long LLo);
+ void testing_iiop_char(inout char Ch);
+ void testing_iiop_wchar(inout wchar WCh);
+ void testing_iiop_bool(inout boolean Bool);
+ void testing_iiop_octet(inout octet Oct);
+ void testing_iiop_any(inout any AnyType);
+ void testing_iiop_obj(inout Object Obj);
+ void testing_iiop_string(inout StrLength6 Str);
+ void testing_iiop_wstring(inout WstrLength6 WStr);
+ void testing_iiop_struct(inout struc Stru);
+ void testing_iiop_union(inout uni Uni);
+ void testing_iiop_union_d(inout uni_d Uni);
+ void testing_iiop_enum(inout enumerant Enumerant);
+ void testing_iiop_seq(inout seq Seq);
+ void testing_iiop_uni_seq(inout UniSeq USeq);
+ void testing_iiop_struc_seq(inout StrucSeq SSeq);
+ void testing_iiop_array(inout array Arr);
+ void testing_iiop_fixed(inout fixed52 MyFixed);
+ void testing_iiop_void();
+ void testing_iiop_context();
+ void testing_iiop_server_marshal(inout StrLength6 Str);
+
+ oneway void testing_iiop_oneway_delay(in long Time);
+ void testing_iiop_twoway_delay(in long Time);
+
+ // Testing relay calls/casts to, for example, test that sending implicit
+ // Contexts works.
+ void relay_call(in Object Target);
+ oneway void relay_cast(in Object Target);
+
+ // Testing pseudo calls/casts
+ void pseudo_call();
+ oneway void pseudo_cast();
+ void pseudo_call_delay(inout long Lo);
+ oneway void pseudo_cast_delay(in long Lo);
+ void pseudo_call_raise_exc(in long Lo);
+ void raise_local_exception()
+ raises(UserDefinedException);
+ void raise_complex_local_exception()
+ raises(ComplexUserDefinedException);
+ };
+
+ interface timeout_server {
+ oneway void oneway_function(in long time);
+ void twoway_function(in long time);
+ };
+
+};
+
+#endif
diff --git a/lib/orber/test/orber_test_server_impl.erl b/lib/orber/test/orber_test_server_impl.erl
new file mode 100644
index 0000000000..35296cb619
--- /dev/null
+++ b/lib/orber/test/orber_test_server_impl.erl
@@ -0,0 +1,262 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1999-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+
+-module(orber_test_server_impl).
+-include_lib("orber/include/corba.hrl").
+-include("idl_output/orber_test_server.hrl").
+
+%%--------------- specified functions ------------------------
+-export([stop_normal/2,
+ stop_brutal/2,
+ print/2,
+ %% Testing code and decode arguments
+ testing_iiop_float/3,
+ testing_iiop_double/3,
+ testing_iiop_short/3,
+ testing_iiop_ushort/3,
+ testing_iiop_long/3,
+ testing_iiop_longlong/3,
+ testing_iiop_ulong/3,
+ testing_iiop_ulonglong/3,
+ testing_iiop_char/3,
+ testing_iiop_wchar/3,
+ testing_iiop_bool/3,
+ testing_iiop_octet/3,
+ testing_iiop_any/3,
+ testing_iiop_obj/3,
+ testing_iiop_string/3,
+ testing_iiop_wstring/3,
+ testing_iiop_struct/3,
+ testing_iiop_union/3,
+ testing_iiop_union_d/3,
+ testing_iiop_enum/3,
+ testing_iiop_seq/3,
+ testing_iiop_uni_seq/3,
+ testing_iiop_struc_seq/3,
+ testing_iiop_array/3,
+ testing_iiop_fixed/3,
+ testing_iiop_void/2,
+ testing_iiop_context/2,
+ testing_iiop_server_marshal/3,
+ relay_call/3,
+ relay_cast/3,
+ %% Testing pseudo calls.
+ pseudo_call/2,
+ pseudo_cast/2,
+ pseudo_call_delay/3,
+ pseudo_cast_delay/3,
+ pseudo_call_raise_exc/3,
+ %% Testing raise locally defined exception.
+ raise_local_exception/2,
+ raise_complex_local_exception/2,
+ %% Test timeout functionality
+ testing_iiop_oneway_delay/3,
+ testing_iiop_twoway_delay/3]).
+
+
+%%--------------- gen_server specific ------------------------
+-export([init/1, terminate/2]).
+-export([handle_call/3, handle_cast/2, handle_info/2, code_change/3]).
+
+%%--------------- LOCAL DATA ---------------------------------
+
+%%------------------------------------------------------------
+%% function : init, terminate
+%%------------------------------------------------------------
+init(State) ->
+ process_flag(trap_exit,true),
+ {ok, State}.
+
+terminate(Reason, State) ->
+ io:format("orber_test_server:terminate(~p ~p)~n",[Reason, State]),
+ ok.
+
+code_change(_OldVsn, State, _Extra) ->
+ {ok, State}.
+handle_call(_,_, State) ->
+ {noreply, State}.
+handle_cast(_, State) ->
+ {noreply, State}.
+handle_info(_Info, State) ->
+ {noreply, State}.
+
+%%--------------- SERVER FUNCTIONS ---------------------------
+
+print(Self, State) ->
+ io:format("orber_test_server:print(~p ~p)~n",[Self, State]),
+ {reply, ok, State}.
+
+stop_normal(_Self, State) ->
+ {stop, normal, ok, State}.
+
+stop_brutal(_Self, _State) ->
+ exit("killed_brutal").
+
+
+%% Testing code and decode arguments
+testing_iiop_float(_Self, State, Float) ->
+ {reply, {ok, Float}, State}.
+
+testing_iiop_double(_Self, State, Double) ->
+ {reply, {ok, Double}, State}.
+
+testing_iiop_short(_Self, State, Short) ->
+ {reply, {ok, Short}, State}.
+
+testing_iiop_ushort(_Self, State, Ushort) ->
+ {reply, {ok, Ushort}, State}.
+
+testing_iiop_long(_Self, State, Long) ->
+ {reply, {ok, Long}, State}.
+
+testing_iiop_longlong(_Self, State, LLong) ->
+ {reply, {ok, LLong}, State}.
+
+testing_iiop_ulong(_Self, State, Ulong) ->
+ {reply, {ok, Ulong}, State}.
+
+testing_iiop_ulonglong(_Self, State, ULlong) ->
+ {reply, {ok, ULlong}, State}.
+
+testing_iiop_char(_Self, State, Char) ->
+ {reply, {ok, Char}, State}.
+
+testing_iiop_wchar(_Self, State, WChar) ->
+ {reply, {ok, WChar}, State}.
+
+testing_iiop_bool(_Self, State, Boolean) ->
+ {reply, {ok, Boolean}, State}.
+
+testing_iiop_octet(_Self, State, Octet) ->
+ {reply, {ok, Octet}, State}.
+
+testing_iiop_any(_Self, State, Any) ->
+ {reply, {ok, Any}, State}.
+
+testing_iiop_obj(_Self, State, Obj) ->
+ {reply, {ok, Obj}, State}.
+
+testing_iiop_string(_Self, State, String) ->
+ {reply, {ok, String}, State}.
+
+testing_iiop_wstring(_Self, State, WString) ->
+ {reply, {ok, WString}, State}.
+
+testing_iiop_struct(_Self, State, Struct) ->
+ {reply, {ok, Struct}, State}.
+
+testing_iiop_union(_Self, State, Union) ->
+ {reply, {ok, Union}, State}.
+
+testing_iiop_union_d(_Self, State, Union) ->
+ {reply, {ok, Union}, State}.
+
+testing_iiop_enum(_Self, State, Enum) ->
+ {reply, {ok, Enum}, State}.
+
+testing_iiop_seq(_Self, State, Sequence) ->
+ {reply, {ok, Sequence}, State}.
+
+testing_iiop_uni_seq(_Self, State, Sequence) ->
+ {reply, {ok, Sequence}, State}.
+
+testing_iiop_struc_seq(_Self, State, Sequence) ->
+ {reply, {ok, Sequence}, State}.
+
+testing_iiop_array(_Self, State, Array) ->
+ {reply, {ok, Array}, State}.
+
+testing_iiop_fixed(_Self, State, Fixed) ->
+ {reply, {ok, Fixed}, State}.
+
+testing_iiop_void(_Self, State) ->
+ {reply, ok, State}.
+
+testing_iiop_context(_Self, State) ->
+ Ctx = get(oe_server_in_context),
+ io:format("orber_test_server:testing_iiop_context( ~p )~n", [Ctx]),
+ {reply, ok, State}.
+
+testing_iiop_server_marshal(_Self, State, _String) ->
+ {reply, {ok, false}, State}.
+
+testing_iiop_oneway_delay(_Self, State, Time) ->
+ timer:sleep(Time),
+ {noreply, State}.
+
+testing_iiop_twoway_delay(_Self, State, Time) ->
+ timer:sleep(Time),
+ {reply, ok, State}.
+
+raise_local_exception(_Self, State) ->
+ corba:raise(#'orber_test_server_UserDefinedException'{}),
+ {reply, ok, State}.
+
+raise_complex_local_exception(_Self, State) ->
+ corba:raise(#'orber_test_server_ComplexUserDefinedException'{strseq=
+ [#orber_test_server_struc{a=1, b=2}]}),
+ {reply, ok, State}.
+
+%% Testing relay calls/casts to, for example, test that sending implicit
+%% Contexts works.
+relay_call(_Self, State, Target) ->
+ io:format("orber_test_server:relay_call( ~p ) Pre~n", [get(oe_server_in_context)]),
+ orber_test_server:testing_iiop_context(Target),
+ io:format("orber_test_server:relay_call( ~p ) Post~n", [get(oe_server_in_context)]),
+ {reply, ok, State}.
+
+relay_cast(_Self, State, Target) ->
+ io:format("orber_test_server:relay_cast( ~p ) Pre~n", [get(oe_server_in_context)]),
+ orber_test_server:testing_iiop_context(Target),
+ io:format("orber_test_server:relay_cast( ~p ) Post~n", [get(oe_server_in_context)]),
+ {noreply, State}.
+
+%% Testing pseudo calls.
+pseudo_call(_Self, State) ->
+ io:format("orber_test_server:pseudo_call( ~p )~n", [now()]),
+ {reply, ok, State}.
+
+pseudo_cast(_Self, State) ->
+ io:format("orber_test_server:pseudo_cast( ~p )~n", [now()]),
+ {noreply, State}.
+pseudo_call_delay(_Self, State, Time) ->
+ io:format("orber_test_server:pseudo_call_delay( ~p )~n", [now()]),
+ timer:sleep(Time),
+ io:format("orber_test_server:pseudo_call_delay( ~p )~n", [now()]),
+ {reply, {ok, Time}, State}.
+
+pseudo_cast_delay(_Self, State, Time) ->
+ io:format("orber_test_server:pseudo_cast_delay( ~p )~n", [now()]),
+ timer:sleep(Time),
+ io:format("orber_test_server:pseudo_cast_delay( ~p )~n", [now()]),
+ {noreply, State}.
+
+pseudo_call_raise_exc(_Self, State, 1) ->
+ io:format("orber_test_server:pseudo_call_raise_exc( ~p )~n",[1]),
+ {reply, {'EXCEPTION', #'BAD_QOS'{completion_status=?COMPLETED_NO}}, State};
+pseudo_call_raise_exc(_Self, State, 2) ->
+ io:format("orber_test_server:pseudo_call_raise_exc( ~p )~n",[2]),
+ corba:raise(#'BAD_QOS'{completion_status=?COMPLETED_NO}),
+ {reply, ok, State}.
+
+%%--------------- LOCAL FUNCTIONS ----------------------------
+
+%%--------------- END OF MODULE ------------------------------
+
diff --git a/lib/orber/test/orber_test_timeout_server_impl.erl b/lib/orber/test/orber_test_timeout_server_impl.erl
new file mode 100644
index 0000000000..138eb51d92
--- /dev/null
+++ b/lib/orber/test/orber_test_timeout_server_impl.erl
@@ -0,0 +1,65 @@
+%%--------------------------------------------------------------------
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2000-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%----------------------------------------------------------------------
+%% File : orber_test_timeout_server_impl.erl
+%% Purpose :
+%%----------------------------------------------------------------------
+
+-module(orber_test_timeout_server_impl).
+
+-export([oneway_function/3, twoway_function/3]).
+
+
+%%--------------- gen_server specific ------------------------
+-export([init/1, terminate/2, code_change/3, handle_info/2]).
+
+%%------------------------------------------------------------
+%% function : server specific
+%%------------------------------------------------------------
+init(State) ->
+ %% 'trap_exit' optional
+ process_flag(trap_exit,true),
+ {ok, State}.
+
+terminate(_Reason, _State) ->
+ ok.
+
+code_change(_OldVsn, State, _Extra) ->
+ {ok, State}.
+
+%% If use IC option {{handle_info, "Module::Interface"}, true}
+handle_info(_Info, State) ->
+ %% Await the next invocation.
+ {noreply, State}.
+
+%%--- two-way ------------------------------------------------
+twoway_function(_OE_THIS, State, Time) ->
+ timer:sleep(Time),
+ {reply, ok, State}.
+
+
+%%--- one-way ------------------------------------------------
+oneway_function(_OE_THIS, State, Time) ->
+ timer:sleep(Time),
+ {noreply, State}.
+
+%%--------------- END OF MODULE ------------------------------
+
diff --git a/lib/orber/test/orber_web_SUITE.erl b/lib/orber/test/orber_web_SUITE.erl
new file mode 100644
index 0000000000..ffa7468853
--- /dev/null
+++ b/lib/orber/test/orber_web_SUITE.erl
@@ -0,0 +1,443 @@
+%%-----------------------------------------------------------------
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2004-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%-----------------------------------------------------------------
+%% File : orber_web_SUITE.erl
+%% Purpose :
+%%-----------------------------------------------------------------
+
+-module(orber_web_SUITE).
+
+-include("test_server.hrl").
+-include_lib("orber/include/corba.hrl").
+-include_lib("orber/src/orber_iiop.hrl").
+
+-define(default_timeout, ?t:minutes(3)).
+
+-define(match(ExpectedRes, Expr),
+ fun() ->
+ AcTuAlReS = (catch (Expr)),
+ case AcTuAlReS of
+ ExpectedRes ->
+ io:format("------ CORRECT RESULT ------~n~p~n",
+ [AcTuAlReS]),
+ AcTuAlReS;
+ _ ->
+ io:format("###### ERROR ERROR ######~n~p~n",
+ [AcTuAlReS]),
+ ?line exit(AcTuAlReS)
+ end
+ end()).
+
+-define(nomatch(Not, Expr),
+ fun() ->
+ AcTuAlReS = (catch (Expr)),
+ case AcTuAlReS of
+ Not ->
+ io:format("###### ERROR ERROR ######~n~p~n",
+ [AcTuAlReS]),
+ ?line exit(AcTuAlReS);
+ _ ->
+ io:format("------ CORRECT RESULT ------~n~p~n",
+ [AcTuAlReS]),
+ AcTuAlReS
+ end
+ end()).
+
+
+%%-----------------------------------------------------------------
+%% External exports
+%%-----------------------------------------------------------------
+-export([all/1]).
+
+%%-----------------------------------------------------------------
+%% Internal exports
+%%-----------------------------------------------------------------
+-export([]).
+-compile(export_all).
+
+%%-----------------------------------------------------------------
+%% Func: all/1
+%% Args:
+%% Returns:
+%%-----------------------------------------------------------------
+all(doc) -> ["This suite is for testing the Orber Web API"];
+all(suite) ->
+ [menu, configure, info, nameservice, ifr_select, ifr_data,
+ create, delete_ctx, add_ctx, delete_obj, server].
+
+%%-----------------------------------------------------------------
+%% Init and cleanup functions.
+%%-----------------------------------------------------------------
+init_per_testcase(_Case, Config) ->
+ ?line Dog=test_server:timetrap(?default_timeout),
+ Path = code:which(?MODULE),
+ code:add_pathz(filename:join(filename:dirname(Path), "idl_output")),
+ orber:jump_start(2875),
+ oe_orber_test_server:oe_register(),
+ [{watchdog, Dog}|Config].
+
+
+fin_per_testcase(_Case, Config) ->
+ oe_orber_test_server:oe_unregister(),
+ orber:jump_stop(),
+ Path = code:which(?MODULE),
+ code:del_path(filename:join(filename:dirname(Path), "idl_output")),
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: menu
+%% Description:
+%%-----------------------------------------------------------------
+menu(doc) -> [""];
+menu(suite) -> [];
+menu(_) ->
+ Node = atom_to_list(node()),
+ OK = orber_web:menu(env, [{"node", Node}]),
+ ?match(OK, orber_web:menu(env, [])),
+ ?match(OK, orber_web:menu(env, [42, {"node", Node}, "wrong"])),
+ ?match({'EXIT', _E}, orber_web:menu(env, [{"node", localhost}])),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: configure
+%% Description:
+%%-----------------------------------------------------------------
+configure(doc) -> [""];
+configure(suite) -> [];
+configure(_) ->
+ Node = atom_to_list(node()),
+ ?match({'EXIT', _}, orber_web:configure(env, [])),
+ ?match({'EXIT', _}, orber_web:configure(env, [{"node", localhost},
+ {"data", atom}])),
+ ?match([_H|_T], orber_web:configure(env, [{"node", Node}, {"data", ""}])),
+ ?match([_H|_T], orber_web:configure(env, [{"node", Node},
+ {"data", "[{orber_debug_level, 9}]"}])),
+ ?match({ok, 9}, application:get_env(orber, orber_debug_level)),
+ ?match([_H|_T], orber_web:configure(env, [{"node", "bad_node"},
+ {"data", "[{orber_debug_level, 9}]"}])),
+ ?match({error, _}, orber_web:configure(env, [{"node", Node},
+ {"data", "{orber_debug_level 9}"}])),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: info
+%% Description:
+%%-----------------------------------------------------------------
+info(doc) -> [""];
+info(suite) -> [];
+info(_) ->
+ ?match({'EXIT', _}, orber_web:info(env, [])),
+ ?match({'EXIT', _}, orber_web:info(env, [{"node", localhost}])),
+ ?match([_H|_T], orber_web:info(env, [{"node", atom_to_list(node())}])),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: nameservice
+%% Description:
+%%-----------------------------------------------------------------
+nameservice(doc) -> [""];
+nameservice(suite) -> [];
+nameservice(_) ->
+ NodeStr = atom_to_list(node()),
+ ?match({'EXIT', _}, orber_web:nameservice(env, [{"node", localhost},
+ {"context", "root"}])),
+ ?match({'EXIT', _}, orber_web:nameservice(env, [{"node", localhost},
+ {"context", "id1"}])),
+ ?match([_H|_T], orber_web:nameservice(env, [{"node", "bad_node"},
+ {"context", "root"}])),
+ ?match([_,_,_,NodeStr|_], orber_web:nameservice(env, [{"node", NodeStr},
+ {"context", "root"}])),
+ ?match({ok,_}, orber_web:nameservice(env, [{"node", NodeStr},
+ {"context", "id1"}])),
+ ?match([_H|_T], orber_web:add_ctx(env, [{"node", NodeStr},
+ {"context", "root"},
+ {"id", "id1"}])),
+ ?match([_H|_T], orber_web:add_ctx(env, [{"node", NodeStr},
+ {"context", "id1"},
+ {"id", "id2"}])),
+ [_,_,_,IOR] =
+ ?match([_,_,_,_], orber_web:create(env, [{"node", NodeStr},
+ {"module", "orber_test_server"},
+ {"arguments", "[]"},
+ {"options", "[{pseudo, true}]"},
+ {"namestr", "id1/id2/id3"},
+ {"bind", "rebind"}])),
+ ?match(#'IOP_IOR'{}, corba:string_to_object(IOR)),
+
+ ?match([_,"id1"|_], orber_web:nameservice(env, [{"node", NodeStr},
+ {"context", "id1"}])),
+ ?nomatch({error, _}, orber_web:nameservice(env, [{"node", NodeStr},
+ {"context", "id1/id2"},
+ {"object", "id3"}])),
+
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: ifr_select
+%% Description:
+%%-----------------------------------------------------------------
+ifr_select(doc) -> [""];
+ifr_select(suite) -> [];
+ifr_select(_) ->
+ ?match({'EXIT', _}, orber_web:ifr_select(env, [])),
+ ?match({'EXIT', _}, orber_web:ifr_select(env, [{"node", localhost}])),
+ ?match([_H|_T], orber_web:ifr_select(env, [{"node", "bad_node"}])),
+ ?match([_H|_T], orber_web:ifr_select(env, [{"node", atom_to_list(node())}])),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: ifr_data
+%% Description:
+%%-----------------------------------------------------------------
+ifr_data(doc) -> [""];
+ifr_data(suite) -> [];
+ifr_data(_) ->
+ ?match({'EXIT', _}, orber_web:ifr_data(env, [])),
+ ?match({'EXIT', _}, orber_web:ifr_data(env, [{"node", localhost},
+ {"table", "ir_ModuleDef"}])),
+ ?match({error, _}, orber_web:ifr_data(env, [{"node", "bad_host"},
+ {"table", "ir_ModuleDef"}])),
+ ?match({'EXIT', _}, orber_web:ifr_data(env, [{"node", atom_to_list(node())},
+ {"table", "bad_table"}])),
+ ?match([_H|_T], orber_web:ifr_data(env, [{"node", atom_to_list(node())},
+ {"table", "ir_ModuleDef"}])),
+ ?match([_H|_T], orber_web:ifr_data(env, [{"node", atom_to_list(node())},
+ {"table", "ir_InterfaceDef"}])),
+ ?match([_H|_T], orber_web:ifr_data(env, [{"node", atom_to_list(node())},
+ {"table", "ir_StructDef"}])),
+ ?match([_H|_T], orber_web:ifr_data(env, [{"node", atom_to_list(node())},
+ {"table", "ir_ExceptionDef"}])),
+ ?match([_H|_T], orber_web:ifr_data(env, [{"node", atom_to_list(node())},
+ {"table", "ir_ConstantDef"}])),
+ ?match([_H|_T], orber_web:ifr_data(env, [{"node", atom_to_list(node())},
+ {"table", "ir_EnumDef"}])),
+ ?match([_H|_T], orber_web:ifr_data(env, [{"node", atom_to_list(node())},
+ {"table", "ir_AliasDef"}])),
+ ?match([_H|_T], orber_web:ifr_data(env, [{"node", atom_to_list(node())},
+ {"table", "ir_AttributeDef"}])),
+ ?match([_H|_T], orber_web:ifr_data(env, [{"node", atom_to_list(node())},
+ {"table", "ir_OperationDef"}])),
+ ?match([_H|_T], orber_web:ifr_data(env, [{"node", atom_to_list(node())},
+ {"table", "ir_Contained"}])),
+ ?match([_H|_T], orber_web:ifr_data(env, [{"node", atom_to_list(node())},
+ {"table", "ir_TypedefDef"}])),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: create
+%% Description:
+%%-----------------------------------------------------------------
+create(doc) -> [""];
+create(suite) -> [];
+create(_) ->
+ NodeStr = atom_to_list(node()),
+ ?match({'EXIT', _}, orber_web:create(env, [])),
+ ?match({'EXIT', _}, orber_web:create(env, [{"node", localhost}])),
+ ?match({error, _}, orber_web:create(env, [{"node", NodeStr},
+ {"module", "orber_test_server"},
+ {"arguments", "[]"},
+ {"options", "[bad_option 42]"},
+ {"namestr", "[]"},
+ {"bind", "rebind"}])),
+ ?match({error, _}, orber_web:create(env, [{"node", NodeStr},
+ {"module", "orber_test_server"},
+ {"arguments", "[bad_argument 42]"},
+ {"options", "[]"},
+ {"namestr", "[]"},
+ {"bind", "rebind"}])),
+
+ ?match([_, NodeStr|_T], orber_web:create(env, [{"node", NodeStr}])),
+
+ [_,IOR] = ?match([_,_], orber_web:create(env, [{"node", NodeStr},
+ {"module", "orber_test_server"},
+ {"arguments", "[]"},
+ {"options", "[]"},
+ {"namestr", ""},
+ {"bind", "rebind"}])),
+ ?match(#'IOP_IOR'{}, corba:string_to_object(IOR)),
+
+ [_,_,_,_,_,IOR2] =
+ ?match([_,_,_,_,_,_], orber_web:create(env, [{"node", NodeStr},
+ {"module", "orber_test_server"},
+ {"arguments", "[]"},
+ {"options", "[]"},
+ {"namestr", "id1"},
+ {"bind", "rebind"}])),
+ ?match(#'IOP_IOR'{}, corba:string_to_object(IOR2)),
+
+ [_,_,_,IOR3] =
+ ?match([_,_,_,_], orber_web:create(env, [{"node", NodeStr},
+ {"module", "orber_test_server"},
+ {"arguments", "[]"},
+ {"options", "[{pseudo, true}]"},
+ {"namestr", "id2"},
+ {"bind", "rebind"}])),
+ ?match(#'IOP_IOR'{}, corba:string_to_object(IOR3)),
+
+ [_,IOR4] =?match([_,_], orber_web:create(env, [{"node", NodeStr},
+ {"module", "orber_test_server"},
+ {"arguments", "[]"},
+ {"options", "[{pseudo, true}]"},
+ {"namestr", ""},
+ {"bind", "rebind"}])),
+ ?match(#'IOP_IOR'{}, corba:string_to_object(IOR4)),
+
+ ?match([_], orber_web:create(env, [{"node", NodeStr},
+ {"module", "orber_test_server"},
+ {"arguments", "[]"},
+ {"options", "[{unknown, option}]"},
+ {"namestr", "id1"},
+ {"bind", "rebind"}])),
+
+ ?match([_, "id1"], orber_web:create(env, [{"node", NodeStr},
+ {"module", "orber_test_server"},
+ {"arguments", "[]"},
+ {"options", "[]"},
+ {"namestr", "id1"},
+ {"bind", "bind"}])),
+
+ ?match([_, "id2"], orber_web:create(env, [{"node", NodeStr},
+ {"module", "orber_test_server"},
+ {"arguments", "[]"},
+ {"options", "[{pseudo, true}]"},
+ {"namestr", "id2"},
+ {"bind", "bind"}])),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: delete_ctx
+%% Description:
+%%-----------------------------------------------------------------
+delete_ctx(doc) -> [""];
+delete_ctx(suite) -> [];
+delete_ctx(_) ->
+ ?match({ok, _}, orber_web:delete_ctx(env, [{"node", atom_to_list(node())},
+ {"context", "id1"}])),
+ ?match([_H|_T], orber_web:add_ctx(env, [{"node", atom_to_list(node())},
+ {"context", "root"},
+ {"id", "id1"}])),
+ ?match([_H|_T], orber_web:delete_ctx(env, [{"node", atom_to_list(node())},
+ {"context", "id1"}])),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: add_ctx
+%% Description:
+%%-----------------------------------------------------------------
+add_ctx(doc) -> [""];
+add_ctx(suite) -> [];
+add_ctx(_) ->
+ ?match({error, _}, orber_web:add_ctx(env, [{"node", "bad_node"},
+ {"context", "root"},
+ {"id", "id1"}])),
+ ?match([_H|_T], orber_web:add_ctx(env, [{"node", atom_to_list(node())},
+ {"context", "root"},
+ {"id", ""}])),
+ ?match([_H|_T], orber_web:add_ctx(env, [{"node", atom_to_list(node())},
+ {"context", "root"},
+ {"id", "id1"}])),
+ ?match([_H|_T], orber_web:add_ctx(env, [{"node", atom_to_list(node())},
+ {"context", "id1"},
+ {"id", "id2"}])),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: delete_obj
+%% Description:
+%%-----------------------------------------------------------------
+delete_obj(doc) -> [""];
+delete_obj(suite) -> [];
+delete_obj(_) ->
+ NodeStr = atom_to_list(node()),
+ ?match({error, _}, orber_web:delete_obj(env, [{"node", "bad_node"},
+ {"context", "id1"},
+ {"action", "unbind"}])),
+ ?match({error, _}, orber_web:delete_obj(env, [{"node", "bad_node"},
+ {"context", "id1"},
+ {"action", "both"}])),
+ ?match({'EXIT', _}, orber_web:delete_obj(env, [{"node", bad_node},
+ {"context", "id1"},
+ {"action", "both"}])),
+ ?match({error, _}, orber_web:delete_obj(env, [{"node", NodeStr},
+ {"context", "non/existing"},
+ {"action", "unbind"}])),
+ [_,_,_,_,_,IOR2] =
+ ?match([_,_,_,_,_,_], orber_web:create(env, [{"node", NodeStr},
+ {"module", "orber_test_server"},
+ {"arguments", "[]"},
+ {"options", "[]"},
+ {"namestr", "id1"},
+ {"bind", "rebind"}])),
+ ?match(#'IOP_IOR'{}, corba:string_to_object(IOR2)),
+
+ ?match({error, _}, orber_web:delete_obj(env, [{"node", NodeStr},
+ {"context", "bad/INS./id"},
+ {"action", "unbind"}])),
+
+ [_,_,_,IOR3] =
+ ?match([_,_,_,_], orber_web:create(env, [{"node", NodeStr},
+ {"module", "orber_test_server"},
+ {"arguments", "[]"},
+ {"options", "[{pseudo, true}]"},
+ {"namestr", "id2"},
+ {"bind", "rebind"}])),
+ ?match(#'IOP_IOR'{}, corba:string_to_object(IOR3)),
+
+ ?match([_, "id1"|_], orber_web:delete_obj(env, [{"node", NodeStr},
+ {"context", "id1"},
+ {"action", "unbind"}])),
+ ?match([_, "id2"|_], orber_web:delete_obj(env, [{"node", NodeStr},
+ {"context", "id2"},
+ {"action", "unbind"}])),
+
+
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: server
+%% Description:
+%%-----------------------------------------------------------------
+server(doc) -> [""];
+server(suite) -> [];
+server(_) ->
+ NodeStr = "node=" ++ atom_to_list(node()),
+ {ok, Pid} = ?match({ok,_}, orber_web_server:start()),
+ ?match({error,{already_started, Pid}}, orber_web_server:start_link()),
+ ?match({error,{already_started,Pid}}, orber_web_server:start()),
+ ?match({orber, _}, orber_web_server:config_data()),
+ ?match([_H|_T], orber_web_server:ifr_select(env, "node=badnode")),
+ ?match([_H|_T], orber_web_server:ifr_select(env, "node=" ++ NodeStr)),
+ ?match([_H|_T], orber_web_server:menu(env, NodeStr)),
+ ?match([_H|_T], orber_web_server:configure(env, NodeStr ++ "&data=[{orber_debug_level, 9}]")),
+ ?match([_H|_T], orber_web_server:nameservice(env, NodeStr ++ "&context=root")),
+ ?match([_H|_T], orber_web_server:info(env, NodeStr)),
+ ?match([_H|_T], orber_web_server:ifr_data(env, NodeStr ++ "&table=ir_ModuleDef")),
+ ?match([_H|_T], orber_web_server:create(env, NodeStr)),
+ ?match([_H|_T], orber_web_server:add_ctx(env, NodeStr ++ "&context=root&id=id1")),
+ ?match([_H|_T], orber_web_server:delete_ctx(env, NodeStr++"&context=id1")),
+ ?match([_H|_T], orber_web_server:delete_obj(env, NodeStr++"&context=id1&action=unbind")),
+ ?match([_H|_T], orber_web_server:default_selection(env, NodeStr)),
+ ?match(ok, orber_web_server:stop()),
+ ok.
+
+
diff --git a/lib/orber/test/tc_SUITE.erl b/lib/orber/test/tc_SUITE.erl
new file mode 100644
index 0000000000..807a663219
--- /dev/null
+++ b/lib/orber/test/tc_SUITE.erl
@@ -0,0 +1,661 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2004-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%-----------------------------------------------------------------
+%%
+%% Description:
+%% Test suite for the basic typecode functions
+%%
+%%-----------------------------------------------------------------
+-module(tc_SUITE).
+
+-include("test_server.hrl").
+-include_lib("orber/src/orber_iiop.hrl").
+
+-define(default_timeout, ?t:minutes(3)).
+
+-define(match(Expr),
+ fun() ->
+ case (catch (Expr)) of
+ AcTuAlReS when is_binary(AcTuAlReS)->
+ io:format("###### ERROR ERROR ######~nRESULT: ~p~n",
+ [AcTuAlReS]),
+ exit(AcTuAlReS);
+ _ ->
+ ok
+ end
+ end()).
+-define(SUB_ELIST, [{"null", orber_tc:null()},
+ {"void", orber_tc:void()},
+ {"short", orber_tc:short()},
+ {"unsigned_short", orber_tc:unsigned_short()},
+ {"long", orber_tc:long()},
+ {"unsigned_long", orber_tc:unsigned_long()},
+ {"long_long", orber_tc:long_long()},
+ {"unsigned_long_long", orber_tc:unsigned_long_long()},
+ {"float", orber_tc:'float'()},
+ {"double", orber_tc:double()},
+ {"longdouble", orber_tc:longdouble()},
+ {"boolean", orber_tc:boolean()},
+ {"char", orber_tc:char()},
+ {"wchar", orber_tc:wchar()},
+ {"octet", orber_tc:octet()},
+ {"any", orber_tc:any()},
+ {"typecode", orber_tc:typecode()},
+ {"principal", orber_tc:principal()},
+ {"object_reference", orber_tc:object_reference("Id", "Name")}]).
+
+-define(ELIST, [{"null", orber_tc:null()},
+ {"void", orber_tc:void()},
+ {"short", orber_tc:short()},
+ {"unsigned_short", orber_tc:unsigned_short()},
+ {"long", orber_tc:long()},
+ {"unsigned_long", orber_tc:unsigned_long()},
+ {"long_long", orber_tc:long_long()},
+ {"unsigned_long_long", orber_tc:unsigned_long_long()},
+ {"float", orber_tc:'float'()},
+ {"double", orber_tc:double()},
+ {"longdouble", orber_tc:longdouble()},
+ {"boolean", orber_tc:boolean()},
+ {"char", orber_tc:char()},
+ {"wchar", orber_tc:wchar()},
+ {"octet", orber_tc:octet()},
+ {"any", orber_tc:any()},
+ {"typecode", orber_tc:typecode()},
+ {"principal", orber_tc:principal()},
+ {"object_reference", orber_tc:object_reference("Id", "Name")},
+ {"struct", orber_tc:struct("Id", "Name", ?SUB_ELIST)},
+ {"enum", orber_tc:enum("Id", "Name", ["E1", "E2"])},
+ {"string", orber_tc:string(1)},
+ {"wstring", orber_tc:wstring(0)},
+ {"sequence", orber_tc:sequence(orber_tc:enum("Id", "Name",
+ ["E1", "E2"]), 0)},
+ {"array", orber_tc:array(orber_tc:enum("Id", "Name",
+ ["E1", "E2"]), 2)},
+ {"alias", orber_tc:alias("id", "name",
+ orber_tc:enum("Id", "Name",
+ ["E1", "E2"]))},
+ {"exception", orber_tc:exception("Id", "Name", ?SUB_ELIST)}]).
+
+-define(VELIST, [{"null", orber_tc:null(), 42},
+ {"void", orber_tc:void(), 42},
+ {"short", orber_tc:short(), 42},
+ {"unsigned_short", orber_tc:unsigned_short(), 42},
+ {"long", orber_tc:long(), 42},
+ {"unsigned_long", orber_tc:unsigned_long(), 42},
+ {"long_long", orber_tc:long_long(), 42},
+ {"unsigned_long_long", orber_tc:unsigned_long_long(), 42},
+ {"float", orber_tc:'float'(), 42},
+ {"double", orber_tc:double(), 42},
+ {"longdouble", orber_tc:longdouble(), 42},
+ {"boolean", orber_tc:boolean(), 42},
+ {"char", orber_tc:char(), 42},
+ {"wchar", orber_tc:wchar(), 42},
+ {"octet", orber_tc:octet(), 42},
+ {"any", orber_tc:any(), 42},
+ {"typecode", orber_tc:typecode(), 42},
+ {"principal", orber_tc:principal(), 42},
+ {"object_reference", orber_tc:object_reference("Id", "Name"), 42},
+ {"struct", orber_tc:struct("Id", "Name", ?SUB_ELIST), 42},
+ {"enum", orber_tc:enum("Id", "Name", ["E1", "E2"]), 42},
+ {"string", orber_tc:string(1), 42},
+ {"wstring", orber_tc:wstring(0), 42},
+ {"sequence", orber_tc:sequence(orber_tc:enum("Id", "Name",
+ ["E1", "E2"]), 0), 42},
+ {"array", orber_tc:array(orber_tc:enum("Id", "Name",
+ ["E1", "E2"]), 2), 42},
+ {"alias", orber_tc:alias("id", "name",
+ orber_tc:enum("Id", "Name",
+ ["E1", "E2"])), 42},
+ {"exception", orber_tc:exception("Id", "Name", ?SUB_ELIST), 42}]).
+
+%%-----------------------------------------------------------------
+%% External exports
+%%-----------------------------------------------------------------
+-export([all/1]).
+
+%%-----------------------------------------------------------------
+%% Internal exports
+%%-----------------------------------------------------------------
+-export([]).
+-compile(export_all).
+
+%%-----------------------------------------------------------------
+%% Func: all/1
+%% Args:
+%% Returns:
+%%-----------------------------------------------------------------
+all(doc) -> ["Description", "more description"];
+all(suite) ->
+ [null, void,
+ short, ushort,
+ long, ulong,
+ longlong, ulonglong,
+ boolean, char, wchar, octet,
+ float, double, longdouble,
+ any, typecode, principal, object_reference,
+ struct, union, enum, string, wstring, sequence, array,
+ alias, exception, fixed, value, value_box, native,
+ abstract_interface, indirection, get_tc].
+
+%%-----------------------------------------------------------------
+%% Init and cleanup functions.
+%%-----------------------------------------------------------------
+
+init_per_testcase(_Case, Config) ->
+ ?line Dog=test_server:timetrap(?default_timeout),
+ [{watchdog, Dog}|Config].
+
+
+fin_per_testcase(_Case, Config) ->
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: null test
+%% Description:
+%%-----------------------------------------------------------------
+null(doc) -> [];
+null(suite) -> [];
+null(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:null()),
+ ?line code(orber_tc:null()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: void test
+%% Description:
+%%-----------------------------------------------------------------
+void(doc) -> [];
+void(suite) -> [];
+void(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:void()),
+ ?line code(orber_tc:void()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: short integer test
+%% Description:
+%%-----------------------------------------------------------------
+short(doc) -> [];
+short(suite) -> [];
+short(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:short()),
+ ?line code(orber_tc:short()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: unsigned short integer test
+%% Description:
+%%-----------------------------------------------------------------
+ushort(doc) -> [];
+ushort(suite) -> [];
+ushort(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:unsigned_short()),
+ ?line code(orber_tc:unsigned_short()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: long integer test
+%% Description:
+%%-----------------------------------------------------------------
+long(doc) -> [];
+long(suite) -> [];
+long(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:long()),
+ ?line code(orber_tc:long()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: unsigned long integer test
+%% Description:
+%%-----------------------------------------------------------------
+ulong(doc) -> [];
+ulong(suite) -> [];
+ulong(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:unsigned_long()),
+ ?line code(orber_tc:unsigned_long()),
+ ok.
+
+
+%%-----------------------------------------------------------------
+%% Test Case: long integer test
+%% Description:
+%%-----------------------------------------------------------------
+longlong(doc) -> [];
+longlong(suite) -> [];
+longlong(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:long_long()),
+ ?line code(orber_tc:long_long()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: unsigned long integer test
+%% Description:
+%%-----------------------------------------------------------------
+ulonglong(doc) -> [];
+ulonglong(suite) -> [];
+ulonglong(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:unsigned_long_long()),
+ ?line code(orber_tc:unsigned_long_long()),
+ ok.
+
+
+%%-----------------------------------------------------------------
+%% Test Case: float test
+%% Description:
+%%-----------------------------------------------------------------
+float(doc) -> [];
+float(suite) -> [];
+float(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:'float'()),
+ ?line code(orber_tc:'float'()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: double test
+%% Description:
+%%-----------------------------------------------------------------
+double(doc) -> [];
+double(suite) -> [];
+double(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:double()),
+ ?line code(orber_tc:double()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: longdouble test
+%% Description:
+%%-----------------------------------------------------------------
+longdouble(doc) -> [];
+longdouble(suite) -> [];
+longdouble(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:longdouble()),
+ ?line code(orber_tc:longdouble()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: boolean test
+%% Description:
+%%-----------------------------------------------------------------
+boolean(doc) -> [];
+boolean(suite) -> [];
+boolean(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:boolean()),
+ ?line code(orber_tc:boolean()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: character test
+%% Description:
+%%-----------------------------------------------------------------
+char(doc) -> [];
+char(suite) -> [];
+char(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:char()),
+ ?line code(orber_tc:char()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: character test
+%% Description:
+%%-----------------------------------------------------------------
+wchar(doc) -> [];
+wchar(suite) -> [];
+wchar(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:wchar()),
+ ?line code(orber_tc:wchar()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: octet test
+%% Description:
+%%-----------------------------------------------------------------
+octet(doc) -> [];
+octet(suite) -> [];
+octet(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:octet()),
+ ?line code(orber_tc:octet()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: any test
+%% Description:
+%%-----------------------------------------------------------------
+any(doc) -> [];
+any(suite) -> [];
+any(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:any()),
+ ?line code(orber_tc:any()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: typecode test
+%% Description:
+%%-----------------------------------------------------------------
+typecode(doc) -> [];
+typecode(suite) -> [];
+typecode(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:typecode()),
+ ?line code(orber_tc:typecode()),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: principal test
+%% Description:
+%%-----------------------------------------------------------------
+principal(doc) -> [];
+principal(suite) -> [];
+principal(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:principal()),
+ ?line code(orber_tc:principal()),
+ ok.
+
+
+%%-----------------------------------------------------------------
+%% Test Case: object_reference test
+%% Description:
+%%-----------------------------------------------------------------
+object_reference(doc) -> [];
+object_reference(suite) -> [];
+object_reference(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:object_reference("Id", "Name")),
+ ?line false = orber_tc:check_tc(orber_tc:object_reference(42, "Name")),
+ ?line false = orber_tc:check_tc(orber_tc:object_reference("Id", 42)),
+ ?line code(orber_tc:object_reference("Id", "Name")),
+ ?line ?match(code(orber_tc:object_reference(42, "Name"))),
+ ?line ?match(code(orber_tc:object_reference("Id", 42))),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: struct
+%% Description:
+%%-----------------------------------------------------------------
+struct(doc) -> [];
+struct(suite) -> [];
+struct(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:struct("Id", "Name", ?ELIST)),
+ ?line false = orber_tc:check_tc(orber_tc:struct(42, "Name", ?ELIST)),
+ ?line false = orber_tc:check_tc(orber_tc:struct("Id", false, ?ELIST)),
+ ?line false = orber_tc:check_tc(orber_tc:struct("Id", "Name", ?VELIST)),
+ ?line false = orber_tc:check_tc(orber_tc:struct("Id", "Name", "wrong")),
+ ?line code(orber_tc:struct("Id", "Name", ?ELIST)),
+ ?line ?match(code(orber_tc:struct(42, "Name", ?ELIST))),
+ ?line ?match(code(orber_tc:struct("Id", false, ?ELIST))),
+ ?line ?match(code(orber_tc:struct("Id", "Name", ?VELIST))),
+ ?line ?match(code(orber_tc:struct("Id", "Name", "wrong"))),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: union
+%% Description:
+%%-----------------------------------------------------------------
+union(doc) -> [];
+union(suite) -> [];
+union(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:union("Id", "Name", orber_tc:long(),
+ -1, [{1, "long", orber_tc:long()},
+ {2, "longlong", orber_tc:long()}])),
+ ?line false = orber_tc:check_tc(orber_tc:union("Id", "Name", orber_tc:long(),
+ -1, ?ELIST)),
+ ?line false = orber_tc:check_tc(orber_tc:union(42, "Name", orber_tc:long(),
+ -1, [{1, "long", orber_tc:long()},
+ {2, "longlong", orber_tc:long()}])),
+ ?line false = orber_tc:check_tc(orber_tc:union("Id", false, orber_tc:long(),
+ -1, [{1, "long", orber_tc:long()},
+ {2, "longlong", orber_tc:long()}])),
+ ?line false = orber_tc:check_tc(orber_tc:union("Id", "Name", bad_tc,
+ -1, [{1, "long", orber_tc:long()},
+ {2, "longlong", orber_tc:long()}])),
+ ?line false = orber_tc:check_tc(orber_tc:union("Id", "Name", orber_tc:long(),
+ "wrong", [{1, "long", orber_tc:long()},
+ {2, "longlong", orber_tc:long()}])),
+
+ ?line code(orber_tc:union("Id", "Name", orber_tc:long(),
+ -1, [{1, "long", orber_tc:long()},
+ {2, "longlong", orber_tc:long()}])),
+ ok.
+
+
+%%-----------------------------------------------------------------
+%% Test Case: enum test
+%% Description:
+%%-----------------------------------------------------------------
+enum(doc) -> [];
+enum(suite) -> [];
+enum(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:enum("Id", "Name",
+ ["E1", "E2", "E3"])),
+ ?line false = orber_tc:check_tc(orber_tc:enum(42, "Name",
+ ["E1", "E2", "E3"])),
+ ?line false = orber_tc:check_tc(orber_tc:enum("Id", false,
+ ["E1", "E2", "E3"])),
+ ?line false = orber_tc:check_tc(orber_tc:enum("Id", "Name",
+ ["E1", false, "E3"])),
+ ?line code(orber_tc:enum("Id", "Name", ["E1", "E2", "E3"])),
+ ?line ?match(code(orber_tc:enum(false, "Name", ["E1", "E2", "E3"]))),
+ ?line ?match(code(orber_tc:enum("Id", 42, ["E1", "E2", "E3"]))),
+ ?line ?match(code(orber_tc:enum("Id", "Name", ["E1", false, "E3"]))),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: string
+%% Description:
+%%-----------------------------------------------------------------
+string(doc) -> [];
+string(suite) -> [];
+string(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:string(0)),
+ ?line true = orber_tc:check_tc(orber_tc:string(1)),
+ ?line false = orber_tc:check_tc(orber_tc:string("wrong")),
+ ?line code(orber_tc:string(0)),
+ ?line code(orber_tc:string(1)),
+ ?line ?match(code(orber_tc:string(-1))),
+ ?line ?match(code(orber_tc:string(?ULONGMAX+1))),
+ ?line ?match(code(orber_tc:string("wrong"))),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: wstring
+%% Description:
+%%-----------------------------------------------------------------
+wstring(doc) -> [];
+wstring(suite) -> [];
+wstring(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:wstring(0)),
+ ?line true = orber_tc:check_tc(orber_tc:wstring(1)),
+ ?line false = orber_tc:check_tc(orber_tc:wstring("wrong")),
+ ?line code(orber_tc:wstring(0)),
+ ?line code(orber_tc:wstring(1)),
+ ?line ?match(code(orber_tc:wstring(-1))),
+ ?line ?match(code(orber_tc:wstring(?ULONGMAX+1))),
+ ?line ?match(code(orber_tc:wstring(false))),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: sequence
+%% Description:
+%%-----------------------------------------------------------------
+sequence(doc) -> [];
+sequence(suite) -> [];
+sequence(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:sequence(orber_tc:struct("Id", "Name", ?ELIST), 0)),
+ ?line code(orber_tc:sequence(orber_tc:struct("Id", "Name", ?ELIST), 0)),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: array
+%% Description:
+%%-----------------------------------------------------------------
+array(doc) -> [];
+array(suite) -> [];
+array(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:array(orber_tc:struct("Id", "Name", ?ELIST), 1)),
+ ?line code(orber_tc:array(orber_tc:struct("Id", "Name", ?ELIST), 1)),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: alias
+%% Description:
+%%-----------------------------------------------------------------
+alias(doc) -> [];
+alias(suite) -> [];
+alias(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:alias("Id", "Name", orber_tc:struct("Id", "Name", ?ELIST))),
+ ?line false = orber_tc:check_tc(orber_tc:alias(false, "Name", orber_tc:struct("Id", "Name", ?ELIST))),
+ ?line false = orber_tc:check_tc(orber_tc:alias("Id", 42, orber_tc:struct("Id", "Name", ?ELIST))),
+ ?line false = orber_tc:check_tc(orber_tc:alias("Id", "Name", "wrong")),
+ ?line code(orber_tc:alias("Id", "Name", orber_tc:struct("Id", "Name", ?ELIST))),
+ ?line ?match(code(orber_tc:alias("Id", "Name", orber_tc:struct("Id", "Name", ?VELIST)))),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: exception
+%% Description:
+%%-----------------------------------------------------------------
+exception(doc) -> [];
+exception(suite) -> [];
+exception(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:exception("Id", "Name", ?ELIST)),
+ ?line false = orber_tc:check_tc(orber_tc:exception(42, "Name", ?ELIST)),
+ ?line false = orber_tc:check_tc(orber_tc:exception("Id", false, ?ELIST)),
+ ?line false = orber_tc:check_tc(orber_tc:exception("Id", "Name", "wrong")),
+ ?line code(orber_tc:exception("Id", "Name", ?ELIST)),
+ ?line ?match(code(orber_tc:exception(42, "Name", ?ELIST))),
+ ?line ?match(code(orber_tc:exception("Id", false, ?ELIST))),
+ ?line ?match(code(orber_tc:exception("Id", "Name", "wrong"))),
+
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: fixed
+%% Description:
+%%-----------------------------------------------------------------
+fixed(doc) -> [];
+fixed(suite) -> [];
+fixed(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:fixed(25, 2)),
+ ?line code(orber_tc:fixed(25, 2)),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: value
+%% Description:
+%%-----------------------------------------------------------------
+value(doc) -> [];
+value(suite) -> [];
+value(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:value("Id", "Name", 42,
+ orber_tc:fixed(25, 2), ?VELIST)),
+ ?line false = orber_tc:check_tc(orber_tc:value(42, "Name", 42,
+ orber_tc:fixed(25, 2), ?VELIST)),
+ ?line false = orber_tc:check_tc(orber_tc:value("Id", 42, 42,
+ orber_tc:fixed(25, 2), ?VELIST)),
+ ?line false = orber_tc:check_tc(orber_tc:value("Id", "Name", "wrong",
+ orber_tc:fixed(25, 2), ?VELIST)),
+ ?line false = orber_tc:check_tc(orber_tc:value("Id", "Name", "42",
+ orber_tc:fixed(25, 2), ?VELIST)),
+ ?line false = orber_tc:check_tc(orber_tc:value("Id", "Name", "42",
+ ?VELIST, ?VELIST)),
+ ?line false = orber_tc:check_tc(orber_tc:value("Id", "Name", "42",
+ orber_tc:fixed(25, 2), false)),
+
+ ?line code(orber_tc:value("Id", "Name", 42, orber_tc:long(), ?VELIST)),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: value_box
+%% Description:
+%%-----------------------------------------------------------------
+value_box(doc) -> [];
+value_box(suite) -> [];
+value_box(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:value_box("Id", "Name",
+ orber_tc:fixed(25, 2))),
+ ?line false = orber_tc:check_tc(orber_tc:value_box(42, "Name",
+ orber_tc:fixed(25, 2))),
+ ?line false = orber_tc:check_tc(orber_tc:value_box("Id", 42,
+ orber_tc:fixed(25, 2))),
+ ?line false = orber_tc:check_tc(orber_tc:value_box("Id", "Name", "wrong")),
+ ?line code(orber_tc:value_box("Id", "Name", orber_tc:long())),
+ ?line ?match(code(orber_tc:value_box(42, "Name", orber_tc:short()))),
+ ?line ?match(code(orber_tc:value_box("Id", 42, orber_tc:char()))),
+ ?line ?match(code(orber_tc:value_box("Id", "Name", false))),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: native
+%% Description:
+%%-----------------------------------------------------------------
+native(doc) -> [];
+native(suite) -> [];
+native(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:native("Id", "Name")),
+ ?line false = orber_tc:check_tc(orber_tc:native(42, "Name")),
+ ?line false = orber_tc:check_tc(orber_tc:native("Id", 42)),
+ ?line code(orber_tc:native("Id", "Name")),
+ ?line ?match(code(orber_tc:native(42, "Name"))),
+ ?line ?match(code(orber_tc:native("Id", 42))),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: abstract_interface
+%% Description:
+%%-----------------------------------------------------------------
+abstract_interface(doc) -> [];
+abstract_interface(suite) -> [];
+abstract_interface(_) ->
+ ?line true = orber_tc:check_tc(orber_tc:abstract_interface("RepId", "Name")),
+ ?line false = orber_tc:check_tc(orber_tc:abstract_interface(false, "Name")),
+ ?line false = orber_tc:check_tc(orber_tc:abstract_interface("RepId", 42)),
+ ?line code(orber_tc:abstract_interface("RepId", "Name")),
+ ?line ?match(code(orber_tc:abstract_interface(42, "Name"))),
+ ?line ?match(code(orber_tc:abstract_interface("Id", 42))),
+ ok.
+
+
+
+%%-----------------------------------------------------------------
+%% Test Case: indirection
+%% Description:
+%%-----------------------------------------------------------------
+indirection(doc) -> [];
+indirection(suite) -> [];
+indirection(_) ->
+ ?line true = orber_tc:check_tc({'none', 42}),
+ ok.
+
+%%-----------------------------------------------------------------
+%% Test Case: get_tc
+%% Description:
+%%-----------------------------------------------------------------
+get_tc(doc) -> [];
+get_tc(suite) -> [];
+get_tc(_) ->
+ TC = 'CosNaming_Binding':tc(),
+ ?line TC = orber_tc:get_tc({'CosNaming_Binding', 42}),
+ ?line ?match(orber_tc:get_tc({'none', 42})),
+ ok.
+
+%%-----------------------------------------------------------------
+%% MISC Operations
+%%-----------------------------------------------------------------
+code(Value) ->
+ cdr_encode:enc_type({1,2}, tk_TypeCode, Value).