1 16 17 package test.functional; 18 19 import junit.framework.TestCase; 20 import org.apache.axis.client.AdminClient; 21 import org.apache.axis.components.logger.LogFactory; 22 import org.apache.commons.logging.Log; 23 import samples.faults.EmployeeClient; 24 25 26 27 29 public class TestFaultsSample extends TestCase { 30 static Log log = 31 LogFactory.getLog(TestFaultsSample.class.getName()); 32 33 public TestFaultsSample(String name) { 34 super(name); 35 } 36 37 public void doTestDeploy () throws Exception { 38 String [] args = { "samples/faults/deploy.wsdd" }; 39 AdminClient.main(args); 40 } 41 42 public void doTest1 () throws Exception { 43 String [] args = { "#001" }; 44 EmployeeClient.main(args); 45 } 46 47 public void doTest2 () throws Exception { 48 String [] args = { "#002" }; 49 try { 50 EmployeeClient.main(args); 51 } catch (samples.faults.NoSuchEmployeeFault nsef) { 52 return; 53 } 54 fail("Should not reach here"); 55 } 56 57 public void testFaultsService () throws Exception { 58 try { 59 log.info("Testing faults sample."); 60 log.info("Testing deployment..."); 61 doTestDeploy(); 62 log.info("Testing service..."); 63 doTest1(); 64 doTest2(); 65 log.info("Test complete."); 66 } 67 catch( Exception e ) { 68 e.printStackTrace(); 69 throw new Exception ("Fault returned from test: "+e); 70 } 71 } 72 73 public static void main(String [] args) throws Exception { 74 TestFaultsSample tester = new TestFaultsSample("test"); 75 tester.testFaultsService(); 76 } 77 } 78 79 | Popular Tags |