1 25 26 package org.objectweb.jonas.jonasadmin.test.template; 27 28 import junit.framework.TestSuite; 29 30 import org.objectweb.jonas.jonasadmin.test.util.JonasAdminAuth; 31 import org.objectweb.jonas.jonasadmin.test.util.JonasAdminTestCase; 32 33 import com.meterware.httpunit.HttpUnitOptions; 34 import com.meterware.httpunit.WebConversation; 35 import com.meterware.httpunit.WebLink; 36 import com.meterware.httpunit.WebResponse; 37 import com.meterware.httpunit.WebTable; 38 39 44 public class F_JonasAdminTemplate extends JonasAdminTestCase { 45 46 50 public F_JonasAdminTemplate(String s) { 51 super(s, URL_JONASADMIN); 52 } 53 54 59 public F_JonasAdminTemplate(WebConversation wc, String s) { 60 super(wc, s, URL_JONASADMIN); 61 } 62 63 67 public static void main(String [] args) { 68 69 String testtorun = null; 70 for (int argn = 0; argn < args.length; argn++) { 72 String sArg = args[argn]; 73 if (sArg.equals("-n")) { 74 testtorun = args[++argn]; 75 } 76 } 77 if (testtorun == null) { 78 junit.textui.TestRunner.run(suite()); 79 } else { 80 83 junit.textui.TestRunner.run(new F_JonasAdminTemplate(testtorun)); 84 } 85 } 86 87 91 public static TestSuite suite() { 92 95 return new TestSuite(F_JonasAdminTemplate.class); 96 } 97 98 103 public static TestSuite suite(WebConversation wc) { 104 TestSuite suite = new TestSuite(); 105 108 suite.addTest(new F_JonasAdminTemplate(wc, "testTemplate")); 109 return suite; 110 } 111 112 117 protected void setUp() throws Exception { 118 super.setUp(); 119 120 if (wc.getCurrentPage().getURL() == null) { 121 useWar("jonasAdmin"); 122 try { 124 JonasAdminAuth.doValidAuth(wc, url); 125 } catch (Exception e) { 126 fail("authentification failed : " + e); 127 } 128 } else { 129 try { 131 wc.getFrameContents(FRAME_TREE); 132 } catch (Exception e) { 133 wc.getResponse(urlLogOut); 134 try { 136 JonasAdminAuth.doValidAuth(wc, url); 137 } catch (Exception auth) { 138 fail("authentification failed : " + auth); 139 } 140 } 141 } 142 } 143 144 149 public void testTemplate() throws Exception { 150 151 WebResponse wr; 152 WebLink link; 153 WebTable table; 154 157 159 HttpUnitOptions.setExceptionsThrownOnScriptError(false); 161 HttpUnitOptions.setExceptionsThrownOnErrorStatus(false); 163 164 167 168 } 169 170 174 public void tearDown() throws Exception { 175 176 } 177 178 } 179 | Popular Tags |