1 package test.wsdl.qnameser; 2 3 import org.apache.axis.client.AdminClient; 4 import org.apache.axis.components.logger.LogFactory; 5 import org.apache.axis.message.MessageElement; 6 import org.apache.axis.message.Text; 7 import org.apache.axis.utils.Options; 8 import org.apache.commons.logging.Log; 9 import org.apache.log4j.Logger; 10 11 import javax.xml.namespace.QName ; 12 import java.io.FileInputStream ; 13 import java.io.FileNotFoundException ; 14 import java.io.InputStream ; 15 import java.util.Calendar ; 16 17 public class QNameSerTestCase extends junit.framework.TestCase { 18 19 public QNameSerTestCase(String name) { 20 super(name); 21 } 22 23 public void testQName() throws Exception { 24 PlanWSSoap binding; 25 try { 26 PlanWSLocator locator = new PlanWSLocator(); 27 binding = locator.getPlanWSSoap(); 28 deployServer(); 29 } 30 catch (javax.xml.rpc.ServiceException jre) { 31 throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); 32 } 33 catch (Exception e) { 34 throw new junit.framework.AssertionFailedError("Binding initialization Exception caught: " + e); 35 } 36 assertTrue("binding is null", binding != null); 37 38 binding.getPlan(PlanService.Q_1); 39 binding.getPlan(PlanService.Q_2); 40 binding.getPlan(PlanService.Q_3); 41 } 42 43 44 public void testQNameList() throws Exception { 45 PlanWSSoap binding; 46 try { 47 PlanWSLocator locator = new PlanWSLocator(); 48 binding = locator.getPlanWSSoap(); 49 deployServer(); 50 } 51 catch (javax.xml.rpc.ServiceException jre) { 52 throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); 53 } 54 catch (Exception e) { 55 throw new junit.framework.AssertionFailedError("Binding initialization Exception caught: " + e); 56 } 57 assertTrue("binding is null", binding != null); 58 59 QName [] list = 60 new QName [] {PlanService.Q_1, PlanService.Q_2, PlanService.Q_3}; 61 GetMPlan in = new GetMPlan(list); 62 binding.getMPlan(in); 63 } 64 65 private void deployServer() { 66 final String INPUT_FILE = "server-deploy.wsdd"; 67 68 InputStream is = getClass().getResourceAsStream(INPUT_FILE); 69 if (is == null) { 70 try { 72 is = new FileInputStream (INPUT_FILE); 73 } catch (FileNotFoundException e) { 74 is = null; 75 } 76 } 77 assertNotNull("Unable to find " + INPUT_FILE + ". Make sure it is on the classpath or in the current directory.", is); 78 AdminClient admin = new AdminClient(); 79 try { 80 Options opts = new Options( null ); 81 opts.setDefaultURL("http://localhost:8080/axis/services/AdminService"); 82 admin.process(opts, is); 83 } catch (Exception e) { 84 assertTrue("Unable to deploy " + INPUT_FILE + ". ERROR: " + e, false); 85 } 86 } 87 88 } 89 90 | Popular Tags |