1   /**
2    *  MicroEmulator
3    *  Copyright (C) 2006-2007 Bartek Teodorczyk <barteo@barteo.net>
4    *  Copyright (C) 2006-2007 Vlad Skarzhevskyy
5    *
6    *  It is licensed under the following two licenses as alternatives:
7    *    1. GNU Lesser General Public License (the "LGPL") version 2.1 or any newer version
8    *    2. Apache License (the "AL") Version 2.0
9    *
10   *  You may not use this file except in compliance with at least one of
11   *  the above two licenses.
12   *
13   *  You may obtain a copy of the LGPL at
14   *      http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
15   *
16   *  You may obtain a copy of the AL at
17   *      http://www.apache.org/licenses/LICENSE-2.0
18   *
19   *  Unless required by applicable law or agreed to in writing, software
20   *  distributed under the License is distributed on an "AS IS" BASIS,
21   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22   *  See the LGPL or the AL for the specific language governing permissions and
23   *  limitations.
24   *
25   *  @version $Id: BaseGCFTestCase.java 1605 2008-02-25 21:07:14Z barteo $
26   */
27  package javax.microedition.io;
28  
29  import org.microemu.SSLContextSetup;
30  import org.microemu.TestEnvPropertiesHelper;
31  
32  import junit.framework.TestCase;
33  
34  /**
35   * @author vlads
36   *
37   */
38  public class BaseGCFTestCase extends TestCase {
39  
40  	/**
41  	 * This is the server where I keep HTTPS and Socket test response server.
42  	 * If change add server to test-servers.keystore if it self-signed certificate.
43  	 * 
44  	 * War sources here https://pyx4j.com/svn/pyx4me/pyx4me-host/pyx4me-test-server
45  	 * 
46  	 */
47  	public static final String TEST_HOST = findNoProxyTestHost();
48  
49  	/**
50  	 * File  ${home}/.microemulator/tests.properties is used for configuration
51  	 * @return
52  	 */
53  	private static String findNoProxyTestHost() {
54  		return TestEnvPropertiesHelper.getProperty("gcf.no-proxy-test-host", "pyx4j.com");
55  	}
56  
57  	/**
58  	 * TODO Support proxy configuration.
59  	 */
60  	protected void setUp() throws Exception {
61  		// Some tests may run via proxy but not all.
62  		if (System.getProperty("http.proxyHost") == null) {
63  			//System.setProperty("http.proxyHost", "genproxy");
64  			//System.setProperty("http.proxyPort", String.valueOf(8900));
65  		}
66  	}
67  
68  	/**
69  	 * Trust our self-signed test-servers
70  	 */
71  	protected void setupSSLContext() {
72  	    SSLContextSetup.setUp();
73  	}
74  }