1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package com.sun.star.lib.uno.bridges.java_remote; 25 26 import com.sun.star.bridge.XBridge; 27 import com.sun.star.uno.Type; 28 import com.sun.star.uno.XInterface; 29 import complexlib.ComplexTestCase; 30 31 public final class BridgedObject_Test extends ComplexTestCase { getTestMethodNames()32 public String[] getTestMethodNames() { 33 return new String[] { "test" }; 34 } 35 test()36 public void test() { 37 RequestHandler handler = new RequestHandler() { 38 public Object sendRequest( 39 String oid, Type type, String operation, Object[] args) 40 { 41 return null; 42 } 43 }; 44 XBridge bridge1 = new TestBridge(); 45 ProxyFactory factory1 = new ProxyFactory(handler, bridge1); 46 XBridge bridge2 = new TestBridge(); 47 ProxyFactory factory2 = new ProxyFactory(handler, bridge2); 48 Object object0 = new Object(); 49 Object object1 = factory1.create("", new Type(XInterface.class)); 50 Object object2 = factory2.create("", new Type(XInterface.class)); 51 assure(BridgedObject.getBridge(object0) == null); 52 assure(BridgedObject.getBridge(object1) == bridge1); 53 assure(BridgedObject.getBridge(object2) == bridge2); 54 } 55 56 private static final class TestBridge implements XBridge { getInstance(String instanceName)57 public Object getInstance(String instanceName) { 58 return null; 59 } 60 getName()61 public String getName() { 62 return null; 63 } 64 getDescription()65 public String getDescription() { 66 return null; 67 } 68 } 69 } 70