1%%-----------------------------------------------------------------
2%%
3%% %CopyrightBegin%
4%%
5%% Copyright Ericsson AB 2004-2016. All Rights Reserved.
6%%
7%% Licensed under the Apache License, Version 2.0 (the "License");
8%% you may not use this file except in compliance with the License.
9%% You may obtain a copy of the License at
10%%
11%%     http://www.apache.org/licenses/LICENSE-2.0
12%%
13%% Unless required by applicable law or agreed to in writing, software
14%% distributed under the License is distributed on an "AS IS" BASIS,
15%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16%% See the License for the specific language governing permissions and
17%% limitations under the License.
18%%
19%% %CopyrightEnd%
20%%
21%%
22%%-----------------------------------------------------------------
23%% File    : generated_SUITE.erl
24%% Purpose :
25%%-----------------------------------------------------------------
26
27-module(generated_SUITE).
28
29-include_lib("common_test/include/ct.hrl").
30-include_lib("orber/include/corba.hrl").
31
32-define(default_timeout, test_server:minutes(3)).
33
34-define(match(ExpectedRes, Expr),
35        fun() ->
36		AcTuAlReS = (catch (Expr)),
37		case AcTuAlReS of
38		    ExpectedRes ->
39			AcTuAlReS;
40		    _ ->
41			io:format("###### ERROR ERROR ######~n~p~n",
42				  [AcTuAlReS]),
43			exit(AcTuAlReS)
44		end
45	end()).
46
47-define(nomatch(Not, Expr),
48        fun() ->
49		AcTuAlReS = (catch (Expr)),
50		case AcTuAlReS of
51		    Not ->
52			io:format("###### ERROR ERROR ######~n~p~n",
53				  [AcTuAlReS]),
54			exit(AcTuAlReS);
55		    _ ->
56			AcTuAlReS
57		end
58	end()).
59
60
61-define(checktc(_Op),
62        fun(TC) ->
63		case orber_tc:check_tc(TC) of
64		    false ->
65			io:format("###### ERROR ERROR ######~n~p - ~p~n", [Op, TC]),
66			exit(TC);
67		    true ->
68			true
69		end
70	end).
71
72%%-----------------------------------------------------------------
73%% External exports
74%%-----------------------------------------------------------------
75-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2]).
76
77%%-----------------------------------------------------------------
78%% Internal exports
79%%-----------------------------------------------------------------
80-compile(export_all).
81
82%%-----------------------------------------------------------------
83%% Func: all/1
84%% Args:
85%% Returns:
86%%-----------------------------------------------------------------
87suite() -> [{ct_hooks,[ts_install_cth]}].
88
89all() ->
90    ['CosEventDomainAdmin',
91     'CosEventDomainAdmin_DiamondSeq',
92     'CosEventDomainAdmin_AlreadyExists',
93     'CosEventDomainAdmin_DomainIDSeq',
94     'CosEventDomainAdmin_Connection',
95     'CosEventDomainAdmin_ConnectionIDSeq',
96     'CosEventDomainAdmin_ConnectionNotFound',
97     'CosEventDomainAdmin_CycleCreationForbidden',
98     'CosEventDomainAdmin_CycleSeq',
99     'CosEventDomainAdmin_DiamondCreationForbidden',
100     'CosEventDomainAdmin_DomainNotFound',
101     'CosEventDomainAdmin_MemberIDSeq',
102     'CosEventDomainAdmin_RouteSeq',
103     'CosEventDomainAdmin_EventDomainFactory',
104     'CosEventDomainAdmin_EventDomain'].
105
106groups() ->
107    [].
108
109init_per_suite(Config) ->
110    Config.
111
112end_per_suite(_Config) ->
113    ok.
114
115init_per_group(_GroupName, Config) ->
116    Config.
117
118end_per_group(_GroupName, Config) ->
119    Config.
120
121
122%%-----------------------------------------------------------------
123%% Init and cleanup functions.
124%%-----------------------------------------------------------------
125init_per_testcase(_Case, Config) ->
126    Dog=test_server:timetrap(?default_timeout),
127    [{watchdog, Dog}|Config].
128
129
130end_per_testcase(_Case, Config) ->
131    Dog = proplists:get_value(watchdog, Config),
132    test_server:timetrap_cancel(Dog),
133    ok.
134
135
136%%-----------------------------------------------------------------
137%% Test Case: 'CosEventDomainAdmin'
138%% Description:
139%%-----------------------------------------------------------------
140'CosEventDomainAdmin'(_) ->
141    ?match("CycleDetection", 'CosEventDomainAdmin':'CycleDetection'()),
142    ?match(0, 'CosEventDomainAdmin':'AuthorizeCycles'()),
143    ?match(1, 'CosEventDomainAdmin':'ForbidCycles'()),
144    ?match("DiamondDetection", 'CosEventDomainAdmin':'DiamondDetection'()),
145    ?match(0, 'CosEventDomainAdmin':'AuthorizeDiamonds'()),
146    ?match(1, 'CosEventDomainAdmin':'ForbidDiamonds'()),
147    ok.
148
149%%-----------------------------------------------------------------
150%% Test Case: 'CosEventDomainAdmin_DiamondSeq'
151%% Description:
152%%-----------------------------------------------------------------
153'CosEventDomainAdmin_DiamondSeq'(_) ->
154    ?match(true, orber_tc:check_tc('CosEventDomainAdmin_DiamondSeq':tc())),
155    ?match("IDL:omg.org/CosEventDomainAdmin/DiamondSeq:1.0",
156	   'CosEventDomainAdmin_DiamondSeq':id()),
157    ?match("CosEventDomainAdmin_DiamondSeq",
158	   'CosEventDomainAdmin_DiamondSeq':name()),
159    ok.
160
161%%-----------------------------------------------------------------
162%% Test Case: 'CosEventDomainAdmin_AlreadyExists'
163%% Description:
164%%-----------------------------------------------------------------
165'CosEventDomainAdmin_AlreadyExists'(_) ->
166    ?match(true, orber_tc:check_tc('CosEventDomainAdmin_AlreadyExists':tc())),
167    ?match("IDL:omg.org/CosEventDomainAdmin/AlreadyExists:1.0",
168	   'CosEventDomainAdmin_AlreadyExists':id()),
169    ?match("CosEventDomainAdmin_AlreadyExists",
170	   'CosEventDomainAdmin_AlreadyExists':name()),
171    ok.
172
173%%-----------------------------------------------------------------
174%% Test Case: 'CosEventDomainAdmin_DomainIDSeq'
175%% Description:
176%%-----------------------------------------------------------------
177'CosEventDomainAdmin_DomainIDSeq'(_) ->
178    ?match(true, orber_tc:check_tc('CosEventDomainAdmin_DomainIDSeq':tc())),
179    ?match("IDL:omg.org/CosEventDomainAdmin/DomainIDSeq:1.0",
180	   'CosEventDomainAdmin_DomainIDSeq':id()),
181    ?match("CosEventDomainAdmin_DomainIDSeq",
182	   'CosEventDomainAdmin_DomainIDSeq':name()),
183    ok.
184
185%%-----------------------------------------------------------------
186%% Test Case: 'CosEventDomainAdmin_Connection'
187%% Description:
188%%-----------------------------------------------------------------
189'CosEventDomainAdmin_Connection'(_) ->
190    ?match(true, orber_tc:check_tc('CosEventDomainAdmin_Connection':tc())),
191    ?match("IDL:omg.org/CosEventDomainAdmin/Connection:1.0",
192	   'CosEventDomainAdmin_Connection':id()),
193    ?match("CosEventDomainAdmin_Connection",
194	   'CosEventDomainAdmin_Connection':name()),
195    ok.
196
197%%-----------------------------------------------------------------
198%% Test Case: 'CosEventDomainAdmin_ConnectionIDSeq'
199%% Description:
200%%-----------------------------------------------------------------
201'CosEventDomainAdmin_ConnectionIDSeq'(_) ->
202    ?match(true, orber_tc:check_tc('CosEventDomainAdmin_ConnectionIDSeq':tc())),
203    ?match("IDL:omg.org/CosEventDomainAdmin/ConnectionIDSeq:1.0",
204	   'CosEventDomainAdmin_ConnectionIDSeq':id()),
205    ?match("CosEventDomainAdmin_ConnectionIDSeq",
206	   'CosEventDomainAdmin_ConnectionIDSeq':name()),
207    ok.
208
209%%-----------------------------------------------------------------
210%% Test Case: 'CosEventDomainAdmin_ConnectionNotFound'
211%% Description:
212%%-----------------------------------------------------------------
213'CosEventDomainAdmin_ConnectionNotFound'(_) ->
214    ?match(true, orber_tc:check_tc('CosEventDomainAdmin_ConnectionNotFound':tc())),
215    ?match("IDL:omg.org/CosEventDomainAdmin/ConnectionNotFound:1.0",
216	   'CosEventDomainAdmin_ConnectionNotFound':id()),
217    ?match("CosEventDomainAdmin_ConnectionNotFound",
218	   'CosEventDomainAdmin_ConnectionNotFound':name()),
219    ok.
220
221%%-----------------------------------------------------------------
222%% Test Case: 'CosEventDomainAdmin_CycleCreationForbidden'
223%% Description:
224%%-----------------------------------------------------------------
225'CosEventDomainAdmin_CycleCreationForbidden'(_) ->
226    ?match(true, orber_tc:check_tc('CosEventDomainAdmin_CycleCreationForbidden':tc())),
227    ?match("IDL:omg.org/CosEventDomainAdmin/CycleCreationForbidden:1.0",
228	   'CosEventDomainAdmin_CycleCreationForbidden':id()),
229    ?match("CosEventDomainAdmin_CycleCreationForbidden",
230	   'CosEventDomainAdmin_CycleCreationForbidden':name()),
231    ok.
232
233%%-----------------------------------------------------------------
234%% Test Case: 'CosEventDomainAdmin_CycleSeq'
235%% Description:
236%%-----------------------------------------------------------------
237'CosEventDomainAdmin_CycleSeq'(_) ->
238    ?match(true, orber_tc:check_tc('CosEventDomainAdmin_CycleSeq':tc())),
239    ?match("IDL:omg.org/CosEventDomainAdmin/CycleSeq:1.0",
240	   'CosEventDomainAdmin_CycleSeq':id()),
241    ?match("CosEventDomainAdmin_CycleSeq",
242	   'CosEventDomainAdmin_CycleSeq':name()),
243    ok.
244
245%%-----------------------------------------------------------------
246%% Test Case: 'CosEventDomainAdmin_DiamondCreationForbidden'
247%% Description:
248%%-----------------------------------------------------------------
249'CosEventDomainAdmin_DiamondCreationForbidden'(_) ->
250    ?match(true, orber_tc:check_tc('CosEventDomainAdmin_DiamondCreationForbidden':tc())),
251    ?match("IDL:omg.org/CosEventDomainAdmin/DiamondCreationForbidden:1.0",
252	   'CosEventDomainAdmin_DiamondCreationForbidden':id()),
253    ?match("CosEventDomainAdmin_DiamondCreationForbidden",
254	   'CosEventDomainAdmin_DiamondCreationForbidden':name()),
255    ok.
256
257%%-----------------------------------------------------------------
258%% Test Case: 'CosEventDomainAdmin_DomainNotFound'
259%% Description:
260%%-----------------------------------------------------------------
261'CosEventDomainAdmin_DomainNotFound'(_) ->
262    ?match(true, orber_tc:check_tc('CosEventDomainAdmin_DomainNotFound':tc())),
263    ?match("IDL:omg.org/CosEventDomainAdmin/DomainNotFound:1.0",
264	   'CosEventDomainAdmin_DomainNotFound':id()),
265    ?match("CosEventDomainAdmin_DomainNotFound",
266	   'CosEventDomainAdmin_DomainNotFound':name()),
267    ok.
268
269%%-----------------------------------------------------------------
270%% Test Case: 'CosEventDomainAdmin_MemberIDSeq'
271%% Description:
272%%-----------------------------------------------------------------
273'CosEventDomainAdmin_MemberIDSeq'(_) ->
274    ?match(true, orber_tc:check_tc('CosEventDomainAdmin_MemberIDSeq':tc())),
275    ?match("IDL:omg.org/CosEventDomainAdmin/MemberIDSeq:1.0",
276	   'CosEventDomainAdmin_MemberIDSeq':id()),
277    ?match("CosEventDomainAdmin_MemberIDSeq",
278	   'CosEventDomainAdmin_MemberIDSeq':name()),
279    ok.
280
281%%-----------------------------------------------------------------
282%% Test Case: 'CosEventDomainAdmin_RouteSeq'
283%% Description:
284%%-----------------------------------------------------------------
285'CosEventDomainAdmin_RouteSeq'(_) ->
286    ?match(true, orber_tc:check_tc('CosEventDomainAdmin_RouteSeq':tc())),
287    ?match("IDL:omg.org/CosEventDomainAdmin/RouteSeq:1.0",
288	   'CosEventDomainAdmin_RouteSeq':id()),
289    ?match("CosEventDomainAdmin_RouteSeq",
290	   'CosEventDomainAdmin_RouteSeq':name()),
291    ok.
292
293%%-----------------------------------------------------------------
294%% Test Case: 'CosEventDomainAdmin_EventDomainFactory'
295%% Description:
296%%-----------------------------------------------------------------
297'CosEventDomainAdmin_EventDomainFactory'(_) ->
298    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomainFactory':oe_tc(create_event_domain)),
299    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomainFactory':oe_tc(get_all_domains)),
300    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomainFactory':oe_tc(get_event_domain)),
301    ?match(undefined, 'CosEventDomainAdmin_EventDomainFactory':oe_tc(undefined)),
302    ?match([_|_], 'CosEventDomainAdmin_EventDomainFactory':oe_get_interface()),
303    ?match("IDL:omg.org/CosEventDomainAdmin/EventDomainFactory:1.0",
304	   'CosEventDomainAdmin_EventDomainFactory':typeID()),
305    check_tc('CosEventDomainAdmin_EventDomainFactory':oe_get_interface()),
306    ?match(true, 'CosEventDomainAdmin_EventDomainFactory':oe_is_a('CosEventDomainAdmin_EventDomainFactory':typeID())),
307    ?match(false, 'CosEventDomainAdmin_EventDomainFactory':oe_is_a("wrong")),
308    ok.
309
310
311%%-----------------------------------------------------------------
312%% Test Case: 'CosEventDomainAdmin_EventDomain'
313%% Description:
314%%-----------------------------------------------------------------
315'CosEventDomainAdmin_EventDomain'(_) ->
316    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(add_channel)),
317    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(get_all_channels)),
318    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(get_channel)),
319    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(remove_channel)),
320    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(add_connection)),
321    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(get_all_connections)),
322    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(get_connection)),
323    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(remove_connection)),
324    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(get_offer_channels)),
325    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(get_subscription_channels)),
326    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(destroy)),
327    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(get_cycles)),
328    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(get_diamonds)),
329    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(set_default_consumer_channel)),
330    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(set_default_supplier_channel)),
331    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_push_consumer)),
332    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_pull_consumer)),
333    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_push_supplier)),
334    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_pull_supplier)),
335    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_structured_push_consumer)),
336    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_structured_pull_consumer)),
337    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_structured_push_supplier)),
338    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_structured_pull_supplier)),
339    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_sequence_push_consumer)),
340    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_sequence_pull_consumer)),
341    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_sequence_push_supplier)),
342    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_sequence_pull_supplier)),
343    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_push_consumer_with_id)),
344    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_pull_consumer_with_id)),
345    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_push_supplier_with_id)),
346    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_pull_supplier_with_id)),
347    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_structured_push_consumer_with_id)),
348    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_structured_pull_consumer_with_id)),
349    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_structured_push_supplier_with_id)),
350    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_structured_pull_supplier_with_id)),
351    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_sequence_push_consumer_with_id)),
352    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_sequence_pull_consumer_with_id)),
353    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_sequence_push_supplier_with_id)),
354    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_sequence_pull_supplier_with_id)),
355    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(get_qos)),
356    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(set_qos)),
357    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(validate_qos)),
358    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(get_admin)),
359    ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(set_admin)),
360    ?match(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(undefined)),
361    ?match([_|_], 'CosEventDomainAdmin_EventDomain':oe_get_interface()),
362    ?match("IDL:omg.org/CosEventDomainAdmin/EventDomain:1.0",
363	   'CosEventDomainAdmin_EventDomain':typeID()),
364    check_tc('CosEventDomainAdmin_EventDomain':oe_get_interface()),
365    ?match(true, 'CosEventDomainAdmin_EventDomain':oe_is_a('CosEventDomainAdmin_EventDomain':typeID())),
366    ?match(true, 'CosEventDomainAdmin_EventDomain':oe_is_a('CosNotification_QoSAdmin':typeID())),
367    ?match(true, 'CosEventDomainAdmin_EventDomain':oe_is_a('CosNotification_AdminPropertiesAdmin':typeID())),
368    ?match(false, 'CosEventDomainAdmin_EventDomain':oe_is_a("wrong")),
369    ok.
370
371
372
373%%-----------------------------------------------------------------
374%% MISC functions
375%%-----------------------------------------------------------------
376check_tc([]) ->
377    ok;
378check_tc([{Op, {RetType, InParameters, OutParameters}}|T]) ->
379    io:format("checked - ~s~n", [Op]),
380    lists:all(?checktc(Op), [RetType|InParameters]),
381    lists:all(?checktc(Op), OutParameters),
382    check_tc(T).
383
384
385