1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SystemProxySettings.java,v $
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
;
37 import lib
.TestEnvironment
;
38 import lib
.TestParameters
;
40 import com
.sun
.star
.lang
.XMultiServiceFactory
;
41 import com
.sun
.star
.uno
.XInterface
;
44 * Test for object which is represented by service
45 * <code>com.sun.star.system.SystemProxySettings</code>. <p>
46 * Object implements the following interfaces :
48 * <li> <code>com::sun::star::lang::XServiceInfo</code></li>
49 * <li> <code>com::sun::star::system::XProxySettings</code></li>
50 * <li> <code>com::sun::star::lang::XTypeProvider</code></li>
53 * This object test <b> is NOT </b> designed to be run in several
54 * threads concurently.
56 * @see com.sun.star.lang.XServiceInfo
57 * @see com.sun.star.system.XProxySettings
58 * @see com.sun.star.lang.XTypeProvider
59 * @see ifc.lang._XServiceInfo
60 * @see ifc.system._XProxySettings
61 * @see ifc.lang._XTypeProvider
63 public class SystemProxySettings
extends TestCase
{
66 * Creating a Testenvironment for the interfaces to be tested.
67 * Creates an instance of
68 * <code>com.sun.star.system.SystemProxySettings</code>,for testing.
70 * Object relations created :
72 * <li> <code>'XProxySettings.proxySettings'</code> for
73 * {@link ifc.system._XProxySettings} : </li>
74 * <p>It passes a Hashtable with expected proxy settings as object
75 * relation "XProxySettings.proxySettings", to verify results. The expected
76 * settings are taken from parameters. The following parameters are recognized:
78 * <li>test.proxy.soffice52.ftpProxyAddress</li>
79 * <li>test.proxy.soffice52.ftpProxyPort</li>
80 * <li>test.proxy.soffice52.gopherProxyAddress</li>
81 * <li>test.proxy.soffice52.gopherProxyPort</li>
82 * <li>test.proxy.soffice52.httpProxyAddress</li>
83 * <li>test.proxy.soffice52.httpProxyPort</li>
84 * <li>test.proxy.soffice52.httpsProxyAddress</li>
85 * <li>test.proxy.soffice52.httpsProxyPort</li>
86 * <li>test.proxy.soffice52.socksProxyAddress</li>
87 * <li>test.proxy.soffice52.socksProxyPort</li>
88 * <li>test.proxy.soffice52.proxyBypassAddress</li>
89 * <li>test.proxy.soffice52.proxyEnabled</li>
93 protected TestEnvironment createTestEnvironment
94 (TestParameters tParam
, PrintWriter log
) {
95 XInterface oObj
= null;
96 Object oInterface
= null;
99 XMultiServiceFactory xMSF
= (XMultiServiceFactory
)tParam
.getMSF();
100 oInterface
= xMSF
.createInstance
101 ( "com.sun.star.system.SystemProxySettings" );
103 catch( com
.sun
.star
.uno
.Exception e
) {
104 log
.println("Service not available" );
107 oObj
= (XInterface
) oInterface
;
109 log
.println( " creating a new environment for object" );
110 TestEnvironment tEnv
= new TestEnvironment( oObj
);
112 // extracting parameters to proxy settings
113 Hashtable proxySettings
= new Hashtable(12);
115 String prefix
= "test.proxy.system.";
117 final String
[] names
= {
120 "gopherProxyAddress",
128 "proxyBypassAddress",
132 for (int i
= 0; i
< names
.length
; i
++) {
133 String name
= prefix
+ names
[i
];
134 String value
= (String
) tParam
.get(name
);
140 proxySettings
.put(names
[i
], value
);
143 tEnv
.addObjRelation("XProxySettings.proxySettings", proxySettings
);