1   /**
2    *  MicroEmulator
3    *  Copyright (C) 2006-2007 Bartek Teodorczyk <barteo@barteo.net>
4    *  Copyright (C) 2006-2007 Vlad Skarzhevskyy
5    *
6    *  This library is free software; you can redistribute it and/or
7    *  modify it under the terms of the GNU Lesser General Public
8    *  License as published by the Free Software Foundation; either
9    *  version 2.1 of the License, or (at your option) any later version.
10   *
11   *  This library is distributed in the hope that it will be useful,
12   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14   *  Lesser General Public License for more details.
15   *
16   *  You should have received a copy of the GNU Lesser General Public
17   *  License along with this library; if not, write to the Free Software
18   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19   *
20   *  @version $Id: BaseGCFTestCase.java 900 2007-02-13 18:45:30Z vlads $
21   */
22  package javax.microedition.io;
23  
24  import org.microemu.SSLContextSetup;
25  import org.microemu.TestEnvPropertiesHelper;
26  
27  import junit.framework.TestCase;
28  
29  /**
30   * @author vlads
31   *
32   */
33  public class BaseGCFTestCase extends TestCase {
34  
35  	/**
36  	 * This is the server where I keep HTTPS and Socket test response server.
37  	 * If change add server to test-servers.keystore if it self-signed certificate.
38  	 * 
39  	 * War sources here https://pyx4j.com/svn/pyx4me/pyx4me-host/pyx4me-test-server
40  	 * 
41  	 */
42  	public static final String TEST_HOST = findNoProxyTestHost();
43  
44  	/**
45  	 * File  ${home}/.microemulator/tests.properties is used for configuration
46  	 * @return
47  	 */
48  	private static String findNoProxyTestHost() {
49  		return TestEnvPropertiesHelper.getProperty("gcf.no-proxy-test-host", "pyx4j.com");
50  	}
51  
52  	/**
53  	 * TODO Support proxy configuration.
54  	 */
55  	protected void setUp() throws Exception {
56  		// Some tests may run via proxy but not all.
57  		if (System.getProperty("http.proxyHost") == null) {
58  			//System.setProperty("http.proxyHost", "genproxy");
59  			//System.setProperty("http.proxyPort", String.valueOf(8900));
60  		}
61  	}
62  
63  	/**
64  	 * Trust our self-signed test-servers
65  	 */
66  	protected void setupSSLContext() {
67  	    SSLContextSetup.setUp();
68  	}
69  }