merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / ifc / system / _XProxySettings.java
blob410ddfef8c4b51e44398c66efb9889488bfba20d
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: _XProxySettings.java,v $
10 * $Revision: 1.4 $
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 ifc.system;
33 import java.util.Hashtable;
35 import lib.MultiMethodTest;
36 import lib.Status;
37 import lib.StatusException;
39 import com.sun.star.system.XProxySettings;
41 /**
42 * Tests <code>com.sun.star.system.XProxySettings</code> interface. The result
43 * of each method is compared with expected settings which is specified by the
44 * caller of the tests via object relation "XProxySettings.proxaSettings". That
45 * should be a Hashtable containing the following keys:
46 * <ul>
47 * <li>ftpProxyAddress</li>
48 * <li>ftpProxyPort</li>
49 * <li>gopherProxyAddress</li>
50 * <li>gopherProxyPort</li>
51 * <li>httpProxyAddress</li>
52 * <li>httpProxyPort</li>
53 * <li>httpsProxyAddress</li>
54 * <li>httpsProxyPort</li>
55 * <li>socksProxyAddress</li>
56 * <li>socksProxyPort</li>
57 * <li>proxyBypassAddress</li>
58 * <li>proxyEnabled</li>
59 * </ul>.
60 * Each value for a key, should be a String specifying the correct result of
61 * the corresponding getXXX() method of XProxySettings interface.
62 * <p>If the object relation is not specified the test failes.
65 public class _XProxySettings extends MultiMethodTest {
66 public XProxySettings oObj;
68 /**
69 * Contains a Hashtable with correct results of the tested methods. See
70 * the class description.
72 Hashtable expectedProxies;
74 /**
75 * Checks that the "XProxySettings.proxySettings" object relation is
76 * specified and stores its value to <code>expectedProxies</code> field.
78 * @throws StatusException is the object relation is not specified.
80 * @see #expectedProxies
82 public void before() {
83 expectedProxies = (Hashtable)tEnv.getObjRelation(
84 "XProxySettings.proxySettings");
86 if (expectedProxies == null) {
87 throw new StatusException(
88 Status.failed("Expected proxy settings are not specified"));
92 /**
93 * Calls <code>getFtpProxyAddress()</code> and verifies its result with
94 * "ftpProxyAddress" value of <code>expectedProxies</code>.
96 * @see #expectedProxies
98 public void _getFtpProxyAddress() {
99 String ftpProxyAddress = oObj.getFtpProxyAddress();
100 String expectedFtpProxyAddress = (String)
101 expectedProxies.get("ftpProxyAddress");
103 log.println("getFtpProxyAddress");
104 log.println("getting: "+ftpProxyAddress);
105 log.println("expected: "+expectedFtpProxyAddress);
107 tRes.tested("getFtpProxyAddress()",
108 ftpProxyAddress.equals(expectedFtpProxyAddress));
112 * Calls <code>getFtpProxyPort()</code> and verifies its result with
113 * "ftpProxyPort" value of <code>expectedProxies</code>.
115 * @see #expectedProxies
117 public void _getFtpProxyPort() {
118 String ftpProxyPort = oObj.getFtpProxyPort();
119 String expectedFtpProxyPort = (String)
120 expectedProxies.get("ftpProxyPort");
122 log.println("getFtpProxyPort");
123 log.println("getting: "+ftpProxyPort);
124 log.println("expected: "+expectedFtpProxyPort);
126 tRes.tested("getFtpProxyPort()",
127 ftpProxyPort.equals(expectedFtpProxyPort));
131 * Calls <code>getGopherProxyAddress()</code> and verifies its result with
132 * "gopherProxyAddress" value of <code>expectedProxies</code>.
134 * @see #expectedProxies
136 public void _getGopherProxyAddress() {
137 String gopherProxyAddress = oObj.getGopherProxyAddress();
138 String expectedGopherProxyAddress = (String)
139 expectedProxies.get("gopherProxyAddress");
141 tRes.tested("getGopherProxyAddress()",
142 gopherProxyAddress.equals(expectedGopherProxyAddress));
146 * Calls <code>getGopherProxyPort()</code> and verifies its result with
147 * "gopherProxyPort" value of <code>expectedProxies</code>.
149 * @see #expectedProxies
151 public void _getGopherProxyPort() {
152 String gopherProxyPort = oObj.getGopherProxyPort();
153 String expectedGopherProxyPort = (String)
154 expectedProxies.get("gopherProxyPort");
156 tRes.tested("getGopherProxyPort()",
157 gopherProxyPort.equals(expectedGopherProxyPort));
161 * Calls <code>getHttpProxyAddress()</code> and verifies its result with
162 * "httpProxyAddress" value of <code>expectedProxies</code>.
164 * @see #expectedProxies
166 public void _getHttpProxyAddress() {
167 String httpProxyAddress = oObj.getHttpProxyAddress();
168 String expectedHttpProxyAddress = (String)
169 expectedProxies.get("httpProxyAddress");
171 log.println("getHttpProxyAddress");
172 log.println("getting: "+httpProxyAddress);
173 log.println("expected: "+expectedHttpProxyAddress);
175 tRes.tested("getHttpProxyAddress()",
176 httpProxyAddress.equals(expectedHttpProxyAddress));
180 * Calls <code>getHttpProxyPort()</code> and verifies its result with
181 * "httpProxyPort" value of <code>expectedProxies</code>.
183 * @see #expectedProxies
185 public void _getHttpProxyPort() {
186 String httpProxyPort = oObj.getHttpProxyPort();
187 String expectedHttpProxyPort = (String)
188 expectedProxies.get("httpProxyPort");
190 log.println("getHttpProxyPort");
191 log.println("getting: "+httpProxyPort);
192 log.println("expected: "+expectedHttpProxyPort);
194 tRes.tested("getHttpProxyPort()",
195 httpProxyPort.equals(expectedHttpProxyPort));
199 * Calls <code>getHttpsProxyAddress()</code> and verifies its result with
200 * "httpsProxyAddress" value of <code>expectedProxies</code>.
202 * @see #expectedProxies
204 public void _getHttpsProxyAddress() {
205 String httpsProxyAddress = oObj.getHttpsProxyAddress();
206 String expectedHttpsProxyAddress = (String)
207 expectedProxies.get("httpsProxyAddress");
209 log.println("getHttpsProxyAddress");
210 log.println("getting: "+httpsProxyAddress);
211 log.println("expected: "+expectedHttpsProxyAddress);
213 tRes.tested("getHttpsProxyAddress()",
214 httpsProxyAddress.equals(expectedHttpsProxyAddress));
218 * Calls <code>getHttpsProxyPort()</code> and verifies its result with
219 * "httpsProxyPort" value of <code>expectedProxies</code>.
221 * @see #expectedProxies
223 public void _getHttpsProxyPort() {
224 String httpsProxyPort = oObj.getHttpsProxyPort();
225 String expectedHttpsProxyPort = (String)
226 expectedProxies.get("httpsProxyPort");
228 log.println("getHttpsProxyPort");
229 log.println("getting: "+httpsProxyPort);
230 log.println("expected: "+expectedHttpsProxyPort);
232 tRes.tested("getHttpsProxyPort()",
233 httpsProxyPort.equals(expectedHttpsProxyPort));
237 * Calls <code>getProxyBypassAddress()</code> and verifies its result with
238 * "proxyBypassAddress" value of <code>expectedProxies</code>.
240 * @see #expectedProxies
242 public void _getProxyBypassAddress() {
243 String proxyBypassAddress = oObj.getProxyBypassAddress();
244 String expectedProxyBypassAddress = (String)
245 expectedProxies.get("proxyBypassAddress");
247 log.println("getProxyBypassAddress");
248 log.println("getting: "+proxyBypassAddress);
249 log.println("expected: "+expectedProxyBypassAddress);
251 tRes.tested("getProxyBypassAddress()",
252 proxyBypassAddress.equals(expectedProxyBypassAddress));
256 * Calls <code>getSocksProxyAddress()</code> and verifies its result with
257 * "socksProxyAddress" value of <code>expectedProxies</code>.
259 * @see #expectedProxies
261 public void _getSocksProxyAddress() {
262 String socksProxyAddress = oObj.getSocksProxyAddress();
263 String expectedSocksProxyAddress = (String)
264 expectedProxies.get("socksProxyAddress");
266 log.println("getSocksProxyAddress");
267 log.println("getting: "+socksProxyAddress);
268 log.println("expected: "+expectedSocksProxyAddress);
270 tRes.tested("getSocksProxyAddress()",
271 socksProxyAddress.equals(expectedSocksProxyAddress));
275 * Calls <code>getSocksProxyPort()</code> and verifies its result with
276 * "socksProxyPort" value of <code>expectedProxies</code>.
278 * @see #expectedProxies
280 public void _getSocksProxyPort() {
281 String socksProxyPort = oObj.getSocksProxyPort();
282 String expectedSocksProxyPort = (String)
283 expectedProxies.get("socksProxyPort");
285 log.println("getSocksProxyPort");
286 log.println("getting: "+socksProxyPort);
287 log.println("expected: "+expectedSocksProxyPort);
289 tRes.tested("getSocksProxyPort()",
290 socksProxyPort.equals(expectedSocksProxyPort));
294 * Calls <code>isProxyEnabled()</code> and verifies its result with
295 * "proxyEnabled" value of <code>expectedProxies</code>.
297 * @see #expectedProxies
299 public void _isProxyEnabled() {
300 boolean proxyEnabled = oObj.isProxyEnabled();
302 String proxyEnabledStr = (String)expectedProxies.get("proxyEnabled");
303 boolean expected = proxyEnabledStr != null
304 && proxyEnabledStr.equalsIgnoreCase("true");
306 tRes.tested("isProxyEnabled()", proxyEnabled == expected);