1 57 58 package buy; 59 60 import junit.framework.Test; 61 import junit.framework.TestCase; 62 import junit.framework.TestSuite; 63 64 import org.apache.wsif.WSIFService; 65 import org.apache.wsif.WSIFServiceFactory; 66 import org.apache.wsif.util.WSIFPluggableProviders; 67 import util.TestUtilities; 68 69 73 public class BuyTest extends TestCase { 74 String wsdlLocation = 75 TestUtilities.getWsdlPath("java\\test\\buy") + "buy.wsdl"; 76 77 public BuyTest(String name) { 78 super(name); 79 } 80 81 public static void main(String [] args) { 82 junit.textui.TestRunner.run(suite()); 83 } 84 85 public static Test suite() { 86 return new TestSuite(BuyTest.class); 87 } 88 89 public void setUp() { 90 TestUtilities.setUpExtensionsAndProviders(); 91 } 92 93 public void testSoapJms() { 94 doit("JMSPort", "soap"); 95 } 96 public void testAxisJms() { 97 doit("JMSPort", "axis"); 98 } 99 100 private void doit(String portName, String protocol) { 101 if (portName.indexOf("JMS") != -1 && !TestUtilities.areWeTesting("jms")) 102 return; 103 104 TestUtilities.setProviderForProtocol( protocol ); 105 106 try { 107 WSIFServiceFactory factory = WSIFServiceFactory.newInstance(); 108 WSIFService service = factory.getService(wsdlLocation, null, null, "http://www.buyservice.com/buy-interface", "buyService"); 113 System.err.println("\n\nUsing '" + portName + "' port:"); 114 buyService stub = (buyService) service.getStub(portName, buyService.class); 115 116 String resp = stub.buy("IBM", 100); 117 System.out.println("\nResponse >> " + resp); 118 } catch (Exception e) { 119 System.err.println("StockquoteTest(" + portName + ") caught exception " + e); 120 e.printStackTrace(); 121 assertTrue(false); 122 } 123 124 TestUtilities.resetDefaultProviders(); 125 126 } 127 128 } 129 | Popular Tags |