svx: prefix members of SdrUnoObj
[LibreOffice.git] / qadevOOo / tests / java / mod / _bridgefac / uno / BridgeFactory.java
blob1860e3638104b3504e5c03983c139c3d4b594c88
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 mod._bridgefac.uno;
21 import com.sun.star.uno.XInterface;
22 import java.io.PrintWriter;
23 import lib.TestCase;
24 import lib.TestEnvironment;
25 import lib.TestParameters;
26 import util.utils;
28 /**
29 * Tests <code>com.sun.star.bridge.BridgeFactory</code>
30 * service. <p>
31 * @see com.sun.star.bridge.XBridgeFactory
32 * @see com.sun.star.lang.XComponent
33 * @see ifc.bridge._XBridgeFactory
34 * @see ifc.lang._XComponent
36 public class BridgeFactory extends TestCase {
38 /**
39 * Retrieves host name where StarOffice is started from test
40 * parameter <code>'CONNECTION_STRING'</code>.
42 @Override
43 protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception {
44 String cncstr = (String) tParam.get("CONNECTION_STRING") ;
45 int idx = cncstr.indexOf("host=") + 5 ;
46 sOfficeHost = cncstr.substring(idx, cncstr.indexOf(",", idx)) ;
49 @Override
50 protected void cleanup( TestParameters tParam, PrintWriter log ) {
53 /**
54 * Acceptor chooses the first port after <code>basePort</code>
55 * which is free.
57 protected static final int basePort = 50003 ;
58 private int curPort ;
59 private static String sOfficeHost = null ;
61 /**
62 * Creating a TestEnvironment for the interfaces to be tested.
63 * Just creates <code>com.sun.star.bridge.BridgeFactory</code>
64 * service as object to be tested.
66 @Override
67 protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception {
69 XInterface oObj = (XInterface)
70 Param.getMSF().createInstance
71 ("com.sun.star.bridge.BridgeFactory") ;
73 TestEnvironment tEnv = new TestEnvironment(oObj) ;
75 // select the port
76 curPort = utils.getNextFreePort(basePort);
77 log.println("Choose Port nr: " + curPort);
79 // adding connection string as relation
80 tEnv.addObjRelation("CNNCTSTR",
81 "socket,host=" + sOfficeHost + ",port=" + curPort) ;
83 // adding port number for freeing it.
84 tEnv.addObjRelation("Connector.Port", Integer.valueOf(curPort)) ;
86 return tEnv ;
89 /**
90 * Just clears flag which indicates that port is free now.
92 @Override
93 public synchronized void disposeTestEnvironment( TestEnvironment tEnv,
94 TestParameters tParam) {
95 curPort = ((Integer)tEnv.getObjRelation("Connector.Port")).intValue() ;