office-gobmx/bridges/test/java_remote/Bug51323_Test.java
Noel Grandin 0477e6c39b java: add @Override annotation to overriding methods
Change-Id: I086964c6f6ce52c60c52b6dbc445d3c21d22c80a
2014-08-12 09:41:28 +02:00

76 lines
2.7 KiB
Java

/*
* 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.java_remote;
import com.sun.star.bridge.XBridgeFactory;
import com.sun.star.bridge.XInstanceProvider;
import com.sun.star.connection.Connector;
import com.sun.star.connection.XConnection;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
import com.sun.star.uno.XInterface;
import complexlib.ComplexTestCase;
import test.lib.TestBed;
/**
* Test case for bug #i51323#.
*
* <p>Bug #i51323# "jurt: BridgeFactory.createBridge creates bridge names."
* Make sure that multiple calls to BridgeFactory.getBridge with empty names
* create different bridges.</p>
*/
public final class Bug51323_Test extends ComplexTestCase {
@Override
public String[] getTestMethodNames() {
return new String[] { "test" };
}
public void test() throws Exception {
assure(
"test",
new TestBed().execute(new Provider(), false, Client.class, 0));
}
public static final class Client extends TestBed.Client {
public static void main(String[] args) {
new Client().execute();
}
@Override
protected boolean run(XComponentContext context) throws Throwable {
XConnection connection =
Connector.create(context).connect(getConnectionDescription());
XBridgeFactory factory = UnoRuntime.queryInterface(
XBridgeFactory.class,
context.getServiceManager().createInstanceWithContext(
"com.sun.star.bridge.BridgeFactory", context));
return !UnoRuntime.areSame(
factory.createBridge(
"", getProtocolDescription(), connection, null),
factory.createBridge(
"", getProtocolDescription(), connection, null));
}
}
private static final class Provider implements XInstanceProvider {
public Object getInstance(String instanceName) {
return new XInterface() {};
}
}
}