merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / mod / _proxyset / SOffice52ProxySettings.java
blob64d189149925ad98b6acbb5a14dbdf0366f8855e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SOffice52ProxySettings.java,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package mod._proxyset;
33 import java.io.PrintWriter;
34 import java.util.Hashtable;
36 import lib.StatusException;
37 import lib.TestCase;
38 import lib.TestEnvironment;
39 import lib.TestParameters;
41 import com.sun.star.lang.XMultiServiceFactory;
42 import com.sun.star.uno.XInterface;
44 /**
45 * Test for object which is represented by service
46 * <code>com.sun.star.system.SOffice52ProxySettings</code>. <p>
47 * Object implements the following interfaces :
48 * <ul>
49 * <li> <code>com::sun::star::lang::XServiceInfo</code></li>
50 * <li> <code>com::sun::star::system::XProxySettings</code></li>
51 * <li> <code>com::sun::star::lang::XTypeProvider</code></li>
52 * </ul> <p>
54 * This object test <b> is NOT </b> designed to be run in several
55 * threads concurently.
57 * @see com.sun.star.lang.XServiceInfo
58 * @see com.sun.star.system.XProxySettings
59 * @see com.sun.star.lang.XTypeProvider
60 * @see ifc.lang._XServiceInfo
61 * @see ifc.system._XProxySettings
62 * @see ifc.lang._XTypeProvider
64 public class SOffice52ProxySettings extends TestCase {
66 /**
67 * Creating a Testenvironment for the interfaces to be tested.
68 * Creates an instance of
69 * <code>com.sun.star.system.SOffice52ProxySettings</code>,for testing.
71 * Object relations created :
72 * <ul>
73 * <li> <code>'XProxySettings.proxySettings'</code> for
74 * {@link ifc.system._XProxySettings} : </li>
75 * <p>It passes a Hashtable with expected proxy settings as object
76 * relation "XProxySettings.proxySettings", to verify results. The expected
77 * settings are taken from parameters. The following parameters are recognized:
78 * <ul>
79 * <li>test.proxy.soffice52.ftpProxyAddress</li>
80 * <li>test.proxy.soffice52.ftpProxyPort</li>
81 * <li>test.proxy.soffice52.gopherProxyAddress</li>
82 * <li>test.proxy.soffice52.gopherProxyPort</li>
83 * <li>test.proxy.soffice52.httpProxyAddress</li>
84 * <li>test.proxy.soffice52.httpProxyPort</li>
85 * <li>test.proxy.soffice52.httpsProxyAddress</li>
86 * <li>test.proxy.soffice52.httpsProxyPort</li>
87 * <li>test.proxy.soffice52.socksProxyAddress</li>
88 * <li>test.proxy.soffice52.socksProxyPort</li>
89 * <li>test.proxy.soffice52.proxyBypassAddress</li>
90 * <li>test.proxy.soffice52.proxyEnabled</li>
91 * </ul>.
92 * </ul>
94 protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) {
95 XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF();
96 XInterface oObj = null;
98 try {
99 oObj = (XInterface)xMSF.createInstance(
100 "com.sun.star.system.SOffice52ProxySettings");
101 } catch (com.sun.star.uno.Exception e) {
102 e.printStackTrace(log);
103 throw new StatusException("Unexpected exception", e);
106 String Iname = util.utils.getImplName(oObj);
107 log.println("Implementation Name: "+Iname);
108 TestEnvironment tEnv = new TestEnvironment(oObj);
110 // extracting parameters to proxy settings
111 Hashtable proxySettings = new Hashtable(12);
113 String prefix = "test.proxy.soffice52.";
115 final String[] names = {
116 "ftpProxyAddress",
117 "ftpProxyPort",
118 "gopherProxyAddress",
119 "gopherProxyPort",
120 "httpProxyAddress",
121 "httpProxyPort",
122 "httpsProxyAddress",
123 "httpsProxyPort",
124 "socksProxyAddress",
125 "socksProxyPort",
126 "proxyBypassAddress",
127 "proxyEnabled"
130 for (int i = 0; i < names.length; i++) {
131 String name = prefix + names[i];
132 String value = (String) tParam.get(name);
134 if (value == null) {
135 value = "";
138 proxySettings.put(names[i], value);
141 tEnv.addObjRelation("XProxySettings.proxySettings", proxySettings);
143 return tEnv;
146 } // finish class TestCase