From 5ddf44bb91540fd88e604f077d71482c40185cd8 Mon Sep 17 00:00:00 2001 From: Niclas Eklund Date: Mon, 20 Sep 2010 13:25:26 +0200 Subject: Add test suites for (most) CORBA applications --- lib/cosEvent/test/Makefile | 154 +++++++++ lib/cosEvent/test/cosEvent.spec | 19 ++ lib/cosEvent/test/event_channel_SUITE.erl | 316 ++++++++++++++++++ lib/cosEvent/test/event_test_PullC_impl.erl | 43 +++ lib/cosEvent/test/event_test_PullS_impl.erl | 57 ++++ lib/cosEvent/test/event_test_PushC_impl.erl | 46 +++ lib/cosEvent/test/event_test_PushS_impl.erl | 41 +++ lib/cosEvent/test/event_test_server.idl | 47 +++ lib/cosEvent/test/generated_SUITE.erl | 487 ++++++++++++++++++++++++++++ lib/cosEvent/test/idl_output/.gitignore | 0 10 files changed, 1210 insertions(+) create mode 100644 lib/cosEvent/test/Makefile create mode 100644 lib/cosEvent/test/cosEvent.spec create mode 100644 lib/cosEvent/test/event_channel_SUITE.erl create mode 100644 lib/cosEvent/test/event_test_PullC_impl.erl create mode 100644 lib/cosEvent/test/event_test_PullS_impl.erl create mode 100644 lib/cosEvent/test/event_test_PushC_impl.erl create mode 100644 lib/cosEvent/test/event_test_PushS_impl.erl create mode 100644 lib/cosEvent/test/event_test_server.idl create mode 100644 lib/cosEvent/test/generated_SUITE.erl create mode 100644 lib/cosEvent/test/idl_output/.gitignore (limited to 'lib/cosEvent') diff --git a/lib/cosEvent/test/Makefile b/lib/cosEvent/test/Makefile new file mode 100644 index 0000000000..3d95075ee1 --- /dev/null +++ b/lib/cosEvent/test/Makefile @@ -0,0 +1,154 @@ +# +# %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% +# +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include ../vsn.mk +VSN=$(COSEVENT_VSN) +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/cosEvent_test + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- +TEST_SPEC_FILE = cosEvent.spec + + +IDL_FILES = \ + event_test_server.idl \ + +IDLOUTDIR = idl_output + +MODULES = \ + event_test_PushC_impl \ + event_test_PullC_impl \ + event_test_PushS_impl \ + event_test_PullS_impl \ + event_channel_SUITE \ + generated_SUITE + +GEN_MOD_COS = \ + event_test_PullC \ + event_test_PushS \ + event_test_PullS \ + oe_event_test_server \ + event_test_PushC + +GEN_HRL_COS = \ + event_test.hrl \ + event_test_PushC.hrl \ + event_test_PullC.hrl \ + event_test_PushS.hrl \ + event_test_PullS.hrl \ + oe_event_test_server.hrl + + +GEN_MODULES = $(GEN_MOD_COS) + +ERL_FILES = $(MODULES:%=%.erl) + +HRL_FILES = + +GEN_HRL_FILES = $(GEN_HRL_COS) + +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 +# ---------------------------------------------------- +# ---------------------------------------------------- +# 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/cosEvent/ebin \ + -pa $(ERL_TOP)/lib/cosEvent/test/idl_output \ + -I$(ERL_TOP)/lib/cosEvent \ + -I$(ERL_TOP)/lib/cosEvent/test/$(IDLOUTDIR) \ + -I$(ERL_TOP)/lib/test_server/include + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- +tests debug opt: $(TARGET_FILES) + +clean: + rm -f idl_output/* + rm -rf java_initial_reference_idl java_cos_naming_idl + rm -rf java_iiop_module_idl java_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_COS = \ + $(GEN_HRL_COS:%=$(IDLOUTDIR)/%) \ + $(GEN_MOD_COS:%=$(IDLOUTDIR)/%.erl) + + +$(TGT_COS): event_test_server.idl + erlc $(ERL_IDL_FLAGS) -o$(IDLOUTDIR) event_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) + $(INSTALL_DIR) $(RELSYSDIR)/$(IDLOUTDIR) + $(INSTALL_DATA) $(GEN_TARGET_FILES) $(GEN_FILES) \ + $(RELSYSDIR)/$(IDLOUTDIR) + diff --git a/lib/cosEvent/test/cosEvent.spec b/lib/cosEvent/test/cosEvent.spec new file mode 100644 index 0000000000..910f7a7c28 --- /dev/null +++ b/lib/cosEvent/test/cosEvent.spec @@ -0,0 +1,19 @@ +%% +%% %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% +%% +{topcase, {dir, "../cosEvent_test"}}. diff --git a/lib/cosEvent/test/event_channel_SUITE.erl b/lib/cosEvent/test/event_channel_SUITE.erl new file mode 100644 index 0000000000..2b0cf1fe30 --- /dev/null +++ b/lib/cosEvent/test/event_channel_SUITE.erl @@ -0,0 +1,316 @@ +%%----------------------------------------------------------------- +%% +%% %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(event_channel_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"). + +%%----------------------------------------------------------------- +%% Macros +%%----------------------------------------------------------------- + +-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 ######~n~p~n", + [AcTuAlReS]), + ?line exit(AcTuAlReS) + end + end()). + + +%%----------------------------------------------------------------- +%% External exports +%%----------------------------------------------------------------- +-export([all/1, event_objects_api/1, events_api/1, events_sync_api/1, + cases/0, init_all/1, finish_all/1, + init_per_testcase/2, fin_per_testcase/2, app_test/1]). + +%%----------------------------------------------------------------- +%% Internal exports +%%----------------------------------------------------------------- + +all(doc) -> ["API tests for the cosEvent interfaces", ""]; +all(suite) -> {req, + [mnesia, orber], + {conf, init_all, cases(), finish_all}}. + +cases() -> + [events_api, events_sync_api, event_objects_api, app_test]. + +%%----------------------------------------------------------------- +%% 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. + +init_all(Config) when is_list(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), + cosEventApp:install(), + cosEventApp:start(), + oe_event_test_server:oe_register(), + Config. + +finish_all(Config) when is_list(Config) -> + oe_event_test_server:oe_unregister(), + cosEventApp:stop(), + cosEventApp:uninstall(), + application:stop(orber), + application:stop(mnesia), + mnesia:delete_schema([node()]), + Path = code:which(?MODULE), + code:del_path(filename:join(filename:dirname(Path), "idl_output")), + Config. + +%%----------------------------------------------------------------- +%% Tests app file +%%----------------------------------------------------------------- +app_test(doc) -> []; +app_test(suite) -> []; +app_test(_Config) -> + ok=test_server:app_test(cosEvent), + ok. + + + +event_objects_api(doc) -> ["Testing the CosEvent API to setup a complete service", ""]; +event_objects_api(suite) -> []; +event_objects_api(_Config) -> + + Ch = ?match({_,key,_,_,_,_}, cosEventApp:start_channel([{typecheck, true}, + {pull_interval, 300}])), + + AC=?match({_,key,_,_,_,_}, + 'CosEventChannelAdmin_EventChannel':for_consumers(Ch)), + AS=?match({_,key,_,_,_,_}, + 'CosEventChannelAdmin_EventChannel':for_suppliers(Ch)), + + PPushS=?match({_,key,_,_,_,_}, + 'CosEventChannelAdmin_ConsumerAdmin':obtain_push_supplier(AC)), + PPullS=?match({_,key,_,_,_,_}, + 'CosEventChannelAdmin_ConsumerAdmin':obtain_pull_supplier(AC)), + + PPushC=?match({_,key,_,_,_,_}, + 'CosEventChannelAdmin_SupplierAdmin':obtain_push_consumer(AS)), + PPullC=?match({_,key,_,_,_,_}, + 'CosEventChannelAdmin_SupplierAdmin':obtain_pull_consumer(AS)), + + PushC=?match({_,key,_,_,_,_}, + 'event_test_PushC':oe_create([])), + PullC=?match({_,key,_,_,_,_}, + 'event_test_PullC':oe_create(PPullC)), + + PushS=?match({_,key,_,_,_,_}, + 'event_test_PushS':oe_create(PPushC)), + + PullS=?match({_,key,_,_,_,_}, + 'event_test_PullS':oe_create([])), + + NIL = corba:create_nil_objref(), + + ?match({'EXCEPTION',{'BAD_PARAM',_,_,_}}, + 'CosEventChannelAdmin_ProxyPushSupplier':connect_push_consumer(PPushS, NIL)), + ?match({'EXCEPTION',{'BAD_PARAM',_,_,_}}, + 'CosEventChannelAdmin_ProxyPushSupplier':connect_push_consumer(PPushS, PullS)), + ?match(ok, 'CosEventChannelAdmin_ProxyPushSupplier':connect_push_consumer(PPushS, PushC)), + ?match({'EXCEPTION',{'CosEventChannelAdmin_AlreadyConnected',_}}, + 'CosEventChannelAdmin_ProxyPushSupplier':connect_push_consumer(PPushS, PushC)), + + ?match(ok, 'CosEventChannelAdmin_ProxyPullSupplier':connect_pull_consumer(PPullS, NIL)), + ?match({'EXCEPTION',{'BAD_PARAM',_,_,_}}, + 'CosEventChannelAdmin_ProxyPullSupplier':connect_pull_consumer(PPullS, PullS)), + ?match(ok, 'CosEventChannelAdmin_ProxyPullSupplier':connect_pull_consumer(PPullS, PullC)), + ?match({'EXCEPTION',{'CosEventChannelAdmin_AlreadyConnected',_}}, + 'CosEventChannelAdmin_ProxyPullSupplier':connect_pull_consumer(PPullS, PullC)), + + ?match(ok, 'CosEventChannelAdmin_ProxyPushConsumer':connect_push_supplier(PPushC, NIL)), + ?match({'EXCEPTION',{'BAD_PARAM',_,_,_}}, + 'CosEventChannelAdmin_ProxyPushConsumer':connect_push_supplier(PPushC, PullS)), + ?match(ok, 'CosEventChannelAdmin_ProxyPushConsumer':connect_push_supplier(PPushC, PushS)), + ?match({'EXCEPTION',{'CosEventChannelAdmin_AlreadyConnected',_}}, + 'CosEventChannelAdmin_ProxyPushConsumer':connect_push_supplier(PPushC, PushS)), + + ?match({'EXCEPTION',{'BAD_PARAM',_,_,_}}, + 'CosEventChannelAdmin_ProxyPullConsumer':connect_pull_supplier(PPullC, NIL)), + ?match({'EXCEPTION',{'BAD_PARAM',_,_,_}}, + 'CosEventChannelAdmin_ProxyPullConsumer':connect_pull_supplier(PPullC, PushS)), + ?match(ok, 'CosEventChannelAdmin_ProxyPullConsumer':connect_pull_supplier(PPullC, PullS)), + ?match({'EXCEPTION',{'CosEventChannelAdmin_AlreadyConnected',_}}, + 'CosEventChannelAdmin_ProxyPullConsumer':connect_pull_supplier(PPullC, PullS)), + + + catch corba:dispose(AC), + %% Wait a couple of seconds to be sure all data removed from DB. + timer:sleep(2000), + + %% Since we terminated ConsumerAdmin only the Supplier Proxies should be terminated. + ?match(true, corba_object:non_existent(AC)), + ?match(true, corba_object:non_existent(PPushS)), + ?match(true, corba_object:non_existent(PPullS)), + + ?match(false, corba_object:non_existent(Ch)), + ?match(false, corba_object:non_existent(AS)), + ?match(false, corba_object:non_existent(PPullC)), + ?match(false, corba_object:non_existent(PPushC)), + + %% Terminate a proxy and check that its admin is unaffected. + catch corba:dispose(PPullC), + timer:sleep(2000), + ?match(false, corba_object:non_existent(AS)), + ?match(true, corba_object:non_existent(PPullC)), + + catch corba:dispose(Ch), + timer:sleep(2000), + + ?match(true, corba_object:non_existent(Ch)), + ?match(true, corba_object:non_existent(AS)), + ?match(true, corba_object:non_existent(PPullC)), + ?match(true, corba_object:non_existent(PPushC)), + + %% The client should be notified; wait for a couple of seconds and check it. + timer:sleep(2000), + ?match(true, corba_object:non_existent(PushC)), + ?match(true, corba_object:non_existent(PullC)), + ?match(true, corba_object:non_existent(PushS)), + ?match(true, corba_object:non_existent(PullS)), + + ok. + +events_api(doc) -> ["Testing the CosEvent API for sending events asynchronous", ""]; +events_api(suite) -> []; +events_api(_Config) -> + + Ch = ?match({_,key,_,_,_,_}, cosEventApp:start_channel([{typecheck, true}, + {pull_interval, 2}, + {blocking, false}])), + event_sender(Ch). + + +events_sync_api(doc) -> ["Testing the CosEvent API for sending events synchronous", ""]; +events_sync_api(suite) -> []; +events_sync_api(_Config) -> + + Ch = ?match({_,key,_,_,_,_}, cosEventApp:start_channel([{typecheck, true}, + {pull_interval, 2}, + {blocking, true}])), + event_sender(Ch). + +event_sender(Ch) -> + Event1 = #any{typecode=tk_long, value = 1}, + Event2 = #any{typecode=tk_long, value = 2}, + Event3 = #any{typecode=tk_long, value = 3}, + Event4 = #any{typecode=tk_long, value = 4}, + Event5 = #any{typecode=tk_long, value = 5}, + Event6 = #any{typecode=tk_long, value = 6}, + + AC=?match({_,key,_,_,_,_}, + 'CosEventChannelAdmin_EventChannel':for_consumers(Ch)), + AS=?match({_,key,_,_,_,_}, + 'CosEventChannelAdmin_EventChannel':for_suppliers(Ch)), + + PPushS=?match({_,key,_,_,_,_}, + 'CosEventChannelAdmin_ConsumerAdmin':obtain_push_supplier(AC)), + PPullS=?match({_,key,_,_,_,_}, + 'CosEventChannelAdmin_ConsumerAdmin':obtain_pull_supplier(AC)), + + PPushC=?match({_,key,_,_,_,_}, + 'CosEventChannelAdmin_SupplierAdmin':obtain_push_consumer(AS)), + PPullC=?match({_,key,_,_,_,_}, + 'CosEventChannelAdmin_SupplierAdmin':obtain_pull_consumer(AS)), + + PushC=?match({_,key,_,_,_,_}, 'event_test_PushC':oe_create([])), + PullC=?match({_,key,_,_,_,_}, 'event_test_PullC':oe_create(PPullS)), + + PushS=?match({_,key,_,_,_,_}, 'event_test_PushS':oe_create(PPushC)), + + PullS=?match({_,key,_,_,_,_}, 'event_test_PullS':oe_create([])), + + ?match(ok, 'CosEventChannelAdmin_ProxyPushSupplier':connect_push_consumer(PPushS, PushC)), + ?match(ok, 'CosEventChannelAdmin_ProxyPullSupplier':connect_pull_consumer(PPullS, PullC)), + ?match(ok, 'CosEventChannelAdmin_ProxyPushConsumer':connect_push_supplier(PPushC, PushS)), + ?match(ok, 'CosEventChannelAdmin_ProxyPullConsumer':connect_pull_supplier(PPullC, PullS)), + + %% No events should be available at the consumer side at this point. + ?match({_, false}, event_test_PullC:do_try_pull(PullC)), + ?match([], event_test_PushC:get_data(PushC)), + + %% Push an event and wait to be sure it have reached the destination. + ?match(ok, event_test_PushS:do_push(PushS, Event1)), + ?match(ok, event_test_PushS:do_push(PushS, Event2)), + ?match(ok, event_test_PushS:do_push(PushS, Event3)), + timer:sleep(2000), + ?match({Event1, true}, event_test_PullC:do_try_pull(PullC)), + ?match({Event2, true}, event_test_PullC:do_try_pull(PullC)), + ?match({Event3, true}, event_test_PullC:do_try_pull(PullC)), + ?match({_, false}, event_test_PullC:do_try_pull(PullC)), + ?match([Event1, Event2, Event3], event_test_PushC:get_data(PushC)), + + ?match(ok, event_test_PullS:add_event(PullS, Event4)), + ?match(ok, event_test_PullS:add_event(PullS, Event5)), + ?match(ok, event_test_PullS:add_event(PullS, Event6)), + + %% Since the pull operation is blocking we do not need to "sleep". + %% The ProxyPullConsumer will pull for events according to the pull_interval + %% parameter given when started the channel. + ?match(Event4, event_test_PullC:do_pull(PullC)), + ?match(Event5, event_test_PullC:do_pull(PullC)), + ?match(Event6, event_test_PullC:do_pull(PullC)), + + timer:sleep(2000), + ?match([Event4, Event5, Event6], event_test_PushC:get_data(PushC)), + + + catch corba:dispose(Ch), + %% The client should be notified; wait for a couple of seconds and check it. + timer:sleep(2000), + ?match(true, corba_object:non_existent(PushC)), + ?match(true, corba_object:non_existent(PullC)), + ?match(true, corba_object:non_existent(PushS)), + ?match(true, corba_object:non_existent(PullS)), + + ok. diff --git a/lib/cosEvent/test/event_test_PullC_impl.erl b/lib/cosEvent/test/event_test_PullC_impl.erl new file mode 100644 index 0000000000..186d1cbd51 --- /dev/null +++ b/lib/cosEvent/test/event_test_PullC_impl.erl @@ -0,0 +1,43 @@ +%%------------------------------------------------------------------------ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2001-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: a very simple implementation of PullConsumer interface +%%------------------------------------------------------------------------ +-module(event_test_PullC_impl). + +-export([init/1, terminate/2, disconnect_pull_consumer/1, do_pull/1, do_try_pull/1]). + +init(Proxy) -> + {ok, Proxy}. + +terminate(_From, _Reason) -> + ok. + +disconnect_pull_consumer(Proxy) -> + io:format("event_test_PullC terminates~n",[]), + {stop, normal, ok, Proxy}. + +do_pull(Proxy) -> + {reply, 'CosEventComm_PullSupplier':pull(Proxy), Proxy}. + +do_try_pull(Proxy) -> + {reply, 'CosEventComm_PullSupplier':try_pull(Proxy), Proxy}. + diff --git a/lib/cosEvent/test/event_test_PullS_impl.erl b/lib/cosEvent/test/event_test_PullS_impl.erl new file mode 100644 index 0000000000..b7fa0c34f0 --- /dev/null +++ b/lib/cosEvent/test/event_test_PullS_impl.erl @@ -0,0 +1,57 @@ +%%------------------------------------------------------------------------ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2001-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: a very simple implementation of Pull Supplier interface +%%------------------------------------------------------------------------ +-module(event_test_PullS_impl). + +-include_lib("orber/include/corba.hrl"). + +-export([init/1, terminate/2, pull/1, try_pull/1, disconnect_pull_supplier/1, + add_event/2]). + +init(_) -> + {ok, []}. + +terminate(_From, _Reason) -> + ok. + +pull([]) -> + corba:raise(#'INTERNAL'{completion_status = ?COMPLETED_NO}); +pull([Event|Events]) -> + {reply, Event, Events}. + +try_pull([]) -> + {reply, {#any{typecode=tk_null, value = null}, false}, []}; +try_pull([Event|Events]) -> + {reply, {Event, true}, Events}. + +disconnect_pull_supplier(Events) -> + io:format("event_test_PullS terminates ~p~n", [Events]), + {stop, normal, ok, Events}. + + +add_event(Events, Event) -> + %% Store in FIFO order; don't really care if we use '++' since + %% this operation is used in tests only. + {reply, ok, Events ++ [Event]}. + + diff --git a/lib/cosEvent/test/event_test_PushC_impl.erl b/lib/cosEvent/test/event_test_PushC_impl.erl new file mode 100644 index 0000000000..6eadf74a31 --- /dev/null +++ b/lib/cosEvent/test/event_test_PushC_impl.erl @@ -0,0 +1,46 @@ +%%------------------------------------------------------------------------ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2001-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: a very simple implementation of Push Consumer interface +%%------------------------------------------------------------------------ + +-module(event_test_PushC_impl). + +-export([init/1, terminate/2, push/2, disconnect_push_consumer/1, get_data/1]). + +init(_) -> + {ok, []}. + +terminate(_From, _Reason) -> + ok. + +push(Events, Event) -> + {reply, ok, [Event|Events]}. + +disconnect_push_consumer(Events) -> + io:format("event_test_PushC terminates: ~p~n", [Events]), + {stop, normal, ok, Events}. + + +get_data(Events) -> + %% Returns Events in FIFO order and reset state. + {reply, lists:reverse(Events), []}. + diff --git a/lib/cosEvent/test/event_test_PushS_impl.erl b/lib/cosEvent/test/event_test_PushS_impl.erl new file mode 100644 index 0000000000..da82e97211 --- /dev/null +++ b/lib/cosEvent/test/event_test_PushS_impl.erl @@ -0,0 +1,41 @@ +%%------------------------------------------------------------------------ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2001-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: a very simple implementation of Push Supplier interface +%%------------------------------------------------------------------------ + +-module(event_test_PushS_impl). + +-export([init/1, terminate/2, disconnect_push_supplier/1, do_push/2]). + +init(Proxy) -> + {ok, Proxy}. + +terminate(_From, _Reason) -> + ok. + +disconnect_push_supplier(Proxy) -> + io:format("event_test_PullC terminates~n",[]), + {stop, normal, ok, Proxy}. + +do_push(Proxy, Event) -> + {reply, 'CosEventComm_PushConsumer':push(Proxy, Event), Proxy}. + diff --git a/lib/cosEvent/test/event_test_server.idl b/lib/cosEvent/test/event_test_server.idl new file mode 100644 index 0000000000..1719401ccd --- /dev/null +++ b/lib/cosEvent/test/event_test_server.idl @@ -0,0 +1,47 @@ +// +// %CopyrightBegin% +// +// Copyright Ericsson AB 2001-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 _EVENT_TEST_SERVER_IDL +#define _EVENT_TEST_SERVER_IDL + +#include <../src/CosEventComm.idl> + +module event_test { + + interface PushC : CosEventComm::PushConsumer { + typedef sequence AnySeq; + AnySeq get_data(); + }; + interface PullC : CosEventComm::PullConsumer { + any do_pull(); + any do_try_pull(out boolean has_event); + }; + + interface PushS : CosEventComm::PushSupplier { + void do_push(in any Event); + }; + interface PullS : CosEventComm::PullSupplier { + void add_event(in any Event); + }; + +}; + +#endif + + diff --git a/lib/cosEvent/test/generated_SUITE.erl b/lib/cosEvent/test/generated_SUITE.erl new file mode 100644 index 0000000000..2d75b18451 --- /dev/null +++ b/lib/cosEvent/test/generated_SUITE.erl @@ -0,0 +1,487 @@ +%%----------------------------------------------------------------- +%% +%% %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) -> + ['CosEventChannelAdmin_AlreadyConnected', 'CosEventChannelAdmin_TypeError', + 'CosEventComm_Disconnected', + 'CosEventChannelAdmin_ConsumerAdmin', 'CosEventChannelAdmin_EventChannel', + 'CosEventChannelAdmin_ProxyPullConsumer', 'CosEventChannelAdmin_ProxyPullSupplier', + 'CosEventChannelAdmin_ProxyPushConsumer', 'CosEventChannelAdmin_ProxyPushSupplier', + 'CosEventChannelAdmin_SupplierAdmin', oe_CosEventComm_CAdmin, + oe_CosEventComm_Channel, oe_CosEventComm_Event, oe_CosEventComm_PullerS, + oe_CosEventComm_PusherS, 'CosEventComm_PullConsumer', + 'CosEventComm_PullSupplier', 'CosEventComm_PushConsumer', + 'CosEventComm_PushSupplier']. + +%%----------------------------------------------------------------- +%% 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: 'CosEventChannelAdmin_AlreadyConnected' +%% Description: +%%----------------------------------------------------------------- +'CosEventChannelAdmin_AlreadyConnected'(doc) -> [""]; +'CosEventChannelAdmin_AlreadyConnected'(suite) -> []; +'CosEventChannelAdmin_AlreadyConnected'(_) -> + ?match(true, orber_tc:check_tc('CosEventChannelAdmin_AlreadyConnected':tc())), + ?match("IDL:omg.org/CosEventChannelAdmin/AlreadyConnected:1.0", + 'CosEventChannelAdmin_AlreadyConnected':id()), + ?match("CosEventChannelAdmin_AlreadyConnected", + 'CosEventChannelAdmin_AlreadyConnected':name()), + ok. + + +%%----------------------------------------------------------------- +%% Test Case: 'CosEventChannelAdmin_TypeError' +%% Description: +%%----------------------------------------------------------------- +'CosEventChannelAdmin_TypeError'(doc) -> [""]; +'CosEventChannelAdmin_TypeError'(suite) -> []; +'CosEventChannelAdmin_TypeError'(_) -> + ?match(true, orber_tc:check_tc('CosEventChannelAdmin_TypeError':tc())), + ?match("IDL:omg.org/CosEventChannelAdmin/TypeError:1.0", + 'CosEventChannelAdmin_TypeError':id()), + ?match("CosEventChannelAdmin_TypeError", + 'CosEventChannelAdmin_TypeError':name()), + ok. + + +%%----------------------------------------------------------------- +%% Test Case: 'CosEventComm_Disconnected' +%% Description: +%%----------------------------------------------------------------- +'CosEventComm_Disconnected'(doc) -> [""]; +'CosEventComm_Disconnected'(suite) -> []; +'CosEventComm_Disconnected'(_) -> + ?match(true, orber_tc:check_tc('CosEventComm_Disconnected':tc())), + ?match("IDL:omg.org/CosEventComm/Disconnected:1.0", + 'CosEventComm_Disconnected':id()), + ?match("CosEventComm_Disconnected", 'CosEventComm_Disconnected':name()), + ok. + + +%%----------------------------------------------------------------- +%% Test Case: 'CosEventChannelAdmin_ConsumerAdmin' +%% Description: +%%----------------------------------------------------------------- +'CosEventChannelAdmin_ConsumerAdmin'(doc) -> [""]; +'CosEventChannelAdmin_ConsumerAdmin'(suite) -> []; +'CosEventChannelAdmin_ConsumerAdmin'(_) -> + ?nomatch(undefined, 'CosEventChannelAdmin_ConsumerAdmin':oe_tc(obtain_push_supplier)), + ?nomatch(undefined, 'CosEventChannelAdmin_ConsumerAdmin':oe_tc(obtain_pull_supplier)), + ?match(undefined, 'CosEventChannelAdmin_ConsumerAdmin':oe_tc(undefined)), + ?match([_|_], 'CosEventChannelAdmin_ConsumerAdmin':oe_get_interface()), + ?match("IDL:omg.org/CosEventChannelAdmin/ConsumerAdmin:1.0", + 'CosEventChannelAdmin_ConsumerAdmin':typeID()), + check_tc('CosEventChannelAdmin_ConsumerAdmin':oe_get_interface()), + ?match(true, 'CosEventChannelAdmin_ConsumerAdmin':oe_is_a('CosEventChannelAdmin_ConsumerAdmin':typeID())), + ?match(false, 'CosEventChannelAdmin_ConsumerAdmin':oe_is_a("wrong")), + ok. + +%%----------------------------------------------------------------- +%% Test Case: 'CosEventChannelAdmin_EventChannel' +%% Description: +%%----------------------------------------------------------------- +'CosEventChannelAdmin_EventChannel'(doc) -> [""]; +'CosEventChannelAdmin_EventChannel'(suite) -> []; +'CosEventChannelAdmin_EventChannel'(_) -> + ?nomatch(undefined, 'CosEventChannelAdmin_EventChannel':oe_tc(for_consumers)), + ?nomatch(undefined, 'CosEventChannelAdmin_EventChannel':oe_tc(for_suppliers)), + ?nomatch(undefined, 'CosEventChannelAdmin_EventChannel':oe_tc(destroy)), + ?match(undefined, 'CosEventChannelAdmin_EventChannel':oe_tc(undefined)), + ?match([_|_], 'CosEventChannelAdmin_EventChannel':oe_get_interface()), + ?match("IDL:omg.org/CosEventChannelAdmin/EventChannel:1.0", + 'CosEventChannelAdmin_EventChannel':typeID()), + check_tc('CosEventChannelAdmin_EventChannel':oe_get_interface()), + ?match(true, 'CosEventChannelAdmin_EventChannel':oe_is_a('CosEventChannelAdmin_EventChannel':typeID())), + ?match(false, 'CosEventChannelAdmin_EventChannel':oe_is_a("wrong")), + ok. + +%%----------------------------------------------------------------- +%% Test Case: 'CosEventChannelAdmin_ProxyPullConsumer' +%% Description: +%%----------------------------------------------------------------- +'CosEventChannelAdmin_ProxyPullConsumer'(doc) -> [""]; +'CosEventChannelAdmin_ProxyPullConsumer'(suite) -> []; +'CosEventChannelAdmin_ProxyPullConsumer'(_) -> + ?nomatch(undefined, 'CosEventChannelAdmin_ProxyPullConsumer':oe_tc(connect_pull_supplier)), + ?nomatch(undefined, 'CosEventChannelAdmin_ProxyPullConsumer':oe_tc(disconnect_pull_consumer)), + ?match(undefined, 'CosEventChannelAdmin_ProxyPullConsumer':oe_tc(undefined)), + ?match([_|_], 'CosEventChannelAdmin_ProxyPullConsumer':oe_get_interface()), + ?match("IDL:omg.org/CosEventChannelAdmin/ProxyPullConsumer:1.0", + 'CosEventChannelAdmin_ProxyPullConsumer':typeID()), + check_tc('CosEventChannelAdmin_ProxyPullConsumer':oe_get_interface()), + ?match(true, 'CosEventChannelAdmin_ProxyPullConsumer':oe_is_a('CosEventChannelAdmin_ProxyPullConsumer':typeID())), + ?match(true, 'CosEventChannelAdmin_ProxyPullConsumer':oe_is_a('CosEventComm_PullConsumer':typeID())), + ?match(false, 'CosEventChannelAdmin_ProxyPullConsumer':oe_is_a("wrong")), + ok. + +%%----------------------------------------------------------------- +%% Test Case: 'CosEventChannelAdmin_ProxyPullSupplier' +%% Description: +%%----------------------------------------------------------------- +'CosEventChannelAdmin_ProxyPullSupplier'(doc) -> [""]; +'CosEventChannelAdmin_ProxyPullSupplier'(suite) -> []; +'CosEventChannelAdmin_ProxyPullSupplier'(_) -> + ?nomatch(undefined, 'CosEventChannelAdmin_ProxyPullSupplier':oe_tc(connect_pull_consumer)), + ?nomatch(undefined, 'CosEventChannelAdmin_ProxyPullSupplier':oe_tc(pull)), + ?nomatch(undefined, 'CosEventChannelAdmin_ProxyPullSupplier':oe_tc(try_pull)), + ?nomatch(undefined, 'CosEventChannelAdmin_ProxyPullSupplier':oe_tc(disconnect_pull_supplier)), + ?match(undefined, 'CosEventChannelAdmin_ProxyPullSupplier':oe_tc(undefined)), + ?match([_|_], 'CosEventChannelAdmin_ProxyPullSupplier':oe_get_interface()), + ?match("IDL:omg.org/CosEventChannelAdmin/ProxyPullSupplier:1.0", + 'CosEventChannelAdmin_ProxyPullSupplier':typeID()), + check_tc('CosEventChannelAdmin_ProxyPullSupplier':oe_get_interface()), + ?match(true, 'CosEventChannelAdmin_ProxyPullSupplier':oe_is_a('CosEventChannelAdmin_ProxyPullSupplier':typeID())), + ?match(true, 'CosEventChannelAdmin_ProxyPullSupplier':oe_is_a('CosEventComm_PullSupplier':typeID())), + ?match(false, 'CosEventChannelAdmin_ProxyPullSupplier':oe_is_a("wrong")), + ok. + +%%----------------------------------------------------------------- +%% Test Case: 'CosEventChannelAdmin_ProxyPushConsumer' +%% Description: +%%----------------------------------------------------------------- +'CosEventChannelAdmin_ProxyPushConsumer'(doc) -> [""]; +'CosEventChannelAdmin_ProxyPushConsumer'(suite) -> []; +'CosEventChannelAdmin_ProxyPushConsumer'(_) -> + ?nomatch(undefined, 'CosEventChannelAdmin_ProxyPushConsumer':oe_tc(connect_push_supplier)), + ?nomatch(undefined, 'CosEventChannelAdmin_ProxyPushConsumer':oe_tc(push)), + ?nomatch(undefined, 'CosEventChannelAdmin_ProxyPushConsumer':oe_tc(disconnect_push_consumer)), + ?match(undefined, 'CosEventChannelAdmin_ProxyPushConsumer':oe_tc(undefined)), + ?match([_|_], 'CosEventChannelAdmin_ProxyPushConsumer':oe_get_interface()), + ?match("IDL:omg.org/CosEventChannelAdmin/ProxyPushConsumer:1.0", + 'CosEventChannelAdmin_ProxyPushConsumer':typeID()), + check_tc('CosEventChannelAdmin_ProxyPushConsumer':oe_get_interface()), + ?match(true, 'CosEventChannelAdmin_ProxyPushConsumer':oe_is_a('CosEventChannelAdmin_ProxyPushConsumer':typeID())), + ?match(true, 'CosEventChannelAdmin_ProxyPushConsumer':oe_is_a('CosEventComm_PushConsumer':typeID())), + ?match(false, 'CosEventChannelAdmin_ProxyPushConsumer':oe_is_a("wrong")), + ok. + +%%----------------------------------------------------------------- +%% Test Case: 'CosEventChannelAdmin_ProxyPushSupplier' +%% Description: +%%----------------------------------------------------------------- +'CosEventChannelAdmin_ProxyPushSupplier'(doc) -> [""]; +'CosEventChannelAdmin_ProxyPushSupplier'(suite) -> []; +'CosEventChannelAdmin_ProxyPushSupplier'(_) -> + ?nomatch(undefined, 'CosEventChannelAdmin_ProxyPushSupplier':oe_tc(connect_push_consumer)), + ?nomatch(undefined, 'CosEventChannelAdmin_ProxyPushSupplier':oe_tc(disconnect_push_supplier)), + ?match(undefined, 'CosEventChannelAdmin_ProxyPushSupplier':oe_tc(undefined)), + ?match([_|_], 'CosEventChannelAdmin_ProxyPushSupplier':oe_get_interface()), + ?match("IDL:omg.org/CosEventChannelAdmin/ProxyPushSupplier:1.0", + 'CosEventChannelAdmin_ProxyPushSupplier':typeID()), + check_tc('CosEventChannelAdmin_ProxyPushSupplier':oe_get_interface()), + ?match(true, 'CosEventChannelAdmin_ProxyPushSupplier':oe_is_a('CosEventChannelAdmin_ProxyPushSupplier':typeID())), + ?match(true, 'CosEventChannelAdmin_ProxyPushSupplier':oe_is_a('CosEventComm_PushSupplier':typeID())), + ?match(false, 'CosEventChannelAdmin_ProxyPushSupplier':oe_is_a("wrong")), + ok. + +%%----------------------------------------------------------------- +%% Test Case: 'CosEventChannelAdmin_SupplierAdmin' +%% Description: +%%----------------------------------------------------------------- +'CosEventChannelAdmin_SupplierAdmin'(doc) -> [""]; +'CosEventChannelAdmin_SupplierAdmin'(suite) -> []; +'CosEventChannelAdmin_SupplierAdmin'(_) -> + ?nomatch(undefined, 'CosEventChannelAdmin_SupplierAdmin':oe_tc(obtain_push_consumer)), + ?nomatch(undefined, 'CosEventChannelAdmin_SupplierAdmin':oe_tc(obtain_pull_consumer)), + ?match(undefined, 'CosEventChannelAdmin_SupplierAdmin':oe_tc(undefined)), + ?match([_|_], 'CosEventChannelAdmin_SupplierAdmin':oe_get_interface()), + ?match("IDL:omg.org/CosEventChannelAdmin/SupplierAdmin:1.0", + 'CosEventChannelAdmin_SupplierAdmin':typeID()), + check_tc('CosEventChannelAdmin_SupplierAdmin':oe_get_interface()), + ?match(true, 'CosEventChannelAdmin_SupplierAdmin':oe_is_a('CosEventChannelAdmin_SupplierAdmin':typeID())), + ?match(false, 'CosEventChannelAdmin_SupplierAdmin':oe_is_a("wrong")), + ok. + +%%----------------------------------------------------------------- +%% Test Case: 'oe_CosEventComm_CAdmin' +%% Description: +%%----------------------------------------------------------------- +'oe_CosEventComm_CAdmin'(doc) -> [""]; +'oe_CosEventComm_CAdmin'(suite) -> []; +'oe_CosEventComm_CAdmin'(_) -> + ?nomatch(undefined, 'oe_CosEventComm_CAdmin':oe_tc(obtain_push_supplier)), + ?nomatch(undefined, 'oe_CosEventComm_CAdmin':oe_tc(obtain_pull_supplier)), + ?nomatch(undefined, 'oe_CosEventComm_CAdmin':oe_tc(send)), + ?nomatch(undefined, 'oe_CosEventComm_CAdmin':oe_tc(send_sync)), + ?match(undefined, 'oe_CosEventComm_CAdmin':oe_tc(undefined)), + ?match([_|_], 'oe_CosEventComm_CAdmin':oe_get_interface()), + ?match("IDL:oe_CosEventComm/CAdmin:1.0", + 'oe_CosEventComm_CAdmin':typeID()), + check_tc('oe_CosEventComm_CAdmin':oe_get_interface()), + ?match(true, 'oe_CosEventComm_CAdmin':oe_is_a('oe_CosEventComm_CAdmin':typeID())), + ?match(true, 'oe_CosEventComm_CAdmin':oe_is_a('CosEventChannelAdmin_ConsumerAdmin':typeID())), + ?match(true, 'oe_CosEventComm_CAdmin':oe_is_a('oe_CosEventComm_Event':typeID())), + ?match(false, 'oe_CosEventComm_CAdmin':oe_is_a("wrong")), + ok. + +%%----------------------------------------------------------------- +%% Test Case: 'oe_CosEventComm_Channel' +%% Description: +%%----------------------------------------------------------------- +'oe_CosEventComm_Channel'(doc) -> [""]; +'oe_CosEventComm_Channel'(suite) -> []; +'oe_CosEventComm_Channel'(_) -> + ?nomatch(undefined, 'oe_CosEventComm_Channel':oe_tc(for_consumers)), + ?nomatch(undefined, 'oe_CosEventComm_Channel':oe_tc(for_suppliers)), + ?nomatch(undefined, 'oe_CosEventComm_Channel':oe_tc(destroy)), + ?nomatch(undefined, 'oe_CosEventComm_Channel':oe_tc(send)), + ?nomatch(undefined, 'oe_CosEventComm_Channel':oe_tc(send_sync)), + ?match(undefined, 'oe_CosEventComm_Channel':oe_tc(undefined)), + ?match([_|_], 'oe_CosEventComm_Channel':oe_get_interface()), + ?match("IDL:oe_CosEventComm/Channel:1.0", + 'oe_CosEventComm_Channel':typeID()), + check_tc('oe_CosEventComm_Channel':oe_get_interface()), + ?match(true, 'oe_CosEventComm_Channel':oe_is_a('oe_CosEventComm_Channel':typeID())), + ?match(true, 'oe_CosEventComm_Channel':oe_is_a('CosEventChannelAdmin_EventChannel':typeID())), + ?match(true, 'oe_CosEventComm_Channel':oe_is_a('oe_CosEventComm_Event':typeID())), + ?match(false, 'oe_CosEventComm_Channel':oe_is_a("wrong")), + ok. + +%%----------------------------------------------------------------- +%% Test Case: 'oe_CosEventComm_Event' +%% Description: +%%----------------------------------------------------------------- +'oe_CosEventComm_Event'(doc) -> [""]; +'oe_CosEventComm_Event'(suite) -> []; +'oe_CosEventComm_Event'(_) -> + ?nomatch(undefined, 'oe_CosEventComm_Event':oe_tc(send)), + ?nomatch(undefined, 'oe_CosEventComm_Event':oe_tc(send_sync)), + ?match(undefined, 'oe_CosEventComm_Event':oe_tc(undefined)), + ?match([_|_], 'oe_CosEventComm_Event':oe_get_interface()), + ?match("IDL:oe_CosEventComm/Event:1.0", + 'oe_CosEventComm_Event':typeID()), + check_tc('oe_CosEventComm_Event':oe_get_interface()), + ?match(true, 'oe_CosEventComm_Event':oe_is_a('oe_CosEventComm_Event':typeID())), + ?match(false, 'oe_CosEventComm_Event':oe_is_a("wrong")), + ok. + +%%----------------------------------------------------------------- +%% Test Case: 'oe_CosEventComm_PullerS' +%% Description: +%%----------------------------------------------------------------- +'oe_CosEventComm_PullerS'(doc) -> [""]; +'oe_CosEventComm_PullerS'(suite) -> []; +'oe_CosEventComm_PullerS'(_) -> + ?nomatch(undefined, 'oe_CosEventComm_PullerS':oe_tc(connect_pull_consumer)), + ?nomatch(undefined, 'oe_CosEventComm_PullerS':oe_tc(pull)), + ?nomatch(undefined, 'oe_CosEventComm_PullerS':oe_tc(try_pull)), + ?nomatch(undefined, 'oe_CosEventComm_PullerS':oe_tc(disconnect_pull_supplier)), + ?nomatch(undefined, 'oe_CosEventComm_PullerS':oe_tc(send)), + ?nomatch(undefined, 'oe_CosEventComm_PullerS':oe_tc(send_sync)), + ?match(undefined, 'oe_CosEventComm_PullerS':oe_tc(undefined)), + ?match([_|_], 'oe_CosEventComm_PullerS':oe_get_interface()), + ?match("IDL:oe_CosEventComm/PullerS:1.0", + 'oe_CosEventComm_PullerS':typeID()), + check_tc('oe_CosEventComm_PullerS':oe_get_interface()), + ?match(true, 'oe_CosEventComm_PullerS':oe_is_a('oe_CosEventComm_PullerS':typeID())), + ?match(true, 'oe_CosEventComm_PullerS':oe_is_a('CosEventChannelAdmin_ProxyPullSupplier':typeID())), + ?match(true, 'oe_CosEventComm_PullerS':oe_is_a('CosEventComm_PullSupplier':typeID())), + ?match(true, 'oe_CosEventComm_PullerS':oe_is_a('oe_CosEventComm_Event':typeID())), + ?match(false, 'oe_CosEventComm_PullerS':oe_is_a("wrong")), + ok. + +%%----------------------------------------------------------------- +%% Test Case: 'oe_CosEventComm_PusherS' +%% Description: +%%----------------------------------------------------------------- +'oe_CosEventComm_PusherS'(doc) -> [""]; +'oe_CosEventComm_PusherS'(suite) -> []; +'oe_CosEventComm_PusherS'(_) -> + ?nomatch(undefined, 'oe_CosEventComm_PusherS':oe_tc(connect_push_consumer)), + ?nomatch(undefined, 'oe_CosEventComm_PusherS':oe_tc(disconnect_push_supplier)), + ?nomatch(undefined, 'oe_CosEventComm_PusherS':oe_tc(send)), + ?nomatch(undefined, 'oe_CosEventComm_PusherS':oe_tc(send_sync)), + ?match(undefined, 'oe_CosEventComm_PusherS':oe_tc(undefined)), + ?match([_|_], 'oe_CosEventComm_PusherS':oe_get_interface()), + ?match("IDL:oe_CosEventComm/PusherS:1.0", + 'oe_CosEventComm_PusherS':typeID()), + check_tc('oe_CosEventComm_PusherS':oe_get_interface()), + ?match(true, 'oe_CosEventComm_PusherS':oe_is_a('oe_CosEventComm_PusherS':typeID())), + ?match(true, 'oe_CosEventComm_PusherS':oe_is_a('CosEventChannelAdmin_ProxyPushSupplier':typeID())), + ?match(true, 'oe_CosEventComm_PusherS':oe_is_a('CosEventComm_PushSupplier':typeID())), + ?match(true, 'oe_CosEventComm_PusherS':oe_is_a('oe_CosEventComm_Event':typeID())), + ?match(false, 'oe_CosEventComm_PusherS':oe_is_a("wrong")), + ok. + +%%----------------------------------------------------------------- +%% Test Case: 'CosEventComm_PullConsumer' +%% Description: +%%----------------------------------------------------------------- +'CosEventComm_PullConsumer'(doc) -> [""]; +'CosEventComm_PullConsumer'(suite) -> []; +'CosEventComm_PullConsumer'(_) -> + ?nomatch(undefined, 'CosEventComm_PullConsumer':oe_tc(disconnect_pull_consumer)), + ?match(undefined, 'CosEventComm_PullConsumer':oe_tc(undefined)), + ?match([_|_], 'CosEventComm_PullConsumer':oe_get_interface()), + ?match("IDL:omg.org/CosEventComm/PullConsumer:1.0", + 'CosEventComm_PullConsumer':typeID()), + check_tc('CosEventComm_PullConsumer':oe_get_interface()), + ?match(true, 'CosEventComm_PullConsumer':oe_is_a('CosEventComm_PullConsumer':typeID())), + ?match(false, 'CosEventComm_PullConsumer':oe_is_a("wrong")), + ok. + +%%----------------------------------------------------------------- +%% Test Case: 'CosEventComm_PullSupplier' +%% Description: +%%----------------------------------------------------------------- +'CosEventComm_PullSupplier'(doc) -> [""]; +'CosEventComm_PullSupplier'(suite) -> []; +'CosEventComm_PullSupplier'(_) -> + ?nomatch(undefined, 'CosEventComm_PullSupplier':oe_tc(pull)), + ?nomatch(undefined, 'CosEventComm_PullSupplier':oe_tc(try_pull)), + ?nomatch(undefined, 'CosEventComm_PullSupplier':oe_tc(disconnect_pull_supplier)), + ?match(undefined, 'CosEventComm_PullSupplier':oe_tc(undefined)), + ?match([_|_], 'CosEventComm_PullSupplier':oe_get_interface()), + ?match("IDL:omg.org/CosEventComm/PullSupplier:1.0", + 'CosEventComm_PullSupplier':typeID()), + check_tc('CosEventComm_PullSupplier':oe_get_interface()), + ?match(true, 'CosEventComm_PullSupplier':oe_is_a('CosEventComm_PullSupplier':typeID())), + ?match(false, 'CosEventComm_PullSupplier':oe_is_a("wrong")), + ok. + +%%----------------------------------------------------------------- +%% Test Case: 'CosEventComm_PushConsumer' +%% Description: +%%----------------------------------------------------------------- +'CosEventComm_PushConsumer'(doc) -> [""]; +'CosEventComm_PushConsumer'(suite) -> []; +'CosEventComm_PushConsumer'(_) -> + ?nomatch(undefined, 'CosEventComm_PushConsumer':oe_tc(push)), + ?nomatch(undefined, 'CosEventComm_PushConsumer':oe_tc(disconnect_push_consumer)), + ?match(undefined, 'CosEventComm_PushConsumer':oe_tc(undefined)), + ?match([_|_], 'CosEventComm_PushConsumer':oe_get_interface()), + ?match("IDL:omg.org/CosEventComm/PushConsumer:1.0", + 'CosEventComm_PushConsumer':typeID()), + check_tc('CosEventComm_PushConsumer':oe_get_interface()), + ?match(true, 'CosEventComm_PushConsumer':oe_is_a('CosEventComm_PushConsumer':typeID())), + ?match(false, 'CosEventComm_PushConsumer':oe_is_a("wrong")), + ok. + +%%----------------------------------------------------------------- +%% Test Case: 'CosEventComm_PushSupplier' +%% Description: +%%----------------------------------------------------------------- +'CosEventComm_PushSupplier'(doc) -> [""]; +'CosEventComm_PushSupplier'(suite) -> []; +'CosEventComm_PushSupplier'(_) -> + ?nomatch(undefined, 'CosEventComm_PushSupplier':oe_tc(disconnect_push_supplier)), + ?match(undefined, 'CosEventComm_PushSupplier':oe_tc(undefined)), + ?match([_|_], 'CosEventComm_PushSupplier':oe_get_interface()), + ?match("IDL:omg.org/CosEventComm/PushSupplier:1.0", + 'CosEventComm_PushSupplier':typeID()), + check_tc('CosEventComm_PushSupplier':oe_get_interface()), + ?match(true, 'CosEventComm_PushSupplier':oe_is_a('CosEventComm_PushSupplier':typeID())), + ?match(false, 'CosEventComm_PushSupplier':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/cosEvent/test/idl_output/.gitignore b/lib/cosEvent/test/idl_output/.gitignore new file mode 100644 index 0000000000..e69de29bb2 -- cgit v1.2.3