bump product version to 4.1.6.2
[LibreOffice.git] / bridges / test / java_remote / Bug114133_Test.java
blob01a34dc5cb2999c3b98fadcc7f696fa790868cdc
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.uno.XComponentContext;
23 import com.sun.star.uno.XInterface;
24 import complexlib.ComplexTestCase;
25 import util.WaitUnreachable;
26 import test.lib.TestBed;
28 /**
29 * Test case for bug #114133#.
31 * <p>Bug #114133# "Java UNO: UnoRuntime.getBride and disposed bridges." The
32 * client calls UnoRuntime.getBridge to get a bridge to the server, uses the
33 * bridge, waits until it terminates itself (when all bridged objects have been
34 * garbage-collected), then calls UnoRuntime.getBridge again. This must return
35 * a fresh, unterminated bridge.</p>
37 public final class Bug114133_Test extends ComplexTestCase {
38 public String[] getTestMethodNames() {
39 return new String[] { "test" };
42 public void test() throws Exception {
43 assure(
44 "test",
45 new TestBed().execute(new Provider(), false, Client.class, 0));
48 public static final class Client extends TestBed.Client {
49 public static void main(String[] args) {
50 new Client().execute();
53 protected boolean run(XComponentContext context) throws Throwable {
54 new WaitUnreachable(getBridge(context).getInstance("Test")).
55 waitUnreachable();
56 new WaitUnreachable(getBridge(context).getInstance("Test")).
57 waitUnreachable();
58 return true;
62 private static final class Provider implements XInstanceProvider {
63 public Object getInstance(String instanceName) {
64 return new XInterface() {};