xref: /AOO42X/main/testtools/source/bridgetest/idl/bridgetest.idl (revision a230972184deb427a995e0eb922a5743673d1d16)
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
110struct TwoFloats
111{
112    float                      a;
113    float                      b;
114};
115
116struct ThreeDoubles
117{
118    double                     a;
119    double                     b;
120    double                     c;
121};
122
123struct MixedFloatLong
124{
125    float                      a;
126    long                       b;
127};
128
129struct OneByte
130{
131    byte                       value;
132};
133
134struct ThreeLongs
135{
136    long                       a;
137    long                       b;
138    long                       c;
139};
140/**
141 * complex types adding string, inteface, any
142 */
143struct TestElement : TestSimple
144{
145    string                     String;
146    com::sun::star::uno::XInterface   Interface;
147    any                        Any;
148};
149/**
150 * adding even more complexity, sequence< TestElement >
151 */
152struct TestDataElements : TestElement
153{
154    sequence< TestElement > Sequence;
155};
156
157/**
158 * typedef used in interface
159 */
160typedef TestDataElements TestData;
161
162struct TestPolyStruct<T> { T member; };
163struct TestPolyStruct2<T,C> {
164    T member1;
165    C member2;
166};
167
168interface XRecursiveCall : com::sun::star::uno::XInterface
169{
170    /***
171     * @param nToCall If nToCall is 0, the method returns immeadiatly.
172     *                Otherwise, call the given interface with nToCall -1
173     *
174     ***/
175    void callRecursivly( [in] XRecursiveCall xCall , [in] long nToCall );
176};
177
178interface XMultiBase1 {
179    [attribute] double att1; // initially 0.0
180    long fn11([in] long arg); // return 11 * arg
181    string fn12([in] string arg); // return "12" + arg
182};
183
184interface XMultiBase2: XMultiBase1 {
185    long fn21([in] long arg); // return 21 * arg
186    string fn22([in] string arg); // return "22" + arg
187};
188
189interface XMultiBase3 {
190    [attribute] double att3; // initially 0.0
191    long fn31([in] long arg); // return 31 * arg
192    string fn32([in] string arg); // return "32" + arg
193    long fn33(); // return 33
194};
195
196interface XMultiBase3a: XMultiBase3 {};
197
198interface XMultiBase4 {
199    long fn41([in] long arg); // return 41 * arg
200};
201
202interface XMultiBase5 {
203    interface XMultiBase3;
204    interface XMultiBase4;
205    interface XMultiBase1;
206};
207
208interface XMultiBase6 {
209    interface XMultiBase2;
210    interface XMultiBase3a;
211    interface XMultiBase5;
212    long fn61([in] long arg); // return 61 * arg
213    string fn62([in] string arg); // return "62" + arg
214};
215
216interface XMultiBase7 {
217    long fn71([in] long arg); // return 71 * arg
218    string fn72([in] string arg); // return "72" + arg
219    long fn73(); // return 73
220};
221
222interface XMulti {
223    interface XMultiBase6;
224    interface XMultiBase7;
225};
226
227/**
228 * Monster test interface to test bridge calls.
229 * An implementation of this object has to store given values and return whenever there
230 * is an out param or return value.
231 */
232interface XBridgeTestBase : com::sun::star::uno::XInterface
233{
234    /**
235     * in parameter test, tests by calls reference also (complex types)
236     */
237    [oneway] void setValues( [in] boolean bBool, [in] char cChar, [in] byte nByte,
238                             [in] short nShort, [in] unsigned short nUShort,
239                             [in] long nLong, [in] unsigned long nULong,
240                             [in] hyper nHyper, [in] unsigned hyper nUHyper,
241                             [in] float fFloat, [in] double fDouble,
242                             [in] TestEnum eEnum, [in] string aString,
243                             [in] com::sun::star::uno::XInterface xInterface, [in] any aAny,
244                             [in] sequence< TestElement > aSequence,
245                             [in] TestData aStruct );
246    /**
247     * inout parameter test
248     *
249     * @return aStruct. The out parameter contain the values, that were previously set
250     *         by setValues or (if not called before) default constructed values.
251     *
252     */
253    TestData setValues2( [inout] boolean bBool, [inout] char cChar, [inout] byte nByte,
254                         [inout] short nShort, [inout] unsigned short nUShort,
255                         [inout] long nLong, [inout] unsigned long nULong,
256                         [inout] hyper nHyper, [inout] unsigned hyper nUHyper,
257                         [inout] float fFloat, [inout] double fDouble,
258                         [inout] TestEnum eEnum, [inout] string aString,
259                         [inout] com::sun::star::uno::XInterface xInterface, [inout] any aAny,
260                         [inout] sequence< TestElement > aSequence,
261                         [inout] TestData aStruct );
262
263    /**
264     * out parameter test
265     */
266    TestData getValues( [out] boolean bBool, [out] char cChar, [out] byte nByte,
267                        [out] short nShort, [out] unsigned short nUShort,
268                        [out] long nLong, [out] unsigned long nULong,
269                        [out] hyper nHyper, [out] unsigned hyper nUHyper,
270                        [out] float fFloat, [out] double fDouble,
271                        [out] TestEnum eEnum, [out] string aString,
272                        [out] com::sun::star::uno::XInterface xInterface, [out] any aAny,
273                        [out] sequence< TestElement > aSequence,
274                        [out] TestData aStruct );
275
276    /**
277     * register return test 1
278     */
279    SmallStruct echoSmallStruct( [in] SmallStruct aStruct );
280
281    /**
282     * register return test 2
283     */
284    MediumStruct echoMediumStruct( [in] MediumStruct aStruct );
285
286    /**
287     * register return test 3
288     */
289    BigStruct echoBigStruct( [in] BigStruct aStruct );
290
291    /**
292     * register return test 4
293     */
294    AllFloats echoAllFloats( [in] AllFloats aStruct );
295    TwoFloats echoTwoFloats( [in] TwoFloats aStruct );
296    ThreeDoubles echoThreeDoubles( [in] ThreeDoubles aStruct );
297    MixedFloatLong echoMixedFloatLong( [in] MixedFloatLong aStruct );
298
299    OneByte echoOneByte( [in] OneByte aStruct );
300    ThreeLongs echoThreeLongs( [in] ThreeLongs aStruct );
301
302    /**
303     * register return test 4 (i107182)
304     */
305    long testPPCAlignment( [in] hyper l1, [in] hyper l2, [in] long i1, [in] hyper l3, [in] long i2 );
306
307    hyper testPackedStack(
308        [in] hyper a0, [in] hyper a1, [in] hyper a2, [in] hyper a3,
309        [in] hyper a4, [in] hyper a5, [in] hyper a6,
310        [in] byte b, [in] byte c, [in] short s, [in] long l,
311        [in] byte d, [in] hyper h );
312
313    double testFpStack(
314        [in] double a0, [in] double a1, [in] double a2, [in] double a3,
315        [in] double a4, [in] double a5, [in] double a6, [in] double a7,
316        [in] float f8, [in] double d9 );
317
318    [attribute] boolean                  Bool;
319    [attribute] byte                     Byte;
320    [attribute] char                     Char;
321    [attribute] short                    Short;
322    [attribute] unsigned short           UShort;
323    [attribute] long                     Long;
324    [attribute] unsigned long            ULong;
325    [attribute] hyper                    Hyper;
326    [attribute] unsigned hyper           UHyper;
327    [attribute] float                    Float;
328    [attribute] double                   Double;
329    [attribute] TestEnum                 Enum;
330    [attribute] string                   String;
331    [attribute] com::sun::star::uno::XInterface Interface;
332    [attribute] any                      Any;
333    [attribute] sequence< TestElement >  Sequence;
334    [attribute] TestData                 Struct;
335
336    [attribute] long RaiseAttr1 {
337        set raises (com::sun::star::lang::IllegalArgumentException);
338    };
339    [attribute, readonly] long RaiseAttr2 {
340        get raises (com::sun::star::lang::IllegalArgumentException);
341    };
342
343    TestPolyStruct<boolean> transportPolyBoolean(
344        [in] TestPolyStruct<boolean> arg);
345    void transportPolyHyper([inout] TestPolyStruct<hyper> arg);
346    void transportPolySequence(
347        [in] TestPolyStruct<sequence<any> > arg1,
348        [out] TestPolyStruct<sequence<any> > arg2);
349
350    TestPolyStruct<long> getNullPolyLong();
351    TestPolyStruct<string> getNullPolyString();
352    TestPolyStruct<type> getNullPolyType();
353    TestPolyStruct<any> getNullPolyAny();
354    TestPolyStruct<sequence<boolean> > getNullPolySequence();
355    TestPolyStruct<TestEnum> getNullPolyEnum();
356    TestPolyStruct<TestBadEnum> getNullPolyBadEnum();
357    TestPolyStruct<TestStruct> getNullPolyStruct();
358    TestPolyStruct<XBridgeTestBase> getNullPolyInterface();
359
360    /***
361     * This method returns the parameter value.
362     * Method to extensively test anys.
363     ****/
364    any transportAny( [in] any value );
365
366    /***
367     * methods to check sequence of calls. Call call() and callOneway
368     * in an arbitrary sequence. Increase the callId for every call.
369     * The testobject sets an error flag.
370
371        @see testSequencePassed
372     ***/
373    void call( [in] long nCallId, [in] long nWaitMUSEC );
374    [oneway] void callOneway( [in] long nCallId, [in] long nWaitMUSEC );
375    boolean sequenceOfCallTestPassed();
376
377    /****
378     * methods to check, if threads thread identity is holded.
379     *
380     ***/
381    void startRecursiveCall( [in] XRecursiveCall xCall , [in] long nToCall );
382
383    XMulti getMulti();
384    string testMulti([in] XMulti multi);
385};
386
387
388/**
389 * Inherting from monster; adds raiseException(), attribute raising RuntimeException.
390 */
391interface XBridgeTest : XBridgeTestBase
392{
393    /**
394     * the exception struct returned has to be filled with given arguments.
395     * return value is for dummy.
396     */
397    TestData raiseException( [in] short ArgumentPosition,
398                             [in] string Message,
399                             [in] com::sun::star::uno::XInterface Context )
400        raises( com::sun::star::lang::IllegalArgumentException );
401
402
403    /**
404     * Throws runtime exception.
405     * check remote bridges handle exceptions during oneway calls properly.
406     * Note that on client side the exception may fly or not. When it flies, it should
407     * have the proper message and context.
408     ***/
409    [oneway] void raiseRuntimeExceptionOneway(  [in] string Message,
410                                                [in] com::sun::star::uno::XInterface Context );
411
412    /**
413     * raises runtime exception;
414     * the exception struct returned has to be filled with formerly set test data.
415     */
416    [attribute] long                     RuntimeException;
417};
418
419
420exception BadConstructorArguments: com::sun::star::uno::Exception {};
421
422service Constructors: com::sun::star::uno::XInterface {
423    create1(
424        [in] boolean arg0,
425        [in] byte arg1,
426        [in] short arg2,
427        [in] unsigned short arg3,
428        [in] long arg4,
429        [in] unsigned long arg5,
430        [in] hyper arg6,
431        [in] unsigned hyper arg7,
432        [in] float arg8,
433        [in] double arg9,
434        [in] char arg10,
435        [in] string arg11,
436        [in] type arg12,
437        [in] any arg13,
438        [in] sequence< boolean > arg14,
439        [in] sequence< byte > arg15,
440        [in] sequence< short > arg16,
441        [in] sequence< unsigned short > arg17,
442        [in] sequence< long > arg18,
443        [in] sequence< unsigned long > arg19,
444        [in] sequence< hyper > arg20,
445        [in] sequence< unsigned hyper > arg21,
446        [in] sequence< float > arg22,
447        [in] sequence< double > arg23,
448        [in] sequence< char > arg24,
449        [in] sequence< string > arg25,
450        [in] sequence< type > arg26,
451        [in] sequence< any > arg27,
452        [in] sequence< sequence< boolean > > arg28,
453        [in] sequence< sequence< any > > arg29,
454        [in] sequence< TestEnum > arg30,
455        [in] sequence< TestStruct > arg31,
456        [in] sequence< TestPolyStruct< boolean > > arg32,
457        [in] sequence< TestPolyStruct< any > > arg33,
458        [in] sequence< com::sun::star::uno::XInterface > arg34,
459        [in] TestEnum arg35,
460        [in] TestStruct arg36,
461        [in] TestPolyStruct< boolean > arg37,
462        [in] TestPolyStruct< any > arg38,
463        [in] com::sun::star::uno::XInterface arg39)
464        raises (BadConstructorArguments);
465
466    create2([in] any... args) raises (BadConstructorArguments);
467
468};
469
470service Constructors2: XMultiBase1 {
471
472    create1(
473        [in] TestPolyStruct<type> arg1,
474        [in] TestPolyStruct<any> arg2,
475        [in] TestPolyStruct<boolean> arg3,
476        [in] TestPolyStruct<byte> arg4,
477        [in] TestPolyStruct<short> arg5,
478        [in] TestPolyStruct<long> arg6,
479        [in] TestPolyStruct<hyper> arg7,
480        [in] TestPolyStruct<char> arg8,
481        [in] TestPolyStruct<string> arg9,
482        [in] TestPolyStruct<float> arg10,
483        [in] TestPolyStruct<double> arg11,
484        [in] TestPolyStruct<com::sun::star::uno::XInterface> arg12,
485        [in] TestPolyStruct<com::sun::star::lang::XComponent> arg13,
486        [in] TestPolyStruct<TestEnum> arg14,
487        [in] TestPolyStruct<TestPolyStruct2<char,any> > arg15,
488        [in] TestPolyStruct<TestPolyStruct2<TestPolyStruct2<char,any>,string> > arg16,
489        [in] TestPolyStruct2<string, TestPolyStruct2<char, TestPolyStruct<any> > > arg17,
490        [in] TestPolyStruct2<TestPolyStruct2<char,any>, TestPolyStruct<char> > arg18,
491        [in] TestPolyStruct<sequence<type> > arg19,
492        [in] TestPolyStruct<sequence<any> > arg20,
493        [in] TestPolyStruct<sequence<boolean> > arg21,
494        [in] TestPolyStruct<sequence<byte> > arg22,
495        [in] TestPolyStruct<sequence<short> > arg23,
496        [in] TestPolyStruct<sequence<long> > arg24,
497        [in] TestPolyStruct<sequence<hyper> > arg25,
498        [in] TestPolyStruct<sequence<char> > arg26,
499        [in] TestPolyStruct<sequence<string> > arg27,
500        [in] TestPolyStruct<sequence<float> > arg28,
501        [in] TestPolyStruct<sequence<double> > arg29,
502        [in] TestPolyStruct<sequence<com::sun::star::uno::XInterface> > arg30,
503        [in] TestPolyStruct<sequence<com::sun::star::lang::XComponent> > arg31,
504        [in] TestPolyStruct<sequence<TestEnum> > arg32,
505        [in] TestPolyStruct<sequence<TestPolyStruct2<char, sequence<any> > > > arg33,
506        [in] TestPolyStruct<sequence<TestPolyStruct2<TestPolyStruct<char>, sequence<any> > > > arg34,
507        [in] TestPolyStruct<sequence<sequence<long> > > arg35,
508        [in] sequence<TestPolyStruct<long > > arg36,
509        [in] sequence<TestPolyStruct<TestPolyStruct2<char,any> > > arg37,
510        [in] sequence<TestPolyStruct<TestPolyStruct2<TestPolyStruct2<char,any>,string> > > arg38,
511        [in] sequence<TestPolyStruct2<string, TestPolyStruct2<char, TestPolyStruct<any> > > > arg39,
512        [in] sequence<TestPolyStruct2<TestPolyStruct2<char,any>, TestPolyStruct<char> > > arg40,
513        [in] sequence<sequence<TestPolyStruct< char > > > arg41,
514        [in] sequence<sequence<TestPolyStruct<TestPolyStruct2<char,any> > > >arg42,
515        [in] sequence<sequence<TestPolyStruct<TestPolyStruct2<TestPolyStruct2<char,any>,string> > > > arg43,
516        [in] sequence<sequence<TestPolyStruct2<string, TestPolyStruct2<char, TestPolyStruct<any> > > > > arg44,
517        [in] sequence<sequence<TestPolyStruct2<TestPolyStruct2<char,any>, TestPolyStruct<char> > > > arg45
518        );
519};
520
521interface XCurrentContextChecker {
522    boolean perform(
523        [in] XCurrentContextChecker other, [in] long setSteps,
524        [in] long checkSteps);
525};
526
527/** Extended tests with sequences.
528 */
529interface XBridgeTest2 : XBridgeTest
530{
531    sequence< boolean > setSequenceBool( [in] sequence< boolean > aSeq);
532    sequence< char > setSequenceChar( [in] sequence< char > aSeq);
533    sequence< byte> setSequenceByte( [in] sequence< byte > aSeq);
534    sequence< short> setSequenceShort( [in] sequence< short > aSeq);
535    sequence< unsigned short > setSequenceUShort( [in] sequence< unsigned short > aSeq);
536    sequence< long > setSequenceLong( [in] sequence< long > aSeq);
537    sequence< unsigned long > setSequenceULong( [in] sequence< unsigned long > aSeq);
538    sequence< hyper > setSequenceHyper( [in] sequence< hyper > aSeq);
539    sequence< unsigned hyper > setSequenceUHyper( [in] sequence< unsigned hyper > aSeq);
540    sequence< float > setSequenceFloat( [in] sequence< float > aSeq);
541    sequence< double > setSequenceDouble( [in] sequence< double > aSeq);
542    sequence< TestEnum > setSequenceEnum( [in] sequence< TestEnum > aSeq);
543    sequence< string > setSequenceString( [in] sequence< string > aString);
544    sequence< com::sun::star::uno::XInterface > setSequenceXInterface(
545        [in] sequence< com::sun::star::uno::XInterface > aSeq);
546    sequence< any > setSequenceAny( [in] sequence< any > aSeq);
547    sequence< TestElement > setSequenceStruct( [in] sequence< TestElement > aSeq);
548
549    sequence< sequence< long > > setDim2( [in] sequence< sequence< long > > aSeq);
550    sequence< sequence < sequence < long > > > setDim3(
551        [in] sequence< sequence < sequence < long > > > aSeq);
552
553    void setSequencesInOut( [inout] sequence< boolean > aSeqBoolean,
554                       [inout] sequence< char > aSeqChar,
555                       [inout] sequence< byte > aSeqByte,
556                       [inout] sequence< short > aSeqShort,
557                       [inout] sequence< unsigned short> aSeqUShort,
558                       [inout] sequence< long > aSeqLong,
559                       [inout] sequence< unsigned long > aSeqULong,
560                       [inout] sequence< hyper > aSeqHyper,
561                       [inout] sequence< unsigned hyper > aSeqUHyper,
562                       [inout] sequence< float > aSeqFloat,
563                       [inout] sequence< double > aSeqDouble,
564                       [inout] sequence< TestEnum > aSeqEnum,
565                       [inout] sequence< string > aSeqString,
566                       [inout] sequence< com::sun::star::uno::XInterface > aSeqXInterface,
567                       [inout] sequence< any > aSeqAny,
568                       [inout] sequence< sequence< long > > aSeqDim2,
569                       [inout] sequence< sequence < sequence < long > > > aSeqDim3);
570
571    void setSequencesOut( [out] sequence< boolean > aSeqBoolean,
572                       [out] sequence< char > aSeqChar,
573                       [out] sequence< byte > aSeqByte,
574                       [out] sequence< short > aSeqShort,
575                       [out] sequence< unsigned short> aSeqUShort,
576                       [out] sequence< long > aSeqLong,
577                       [out] sequence< unsigned long > aSeqULong,
578                       [out] sequence< hyper > aSeqHyper,
579                       [out] sequence< unsigned hyper > aSeqUHyper,
580                       [out] sequence< float > aSeqFloat,
581                       [out] sequence< double > aSeqDouble,
582                       [out] sequence< TestEnum > aSeqEnum,
583                       [out] sequence< string > aSeqString,
584                       [out] sequence< com::sun::star::uno::XInterface > aSeqXInterface,
585                       [out] sequence< any > aSeqAny,
586                       [out] sequence< sequence< long > > aSeqDim2,
587                       [out] sequence< sequence < sequence < long > > > aSeqDim3);
588
589    void testConstructorsService(
590        [in] com::sun::star::uno::XComponentContext context)
591        raises (BadConstructorArguments);
592
593    XCurrentContextChecker getCurrentContextChecker();
594};
595
596}; }; };
597