1 package org.apache.axis2.engine; 2 3 import junit.framework.TestCase; 4 import org.apache.axis2.description.AxisDescWSDLComponentFactory; 5 import org.apache.axis2.description.ServiceDescription; 6 import org.apache.axis2.wsdl.builder.WOMBuilderFactory; 7 import org.apache.wsdl.WSDLDescription; 8 9 import java.io.File ; 10 import java.io.FileInputStream ; 11 import java.io.InputStream ; 12 import java.util.Iterator ; 13 30 31 36 public class ServiceDescriptionBuilderTest extends TestCase { 37 private ServiceDescription service = null; 38 39 private void initialize() throws Exception { 40 41 if (null == this.service) { 42 InputStream in = new FileInputStream (new File ("./test-resources/service.wsdl")) ; 43 if(in == null){ 44 throw new Exception ("Input Stream is null , fileNot Found") ; 45 } 46 WSDLDescription womDescription = WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11).build(in, new AxisDescWSDLComponentFactory()).getDescription(); 47 Iterator iterator = womDescription.getServices().keySet().iterator(); 48 if(iterator.hasNext()){ 49 this.service = (ServiceDescription)iterator.next(); 50 } 51 } 54 55 } 56 57 public void test(){ 58 try { 59 this.initialize(); 60 } catch (Exception e) { 61 e.printStackTrace(); 62 } 63 } 64 } 65 66 | Popular Tags |