1 22 23 package org.objectweb.jonas.examples.clients.sampleCluster2; 24 25 import junit.framework.TestSuite; 26 27 import org.objectweb.jonas.examples.util.JExampleTestCase; 28 29 import com.meterware.httpunit.WebResponse; 30 31 35 public class F_SampleCluster2 extends JExampleTestCase { 36 37 40 private static final String URL_EARSAMPLE = "/sampleCluster2"; 41 42 46 public F_SampleCluster2(String s) { 47 super(s, URL_EARSAMPLE); 48 } 49 50 54 public static void main(String [] args) { 55 56 String testtorun = null; 57 for (int argn = 0; argn < args.length; argn++) { 59 String sArg = args[argn]; 60 if (sArg.equals("-n")) { 61 testtorun = args[++argn]; 62 } 63 } 64 65 if (testtorun == null) { 66 junit.textui.TestRunner.run(suite()); 67 } else { 68 junit.textui.TestRunner.run(new F_SampleCluster2(testtorun)); 69 } 70 } 71 72 76 public static TestSuite suite() { 77 return new TestSuite(F_SampleCluster2.class); 78 } 79 80 84 protected void setUp() throws Exception { 85 super.setUp(); 86 useEar("sampleCluster2"); 87 } 88 89 93 public void testIsFirstPageOk() throws Exception { 94 WebResponse wr = wc.getResponse(url); 95 String txt = wr.getText(); 96 97 if (txt.indexOf("<strong>Sample is OK.</strong>") == -1) { 98 fail("The example was not ok : " + txt); 99 } 100 } 101 102 106 public void testIsSessionOk() throws Exception { 107 WebResponse wr = wc.getResponse(url + "/servlet/session"); 108 String txt = wr.getText(); 109 110 if (txt.indexOf("<strong>Sample is OK.</strong>") == -1) { 111 fail("The example was not ok : " + txt); 112 } 113 } 114 115 119 public void testIsCheckOk() throws Exception { 120 WebResponse wr = wc.getResponse(url + "/servlet/check"); 121 String txt = wr.getText(); 122 123 if (txt.indexOf("<strong>Sample is OK.</strong>") == -1) { 124 fail("The example was not ok : " + txt); 125 } 126 } 127 128 132 public void testIsReleaseOk() throws Exception { 133 WebResponse wr = wc.getResponse(url + "/servlet/release"); 134 String txt = wr.getText(); 135 136 if (txt.indexOf("<strong>Sample is OK.</strong>") == -1) { 137 fail("The example was not ok : " + txt); 138 } 139 } 140 141 } 142 | Popular Tags |