diff options
Diffstat (limited to 'lib/cosTime/test')
-rw-r--r-- | lib/cosTime/test/Makefile | 135 | ||||
-rw-r--r-- | lib/cosTime/test/cosTime.cover | 2 | ||||
-rw-r--r-- | lib/cosTime/test/cosTime.spec | 1 | ||||
-rw-r--r-- | lib/cosTime/test/generated_SUITE.erl | 289 | ||||
-rw-r--r-- | lib/cosTime/test/time_SUITE.erl | 301 |
5 files changed, 0 insertions, 728 deletions
diff --git a/lib/cosTime/test/Makefile b/lib/cosTime/test/Makefile deleted file mode 100644 index 91d3eccf43..0000000000 --- a/lib/cosTime/test/Makefile +++ /dev/null @@ -1,135 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2000-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 - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(COSTIME_VSN) -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/cosTime_test - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -TEST_SPEC_FILE = cosTime.spec -COVER_FILE = cosTime.cover - - -IDL_FILES = - -IDLOUTDIR = idl_output - -MODULES = \ - time_SUITE \ - generated_SUITE - -GEN_MODULES = \ - -GEN_HRL_FILES = \ - -ERL_FILES = $(MODULES:%=%.erl) - -HRL_FILES = - -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/cosTime/priv:$(ERL_TOP)lib/cosTime/test -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/cosTime/ebin \ - -pa $(ERL_TOP)/lib/cosTime/src \ - -pa $(ERL_TOP)/lib/cosTime/include \ - -pa $(ERL_TOP)/lib/cosNotification/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/cosNotification/include \ - -pa $(ERL_TOP)/lib/cosTime/ebin \ - -pa $(ERL_TOP)/lib/cosTime/include \ - -pa $(ERL_TOP)/lib/cosTime/test/idl_output \ - -I$(ERL_TOP)/lib/orber/include \ - -I$(ERL_TOP)/lib/cosNotification/include \ - -I$(ERL_TOP)/lib/cosTime/src \ - -I$(ERL_TOP)/lib/cosTime/include \ - -I$(ERL_TOP)/lib/cosTime \ - -I$(ERL_TOP)/lib/cosTime/test/$(IDLOUTDIR) - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- - - -tests debug opt: $(TARGET_FILES) - -clean: - rm -f idl_output/* - rm -f $(TARGET_FILES) - rm -f errs core *~ - -docs: - -# ---------------------------------------------------- -# Special Targets -# ---------------------------------------------------- - -# ---------------------------------------------------- -# 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) "$(RELSYSDIR)" - $(INSTALL_DATA) $(SUITE_TARGET_FILES) "$(RELSYSDIR)" -# $(INSTALL_DIR) "$(RELSYSDIR)/$(IDLOUTDIR)" -# $(INSTALL_DATA) $(GEN_TARGET_FILES) $(GEN_FILES) \ -# "$(RELSYSDIR)/$(IDLOUTDIR)" - diff --git a/lib/cosTime/test/cosTime.cover b/lib/cosTime/test/cosTime.cover deleted file mode 100644 index 81a05b8cfd..0000000000 --- a/lib/cosTime/test/cosTime.cover +++ /dev/null @@ -1,2 +0,0 @@ -{incl_app,cosTime,details}. - diff --git a/lib/cosTime/test/cosTime.spec b/lib/cosTime/test/cosTime.spec deleted file mode 100644 index 8bf6f740fe..0000000000 --- a/lib/cosTime/test/cosTime.spec +++ /dev/null @@ -1 +0,0 @@ -{suites,"../cosTime_test",all}. diff --git a/lib/cosTime/test/generated_SUITE.erl b/lib/cosTime/test/generated_SUITE.erl deleted file mode 100644 index b030155340..0000000000 --- a/lib/cosTime/test/generated_SUITE.erl +++ /dev/null @@ -1,289 +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 : -%%----------------------------------------------------------------- - --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() -> - ['TimeBase_IntervalT', 'TimeBase_UtcT', - 'CosTime_TimeUnavailable', 'CosTimerEvent_TimerEventT', - 'CosTime_TIO', 'CosTime_TimeService', 'CosTime_UTO', - 'CosTimerEvent_TimerEventHandler', - 'CosTimerEvent_TimerEventService']. - -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: 'TimeBase_IntervalT' -%% Description: -%%----------------------------------------------------------------- -'TimeBase_IntervalT'(_) -> - ?match(true, orber_tc:check_tc('TimeBase_IntervalT':tc())), - ?match("IDL:omg.org/TimeBase/IntervalT:1.0", - 'TimeBase_IntervalT':id()), - ?match("TimeBase_IntervalT", - 'TimeBase_IntervalT':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'TimeBase_UtcT' -%% Description: -%%----------------------------------------------------------------- -'TimeBase_UtcT'(_) -> - ?match(true, orber_tc:check_tc('TimeBase_UtcT':tc())), - ?match("IDL:omg.org/TimeBase/UtcT:1.0", - 'TimeBase_UtcT':id()), - ?match("TimeBase_UtcT", - 'TimeBase_UtcT':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTime_TimeUnavailable' -%% Description: -%%----------------------------------------------------------------- -'CosTime_TimeUnavailable'(_) -> - ?match(true, orber_tc:check_tc('CosTime_TimeUnavailable':tc())), - ?match("IDL:omg.org/CosTime/TimeUnavailable:1.0", - 'CosTime_TimeUnavailable':id()), - ?match("CosTime_TimeUnavailable", - 'CosTime_TimeUnavailable':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTimerEvent_TimerEventT' -%% Description: -%%----------------------------------------------------------------- -'CosTimerEvent_TimerEventT'(_) -> - ?match(true, orber_tc:check_tc('CosTimerEvent_TimerEventT':tc())), - ?match("IDL:omg.org/CosTimerEvent/TimerEventT:1.0", - 'CosTimerEvent_TimerEventT':id()), - ?match("CosTimerEvent_TimerEventT", - 'CosTimerEvent_TimerEventT':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTime_TIO' -%% Description: -%%----------------------------------------------------------------- -'CosTime_TIO'(_) -> - ?nomatch(undefined, 'CosTime_TIO':oe_tc('_get_time_interval')), - ?nomatch(undefined, 'CosTime_TIO':oe_tc(spans)), - ?nomatch(undefined, 'CosTime_TIO':oe_tc(overlaps)), - ?nomatch(undefined, 'CosTime_TIO':oe_tc(time)), - ?match(undefined, 'CosTime_TIO':oe_tc(undefined)), - ?match([_|_], 'CosTime_TIO':oe_get_interface()), - ?match("IDL:omg.org/CosTime/TIO:1.0", 'CosTime_TIO':typeID()), - check_tc('CosTime_TIO':oe_get_interface()), - ?match(true, 'CosTime_TIO':oe_is_a('CosTime_TIO':typeID())), - ?match(false, 'CosTime_TIO':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTime_TimeService' -%% Description: -%%----------------------------------------------------------------- -'CosTime_TimeService'(_) -> - ?nomatch(undefined, 'CosTime_TimeService':oe_tc(universal_time)), - ?nomatch(undefined, 'CosTime_TimeService':oe_tc(secure_universal_time)), - ?nomatch(undefined, 'CosTime_TimeService':oe_tc(new_universal_time)), - ?nomatch(undefined, 'CosTime_TimeService':oe_tc(uto_from_utc)), - ?nomatch(undefined, 'CosTime_TimeService':oe_tc(new_interval)), - ?match(undefined, 'CosTime_TimeService':oe_tc(undefined)), - ?match([_|_], 'CosTime_TimeService':oe_get_interface()), - ?match("IDL:omg.org/CosTime/TimeService:1.0", - 'CosTime_TimeService':typeID()), - check_tc('CosTime_TimeService':oe_get_interface()), - ?match(true, 'CosTime_TimeService':oe_is_a('CosTime_TimeService':typeID())), - ?match(false, 'CosTime_TimeService':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTime_UTO' -%% Description: -%%----------------------------------------------------------------- -'CosTime_UTO'(_) -> - ?nomatch(undefined, 'CosTime_UTO':oe_tc('_get_time')), - ?nomatch(undefined, 'CosTime_UTO':oe_tc('_get_inaccuracy')), - ?nomatch(undefined, 'CosTime_UTO':oe_tc('_get_tdf')), - ?nomatch(undefined, 'CosTime_UTO':oe_tc('_get_utc_time')), - ?nomatch(undefined, 'CosTime_UTO':oe_tc(absolute_time)), - ?nomatch(undefined, 'CosTime_UTO':oe_tc(compare_time)), - ?nomatch(undefined, 'CosTime_UTO':oe_tc(time_to_interval)), - ?nomatch(undefined, 'CosTime_UTO':oe_tc(interval)), - ?match(undefined, 'CosTime_UTO':oe_tc(undefined)), - ?match([_|_], 'CosTime_UTO':oe_get_interface()), - ?match("IDL:omg.org/CosTime/UTO:1.0", 'CosTime_UTO':typeID()), - check_tc('CosTime_UTO':oe_get_interface()), - ?match(true, 'CosTime_UTO':oe_is_a('CosTime_UTO':typeID())), - ?match(false, 'CosTime_UTO':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTimerEvent_TimerEventHandler' -%% Description: -%%----------------------------------------------------------------- -'CosTimerEvent_TimerEventHandler'(_) -> - ?nomatch(undefined, 'CosTimerEvent_TimerEventHandler':oe_tc('_get_status')), - ?nomatch(undefined, 'CosTimerEvent_TimerEventHandler':oe_tc(time_set)), - ?nomatch(undefined, 'CosTimerEvent_TimerEventHandler':oe_tc(set_timer)), - ?nomatch(undefined, 'CosTimerEvent_TimerEventHandler':oe_tc(cancel_timer)), - ?nomatch(undefined, 'CosTimerEvent_TimerEventHandler':oe_tc(set_data)), - ?match(undefined, 'CosTimerEvent_TimerEventHandler':oe_tc(undefined)), - ?match([_|_], 'CosTimerEvent_TimerEventHandler':oe_get_interface()), - ?match("IDL:omg.org/CosTimerEvent/TimerEventHandler:1.0", - 'CosTimerEvent_TimerEventHandler':typeID()), - check_tc('CosTimerEvent_TimerEventHandler':oe_get_interface()), - ?match(true, 'CosTimerEvent_TimerEventHandler':oe_is_a('CosTimerEvent_TimerEventHandler':typeID())), - ?match(false, 'CosTimerEvent_TimerEventHandler':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTimerEvent_TimerEventService' -%% Description: -%%----------------------------------------------------------------- -'CosTimerEvent_TimerEventService'(_) -> - ?nomatch(undefined, 'CosTimerEvent_TimerEventService':oe_tc(register)), - ?nomatch(undefined, 'CosTimerEvent_TimerEventService':oe_tc(unregister)), - ?nomatch(undefined, 'CosTimerEvent_TimerEventService':oe_tc(event_time)), - ?match(undefined, 'CosTimerEvent_TimerEventService':oe_tc(undefined)), - ?match([_|_], 'CosTimerEvent_TimerEventService':oe_get_interface()), - ?match("IDL:omg.org/CosTimerEvent/TimerEventService:1.0", - 'CosTimerEvent_TimerEventService':typeID()), - check_tc('CosTimerEvent_TimerEventService':oe_get_interface()), - ?match(true, 'CosTimerEvent_TimerEventService':oe_is_a('CosTimerEvent_TimerEventService':typeID())), - ?match(false, 'CosTimerEvent_TimerEventService':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/cosTime/test/time_SUITE.erl b/lib/cosTime/test/time_SUITE.erl deleted file mode 100644 index f85f13badb..0000000000 --- a/lib/cosTime/test/time_SUITE.erl +++ /dev/null @@ -1,301 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-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 : time_SUITE.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module(time_SUITE). - - -%%--------------- INCLUDES ----------------------------------- --include_lib("cosTime/src/cosTimeApp.hrl"). - --include_lib("common_test/include/ct.hrl"). - -%%--------------- DEFINES ------------------------------------ --define(default_timeout, test_server:minutes(20)). --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]), - exit(AcTuAlReS) - end - end()). - --define(match_inverse(NotExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - NotExpectedRes -> - io:format("###### ERROR ERROR ######~n ~p~n", - [AcTuAlReS]), - exit(AcTuAlReS); - _ -> - io:format("------ CORRECT RESULT ------~n~p~n", - [AcTuAlReS]), - AcTuAlReS - end - end()). - - -%%----------------------------------------------------------------- -%% 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, time_api/1, timerevent_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() -> - [time_api, timerevent_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")), - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - - -end_per_testcase(_Case, Config) -> - 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) -> - Path = code:which(?MODULE), - code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), - mnesia:delete_schema([node()]), - mnesia:create_schema([node()]), - orber:install([node()]), - application:start(mnesia), - application:start(orber), - cosNotificationApp:install_event(), - cosNotificationApp:install(), - cosTime:install_time(), - cosTime:install_timerevent(), - if - is_list(Config) -> - Config; - true -> - exit("Config not a list") - end. - -end_per_suite(Config) -> - Path = code:which(?MODULE), - code:del_path(filename:join(filename:dirname(Path), "idl_output")), - cosTime:uninstall_time(), - cosTime:uninstall_timerevent(), - cosNotificationApp:uninstall(), - cosNotificationApp:uninstall_event(), - application:stop(orber), - application:stop(mnesia), - mnesia:delete_schema([node()]), - Config. - -%%----------------------------------------------------------------- -%% Tests app file -%%----------------------------------------------------------------- -app_test(_Config) -> - ok=test_server:app_test(cosTime), - ok. - -%%----------------------------------------------------------------- -%% CosTime API tests -%%----------------------------------------------------------------- -time_api(_Config) -> - ?match(ok, application:start(cosTime)), - TS=cosTime:start_time_service(0, 500), - Time=calendar:datetime_to_gregorian_seconds({{1582,1,1},{0,0,0}}), - Inaccuracy = 1000, - Tdf =1, - Utc = #'TimeBase_UtcT'{time=Time, inacclo = ?low_TimeT(Inaccuracy), - inacchi = ?high_TimeT(Inaccuracy), tdf = Tdf}, - UTO1='CosTime_TimeService':new_universal_time(TS, Time, Inaccuracy, Tdf), - UTO2='CosTime_TimeService':uto_from_utc(TS, Utc), - ?match(Time, 'CosTime_UTO':'_get_time'(UTO1)), - ?match(Inaccuracy, 'CosTime_UTO':'_get_inaccuracy'(UTO1)), - ?match(Tdf, 'CosTime_UTO':'_get_tdf'(UTO1)), - ?match(Utc, 'CosTime_UTO':'_get_utc_time'(UTO1)), - - ?match(Time, 'CosTime_UTO':'_get_time'(UTO2)), - ?match(Inaccuracy, 'CosTime_UTO':'_get_inaccuracy'(UTO2)), - ?match(Tdf, 'CosTime_UTO':'_get_tdf'(UTO2)), - ?match(Utc, 'CosTime_UTO':'_get_utc_time'(UTO2)), - - TIO1='CosTime_TimeService':new_interval(TS, 2, 5), - _TIO2='CosTime_TimeService':new_interval(TS, 3, 6), - TIO3='CosTime_TimeService':new_interval(TS, 1, 3), - TIO4='CosTime_TimeService':new_interval(TS, 3, 4), - TIO5='CosTime_TimeService':new_interval(TS, 7, 8), - TIO6='CosTime_TimeService':new_interval(TS, 2, 6), - TIO7='CosTime_TimeService':new_interval(TS, 3, 7), - - {_,TIO8} = ?match({'OTContained', _}, 'CosTime_TIO':overlaps(TIO1, TIO6)), - {_,TIO9} = ?match({'OTContainer', _}, 'CosTime_TIO':overlaps(TIO1, TIO1)), - {_,TIO10} = ?match({'OTContainer', _}, 'CosTime_TIO':overlaps(TIO1, TIO4)), - {_,TIO11} = ?match({'OTOverlap', _}, 'CosTime_TIO':overlaps(TIO1, TIO3)), - {_,TIO12} = ?match({'OTOverlap', _}, 'CosTime_TIO':overlaps(TIO1, TIO7)), - {_,TIO13} = ?match({'OTNoOverlap', _}, 'CosTime_TIO':overlaps(TIO1, TIO5)), - - ?match({'TimeBase_IntervalT',2,5},'CosTime_TIO':'_get_time_interval'(TIO8)), - ?match({'TimeBase_IntervalT',2,5},'CosTime_TIO':'_get_time_interval'(TIO9)), - ?match({'TimeBase_IntervalT',3,4},'CosTime_TIO':'_get_time_interval'(TIO10)), - ?match({'TimeBase_IntervalT',2,3},'CosTime_TIO':'_get_time_interval'(TIO11)), - ?match({'TimeBase_IntervalT',3,5},'CosTime_TIO':'_get_time_interval'(TIO12)), - ?match({'TimeBase_IntervalT',5,7},'CosTime_TIO':'_get_time_interval'(TIO13)), - - UTO3='CosTime_TimeService':new_universal_time(TS, 4, 2, 0), %% 2-6 - UTO4='CosTime_TimeService':new_universal_time(TS, 2, 1, 0), %% 1-3 - UTO5='CosTime_TimeService':new_universal_time(TS, 3, 0, 0), %% 3-3 - UTO6='CosTime_TimeService':new_universal_time(TS, 9, 1, 0), %% 8-10 - UTO7='CosTime_TimeService':new_universal_time(TS, 4, 3, 0), %% 1-7 - UTO8='CosTime_TimeService':new_universal_time(TS, 5, 2, 0), %% 3-7 - - {_,TIO14} = ?match({'OTContained', _}, 'CosTime_TIO':spans(TIO1, UTO7)), - {_,TIO15} = ?match({'OTContainer', _}, 'CosTime_TIO':spans(TIO1, UTO5)), - {_,TIO16} = ?match({'OTOverlap', _}, 'CosTime_TIO':spans(TIO1, UTO4)), - {_,TIO17} = ?match({'OTOverlap', _}, 'CosTime_TIO':spans(TIO1, UTO8)), - {_,TIO18} = ?match({'OTNoOverlap', _}, 'CosTime_TIO':spans(TIO1, UTO6)), - {_,TIO19} = ?match({'OTContained', _}, 'CosTime_TIO':spans(TIO1, UTO3)), - - ?match({'TimeBase_IntervalT',2,5},'CosTime_TIO':'_get_time_interval'(TIO14)), - ?match({'TimeBase_IntervalT',3,3},'CosTime_TIO':'_get_time_interval'(TIO15)), - ?match({'TimeBase_IntervalT',2,3},'CosTime_TIO':'_get_time_interval'(TIO16)), - ?match({'TimeBase_IntervalT',3,5},'CosTime_TIO':'_get_time_interval'(TIO17)), - ?match({'TimeBase_IntervalT',5,8},'CosTime_TIO':'_get_time_interval'(TIO18)), - ?match({'TimeBase_IntervalT',2,5},'CosTime_TIO':'_get_time_interval'(TIO19)), - - - cosTime:stop_time_service(TS), - application:stop(cosTime), - ok. - - -%%----------------------------------------------------------------- -%% CosTimerEvent API tests -%%----------------------------------------------------------------- -timerevent_api(_Config) -> - %% Init cosTime apps. - ?match(ok, application:start(cosTime)), - TS=cosTime:start_time_service(0, 500), - TES=cosTime:start_timerevent_service(TS), - - %%----- Initialize the cosNotification application. ----- - cosNotificationApp:start(), - Fac = (catch cosNotificationApp:start_factory([])), - {Ch, _Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, [], [])), - %% Create the Admin objects - {AdminSupplier, _ASID}= ?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_suppliers(Ch,'OR_OP')), - {AdminConsumer, _ACID}= ?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_consumers(Ch,'OR_OP')), - - %% Create a push consumer TimerEventService will push events to. - {ProxyPushConsumer,_ID10}= ?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_push_consumer(AdminSupplier, 'ANY_EVENT')), - - %% Create a pull suppliers so we can check we actually got the event. - {ProxyPullSupplier,_ID1} = ?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_pull_supplier(AdminConsumer, 'ANY_EVENT')), - - AnyEvent = any:create(orber_tc:long(), 100), - UTO=?match({_,pseudo,_,_,_,_}, 'CosTime_TimeService':new_universal_time(TS, 10*10000000,1,1)), - EH=?match({_,key,_,_,_,_}, 'CosTimerEvent_TimerEventService':register(TES, ProxyPushConsumer, AnyEvent)), - - ?match('ESTimeCleared','CosTimerEvent_TimerEventHandler':'_get_status'(EH)), - ?match({false,_},'CosTimerEvent_TimerEventHandler':time_set(EH)), - ?match(ok,'CosTimerEvent_TimerEventHandler':set_timer(EH, 'TTRelative', UTO)), - ?match({true,_},'CosTimerEvent_TimerEventHandler':time_set(EH)), - ?match('ESTimeSet','CosTimerEvent_TimerEventHandler':'_get_status'(EH)), - - ?match({{any,tk_null,null}, false}, - 'CosNotifyChannelAdmin_ProxyPullSupplier':try_pull(ProxyPullSupplier)), - - ?match(AnyEvent, 'CosNotifyChannelAdmin_ProxyPullSupplier':pull(ProxyPullSupplier)), - ?match('ESTriggered','CosTimerEvent_TimerEventHandler':'_get_status'(EH)), - - %% It's allowed to send an UTO with time eq. to 0 if the server is TTRelative. - %% When TTAbsolute BAD_PARAM is raised. - UTO2=?match({_,pseudo,_,_,_,_}, 'CosTime_TimeService':new_universal_time(TS, 0,1,1)), - ?match({'EXCEPTION',_},'CosTimerEvent_TimerEventHandler':set_timer(EH, 'TTAbsolute', UTO2)), - ?match(ok,'CosTimerEvent_TimerEventHandler':set_timer(EH, 'TTRelative', UTO2)), - ?match(AnyEvent, 'CosNotifyChannelAdmin_ProxyPullSupplier':pull(ProxyPullSupplier)), - - %% TTPeriodic is defined to be relative, i.e., we can use the tactic as above. - ?match(ok,'CosTimerEvent_TimerEventHandler':set_timer(EH, 'TTPeriodic', UTO2)), - - %% Sleep for UTO*2+4 secs. At this point the Timer should have delivered 2 events. - timer:sleep(24000), - %% Cancel the timer so no more events will be delivered. - ?match(true,'CosTimerEvent_TimerEventHandler':cancel_timer(EH)), - - ?match({AnyEvent, true}, 'CosNotifyChannelAdmin_ProxyPullSupplier':try_pull(ProxyPullSupplier)), - ?match({AnyEvent, true}, 'CosNotifyChannelAdmin_ProxyPullSupplier':try_pull(ProxyPullSupplier)), - ?match({{any,tk_null,null}, false}, - 'CosNotifyChannelAdmin_ProxyPullSupplier':try_pull(ProxyPullSupplier)), - - - - %% Clean up. - cosNotificationApp:stop(), - cosTime:stop_timerevent_service(TES), - cosTime:stop_time_service(TS), - application:stop(cosTime), - ok. - - |