PipedConnection leftSide = new PipedConnection(new Object[]{rightSide});
BridgeFactory bridgeFactory = new BridgeFactory(); // create the needed bridgeFactory
// create a bridge
XBridge xBridge = bridgeFactory.createBridge("testbridge", "urp", (XConnection)leftSide, null);
// test that we get the same bridge
assure("", UnoRuntime.areSame(xBridge,
bridgeFactory.getBridge("testbridge")));
// test that we can not create another bridge with same name
try {
XBridge dummy = bridgeFactory.createBridge("testbridge", "urp", (XConnection)leftSide, null);
failed("");
}
catch(BridgeExistsException bridgeExistsException) {
}
// test getExistingBridges
XBridge xBridges[] = bridgeFactory.getExistingBridges();
assure("", UnoRuntime.areSame(xBridge, xBridges[0]));
// dispose the bridge
XComponent xComponent = UnoRuntime.queryInterface(XComponent.class, xBridge);
xComponent.dispose();
// test that the bridge has been removed
assure("", bridgeFactory.getBridge("testbridge") == null);
rightSide = new PipedConnection(new Object[0]);
leftSide = new PipedConnection(new Object[]{rightSide});
// test that we really get a new bridge
XBridge xBridge_new = bridgeFactory.createBridge("testbridge", "urp", (XConnection)leftSide, null);
assure("", !UnoRuntime.areSame(xBridge, xBridge_new));
for(int i = 0; i <10000; ++ i) {
Object x[] = new Object[100];
}