diff options
Diffstat (limited to 'lib/cosTransactions/test')
-rw-r--r-- | lib/cosTransactions/test/Makefile | 151 | ||||
-rw-r--r-- | lib/cosTransactions/test/cosTransactions.cover | 2 | ||||
-rw-r--r-- | lib/cosTransactions/test/cosTransactions.spec | 1 | ||||
-rw-r--r-- | lib/cosTransactions/test/etrap_test.cfg | 21 | ||||
-rw-r--r-- | lib/cosTransactions/test/etrap_test.idl | 39 | ||||
-rw-r--r-- | lib/cosTransactions/test/etrap_test_lib.erl | 126 | ||||
-rw-r--r-- | lib/cosTransactions/test/etrap_test_lib.hrl | 101 | ||||
-rw-r--r-- | lib/cosTransactions/test/etrap_test_server_impl.erl | 211 | ||||
-rw-r--r-- | lib/cosTransactions/test/generated_SUITE.erl | 543 | ||||
-rw-r--r-- | lib/cosTransactions/test/transactions_SUITE.erl | 396 |
10 files changed, 0 insertions, 1591 deletions
diff --git a/lib/cosTransactions/test/Makefile b/lib/cosTransactions/test/Makefile deleted file mode 100644 index 58199248d1..0000000000 --- a/lib/cosTransactions/test/Makefile +++ /dev/null @@ -1,151 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -#ifeq ($(TYPE),debug) -#ERL_COMPILE_FLAGS += -Ddebug -W -#endif - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(COSTRANSACTIONS_VSN) -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/cosTransactions_test - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -TEST_SPEC_FILE = cosTransactions.spec -COVER_FILE = cosTransactions.cover - - -IDL_FILES = \ - etrap_test.idl - -IDLOUTDIR = idl_output - -MODULES = \ - transactions_SUITE \ - etrap_test_server_impl \ - etrap_test_lib \ - generated_SUITE - -GEN_MODULES = \ - oe_etrap_test \ - etrap_test_server - -GEN_HRL_FILES = \ - oe_etrap_test.hrl \ - etrap_test_server.hrl - -ERL_FILES = $(MODULES:%=%.erl) - -HRL_FILES = \ - etrap_test_lib.hrl - -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) - - -# ---------------------------------------------------- -# PROGRAMS -# ---------------------------------------------------- -LOCAL_CLASSPATH = $(ERL_TOP)/lib/cosTransactions/priv:$(ERL_TOP)/lib/cosTransactions/test -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/cosTransactions/ebin\ - -pa $(ERL_TOP)/lib/orber/ebin \ - -pa $(ERL_TOP)/lib/ic/ebin - -ERL_COMPILE_FLAGS += \ - $(ERL_IDL_FLAGS) \ - -pa $(ERL_TOP)/lib/orber/include \ - -pa $(ERL_TOP)/lib/cosTransactions/ebin \ - -pa $(ERL_TOP)/lib/cosTransactions/test/idl_output \ - -I$(ERL_TOP)/lib/orber/include \ - -I$(ERL_TOP)/lib/cosTransactions \ - -I$(ERL_TOP)/lib/cosTransactions/test/$(IDLOUTDIR) - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- - - -tests debug opt: $(TARGET_FILES) - -clean: - rm -f idl_output/* - rm -f $(TARGET_FILES) - rm -f errs core *~ - -#debug: -# @${MAKE} TYPE=debug - -docs: - -# ---------------------------------------------------- -# Special Targets -# ---------------------------------------------------- - -IDL-GENERATED: etrap_test.idl - erlc $(ERL_IDL_FLAGS) -o$(IDLOUTDIR) \ - +'{cfgfile,"etrap_test.cfg"}' etrap_test.idl - >IDL-GENERATED - -$(GEN_FILES): IDL-GENERATED - -$(TARGET_FILES): IDL-GENERATED - -# ---------------------------------------------------- -# 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) \ - $(COVER_FILE) $(ERL_FILES) $(HRL_FILES) "$(RELSYSDIR)" - $(INSTALL_DATA) $(SUITE_TARGET_FILES) "$(RELSYSDIR)" - $(INSTALL_DIR) "$(RELSYSDIR)/$(IDLOUTDIR)" - $(INSTALL_DATA) $(GEN_TARGET_FILES) $(GEN_FILES) \ - "$(RELSYSDIR)/$(IDLOUTDIR)" - diff --git a/lib/cosTransactions/test/cosTransactions.cover b/lib/cosTransactions/test/cosTransactions.cover deleted file mode 100644 index b27bae999d..0000000000 --- a/lib/cosTransactions/test/cosTransactions.cover +++ /dev/null @@ -1,2 +0,0 @@ -{incl_app,cosTransactions,details}. - diff --git a/lib/cosTransactions/test/cosTransactions.spec b/lib/cosTransactions/test/cosTransactions.spec deleted file mode 100644 index 9918c8ca16..0000000000 --- a/lib/cosTransactions/test/cosTransactions.spec +++ /dev/null @@ -1 +0,0 @@ -{suites,"../cosTransactions_test",all}. diff --git a/lib/cosTransactions/test/etrap_test.cfg b/lib/cosTransactions/test/etrap_test.cfg deleted file mode 100644 index a2bc7d3fb7..0000000000 --- a/lib/cosTransactions/test/etrap_test.cfg +++ /dev/null @@ -1,21 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -{this, "etrap_test::server"}. -{{handle_info, "etrap_test::server"}, true}. diff --git a/lib/cosTransactions/test/etrap_test.idl b/lib/cosTransactions/test/etrap_test.idl deleted file mode 100644 index 7379115be7..0000000000 --- a/lib/cosTransactions/test/etrap_test.idl +++ /dev/null @@ -1,39 +0,0 @@ -// -// %CopyrightBegin% -// -// Copyright Ericsson AB 1999-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -// - -#ifndef _TEST_IDL -#define _TEST_IDL -#include <../src/CosTransactions.idl> -module etrap_test { - - // interface server - interface server : - CosTransactions::Coordinator, CosTransactions::SubtransactionAwareResource, - CosTransactions::RecoveryCoordinator, CosTransactions::Control { - }; -// interface Server : -// CosTransactions::Coordinator, CosTransactions::SubtransactionAwareResource, -// CosTransactions::RecoveryCoordinator, CosTransactions::Control, -// CosTransactions::Synchronization { -// }; - -}; // End of test Module - -#endif diff --git a/lib/cosTransactions/test/etrap_test_lib.erl b/lib/cosTransactions/test/etrap_test_lib.erl deleted file mode 100644 index e8d8c3a429..0000000000 --- a/lib/cosTransactions/test/etrap_test_lib.erl +++ /dev/null @@ -1,126 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - --module(etrap_test_lib). - -%%--------------- INCLUDES --------------------------------------------- --include("etrap_test_lib.hrl"). --include_lib("cosTransactions/src/ETraP_Common.hrl"). - -%%--------------- EXPORTS ---------------------------------------------- --export([scratch_debug_fun/0, - activate_debug_fun/5, - update_debug_info/1, - deactivate_debug_fun/3, - eval_debug_fun/4, - set_debug_context/4]). - -%%--------------- CONSTANTS/DEFINITIONS -------------------------------- --define(DEBUG_TAB, etrap_debug). --record(debug_info, {id, function, type, file, line}). - -%%--------------- DEBUG FUNCTIONS -------------------------------------- -%% Managing conditional debug functions -%% -%% The main idea with the debug_fun's is to allow test programs -%% to control the internal behaviour of CosTransactions. -%% -%% First should calls to ?eval_debug_fun be inserted at well -%% defined places in CosTransaction's code. E.g. in critical situations -%% of startup, transaction commit, backups etc. -%% -%% Then compile CosTransactions with the compiler option 'debug'. -%% -%% In test programs ?activate_debug_fun should be called -%% in order to bind a fun to the debug identifier stated -%% in the call to ?eval_debug_fun. - -scratch_debug_fun() -> - catch ets:delete(?DEBUG_TAB), - ets:new(?DEBUG_TAB, - [set, public, named_table, {keypos, 2}]). - -activate_debug_fun(FunId, Fun, Type, File, Line) -> - io:format("Activiating ~p RETRIES: ~p WAIT: ~p~n", - [FunId, ?tr_max_retries, ?tr_comm_failure_wait]), - Info = #debug_info{id = FunId, - function = Fun, - type = Type, - file = File, - line = Line}, - update_debug_info(Info). - -update_debug_info(Info) -> - case catch ets:insert(?DEBUG_TAB, Info) of - {'EXIT', _} -> - scratch_debug_fun(), - ets:insert(?DEBUG_TAB, Info); - _ -> - ok - end, - ok. - -deactivate_debug_fun(FunId, _File, _Line) -> - catch ets:delete(?DEBUG_TAB, FunId), - ok. - -eval_debug_fun(FunId, Env, File, Line) -> - case catch ets:lookup(?DEBUG_TAB, FunId) of - [] -> - ok; - [Info] -> - Fun = Info#debug_info.function, - case Info#debug_info.type of - transient -> - deactivate_debug_fun(FunId, File, Line); - _-> - ok - end, - io:format("Running debug fun ~p:~p (LINE: ~p)~n", [File, FunId, Line]), - Fun(Env); - {'EXIT', _R} -> - ok - end. - - -set_debug_context([], [], _, _)-> ok; -set_debug_context([], _, _, _)-> - ets:delete(?DEBUG_TAB), - exit("failed transactions_SUITE. Bad configuration."); -set_debug_context(_, [], _, _)-> - ets:delete(?DEBUG_TAB), - exit("failed transactions_SUITE Bad configuration."); -set_debug_context([RHead|RTail], [CHead|CTail], File, Line)-> - write_context(RHead, CHead, File, Line), - set_debug_context(RTail, CTail, File, Line). - -write_context(_Resource, [], _, _)-> ok; -write_context(Resource, [{Func, Fun, Type}|PTail], File, Line)-> - etrap_test_lib:activate_debug_fun({Resource, Func}, - Fun, Type, - File, Line), - write_context(Resource, PTail, File, Line); -write_context(_,_, _, _) -> - ets:delete(?DEBUG_TAB), - exit("failed transactions_SUITE. Bad configuration."). - - -%%--------------- END OF MODULE ---------------------------------------- diff --git a/lib/cosTransactions/test/etrap_test_lib.hrl b/lib/cosTransactions/test/etrap_test_lib.hrl deleted file mode 100644 index 6fe61a4d45..0000000000 --- a/lib/cosTransactions/test/etrap_test_lib.hrl +++ /dev/null @@ -1,101 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - --ifndef(ETRAP_TEST_LIB_HRL). --define(ETRAP_TEST_LIB_HRL, true). - --define(match(ExpectedRes, Expr, Msg), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - io:format("~n------ CORRECT RESULT ------~n~p~n~p~n", - [AcTuAlReS, Msg]), - ok; - _ -> - io:format("~n###### ERROR ERROR ######~n~p~n~p~n", - [AcTuAlReS, Msg]), - exit(AcTuAlReS) - end - end()). - --define(match_inverse(NotExpectedRes, Expr, Msg), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - NotExpectedRes -> - io:format("~n###### ERROR ERROR ######~n ~p~n~p~n", - [AcTuAlReS, Msg]), - exit(AcTuAlReS); - _ -> - io:format("~n------ CORRECT RESULT ------~n~p~n~p~n", - [AcTuAlReS, Msg]), - ok - end - end()). - - --define(crash_and_recover, fun(_Env)-> exit(crash_and_burn) end). - --define(crash_no_recovery, fun(Env)-> throw({stop,normal,{Env,state}}) end). - --define(delay(Time), fun(_Id) -> timer:sleep(Time*1000) end). - --define(TIMEOUT, 4). --define(SUP_TEST(Env, Name), - ['etrap_test_server', Env, - [{sup_child, true}, {persistent, true}, - {regname, {global, Name}}]]). - --define(no_context, [[],[],[], []]). --define(nop, []). --define(delay_transient(Tag, Ti), - [{Tag, ?delay(Ti), transient}]). --define(crash_transient(Tag), - [{Tag, ?crash_and_recover, transient}]). --define(crash_permanent(Tag), - [{Tag, ?crash_no_recovery, permanent}]). - -%%----------------------------------------------------------- -%% Definition of 'Resource' action. -%% function action reply -%%----------------------------------------------------------- -%% raise #'CosTransactions_HeuristicMixed' {} --define(rollback_mix, [{rollback, exc, ?tr_mixed}]). --define(commit_mix, [{commit, exc, ?tr_mixed}]). --define(prepare_mix, [{prepare, exc, ?tr_mixed}]). -%% raise #'CosTransactions_HeuristicRollback' {} --define(rollback_rb, [{rollback, exc, ?tr_rollback}]). --define(commit_rb, [{commit, exc, ?tr_rollback}]). -%% raise #'CosTransactions_HeuristicCommit' {} --define(rollback_cm, [{rollback, exc, ?tr_commit}]). --define(commit_cm, [{commit, exc, ?tr_commit}]). -%% delay reply --define(rollback_delay, [{rollback, delay, ?TIMEOUT*2}]). --define(commit_delay, [{commit, delay, ?TIMEOUT*2}]). --define(prepare_delay, [{prepare, delay, ?TIMEOUT*2}]). -%% other reply than default --define(prepare_commit, [{prepare, reply, 'VoteCommit'}]). --define(prepare_rollback, [{prepare, stop_reply, 'VoteRollback'}]). - --endif. - -%%-------------- EOF --------------------------------------------------- diff --git a/lib/cosTransactions/test/etrap_test_server_impl.erl b/lib/cosTransactions/test/etrap_test_server_impl.erl deleted file mode 100644 index 8a244b42c7..0000000000 --- a/lib/cosTransactions/test/etrap_test_server_impl.erl +++ /dev/null @@ -1,211 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(etrap_test_server_impl). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% Local --include_lib("cosTransactions/src/ETraP_Common.hrl"). --include_lib("cosTransactions/include/CosTransactions.hrl"). -%%--------------- IMPORTS------------------------------------- -%%--------------- EXPORTS------------------------------------- --export([prepare/2, - rollback/2, - commit/2, - commit_one_phase/2, - forget/2, -% before_completion/2, -% after_completion/3, - commit_subtransaction/3, - rollback_subtransaction/2]). - - -%%--------------- gen_server specific ------------------------ --export([init/1, terminate/2]). --export([handle_call/3, handle_cast/2, handle_info/2, code_change/3]). - -%%------------------------------------------------------------ -%% function : init, terminate -%%------------------------------------------------------------ -init(State) -> - process_flag(trap_exit,true), - io:format("etrap_test_server:init ~p~n", [State]), - ?debug_print("STARTING etrap_test_server( ~p )~n", [State]), - {ok, State}. - -terminate(Reason, _State) -> - io:format("etrap_test_server:terminate ~p~n", [Reason]), - ?debug_print("STOPREASON etrap_test_server( ~p )~n", [Reason]), - ok. - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. -handle_call(_,_, State) -> - {noreply, State}. -handle_cast(_, State) -> - {noreply, State}. -handle_info(_Info, State) -> - {noreply, State}. - -%%-- Inherit from CosTransactions::SubtransactionAwareResource -- -prepare(_Self, State) -> - case ?is_debug_compiled of - true -> - io:format("etrap_test_server:prepare ~p~n", [State]); - _-> - ok - end, -% ?debug_print("etrap_test_server:prepare ~p~n", [State]), - action(prepare, State, {reply, 'VoteCommit', State}). - -rollback(_Self, State) -> - case ?is_debug_compiled of - true -> - io:format("etrap_test_server:rollback ~p~n", [State]); - _-> - ok - end, -% ?debug_print("etrap_test_server:rollback ~p~n", [State]), - case sync_test(State) of - true -> - action(rollback, State, {reply, ok, State}); - _-> - action(rollback, State, {stop, normal, ok, State}) - end. - -commit(_Self, State) -> - case ?is_debug_compiled of - true -> - io:format("etrap_test_server:commit ~p~n", [State]); - _-> - ok - end, -% ?debug_print("etrap_test_server:commit ~p~n", [State]), - case sync_test(State) of - true -> - action(commit, State, {reply, ok, State}); - _-> - action(commit, State, {stop, normal, ok, State}) - end. - -commit_one_phase(_Self, State) -> - case ?is_debug_compiled of - true -> - io:format("etrap_test_server:commit_one_phase ~p~n", [State]); - _-> - ok - end, -% ?debug_print("etrap_test_server:commit_one_phase ~p~n", [State]), - case sync_test(State) of - true -> - {reply, ok, State}; - _-> - {stop, normal, ok, State} - end. - -forget(_Self, State) -> - case ?is_debug_compiled of - true -> - io:format("etrap_test_server:forget ~p~n", [State]); - _-> - ok - end, -% ?debug_print("etrap_test_server:forget ~p~n", [State]), - case sync_test(State) of - true -> - {reply, ok, State}; - _-> - {stop, normal, ok, State} - end. - -commit_subtransaction(_Self, State, Parent) -> - case ?is_debug_compiled of - true -> - io:format("etrap_test_server:commit_subtransaction( ~p )~n", [Parent]); - _-> - ok - end, -% ?debug_print("etrap_test_server:commit_subtransaction( ~p )~n", [Parent]), - {reply, ok, State}. -rollback_subtransaction(_Self, State) -> - case ?is_debug_compiled of - true -> - io:format("etrap_test_server:rollback_subtransaction()~n", []); - _-> - ok - end, -% ?debug_print("etrap_test_server:rollback_subtransaction()~n", []), - {reply, ok, State}. - -%before_completion(_Self, State) -> -% case ?is_debug_compiled of -% true -> -% io:format("etrap_test_server:before_completion()~n", []); -% _-> -% ok -% end, -%% ?debug_print("etrap_test_server:before_completion()~n", []), -% {reply, ok, State}. -%after_completion(_Self, State, Status) -> -% case ?is_debug_compiled of -% true -> -% io:format("etrap_test_server:after_completion( ~p )~n", [Status]); -% _-> -% ok -% end, -%% ?debug_print("etrap_test_server:after_completion( ~p )~n", [Status]), -% {stop, normal, ok, State}. - -%%--------------- LOCAL FUNCTIONS ---------------------------- -action(Key, State, Default) -> - case catch lists:keysearch(Key, 1, State) of - {value,{Key, stop_reply, R}} -> - case sync_test(State) of - true -> - {reply, R, State}; - _-> - {stop, normal, R, State} - end; - {value,{Key, reply, R}} -> - {reply, R, State}; - {value,{Key, exc, E}} -> - corba:raise(E); - {value,{Key, delay, Time}} -> - timer:sleep(Time*1000), - Default; - {value,{Key,Value}} -> - Value; - _ -> - Default - end. - -sync_test(State) -> - case catch lists:keysearch(sync, 1, State) of - {value,{sync, true}} -> - true; - _ -> - false - end. - - -%%--------------- END OF MODULE ------------------------------ - diff --git a/lib/cosTransactions/test/generated_SUITE.erl b/lib/cosTransactions/test/generated_SUITE.erl deleted file mode 100644 index 52b850b189..0000000000 --- a/lib/cosTransactions/test/generated_SUITE.erl +++ /dev/null @@ -1,543 +0,0 @@ -%%----------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File : generated_SUITE.erl -%% Purpose : -%% Created : 27 Jan 2004 -%%----------------------------------------------------------------- - --module(generated_SUITE). - --include_lib("common_test/include/ct.hrl"). --include_lib("orber/include/corba.hrl"). - --define(default_timeout, test_server:minutes(3)). - --define(match(ExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - AcTuAlReS; - _ -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS) - end - end()). - --define(nomatch(Not, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - Not -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - 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]), - exit(TC); - true -> - true - end - end). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --compile(export_all). - -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - ['CosTransactions_Control', - 'CosTransactions_Coordinator', - 'CosTransactions_HeuristicCommit', - 'CosTransactions_HeuristicHazard', - 'CosTransactions_HeuristicMixed', - 'CosTransactions_HeuristicRollback', - 'CosTransactions_Inactive', - 'CosTransactions_InvalidControl', - 'CosTransactions_NoTransaction', - 'CosTransactions_NotPrepared', - 'CosTransactions_NotSubtransaction', - 'CosTransactions_RecoveryCoordinator', - 'CosTransactions_Resource', - 'CosTransactions_SubtransactionAwareResource', - 'CosTransactions_SubtransactionsUnavailable', - 'CosTransactions_Terminator', - 'CosTransactions_TransactionFactory', - 'CosTransactions_Unavailable', - 'CosTransactions_SynchronizationUnavailable', - 'CosTransactions_TransIdentity', - 'CosTransactions_PropagationContext', - 'CosTransactions_otid_t', - 'CosTransactions_WrongTransaction', 'ETraP_Server']. - -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- -init_per_testcase(_Case, Config) -> - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Case, Config) -> - Dog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_HeuristicCommit' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_HeuristicCommit'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_HeuristicCommit':tc())), - ?match("IDL:omg.org/CosTransactions/HeuristicCommit:1.0", - 'CosTransactions_HeuristicCommit':id()), - ?match("CosTransactions_HeuristicCommit", - 'CosTransactions_HeuristicCommit':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_HeuristicHazard' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_HeuristicHazard'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_HeuristicHazard':tc())), - ?match("IDL:omg.org/CosTransactions/HeuristicHazard:1.0", - 'CosTransactions_HeuristicHazard':id()), - ?match("CosTransactions_HeuristicHazard", - 'CosTransactions_HeuristicHazard':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_HeuristicMixed' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_HeuristicMixed'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_HeuristicMixed':tc())), - ?match("IDL:omg.org/CosTransactions/HeuristicMixed:1.0", - 'CosTransactions_HeuristicMixed':id()), - ?match("CosTransactions_HeuristicMixed", - 'CosTransactions_HeuristicMixed':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_HeuristicRollback' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_HeuristicRollback'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_HeuristicRollback':tc())), - ?match("IDL:omg.org/CosTransactions/HeuristicRollback:1.0", - 'CosTransactions_HeuristicRollback':id()), - ?match("CosTransactions_HeuristicRollback", - 'CosTransactions_HeuristicRollback':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_Inactive' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_Inactive'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_Inactive':tc())), - ?match("IDL:omg.org/CosTransactions/Inactive:1.0", - 'CosTransactions_Inactive':id()), - ?match("CosTransactions_Inactive", - 'CosTransactions_Inactive':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_InvalidControl' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_InvalidControl'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_InvalidControl':tc())), - ?match("IDL:omg.org/CosTransactions/InvalidControl:1.0", - 'CosTransactions_InvalidControl':id()), - ?match("CosTransactions_InvalidControl", - 'CosTransactions_InvalidControl':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_NoTransaction' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_NoTransaction'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_NoTransaction':tc())), - ?match("IDL:omg.org/CosTransactions/NoTransaction:1.0", - 'CosTransactions_NoTransaction':id()), - ?match("CosTransactions_NoTransaction", - 'CosTransactions_NoTransaction':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_NotPrepared' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_NotPrepared'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_NotPrepared':tc())), - ?match("IDL:omg.org/CosTransactions/NotPrepared:1.0", - 'CosTransactions_NotPrepared':id()), - ?match("CosTransactions_NotPrepared", - 'CosTransactions_NotPrepared':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_NotSubtransaction' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_NotSubtransaction'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_NotSubtransaction':tc())), - ?match("IDL:omg.org/CosTransactions/NotSubtransaction:1.0", - 'CosTransactions_NotSubtransaction':id()), - ?match("CosTransactions_NotSubtransaction", - 'CosTransactions_NotSubtransaction':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_SubtransactionsUnavailable' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_SubtransactionsUnavailable'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_SubtransactionsUnavailable':tc())), - ?match("IDL:omg.org/CosTransactions/SubtransactionsUnavailable:1.0", - 'CosTransactions_SubtransactionsUnavailable':id()), - ?match("CosTransactions_SubtransactionsUnavailable", - 'CosTransactions_SubtransactionsUnavailable':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_Unavailable' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_Unavailable'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_Unavailable':tc())), - ?match("IDL:omg.org/CosTransactions/Unavailable:1.0", - 'CosTransactions_Unavailable':id()), - ?match("CosTransactions_Unavailable", - 'CosTransactions_Unavailable':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_SynchronizationUnavailable' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_SynchronizationUnavailable'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_SynchronizationUnavailable':tc())), - ?match("IDL:omg.org/CosTransactions/SynchronizationUnavailable:1.0", - 'CosTransactions_SynchronizationUnavailable':id()), - ?match("CosTransactions_SynchronizationUnavailable", - 'CosTransactions_SynchronizationUnavailable':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_TransIdentity' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_TransIdentity'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_TransIdentity':tc())), - ?match("IDL:omg.org/CosTransactions/TransIdentity:1.0", - 'CosTransactions_TransIdentity':id()), - ?match("CosTransactions_TransIdentity", - 'CosTransactions_TransIdentity':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_PropagationContext' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_PropagationContext'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_PropagationContext':tc())), - ?match("IDL:omg.org/CosTransactions/PropagationContext:1.0", - 'CosTransactions_PropagationContext':id()), - ?match("CosTransactions_PropagationContext", - 'CosTransactions_PropagationContext':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_otid_t' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_otid_t'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_otid_t':tc())), - ?match("IDL:omg.org/CosTransactions/otid_t:1.0", - 'CosTransactions_otid_t':id()), - ?match("CosTransactions_otid_t", - 'CosTransactions_otid_t':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_WrongTransaction' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_WrongTransaction'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_WrongTransaction':tc())), - ?match("IDL:omg.org/CosTransactions/WrongTransaction:1.0", - 'CosTransactions_WrongTransaction':id()), - ?match("CosTransactions_WrongTransaction", - 'CosTransactions_WrongTransaction':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_Control' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_Control'(_) -> - ?nomatch(undefined, 'CosTransactions_Control':oe_tc(get_terminator)), - ?nomatch(undefined, 'CosTransactions_Control':oe_tc(get_coordinator)), - ?match(undefined, 'CosTransactions_Control':oe_tc(undefined)), - ?match([_|_], 'CosTransactions_Control':oe_get_interface()), - ?match("IDL:omg.org/CosTransactions/Control:1.0", - 'CosTransactions_Control':typeID()), - check_tc('CosTransactions_Control':oe_get_interface()), - ?match(true, 'CosTransactions_Control':oe_is_a('CosTransactions_Control':typeID())), - ?match(false, 'CosTransactions_Control':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_Coordinator' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_Coordinator'(_) -> - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(get_status)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(get_parent_status)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(get_top_level_status)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(is_same_transaction)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(is_related_transaction)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(is_ancestor_transaction)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(is_descendant_transaction)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(is_top_level_transaction)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(hash_transaction)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(hash_top_level_tran)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(register_resource)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(register_subtran_aware)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(rollback_only)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(get_transaction_name)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(create_subtransaction)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(get_txcontext)), - ?match(undefined, 'CosTransactions_Coordinator':oe_tc(undefined)), - ?match([_|_], 'CosTransactions_Coordinator':oe_get_interface()), - ?match("IDL:omg.org/CosTransactions/Coordinator:1.0", - 'CosTransactions_Coordinator':typeID()), - check_tc('CosTransactions_Coordinator':oe_get_interface()), - ?match(true, 'CosTransactions_Coordinator':oe_is_a('CosTransactions_Coordinator':typeID())), - ?match(false, 'CosTransactions_Coordinator':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_RecoveryCoordinator' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_RecoveryCoordinator'(_) -> - ?nomatch(undefined, 'CosTransactions_RecoveryCoordinator':oe_tc(replay_completion)), - ?match(undefined, 'CosTransactions_RecoveryCoordinator':oe_tc(undefined)), - ?match([_|_], 'CosTransactions_RecoveryCoordinator':oe_get_interface()), - ?match("IDL:omg.org/CosTransactions/RecoveryCoordinator:1.0", - 'CosTransactions_RecoveryCoordinator':typeID()), - check_tc('CosTransactions_RecoveryCoordinator':oe_get_interface()), - ?match(true, 'CosTransactions_RecoveryCoordinator':oe_is_a('CosTransactions_RecoveryCoordinator':typeID())), - ?match(false, 'CosTransactions_RecoveryCoordinator':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_Resource' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_Resource'(_) -> - ?nomatch(undefined, 'CosTransactions_Resource':oe_tc(prepare)), - ?nomatch(undefined, 'CosTransactions_Resource':oe_tc(rollback)), - ?nomatch(undefined, 'CosTransactions_Resource':oe_tc(commit)), - ?nomatch(undefined, 'CosTransactions_Resource':oe_tc(commit_one_phase)), - ?nomatch(undefined, 'CosTransactions_Resource':oe_tc(forget)), - ?match(undefined, 'CosTransactions_Resource':oe_tc(undefined)), - ?match([_|_], 'CosTransactions_Resource':oe_get_interface()), - ?match("IDL:omg.org/CosTransactions/Resource:1.0", - 'CosTransactions_Resource':typeID()), - check_tc('CosTransactions_Resource':oe_get_interface()), - ?match(true, 'CosTransactions_Resource':oe_is_a('CosTransactions_Resource':typeID())), - ?match(false, 'CosTransactions_Resource':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_SubtransactionAwareResource' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_SubtransactionAwareResource'(_) -> - ?nomatch(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(commit_subtransaction)), - ?nomatch(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(rollback_subtransaction)), - ?nomatch(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(prepare)), - ?nomatch(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(rollback)), - ?nomatch(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(commit)), - ?nomatch(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(commit_one_phase)), - ?nomatch(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(forget)), - ?match(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(undefined)), - ?match([_|_], 'CosTransactions_SubtransactionAwareResource':oe_get_interface()), - ?match("IDL:omg.org/CosTransactions/SubtransactionAwareResource:1.0", - 'CosTransactions_SubtransactionAwareResource':typeID()), - check_tc('CosTransactions_SubtransactionAwareResource':oe_get_interface()), - ?match(true, 'CosTransactions_SubtransactionAwareResource':oe_is_a('CosTransactions_SubtransactionAwareResource':typeID())), - ?match(true, 'CosTransactions_SubtransactionAwareResource':oe_is_a('CosTransactions_Resource':typeID())), - ?match(false, 'CosTransactions_SubtransactionAwareResource':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_Terminator' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_Terminator'(_) -> - ?nomatch(undefined, 'CosTransactions_Terminator':oe_tc(commit)), - ?nomatch(undefined, 'CosTransactions_Terminator':oe_tc(rollback)), - ?match(undefined, 'CosTransactions_Terminator':oe_tc(undefined)), - ?match([_|_], 'CosTransactions_Terminator':oe_get_interface()), - ?match("IDL:omg.org/CosTransactions/Terminator:1.0", - 'CosTransactions_Terminator':typeID()), - check_tc('CosTransactions_Terminator':oe_get_interface()), - ?match(true, 'CosTransactions_Terminator':oe_is_a('CosTransactions_Terminator':typeID())), - ?match(false, 'CosTransactions_Terminator':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_TransactionFactory' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_TransactionFactory'(_) -> - ?nomatch(undefined, 'CosTransactions_TransactionFactory':oe_tc(create)), - ?nomatch(undefined, 'CosTransactions_TransactionFactory':oe_tc(recreate)), - ?match(undefined, 'CosTransactions_TransactionFactory':oe_tc(undefined)), - ?match([_|_], 'CosTransactions_TransactionFactory':oe_get_interface()), - ?match("IDL:omg.org/CosTransactions/TransactionFactory:1.0", - 'CosTransactions_TransactionFactory':typeID()), - check_tc('CosTransactions_TransactionFactory':oe_get_interface()), - ?match(true, 'CosTransactions_TransactionFactory':oe_is_a('CosTransactions_TransactionFactory':typeID())), - ?match(false, 'CosTransactions_TransactionFactory':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'ETraP_Server' -%% Description: -%%----------------------------------------------------------------- -'ETraP_Server'(_) -> - ?nomatch(undefined, 'ETraP_Server':oe_tc(get_status)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(get_parent_status)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(get_top_level_status)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(is_same_transaction)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(is_related_transaction)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(is_ancestor_transaction)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(is_descendant_transaction)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(is_top_level_transaction)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(hash_transaction)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(hash_top_level_tran)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(register_resource)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(register_subtran_aware)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(rollback_only)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(get_transaction_name)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(create_subtransaction)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(get_txcontext)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(prepare)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(rollback)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(commit)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(commit_one_phase)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(forget)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(replay_completion)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(get_terminator)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(get_coordinator)), - ?match(undefined, 'ETraP_Server':oe_tc(undefined)), - ?match([_|_], 'ETraP_Server':oe_get_interface()), - ?match("IDL:omg.org/ETraP/Server:1.0", - 'ETraP_Server':typeID()), - check_tc('ETraP_Server':oe_get_interface()), - ?match(true, 'ETraP_Server':oe_is_a('ETraP_Server':typeID())), - ?match(true, 'ETraP_Server':oe_is_a('CosTransactions_Coordinator':typeID())), - ?match(true, 'ETraP_Server':oe_is_a('CosTransactions_Resource':typeID())), - ?match(true, 'ETraP_Server':oe_is_a('CosTransactions_RecoveryCoordinator':typeID())), - ?match(true, 'ETraP_Server':oe_is_a('CosTransactions_Control':typeID())), - ?match(false, 'ETraP_Server':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/cosTransactions/test/transactions_SUITE.erl b/lib/cosTransactions/test/transactions_SUITE.erl deleted file mode 100644 index 00753a4e6e..0000000000 --- a/lib/cosTransactions/test/transactions_SUITE.erl +++ /dev/null @@ -1,396 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(transactions_SUITE). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). - -%% Local --include_lib("cosTransactions/src/ETraP_Common.hrl"). --include_lib("cosTransactions/include/CosTransactions.hrl"). --include("etrap_test_lib.hrl"). - --include_lib("common_test/include/ct.hrl"). - --define(default_timeout, test_server:minutes(20)). - - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, cases/0, - init_per_suite/1, end_per_suite/1, resource_api/1, etrap_api/1, - init_per_testcase/2, end_per_testcase/2, app_test/1]). - -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - cases(). - -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -cases() -> - [etrap_api, resource_api, app_test]. - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- -init_per_testcase(_Case, Config) -> - Path = code:which(?MODULE), - code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), - 'oe_CosTransactions':'oe_register'(), - 'oe_etrap_test':'oe_register'(), - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - - -end_per_testcase(_Case, Config) -> - 'oe_etrap_test':'oe_unregister'(), - 'oe_CosTransactions':'oe_unregister'(), - Path = code:which(?MODULE), - code:del_path(filename:join(filename:dirname(Path), "idl_output")), - Dog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - -init_per_suite(Config) -> - 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. - -end_per_suite(Config) -> - application:stop(orber), - application:stop(mnesia), - mnesia:delete_schema([node()]), - Config. - -%%----------------------------------------------------------------- -%% Tests app file -%%----------------------------------------------------------------- -app_test(_Config) -> - ok=test_server:app_test(cosTransactions), - ok. - -%%----------------------------------------------------------------- -%% API tests -%%----------------------------------------------------------------- -etrap_api(_Config) -> - ?match(ok, application:start(cosTransactions), - "Starting the cosTransactions application"), - TrFac = cosTransactions:start_factory(), - %% Start a new transaction: - %% RootCoord - %% / \ - %% SubCoord1 SubCoord2 - Control = 'CosTransactions_TransactionFactory':create(TrFac, 0), - Term = 'CosTransactions_Control':get_terminator(Control), - Coord = 'CosTransactions_Control':get_coordinator(Control), - SubCont1 = 'CosTransactions_Coordinator':create_subtransaction(Coord), - SubCont2 = 'CosTransactions_Coordinator':create_subtransaction(Coord), - SubCoord1 = 'CosTransactions_Control':get_coordinator(SubCont1), - SubCoord2 = 'CosTransactions_Control':get_coordinator(SubCont2), - - - %%------ Test CosTransactions::Coordinator ------ - ?match(true, - 'CosTransactions_Coordinator':is_same_transaction(Coord, Coord), - "'CosTransactions_Coordinator':is_same_transaction"), - ?match(false, - 'CosTransactions_Coordinator':is_same_transaction(Coord, SubCoord1), - "'CosTransactions_Coordinator':is_same_transaction"), - ?match(true, - 'CosTransactions_Coordinator':is_descendant_transaction(Coord, Coord), - "'CosTransactions_Coordinator':is_descendant_transaction"), - ?match(false, - 'CosTransactions_Coordinator':is_descendant_transaction(Coord, SubCoord1), - "'CosTransactions_Coordinator':is_descendant_transaction"), - ?match(true, - 'CosTransactions_Coordinator':is_descendant_transaction(SubCoord1, Coord), - "'CosTransactions_Coordinator':is_descendant_transaction"), - ?match(false, - 'CosTransactions_Coordinator':is_descendant_transaction(SubCoord1, SubCoord2), - "'CosTransactions_Coordinator':is_descendant_transaction"), - ?match(true, - 'CosTransactions_Coordinator':is_top_level_transaction(Coord), - "'CosTransactions_Coordinator':is_top_level_transaction"), - ?match(false, - 'CosTransactions_Coordinator':is_top_level_transaction(SubCoord2), - "'CosTransactions_Coordinator':is_top_level_transaction"), - - RootHash = 'CosTransactions_Coordinator':hash_transaction(Coord), - RepeatHash= 'CosTransactions_Coordinator':hash_transaction(Coord), - RootHash2 = 'CosTransactions_Coordinator':hash_top_level_tran(SubCoord1), - RootHash3 = 'CosTransactions_Coordinator':hash_top_level_tran(Coord), - _SubHash = 'CosTransactions_Coordinator':hash_transaction(SubCoord2), - ?match(RootHash, RepeatHash, - "'CosTransactions_Coordinator':hash_transaction"), - ?match(RootHash, RootHash2, - "'CosTransactions_Coordinator':hash_top_level_tran"), - ?match(RootHash, RootHash3, - "'CosTransactions_Coordinator':hash_top_level_tran"), -% ?match_inverse(RootHash, SubHash, -% "'CosTransactions_Coordinator':hash_transaction"), - - ?match('StatusActive', - 'CosTransactions_Coordinator':get_status(Coord), - "'CosTransactions_Coordinator':get_status"), - ?match('StatusActive', - 'CosTransactions_Coordinator':get_status(SubCoord1), - "'CosTransactions_Coordinator':get_status"), - ?match('StatusActive', - 'CosTransactions_Coordinator':get_parent_status(Coord), - "'CosTransactions_Coordinator':get_parent_status"), - ?match('StatusActive', - 'CosTransactions_Coordinator':get_parent_status(SubCoord1), - "'CosTransactions_Coordinator':get_parent_status"), - ?match('StatusActive', - 'CosTransactions_Coordinator':get_top_level_status(Coord), - "'CosTransactions_Coordinator':get_top_level_status"), - ?match('StatusActive', - 'CosTransactions_Coordinator':get_top_level_status(SubCoord1), - "'CosTransactions_Coordinator':get_top_level_status"), - - %% Create a CosTransactions::Resource to experiments with. - %% Start a new transaction: - %% RootCoord - %% / \ - %% SubCoord1 SubCoord2 - %% / - %% Resource - N1 = 'ETraP_Common':create_name("test"), - O1 = etrap_test_server:oe_create(?nop, {global, N1}), - _RC1 = 'CosTransactions_Coordinator':register_resource(SubCoord1, O1), -% 'CosTransactions_Coordinator':register_synchronization(SubCoord1, O1), - - ?match('VoteCommit', - 'CosTransactions_Resource':prepare(SubCoord1), - "'CosTransactions_Coordinator':prepare"), - %% The Transaction are no longer in 'StatusActive' state. No new - %% "members" allowed. - ?match('StatusPrepared', - 'CosTransactions_Coordinator':get_status(SubCoord1), - "'CosTransactions_Coordinator':get_status"), -% ?match({'EXCEPTION', ?tr_inactive}, -% 'CosTransactions_Coordinator':register_synchronization(SubCoord1, O1), -% "'CosTransactions_Coordinator':register_synchronization"), - ?match({'EXCEPTION', ?tr_inactive}, - 'CosTransactions_Coordinator':register_resource(SubCoord1, O1), - "'CosTransactions_Coordinator':register_resource"), - ?match({'EXCEPTION', ?tr_inactive}, - 'CosTransactions_Coordinator':create_subtransaction(SubCoord1), - "'CosTransactions_Coordinator':create_subtransaction"), - - catch corba:dispose(SubCoord1), - catch corba:dispose(SubCoord2), - catch corba:dispose(SubCont1), - catch corba:dispose(SubCont2), - catch corba:dispose(Term), - catch corba:dispose(Control), - catch corba:dispose(Coord), - catch corba:dispose(O1), - - cosTransactions:stop_factory(TrFac), - application:stop(cosTransactions), - ok. - -%%----------------------------------------------------------------- -%% API tests -%%----------------------------------------------------------------- -resource_api(_Config) -> - ?match(ok, application:start(cosTransactions), - "Starting the cosTransactions application"), - TrFac = cosTransactions:start_factory([{typecheck, true}]), - - ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - run(TrFac, 0, {?nop, ?nop, ?nop, ?prepare_rollback}), - "TESTCASE #1: Prepare rollback Resource 4"), - ?match({'EXCEPTION', ?tr_mixed}, - run(TrFac, 0, {?nop, ?nop, ?commit_mix, ?nop}), - "TESTCASE #2: Heuristic Mixed exception Resource 3"), - ?match(ok, - run(TrFac, 0, {?nop, ?nop, ?nop, ?nop}), - "TESTCASE #3: Normal completion. No errors."), - ?match(ok, - run(TrFac, 0, {?nop, ?nop, ?nop, ?commit_cm}), - "TESTCASE #4: Heuristic Commit Exception Resource 4"), - ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - run(TrFac, 0, {?nop, ?rollback_rb, ?nop, ?prepare_rollback}), - "TESTCASE #5: Heuristic Rollbac Resource 2, Resource 4 reply 'VoteRollback'"), - ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - run(TrFac, 0, {?nop, ?nop, ?prepare_rollback, ?rollback_rb}), - "TESTCASE #6: Heuristic Rollbac Resource 4, Resource 3 reply 'VoteRollback'"), - ?match(ok, - run(TrFac, 0, {?nop, ?nop, ?commit_delay, ?nop}), - "TESTCASE #7: Resource 3 delay during commit. No timeout."), - ?match(ok, - run(TrFac, 0, {?nop, ?nop, ?prepare_delay, ?nop}), - "TESTCASE #8: Resource 3 delay during prepare. No timeout."), - ?match(ok, - run(TrFac, ?TIMEOUT, {?nop, ?commit_delay, ?nop, ?nop}), - "TESTCASE #9: Resource 3 delay during commit. Timeout."), - ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - run(TrFac, ?TIMEOUT, {?nop, ?prepare_delay, ?nop, ?nop}), - "TESTCASE #10: Resource 3 delay during prepare. Timeout."), - case ?is_debug_compiled of - true -> - %% Testing the Coordinators (root and sub). - ?match(ok, - run(TrFac, 0, {?nop, ?nop, ?nop, ?nop, [?nop, ?nop,?crash_transient(commit), ?nop]}), - "TESTCASE #11: SubCoord 3 crash transient during commit."), - ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{}}, - run(TrFac, 0, {?nop, ?nop, ?nop, ?nop, [?nop, ?nop,?crash_transient(send_prepare), ?nop]}), - "TESTCASE #12: SubCoord 3 crash transient during send prepare."), - ?match({'EXCEPTION', ?tr_hazard}, - run(TrFac, 0, {?nop, ?nop, ?nop, ?nop, [?nop, ?nop,?crash_permanent(commit), ?nop]}), - "TESTCASE #13: SubCoord 3 crash permanent during commit."), - ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{}}, - run(TrFac, 0, {?nop, ?nop, ?nop, ?nop, [?nop, ?nop,?crash_permanent(send_prepare), ?nop]}), - "TESTCASE #14: SubCoord 3 crash permanent during prepare."), - ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{}}, - run(TrFac, 0, {?nop, ?nop, ?nop, ?nop, [?nop, ?crash_transient(send_prepare), ?crash_transient(commit), ?nop]}), - "TESTCASE #15: SubCoord 2 crash transient during prepare. SubCoord 3 crash transient during commit"), - ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - run(TrFac, 0, {?nop, ?nop, ?nop, ?nop, [?crash_transient(send_prepare), ?nop, ?nop, ?nop]}), - "TESTCASE #16: RootCoord crash transient during send prepare."), - ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{}}, - run(TrFac, 0, {?nop, ?nop, ?nop, ?nop, [?nop, ?crash_transient(prepare1), ?nop, ?nop]}), - "TESTCASE #17: SubCoord 1 crash transient during prepare1."), - ?match({'EXCEPTION', ?tr_mixed}, - run(TrFac, 0, {?nop, ?prepare_mix, ?nop, ?nop, [?nop, ?nop, ?crash_transient(prepare2), ?nop]}), - "TESTCASE #18: SubCoord 3 crash transient during prepare2. Resource 2 raise Heuristic Mixed during prepare"), - ?match({'EXCEPTION', ?tr_mixed}, - run(TrFac, 0, {?nop, ?commit_mix, ?nop, ?nop, [?nop, ?nop, ?crash_transient(commit2), ?nop]}), - "TESTCASE #19: Resource 2 raise Heurist mixed during commit. SubCoord crash transient commit2"), - ?match({'EXCEPTION', ?tr_mixed}, - run(TrFac, 0, {?nop, ?rollback_cm, ?nop, ?prepare_rollback, [?nop, ?crash_transient(rollback2), ?nop, ?nop]}), - "TESTCASE #20: Resource 2 raise Heuristic Commit during rollback. Resource 4 'VoteRollback'. SubCoord 2 crash transient rollback2."), - ?match({'EXCEPTION', ?tr_mixed}, - run(TrFac, 0, {?nop, ?nop, ?nop, ?commit_mix, [?nop, ?nop, ?crash_transient(send_forget1), ?nop]}), - "TESTCASE #21: Resource 4 raise Heuristic Mixed during commit. SubCoord 2 crash transient send_forget1."), - ?match({'EXCEPTION', ?tr_mixed}, - run(TrFac, 0, {?nop, ?nop, ?nop, ?commit_mix, [?crash_transient(send_forget1), ?nop, ?nop, ?nop]}), - "TESTCASE #22: Resource 4 raise Heuristic Mixed during commit. Root Coord crash transient send_forget1."), - ?match({'EXCEPTION', ?tr_mixed}, - run(TrFac, 0, {?nop, ?nop, ?nop, ?commit_mix, [?crash_transient(send_forget3), ?nop, ?crash_transient(send_forget1), ?nop]}), - "TESTCASE #23: Resource 4 raise Heuristic Mixed during commit. Root Coord crash transient send_forget3. SubCoord 3 crash transient send_forget1."), - ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - run(TrFac, ?TIMEOUT, {?nop, ?nop, ?nop, ?nop, [?delay_transient(root_delay, ?TIMEOUT*2), ?nop, ?nop, ?nop]}), - "TESTCASE #24: Delay RootCoord. Timeout."), - %% Testing the Terminator. - ?match({'EXCEPTION', ?tr_mixed}, - run(TrFac, ?TIMEOUT, {?nop, ?prepare_mix, ?nop, ?nop, [?nop, ?nop, ?nop, ?crash_transient(commit_heuristic1)]}), - "TESTCASE #25: Terminator crash transient after received and logged Heuristic mix."), - ?match(ok, - run(TrFac, ?TIMEOUT, {?nop, ?nop, ?nop, ?nop, [?nop, ?nop, ?nop, ?crash_transient(commit_ok2)]}), - "TESTCASE #26: Terminator crash transient after received and logged 'ok'."); - _ -> - ok - end, - - cosTransactions:stop_factory(TrFac), - application:stop(cosTransactions), - ok. - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- - -run(TrFac, Time, Spec) -> - Control = 'CosTransactions_TransactionFactory':create(TrFac, Time), - Term = 'CosTransactions_Control':get_terminator(Control), - Coord = 'CosTransactions_Control':get_coordinator(Control), - SubCont1 = 'CosTransactions_Coordinator':create_subtransaction(Coord), - SubCont2 = 'CosTransactions_Coordinator':create_subtransaction(Coord), - SubCoord1 = 'CosTransactions_Control':get_coordinator(SubCont1), - SubCoord2 = 'CosTransactions_Control':get_coordinator(SubCont2), - %% Start resources/participants. - {O1, O2, O3, O4, Ctx} = start_resources(Spec), - - %% Get generated names to use for debugging. - CoordN = 'CosTransactions_Coordinator':get_transaction_name(Coord), - SubC1N = 'CosTransactions_Coordinator':get_transaction_name(SubCoord1), - SubC2N = 'CosTransactions_Coordinator':get_transaction_name(SubCoord2), - - ?set_debug_context([CoordN, SubC1N, SubC2N, Term], Ctx), - - %% Register the resources as participants. - _RC1 = 'CosTransactions_Coordinator':register_resource(SubCoord1, O1), - _RC2 = 'CosTransactions_Coordinator':register_resource(SubCoord1, O2), - _RC3 = 'CosTransactions_Coordinator':register_resource(SubCoord2, O3), - _RC4 = 'CosTransactions_Coordinator':register_resource(SubCoord2, O4), - - 'CosTransactions_Coordinator':register_subtran_aware(SubCoord1, O4), -% 'CosTransactions_Coordinator':register_synchronization(SubCoord1, O2), - -% Reply = (catch 'CosTransactions_Terminator':commit(Term, true)), - Reply = (catch 'ETraP_Common':send_stubborn('CosTransactions_Terminator', - commit, [Term, true], - ?tr_max_retries, - ?tr_comm_failure_wait)), - - catch corba:dispose(SubCoord1), - catch corba:dispose(SubCoord2), - catch corba:dispose(SubCont1), - catch corba:dispose(SubCont2), - catch corba:dispose(Term), - catch corba:dispose(Control), - catch corba:dispose(Coord), - catch corba:dispose(O1), - catch corba:dispose(O2), - catch corba:dispose(O3), - catch corba:dispose(O4), - Reply. - -start_resources({A1, A2, A3, A4})-> - start_resources({A1, A2, A3, A4, ?no_context}); -start_resources({A1, A2, A3, A4, Ctx})-> - N1 = 'ETraP_Common':create_name("test"), - N2 = 'ETraP_Common':create_name("test"), - N3 = 'ETraP_Common':create_name("test"), - N4 = 'ETraP_Common':create_name("test"), - {_,_,O1} = supervisor:start_child(?SUPERVISOR_NAME, ?SUP_TEST(A1, N1)), - {_,_,O2} = supervisor:start_child(?SUPERVISOR_NAME, ?SUP_TEST(A2, N2)), -% {_,_,O2} = supervisor:start_child(?SUPERVISOR_NAME, ?SUP_TEST([{sync,true}|A2], N2)), - {_,_,O3} = supervisor:start_child(?SUPERVISOR_NAME, ?SUP_TEST(A3, N3)), - {_,_,O4} = supervisor:start_child(?SUPERVISOR_NAME, ?SUP_TEST(A4, N4)), - {O1, O2, O3, O4, Ctx}. |