1 25 package testsuite.regression; 26 27 import java.util.Properties ; 28 29 import sun.applet.AppletSecurity; 30 import testsuite.BaseTestCase; 31 32 39 public class AppletRegressionTest extends BaseTestCase { 40 private final static String TOGGLE_RUN_PROPERTY = "com.mysql.jdbc.testsuite.regression.runAppletRegressionTest"; 41 42 47 public AppletRegressionTest(String name) { 48 super(name); 49 50 } 52 53 58 public static void main(String [] args) { 59 System.setProperty(TOGGLE_RUN_PROPERTY, "true"); 60 junit.textui.TestRunner.run(AppletRegressionTest.class); 61 } 62 63 69 public void testAppletSecurityManager() throws Exception { 70 if ("true".equalsIgnoreCase(System.getProperty(TOGGLE_RUN_PROPERTY))) { 71 System.setSecurityManager(new CustomAppletSecurity()); 72 73 getConnectionWithProps(new Properties ()); 74 } 75 } 76 77 81 class CustomAppletSecurity extends AppletSecurity { 82 87 public synchronized void checkAccess(Thread arg0) { 88 } 89 90 96 public void checkConnect(String host, int port, Object context) { 97 } 98 99 104 public void checkConnect(String host, int port) { 105 } 106 } 107 } 108 | Popular Tags |