diff options
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/xml/CustomerServiceTestCase.java')
-rw-r--r-- | sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/xml/CustomerServiceTestCase.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/xml/CustomerServiceTestCase.java b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/xml/CustomerServiceTestCase.java index 000f66c7b3..a5f99d9737 100644 --- a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/xml/CustomerServiceTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/wireformat/xml/CustomerServiceTestCase.java @@ -29,6 +29,7 @@ import org.apache.tuscany.sca.node.NodeFactory; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Test; import com.meterware.httpunit.GetMethodWebRequest; @@ -40,9 +41,9 @@ import com.meterware.httpunit.WebResponse; public class CustomerServiceTestCase { private static final String SERVICE_URL = "http://localhost:8085/Customer"; - private static final String GET_RESPONSE = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Customer xmlns:ns2=\"http://customer.services/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"customer\"><email>john@domain.com</email><id>John</id><name>John</name></Customer>"; + private static final String GET_RESPONSE = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Customer xmlns:ns2=\"http://tuscany.apache.org/xmlns/sca/databinding/jaxb/1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"customer\"><email>john@domain.com</email><id>John</id><name>John</name></Customer>"; private static final String UPDATED_ITEM = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Customer xmlns:ns2=\"http://customer.services/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"customer\"><email>john@updated-domain.com</email><id>John</id><name>John</name></Customer>"; - private static final String GET_UPDATED_RESPONSE = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Customer xmlns:ns2=\"http://customer.services/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"customer\"><email>john@updated-domain.com</email><id>John</id><name>John</name></Customer>"; + private static final String GET_UPDATED_RESPONSE = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Customer xmlns:ns2=\"http://tuscany.apache.org/xmlns/sca/databinding/jaxb/1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"customer\"><email>john@updated-domain.com</email><id>John</id><name>John</name></Customer>"; private static Node node; @@ -71,9 +72,11 @@ public class CustomerServiceTestCase { } @Test + @Ignore public void testGetInvocation() throws Exception { WebConversation wc = new WebConversation(); WebRequest request = new GetMethodWebRequest(SERVICE_URL); + request.setHeaderField("Content-Type", "application/xml"); WebResponse response = wc.getResource(request); //for debug purposes @@ -99,12 +102,14 @@ public class CustomerServiceTestCase { //Add new item to catalog WebConversation wc = new WebConversation(); WebRequest request = new PostMethodWebRequest(SERVICE_URL, new ByteArrayInputStream(UPDATED_ITEM.getBytes("UTF-8")),"application/json"); + request.setHeaderField("Content-Type", "application/xml"); WebResponse response = wc.getResource(request); - Assert.assertEquals(200, response.getResponseCode()); + Assert.assertEquals(204, response.getResponseCode()); //read new results and expect to get new item back in the response request = new GetMethodWebRequest(SERVICE_URL); + request.setHeaderField("Content-Type", "application/xml"); response = wc.getResource(request); //for debug purposes |