2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package com
.sun
.star
.comp
.bridge
;
21 import com
.sun
.star
.comp
.loader
.FactoryHelper
;
23 import com
.sun
.star
.lang
.XServiceInfo
;
24 import com
.sun
.star
.lang
.XTypeProvider
;
26 import com
.sun
.star
.test
.performance
.ComplexTypes
;
27 import com
.sun
.star
.test
.performance
.XPerformanceTest
;
29 import test
.testtools
.bridgetest
.BadConstructorArguments
;
30 import test
.testtools
.bridgetest
.Constructors
;
31 import test
.testtools
.bridgetest
.Constructors2
;
32 import test
.testtools
.bridgetest
.TestDataElements
;
33 import test
.testtools
.bridgetest
.TestElement
;
34 import test
.testtools
.bridgetest
.TestEnum
;
35 import test
.testtools
.bridgetest
.TestPolyStruct
;
36 import test
.testtools
.bridgetest
.TestPolyStruct2
;
37 import test
.testtools
.bridgetest
.TestStruct
;
38 import test
.testtools
.bridgetest
.SmallStruct
;
39 import test
.testtools
.bridgetest
.MediumStruct
;
40 import test
.testtools
.bridgetest
.BigStruct
;
41 import test
.testtools
.bridgetest
.TwoFloats
;
42 import test
.testtools
.bridgetest
.FourFloats
;
43 import test
.testtools
.bridgetest
.MixedFloatAndInteger
;
44 import test
.testtools
.bridgetest
.DoubleHyper
;
45 import test
.testtools
.bridgetest
.HyperDouble
;
46 import test
.testtools
.bridgetest
.FloatFloatLongByte
;
47 import test
.testtools
.bridgetest
.ThreeByteStruct
;
48 import test
.testtools
.bridgetest
.XBridgeTest
;
49 import test
.testtools
.bridgetest
.XBridgeTest2
;
50 import test
.testtools
.bridgetest
.XCurrentContextChecker
;
51 import test
.testtools
.bridgetest
.XMulti
;
52 import test
.testtools
.bridgetest
.XRecursiveCall
;
55 import com
.sun
.star
.lang
.IllegalArgumentException
;
56 import com
.sun
.star
.lang
.XMultiServiceFactory
;
57 import com
.sun
.star
.lang
.XSingleServiceFactory
;
59 import com
.sun
.star
.registry
.XRegistryKey
;
61 import com
.sun
.star
.uno
.Any
;
62 import com
.sun
.star
.uno
.Type
;
63 import com
.sun
.star
.uno
.XComponentContext
;
64 import com
.sun
.star
.uno
.XInterface
;
66 @SuppressWarnings("unchecked")
67 public class TestComponent
{
68 public static final boolean DEBUG
= false;
70 public static class _PerformancTestObject
implements XPerformanceTest
, XServiceInfo
, XTypeProvider
{
71 private static final String __serviceName
= "com.sun.star.comp.benchmark.JavaTestObject";
76 private double _double
;
77 private String _string
= "";
78 private Object _xInterface
;
80 private Object _interface_sequence
[] = new Object
[0];
81 private ComplexTypes _complexTypes
= new ComplexTypes();
84 public int getLong_attr() throws com
.sun
.star
.uno
.RuntimeException
{
88 public void setLong_attr( int _long_attr
) throws com
.sun
.star
.uno
.RuntimeException
{
92 public long getHyper_attr() throws com
.sun
.star
.uno
.RuntimeException
{
96 public void setHyper_attr( long _hyper_attr
) throws com
.sun
.star
.uno
.RuntimeException
{
100 public float getFloat_attr() throws com
.sun
.star
.uno
.RuntimeException
{
104 public void setFloat_attr( float _float_attr
) throws com
.sun
.star
.uno
.RuntimeException
{
105 _float
= _float_attr
;
108 public double getDouble_attr() throws com
.sun
.star
.uno
.RuntimeException
{
112 public void setDouble_attr( double _double_attr
) throws com
.sun
.star
.uno
.RuntimeException
{
113 _double
= _double_attr
;
116 public String
getString_attr() throws com
.sun
.star
.uno
.RuntimeException
{
120 public void setString_attr( String _string_attr
) throws com
.sun
.star
.uno
.RuntimeException
{
121 _string
= _string_attr
;
124 public Object
getInterface_attr() throws com
.sun
.star
.uno
.RuntimeException
{
128 public void setInterface_attr( java
.lang
.Object _interface_attr
) throws com
.sun
.star
.uno
.RuntimeException
{
129 _xInterface
= _interface_attr
;
132 public Object
getAny_attr() throws com
.sun
.star
.uno
.RuntimeException
{
136 public void setAny_attr(Object _any_attr
) throws com
.sun
.star
.uno
.RuntimeException
{
140 public Object
[] getSequence_attr() throws com
.sun
.star
.uno
.RuntimeException
{
141 return _interface_sequence
;
144 public void setSequence_attr(Object
[] _sequence_attr
) throws com
.sun
.star
.uno
.RuntimeException
{
145 _interface_sequence
= _sequence_attr
;
148 public ComplexTypes
getStruct_attr() throws com
.sun
.star
.uno
.RuntimeException
{
149 return _complexTypes
;
152 public void setStruct_attr( ComplexTypes _struct_attr
) throws com
.sun
.star
.uno
.RuntimeException
{
153 _complexTypes
= _struct_attr
;
158 public void async() throws com
.sun
.star
.uno
.RuntimeException
{
161 public void sync( ) throws com
.sun
.star
.uno
.RuntimeException
{
164 public ComplexTypes
complexIn( /*IN*/ComplexTypes aVal
) throws com
.sun
.star
.uno
.RuntimeException
{
168 public ComplexTypes
complexInout( /*INOUT*/ComplexTypes
[] aVal
) throws com
.sun
.star
.uno
.RuntimeException
{
172 public void complexOneway( /*IN*/ComplexTypes aVal
) throws com
.sun
.star
.uno
.RuntimeException
{
175 public void complexNoreturn( /*IN*/ComplexTypes aVal
) throws com
.sun
.star
.uno
.RuntimeException
{
178 public XPerformanceTest
createObject( ) throws com
.sun
.star
.uno
.RuntimeException
{
179 return new _PerformancTestObject();
182 public int getLong() throws com
.sun
.star
.uno
.RuntimeException
{
186 public void setLong(/*IN*/int n
) throws com
.sun
.star
.uno
.RuntimeException
{
190 public long getHyper() throws com
.sun
.star
.uno
.RuntimeException
{
194 public void setHyper(/*IN*/long n
) throws com
.sun
.star
.uno
.RuntimeException
{
198 public float getFloat() throws com
.sun
.star
.uno
.RuntimeException
{
202 public void setFloat( /*IN*/float f
) throws com
.sun
.star
.uno
.RuntimeException
{
206 public double getDouble( ) throws com
.sun
.star
.uno
.RuntimeException
{
210 public void setDouble( /*IN*/double f
) throws com
.sun
.star
.uno
.RuntimeException
{
214 public String
getString( ) throws com
.sun
.star
.uno
.RuntimeException
{
218 public void setString( /*IN*/String s
) throws com
.sun
.star
.uno
.RuntimeException
{
222 public Object
getInterface( ) throws com
.sun
.star
.uno
.RuntimeException
{
226 public void setInterface( /*IN*/Object x
) throws com
.sun
.star
.uno
.RuntimeException
{
230 public Object
getAny( ) throws com
.sun
.star
.uno
.RuntimeException
{
234 public void setAny( /*IN*/java
.lang
.Object a
) throws com
.sun
.star
.uno
.RuntimeException
{
238 public Object
[] getSequence( ) throws com
.sun
.star
.uno
.RuntimeException
{
239 return _interface_sequence
;
242 public void setSequence( /*IN*/Object
[] seq
) throws com
.sun
.star
.uno
.RuntimeException
{
243 if(DEBUG
) System
.err
.println("#### " + getClass().getName() + ".setSequence:" + seq
);
245 _interface_sequence
= seq
;
248 public ComplexTypes
getStruct( ) throws com
.sun
.star
.uno
.RuntimeException
{
249 return _complexTypes
;
252 public void setStruct( /*IN*/ComplexTypes c
) throws com
.sun
.star
.uno
.RuntimeException
{
256 public void raiseRuntimeException( ) throws com
.sun
.star
.uno
.RuntimeException
{
257 throw new com
.sun
.star
.uno
.RuntimeException();
261 public String
getImplementationName() throws com
.sun
.star
.uno
.RuntimeException
{
262 return __serviceName
;
265 public boolean supportsService(String rServiceName
) throws com
.sun
.star
.uno
.RuntimeException
{
266 String rSNL
[] = getSupportedServiceNames();
268 for(int nPos
= rSNL
.length
; (nPos
--) != 0;) {
269 if (rSNL
[nPos
].equals(rServiceName
))
276 public String
[] getSupportedServiceNames() throws com
.sun
.star
.uno
.RuntimeException
{
277 return new String
[]{__serviceName
};
281 public Type
[] getTypes() throws com
.sun
.star
.uno
.RuntimeException
{
283 return new Type
[]{new Type(XPerformanceTest
.class), new Type(XServiceInfo
.class), new Type(XTypeProvider
.class)};
285 catch(Exception exception
) {
286 throw new com
.sun
.star
.uno
.RuntimeException(exception
);
290 public byte[] getImplementationId() throws com
.sun
.star
.uno
.RuntimeException
{
295 public static class _TestObject
implements XBridgeTest2
, XRecursiveCall
, XServiceInfo
, XTypeProvider
{
296 private static final String __serviceName
= "com.sun.star.test.bridge.JavaTestObject";
298 private boolean _bool
;
301 private short _short
;
302 private short _ushort
;
306 private long _uhyper
;
307 private float _float
;
308 private double _double
;
309 private String _string
;
311 private short _short2
;
312 private Object _xInterface
;
314 private TestEnum _testEnum
= TestEnum
.TEST
;
315 private TestElement _testElements
[] = new TestElement
[0];
316 private TestDataElements _testDataElements
= new TestDataElements();
318 private int _nLastCallId
;
319 private boolean _bFirstCall
;
320 private boolean _bSequenceOfCallTestPassed
;
322 private boolean[] arBool
;
323 private char[] arChar
;
324 private byte[] arByte
;
325 private short[] arShort
;
326 private short[] arUShort
;
327 private int[] arLong
;
328 private int[] arULong
;
329 private long[] arHyper
;
330 private long[] arUHyper
;
331 private float[] arFloat
;
332 private double[] arDouble
;
333 private String
[] arString
;
334 private Object
[] arObject
;
335 private Object
[] arAny
;
336 private TestEnum
[] arEnum
;
337 private int[][] arLong2
;
338 private int[][][] arLong3
;
339 public _TestObject(XMultiServiceFactory xMultiServiceFactory
) {
340 if(DEBUG
) System
.err
.println("##### " + getClass().getName() + ".<init> " + xMultiServiceFactory
);
344 _bSequenceOfCallTestPassed
= true;
348 public void setValues(boolean bBool
,
365 TestElement testElements
[],
366 TestDataElements testDataElements
) throws com
.sun
.star
.uno
.RuntimeException
368 if(DEBUG
) System
.err
.println("##### " + getClass().getName() + ".setValues:" + any
);
381 _testEnum
= testEnum
;
385 _xInterface
= xInterface
;
387 _testElements
= testElements
;
388 _testDataElements
= testDataElements
;
393 public TestDataElements
setValues2(/*INOUT*/boolean[] io_bool
,
394 /*INOUT*/char[] io_char
,
395 /*INOUT*/byte[] io_byte
,
396 /*INOUT*/short[] io_short
,
397 /*INOUT*/short[] io_ushort
,
398 /*INOUT*/int[] io_long
,
399 /*INOUT*/int[] io_ulong
,
400 /*INOUT*/long[] io_hyper
,
401 /*INOUT*/long[] io_uhyper
,
402 /*INOUT*/float[] io_float
,
403 /*INOUT*/double[] io_double
,
404 /*INOUT*/TestEnum
[] io_testEnum
,
405 /*INOUT*/String
[] io_string
,
406 /*INOUT*/byte[] io_byte2
,
407 /*INOUT*/short[] io_short2
,
408 /*INOUT*/Object
[] io_xInterface
,
409 /*INOUT*/Object
[] io_any
,
410 /*INOUT*/TestElement
[][] io_testElements
,
411 /*INOUT*/TestDataElements
[] io_testDataElements
) throws com
.sun
.star
.uno
.RuntimeException
413 if(DEBUG
) System
.err
.println("##### " + getClass().getName() + ".setValues2:" + io_any
[0]);
418 _short
= io_short
[0];
419 _ushort
= io_ushort
[0];
421 _ulong
= io_ulong
[0];
422 _hyper
= io_hyper
[0];
423 _uhyper
= io_uhyper
[0];
424 _float
= io_float
[0];
425 _double
= io_double
[0];
426 _testEnum
= io_testEnum
[0];
427 _string
= io_string
[0];
428 _byte2
= io_byte2
[0];
429 _short2
= io_short2
[0];
430 _xInterface
= io_xInterface
[0];
432 _testElements
= io_testElements
[0];
433 _testDataElements
= io_testDataElements
[0];
435 io_testElements
[ 0 ] =
436 new TestElement
[] { io_testElements
[ 0 ][ 1 ], io_testElements
[ 0 ][ 0 ] };
438 return _testDataElements
;
441 public TestDataElements
getValues(/*OUT*/boolean[] o_bool
,
442 /*OUT*/char[] o_char
,
443 /*OUT*/byte[] o_byte
,
444 /*OUT*/short[] o_short
,
445 /*OUT*/short[] o_ushort
,
447 /*OUT*/int[] o_ulong
,
448 /*OUT*/long[] o_hyper
,
449 /*OUT*/long[] o_uhyper
,
450 /*OUT*/float[] o_float
,
451 /*OUT*/double[] o_double
,
452 /*OUT*/TestEnum
[] o_testEnum
,
453 /*OUT*/String
[] o_string
,
454 /*OUT*/byte[] o_byte2
,
455 /*OUT*/short[] o_short2
,
456 /*OUT*/Object
[] o_xInterface
,
457 /*OUT*/Object
[] o_any
,
458 /*OUT*/TestElement
[][] o_testElements
,
459 /*OUT*/TestDataElements
[] o_testDataElements
) throws com
.sun
.star
.uno
.RuntimeException
461 if(DEBUG
) System
.err
.println("##### " + getClass().getName() + ".getValues:" + _any
);
467 o_ushort
[0] = _ushort
;
471 o_uhyper
[0] = _uhyper
;
473 o_double
[0] = _double
;
474 o_testEnum
[0] = _testEnum
;
475 o_string
[0] = _string
;
477 o_short2
[0] = _short2
;
478 o_xInterface
[0] = _xInterface
;
480 o_testElements
[0] = _testElements
;
481 o_testDataElements
[0] = _testDataElements
;
483 return _testDataElements
;
486 public SmallStruct
echoSmallStruct( SmallStruct i_Struct
) throws com
.sun
.star
.uno
.RuntimeException
{
490 public MediumStruct
echoMediumStruct( MediumStruct i_Struct
) throws com
.sun
.star
.uno
.RuntimeException
{
494 public BigStruct
echoBigStruct( BigStruct i_Struct
) throws com
.sun
.star
.uno
.RuntimeException
{
498 public TwoFloats
echoTwoFloats( TwoFloats i_Struct
) throws com
.sun
.star
.uno
.RuntimeException
{
502 public FourFloats
echoFourFloats( FourFloats i_Struct
) throws com
.sun
.star
.uno
.RuntimeException
{
506 public MixedFloatAndInteger
echoMixedFloatAndInteger( MixedFloatAndInteger i_Struct
) throws com
.sun
.star
.uno
.RuntimeException
{
510 public DoubleHyper
echoDoubleHyper(DoubleHyper s
) throws com
.sun
.star
.uno
.RuntimeException
{
514 public HyperDouble
echoHyperDouble(HyperDouble s
) throws com
.sun
.star
.uno
.RuntimeException
{
518 public FloatFloatLongByte
echoFloatFloatLongByte(FloatFloatLongByte s
)
519 throws com
.sun
.star
.uno
.RuntimeException
524 public ThreeByteStruct
echoThreeByteStruct( ThreeByteStruct i_Struct
) throws com
.sun
.star
.uno
.RuntimeException
{
528 public int testPPCAlignment( long l1
, long l2
, int i1
, long l3
, int i2
) throws com
.sun
.star
.uno
.RuntimeException
{
532 public int testPPC64Alignment( double d1
, double d2
, double d3
, int i1
) throws com
.sun
.star
.uno
.RuntimeException
{
536 public double testTenDoubles( double d1
, double d2
, double d3
, double d4
, double d5
, double d6
, double d7
, double d8
, double d9
, double d10
) {
537 return d1
+ d2
+ d3
+ d4
+ d5
+ d6
+ d7
+ d8
+ d9
+ d10
;
541 public boolean getBool() throws com
.sun
.star
.uno
.RuntimeException
{
545 public void setBool(boolean bool
) throws com
.sun
.star
.uno
.RuntimeException
{
549 public byte getByte() throws com
.sun
.star
.uno
.RuntimeException
{
553 public void setByte(byte zbyte
) throws com
.sun
.star
.uno
.RuntimeException
{
557 public char getChar() throws com
.sun
.star
.uno
.RuntimeException
{
561 public void setChar(char zchar
) throws com
.sun
.star
.uno
.RuntimeException
{
565 public short getShort() throws com
.sun
.star
.uno
.RuntimeException
{
569 public void setShort(short zshort
) throws com
.sun
.star
.uno
.RuntimeException
{
573 public short getUShort() throws com
.sun
.star
.uno
.RuntimeException
{
577 public void setUShort(short ushort
) throws com
.sun
.star
.uno
.RuntimeException
{
581 public int getLong() throws com
.sun
.star
.uno
.RuntimeException
{
585 public void setLong(int zint
) throws com
.sun
.star
.uno
.RuntimeException
{
589 public int getULong() throws com
.sun
.star
.uno
.RuntimeException
{
593 public void setULong(int uint
) throws com
.sun
.star
.uno
.RuntimeException
{
597 public long getHyper() throws com
.sun
.star
.uno
.RuntimeException
{
601 public void setHyper(long hyper
) throws com
.sun
.star
.uno
.RuntimeException
{
605 public long getUHyper() throws com
.sun
.star
.uno
.RuntimeException
{
609 public void setUHyper(long uhyper
) throws com
.sun
.star
.uno
.RuntimeException
{
613 public float getFloat() throws com
.sun
.star
.uno
.RuntimeException
{
617 public void setFloat(float zfloat
) throws com
.sun
.star
.uno
.RuntimeException
{
621 public double getDouble() throws com
.sun
.star
.uno
.RuntimeException
{
625 public void setDouble(double zdouble
) throws com
.sun
.star
.uno
.RuntimeException
{
629 public TestEnum
getEnum() throws com
.sun
.star
.uno
.RuntimeException
{
633 public void setEnum(TestEnum testEnum
) throws com
.sun
.star
.uno
.RuntimeException
{
634 _testEnum
= testEnum
;
637 public String
getString() throws com
.sun
.star
.uno
.RuntimeException
{
641 public void setString(String string
) throws com
.sun
.star
.uno
.RuntimeException
{
645 public byte getByte2() throws com
.sun
.star
.uno
.RuntimeException
{
649 public void setByte2(byte zbyte
) throws com
.sun
.star
.uno
.RuntimeException
{
653 public short getShort2() throws com
.sun
.star
.uno
.RuntimeException
{
657 public void setShort2(short zshort
) throws com
.sun
.star
.uno
.RuntimeException
{
661 public Object
getInterface() throws com
.sun
.star
.uno
.RuntimeException
{
665 public void setInterface(Object zinterface
) throws com
.sun
.star
.uno
.RuntimeException
{
666 _xInterface
= zinterface
;
669 public Object
getAny() throws com
.sun
.star
.uno
.RuntimeException
{
670 if(DEBUG
) System
.err
.println("##### " + getClass().getName() + ".setAny:" + _any
);
675 public void setAny(Object any
) throws com
.sun
.star
.uno
.RuntimeException
{
676 if(DEBUG
) System
.err
.println("##### " + getClass().getName() + ".setAny:" + any
);
681 public TestElement
[] getSequence() throws com
.sun
.star
.uno
.RuntimeException
{
682 return _testElements
;
685 public void setSequence(TestElement testElements
[]) throws com
.sun
.star
.uno
.RuntimeException
{
686 _testElements
= testElements
;
689 public TestDataElements
getStruct() throws com
.sun
.star
.uno
.RuntimeException
{
690 return _testDataElements
;
693 public void setStruct(TestDataElements testDataElements
) throws com
.sun
.star
.uno
.RuntimeException
{
694 _testDataElements
= testDataElements
;
697 public int getRaiseAttr1() {
698 throw new com
.sun
.star
.uno
.RuntimeException();
701 public void setRaiseAttr1(int n
) throws IllegalArgumentException
{
702 throw new IllegalArgumentException();
705 public int getRaiseAttr2() throws IllegalArgumentException
{
706 throw new IllegalArgumentException();
709 public TestPolyStruct
transportPolyBoolean(TestPolyStruct arg
) {
710 Boolean dummy
= (Boolean
) arg
.member
;
714 public void transportPolyHyper(TestPolyStruct
[] arg
) {
715 Long dummy
= (Long
) arg
[0].member
;
718 public void transportPolySequence(
719 TestPolyStruct arg1
, TestPolyStruct
[] arg2
)
721 Object
[] dummy
= (Object
[]) arg1
.member
;
725 public TestPolyStruct
getNullPolyLong() {
726 return new TestPolyStruct();
729 public TestPolyStruct
getNullPolyString() {
730 return new TestPolyStruct();
733 public TestPolyStruct
getNullPolyType() {
734 return new TestPolyStruct();
737 public TestPolyStruct
getNullPolyAny() {
738 return new TestPolyStruct();
741 public TestPolyStruct
getNullPolySequence() {
742 return new TestPolyStruct();
745 public TestPolyStruct
getNullPolyEnum() {
746 return new TestPolyStruct();
749 public TestPolyStruct
getNullPolyBadEnum() {
750 return new TestPolyStruct();
753 public TestPolyStruct
getNullPolyStruct() {
754 return new TestPolyStruct();
757 public TestPolyStruct
getNullPolyInterface() {
758 return new TestPolyStruct();
761 public Object
transportAny(Object value
) throws com
.sun
.star
.uno
.RuntimeException
{
765 public void call(int nCallId
, int nWaitMUSEC
) throws com
.sun
.star
.uno
.RuntimeException
{
767 Thread
.sleep(nWaitMUSEC
/ 10000);
769 catch(InterruptedException interruptedException
) {
770 throw new com
.sun
.star
.uno
.RuntimeException(interruptedException
);
777 _bSequenceOfCallTestPassed
= _bSequenceOfCallTestPassed
&& (nCallId
> _nLastCallId
);
779 _nLastCallId
= nCallId
;
782 public void callOneway( int nCallId
, int nWaitMUSEC
) throws com
.sun
.star
.uno
.RuntimeException
{
784 Thread
.sleep(nWaitMUSEC
/ 10000);
786 catch(InterruptedException interruptedException
) {
787 throw new com
.sun
.star
.uno
.RuntimeException(interruptedException
);
790 _bSequenceOfCallTestPassed
= _bSequenceOfCallTestPassed
&& (nCallId
> _nLastCallId
);
791 _nLastCallId
= nCallId
;
794 public boolean sequenceOfCallTestPassed() throws com
.sun
.star
.uno
.RuntimeException
{
795 return _bSequenceOfCallTestPassed
;
798 public synchronized void callRecursivly(XRecursiveCall xCall
, int nToCall
) throws com
.sun
.star
.uno
.RuntimeException
{
802 xCall
.callRecursivly(this , nToCall
);
806 public synchronized void startRecursiveCall(XRecursiveCall xCall
, int nToCall
) throws com
.sun
.star
.uno
.RuntimeException
{
810 xCall
.callRecursivly( this , nToCall
);
814 public XMulti
getMulti() {
815 return new XMulti() {
816 public double getatt1() {
820 public void setatt1(double value
) {
824 public int fn11(int arg
) {
828 public String
fn12(String arg
) {
832 public int fn21(int arg
) {
836 public String
fn22(String arg
) {
840 public double getatt3() {
844 public void setatt3(double value
) {
848 public int fn31(int arg
) {
852 public String
fn32(String arg
) {
860 public int fn41(int arg
) {
864 public int fn61(int arg
) {
868 public String
fn62(String arg
) {
872 public int fn71(int arg
) {
876 public String
fn72(String arg
) {
884 private double attribute1
= 0.0;
885 private double attribute3
= 0.0;
889 private static final class CheckFailed
extends Exception
{
890 CheckFailed(String message
) {
895 private static void checkEqual(int value
, int argument
)
898 if (argument
!= value
) {
899 throw new CheckFailed(value
+ " != " + argument
);
903 private static void checkEqual(double value
, double argument
)
906 if (argument
!= value
) {
907 throw new CheckFailed(value
+ " != " + argument
);
911 private static void checkEqual(String value
, String argument
)
914 if (!argument
.equals(value
)) {
915 throw new CheckFailed(value
+ " != " + argument
);
919 public String
testMulti(XMulti multi
) {
921 checkEqual(0.0, multi
.getatt1());
923 checkEqual(0.1, multi
.getatt1());
924 checkEqual(11 * 1, multi
.fn11(1));
925 checkEqual("12" + "abc", multi
.fn12("abc"));
926 checkEqual(21 * 2, multi
.fn21(2));
927 checkEqual("22" + "de", multi
.fn22("de"));
928 checkEqual(0.0, multi
.getatt3());
930 checkEqual(0.3, multi
.getatt3());
931 checkEqual(31 * 3, multi
.fn31(3));
932 checkEqual("32" + "f", multi
.fn32("f"));
933 checkEqual(33, multi
.fn33());
934 checkEqual(41 * 4, multi
.fn41(4));
935 checkEqual(61 * 6, multi
.fn61(6));
936 checkEqual("62", multi
.fn62(""));
937 checkEqual(71 * 7, multi
.fn71(7));
938 checkEqual("72" + "g", multi
.fn72("g"));
939 checkEqual(73, multi
.fn73());
940 } catch (CheckFailed f
) {
941 return f
.getMessage();
947 public TestDataElements
raiseException(short nArgumentPos
, String rMsg
, Object xContext
)
948 throws com
.sun
.star
.lang
.IllegalArgumentException
,
949 com
.sun
.star
.uno
.RuntimeException
951 throw new com
.sun
.star
.lang
.IllegalArgumentException(rMsg
, xContext
, nArgumentPos
);
954 public void raiseRuntimeExceptionOneway(String rMsg
, Object xContext
) throws com
.sun
.star
.uno
.RuntimeException
{
955 throw new com
.sun
.star
.uno
.RuntimeException(rMsg
, xContext
);
958 private void dothrow( com
.sun
.star
.uno
.RuntimeException t
)
959 throws com
.sun
.star
.uno
.RuntimeException
963 public int getRuntimeException()
964 throws com
.sun
.star
.uno
.RuntimeException
966 dothrow( new com
.sun
.star
.uno
.RuntimeException(
967 _string
, _xInterface
) );
971 public void setRuntimeException(int _runtimeexception
) throws com
.sun
.star
.uno
.RuntimeException
{
972 throw new com
.sun
.star
.uno
.RuntimeException(_string
, _xInterface
);
978 public String
getImplementationName() throws com
.sun
.star
.uno
.RuntimeException
{
979 return __serviceName
;
982 public boolean supportsService(String rServiceName
) throws com
.sun
.star
.uno
.RuntimeException
{
983 String rSNL
[] = getSupportedServiceNames();
985 for(int nPos
= rSNL
.length
; (nPos
--) != 0;) {
986 if (rSNL
[nPos
].equals(rServiceName
))
993 public String
[] getSupportedServiceNames() throws com
.sun
.star
.uno
.RuntimeException
{
994 return new String
[]{__serviceName
};
998 public Type
[] getTypes() throws com
.sun
.star
.uno
.RuntimeException
{
1000 return new Type
[]{new Type(XBridgeTest
.class), new Type(XRecursiveCall
.class), new Type(XServiceInfo
.class), new Type(XTypeProvider
.class)};
1002 catch(Exception exception
) {
1003 throw new com
.sun
.star
.uno
.RuntimeException(exception
);
1007 public byte[] getImplementationId() throws com
.sun
.star
.uno
.RuntimeException
{
1012 public boolean[] setSequenceBool( /*IN*/boolean[] aSeq
)
1017 public char[] setSequenceChar( /*IN*/char[] aSeq
)
1022 public byte[] setSequenceByte( /*IN*/byte[] aSeq
)
1027 public short[] setSequenceShort( /*IN*/short[] aSeq
)
1032 public short[] setSequenceUShort( /*IN*/short[] aSeq
)
1037 public int[] setSequenceLong( /*IN*/int[] aSeq
)
1042 public int[] setSequenceULong( /*IN*/int[] aSeq
)
1047 public long[] setSequenceHyper( /*IN*/long[] aSeq
)
1052 public long[] setSequenceUHyper( /*IN*/long[] aSeq
)
1057 public float[] setSequenceFloat( /*IN*/float[] aSeq
)
1062 public double[] setSequenceDouble( /*IN*/double[] aSeq
)
1067 public TestEnum
[] setSequenceEnum( /*IN*/TestEnum
[] aSeq
)
1072 public String
[] setSequenceString( /*IN*/String
[] aSeq
)
1077 public java
.lang
.Object
[] setSequenceXInterface( /*IN*/java
.lang
.Object
[] aSeq
)
1082 public java
.lang
.Object
[] setSequenceAny( /*IN*/java
.lang
.Object
[] aSeq
)
1087 public TestElement
[] setSequenceStruct( /*IN*/TestElement
[] aSeq
)
1089 _testElements
= aSeq
;
1092 public int[][] setDim2( /*IN*/int[][] aSeq
)
1097 public int[][][] setDim3( /*IN*/int[][][] aSeq
)
1102 public void setSequencesInOut( /*INOUT*/boolean[][] aSeqBoolean
,
1103 /*INOUT*/char[][] aSeqChar
, /*INOUT*/byte[][] aSeqByte
,
1104 /*INOUT*/short[][] aSeqShort
, /*INOUT*/short[][] aSeqUShort
,
1105 /*INOUT*/int[][] aSeqLong
, /*INOUT*/int[][] aSeqULong
,
1106 /*INOUT*/long[][] aSeqHyper
, /*INOUT*/long[][] aSeqUHyper
,
1107 /*INOUT*/float[][] aSeqFloat
, /*INOUT*/double[][] aSeqDouble
,
1108 /*INOUT*/TestEnum
[][] aSeqEnum
, /*INOUT*/String
[][] aSeqString
,
1109 /*INOUT*/java
.lang
.Object
[][] aSeqXInterface
,
1110 /*INOUT*/java
.lang
.Object
[][] aSeqAny
,
1111 /*INOUT*/int[][][] aSeqDim2
, /*INOUT*/int[][][][] aSeqDim3
)
1113 arBool
= aSeqBoolean
[0];
1114 arChar
= aSeqChar
[0];
1115 arByte
= aSeqByte
[0];
1116 arShort
= aSeqShort
[0];
1117 arUShort
= aSeqUShort
[0];
1118 arLong
= aSeqLong
[0];
1119 arULong
= aSeqULong
[0];
1120 arFloat
= aSeqFloat
[0];
1121 arDouble
= aSeqDouble
[0];
1122 arEnum
= aSeqEnum
[0];
1123 arString
= aSeqString
[0];
1124 arObject
= aSeqXInterface
[0];
1126 arLong2
= aSeqDim2
[0];
1127 arLong3
= aSeqDim3
[0];
1129 public void setSequencesOut( /*OUT*/boolean[][] aSeqBoolean
, /*OUT*/char[][] aSeqChar
,
1130 /*OUT*/byte[][] aSeqByte
, /*OUT*/short[][] aSeqShort
,
1131 /*OUT*/short[][] aSeqUShort
, /*OUT*/int[][] aSeqLong
,
1132 /*OUT*/int[][] aSeqULong
, /*OUT*/long[][] aSeqHyper
,
1133 /*OUT*/long[][] aSeqUHyper
, /*OUT*/float[][] aSeqFloat
,
1134 /*OUT*/double[][] aSeqDouble
, /*OUT*/TestEnum
[][] aSeqEnum
,
1135 /*OUT*/String
[][] aSeqString
,
1136 /*OUT*/java
.lang
.Object
[][] aSeqXInterface
,
1137 /*OUT*/java
.lang
.Object
[][] aSeqAny
, /*OUT*/int[][][] aSeqDim2
,
1138 /*OUT*/int[][][][] aSeqDim3
)
1140 aSeqBoolean
[0] = arBool
;
1141 aSeqChar
[0] = arChar
;
1142 aSeqByte
[0] = arByte
;
1143 aSeqShort
[0] = arShort
;
1144 aSeqUShort
[0] = arUShort
;
1145 aSeqLong
[0] = arLong
;
1146 aSeqULong
[0] = arULong
;
1147 aSeqHyper
[0] = arHyper
;
1148 aSeqUHyper
[0] = arUHyper
;
1149 aSeqFloat
[0] = arFloat
;
1150 aSeqDouble
[0] = arDouble
;
1151 aSeqEnum
[0] = arEnum
;
1152 aSeqString
[0] = arString
;
1153 aSeqXInterface
[0] = arObject
;
1155 aSeqDim2
[0] = arLong2
;
1156 aSeqDim3
[0] = arLong3
;
1159 public void testConstructorsService(XComponentContext context
)
1160 throws BadConstructorArguments
1162 Constructors
.create1(context
,
1176 new Any(Type
.BOOLEAN
, Boolean
.TRUE
),
1177 new boolean[] { true },
1178 new byte[] { Byte
.MIN_VALUE
},
1179 new short[] { Short
.MIN_VALUE
},
1180 new short[] { (short) -1 },
1181 new int[] { Integer
.MIN_VALUE
},
1183 new long[] { Long
.MIN_VALUE
},
1185 new float[] { 0.123f
},
1186 new double[] { 0.456 },
1188 new String
[] { "test" },
1189 new Type
[] { Type
.ANY
},
1190 new Boolean
[] { Boolean
.TRUE
},
1191 new boolean[][] { new boolean[] { true } },
1193 new Object
[] { new Any(Type
.BOOLEAN
, Boolean
.TRUE
) } },
1194 new TestEnum
[] { TestEnum
.TWO
},
1195 new TestStruct
[] { new TestStruct(10) },
1196 new TestPolyStruct
[] { new TestPolyStruct(Boolean
.TRUE
) },
1197 new TestPolyStruct
[] {
1198 new TestPolyStruct(new Any(Type
.BOOLEAN
, Boolean
.TRUE
)) },
1199 new Object
[] { null },
1202 new TestPolyStruct(Boolean
.TRUE
),
1203 new TestPolyStruct(new Any(Type
.BOOLEAN
, Boolean
.TRUE
)),
1205 Constructors
.create2(context
, new Object
[] {
1207 Byte
.valueOf(Byte
.MIN_VALUE
),
1208 Short
.valueOf(Short
.MIN_VALUE
),
1209 new Any(Type
.UNSIGNED_SHORT
, Short
.valueOf((short) -1)),
1210 Integer
.valueOf(Integer
.MIN_VALUE
),
1211 new Any(Type
.UNSIGNED_LONG
, Integer
.valueOf(-1)),
1212 Long
.valueOf(Long
.MIN_VALUE
),
1213 new Any(Type
.UNSIGNED_HYPER
, Long
.valueOf(-1L)),
1214 Float
.valueOf(0.123f
),
1215 Double
.valueOf(0.456),
1216 Character
.valueOf('X'),
1219 new Any(Type
.BOOLEAN
, Boolean
.TRUE
),
1220 new boolean[] { true },
1221 new byte[] { Byte
.MIN_VALUE
},
1222 new short[] { Short
.MIN_VALUE
},
1224 new Type("[]unsigned short"), new short[] { (short) -1 }),
1225 new int[] { Integer
.MIN_VALUE
},
1226 new Any(new Type("[]unsigned long"), new int[] { -1 }),
1227 new long[] { Long
.MIN_VALUE
},
1228 new Any(new Type("[]unsigned hyper"), new long[] { -1L }),
1229 new float[] { 0.123f
},
1230 new double[] { 0.456 },
1232 new String
[] { "test" },
1233 new Type
[] { Type
.ANY
},
1234 new Any(new Type("[]any"), new Boolean
[] { Boolean
.TRUE
}),
1235 new boolean[][] { new boolean[] { true } },
1237 new Object
[] { new Any(Type
.BOOLEAN
, Boolean
.TRUE
) } },
1238 new TestEnum
[] { TestEnum
.TWO
},
1239 new TestStruct
[] { new TestStruct(10) },
1242 "[]test.testtools.bridgetest.TestPolyStruct<boolean>"),
1243 new TestPolyStruct
[] { new TestPolyStruct(Boolean
.TRUE
) }),
1245 new Type("[]test.testtools.bridgetest.TestPolyStruct<any>"),
1246 new TestPolyStruct
[] {
1247 new TestPolyStruct(new Any(Type
.BOOLEAN
, Boolean
.TRUE
))
1249 new XInterface
[] { null },
1254 "test.testtools.bridgetest.TestPolyStruct<boolean>"),
1255 new TestPolyStruct(Boolean
.TRUE
)),
1257 new Type("test.testtools.bridgetest.TestPolyStruct<any>"),
1258 new TestPolyStruct(new Any(Type
.BOOLEAN
, Boolean
.TRUE
))),
1260 Constructors2
.create1(
1262 new TestPolyStruct(Type
.LONG
),
1263 new TestPolyStruct(new Any(Type
.BOOLEAN
, Boolean
.TRUE
)),
1264 new TestPolyStruct(Boolean
.TRUE
),
1265 new TestPolyStruct(Byte
.valueOf(Byte
.MIN_VALUE
)),
1266 new TestPolyStruct(Short
.valueOf(Short
.MIN_VALUE
)),
1267 new TestPolyStruct(Integer
.valueOf(Integer
.MIN_VALUE
)),
1268 new TestPolyStruct(Long
.valueOf(Long
.MIN_VALUE
)),
1269 new TestPolyStruct(Character
.valueOf('X')),
1270 new TestPolyStruct("test"),
1271 new TestPolyStruct(Float
.valueOf(0.123f
)),
1272 new TestPolyStruct(Double
.valueOf(0.456)),
1273 new TestPolyStruct(new com
.sun
.star
.lib
.uno
.helper
.ComponentBase()),
1274 new TestPolyStruct(new com
.sun
.star
.lib
.uno
.helper
.ComponentBase()),
1275 new TestPolyStruct(TestEnum
.TWO
),
1276 new TestPolyStruct(new TestPolyStruct2(Character
.valueOf('X'),
1277 new Any(Type
.BOOLEAN
, Boolean
.TRUE
))),
1278 new TestPolyStruct(new TestPolyStruct2(new TestPolyStruct2(
1279 Character
.valueOf('X'), new Any(Type
.BOOLEAN
, Boolean
.TRUE
)), "test")),
1280 new TestPolyStruct2("test", new TestPolyStruct2(Character
.valueOf('X'),
1281 new TestPolyStruct(new Any(Type
.BOOLEAN
, Boolean
.TRUE
)))),
1282 new TestPolyStruct2( new TestPolyStruct2(Character
.valueOf('X'),
1283 new Any(Type
.BOOLEAN
, Boolean
.TRUE
)), new TestPolyStruct(Character
.valueOf('X'))),
1284 new TestPolyStruct(new Type
[] { Type
.LONG
}),
1285 new TestPolyStruct(new Any
[] { new Any(Type
.BOOLEAN
, Boolean
.TRUE
) }),
1286 new TestPolyStruct(new boolean[] {true}),
1287 new TestPolyStruct(new byte[] {Byte
.MIN_VALUE
}),
1288 new TestPolyStruct(new short[] {Short
.MIN_VALUE
}),
1289 new TestPolyStruct(new int[] {Integer
.MIN_VALUE
}),
1290 new TestPolyStruct(new long[] {Long
.MIN_VALUE
}),
1291 new TestPolyStruct(new char[] {'X'}),
1292 new TestPolyStruct(new String
[] {"test"}),
1293 new TestPolyStruct(new float[] {0.123f
}),
1294 new TestPolyStruct(new double[] {0.456d
}),
1295 new TestPolyStruct(new Object
[] {new com
.sun
.star
.lib
.uno
.helper
.ComponentBase()}),
1296 new TestPolyStruct(new com
.sun
.star
.lang
.XComponent
[] {new com
.sun
.star
.lib
.uno
.helper
.ComponentBase()}),
1297 new TestPolyStruct(new TestEnum
[] {TestEnum
.TWO
}),
1298 new TestPolyStruct(new TestPolyStruct2
[] {new TestPolyStruct2(
1299 Character
.valueOf('X'), new Any
[] {new Any(Type
.BOOLEAN
, Boolean
.TRUE
)})}),
1300 new TestPolyStruct(new TestPolyStruct2
[] {new TestPolyStruct2(
1301 new TestPolyStruct(Character
.valueOf('X')), new Any
[] {new Any(Type
.BOOLEAN
, Boolean
.TRUE
)})}),
1302 new TestPolyStruct(new int[][] { new int[] {Integer
.MIN_VALUE
} }),
1303 new TestPolyStruct
[]{ new TestPolyStruct(Integer
.valueOf(Integer
.MIN_VALUE
))},
1304 new TestPolyStruct
[]{new TestPolyStruct(new TestPolyStruct2(
1305 Character
.valueOf('X'), new Any(Type
.BOOLEAN
, Boolean
.TRUE
)))},
1306 new TestPolyStruct
[]{new TestPolyStruct(new TestPolyStruct2(
1307 new TestPolyStruct2(Character
.valueOf('X'), new Any(Type
.BOOLEAN
, Boolean
.TRUE
)), "test"))},
1308 new TestPolyStruct2
[]{new TestPolyStruct2("test", new TestPolyStruct2(
1309 Character
.valueOf('X'), new TestPolyStruct(new Any(Type
.BOOLEAN
, Boolean
.TRUE
))))},
1310 new TestPolyStruct2
[]{new TestPolyStruct2(new TestPolyStruct2(Character
.valueOf('X'), new Any(
1311 Type
.BOOLEAN
, Boolean
.TRUE
)),new TestPolyStruct(Character
.valueOf('X')))},
1312 new TestPolyStruct
[][]{new TestPolyStruct
[]{new TestPolyStruct(Character
.valueOf('X'))}},
1313 new TestPolyStruct
[][]{new TestPolyStruct
[]{
1314 new TestPolyStruct(new TestPolyStruct2(Character
.valueOf('X'), new Any(Type
.BOOLEAN
, Boolean
.TRUE
)))}},
1315 new TestPolyStruct
[][]{new TestPolyStruct
[] {new TestPolyStruct(new TestPolyStruct2(
1316 new TestPolyStruct2(Character
.valueOf('X'),new Any(Type
.BOOLEAN
, Boolean
.TRUE
)), "test"))}},
1317 new TestPolyStruct2
[][]{new TestPolyStruct2
[]{new TestPolyStruct2(
1318 "test", new TestPolyStruct2(Character
.valueOf('X'),new TestPolyStruct(new Any(Type
.BOOLEAN
, Boolean
.TRUE
))))}},
1319 new TestPolyStruct2
[][]{new TestPolyStruct2
[]{new TestPolyStruct2(
1320 new TestPolyStruct2(Character
.valueOf('X'),new Any(Type
.BOOLEAN
, Boolean
.TRUE
)),
1321 new TestPolyStruct(Character
.valueOf('X')))}});
1324 public XCurrentContextChecker
getCurrentContextChecker() {
1325 return new CurrentContextChecker();
1330 * Gives a factory for creating the service.
1331 * This method is called by the <code>JavaLoader</code>
1333 * @return returns a <code>XSingleServiceFactory</code> for creating the component
1334 * @param implName the name of the implementation for which a service is desired
1335 * @param multiFactory the service manager to be uses if needed
1336 * @param regKey the registryKey
1337 * @see com.sun.star.comp.loader.JavaLoader
1339 public static XSingleServiceFactory
__getServiceFactory(String implName
,
1340 XMultiServiceFactory multiFactory
,
1341 XRegistryKey regKey
)
1343 XSingleServiceFactory xSingleServiceFactory
= null;
1345 if(implName
.equals(_TestObject
.class.getName()))
1346 xSingleServiceFactory
= FactoryHelper
.getServiceFactory(_TestObject
.class,
1347 _TestObject
.__serviceName
,
1351 else if(implName
.equals(_PerformancTestObject
.class.getName()))
1352 xSingleServiceFactory
= FactoryHelper
.getServiceFactory(_PerformancTestObject
.class,
1353 _PerformancTestObject
.__serviceName
,
1357 return xSingleServiceFactory
;