bump product version to 4.1.6.2
[LibreOffice.git] / bridges / test / java_remote / Bug51323_Test.java
blobbf177fdfc5ff0add18e5740d8083c64cdd2b93ab
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.XBridgeFactory;
22 import com.sun.star.bridge.XInstanceProvider;
23 import com.sun.star.connection.Connector;
24 import com.sun.star.connection.XConnection;
25 import com.sun.star.uno.UnoRuntime;
26 import com.sun.star.uno.XComponentContext;
27 import com.sun.star.uno.XInterface;
28 import complexlib.ComplexTestCase;
29 import test.lib.TestBed;
31 /**
32 * Test case for bug #i51323#.
34 * <p>Bug #i51323# "jurt: BridgeFactory.createBridge creates bridge names."
35 * Make sure that multiple calls to BridgeFactory.getBridge with empty names
36 * create different bridges.</p>
38 public final class Bug51323_Test extends ComplexTestCase {
39 public String[] getTestMethodNames() {
40 return new String[] { "test" };
43 public void test() throws Exception {
44 assure(
45 "test",
46 new TestBed().execute(new Provider(), false, Client.class, 0));
49 public static final class Client extends TestBed.Client {
50 public static void main(String[] args) {
51 new Client().execute();
54 protected boolean run(XComponentContext context) throws Throwable {
55 XConnection connection =
56 Connector.create(context).connect(getConnectionDescription());
57 XBridgeFactory factory = UnoRuntime.queryInterface(
58 XBridgeFactory.class,
59 context.getServiceManager().createInstanceWithContext(
60 "com.sun.star.bridge.BridgeFactory", context));
61 return !UnoRuntime.areSame(
62 factory.createBridge(
63 "", getProtocolDescription(), connection, null),
64 factory.createBridge(
65 "", getProtocolDescription(), connection, null));
69 private static final class Provider implements XInstanceProvider {
70 public Object getInstance(String instanceName) {
71 return new XInterface() {};