1 23 24 29 30 package com.sun.enterprise.server; 31 32 import java.util.Locale ; 33 import java.util.StringTokenizer ; 34 import junit.framework.*; 35 import junit.textui.TestRunner; 36 import com.sun.enterprise.server.PEMain; 37 import com.sun.enterprise.util.SystemPropertyConstants; 38 39 43 public class PEMainTest extends TestCase { 44 45 public PEMainTest(String name) throws Exception 46 { 47 super(name); 48 } 49 50 51 public void testSetSystemLocale() { 52 String [] array = {"en_US","en_US__567_89","sp_SP","fr_FR_WIN","","FR_FR_UNIX"}; 53 for(int i = 0;i < array.length;i++) { 54 System.setProperty(SystemPropertyConstants.DEFAULT_LOCALE_PROPERTY,array[i]); 55 PEMain.setSystemLocale(); 56 if(array[i].equals("")) { 57 Assert.assertTrue(Locale.getDefault().toString(). 59 equalsIgnoreCase(array[i-1])); 60 } else { 61 Assert.assertTrue(Locale.getDefault().toString(). 62 equalsIgnoreCase(System.getProperty( 63 SystemPropertyConstants.DEFAULT_LOCALE_PROPERTY))); 64 } 65 } 67 } 68 119 protected void setUp() 120 { 121 } 122 123 protected void tearDown() 124 { 125 } 126 127 public static junit.framework.Test suite() 128 { 129 TestSuite suite = new TestSuite(PEMainTest.class); 130 return suite; 131 } 132 133 public static void main(String args[]) throws Exception 134 { 135 final TestRunner runner= new TestRunner(); 136 final TestResult result = runner.doRun(PEMainTest.suite(), false); 137 System.exit(result.errorCount() + result.failureCount()); 138 } 139 140 } 141 | Popular Tags |