1 26 27 package org.objectweb.jonas.examples.clients.hibernate; 28 29 import junit.framework.TestSuite; 30 31 import org.objectweb.jonas.examples.util.JExampleTestCase; 32 33 import com.meterware.httpunit.WebResponse; 34 35 40 public class F_Hibernate extends JExampleTestCase { 41 42 45 private static final String URL_HIBERNATE = "/hibernate-sample/testHibernate"; 46 47 51 public static void main(String [] args) { 52 53 String testtorun = null; 54 for (int argn = 0; argn < args.length; argn++) { 56 String sArg = args[argn]; 57 if (sArg.equals("-n")) { 58 testtorun = args[++argn]; 59 } 60 } 61 62 if (testtorun == null) { 63 junit.textui.TestRunner.run(suite()); 64 } else { 65 junit.textui.TestRunner.run(new F_Hibernate(testtorun)); 66 } 67 } 68 69 73 public static TestSuite suite() { 74 return new TestSuite(F_Hibernate.class); 75 } 76 77 82 protected void setUp() throws Exception { 83 super.setUp(); 84 useWar("hibernate-sample"); 85 } 86 87 91 public F_Hibernate(String s) { 92 super(s, URL_HIBERNATE); 93 } 94 95 99 public void testAccessHibernatePage() throws Exception { 100 WebResponse wr = wc.getResponse(url); 101 String page = wr.getText(); 102 103 if (page.indexOf("Servlet is OK") == -1) { 105 fail("Missing 'Servlet is OK' ending text. Check on " + this.url); 106 } 107 108 } 109 110 } 111 | Popular Tags |