diff options
Diffstat (limited to 'codemaker/test/javamaker')
-rw-r--r-- | codemaker/test/javamaker/Test.java | 550 | ||||
-rw-r--r-- | codemaker/test/javamaker/java15/Test.java | 91 | ||||
-rw-r--r-- | codemaker/test/javamaker/java15/makefile.mk | 32 | ||||
-rw-r--r-- | codemaker/test/javamaker/java15/types.idl | 44 | ||||
-rw-r--r-- | codemaker/test/javamaker/makefile.mk | 32 | ||||
-rw-r--r-- | codemaker/test/javamaker/types.idl | 427 |
6 files changed, 1176 insertions, 0 deletions
diff --git a/codemaker/test/javamaker/Test.java b/codemaker/test/javamaker/Test.java new file mode 100644 index 000000000..2c35e647e --- /dev/null +++ b/codemaker/test/javamaker/Test.java @@ -0,0 +1,550 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package test.codemaker.javamaker; + +import com.sun.star.comp.helper.Bootstrap; +import com.sun.star.lang.XEventListener; +import com.sun.star.uno.Any; +import com.sun.star.uno.DeploymentException; +import com.sun.star.uno.Type; +import com.sun.star.uno.XComponentContext; +import com.sun.star.uno.XNamingService; +import complexlib.ComplexTestCase; +import java.util.EventListener; +import test.codemaker.javamaker.Enum1; +import test.codemaker.javamaker.Enum2; +import test.codemaker.javamaker.PolyStruct; +import test.codemaker.javamaker.S2; +import test.codemaker.javamaker.Struct2; +import test.codemaker.javamaker.services.service_abstract; +import test.codemaker.javamaker.services.service_assert; +import test.codemaker.javamaker.services.service_break; +import test.codemaker.javamaker.services.service_catch; +import test.codemaker.javamaker.services.service_class; +import test.codemaker.javamaker.services.service_continue; +import test.codemaker.javamaker.services.service_do; +import test.codemaker.javamaker.services.service_else; +import test.codemaker.javamaker.services.service_extends; +import test.codemaker.javamaker.services.service_final; +import test.codemaker.javamaker.services.service_finally; +import test.codemaker.javamaker.services.service_for; +import test.codemaker.javamaker.services.service_goto; +import test.codemaker.javamaker.services.service_if; +import test.codemaker.javamaker.services.service_implements; +import test.codemaker.javamaker.services.service_import; +import test.codemaker.javamaker.services.service_instanceof; +import test.codemaker.javamaker.services.service_int; +import test.codemaker.javamaker.services.service_native; +import test.codemaker.javamaker.services.service_new; +import test.codemaker.javamaker.services.service_package; +import test.codemaker.javamaker.services.service_private; +import test.codemaker.javamaker.services.service_protected; +import test.codemaker.javamaker.services.service_public; +import test.codemaker.javamaker.services.service_return; +import test.codemaker.javamaker.services.service_static; +import test.codemaker.javamaker.services.service_strictfp; +import test.codemaker.javamaker.services.service_super; +import test.codemaker.javamaker.services.service_synchronized; +import test.codemaker.javamaker.services.service_this; +import test.codemaker.javamaker.services.service_throw; +import test.codemaker.javamaker.services.service_throws; +import test.codemaker.javamaker.services.service_try; +import test.codemaker.javamaker.services.service_volatile; +import test.codemaker.javamaker.services.service_while; +import test.codemaker.javamaker.singleton_abstract; + +public final class Test extends ComplexTestCase { + public String[] getTestMethodNames() { + return new String[] { + "testEnum1", "testEnum2", "testPolyStruct", "testEmptyStruct2", + "testFullStruct2", "testXEventListener", "testS1", "testS2", + "testKeywordServices", "testSingletons" }; + } + + public void before() throws Exception { + context = Bootstrap.createInitialComponentContext(null); + } + + public void testEnum1() { + assure(Enum1.VALUE1.getValue() == -100); + assure(Enum1.VALUE2.getValue() == 100); + assure(Enum1.VALUE1_value == -100); + assure(Enum1.VALUE2_value == 100); + assure(Enum1.getDefault() == Enum1.VALUE1); + assure(Enum1.fromInt(-101) == null); + assure(Enum1.fromInt(-100) == Enum1.VALUE1); + assure(Enum1.fromInt(-99) == null); + assure(Enum1.fromInt(0) == null); + assure(Enum1.fromInt(99) == null); + assure(Enum1.fromInt(100) == Enum1.VALUE2); + assure(Enum1.fromInt(101) == null); + } + + public void testEnum2() { + assure(Enum2.VALUE0.getValue() == 0); + assure(Enum2.VALUE1.getValue() == 1); + assure(Enum2.VALUE2.getValue() == 2); + assure(Enum2.VALUE4.getValue() == 4); + assure(Enum2.VALUE0_value == 0); + assure(Enum2.VALUE1_value == 1); + assure(Enum2.VALUE2_value == 2); + assure(Enum2.VALUE4_value == 4); + assure(Enum2.getDefault() == Enum2.VALUE0); + assure(Enum2.fromInt(-1) == null); + assure(Enum2.fromInt(0) == Enum2.VALUE0); + assure(Enum2.fromInt(1) == Enum2.VALUE1); + assure(Enum2.fromInt(2) == Enum2.VALUE2); + assure(Enum2.fromInt(3) == null); + assure(Enum2.fromInt(4) == Enum2.VALUE4); + assure(Enum2.fromInt(5) == null); + } + + public void testPolyStruct() { + PolyStruct s = new PolyStruct(); + assure(s.member1 == null); + assure(s.member2 == 0); + s = new PolyStruct("ABC", 5); + assure(s.member1.equals("ABC")); + assure(s.member2 == 5); + } + + public void testEmptyStruct2() { + Struct2 s = new Struct2(); + assure(!s.p1); + assure(s.p2 == 0); + assure(s.p3 == 0); + assure(s.p4 == 0); + assure(s.p5 == 0); + assure(s.p6 == 0); + assure(s.p7 == 0L); + assure(s.p8 == 0L); + assure(s.p9 == 0.0f); + assure(s.p10 == 0.0); + assure(s.p11 == '\u0000'); + assure(s.p12.equals("")); + assure(s.p13.equals(Type.VOID)); + assure(s.p14.equals(Any.VOID)); + assure(s.p15 == Enum2.VALUE0); + assure(s.p16.member1 == 0); + assure(s.p17 == null); + assure(s.p18 == null); + assure(!s.t1); + assure(s.t2 == 0); + assure(s.t3 == 0); + assure(s.t4 == 0); + assure(s.t5 == 0); + assure(s.t6 == 0); + assure(s.t7 == 0L); + assure(s.t8 == 0L); + assure(s.t9 == 0.0f); + assure(s.t10 == 0.0); + assure(s.t11 == '\u0000'); + assure(s.t12.equals("")); + assure(s.t13.equals(Type.VOID)); + assure(s.t14.equals(Any.VOID)); + assure(s.t15 == Enum2.VALUE0); + assure(s.t16.member1 == 0); + assure(s.t17 == null); + assure(s.t18 == null); + assure(s.a1.length == 0); + assure(s.a2.length == 0); + assure(s.a3.length == 0); + assure(s.a4.length == 0); + assure(s.a5.length == 0); + assure(s.a6.length == 0); + assure(s.a7.length == 0); + assure(s.a8.length == 0); + assure(s.a9.length == 0); + assure(s.a10.length == 0); + assure(s.a11.length == 0); + assure(s.a12.length == 0); + assure(s.a13.length == 0); + assure(s.a14.length == 0); + assure(s.a15.length == 0); + assure(s.a16.length == 0); + assure(s.a17.length == 0); + assure(s.a18.length == 0); + assure(s.aa1.length == 0); + assure(s.aa2.length == 0); + assure(s.aa3.length == 0); + assure(s.aa4.length == 0); + assure(s.aa5.length == 0); + assure(s.aa6.length == 0); + assure(s.aa7.length == 0); + assure(s.aa8.length == 0); + assure(s.aa9.length == 0); + assure(s.aa10.length == 0); + assure(s.aa11.length == 0); + assure(s.aa12.length == 0); + assure(s.aa13.length == 0); + assure(s.aa14.length == 0); + assure(s.aa15.length == 0); + assure(s.aa16.length == 0); + assure(s.aa17.length == 0); + assure(s.aa18.length == 0); + assure(s.at1.length == 0); + assure(s.at2.length == 0); + assure(s.at3.length == 0); + assure(s.at4.length == 0); + assure(s.at5.length == 0); + assure(s.at6.length == 0); + assure(s.at7.length == 0); + assure(s.at8.length == 0); + assure(s.at9.length == 0); + assure(s.at10.length == 0); + assure(s.at11.length == 0); + assure(s.at12.length == 0); + assure(s.at13.length == 0); + assure(s.at14.length == 0); + assure(s.at15.length == 0); + assure(s.at16.length == 0); + assure(s.at17.length == 0); + assure(s.at18.length == 0); + } + + public void testFullStruct2() { + //TODO: + Struct2 s = new Struct2( + true, (byte) 1, (short) 2, (short) 3, 4, 5, 6L, 7L, 0.8f, 0.9, 'A', + "BCD", Type.UNSIGNED_HYPER, Integer.valueOf(22), Enum2.VALUE4, + new Struct1(1), null, null, false, (byte) 0, (short) 0, (short) 0, + 0, 0, 0L, 0L, 0.0f, 0.0, '\u0000', "", Type.VOID, Any.VOID, + Enum2.VALUE0, new Struct1(), null, null, + new boolean[] { false, true }, new byte[] { (byte) 1, (byte) 2 }, + new short[0], new short[0], new int[0], new int[0], + new long[0], new long[0], new float[0], new double[0], new char[0], + new String[0], new Type[0], new Object[0], new Enum2[0], + new Struct1[] { new Struct1(1), new Struct1(2) }, new Object[0], + new XNamingService[0], new boolean[0][], new byte[0][], + new short[0][], new short[0][], new int[0][], new int[0][], + new long[0][], new long[0][], new float[0][], new double[0][], + new char[0][], new String[0][], new Type[0][], new Object[0][], + new Enum2[0][], new Struct1[0][], new Object[0][], + new XNamingService[0][], new boolean[0][], new byte[0][], + new short[0][], new short[0][], new int[0][], new int[0][], + new long[0][], new long[0][], new float[0][], new double[0][], + new char[0][], new String[0][], new Type[0][], new Object[0][], + new Enum2[0][], new Struct1[0][], new Object[0][], + new XNamingService[0][]); + assure(s.p1); + assure(s.p2 == 1); + assure(s.p3 == 2); + assure(s.p4 == 3); + assure(s.p5 == 4); + assure(s.p6 == 5); + assure(s.p7 == 6L); + assure(s.p8 == 7L); + assure(s.p9 == 0.8f); + assure(s.p10 == 0.9); + assure(s.p11 == 'A'); + assure(s.p12.equals("BCD")); + assure(s.p13.equals(Type.UNSIGNED_HYPER)); + assure(s.p14.equals(Integer.valueOf(22))); + assure(s.p15 == Enum2.VALUE4); + assure(s.p16.member1 == 1); + assure(s.p17 == null); + assure(s.p18 == null); + assure(!s.t1); + assure(s.t2 == 0); + assure(s.t3 == 0); + assure(s.t4 == 0); + assure(s.t5 == 0); + assure(s.t6 == 0); + assure(s.t7 == 0L); + assure(s.t8 == 0L); + assure(s.t9 == 0.0f); + assure(s.t10 == 0.0); + assure(s.t11 == '\u0000'); + assure(s.t12.equals("")); + assure(s.t13.equals(Type.VOID)); + assure(s.t14.equals(Any.VOID)); + assure(s.t15 == Enum2.VALUE0); + assure(s.t16.member1 == 0); + assure(s.t17 == null); + assure(s.t18 == null); + assure(s.a1.length == 2); + assure(!s.a1[0]); + assure(s.a1[1]); + assure(s.a2.length == 2); + assure(s.a2[0] == 1); + assure(s.a2[1] == 2); + assure(s.a3.length == 0); + assure(s.a4.length == 0); + assure(s.a5.length == 0); + assure(s.a6.length == 0); + assure(s.a7.length == 0); + assure(s.a8.length == 0); + assure(s.a9.length == 0); + assure(s.a10.length == 0); + assure(s.a11.length == 0); + assure(s.a12.length == 0); + assure(s.a13.length == 0); + assure(s.a14.length == 0); + assure(s.a15.length == 0); + assure(s.a16.length == 2); + assure(s.a16[0].member1 == 1); + assure(s.a16[1].member1 == 2); + assure(s.a17.length == 0); + assure(s.a18.length == 0); + assure(s.aa1.length == 0); + assure(s.aa2.length == 0); + assure(s.aa3.length == 0); + assure(s.aa4.length == 0); + assure(s.aa5.length == 0); + assure(s.aa6.length == 0); + assure(s.aa7.length == 0); + assure(s.aa8.length == 0); + assure(s.aa9.length == 0); + assure(s.aa10.length == 0); + assure(s.aa11.length == 0); + assure(s.aa12.length == 0); + assure(s.aa13.length == 0); + assure(s.aa14.length == 0); + assure(s.aa15.length == 0); + assure(s.aa16.length == 0); + assure(s.aa17.length == 0); + assure(s.aa18.length == 0); + assure(s.at1.length == 0); + assure(s.at2.length == 0); + assure(s.at3.length == 0); + assure(s.at4.length == 0); + assure(s.at5.length == 0); + assure(s.at6.length == 0); + assure(s.at7.length == 0); + assure(s.at8.length == 0); + assure(s.at9.length == 0); + assure(s.at10.length == 0); + assure(s.at11.length == 0); + assure(s.at12.length == 0); + assure(s.at13.length == 0); + assure(s.at14.length == 0); + assure(s.at15.length == 0); + assure(s.at16.length == 0); + assure(s.at17.length == 0); + assure(s.at18.length == 0); + } + + public void testXEventListener() { + assure(EventListener.class.isAssignableFrom(XEventListener.class)); + } + + public void testS1() throws com.sun.star.uno.Exception { + //TODO: + try { + S1.create1(context); + failed("S1.create1"); + } catch (DeploymentException e) {} + try { + S1.create2(context, new Any[0]); + failed("S1.create2"); + } catch (com.sun.star.uno.Exception e) {} + try { + S1.create3(context, new Any[0]); + failed("S1.create3"); + } catch (DeploymentException e) {} + try { + S1.create4(context, 0, 0, 0); + failed("S1.create4"); + } catch (DeploymentException e) {} + try { + S1.create5( + context, false, (byte) 0, (short) 0, (short) 0, 0, 0, 0L, 0L, + 0.0f, 0.0, '\u0000', "", Type.VOID, Any.VOID, Enum2.VALUE0, + new Struct1(), null, null, false, (byte) 0, (short) 0, + (short) 0, 0, 0, 0L, 0L, 0.0f, 0.0, '\u0000', "", Type.VOID, + Any.VOID, Enum2.VALUE0, new Struct1(), null, null, + new boolean[0], new byte[0], new short[0], new short[0], + new int[0], new int[0], new long[0], new long[0], new float[0], + new double[0], new char[0], new String[0], new Type[0], + new Object[0], new Enum2[0], new Struct1[0], new Object[0], + new XNamingService[0], new boolean[0][], new byte[0][], + new short[0][], new short[0][], new int[0][], new int[0][], + new long[0][], new long[0][], new float[0][], new double[0][], + new char[0][], new String[0][], new Type[0][], new Object[0][], + new Enum2[0][], new Struct1[0][], new Object[0][], + new XNamingService[0][], new boolean[0][], new byte[0][], + new short[0][], new short[0][], new int[0][], new int[0][], + new long[0][], new long[0][], new float[0][], new double[0][], + new char[0][], new String[0][], new Type[0][], new Object[0][], + new Enum2[0][], new Struct1[0][], new Object[0][], + new XNamingService[0][]); + failed("S1.create4"); + } catch (DeploymentException e) {} + } + + public void testS2() { + //TODO + } + + public void testKeywordServices() { + try { + service_abstract.method_abstract(context, 0); + failed("service_abstract.method_abstract"); + } catch (DeploymentException e) {} + try { + service_assert.method_assert(context, 0); + failed("service_assert.method_assert"); + } catch (DeploymentException e) {} + try { + service_break.method_break(context, 0); + failed("service_break.method_break"); + } catch (DeploymentException e) {} + try { + service_catch.method_catch(context, 0); + failed("service_catch.method_catch"); + } catch (DeploymentException e) {} + try { + service_class.method_class(context, 0); + failed("service_class.method_class"); + } catch (DeploymentException e) {} + try { + service_continue.method_continue(context, 0); + failed("service_continue.method_continue"); + } catch (DeploymentException e) {} + try { + service_do.method_do(context, 0); + failed("service_do.method_do"); + } catch (DeploymentException e) {} + try { + service_else.method_else(context, 0); + failed("service_else.method_else"); + } catch (DeploymentException e) {} + try { + service_extends.method_extends(context, 0); + failed("service_extends.method_extends"); + } catch (DeploymentException e) {} + try { + service_final.method_final(context, 0); + failed("service_final.method_final"); + } catch (DeploymentException e) {} + try { + service_finally.method_finally(context, 0); + failed("service_finally.method_finally"); + } catch (DeploymentException e) {} + try { + service_for.method_for(context, 0); + failed("service_for.method_for"); + } catch (DeploymentException e) {} + try { + service_goto.method_goto(context, 0); + failed("service_goto.method_goto"); + } catch (DeploymentException e) {} + try { + service_if.method_if(context, 0); + failed("service_if.method_if"); + } catch (DeploymentException e) {} + try { + service_implements.method_implements(context, 0); + failed("service_implements.method_implements"); + } catch (DeploymentException e) {} + try { + service_import.method_import(context, 0); + failed("service_import.method_import"); + } catch (DeploymentException e) {} + try { + service_instanceof.method_instanceof(context, 0); + failed("service_instanceof.method_instanceof"); + } catch (DeploymentException e) {} + try { + service_int.method_int(context, 0); + failed("service_int.method_int"); + } catch (DeploymentException e) {} + try { + service_native.method_native(context, 0); + failed("service_native.method_native"); + } catch (DeploymentException e) {} + try { + service_new.method_new(context, 0); + failed("service_new.method_new"); + } catch (DeploymentException e) {} + try { + service_package.method_package(context, 0); + failed("service_package.method_package"); + } catch (DeploymentException e) {} + try { + service_private.method_private(context, 0); + failed("service_private.method_private"); + } catch (DeploymentException e) {} + try { + service_protected.method_protected(context, 0); + failed("service_protected.method_protected"); + } catch (DeploymentException e) {} + try { + service_public.method_public(context, 0); + failed("service_public.method_public"); + } catch (DeploymentException e) {} + try { + service_return.method_return(context, 0); + failed("service_return.method_return"); + } catch (DeploymentException e) {} + try { + service_static.method_static(context, 0); + failed("service_static.method_static"); + } catch (DeploymentException e) {} + try { + service_strictfp.method_strictfp(context, 0); + failed("service_strictfp.method_strictfp"); + } catch (DeploymentException e) {} + try { + service_super.method_super(context, 0); + failed("service_super.method_super"); + } catch (DeploymentException e) {} + try { + service_synchronized.method_synchronized(context, 0); + failed("service_synchronized.method_synchronized"); + } catch (DeploymentException e) {} + try { + service_this.method_this(context, 0); + failed("service_this.method_this"); + } catch (DeploymentException e) {} + try { + service_throw.method_throw(context, 0); + failed("service_throw.method_throw"); + } catch (DeploymentException e) {} + try { + service_throws.method_throws(context, 0); + failed("service_throws.method_throws"); + } catch (DeploymentException e) {} + try { + service_try.method_try(context, 0); + failed("service_try.method_try"); + } catch (DeploymentException e) {} + try { + service_volatile.method_volatile(context, 0); + failed("service_volatile.method_volatile"); + } catch (DeploymentException e) {} + try { + service_while.method_while(context, 0); + failed("service_while.method_while"); + } catch (DeploymentException e) {} + } + + public void testSingletons() { + try { + S4.get(context); + failed("S4"); + } catch (DeploymentException e) {} + try { + singleton_abstract.get(context); + failed("singleton_abstract"); + } catch (DeploymentException e) {} + } + + private XComponentContext context; +} diff --git a/codemaker/test/javamaker/java15/Test.java b/codemaker/test/javamaker/java15/Test.java new file mode 100644 index 000000000..30ffb4102 --- /dev/null +++ b/codemaker/test/javamaker/java15/Test.java @@ -0,0 +1,91 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package test.codemaker.javamaker.java15; + +import com.sun.star.lang.XMultiComponentFactory; +import com.sun.star.uno.DeploymentException; +import com.sun.star.uno.XComponentContext; +import complexlib.ComplexTestCase; + +public final class Test extends ComplexTestCase { + public String[] getTestMethodNames() { + return new String[] { + "testPlainPolyStruct", "testBooleanPolyStruct", "testStruct", + "testService" }; + } + + public void testPlainPolyStruct() { + PolyStruct s = new PolyStruct(); + assure(s.member1 == null); + assure(s.member2 == 0); + s = new PolyStruct("ABC", 5); + assure(s.member1.equals("ABC")); + assure(s.member2 == 5); + } + + public void testBooleanPolyStruct() { + PolyStruct<Boolean,Object> s = new PolyStruct<Boolean,Object>(); + assure(s.member1 == null); + assure(s.member2 == 0); + s = new PolyStruct<Boolean,Object>(true, 5); + assure(s.member1 == true); + assure(s.member2 == 5); + } + + public void testStruct() { + Struct s = new Struct(); + assure(s.member.member1 == null); + assure(s.member.member2 == 0); + s = new Struct( + new PolyStruct<PolyStruct<boolean[], Object>, Integer>( + new PolyStruct<boolean[], Object>(new boolean[] { true }, 3), + 4)); + assure(s.member.member1.member1.length == 1); + assure(s.member.member1.member1[0] == true); + assure(s.member.member1.member2 == 3); + assure(s.member.member2 == 4); + } + + public void testService() { + XComponentContext context = new XComponentContext() { + public Object getValueByName(String name) { + return null; + } + + public XMultiComponentFactory getServiceManager() { + throw new DeploymentException(); + } + }; + try { + Service.create(context); + failed(); + } catch (DeploymentException e) {} + try { + Service.create( + context, false, (byte) 1, (short) 2, Integer.valueOf(4)); + failed(); + } catch (DeploymentException e) {} + } + + private static final class Ifc implements XIfc { + public void f1(PolyStruct<Integer, Integer> arg) {} + + public void f2(PolyStruct<Object, Object> arg) {} + } +} diff --git a/codemaker/test/javamaker/java15/makefile.mk b/codemaker/test/javamaker/java15/makefile.mk new file mode 100644 index 000000000..a9be5c83e --- /dev/null +++ b/codemaker/test/javamaker/java15/makefile.mk @@ -0,0 +1,32 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +PRJ := ..$/..$/.. +PRJNAME := codemaker +TARGET := test_codemaker_javamaker_java15 + +PACKAGE := test$/codemaker$/javamaker$/java15 +JAVATESTFILES := Test.java +IDLTESTFILES := types.idl +JARFILES := ridl.jar + +JAVAMAKER = $(BIN)$/javamaker$(EXECPOST) + +.INCLUDE: javaunittest.mk + +$(MISC)$/$(TARGET).javamaker.flag: $(BIN)$/javamaker$(EXECPOST) diff --git a/codemaker/test/javamaker/java15/types.idl b/codemaker/test/javamaker/java15/types.idl new file mode 100644 index 000000000..3244eb257 --- /dev/null +++ b/codemaker/test/javamaker/java15/types.idl @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <com/sun/star/uno/XInterface.idl> + +module test { module codemaker { module javamaker { module java15 { + +struct PolyStruct<if,else> { + if member1; + long member2; +}; + +struct Struct { + PolyStruct<PolyStruct<sequence<boolean>,any>,long> member; +}; + +service Service: com::sun::star::uno::XInterface { + create([in] any... args); +}; + +interface XIfc { + void f1([in] PolyStruct<long, long> arg); + void f2([in] PolyStruct<any, com::sun::star::uno::XInterface> arg); +}; + +}; }; }; }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/codemaker/test/javamaker/makefile.mk b/codemaker/test/javamaker/makefile.mk new file mode 100644 index 000000000..643bb7902 --- /dev/null +++ b/codemaker/test/javamaker/makefile.mk @@ -0,0 +1,32 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +PRJ := ..$/.. +PRJNAME := codemaker +TARGET := test_codemaker_javamaker + +PACKAGE := test$/codemaker$/javamaker +JAVATESTFILES := Test.java +IDLTESTFILES := types.idl +JARFILES := juh.jar jurt.jar ridl.jar + +JAVAMAKER = $(BIN)$/javamaker$(EXECPOST) + +.INCLUDE: javaunittest.mk + +$(MISC)$/$(TARGET).javamaker.flag: $(BIN)$/javamaker$(EXECPOST) diff --git a/codemaker/test/javamaker/types.idl b/codemaker/test/javamaker/types.idl new file mode 100644 index 000000000..e0d5170c1 --- /dev/null +++ b/codemaker/test/javamaker/types.idl @@ -0,0 +1,427 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <com/sun/star/lang/ClassNotFoundException.idl> +#include <com/sun/star/lang/IllegalAccessException.idl> +#include <com/sun/star/uno/DeploymentException.idl> +#include <com/sun/star/uno/Exception.idl> +#include <com/sun/star/uno/RuntimeException.idl> +#include <com/sun/star/uno/XInterface.idl> +#include <com/sun/star/uno/XNamingService.idl> + +module test { module codemaker { module javamaker { + +enum Enum1 { VALUE1 = -100, VALUE2 = 100 }; + +enum Enum2 { VALUE0 = 0, VALUE1 = 1, VALUE2 = 2, VALUE4 = 4 }; + +struct Struct1 { long member1; }; + +struct PolyStruct<if,else> { + if member1; + long member2; +}; + +interface XTest { + boolean test(); + + [attribute, bound] long A1; + [attribute, bound, readonly] long A2; + [attribute] long A3 { + get raises + (com::sun::star::uno::Exception, + com::sun::star::lang::ClassNotFoundException); + set raises (com::sun::star::uno::RuntimeException); + }; + [attribute, readonly] long A4 { + get raises (com::sun::star::uno::DeploymentException); + }; +}; + +typedef boolean Boolean; +typedef byte Byte; +typedef short Short; +typedef unsigned short UnsignedShort; +typedef long Long; +typedef unsigned long UnsignedLong; +typedef hyper Hyper; +typedef unsigned hyper UnsignedHyper; +typedef float Float; +typedef double Double; +typedef char Char; +typedef string String; +typedef type Type; +typedef any Any; +typedef Enum2 Enum; +typedef Struct1 Struct; +typedef com::sun::star::uno::XInterface XInterface; +typedef com::sun::star::uno::XNamingService XNamingService; + +typedef sequence< Boolean > SequenceBoolean; +typedef sequence< Byte > SequenceByte; +typedef sequence< Short > SequenceShort; +typedef sequence< UnsignedShort > SequenceUnsignedShort; +typedef sequence< Long > SequenceLong; +typedef sequence< UnsignedLong > SequenceUnsignedLong; +typedef sequence< Hyper > SequenceHyper; +typedef sequence< UnsignedHyper > SequenceUnsignedHyper; +typedef sequence< Float > SequenceFloat; +typedef sequence< Double > SequenceDouble; +typedef sequence< Char > SequenceChar; +typedef sequence< String > SequenceString; +typedef sequence< Type > SequenceType; +typedef sequence< Any > SequenceAny; +typedef sequence< Enum > SequenceEnum; +typedef sequence< Struct > SequenceStruct; +typedef sequence< XInterface > SequenceXInterface; +typedef sequence< XNamingService > SequenceXNamingService; + +struct Struct2 { + boolean p1; + byte p2; + short p3; + unsigned short p4; + long p5; + unsigned long p6; + hyper p7; + unsigned hyper p8; + float p9; + double p10; + char p11; + string p12; + type p13; + any p14; + Enum2 p15; + Struct1 p16; + com::sun::star::uno::XInterface p17; + com::sun::star::uno::XNamingService p18; + Boolean t1; + Byte t2; + Short t3; + UnsignedShort t4; + Long t5; + UnsignedLong t6; + Hyper t7; + UnsignedHyper t8; + Float t9; + Double t10; + Char t11; + String t12; + Type t13; + Any t14; + Enum t15; + Struct t16; + XInterface t17; + XNamingService t18; + sequence< boolean > a1; + sequence< byte > a2; + sequence< short > a3; + sequence< unsigned short > a4; + sequence< long > a5; + sequence< unsigned long > a6; + sequence< hyper > a7; + sequence< unsigned hyper > a8; + sequence< float > a9; + sequence< double > a10; + sequence< char > a11; + sequence< string > a12; + sequence< type > a13; + sequence< any > a14; + sequence< Enum2 > a15; + sequence< Struct1 > a16; + sequence< com::sun::star::uno::XInterface > a17; + sequence< com::sun::star::uno::XNamingService > a18; + sequence< sequence< boolean > > aa1; + sequence< sequence< byte > > aa2; + sequence< sequence< short > > aa3; + sequence< sequence< unsigned short > > aa4; + sequence< sequence< long > > aa5; + sequence< sequence< unsigned long > > aa6; + sequence< sequence< hyper > > aa7; + sequence< sequence< unsigned hyper > > aa8; + sequence< sequence< float > > aa9; + sequence< sequence< double > > aa10; + sequence< sequence< char > > aa11; + sequence< sequence< string > > aa12; + sequence< sequence< type > > aa13; + sequence< sequence< any > > aa14; + sequence< sequence< Enum2 > > aa15; + sequence< sequence< Struct1 > > aa16; + sequence< sequence< com::sun::star::uno::XInterface > > aa17; + sequence< sequence< com::sun::star::uno::XNamingService > > aa18; + sequence< SequenceBoolean > at1; + sequence< SequenceByte > at2; + sequence< SequenceShort > at3; + sequence< SequenceUnsignedShort > at4; + sequence< SequenceLong > at5; + sequence< SequenceUnsignedLong > at6; + sequence< SequenceHyper > at7; + sequence< SequenceUnsignedHyper > at8; + sequence< SequenceFloat > at9; + sequence< SequenceDouble > at10; + sequence< SequenceChar > at11; + sequence< SequenceString > at12; + sequence< SequenceType > at13; + sequence< SequenceAny > at14; + sequence< SequenceEnum > at15; + sequence< SequenceStruct > at16; + sequence< SequenceXInterface > at17; + sequence< SequenceXNamingService > at18; +}; + +service S1: XTest { + create1(); + + create2([in] any... create2) + raises (com::sun::star::uno::RuntimeException, + com::sun::star::lang::ClassNotFoundException, + com::sun::star::uno::Exception, + com::sun::star::lang::IllegalAccessException, + com::sun::star::uno::DeploymentException); + + create3([in] sequence<any> S1) + raises (com::sun::star::uno::RuntimeException, + com::sun::star::lang::ClassNotFoundException, + com::sun::star::lang::IllegalAccessException, + com::sun::star::uno::DeploymentException); + + create4([in] long javamaker, [in] long S1, [in] long create4); + + create5( + [in] boolean p1, + [in] byte p2, + [in] short p3, + [in] unsigned short p4, + [in] long p5, + [in] unsigned long p6, + [in] hyper p7, + [in] unsigned hyper p8, + [in] float p9, + [in] double p10, + [in] char p11, + [in] string p12, + [in] type p13, + [in] any p14, + [in] Enum2 p15, + [in] Struct1 p16, + [in] com::sun::star::uno::XInterface p17, + [in] com::sun::star::uno::XNamingService p18, + [in] Boolean t1, + [in] Byte t2, + [in] Short t3, + [in] UnsignedShort t4, + [in] Long t5, + [in] UnsignedLong t6, + [in] Hyper t7, + [in] UnsignedHyper t8, + [in] Float t9, + [in] Double t10, + [in] Char t11, + [in] String t12, + [in] Type t13, + [in] Any t14, + [in] Enum t15, + [in] Struct t16, + [in] XInterface t17, + [in] XNamingService t18, + [in] sequence< boolean > a1, + [in] sequence< byte > a2, + [in] sequence< short > a3, + [in] sequence< unsigned short > a4, + [in] sequence< long > a5, + [in] sequence< unsigned long > a6, + [in] sequence< hyper > a7, + [in] sequence< unsigned hyper > a8, + [in] sequence< float > a9, + [in] sequence< double > a10, + [in] sequence< char > a11, + [in] sequence< string > a12, + [in] sequence< type > a13, + [in] sequence< any > a14, + [in] sequence< Enum2 > a15, + [in] sequence< Struct1 > a16, + [in] sequence< com::sun::star::uno::XInterface > a17, + [in] sequence< com::sun::star::uno::XNamingService > a18, + [in] sequence< sequence< boolean > > aa1, + [in] sequence< sequence< byte > > aa2, + [in] sequence< sequence< short > > aa3, + [in] sequence< sequence< unsigned short > > aa4, + [in] sequence< sequence< long > > aa5, + [in] sequence< sequence< unsigned long > > aa6, + [in] sequence< sequence< hyper > > aa7, + [in] sequence< sequence< unsigned hyper > > aa8, + [in] sequence< sequence< float > > aa9, + [in] sequence< sequence< double > > aa10, + [in] sequence< sequence< char > > aa11, + [in] sequence< sequence< string > > aa12, + [in] sequence< sequence< type > > aa13, + [in] sequence< sequence< any > > aa14, + [in] sequence< sequence< Enum2 > > aa15, + [in] sequence< sequence< Struct1 > > aa16, + [in] sequence< sequence< com::sun::star::uno::XInterface > > aa17, + [in] sequence< sequence< com::sun::star::uno::XNamingService > > aa18, + [in] sequence< SequenceBoolean > at1, + [in] sequence< SequenceByte > at2, + [in] sequence< SequenceShort > at3, + [in] sequence< SequenceUnsignedShort > at4, + [in] sequence< SequenceLong > at5, + [in] sequence< SequenceUnsignedLong > at6, + [in] sequence< SequenceHyper > at7, + [in] sequence< SequenceUnsignedHyper > at8, + [in] sequence< SequenceFloat > at9, + [in] sequence< SequenceDouble > at10, + [in] sequence< SequenceChar > at11, + [in] sequence< SequenceString > at12, + [in] sequence< SequenceType > at13, + [in] sequence< SequenceAny > at14, + [in] sequence< SequenceEnum > at15, + [in] sequence< SequenceStruct > at16, + [in] sequence< SequenceXInterface > at17, + [in] sequence< SequenceXNamingService > at18); +}; + +service S2: XTest; + +service S3 { interface XTest; }; + +module services { + +service abstract: com::sun::star::uno::XInterface { + abstract([in] long abstract); }; +service assert: com::sun::star::uno::XInterface { assert([in] long assert); }; +//TODO: boolean +service break: com::sun::star::uno::XInterface { break([in] long break); }; +//TODO: byte +//TODO: case +service catch: com::sun::star::uno::XInterface { catch([in] long catch); }; +//TODO: char +service class: com::sun::star::uno::XInterface { class([in] long class); }; +//TODO: const +service continue: com::sun::star::uno::XInterface { + continue([in] long continue); }; +//TODO: default +service do: com::sun::star::uno::XInterface { do([in] long do); }; +//TODO: double +service else: com::sun::star::uno::XInterface { else([in] long else); }; +//TODO: enum +service extends: com::sun::star::uno::XInterface { + extends([in] long extends); }; +service final: com::sun::star::uno::XInterface { final([in] long final); }; +service finally: com::sun::star::uno::XInterface { + finally([in] long finally); }; +//TODO: float +service for: com::sun::star::uno::XInterface { for([in] long for); }; +service goto: com::sun::star::uno::XInterface { goto([in] long goto); }; +service if: com::sun::star::uno::XInterface { if([in] long if); }; +service implements: com::sun::star::uno::XInterface { + implements([in] long implements); }; +service import: com::sun::star::uno::XInterface { import([in] long import); }; +service instanceof: com::sun::star::uno::XInterface { + instanceof([in] long instanceof); }; +service int: com::sun::star::uno::XInterface { int([in] long int); }; +//TODO: interface +//TODO: long +service native: com::sun::star::uno::XInterface { native([in] long native); }; +service new: com::sun::star::uno::XInterface { new([in] long new); }; +service package: com::sun::star::uno::XInterface { + package([in] long package); }; +service private: com::sun::star::uno::XInterface { + private([in] long private); }; +service protected: com::sun::star::uno::XInterface { + protected([in] long protected); }; +service public: com::sun::star::uno::XInterface { public([in] long public); }; +service return: com::sun::star::uno::XInterface { return([in] long return); }; +//TODO: short +service static: com::sun::star::uno::XInterface { static([in] long static); }; +service strictfp: com::sun::star::uno::XInterface { + strictfp([in] long strictfp); }; +service super: com::sun::star::uno::XInterface { super([in] long super); }; +//TODO: switch +service synchronized: com::sun::star::uno::XInterface { + synchronized([in] long synchronized); }; +service this: com::sun::star::uno::XInterface { this([in] long this); }; +service throw: com::sun::star::uno::XInterface { throw([in] long throw); }; +service throws: com::sun::star::uno::XInterface { throws([in] long throws); }; +//TODO: transient +service try: com::sun::star::uno::XInterface { try([in] long try); }; +//TODO: void +service volatile: com::sun::star::uno::XInterface { + volatile([in] long volatile); }; +service while: com::sun::star::uno::XInterface { while([in] long while); }; + +}; + +singleton S4: XTest; + +singleton S5 { service S2; }; + +singleton abstract: com::sun::star::uno::XNamingService; +singleton assert: com::sun::star::uno::XNamingService; +//TODO: singleton boolean: com::sun::star::uno::XNamingService; +singleton break: com::sun::star::uno::XNamingService; +//TODO: singleton byte: com::sun::star::uno::XNamingService; +//TODO: singleton case: com::sun::star::uno::XNamingService; +singleton catch: com::sun::star::uno::XNamingService; +//TODO: singleton char: com::sun::star::uno::XNamingService; +singleton class: com::sun::star::uno::XNamingService; +//TODO: singleton const: com::sun::star::uno::XNamingService; +singleton continue: com::sun::star::uno::XNamingService; +//TODO: singleton default: com::sun::star::uno::XNamingService; +singleton do: com::sun::star::uno::XNamingService; +//TODO: singleton double: com::sun::star::uno::XNamingService; +singleton else: com::sun::star::uno::XNamingService; +//TODO: singleton enum: com::sun::star::uno::XNamingService; +singleton extends: com::sun::star::uno::XNamingService; +singleton final: com::sun::star::uno::XNamingService; +singleton finally: com::sun::star::uno::XNamingService; +//TODO: singleton float: com::sun::star::uno::XNamingService; +singleton for: com::sun::star::uno::XNamingService; +singleton goto: com::sun::star::uno::XNamingService; +singleton if: com::sun::star::uno::XNamingService; +singleton implements: com::sun::star::uno::XNamingService; +singleton import: com::sun::star::uno::XNamingService; +singleton instanceof: com::sun::star::uno::XNamingService; +singleton int: com::sun::star::uno::XNamingService; +//TODO: singleton interface: com::sun::star::uno::XNamingService; +//TODO: singleton long: com::sun::star::uno::XNamingService; +singleton native: com::sun::star::uno::XNamingService; +singleton new: com::sun::star::uno::XNamingService; +singleton package: com::sun::star::uno::XNamingService; +singleton private: com::sun::star::uno::XNamingService; +singleton protected: com::sun::star::uno::XNamingService; +singleton public: com::sun::star::uno::XNamingService; +singleton return: com::sun::star::uno::XNamingService; +//TODO: singleton short: com::sun::star::uno::XNamingService; +singleton static: com::sun::star::uno::XNamingService; +singleton strictfp: com::sun::star::uno::XNamingService; +singleton super: com::sun::star::uno::XNamingService; +//TODO: singleton switch: com::sun::star::uno::XNamingService; +singleton synchronized: com::sun::star::uno::XNamingService; +singleton this: com::sun::star::uno::XNamingService; +singleton throw: com::sun::star::uno::XNamingService; +singleton throws: com::sun::star::uno::XNamingService; +//TODO: singleton transient: com::sun::star::uno::XNamingService; +singleton try: com::sun::star::uno::XNamingService; +//TODO: singleton void: com::sun::star::uno::XNamingService; +singleton volatile: com::sun::star::uno::XNamingService; +singleton while: com::sun::star::uno::XNamingService; + +}; }; }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |