1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  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,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24#include "com/sun/star/lang/IllegalArgumentException.idl"
25#include "com/sun/star/lang/XComponent.idl"
26#include "com/sun/star/uno/XComponentContext.idl"
27#include "com/sun/star/uno/XInterface.idl"
28
29module test { module testtools { module bridgetest {
30
31enum TestEnum
32{
33    TEST,
34    ONE,
35    TWO,
36    CHECK,
37    LOLA,
38    PALOO,
39    ZA
40};
41
42enum TestBadEnum { M = 1 };
43
44struct TestStruct
45{
46    long member;
47};
48
49/**
50 * simple types
51 */
52struct TestSimple
53{
54    boolean                    Bool;
55    char                       Char;
56    byte                       Byte;
57    short                      Short;
58    unsigned short             UShort;
59    long                       Long;
60    unsigned long              ULong;
61    hyper                      Hyper;
62    unsigned hyper             UHyper;
63    float                      Float;
64    double                     Double;
65    TestEnum                   Enum;
66};
67/**
68 * equal to max size returned in registers on x86_64
69 */
70struct SmallStruct
71{
72    hyper                      a;
73    hyper                      b;
74};
75/**
76 * equal to max size returned in registers on ia64
77 */
78struct MediumStruct
79{
80    hyper                      a;
81    hyper                      b;
82    hyper                      c;
83    hyper                      d;
84};
85/**
86 * bigger than max size returned in registers on ia64
87 */
88struct BigStruct
89{
90    hyper                      a;
91    hyper                      b;
92    hyper                      c;
93    hyper                      d;
94    hyper                      e;
95    hyper                      f;
96    hyper                      g;
97    hyper                      h;
98};
99/**
100 * all floats, ia64 handles them specially
101 */
102struct AllFloats
103{
104    float                      a;
105    float                      b;
106    float                      c;
107    float                      d;
108};
109/**
110 * complex types adding string, inteface, any
111 */
112struct TestElement : TestSimple
113{
114    string                     String;
115    com::sun::star::uno::XInterface   Interface;
116    any                        Any;
117};
118/**
119 * adding even more complexity, sequence< TestElement >
120 */
121struct TestDataElements : TestElement
122{
123    sequence< TestElement > Sequence;
124};
125
126/**
127 * typedef used in interface
128 */
129typedef TestDataElements TestData;
130
131struct TestPolyStruct<T> { T member; };
132struct TestPolyStruct2<T,C> {
133    T member1;
134    C member2;
135};
136
137interface XRecursiveCall : com::sun::star::uno::XInterface
138{
139    /***
140     * @param nToCall If nToCall is 0, the method returns immeadiatly.
141     *                Otherwise, call the given interface with nToCall -1
142     *
143     ***/
144    void callRecursivly( [in] XRecursiveCall xCall , [in] long nToCall );
145};
146
147interface XMultiBase1 {
148    [attribute] double att1; // initially 0.0
149    long fn11([in] long arg); // return 11 * arg
150    string fn12([in] string arg); // return "12" + arg
151};
152
153interface XMultiBase2: XMultiBase1 {
154    long fn21([in] long arg); // return 21 * arg
155    string fn22([in] string arg); // return "22" + arg
156};
157
158interface XMultiBase3 {
159    [attribute] double att3; // initially 0.0
160    long fn31([in] long arg); // return 31 * arg
161    string fn32([in] string arg); // return "32" + arg
162    long fn33(); // return 33
163};
164
165interface XMultiBase3a: XMultiBase3 {};
166
167interface XMultiBase4 {
168    long fn41([in] long arg); // return 41 * arg
169};
170
171interface XMultiBase5 {
172    interface XMultiBase3;
173    interface XMultiBase4;
174    interface XMultiBase1;
175};
176
177interface XMultiBase6 {
178    interface XMultiBase2;
179    interface XMultiBase3a;
180    interface XMultiBase5;
181    long fn61([in] long arg); // return 61 * arg
182    string fn62([in] string arg); // return "62" + arg
183};
184
185interface XMultiBase7 {
186    long fn71([in] long arg); // return 71 * arg
187    string fn72([in] string arg); // return "72" + arg
188    long fn73(); // return 73
189};
190
191interface XMulti {
192    interface XMultiBase6;
193    interface XMultiBase7;
194};
195
196/**
197 * Monster test interface to test bridge calls.
198 * An implementation of this object has to store given values and return whenever there
199 * is an out param or return value.
200 */
201interface XBridgeTestBase : com::sun::star::uno::XInterface
202{
203    /**
204     * in parameter test, tests by calls reference also (complex types)
205     */
206    [oneway] void setValues( [in] boolean bBool, [in] char cChar, [in] byte nByte,
207                             [in] short nShort, [in] unsigned short nUShort,
208                             [in] long nLong, [in] unsigned long nULong,
209                             [in] hyper nHyper, [in] unsigned hyper nUHyper,
210                             [in] float fFloat, [in] double fDouble,
211                             [in] TestEnum eEnum, [in] string aString,
212                             [in] com::sun::star::uno::XInterface xInterface, [in] any aAny,
213                             [in] sequence< TestElement > aSequence,
214                             [in] TestData aStruct );
215    /**
216     * inout parameter test
217     *
218     * @return aStruct. The out parameter contain the values, that were previously set
219     *         by setValues or (if not called before) default constructed values.
220     *
221     */
222    TestData setValues2( [inout] boolean bBool, [inout] char cChar, [inout] byte nByte,
223                         [inout] short nShort, [inout] unsigned short nUShort,
224                         [inout] long nLong, [inout] unsigned long nULong,
225                         [inout] hyper nHyper, [inout] unsigned hyper nUHyper,
226                         [inout] float fFloat, [inout] double fDouble,
227                         [inout] TestEnum eEnum, [inout] string aString,
228                         [inout] com::sun::star::uno::XInterface xInterface, [inout] any aAny,
229                         [inout] sequence< TestElement > aSequence,
230                         [inout] TestData aStruct );
231
232    /**
233     * out parameter test
234     */
235    TestData getValues( [out] boolean bBool, [out] char cChar, [out] byte nByte,
236                        [out] short nShort, [out] unsigned short nUShort,
237                        [out] long nLong, [out] unsigned long nULong,
238                        [out] hyper nHyper, [out] unsigned hyper nUHyper,
239                        [out] float fFloat, [out] double fDouble,
240                        [out] TestEnum eEnum, [out] string aString,
241                        [out] com::sun::star::uno::XInterface xInterface, [out] any aAny,
242                        [out] sequence< TestElement > aSequence,
243                        [out] TestData aStruct );
244
245    /**
246     * register return test 1
247     */
248    SmallStruct echoSmallStruct( [in] SmallStruct aStruct );
249
250    /**
251     * register return test 2
252     */
253    MediumStruct echoMediumStruct( [in] MediumStruct aStruct );
254
255    /**
256     * register return test 3
257     */
258    BigStruct echoBigStruct( [in] BigStruct aStruct );
259
260    /**
261     * register return test 4
262     */
263    AllFloats echoAllFloats( [in] AllFloats aStruct );
264
265    /**
266     * register return test 4 (i107182)
267     */
268    long testPPCAlignment( [in] hyper l1, [in] hyper l2, [in] long i1, [in] hyper l3, [in] long i2 );
269
270    [attribute] boolean                  Bool;
271    [attribute] byte                     Byte;
272    [attribute] char                     Char;
273    [attribute] short                    Short;
274    [attribute] unsigned short           UShort;
275    [attribute] long                     Long;
276    [attribute] unsigned long            ULong;
277    [attribute] hyper                    Hyper;
278    [attribute] unsigned hyper           UHyper;
279    [attribute] float                    Float;
280    [attribute] double                   Double;
281    [attribute] TestEnum                 Enum;
282    [attribute] string                   String;
283    [attribute] com::sun::star::uno::XInterface Interface;
284    [attribute] any                      Any;
285    [attribute] sequence< TestElement >  Sequence;
286    [attribute] TestData                 Struct;
287
288    [attribute] long RaiseAttr1 {
289        set raises (com::sun::star::lang::IllegalArgumentException);
290    };
291    [attribute, readonly] long RaiseAttr2 {
292        get raises (com::sun::star::lang::IllegalArgumentException);
293    };
294
295    TestPolyStruct<boolean> transportPolyBoolean(
296        [in] TestPolyStruct<boolean> arg);
297    void transportPolyHyper([inout] TestPolyStruct<hyper> arg);
298    void transportPolySequence(
299        [in] TestPolyStruct<sequence<any> > arg1,
300        [out] TestPolyStruct<sequence<any> > arg2);
301
302    TestPolyStruct<long> getNullPolyLong();
303    TestPolyStruct<string> getNullPolyString();
304    TestPolyStruct<type> getNullPolyType();
305    TestPolyStruct<any> getNullPolyAny();
306    TestPolyStruct<sequence<boolean> > getNullPolySequence();
307    TestPolyStruct<TestEnum> getNullPolyEnum();
308    TestPolyStruct<TestBadEnum> getNullPolyBadEnum();
309    TestPolyStruct<TestStruct> getNullPolyStruct();
310    TestPolyStruct<XBridgeTestBase> getNullPolyInterface();
311
312    /***
313     * This method returns the parameter value.
314     * Method to extensivly test anys.
315     ****/
316    any transportAny( [in] any value );
317
318    /***
319     * methods to check sequence of calls. Call call() and callOneway
320     * in an arbitrary sequence. Increase the callId for every call.
321     * The testobject sets an error flag.
322
323        @see testSequencePassed
324     ***/
325    void call( [in] long nCallId, [in] long nWaitMUSEC );
326    [oneway] void callOneway( [in] long nCallId, [in] long nWaitMUSEC );
327    boolean sequenceOfCallTestPassed();
328
329    /****
330     * methods to check, if threads thread identity is holded.
331     *
332     ***/
333    void startRecursiveCall( [in] XRecursiveCall xCall , [in] long nToCall );
334
335    XMulti getMulti();
336    string testMulti([in] XMulti multi);
337};
338
339
340/**
341 * Inherting from monster; adds raiseException(), attribute raising RuntimeException.
342 */
343interface XBridgeTest : XBridgeTestBase
344{
345    /**
346     * the exception struct returned has to be filled with given arguments.
347     * return value is for dummy.
348     */
349    TestData raiseException( [in] short ArgumentPosition,
350                             [in] string Message,
351                             [in] com::sun::star::uno::XInterface Context )
352        raises( com::sun::star::lang::IllegalArgumentException );
353
354
355    /**
356     * Throws runtime exception.
357     * check remote bridges handle exceptions during oneway calls properly.
358     * Note that on client side the execption may fly or not. When it flies, it should
359     * have the proper message and context.
360     ***/
361    [oneway] void raiseRuntimeExceptionOneway(  [in] string Message,
362                                                [in] com::sun::star::uno::XInterface Context );
363
364    /**
365     * raises runtime exception;
366     * the exception struct returned has to be filled with formerly set test data.
367     */
368    [attribute] long                     RuntimeException;
369};
370
371
372exception BadConstructorArguments: com::sun::star::uno::Exception {};
373
374service Constructors: com::sun::star::uno::XInterface {
375    create1(
376        [in] boolean arg0,
377        [in] byte arg1,
378        [in] short arg2,
379        [in] unsigned short arg3,
380        [in] long arg4,
381        [in] unsigned long arg5,
382        [in] hyper arg6,
383        [in] unsigned hyper arg7,
384        [in] float arg8,
385        [in] double arg9,
386        [in] char arg10,
387        [in] string arg11,
388        [in] type arg12,
389        [in] any arg13,
390        [in] sequence< boolean > arg14,
391        [in] sequence< byte > arg15,
392        [in] sequence< short > arg16,
393        [in] sequence< unsigned short > arg17,
394        [in] sequence< long > arg18,
395        [in] sequence< unsigned long > arg19,
396        [in] sequence< hyper > arg20,
397        [in] sequence< unsigned hyper > arg21,
398        [in] sequence< float > arg22,
399        [in] sequence< double > arg23,
400        [in] sequence< char > arg24,
401        [in] sequence< string > arg25,
402        [in] sequence< type > arg26,
403        [in] sequence< any > arg27,
404        [in] sequence< sequence< boolean > > arg28,
405        [in] sequence< sequence< any > > arg29,
406        [in] sequence< TestEnum > arg30,
407        [in] sequence< TestStruct > arg31,
408        [in] sequence< TestPolyStruct< boolean > > arg32,
409        [in] sequence< TestPolyStruct< any > > arg33,
410        [in] sequence< com::sun::star::uno::XInterface > arg34,
411        [in] TestEnum arg35,
412        [in] TestStruct arg36,
413        [in] TestPolyStruct< boolean > arg37,
414        [in] TestPolyStruct< any > arg38,
415        [in] com::sun::star::uno::XInterface arg39)
416        raises (BadConstructorArguments);
417
418    create2([in] any... args) raises (BadConstructorArguments);
419
420};
421
422service Constructors2: XMultiBase1 {
423
424    create1(
425        [in] TestPolyStruct<type> arg1,
426        [in] TestPolyStruct<any> arg2,
427        [in] TestPolyStruct<boolean> arg3,
428        [in] TestPolyStruct<byte> arg4,
429        [in] TestPolyStruct<short> arg5,
430        [in] TestPolyStruct<long> arg6,
431        [in] TestPolyStruct<hyper> arg7,
432        [in] TestPolyStruct<char> arg8,
433        [in] TestPolyStruct<string> arg9,
434        [in] TestPolyStruct<float> arg10,
435        [in] TestPolyStruct<double> arg11,
436        [in] TestPolyStruct<com::sun::star::uno::XInterface> arg12,
437        [in] TestPolyStruct<com::sun::star::lang::XComponent> arg13,
438        [in] TestPolyStruct<TestEnum> arg14,
439        [in] TestPolyStruct<TestPolyStruct2<char,any> > arg15,
440        [in] TestPolyStruct<TestPolyStruct2<TestPolyStruct2<char,any>,string> > arg16,
441        [in] TestPolyStruct2<string, TestPolyStruct2<char, TestPolyStruct<any> > > arg17,
442        [in] TestPolyStruct2<TestPolyStruct2<char,any>, TestPolyStruct<char> > arg18,
443        [in] TestPolyStruct<sequence<type> > arg19,
444        [in] TestPolyStruct<sequence<any> > arg20,
445        [in] TestPolyStruct<sequence<boolean> > arg21,
446        [in] TestPolyStruct<sequence<byte> > arg22,
447        [in] TestPolyStruct<sequence<short> > arg23,
448        [in] TestPolyStruct<sequence<long> > arg24,
449        [in] TestPolyStruct<sequence<hyper> > arg25,
450        [in] TestPolyStruct<sequence<char> > arg26,
451        [in] TestPolyStruct<sequence<string> > arg27,
452        [in] TestPolyStruct<sequence<float> > arg28,
453        [in] TestPolyStruct<sequence<double> > arg29,
454        [in] TestPolyStruct<sequence<com::sun::star::uno::XInterface> > arg30,
455        [in] TestPolyStruct<sequence<com::sun::star::lang::XComponent> > arg31,
456        [in] TestPolyStruct<sequence<TestEnum> > arg32,
457        [in] TestPolyStruct<sequence<TestPolyStruct2<char, sequence<any> > > > arg33,
458        [in] TestPolyStruct<sequence<TestPolyStruct2<TestPolyStruct<char>, sequence<any> > > > arg34,
459        [in] TestPolyStruct<sequence<sequence<long> > > arg35,
460        [in] sequence<TestPolyStruct<long > > arg36,
461        [in] sequence<TestPolyStruct<TestPolyStruct2<char,any> > > arg37,
462        [in] sequence<TestPolyStruct<TestPolyStruct2<TestPolyStruct2<char,any>,string> > > arg38,
463        [in] sequence<TestPolyStruct2<string, TestPolyStruct2<char, TestPolyStruct<any> > > > arg39,
464        [in] sequence<TestPolyStruct2<TestPolyStruct2<char,any>, TestPolyStruct<char> > > arg40,
465        [in] sequence<sequence<TestPolyStruct< char > > > arg41,
466        [in] sequence<sequence<TestPolyStruct<TestPolyStruct2<char,any> > > >arg42,
467        [in] sequence<sequence<TestPolyStruct<TestPolyStruct2<TestPolyStruct2<char,any>,string> > > > arg43,
468        [in] sequence<sequence<TestPolyStruct2<string, TestPolyStruct2<char, TestPolyStruct<any> > > > > arg44,
469        [in] sequence<sequence<TestPolyStruct2<TestPolyStruct2<char,any>, TestPolyStruct<char> > > > arg45
470        );
471};
472
473interface XCurrentContextChecker {
474    boolean perform(
475        [in] XCurrentContextChecker other, [in] long setSteps,
476        [in] long checkSteps);
477};
478
479/** Extended tests with sequences.
480 */
481interface XBridgeTest2 : XBridgeTest
482{
483    sequence< boolean > setSequenceBool( [in] sequence< boolean > aSeq);
484    sequence< char > setSequenceChar( [in] sequence< char > aSeq);
485    sequence< byte> setSequenceByte( [in] sequence< byte > aSeq);
486    sequence< short> setSequenceShort( [in] sequence< short > aSeq);
487    sequence< unsigned short > setSequenceUShort( [in] sequence< unsigned short > aSeq);
488    sequence< long > setSequenceLong( [in] sequence< long > aSeq);
489    sequence< unsigned long > setSequenceULong( [in] sequence< unsigned long > aSeq);
490    sequence< hyper > setSequenceHyper( [in] sequence< hyper > aSeq);
491    sequence< unsigned hyper > setSequenceUHyper( [in] sequence< unsigned hyper > aSeq);
492    sequence< float > setSequenceFloat( [in] sequence< float > aSeq);
493    sequence< double > setSequenceDouble( [in] sequence< double > aSeq);
494    sequence< TestEnum > setSequenceEnum( [in] sequence< TestEnum > aSeq);
495    sequence< string > setSequenceString( [in] sequence< string > aString);
496    sequence< com::sun::star::uno::XInterface > setSequenceXInterface(
497        [in] sequence< com::sun::star::uno::XInterface > aSeq);
498    sequence< any > setSequenceAny( [in] sequence< any > aSeq);
499    sequence< TestElement > setSequenceStruct( [in] sequence< TestElement > aSeq);
500
501    sequence< sequence< long > > setDim2( [in] sequence< sequence< long > > aSeq);
502    sequence< sequence < sequence < long > > > setDim3(
503        [in] sequence< sequence < sequence < long > > > aSeq);
504
505    void setSequencesInOut( [inout] sequence< boolean > aSeqBoolean,
506                       [inout] sequence< char > aSeqChar,
507                       [inout] sequence< byte > aSeqByte,
508                       [inout] sequence< short > aSeqShort,
509                       [inout] sequence< unsigned short> aSeqUShort,
510                       [inout] sequence< long > aSeqLong,
511                       [inout] sequence< unsigned long > aSeqULong,
512                       [inout] sequence< hyper > aSeqHyper,
513                       [inout] sequence< unsigned hyper > aSeqUHyper,
514                       [inout] sequence< float > aSeqFloat,
515                       [inout] sequence< double > aSeqDouble,
516                       [inout] sequence< TestEnum > aSeqEnum,
517                       [inout] sequence< string > aSeqString,
518                       [inout] sequence< com::sun::star::uno::XInterface > aSeqXInterface,
519                       [inout] sequence< any > aSeqAny,
520                       [inout] sequence< sequence< long > > aSeqDim2,
521                       [inout] sequence< sequence < sequence < long > > > aSeqDim3);
522
523    void setSequencesOut( [out] sequence< boolean > aSeqBoolean,
524                       [out] sequence< char > aSeqChar,
525                       [out] sequence< byte > aSeqByte,
526                       [out] sequence< short > aSeqShort,
527                       [out] sequence< unsigned short> aSeqUShort,
528                       [out] sequence< long > aSeqLong,
529                       [out] sequence< unsigned long > aSeqULong,
530                       [out] sequence< hyper > aSeqHyper,
531                       [out] sequence< unsigned hyper > aSeqUHyper,
532                       [out] sequence< float > aSeqFloat,
533                       [out] sequence< double > aSeqDouble,
534                       [out] sequence< TestEnum > aSeqEnum,
535                       [out] sequence< string > aSeqString,
536                       [out] sequence< com::sun::star::uno::XInterface > aSeqXInterface,
537                       [out] sequence< any > aSeqAny,
538                       [out] sequence< sequence< long > > aSeqDim2,
539                       [out] sequence< sequence < sequence < long > > > aSeqDim3);
540
541    void testConstructorsService(
542        [in] com::sun::star::uno::XComponentContext context)
543        raises (BadConstructorArguments);
544
545    XCurrentContextChecker getCurrentContextChecker();
546};
547
548}; }; };
549