diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-11-16 21:31:40 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-11-16 21:31:40 +0000 |
commit | 2db586f49d9d27ee249d3862189102b393b7846b (patch) | |
tree | 09186050ff94a96ae19a88422b63baa458e3f2dd /sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java | |
parent | 3b13b2066f00bdf9f1a65c5402cb7aa5e2fa5710 (diff) |
Investigating migration to wink 1.2-SNAPSHOT
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1035822 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/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 | 30 |
1 files changed, 15 insertions, 15 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 c6e487596b..cd69cd0c41 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 @@ -6,15 +6,15 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations - * under the License. + * under the License. */ package org.apache.tuscany.sca.binding.rest.wireformat.xml; @@ -42,8 +42,8 @@ public class CustomerServiceTestCase { 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://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 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; @BeforeClass @@ -63,15 +63,15 @@ public class CustomerServiceTestCase { node.stop(); } } - + @Test public void testPing() throws Exception { new Socket("127.0.0.1", 8085); //System.in.read(); } - + @Test - public void testGetInvocation() throws Exception { + public void testGetInvocation() throws Exception { WebConversation wc = new WebConversation(); WebRequest request = new GetMethodWebRequest(SERVICE_URL); request.setHeaderField("Content-Type", "application/xml"); @@ -82,20 +82,20 @@ public class CustomerServiceTestCase { //for(String headerField : response.getHeaderFieldNames()) { // System.out.println(">>> Header:" + headerField + " - " + response.getHeaderField(headerField)); //} - + //for debug purposes - //System.out.println(">>>" + GET_RESPONSE); - //System.out.println(">>>" + response.getText()); + System.out.println(">>>" + GET_RESPONSE); + System.out.println(">>>" + response.getText()); Assert.assertEquals(200, response.getResponseCode()); Assert.assertEquals("no-cache", response.getHeaderField("Cache-Control")); Assert.assertEquals("tuscany", response.getHeaderField("X-Tuscany")); Assert.assertEquals(GET_RESPONSE, response.getText()); - + } @Test - public void testPutInvocation() throws Exception { + public void testPutInvocation() throws Exception { //Add new item to catalog WebConversation wc = new WebConversation(); WebRequest request = new PostMethodWebRequest(SERVICE_URL, new ByteArrayInputStream(UPDATED_ITEM.getBytes("UTF-8")),"application/xml"); @@ -103,12 +103,12 @@ public class CustomerServiceTestCase { Assert.assertEquals(201, response.getResponseCode()); System.out.println(response.getHeaderField("Location")); - + //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 //System.out.println(">>>" + GET_UPDATED_RESPONSE); //System.out.println(">>>" + response.getText()); |