bump product version to 4.1.6.2
[LibreOffice.git] / bridges / test / java_remote / Bug92174_Test.java
blob2e26ce14cc99a4ffc4f9e531bb7ad25cd0f8f0a6
1 /*
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 test.java_remote;
21 import com.sun.star.bridge.XInstanceProvider;
22 import com.sun.star.lib.uno.typeinfo.MethodTypeInfo;
23 import com.sun.star.lib.uno.typeinfo.TypeInfo;
24 import com.sun.star.uno.UnoRuntime;
25 import com.sun.star.uno.XComponentContext;
26 import com.sun.star.uno.XInterface;
27 import complexlib.ComplexTestCase;
28 import test.lib.TestBed;
30 public final class Bug92174_Test extends ComplexTestCase {
31 public String[] getTestMethodNames() {
32 return new String[] { "test" };
35 public void test() throws Exception {
36 assure("test",
37 new TestBed().execute(new Provider(), false, Client.class, 0));
40 public static final class Client extends TestBed.Client {
41 public static void main(String[] args) {
42 new Client().execute();
45 protected boolean run(XComponentContext context) throws Throwable {
46 XTransport t = UnoRuntime.queryInterface(
47 XTransport.class, getBridge(context).getInstance("Transport"));
48 t.setDerived(new XDerived() {
49 public void fn() {}
50 });
51 t.getBase().fn();
52 return true;
56 private static final class Provider implements XInstanceProvider {
57 public Object getInstance(String instanceName) {
58 return new XTransport() {
59 public XBase getBase() {
60 return derived;
63 public synchronized void setDerived(XDerived derived) {
64 this.derived = derived;
67 private XDerived derived = null;
72 public interface XBase extends XInterface {
73 void fn();
75 TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("fn", 0, 0) };
78 public interface XDerived extends XBase {
79 TypeInfo[] UNOTYPEINFO = null;
82 public interface XTransport extends XInterface {
83 XBase getBase();
85 void setDerived(XDerived derived);
87 TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("getBase", 0, 0),
88 new MethodTypeInfo("setDerived", 1, 0) };