1 package org.codehaus.xfire.client.http; 2 3 import junit.framework.TestCase; 4 5 /*** 6 * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a> 7 * @since Oct 26, 2004 8 */ 9 public class RestTest 10 extends TestCase 11 { 12 public void testREST() 13 throws Exception 14 { 15 SinkHandler handler = new SinkHandler(); 16 RestTestClient client = new RestTestClient( handler ); 17 18 client.invoke(); 19 20 String res = handler.getResponse(); 21 System.out.println(res); 22 assertNotNull(res); 23 assertTrue( res.indexOf("echo") != -1 ); 24 } 25 26 public void testAmazon() 27 throws Exception 28 { 29 SinkHandler handler = new SinkHandler(); 30 String url = "http://webservices.amazon.com/onca/xml?Service=AWSECommerceService" 31 + "&SubscriptionId=1E5AY4ZG53H4AMC8QH82" 32 + "&Operation=ItemSearch" 33 + "&SearchIndex=Books" 34 + "&Keywords=SOAP"; 35 36 RestHttpClient client = new RestHttpClient( handler, url ); 37 38 client.invoke(); 39 40 String res = handler.getResponse(); 41 System.out.println(res); 42 assertNotNull(res); 43 assertTrue( res.indexOf("ItemSearchResponse") != -1 ); 44 } 45 }