KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > testsuite > regression > AppletRegressionTest


1 /*
2  Copyright (C) 2002-2004 MySQL AB
3
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of version 2 of the GNU General Public License as
6  published by the Free Software Foundation.
7
8  There are special exceptions to the terms and conditions of the GPL
9  as it is applied to this software. View the full text of the
10  exception in file EXCEPTIONS-CONNECTOR-J in the directory of this
11  software distribution.
12
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
22
23
24  */

25 package testsuite.regression;
26
27 import java.util.Properties JavaDoc;
28
29 import sun.applet.AppletSecurity;
30 import testsuite.BaseTestCase;
31
32 /**
33  * Tests various applet-related issues.
34  *
35  * @author Mark Matthews
36  * @version $Id: AppletRegressionTest.java,v 1.1.2.1 2005/05/13 18:58:38
37  * mmatthews Exp $
38  */

39 public class AppletRegressionTest extends BaseTestCase {
40     private final static String JavaDoc TOGGLE_RUN_PROPERTY = "com.mysql.jdbc.testsuite.regression.runAppletRegressionTest";
41
42     /**
43      * DOCUMENT ME!
44      *
45      * @param name
46      */

47     public AppletRegressionTest(String JavaDoc name) {
48         super(name);
49
50         // TODO Auto-generated constructor stub
51
}
52
53     /**
54      * Runs all test cases in this test suite
55      *
56      * @param args
57      */

58     public static void main(String JavaDoc[] args) {
59         System.setProperty(TOGGLE_RUN_PROPERTY, "true");
60         junit.textui.TestRunner.run(AppletRegressionTest.class);
61     }
62
63     /**
64      * Tests if the driver wors with an Applet security manager installed.
65      *
66      * @throws Exception
67      * if the test fails
68      */

69     public void testAppletSecurityManager() throws Exception JavaDoc {
70         if ("true".equalsIgnoreCase(System.getProperty(TOGGLE_RUN_PROPERTY))) {
71             System.setSecurityManager(new CustomAppletSecurity());
72
73             getConnectionWithProps(new Properties JavaDoc());
74         }
75     }
76
77     /**
78      * We need to customize the security manager a 'bit', so that JUnit still
79      * works (and we can connect to various databases).
80      */

81     class CustomAppletSecurity extends AppletSecurity {
82         /*
83          * (non-Javadoc)
84          *
85          * @see java.lang.SecurityManager#checkAccess(java.lang.Thread)
86          */

87         public synchronized void checkAccess(Thread JavaDoc arg0) {
88         }
89
90         /*
91          * (non-Javadoc)
92          *
93          * @see java.lang.SecurityManager#checkConnect(java.lang.String, int,
94          * java.lang.Object)
95          */

96         public void checkConnect(String JavaDoc host, int port, Object JavaDoc context) {
97         }
98
99         /*
100          * (non-Javadoc)
101          *
102          * @see java.lang.SecurityManager#checkConnect(java.lang.String, int)
103          */

104         public void checkConnect(String JavaDoc host, int port) {
105         }
106     }
107 }
108
Popular Tags